Example #1
0
        /// <summary>
        ///		保存配置
        /// </summary>
        public static void Save()
        {
            if (!File.Exists("Data\\TUNTAP.ini"))
            {
                File.WriteAllBytes("Data\\TUNTAP.ini", Properties.Resources.defaultTUNTAP);
            }

            var parser = new IniParser.FileIniDataParser();
            var data   = parser.ReadFile("Data\\TUNTAP.ini");

            data["Generic"]["Address"] = Global.TUNTAP.Address.ToString();
            data["Generic"]["Netmask"] = Global.TUNTAP.Netmask.ToString();
            data["Generic"]["Gateway"] = Global.TUNTAP.Gateway.ToString();

            var dns = "";

            foreach (var ip in Global.TUNTAP.DNS)
            {
                dns += ip.ToString();
                dns += ',';
            }
            dns = dns.Trim();
            data["Generic"]["DNS"] = dns.Substring(0, dns.Length - 1);

            parser.WriteFile("Data\\TUNTAP.ini", data);

            File.WriteAllText("Data\\Servers.json", Newtonsoft.Json.JsonConvert.SerializeObject(Global.Servers));
        }
Example #2
0
        private void WriteDesktopIni(string path)
        {
            try
            {
                var iniPath  = Path.Combine(path, "desktop.ini");
                var iconPath = Path.Combine(path, Commons.IconFileName);

                var ini = new IniData();
                ini.Sections.AddSection(Commons.ShellClassInfoSection);
                ini.Sections[Commons.ShellClassInfoSection].AddKey("ConfirmFileOp", "0");
                ini.Sections[Commons.ShellClassInfoSection].AddKey("IconFile", Commons.IconFileName);
                ini.Sections[Commons.ShellClassInfoSection].AddKey("IconIndex", "0");
                ini.Sections[Commons.ShellClassInfoSection].AddKey("IconResource", $"{Commons.IconFileName},0");

                ForceDeleteFile(iniPath);
                var iniFile = new IniParser.FileIniDataParser();
                iniFile.WriteFile(iniPath, ini);

                Commons.RunNoException(() => File.SetAttributes(iconPath, FileAttributes.Hidden | FileAttributes.System));
                Commons.RunNoException(() => File.SetAttributes(iniPath, FileAttributes.Hidden | FileAttributes.System));
                Commons.RunNoException(() => File.SetAttributes(path, FileAttributes.System));
            }
            catch (Exception e)
            {
                Debug.Print("Error writing desktop.ini file: {0}. {1}", path, e.Message);
            }
        }
Example #3
0
        private void InjectIni(string sourceFilePath, string sectionName, IniParser.Model.SectionData translatedSectionData)
        {
            var stringIniParser = new IniParser.FileIniDataParser();

            stringIniParser.Parser.Configuration.AllowDuplicateKeys = true;
            stringIniParser.Parser.Configuration.SkipInvalidLines   = true;
            stringIniParser.Parser.Configuration.CommentRegex       = new System.Text.RegularExpressions.Regex("^;.*");

            var stringInidata = stringIniParser.ReadFile(sourceFilePath, Encoding.Default);

            foreach (var sectionKey in translatedSectionData.Keys)
            {
                var section = sectionKey.KeyName.Split('@').First();
                var key     = sectionKey.KeyName.Split('@').Last();
                var value   = sectionKey.Value.SanitizeQuotes().Trim();
                if (this.RemoveSpecialsChars)
                {
                    value = value.DeleteAccentAndSpecialsChar().RemoveDiacritics();
                }

                if (stringInidata.Sections.Any(s => s.SectionName == section))
                {
                    var iniSectionData = stringInidata.Sections.GetSectionData(section);
                    if (iniSectionData.Keys.Any(k => k.KeyName == key))
                    {
                        iniSectionData.Keys.GetKeyData(key).Value = value;
                    }
                }
            }

            stringIniParser.WriteFile(sourceFilePath, stringInidata, Encoding.Default);
        }
Example #4
0
        public void SaveToFile()
        {
            var parser   = new IniParser.FileIniDataParser();
            var filePath = Path.ChangeExtension(Path.Combine(FileSystem.GetMyConfigPath(), FileName), "ini");
            var data     = new IniData();

            WriteIniData(data);
            parser.WriteFile(filePath, data);
        }
