示例#1
0
        public static void Load()
        {
            try
            {
                string path = Path.Combine(DataManager.GetCfgFolderPath(), cfg_file);
                if (!File.Exists(path))
                {
                    return;
                }

                StreamReader sr = new StreamReader(path);
                while (!sr.EndOfStream)
                {
                    string line = sr.ReadLine();
                    int    pos  = line.IndexOf(';');
                    string key  = line.Substring(0, pos);
                    string name = line.Substring(pos + 1);
                    GroupInfoManager.AddGroup(new GroupInfo(key, name));
                }
            }
            catch (Exception e)
            {
                Logger.WriteLine(e.Message);
            }
        }
示例#2
0
        public static void Save()
        {
            try
            {
                string path = Path.Combine(DataManager.GetCfgFolderPath(), cfg_file);

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

                StreamWriter sw     = new StreamWriter(path);
                GroupInfo[]  groups = GroupInfoManager.GetGroupArray();
                foreach (GroupInfo grp in groups)
                {
                    sw.WriteLine(grp.Key + ";" + grp.Name);
                }
                sw.Close();
            }
            catch (Exception e)
            {
                Logger.WriteLine(e.Message);
            }
        }