Exemplo n.º 1
0
        private bool _ExtractISO(string InFile, string OutPath)
        {
            try
            {
                int FileNum = Wit.GetNumFiles(InFile);

                if (FileNum == -1)
                {
                    MessageBox.Show(Resources.err_extract_failed);
                    return(false);
                }

                if (Directory.Exists(OutPath))
                {
                    Helpers.DeleteDirectory(OutPath);
                }

                bool Res = false;

                Thread th = new Thread(() => { Res = Wit.UnpackISO(InFile, OutPath); });
                th.Start();

                while (th.IsAlive)
                {
                    if (Directory.Exists(OutPath))
                    {
                        int FileC   = Directory.GetFiles(OutPath, "*", SearchOption.AllDirectories).Count();
                        int Percent = (int)(((decimal)FileC / (decimal)FileNum) * 100);
                        SetProgressVal(Percent);
                    }

                    Thread.Sleep(100);
                }

                if (Res == false)
                {
                    MessageBox.Show(Resources.err_extract_failed);
                    return(false);
                }
                else
                {
                    return(true);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                return(false);
            }
        }
Exemplo n.º 2
0
        private bool _PackISO(string InPath, string OutFile)
        {
            try
            {
                if (File.Exists(OutFile))
                {
                    File.Delete(OutFile);
                }

                bool Res = false;

                Thread th = new Thread(() => { Res = Wit.PackISO(InPath, OutFile); });
                th.Start();

                int i = 0;

                while (th.IsAlive)
                {
                    i++;
                    SetProgressVal(i);
                    Thread.Sleep(100);
                }

                if (Res == false)
                {
                    MessageBox.Show(Resources.saving_err);
                    return(false);
                }
                else
                {
                    return(true);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                return(false);
            }
        }