Example #5
0
        public void Save()
        {
            var parser = new IniParser.FileIniDataParser();
            var data   = parser.ReadFile(Program.PATH + "settings.ini");

            data["settings"]["random"]         = Random.ToString();
            data["settings"]["speed"]          = IntervalId.ToString();
            data["settings"]["subdirectories"] = UseSubdirectories.ToString();
            data["settings"]["directory"]      = Directory;

            parser.WriteFile(Program.PATH + "settings.ini", data);
        }
Example #6
0
        public CustomisationDownloader()
        {
            NoCommands = () => { return(!doUpload && !doDownload); };
            var p = new IniParser.FileIniDataParser();

            if (IsCec())
            {
                if (File.Exists(".cec/" + ShortName))
                {
                    custdlConfig = p.ReadFile(".cec/" + ShortName);
                }
                else
                {
                    custdlConfig = new IniData();
                    p.WriteFile(".cec/" + ShortName, custdlConfig);
                }
            }
        }
Example #7
0
            /// <summary>
            ///     保存到文件
            /// </summary>
            public static void SaveToFile()
            {
                var parser = new IniParser.FileIniDataParser();
                var data   = parser.ReadFile("x2tap.ini");

                data["x2tap"]["v2rayLoggingLevel"] = Global.Config.V2RayLoggingLevel.ToString();
                data["TUNTAP"]["Address"]          = Global.Config.TUNTAP.Address;
                data["TUNTAP"]["Netmask"]          = Global.Config.TUNTAP.Netmask;
                data["TUNTAP"]["Gateway"]          = Global.Config.TUNTAP.Gateway;
                data["TUNTAP"]["DNS"]          = Global.Config.TUNTAP.DNS;
                data["TUNTAP"]["UseCustomDNS"] = Global.Config.TUNTAP.UseCustomDNS.ToString();
                parser.WriteFile("x2tap.ini", data);

                File.WriteAllText("SubscriptionLinks.json", Newtonsoft.Json.JsonConvert.SerializeObject(Global.SubscriptionLinks));
                File.WriteAllText("v2ray.json", Newtonsoft.Json.JsonConvert.SerializeObject(Global.V2RayProxies));
                File.WriteAllText("Shadowsocks.json", Newtonsoft.Json.JsonConvert.SerializeObject(Global.ShadowsocksProxies));
                File.WriteAllText("ShadowsocksR.json", Newtonsoft.Json.JsonConvert.SerializeObject(Global.ShadowsocksRProxies));
                File.WriteAllText("ExceptionIPs.json", Newtonsoft.Json.JsonConvert.SerializeObject(Global.ExceptionIPs));
            }
Example #8
0
        private bool WriteBookToIni()
        {
            var parser = new IniParser.FileIniDataParser();
            var data   = parser.ReadFile("Library.ini");

            foreach (var book in _books)
            {
                //Add a new selection and some keys
                data.Sections.AddSection(book.Isbn);
                data[book.Isbn].AddKey("Author", book.Author);
                data[book.Isbn].AddKey("Title", book.Title);
                //data[book.ISBN].AddKey("PublicationDate", book.PublicationDate.ToString("d"));
                data[book.Isbn].AddKey("PublicationDate", book.PublicationDate);
                data[book.Isbn].AddKey("Annotation", book.Annotation);

                parser.WriteFile("Library.ini", data);
            }

            return(true);
        }
        private void SaveSwap()
        {
            string iniFile = AppCommon.Instance.SetingsIniFile;
            var    ini     = new IniParser.FileIniDataParser();

            IniParser.Model.IniData       data;
            KeyValuePair <string, string> kv;

            if (File.Exists(iniFile))
            {
                data = ini.ReadFile(iniFile);
                kv   = (KeyValuePair <string, string>)ddlProfiles.SelectedItem;
                data["PROFILE"]["current"] = Path.GetFileName(kv.Value);
            }
            else
            {
                data = new IniParser.Model.IniData();
                kv   = (KeyValuePair <string, string>)ddlProfiles.SelectedItem;
                data["PROFILE"]["current"] = Path.GetFileName(kv.Value);
            }
            ini.WriteFile(iniFile, data);
        }
