Ejemplo n.º 1
0
        public static bool isLaunch(int index, string dizhi = @"d:\ChangZhi\dnplayer2\")
        {
            var res = false;

            int[] abc = MyLdcmd.getDqmoniqiHuodongIndex(dizhi);
            if (abc.Contains(index))
            {
                res = true;
            }
            return(res);
        }
Ejemplo n.º 2
0
        public static bool LaunchQiHao(int index, string dizhi = @"d:\ChangZhi\dnplayer2\")
        {
            var res = false;

            //lock (obj)
            {
                WriteLog.WriteLogFile(index + "", "起号开始,准备打开" + index + "号模拟器");
                Int64 kstime = GetTimestamp();
                long  ksjs   = GetTimestamp();
                int   i      = 0;
                int[] abc    = MyLdcmd.getDqmoniqiHuodongIndex(dizhi);
                while (true)
                {
                    if (i == 0)
                    {
                        WriteLog.WriteLogFile(index + "", "打开" + index + "号模拟器");
                        dakaimoniqiByIndexQiHao(index);
                        i++;
                    }
                    Int64 jstime = GetTimestamp();
                    if ((jstime - kstime) > 1000 * 60 * 5)
                    {
                        mylogandxianshi("打开很久5分钟也没打开" + index);
                        break;
                    }
                    if ((jstime - ksjs) > 1000 * 20)
                    {
                        abc  = MyLdcmd.getDqmoniqiHuodongIndex(dizhi);
                        ksjs = GetTimestamp();
                    }
                    if (abc.Contains(index))
                    {
                        res = true;
                        break;
                    }
                }
            }
            return(res);
        }
Ejemplo n.º 3
0
        private static bool myQuit(int index, string dizhi)
        {
            var res = false;

            lock (obj)
            {
                int    jubing = MyLdcmd.getDqmoniqiWaiCengJuBingByIndex(index, dizhi);
                IntPtr p      = new IntPtr(jubing);
                PostMessage(p, WM_CLOSE, 0, 0);
                Thread.Sleep(5000);
                MyLdcmd myldcmd = MyLdcmd.GetObject(dizhi);
                long    kstime  = GetTimestamp();
                long    kstime2 = GetTimestamp();
                int[]   abc     = MyLdcmd.getDqmoniqiHuodongIndex(dizhi);
                if (abc.Contains(index))
                {
                    MyLdcmd.getLdCmd().Quit(index);
                    Thread.Sleep(5000);
                    zaiciguanbi();
                }
                abc = MyLdcmd.getDqmoniqiHuodongIndex(dizhi);
                if (!abc.Contains(index))
                {
                    return(true);
                }
                int shi = 0;
                while (true)
                {
                    long jstime = GetTimestamp();
                    if ((jstime - kstime2) > 1000 * 30)
                    {
                        abc     = MyLdcmd.getDqmoniqiHuodongIndex(dizhi);
                        kstime2 = GetTimestamp();
                    }
                    if (shi == 0 && abc.Contains(index))
                    {
                        MyLdcmd.getLdCmd().Quit(index);
                        Thread.Sleep(5000);
                        zaiciguanbi();
                        shi = 1;
                    }
                    if (shi == 1 && abc.Contains(index))
                    {
                        PostMessage(p, WM_CLOSE, 0, 0);
                        Thread.Sleep(5000);
                        shi = 0;
                    }
                    if (!abc.Contains(index))
                    {
                        res = true;
                        break;
                    }
                    if ((jstime - kstime) > 1000 * 60 * 5)
                    {
                        mylogandxianshi("循环很久5分钟也没有关闭" + index);
                        break;
                    }
                }
            }
            return(res);
        }
Ejemplo n.º 4
0
        public bool myQuit(int index, string dizhi, int jubing)
        {
            var res = false;

            if (jubing <= 0)
            {
                WriteLog.WriteLogFile(index + "", "准备获取句柄,在myquit处");
                jubing = MyLdcmd.getDqmoniqiWaiCengJuBingByIndex(index, dizhi);
            }
            IntPtr p = new IntPtr(jubing);

            PostMessage(p, WM_CLOSE, 0, 0);
            Thread.Sleep(5000);
            MyLdcmd myldcmd = MyLdcmd.GetObject(dizhi);
            long    kstime  = MyFuncUtil.GetTimestamp();
            long    kstime2 = MyFuncUtil.GetTimestamp();

            int[] abc = MyLdcmd.getDqmoniqiHuodongIndex(dizhi);
            if (abc.Contains(index))
            {
                MyLdcmd.getLdCmd().Quit(index);
                Thread.Sleep(5000);
                MyFuncUtil.zaiciguanbi();
            }
            abc = MyLdcmd.getDqmoniqiHuodongIndex(dizhi);
            if (!abc.Contains(index))
            {
                return(true);
            }
            int shi = 0;

            while (true)
            {
                long jstime = MyFuncUtil.GetTimestamp();
                if ((jstime - kstime2) > 1000 * 30)
                {
                    abc     = MyLdcmd.getDqmoniqiHuodongIndex(dizhi);
                    kstime2 = MyFuncUtil.GetTimestamp();
                }
                if (shi == 0 && abc.Contains(index))
                {
                    MyLdcmd.getLdCmd().Quit(index);
                    Thread.Sleep(5000);
                    MyFuncUtil.zaiciguanbi();
                    shi = 1;
                }
                if (shi == 1 && abc.Contains(index))
                {
                    PostMessage(p, WM_CLOSE, 0, 0);
                    Thread.Sleep(5000);
                    shi = 0;
                }
                if (!abc.Contains(index))
                {
                    res = true;
                    break;
                }
                if ((jstime - kstime) > 1000 * 60 * 5)
                {
                    MyFuncUtil.mylogandxianshi("循环很久5分钟也没有关闭" + index);
                    break;
                }
            }

            return(res);
        }