예제 #1
0
 public void init(sendQQGroupMsgHandler _showScene, getQQNickHandler _getQQNick, BTCActor _btc, string _path)
 {
     outputMessage = _showScene;
     getQQNick     = _getQQNick;
     btc           = _btc;
     path          = _path;
     lock (matchMutex)
     {
         try
         {
             var lines = FileIOActor.readLines(path + userinfoFile);
             foreach (var line in lines)
             {
                 RHUser user = new RHUser(line);
                 users[user.userid] = user;
             }
             lines = FileIOActor.readLines(path + horseinfoFile);
             foreach (var line in lines)
             {
                 RHHorse horse = new RHHorse(line);
                 horses[horse.name] = horse;
             }
         }
         catch (Exception e)
         {
             FileIOActor.log(e.Message + "\r\n" + e.StackTrace);
         }
     }
 }
예제 #2
0
        public void init(sendQQGroupMsgHandler _showScene, getQQNickHandler _getQQNick, BTCActor _btc, string _path)
        {
            outputMessage = _showScene;
            getQQNick     = _getQQNick;
            btc           = _btc;
            path          = _path;
            //lock (matchMutex)
            //{
            //    try
            //    {
            //        var lines = FileIOActor.readLines(path + userinfoFile);
            //        foreach (var line in lines)
            //        {
            //            var items = line.Split('\t');
            //            if (items.Length >= 4)
            //            {
            //                BTCUser user = btc.get(items[0]);
            //                ruuserinfo[user.qq] = new RHUserInfo(
            //                    user,
            //                    int.Parse(items[1]),
            //                    int.Parse(items[2]),
            //                    int.Parse(items[3])
            //                );
            //            }
            //        }

            //        lines = FileIOActor.readLines(path + horseinfoFile);
            //        foreach (var line in lines)
            //        {
            //            var items = line.Split('\t');
            //            if (items.Length >= 7)
            //            {
            //                horseinfo[items[0]] = new HorseInfo(
            //                    items[0],
            //                    items[1],
            //                    int.Parse(items[2]),
            //                    int.Parse(items[3]),
            //                    int.Parse(items[4]),
            //                    int.Parse(items[5]),
            //                    items[6]
            //                );
            //            }
            //        }
            //        try
            //        {
            //            run = true;
            //            if (raceLoopThread == null) raceLoopThread = new Thread(raceLoop);
            //            raceLoopThread.Start();
            //        }
            //        catch
            //        {

            //        }

            //    }
            //    catch (Exception e)
            //    {
            //        FileIOActor.log(e.Message + "\r\n" + e.StackTrace);
            //    }
            //}
        }
예제 #3
0
        public void init(sendQQGroupMsgHandler _showScene, getQQNickHandler _getQQNick, BTCActor _btc, string _path)
        {
            outputMessage = _showScene;
            getQQNick     = _getQQNick;
            btc           = _btc;
            path          = _path;

            // init videos;
            var videofiles = Directory.GetFiles(path + videoPath, "*.txt");

            foreach (var vf in videofiles)
            {
                string name = Path.GetFileNameWithoutExtension(vf);
                videos[name] = new MWVideo(vf);
            }

            //LoopThread = new Thread(mainloop);
            //run = true;
            //LoopThread.Start();

            lock (dcardMutex)
            {
                // init cards
                var lines = FileIOActor.readLines(path + dcardPath + cardf, Encoding.UTF8);
                foreach (var line in lines)
                {
                    try
                    {
                        MWItem card = new MWItem();
                        card.parse(line);
                        if (!string.IsNullOrWhiteSpace(card.name))
                        {
                            cards[card.name] = card;
                        }
                    }
                    catch (Exception ex)
                    {
                        FileIOActor.log(ex);
                    }
                }

                // init pools
                lines = FileIOActor.readLines(path + dcardPath + poolf, Encoding.UTF8);
                foreach (var line in lines)
                {
                    try
                    {
                        MWItemPool pool = new MWItemPool(cards);
                        pool.parse(line);
                        if (!string.IsNullOrWhiteSpace(pool.name))
                        {
                            pools[pool.name] = pool;
                        }
                    }
                    catch (Exception ex)
                    {
                        FileIOActor.log(ex);
                    }
                }

                // init users
                lines = FileIOActor.readLines(path + dcardPath + userf, Encoding.UTF8);
                foreach (var line in lines)
                {
                    try
                    {
                        MWUser user = new MWUser(-1, cards);
                        user.parse(line);
                        if (user.userid > 0)
                        {
                            users[user.userid] = user;
                        }
                    }
                    catch (Exception ex)
                    {
                        FileIOActor.log(ex);
                    }
                }

                // init servers
                lines = FileIOActor.readLines(path + dcardPath + dcardserverf, Encoding.UTF8);
                foreach (var line in lines)
                {
                    try
                    {
                        MWServer server = new MWServer(this);
                        server.parse(line);
                        if (server.group > 0)
                        {
                            servers[server.group] = server;
                        }
                    }
                    catch (Exception ex)
                    {
                        FileIOActor.log(ex);
                    }
                }
            }
        }