Exemple #1
0
        private void importInLib()
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();

            openFileDialog.Title       = "Select Game(s) to import";
            openFileDialog.Multiselect = true;
            openFileDialog.Filter      = "Zip Archive (*.zip) | *.zip;";
            openFileDialog.ShowDialog();
            try
            {
                foreach (string s in openFileDialog.FileNames)
                {
                    ZipFileWithProgress.ExtractToDirectory(s, Path.Combine(steamPath, "common"), null);
                    string configFile = "";
                    foreach (string cf in Directory.GetFiles(Path.Combine(steamPath, "common"), "*.acf"))
                    {
                        configFile = cf;
                    }
                    string debug = Path.Combine(steamPath, Path.GetFileName(configFile));
                    File.Move(configFile, debug);
                }
                lblStatus.Text = openFileDialog.FileNames.Length + " Game(s) imported!";
            }
            catch (Exception exc)
            {
                lblStatus.Text = "Error while importing!";
            }
        }
Exemple #2
0
 private void createZipArchive(string startPath, string zipPath, ProgressBar progressBar, Label l, string _name, CancellationToken token)
 {
     ZipFileWithProgress.CreateFromDirectory(startPath, zipPath, new BasicProgress <double>(p => lblStatus.Invoke(new Action(() =>
     {
         if (token.IsCancellationRequested)
         {
             l.Text = "Aborting...";
             return;
         }
         progressBar.Maximum = 100;
         progressBar.Step    = 1;
         int hold            = (int)(p * 100);
         progressBar.Value   = hold;
         l.Text = _name + " || " + p.ToString("P2");
     }))), token);
 }