예제 #1
0
        /// <summary>
        /// Copies the content of a script to here.
        /// </summary>
        /// <param name="from">The script to copy from.</param>
        /// <param name="forModification">If false, the script incl. compiled assembly is copied. If true,
        /// the compiled assembly is not copied, so that the script text can be modified.</param>
        public void CopyFrom(AbstractScript from, bool forModification)
        {
            if (object.ReferenceEquals(this, from))
            {
                return;
            }

            var oldScriptText = _scriptText;

            _scriptText = from._scriptText;
            _isDirty    = from._isDirty;

            _wasTriedToCompile = forModification ? false : from._wasTriedToCompile;

            _errors = from._errors;                                          // immutable

            _compilerResult = forModification ? null : from._compilerResult; // (not cloning is intented here)

            _scriptObject = CreateNewScriptObject();                         // we create a new script object, because we are unable to clone it

            if (oldScriptText != _scriptText)
            {
                EhSelfChanged(EventArgs.Empty);
            }
        }
예제 #2
0
            public object Deserialize(object o, Altaxo.Serialization.Xml.IXmlDeserializationInfo info, object parent)
            {
                AbstractScript s = (AbstractScript)o;

                s.m_ScriptText = info.GetString("Text");
                return(s);
            }
예제 #3
0
        public virtual IScriptText CloneForModification()
        {
            AbstractScript result = (AbstractScript)Clone();

            result._compilerResult = null;
            result.m_ScriptObject  = null;
            return(result);
        }
예제 #4
0
        public override bool Equals(object obj)
        {
            if (!(obj is AbstractScript))
            {
                return(base.Equals(obj));
            }
            AbstractScript script = (AbstractScript)obj;

            return(this.ScriptText.GetHashCode() == script.ScriptText.GetHashCode());
        }
예제 #5
0
        /// <summary>
        /// Copies the content of a script to here.
        /// </summary>
        /// <param name="from">The script to copy from.</param>
        /// <param name="forModification">If false, the script incl. compiled assembly is copied. If true,
        /// the compiled assembly is not copied, so that the script text can be modified.</param>
        public void CopyFrom(AbstractScript from, bool forModification)
        {
            this.m_ScriptText   = from.m_ScriptText;
            this.m_ScriptObject = from.m_ScriptObject;
            this.m_IsDirty      = from.m_IsDirty;

            this.m_WasTriedToCompile = forModification ? false : from.m_WasTriedToCompile;

            this.m_Errors = null == from.m_Errors ? null: (string[])from.m_Errors.Clone();

            this._compilerResult = forModification ? null :  from._compilerResult;// (not cloning is intented here)
        }
예제 #6
0
            public void Serialize(object obj, Altaxo.Serialization.Xml.IXmlSerializationInfo info)
            {
                AbstractScript s = (AbstractScript)obj;

                info.AddBaseValueEmbedded(s, typeof(AbstractScript));
            }
예제 #7
0
 /// <summary>
 /// Creates a column script as a copy from another script.
 /// </summary>
 /// <param name="from">The script to copy from.</param>
 /// <param name="forModification">If false, the script incl. compiled assembly is copied. If true,
 /// the compiled assembly is not copied, so that the script text can be modified.</param>
 public AbstractScript(AbstractScript from, bool forModification)
 {
     CopyFrom(from, forModification);
 }
예제 #8
0
 /// <summary>
 /// Creates a column script as a copy from another script.
 /// </summary>
 /// <param name="from">The script to copy from.</param>
 public AbstractScript(AbstractScript from)
     : this(from, false)
 {
 }
예제 #9
0
            public void Serialize(object obj, Altaxo.Serialization.Xml.IXmlSerializationInfo info)
            {
                AbstractScript s = (AbstractScript)obj;

                info.AddValue("Text", s.m_ScriptText);
            }
예제 #10
0
		/// <summary>
		/// Copies the content of a script to here.
		/// </summary>
		/// <param name="from">The script to copy from.</param>
		/// <param name="forModification">If false, the script incl. compiled assembly is copied. If true,
		/// the compiled assembly is not copied, so that the script text can be modified.</param>
		public void CopyFrom(AbstractScript from, bool forModification)
		{
			if (object.ReferenceEquals(this, from))
				return;

			var oldScriptText = _scriptText;
			this._scriptText = from._scriptText;
			this._scriptObject = from._scriptObject;
			this._isDirty = from._isDirty;

			this._wasTriedToCompile = forModification ? false : from._wasTriedToCompile;

			this._errors = null == from._errors ? null : (string[])from._errors.Clone();

			this._compilerResult = forModification ? null : from._compilerResult; // (not cloning is intented here)

			if (oldScriptText != _scriptText)
				EhSelfChanged(EventArgs.Empty);
		}
예제 #11
0
		/// <summary>
		/// Creates a column script as a copy from another script.
		/// </summary>
		/// <param name="from">The script to copy from.</param>
		/// <param name="forModification">If false, the script incl. compiled assembly is copied. If true,
		/// the compiled assembly is not copied, so that the script text can be modified.</param>
		public AbstractScript(AbstractScript from, bool forModification)
		{
			CopyFrom(from, forModification);
		}
예제 #12
0
		/// <summary>
		/// Creates a column script as a copy from another script.
		/// </summary>
		/// <param name="from">The script to copy from.</param>
		public AbstractScript(AbstractScript from)
			: this(from, false)
		{
		}
예제 #13
0
 /// <summary>
 /// Copies the content of a script to here.
 /// </summary>
 /// <param name="from">The script to copy from.</param>
 /// <param name="forModification">If false, the script incl. compiled assembly is copied. If true,
 /// the compiled assembly is not copied, so that the script text can be modified.</param>
 public void CopyFrom(AbstractScript from, bool forModification)
 {
   this.m_ScriptText  = from.m_ScriptText;
   this.m_ScriptObject   = from.m_ScriptObject;
   this.m_IsDirty = from.m_IsDirty;
   
   this.m_WasTriedToCompile = forModification ? false : from.m_WasTriedToCompile;
   
   this.m_Errors   = null==from.m_Errors ? null: (string[])from.m_Errors.Clone();
   
   this._compilerResult = forModification ? null :  from._compilerResult; // (not cloning is intented here)
 }