Example #1
0
        protected void RegisterVariable(string name, object value, string category = null)
        {
            if (name == null)
            {
                throw new ArgumentNullException(nameof(name));
            }
            if (value == null)
            {
                throw new ArgumentNullException(nameof(value));
            }
            var names = name.Split(',');

            KalkDescriptor descriptor = null;

            foreach (var subName in names)
            {
                Content.SetValue(subName, value, true);

                if (descriptor == null || !Descriptors.TryGetValue(names[0], out descriptor))
                {
                    descriptor = new KalkDescriptor();
                }
                Descriptors.Add(subName, descriptor);
                descriptor.Names.Add(subName);
            }
        }
Example #2
0
 protected KalkModule(string name)
 {
     Name = name;
     if (Name == null)
     {
         Name = this.GetType().Name;
         if (Name.EndsWith("Module"))
         {
             Name = Name.Substring(0, Name.Length - "Module".Length);
         }
     }
     Descriptors = new Dictionary <string, KalkDescriptor>();
     Descriptor  = new KalkDescriptor()
     {
         Names = { Name }
     };
 }