コード例 #1
0
        public MWServer(MMDKWorldActor _world, long _group = -1)
        {
            world = _world;
            group = _group;


            // dcard deal
            if (world.pools.Count > 0)
            {
                pool = world.pools.First().Value;
            }
        }
コード例 #2
0
        public void parse(string line)
        {
            var pitems = line.Trim().Split(new char[] { '\t' }, StringSplitOptions.RemoveEmptyEntries);

            if (pitems.Length >= 2)
            {
                group = long.Parse(pitems[0].Trim());
                string poolName = pitems[1].Trim();
                if (world.pools.ContainsKey(poolName))
                {
                    pool = world.pools[poolName];
                }
            }
        }
コード例 #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);
                    }
                }
            }
        }