Example #10
0
        /// <summary>
        /// Set the Exit Code in the App ini file for the Writer Exit code
        /// </summary>
        /// <param name="Reason"></param>
        public static void SetWriterExitReason(int Reason)
        {
            string iniFile = AppCommon.Instance.AppIniFile;
            var    ini     = new IniParser.FileIniDataParser();

            IniParser.Model.IniData data;
            if (File.Exists(iniFile))
            {
                data = ini.ReadFile(iniFile);
                if (data.Sections.ContainsSection(Properties.Settings.Default.IniWriterSection) == false)
                {
                    data.Sections.Add(new IniParser.Model.SectionData(Properties.Settings.Default.IniWriterSection));
                }
                data[Properties.Settings.Default.IniWriterSection][Properties.Settings.Default.IniWriterExitCode] = Reason.ToString(); // will return filename even if there no path prepended
            }
            else
            {
                data = new IniParser.Model.IniData();
                data.Sections.Add(new IniParser.Model.SectionData(Properties.Settings.Default.IniWriterSection));
                data[Properties.Settings.Default.IniWriterSection][Properties.Settings.Default.IniWriterExitCode] = Reason.ToString(); // will return filename even if there no path prepended
            }
            ini.WriteFile(iniFile, data);
        }
Example #11
0
        // <summary>
        /// Sets the location to the Window Spy in the ini file
        /// </summary>
        /// <param name="value">The value to set</param>
        public static void SetWindowSpyApp(string value)
        {
            string iniFile = AppCommon.Instance.SetingsIniFile;
            var    ini     = new IniParser.FileIniDataParser();

            IniParser.Model.IniData data;
            if (File.Exists(iniFile))
            {
                data = ini.ReadFile(iniFile);
                if (data.Sections.ContainsSection(Properties.Settings.Default.IniSettingsAppSection) == false)
                {
                    data.Sections.Add(new IniParser.Model.SectionData(Properties.Settings.Default.IniSettingsAppSection));
                }
                data[Properties.Settings.Default.IniSettingsAppSection][Properties.Settings.Default.IniSettingsAppWindowSpy] = value;
            }
            else
            {
                data = new IniParser.Model.IniData();
                data.Sections.Add(new IniParser.Model.SectionData(Properties.Settings.Default.IniSettingsAppSection));
                data[Properties.Settings.Default.IniSettingsAppSection][Properties.Settings.Default.IniSettingsAppWindowSpy] = value;
            }
            ini.WriteFile(iniFile, data);
        }
Example #12
0
        /// <summary>
        /// Sets the current profile value Profile/current
        /// </summary>
        /// <param name="value">The value to set the PROFILE to</param>
        public static void SetCurrentProfile(string value)
        {
            string iniFile = AppCommon.Instance.SetingsIniFile;
            var    ini     = new IniParser.FileIniDataParser();

            IniParser.Model.IniData data;
            if (File.Exists(iniFile))
            {
                data = ini.ReadFile(iniFile);
                if (data.Sections.ContainsSection(Properties.Settings.Default.IniProfileSection) == false)
                {
                    data.Sections.Add(new IniParser.Model.SectionData(Properties.Settings.Default.IniProfileSection));
                }
                data[Properties.Settings.Default.IniProfileSection][Properties.Settings.Default.IniProfileCurrent] = Path.GetFileName(value); // will return filename even if there no path prepended
            }
            else
            {
                data = new IniParser.Model.IniData();
                data.Sections.Add(new IniParser.Model.SectionData(Properties.Settings.Default.IniProfileSection));
                data[Properties.Settings.Default.IniProfileSection][Properties.Settings.Default.IniProfileCurrent] = Path.GetFileName(value); // will return filename even if there no path prepended
            }
            ini.WriteFile(iniFile, data);
        }
