Ejemplo n.º 1
0
 public void stopVideo()
 {
     lock (videoLock)
     {
         nowvideo = null;
     }
 }
Ejemplo n.º 2
0
 public MWVideo(MWVideo mwv)
 {
     source = mwv.source;
     name   = mwv.name;
     frame  = new List <string>();
     fps    = mwv.fps;
     nowf   = mwv.nowf;
 }
Ejemplo n.º 3
0
        public bool playVideo(string videoName)
        {
            if (world.videos.ContainsKey(videoName))
            {
                lock (videoLock)
                {
                    nowvideo = new MWVideo(world.videos[videoName]);
                    return(true);
                }
            }
            return(false);
            //if (videoName)
            //{

            //}
        }
Ejemplo n.º 4
0
 public string getFrame()
 {
     if (nowvideo != null)
     {
         lock (videoLock)
         {
             if (nowvideo != null)
             {
                 string res = nowvideo.play();
                 if (nowvideo.isEnd())
                 {
                     nowvideo = null;
                 }
                 return(res);
             }
         }
     }
     return("");
 }
Ejemplo n.º 5
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);
                    }
                }
            }
        }