Пример #1
0
        private void cmdSave_Click(object sender, EventArgs e)
        {
            var uri = @"C:\Temp\UtiliTree.txt";
            var ini = new IniProcessor(uri);

            ini.Write("UtiliTree", "A.Dll", "1,2,3,4");
            ini.Write("UtiliTree", "B.Dll", "1,6,255");
        }
Пример #2
0
        private void cmdCreate_Click(object sender, EventArgs e)
        {
            //[.ShellClassInfo]
            //IconResource = C:\Windows\System32\shell32.dll,21

            var uri = @"C:\Temp\UtiliTree\desktop.ini";

            if (File.Exists(uri))
            {
                File.Delete(uri);
            }

            var ini = new IniProcessor(uri);

            ini.Write(".ShellClassInfo", "IconResource", @"C:\Windows\System32\shell32.dll,76");

            /*
             * using (TextWriter file = File.CreateText(uri))
             * {
             *      file.WriteLine("[.ShellClassInfo]");
             *      file.WriteLine(@"C:\Windows\System32\shell32.dll,26");
             * }
             */
            File.SetAttributes(uri, FileAttributes.System | FileAttributes.Hidden);
        }
Пример #3
0
        private void SetIcon(string key)
        {
            var dot  = key.IndexOf(".");
            var id   = Convert.ToInt32(key.Substring(0, dot));
            var name = key.Substring(dot + 1);

            var uri = @"C:\Temp\UtiliTree\desktop.ini";

            if (File.Exists(uri))
            {
                File.Delete(uri);
            }

            var ini = new IniProcessor(uri);

            var res = @"C:\Windows\System32\" + name + ".dll," + id.ToString();

            ini.Write(".ShellClassInfo", "IconResource", res);

            File.SetAttributes(uri, FileAttributes.System | FileAttributes.Hidden);
        }