Example #13
0
        /// <summary>
        ///     保存配置
        /// </summary>
        public static void Save()
        {
            if (!Directory.Exists(DATA_DIR))
            {
                Directory.CreateDirectory(DATA_DIR);
            }
            if (!File.Exists(TUNTAP_INI))
            {
                File.WriteAllBytes(TUNTAP_INI, Properties.Resources.defaultTUNTAP);
            }

            var parser = new IniParser.FileIniDataParser();
            var data   = parser.ReadFile(TUNTAP_INI);

            data["Generic"]["Address"] = Global.TUNTAP.Address.ToString();
            data["Generic"]["Netmask"] = Global.TUNTAP.Netmask.ToString();
            data["Generic"]["Gateway"] = Global.TUNTAP.Gateway.ToString();

            var dns = "";

            foreach (var ip in Global.TUNTAP.DNS)
            {
                dns += ip.ToString();
                dns += ',';
            }
            dns = dns.Trim();
            data["Generic"]["DNS"] = dns.Substring(0, dns.Length - 1);

            data["Generic"]["UseCustomDNS"] = Global.TUNTAP.UseCustomDNS.ToString();

            parser.WriteFile(TUNTAP_INI, data);

            File.WriteAllText(BYPASS_DAT, Newtonsoft.Json.JsonConvert.SerializeObject(Global.BypassIPs, Newtonsoft.Json.Formatting.Indented));
            File.WriteAllText(SERVER_DAT, Newtonsoft.Json.JsonConvert.SerializeObject(Global.Server, Newtonsoft.Json.Formatting.Indented));
            File.WriteAllText(LINK_DAT, Newtonsoft.Json.JsonConvert.SerializeObject(Global.SubscribeLink, Newtonsoft.Json.Formatting.Indented));
            File.WriteAllText(SETTINGS_DAT, Newtonsoft.Json.JsonConvert.SerializeObject(Global.Settings, Newtonsoft.Json.Formatting.Indented));
        }
Example #14
0
        public void ExtractMod(string modPath)
        {
            if (!Directory.Exists(this.OutputExtractFolderPath))
            {
                throw new InvalidOperationException("You must choose an extraction path");
            }

            string outputFilePath = this.OutputExtractFolderPath + "\\Democracy3ModExtractedText.ini";

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

            var iniData = new IniParser.Model.IniData();

            // MOD RACINE
            string modBasePath = this.GameFolderPath.Replace("data", "") + "\\" + modPath + "\\data";

            if (!Directory.Exists(modBasePath))
            {
                throw new InvalidOperationException("Mod is not installed");
            }

            iniData.Sections.AddSection("Mod__" + modPath);

            // SIMULATION
            var path  = modBasePath + "\\simulation\\";
            var files = Directory.GetFiles(path);

            foreach (var filePath in files)
            {
                var fileName = filePath.Replace(path, "");
                if (fileName == "achievements.csv")
                {
                    ParseCsv(filePath, fileName, iniData, 1, new List <int> {
                        4, 2
                    });
                }
                else if (fileName == "policies.csv")
                {
                    ParseCsv(filePath, fileName, iniData, 1, new List <int> {
                        4, 2
                    });
                }
                else if (fileName == "pressuregroups.csv")
                {
                    ParseCsv(filePath, fileName, iniData, 1, new List <int> {
                        8, 3, 9, 10
                    });
                }
                else if (fileName == "simulation.csv")
                {
                    ParseCsv(filePath, fileName, iniData, 1, new List <int> {
                        3, 2
                    });
                }
                else if (fileName == "situations.csv")
                {
                    ParseCsv(filePath, fileName, iniData, 1, new List <int> {
                        3, 2, 6, 7
                    });
                }
                else if (fileName == "votertypes.csv")
                {
                    ParseCsv(filePath, fileName, iniData, 1, new List <int> {
                        8, 2, 3
                    });
                }
                else if (fileName == "sliders.csv")
                {
                    ParseCsv(filePath, fileName, iniData, 1, new List <int> {
                        4, 5, 6, 7, 8, 9, 10
                    });
                }
            }

            // Attacks
            path = modBasePath + "\\simulation\\attacks\\";
            if (Directory.Exists(path))
            {
                files = Directory.GetFiles(path);
                foreach (var filePath in files)
                {
                    var fileName = filePath.Replace(path, "");
                    ParseIni(filePath, fileName, iniData, new List <string> {
                        "SuccessText", "GUIName"
                    });
                }
            }

            // Dilemmas
            path = modBasePath + "\\simulation\\dilemmas\\";
            if (Directory.Exists(path))
            {
                files = Directory.GetFiles(path);
                foreach (var filePath in files)
                {
                    var fileName = filePath.Replace(path, "");
                    ParseIni(filePath, fileName, iniData, new List <string> {
                        "description", "guiname", "name"
                    });
                }
            }

            // Events
            path = modBasePath + "\\simulation\\events\\";
            if (Directory.Exists(path))
            {
                files = Directory.GetFiles(path);
                foreach (var filePath in files)
                {
                    var fileName = filePath.Replace(path, "");
                    ParseIni(filePath, fileName, iniData, new List <string> {
                        "description", "guiname"
                    });
                }
            }

            // Missions
            path = modBasePath + "\\missions\\";
            if (Directory.Exists(path))
            {
                files = Directory.GetDirectories(path);
                foreach (var filePath in files)
                {
                    var fileName = filePath.Replace(path, "") + ".txt";
                    ParseIni(filePath + "\\" + fileName, fileName, iniData, new List <string> {
                        "description", "guiname"
                    });
                }
            }

            var parser = new IniParser.FileIniDataParser();

            parser.WriteFile(outputFilePath, iniData, Encoding.UTF8);
        }
