Exemple #1
0
        /// <summary>
        /// Метод, срабатывающий при нажатии на кнопку "Создать/Закрыть".
        /// </summary>
        private void GenerateNow_Click(object sender, EventArgs e)
        {
            // Проверим необходим ли нам запуск очистки или закрытие формы...
            if (!IsCompleted)
            {
                // Отключим контролы...
                GenerateNow.Text    = AppStrings.RPB_CptWrk;
                GenerateNow.Enabled = false;
                ControlBox          = false;

                // Запускаем асинхронный обработчик...
                if (!BwGen.IsBusy)
                {
                    BwGen.RunWorkerAsync();
                }
                else
                {
                    CoreLib.WriteStringToLog("RepGen Worker is busy. Can't start build sequence.");
                }
            }
            else
            {
                // Закрываем форму...
                Close();
            }
        }
Exemple #2
0
        /// <summary>
        /// "Create/close" button click event handler.
        /// </summary>
        /// <param name="sender">Sender object.</param>
        /// <param name="e">Event arguments.</param>
        private void GenerateNow_Click(object sender, EventArgs e)
        {
            if (!IsCompleted)
            {
                RepWindowStart();

                if (!BwGen.IsBusy)
                {
                    BwGen.RunWorkerAsync();
                }
                else
                {
                    Logger.Warn(DebugStrings.AppDbgExRepWrkBusy);
                }
            }
            else
            {
                Close();
            }
        }
Exemple #3
0
        /// <summary>
        /// Creates compressed report and saves it to disk.
        /// </summary>
        private void RepCreateReport()
        {
            using (ZipFile ZBkUp = new ZipFile(RepMan.ReportArchiveName, Encoding.UTF8))
            {
                // Creating some counters...
                int TotalFiles = RepMan.ReportTargets.Count;
                int CurrentFile = 1, CurrentPercent;

                // Adding generic report files...
                foreach (ReportTarget RepTarget in RepMan.ReportTargets)
                {
                    ProcessManager.StartProcessAndWait(RepTarget.Program, String.Format(RepTarget.Parameters, RepTarget.OutputFileName));

                    CurrentPercent = (int)Math.Round(CurrentFile / (double)TotalFiles * 100.00d, 0); CurrentFile++;
                    if ((CurrentPercent >= 0) && (CurrentPercent <= 100))
                    {
                        BwGen.ReportProgress(CurrentPercent);
                    }

                    if (File.Exists(RepTarget.OutputFileName))
                    {
                        ZBkUp.AddFile(RepTarget.OutputFileName, RepTarget.ArchiveDirectoryName);
                    }
                    else
                    {
                        if (RepTarget.IsMandatory)
                        {
                            throw new FileNotFoundException(DebugStrings.AppDbgExRpMdrNotCreated);
                        }
                    }
                }

                // Adding game configs...
                if (Directory.Exists(SelectedGame.FullCfgPath))
                {
                    ZBkUp.AddDirectory(SelectedGame.FullCfgPath, "configs");
                }

                // Adding video file...
                if (SelectedGame.IsUsingVideoFile)
                {
                    string GameVideo = SelectedGame.GetActualVideoFile();
                    if (File.Exists(GameVideo))
                    {
                        ZBkUp.AddFile(GameVideo, "video");
                    }
                }

                // Adding Steam crash dumps...
                if (Directory.Exists(Path.Combine(FullSteamPath, "dumps")))
                {
                    ZBkUp.AddDirectory(Path.Combine(FullSteamPath, "dumps"), "dumps");
                }

                // Adding Steam logs...
                if (Directory.Exists(Path.Combine(FullSteamPath, "logs")))
                {
                    ZBkUp.AddDirectory(Path.Combine(FullSteamPath, "logs"), "logs");
                }

                // Adding Hosts file contents...
                if (File.Exists(Platform.HostsFileFullPath))
                {
                    ZBkUp.AddFile(Platform.HostsFileFullPath, "hosts");
                }

                // Adding application debug log...
                if (Directory.Exists(CurrentApp.LogDirectoryPath))
                {
                    ZBkUp.AddDirectory(CurrentApp.LogDirectoryPath, "debug");
                }

                // Saving Zip file to disk...
                ZBkUp.Save();
            }
        }