Inheritance: System.EventArgs
示例#1
0
 private void OnVarAccess(VarAccessEventArgs args)
 {
     if (VarAccess != null)
     {
         VarAccess(args);
     }
 }
示例#2
0
        public void Declare(string name, T value)
        {
            VarAccessEventArgs eventArgs = new VarAccessEventArgs();

            OnVarAccess(eventArgs);

            variables[VarNameToInstancedName(name, eventArgs)] = value;
        }
示例#3
0
        private string VarNameToInstancedName(string name, VarAccessEventArgs args)
        {
            for (int i = 0; i < args.Instances.Count; i++)
            {
                name += RepeatedSuffix + args.Instances[i].ToString();
            }

            return(name);
        }
示例#4
0
        public DictionaryKeyValueObserver <string, T> GetRange(string name)
        {
            VarAccessEventArgs eventArgs = new VarAccessEventArgs();

            OnVarAccess(eventArgs);

            string instancedName = VarNameToInstancedName(name, eventArgs) + RepeatedSuffix;

            return(new DictionaryKeyValueObserver <string, T>(variables, (kv) => kv.Key.StartsWith(instancedName)));
        }
示例#5
0
        public T GetDeclared(string name)
        {
            VarAccessEventArgs eventArgs = new VarAccessEventArgs();

            OnVarAccess(eventArgs);

            if (eventArgs.IsInstanced)
            {
                string instancedName = VarNameToInstancedName(name, eventArgs);

                for (string stepName = instancedName; stepName.IndexOf(RepeatedSuffix) >= 0; stepName = stepName.Substring(0, stepName.LastIndexOf(RepeatedSuffix)))
                {
                    if (variables.ContainsKey(stepName))
                    {
                        return(variables[stepName]);
                    }
                }
            }

            return(variables[name]);
        }