Example #15
0
        protected static int set(string[] args)
        {
            try {
                if (args.Length <= 1)
                {
                    HelpSet("");
                    return(0);
                }
                if (settable.Contains(args[1]))
                {
                    var setThis = args[1];
                    if (args.Length == 2)
                    {
                        switch (setThis)
                        {
                        // TODO: insert 1 arg sized sets
                        default:
                            HelpSet(setThis);
                            break;
                        }
                    }
                    if (args.Length == 3)
                    {
                        switch (setThis)
                        {
                        // TODO: insert 2 arg sized sets
                        default:
                            HelpSet(setThis);
                            break;
                        }
                    }
                    if (args.Length >= 4)
                    {
                        switch (setThis)
                        {
                        // TODO: insert 3 arg sized sets
                        case "map":
                            if (typeQueries.Keys.Contains(args[2]))
                            {
                                custdlConfig["map"][args[2]] = args[3];
                                Console.WriteLine("Set " + args[2] + " to be downloaded to " + args[3]);
                            }
                            else
                            {
                                HelpTypes();
                            }
                            return(3);

                            break;

                        default:
                            HelpSet(setThis);
                            break;
                        }
                    }
                    return(0);
                }
                else
                {
                    Console.WriteLine("Couldn't set: " + args[1]);

                    return(0);
                }
            }
            finally {
                var p = new IniParser.FileIniDataParser();
                p.WriteFile(".cec/" + StaticName, custdlConfig);
            }
        }
