Exemple #1
0
        /// <summary>
        /// Write the content of this key to an output stream in .REG file format
        /// </summary>
        /// <param name="output">Output stream</param>
        /// <param name="options">Export options</param>
        public void WriteRegFileFormat(TextWriter output, RegFileExportOptions options)
        {
            List <string> names;
            bool          skipThisEntry = false;

            if ((options & RegFileExportOptions.NoEmptyKeys) == RegFileExportOptions.NoEmptyKeys)
            {
                skipThisEntry = Values.Keys.Count == 0;
                System.Console.WriteLine("skipThisEntry: {0}", skipThisEntry);
            }


            if (!skipThisEntry && !string.IsNullOrEmpty(Name))
            {
                if (RemoveFlag)
                {
                    output.WriteLine("[-{0}]", Path);
                }
                else
                {
                    output.WriteLine("[{0}]", Path);
                    if (DefaultValue != null)
                    {
                        DefaultValue.WriteRegFileFormat(output);
                    }

                    names = Values.Keys.ToList <string>();
                    names.Sort();
                    foreach (string name in names)
                    {
                        Values[name].WriteRegFileFormat(output);
                    }
                }
                output.WriteLine();
            }
            else
            {
                System.Console.WriteLine("SKIPPED");
            }

            names = Keys.Keys.ToList <string>();
            names.Sort();
            foreach (string name in names)
            {
                Keys[name].WriteRegFileFormat(output, options);
            }
        }