Пример #1
0
            void CreateGlowParameter(Item item, int[] path, int? number, int fields, GlowElementCollectionBase parent)
            {
                var glowValue = null as GlowValue;
                var isWriteable = false;

                if((fields & GlowFieldFlags.Value) != 0)
                {
                   var valueKind = item.Parent.Key.GetValueKind(item.Name);
                   var value = item.Parent.Key.GetValue(item.Name);

                   switch(valueKind)
                   {
                  case RegistryValueKind.Binary:
                     glowValue = new GlowValue((byte[])value);
                     break;
                  case RegistryValueKind.DWord:
                     glowValue = new GlowValue((long)(int)value);
                     isWriteable = true;
                     break;
                  case RegistryValueKind.ExpandString:
                     glowValue = new GlowValue((string)value);
                     break;
                  case RegistryValueKind.MultiString:
                     glowValue = new GlowValue(String.Join("\n", (string[])value));
                     break;
                  case RegistryValueKind.QWord:
                     glowValue = new GlowValue((long)value);
                     isWriteable = true;
                     break;
                  case RegistryValueKind.String:
                     glowValue = new GlowValue((string)value);
                     isWriteable = true;
                     break;
                   }
                }

                if(number != null)
                   path = path.Concat(new[] { number.Value }).ToArray();

                var glow = new GlowQualifiedParameter(path);

                if((fields & GlowFieldFlags.Identifier) != 0)
                   glow.Identifier = item.Identifier;

                if((fields & GlowFieldFlags.Description) != 0
                && String.IsNullOrEmpty(item.Name) == false)
                   glow.Description = item.Name;

                if(fields == GlowFieldFlags.All
                && isWriteable)
                   glow.Access = GlowAccess.ReadWrite;

                if(glowValue != null)
                   glow.Value = glowValue;

                parent.Insert(glow);
            }
Пример #2
0
            void CreateGlowNode(Item item, int[] path, int? number, int fields, GlowElementCollectionBase parent)
            {
                if(number != null)
                   path = path.Concat(new[] { number.Value }).ToArray();

                var glow = new GlowQualifiedNode(path);

                if((fields & GlowFieldFlags.Identifier) != 0)
                   glow.Identifier = item.Identifier;

                if((fields & GlowFieldFlags.Description) != 0
                && String.IsNullOrEmpty(item.Name) == false)
                   glow.Description = item.Name;

                parent.Insert(glow);
            }