Пример #1
0
 public void GlobalValueChanged(GlobalValue globalValue)
 {
     if (mTestContext.FullyInitialized)
     {
         mFileIsOutdated = true;
     }
 }
Пример #2
0
        public void LoadDataFromFile()
        {
            if (writer != null)
            {
                CloseFileFromWriting();
            }
            try
            {
                mTestContext.LogMessage("Loading retentive file...");
                reader = new StreamReader(mTestContext.Name + ".ret");
                do
                {
                    // csline is case sensitive, while line is in lowercase
                    string line = reader.ReadLine().Trim();

                    try
                    {
                        int assignmentIndex = line.IndexOf("=");
                        if (assignmentIndex < 0)
                        {
                            mTestContext.LogError("Line in Data Value Retention File is missing an '=' sign.  Line='" + line + "'");
                            continue;
                        }
                        string dataValueName     = line.Substring(0, assignmentIndex).Trim();
                        string dataValueAsString = line.Substring(assignmentIndex + 1).Trim();

                        GlobalValue globalValue = mTestContext.GetGlobalValueIfExists(dataValueName);
                        if (globalValue == null)
                        {
                            mTestContext.LogWarning("GlobalValue '" + dataValueName + "' exists in the retentive file, but not in the test context.");
                        }
                        else if (globalValue.IsRetentive)
                        {
                            globalValue.Value = dataValueAsString;
                        }
                    }
                    catch (Exception e)
                    {
                        mTestContext.LogError("Problem processing line in data value retentive file. Line='" + line + "'. Message=" + e.Message);
                    }
                } while (reader.Peek() != -1);
            }
            catch (Exception e)
            {
                mTestContext.LogError("Problem reading data value retentive file. Message=" + e.Message);
            }
            finally
            {
                if (reader != null)
                {
                    reader.Close();
                    reader.Dispose();
                    reader = null;
                }
            }
        }
Пример #3
0
        public virtual GlobalValue GetGlobalValue(string theName)
        {
            GlobalValue result = GetGlobalValueIfExists(theName);

            if (result == null)
            {
                throw new ArgumentException("GlobalValue '" + theName + "' does not exist.");
            }
            return(result);
        }
Пример #4
0
 public void UnregisterGlobalValue(GlobalValue theValue)
 {
     theValue.GlobalValueChanged -= new GlobalValue.GlobalValueDelegate(GlobalValueChanged);
     if (mTestContext.mGlobalValues.Count == 0)
     {
         // if there are no globals left after this one, disable the timer
         // warning: this assumes they are unregistered from mTestContext.mGlobalValues before we get here
         mUpdateTimer.Enabled = false;
     }
 }
Пример #5
0
        public override GlobalValue GetGlobalValue(string theName)
        {
            GlobalValue result = base.GetGlobalValueIfExists(theName);

            if (result == null)
            {
                result = mProject.GetGlobalValue(theName);
            }
            return(result);
        }
Пример #6
0
        public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, System.Type destinationType)
        {
            if (destinationType == typeof(System.String) &&
                value is GlobalValue)
            {
                GlobalValue globalValue = (GlobalValue)value;

                return(globalValue.Name);
            }
            return(base.ConvertTo(context, culture, value, destinationType));
        }
Пример #7
0
 public void UnRegisterGlobalValue(GlobalValue theGlobalValue)
 {
     mGlobalValues.Remove(theGlobalValue); // WARNING: the implementation of mDataValueRetentionFile.UnregisterGlobalValue(value) assumes we remove the value from mGlobalValues before calling the unregister method
     mDataValueRetentionFile.UnregisterGlobalValue(theGlobalValue);
 }
Пример #8
0
 public void RegisterGlobalValue(GlobalValue theGlobalValue)
 {
     mGlobalValues.Add(theGlobalValue);
     mDataValueRetentionFile.RegisterGlobalValue(theGlobalValue);
 }
Пример #9
0
 public void RegisterGlobalValue(GlobalValue theValue)
 {
     // NOTE: timer isn't enabled until the first value is registered.  It is possible to be re-enabled during a save, but that shouldn't be a problem unless the timer interval is REALLY short
     mUpdateTimer.Enabled         = true;
     theValue.GlobalValueChanged += new GlobalValue.GlobalValueDelegate(GlobalValueChanged);
 }
Пример #10
0
 public LiveValueGetter(GlobalValue theGlobalValue)
 {
     mGlobalValue = theGlobalValue;
 }
Пример #11
0
 public AtTriggerValueGetter(GlobalValue theGlobalValue)
 {
     mGlobalValue = theGlobalValue;
     mDataType    = mGlobalValue.Type; // moved here 6/27/08 since Type for value objects must be known when mathops are created when the execution is created
 }