コード例 #1
0
ファイル: AutoSpeaker.cs プロジェクト: crcruicai/Library
        public static void LoadReply()
        {
            _WordMap = new DictionaryCollection <string, AutoMessage>();
            string filepath = Environment.CurrentDirectory + "\\reply.ini";

            if (File.Exists(filepath))
            {
                StreamReader sr = new StreamReader(filepath, Encoding.Default);
                string       s;
                long         i = 0;
                long         j = 0;
                string       key = "", words = "";
                while ((s = sr.ReadLine()) != null)
                {
                    i = i + 1;
                    if (i % 3 == 1)
                    {
                        key = s;
                    }
                    if (i % 3 == 2)
                    {
                        j     = j + 1;
                        words = s;
                        if (key.Trim().Length > 0 && words.Trim().Length > 0)
                        {
                            _WordMap.Add(key, new AutoMessage()
                            {
                                Count = 0, Text = words
                            });
                            //lvwWordsList.Items.Add(new ListViewItem(new string[] { j.ToString(), key, words }));
                        }
                    }
                }
                sr.Close();
            }
            else
            {
            }
        }
コード例 #2
0
ファイル: AutoSpeaker.cs プロジェクト: crcruicai/Library
        public static void LoadMap()
        {
            string path = Environment.CurrentDirectory + "\\Words.db";

            _WordMap = Util.SerializeHelper.Load <DictionaryCollection <string, AutoMessage> >(path);
        }