Ejemplo n.º 1
0
        private async Task PerformExtraction()
        {
            Log.Information($"Extracting {file} to {destination}");
            Text = "Extracting...";

            using (IArchive archive = ArchiveFactory.Open(file))
            {
                InitProgressBar.Maximum = archive.Entries.Count();

                IReader reader = archive.ExtractAllEntries();

                while (reader.MoveToNextEntry())
                {
                    if (!reader.Entry.IsDirectory)
                    {
                        LabelTask.Text = reader.Entry.Key;
                        InitProgressBar.PerformStep();
                        try
                        {
                            await Task.Run(() => reader.WriteEntryToDirectory(destination, options));
                        }
                        catch (UnauthorizedAccessException e)
                        {
                            Log.Error(e, $"Unable to extract {reader.Entry.Key}");
                            MessageBox.Show($"Unable to extract {reader.Entry.Key}\n\nMake sure that your Windows user is allowed to write into {destination} and try again.", "Unable to extract file", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            return;
                        }
                    }
                }
            }

            Completed = true;
        }
Ejemplo n.º 2
0
 public frmClientMain()
 {
     InitializeComponent();
     AppendMessage2TextBox = new AppendMessage2TextBox(Append2TextBox);
     InitProgressBar       = new InitProgressBar(ConfigProgressSetting);
     SetProgressBarValue   = new SetProgressBarValue(SetProgressBarSetting);
 }
Ejemplo n.º 3
0
        private async Task PerformInitialization()
        {
            Log.Information("Performing initialization of managers");
            // Configure the UI
            Text = "Initializing...";
            InitProgressBar.Maximum = 2;

            // Initialize the managers
            // Build Manager
            LabelTask.Text = "Populating Data Folders";
            await Managers.FolderManager.Initialize();

            InitProgressBar.PerformStep();
            // Build Manager
            LabelTask.Text = "Populating CFX Builds";
            await Managers.BuildManager.Initialize();

            InitProgressBar.PerformStep();

            // And say that we succeded
            Completed = true;
        }