Exemplo n.º 1
0
        public static Dictionary <string, string> LoadIni(string path)
        {
            string str = Rc.loadData(path);

            string[] array      = Rc.CutString2("\n", str);
            var      dictionary = new Dictionary <string, string>();
            bool     flag       = false;

            string[] array2 = array;
            for (int i = 0; i < array2.Length; i++)
            {
                string str2 = array2[i];
                if (!flag)
                {
                    flag = true;
                }
                else
                {
                    string key = Rc.CutString2("=", str2)[0];
                    string value;
                    if (Rc.CutString2("=", str2).Length != 1)
                    {
                        value = Rc.CutString2("=", str2)[1];
                    }
                    else
                    {
                        value = "";
                    }
                    dictionary[key] = value;
                }
            }
            return(dictionary);
        }
Exemplo n.º 2
0
        public static bool ExportIni(string path, Dictionary <string, string> Dic)
        {
            try
            {
                string   export = @"[Alicium]
";
                string[] keys   = new string[Dic.Count];
                string[] values = new string[Dic.Count];
                Dic.Keys.CopyTo(keys, 0);
                Dic.Values.CopyTo(values, 0);
                for (int i = 0; i < Dic.Count; i++)
                {
                    if (keys[i] == "" || values[i] == "")
                    {
                    }
                    else
                    {
                        export += keys[i] + "=" + values[i] + @"
";
                    }
                }
                Rc.saveData(export, path);
                return(true);
            }
            catch
            {
                return(false);
            }
        }