Example #16
0
        public void ExtractAllSentences()
        {
            //this.textBoxOutputFolder.Text == OutputExtractFolderPath
            // this.textBoxSource.Text == GameFolderPath
            if (!Directory.Exists(this.OutputExtractFolderPath))
            {
                throw new InvalidOperationException("You must choose an extraction path");
            }

            string outputFilePath = this.OutputExtractFolderPath + "\\Democracy3MainExtractedText.ini";

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

            var iniData = new IniParser.Model.IniData();

            // RACINE
            string path  = this.GameFolderPath + "\\";
            var    files = Directory.GetFiles(path);

            foreach (var filePath in files)
            {
                var fileName = filePath.Replace(path, "");
                if (fileName == "strings.ini")
                {
                    ParseIni(filePath, fileName, iniData);
                }
                else if (fileName == "tutorial.csv")
                {
                    ParseCsv(filePath, fileName, iniData, 2, new List <int> {
                        11, 3
                    });
                }
            }

            // SIMULATION
            path  = this.GameFolderPath + "\\simulation\\";
            files = Directory.GetFiles(path);
            foreach (var filePath in files)
            {
                var fileName = filePath.Replace(path, "");
                if (fileName == "achievements.csv")
                {
                    ParseCsv(filePath, fileName, iniData, 1, new List <int> {
                        4, 2
                    });
                }
                else if (fileName == "policies.csv")
                {
                    ParseCsv(filePath, fileName, iniData, 1, new List <int> {
                        4, 2
                    });
                }
                else if (fileName == "pressuregroups.csv")
                {
                    ParseCsv(filePath, fileName, iniData, 1, new List <int> {
                        8, 3, 9, 10
                    });
                }
                else if (fileName == "simulation.csv")
                {
                    ParseCsv(filePath, fileName, iniData, 1, new List <int> {
                        3, 2
                    });
                }
                else if (fileName == "situations.csv")
                {
                    ParseCsv(filePath, fileName, iniData, 1, new List <int> {
                        3, 2, 6, 7
                    });
                }
                else if (fileName == "votertypes.csv")
                {
                    ParseCsv(filePath, fileName, iniData, 1, new List <int> {
                        8, 2, 3
                    });
                }
                else if (fileName == "sliders.csv")
                {
                    ParseCsv(filePath, fileName, iniData, 1, new List <int> {
                        4, 5, 6, 7, 8, 9, 10
                    });
                }
            }

            // Attacks
            path = this.GameFolderPath + "\\simulation\\attacks\\";
            if (Directory.Exists(path))
            {
                files = Directory.GetFiles(path);
                foreach (var filePath in files)
                {
                    var fileName = filePath.Replace(path, "");
                    ParseIni(filePath, fileName, iniData, new List <string> {
                        "SuccessText", "GUIName"
                    });
                }
            }

            // Dilemmas
            path = this.GameFolderPath + "\\simulation\\dilemmas\\";
            if (Directory.Exists(path))
            {
                files = Directory.GetFiles(path);
                foreach (var filePath in files)
                {
                    var fileName = filePath.Replace(path, "");
                    ParseIni(filePath, fileName, iniData, new List <string> {
                        "description", "guiname", "name"
                    });
                }
            }

            // Events
            path = this.GameFolderPath + "\\simulation\\events\\";
            if (Directory.Exists(path))
            {
                files = Directory.GetFiles(path);
                foreach (var filePath in files)
                {
                    var fileName = filePath.Replace(path, "");
                    ParseIni(filePath, fileName, iniData, new List <string> {
                        "description", "guiname"
                    });
                }
            }

            // Missions
            path = this.GameFolderPath + "\\missions\\";
            if (Directory.Exists(path))
            {
                files = Directory.GetDirectories(path);
                foreach (var filePath in files)
                {
                    var fileName = filePath.Replace(path, "") + ".txt";
                    ParseIni(filePath + "\\" + fileName, fileName, iniData, new List <string> {
                        "description", "guiname"
                    });
                }
            }

            var parser = new IniParser.FileIniDataParser();

            parser.WriteFile(outputFilePath, iniData, Encoding.UTF8);

            //MessageBox.Show("You can now send the file to transifex website\nFile path : " + outputFilePath, "Extraction finished...", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
Example #17
0
        static int edit(string[] args)
        {
            Func <string, string, bool, string> prompt = (pr, v, pa) => {
                Console.Write(pr + " (");
                if (!string.IsNullOrWhiteSpace(v))
                {
                    Console.Write("leave blank for: \"" + v + "\",");
                }
                Console.WriteLine("ctrl+z to skip)");

                if (pa)
                {
                    string         op   = "";
                    ConsoleKeyInfo akey = Console.ReadKey();
                    while (akey.Key != ConsoleKey.Enter)
                    {
                        Console.CursorLeft = Console.CursorLeft - 1;
                        Console.Write("*");
                        op  += akey.KeyChar;
                        akey = Console.ReadKey();
                    }
                    return(op);
                }

                var str = Console.ReadLine();
                if (str == null || str.Contains("\u001a"))
                {
                    return(null);
                }

                var val = str.Replace(Environment.NewLine, "");;
                if (string.IsNullOrWhiteSpace(val))
                {
                    return(v);
                }
                return(val);
            };

            LoadCec();

            config["org"]["url"]  = prompt("Enter Url", config["org"]["url"], false);
            config["org"]["name"] = prompt("Enter Name", config["org"]["name"], false);
            config["org"]["user"] = prompt("Enter User", config["org"]["user"], false);
            var  oPass   = config["org"]["pass"];
            bool hasPass = false;

            if (oPass != null)
            {
                var udat = Encoding.Default.GetString(ProtectedData.Unprotect(Convert.FromBase64String(oPass), new byte[0], DataProtectionScope.CurrentUser));
                if (udat.StartsWith("legit:"))
                {
                    hasPass = true;
                }
            }
            var pass = prompt("Enter pass", hasPass ? "*****" : "", true);

            if (!string.IsNullOrWhiteSpace(pass) && pass != "*****")
            {
                var protec  = ProtectedData.Protect(Encoding.Default.GetBytes("legit:" + pass), new byte[0], DataProtectionScope.CurrentUser);
                var protStr = Convert.ToBase64String(protec);
                config["org"]["pass"] = protStr;
            }

            var p = new IniParser.FileIniDataParser();

            p.WriteFile(".cec/config", config);

            return(args.Length);
        }