コード例 #1
0
        public static ZipThreadData ThreadUnZip(string ZipFile, string TargetDirectory, string Password, LoadPercent loadPercent = null, bool OverWrite = true)
        {
            IsEnter = true;
            ZipThreadData ztd = new ZipThreadData();

            ztd.ZipFile         = ZipFile;
            ztd.IsZipIng        = true;
            ztd.TargetDirectory = TargetDirectory;
            ztd.Password        = Password;
            ztd.loadPercent     = loadPercent;
            ztd.OverWrite       = OverWrite;
            Timer_Thread.SetTimer((t, r) =>
            {
                try
                {
                    UnZip(ztd.ZipFile, ztd.TargetDirectory, ztd.Password, ztd.loadPercent, ztd.OverWrite);
                    ztd.IsZipIng = false;
                }
                catch (System.Exception e)
                {
                    ztd.error = "解压线程出现错误:" + e.ToString();
                    ztd.loadPercent.Over("", 1, ztd.error);
                    ztd.IsZipIng = false;
                }
                return(-1);
            }, 0, null);
            return(ztd);
        }
コード例 #2
0
        public static Timer_Thread SetTimer(ThreadCall threadCall, float waitTime, Component mo)
        {
            Timer_Thread timer = new Timer_Thread();

            timer.mThreadCallBack = threadCall;
            timer.SetBody(mo);
            timer.BeginThread(waitTime);
            return(timer);
        }