Click here to Skip to main content
Click here to Skip to main content
Articles » Languages » C# » General » Downloads
 
Add your own
alternative version

Conscript: An embeddable, compiled scripting language for .NET

, 5 Sep 2008 CPOL
An API for enhancing any .NET application with a scripting language
conscript_api_and_demo_source.zip
Conscript_API_&_Demo_Source
Conscript
ConscriptDemo
Conscript.ico
Properties
Settings.settings
vssver2.scc
Resources
Conscript.ico
vssver2.scc
vssver2.scc
Collections
vssver2.scc
Compiler
vssver2.scc
Conscript.doxyfile
Properties
vssver2.scc
Resources
Conscript.ico
vssver2.scc
Runtime
vssver2.scc
vssver2.scc
SampleScripts
BubbleSort.cns
Dungeon.cns
Factorial.cns
HelloWorld.cns
vssver2.scc
using System;
using System.Collections.Generic;
using System.Text;

namespace Conscript
{
    /// <summary>
    /// Generic script engine exception.
    /// </summary>
    public class ConscriptException
        : Exception
    {
        #region Private Variables

        private String m_strMessage;
        private Exception m_exceptionInner;

        #endregion

        #region Public Methods

        /// <summary>
        /// Constructs an exception
        /// </summary>
        public ConscriptException()
        {
            m_strMessage = "No details specified.";
            m_exceptionInner = null;
        }

        /// <summary>
        /// Constructs an exception with the given message.
        /// </summary>
        /// <param name="strMessage">Exception message.</param>
        public ConscriptException(String strMessage)
        {
            m_strMessage = strMessage;
            m_exceptionInner = null;
        }

        /// <summary>
        /// Constructs an exception with the given message
        /// and inner exception reference.
        /// </summary>
        /// <param name="strMessage">Exception message.</param>
        /// <param name="exceptionInner">Inner exception reference.</param>
        public ConscriptException(String strMessage, Exception exceptionInner)
        {
            m_strMessage = strMessage;
            m_exceptionInner = exceptionInner;
        }

        /// <summary>
        /// Returns a string representation of the exception.
        /// </summary>
        /// <returns>A string representation of the exception.</returns>
        public override string ToString()
        {
            return MessageTrace;
        }

        #endregion

        #region Public Properties

        /// <summary>
        /// Exception message.
        /// </summary>
        public new String Message
        {
            get { return m_strMessage; }
        }

        /// <summary>
        /// Complete message trace recursively including any
        /// inner exceptions.
        /// </summary>
        public String MessageTrace
        {
            get
            {
                if (m_exceptionInner != null)
                {
                    String strMessageTrace = m_strMessage + " Reason: ";
                    if (typeof(ConscriptException).IsAssignableFrom(
                        m_exceptionInner.GetType()))
                        strMessageTrace += ((ConscriptException) m_exceptionInner).MessageTrace;
                    else
                        strMessageTrace += m_exceptionInner.Message;
                    return strMessageTrace;
                }
                else
                    return m_strMessage;
            }
        }

        #endregion
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Colin Vella
Software Developer (Senior)
Malta Malta
No Biography provided

| Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.1411023.1 | Last Updated 5 Sep 2008
Article Copyright 2007 by Colin Vella
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid