public async Task Handle(object parameterObj)
        {
            var parameter = parameterObj as ConvertImageParameter;

            Console.WriteLine($"Start convert the Files from: {parameter.Source}");
            Console.WriteLine($"Target File: {parameter.Target}");

            var progress = new Progress <IProgressReport>(report =>
            {
                TextProgressBar.Draw(report.Current, report.Total);
            });

            await pdfOrganizerService.ConvertImage(parameter.Source, parameter.Target, parameter.Landscape, parameter.Letter, parameter.ViewAfterComplete, progress);
        }
示例#2
0
        public async Task Handle(object parameterObj)
        {
            var parameter = parameterObj as SplitParameter;

            Console.WriteLine($"Start Merge the Files from: {parameter.Source}");
            Console.WriteLine($"Target File: {parameter.Target}" + (string.IsNullOrWhiteSpace(parameter.Prefix) ? "" : $" with prefix {parameter.Prefix}"));

            var progress = new Progress <IProgressReport>(report =>
            {
                TextProgressBar.Draw(report.Current, report.Total);
            });

            await pdfOrganizerService.Split(parameter.Source, parameter.Target, parameter.Prefix, progress);
        }
示例#3
0
        public XuFuEncounterHandler(Button button, TextProgressBar progressBar, XuFuEncounterDataManager dataManager)
        {
            this.button         = button;
            this.progressBar    = progressBar;
            progressBar.Minimum = 1;
            this.dataManager    = dataManager;

            backgroundWorker = new BackgroundWorker
            {
                WorkerReportsProgress = true
            };
            backgroundWorker.DoWork             += BackgroundWorker_DoWork;
            backgroundWorker.ProgressChanged    += BackgroundWorker_ProgressChanged;
            backgroundWorker.RunWorkerCompleted += BackgroundWorker_RunWorkerCompleted;
        }
        public async Task Handle(object parameterObj)
        {
            var parameter = parameterObj as MergeParameter;

            Console.WriteLine($"Start Merge the Files from: {parameter.FilesPath}");
            Console.WriteLine($"To File: {parameter.FileName}");
            Console.WriteLine($"On Node: {parameter.NodeName}");

            var progress = new Progress <IProgressReport>(report =>
            {
                TextProgressBar.Draw(report.Current, report.Total);
            });

            await service.MergeFiles(parameter.FileName, parameter.NodeName, parameter.FilesPath, progress);
        }
示例#5
0
        public async Task Handle(object parameterObj)
        {
            var parameter = parameterObj as SplitBlockParameter;

            Console.WriteLine($"Start Merge the Files from: {parameter.Source}");
            Console.WriteLine($"Target File: {parameter.Target}");
            Console.WriteLine($"Setting File: {parameter.Setting}");

            var progress = new Progress <IProgressReport>(report =>
            {
                TextProgressBar.Draw(report.Current, report.Total);
            });

            await pdfOrganizerService.SplitBlock(parameter.Source, parameter.Target, parameter.Setting, progress);
        }
        public async Task Handle(object parameterObj)
        {
            var parameter = parameterObj as CompareParameter;

            Console.WriteLine("Start Compare the Files:");
            Console.WriteLine($"{parameter.Path1}");
            Console.WriteLine("And:");
            Console.WriteLine($"{parameter.Path2}");
            Console.WriteLine($"Config File: {parameter.ConfigFile}");
            Console.WriteLine($"Result will Save to: {parameter.OutputPath}");

            var progress = new Progress <IProgressReport>(report =>
            {
                TextProgressBar.Draw(report.Current, report.Total);
            });
            var compareFiles = await compareService.Compare(parameter.Path1, parameter.Path2, parameter.ConfigFile, progress);

            Thread.Sleep(200);
            await reportService.Output(compareFiles, parameter.Path1, parameter.Path2, parameter.OutputPath, false);
        }
        public async Task Handle(object parameterObj)
        {
            var parameter = parameterObj as SplitParameter;

            Console.WriteLine($"Start Split the File: {parameter.FileName}");
            Console.WriteLine($"On Node: {parameter.NodeName}");
            Console.WriteLine($"To Path: {parameter.OutputPath}");

            var progress = new Progress <IProgressReport>(report =>
            {
                TextProgressBar.Draw(report.Current, report.Total);
            });

            if (string.IsNullOrWhiteSpace(parameter.OutputFileNamePattern))
            {
                await service.SplitFile(parameter.FileName, parameter.OutputPath, parameter.NodeName, progress);
            }
            else
            {
                Console.WriteLine($"Output File Name Pattern: {parameter.OutputFileNamePattern}");
                await service.SplitFile(parameter.FileName, parameter.OutputPath, parameter.NodeName, parameter.OutputFileNamePattern, progress);
            }
        }
示例#8
0
        private void UpdateCapacity()
        {
            if (this._totalDiscSize == 0L)
            {
                this.progSize.Text = "0MB";
                return;
            }
            this.progSize.Text = (this._totalDiscSize < 1000000000L ? string.Format("{0}MB", this._totalDiscSize / 1000000L) : string.Format("{0:F2}GB", (double)((float)this._totalDiscSize) / 1000000000));
            long sizeOnDisc = 0L;

            foreach (IMediaItem dirItem in this.DirItems)
            {
                sizeOnDisc += dirItem.SizeOnDisc;
            }
            if (sizeOnDisc == 0L)
            {
                this.progSize.Value       = 0;
                this.btn_BurnDisc.Text    = LangCtrl.GetString("btn_BurnDisc", "Burn Disc");
                this.btn_BurnDisc.Enabled = true;
                return;
            }
            int num = (int)(sizeOnDisc * 100L / this._totalDiscSize);

            if (num > 100)
            {
                this.progSize.Value       = 100;
                this.progSize.Text        = LangCtrl.GetString("DiscSize", "Disc Capacity Exceeded!");
                this.btn_BurnDisc.Enabled = false;
                return;
            }
            this.progSize.Value = num;
            TextProgressBar textProgressBar = this.progSize;

            textProgressBar.Text      = string.Concat(textProgressBar.Text, string.Format(" - {0}% Free", 100 - num));
            this.btn_BurnDisc.Enabled = true;
        }
示例#9
0
 public void setProgressBar(TextProgressBar myBar)
 {
     this.textProgressBar1 = myBar;
 }
示例#10
0
        private static void Main(string[] args)
        {
            var configuration = new ConfigurationBuilder()
                                .AddJsonFile("appsettings.json")
                                .Build();

            _appSettings = new AppSettings
            {
                TargetPatches = configuration.GetSection(nameof(AppSettings.TargetPatches)).GetChildren().Select(targetPatch => new TargetPatch
                {
                    Patch        = Enum.Parse <GamePatch>(targetPatch.GetSection(nameof(TargetPatch.Patch)).Value),
                    GameDataPath = targetPatch.GetSection(nameof(TargetPatch.GameDataPath)).Value,
                }).ToList(),
            };

            _watcher          = new FileSystemWatcher();
            _watcher.Created += OnWatchedFileEvent;
            _watcher.Renamed += OnWatchedFileEvent;
            _watcher.Deleted += OnWatchedFileEvent;

            var form = new Form();

            form.Size        = new Size(1280, 720);
            form.MinimumSize = new Size(400, 300);
            form.Text        = Title;

            var splitContainer = new SplitContainer
            {
                Dock = DockStyle.Fill,
            };

            _archiveInput = new TextBox
            {
                PlaceholderText = "Input map or campaign...",
            };

            _openCloseArchiveButton = new Button
            {
                Text    = "Open archive",
                Enabled = false,
            };

            _diagnosticsDisplay = new TextBox
            {
                Multiline  = true,
                ReadOnly   = true,
                Dock       = DockStyle.Fill,
                ScrollBars = ScrollBars.Vertical,
            };

            _progressBar = new TextProgressBar
            {
                Dock       = DockStyle.Bottom,
                Style      = ProgressBarStyle.Continuous,
                VisualMode = TextProgressBar.ProgressBarDisplayMode.CustomText,
                Visible    = false,
            };

            _openArchiveWorker = new BackgroundWorker
            {
                WorkerReportsProgress      = true,
                WorkerSupportsCancellation = false,
            };

            _openArchiveWorker.DoWork             += OpenArchiveBackgroundWork;
            _openArchiveWorker.ProgressChanged    += OpenArchiveProgressChanged;
            _openArchiveWorker.RunWorkerCompleted += OpenArchiveCompleted;

            _saveArchiveWorker = new BackgroundWorker
            {
                WorkerReportsProgress      = true,
                WorkerSupportsCancellation = false,
            };

            _saveArchiveWorker.DoWork             += SaveArchiveBackgroundWork;
            _saveArchiveWorker.ProgressChanged    += SaveArchiveProgressChanged;
            _saveArchiveWorker.RunWorkerCompleted += SaveArchiveCompleted;

            _adaptAllButton = new Button
            {
                Text = "Adapt all",
            };

            _adaptAllButton.Size    = _adaptAllButton.PreferredSize;
            _adaptAllButton.Enabled = false;

            _saveAsButton = new Button
            {
                Text = "Save As...",
            };

            _saveAsButton.Size    = _saveAsButton.PreferredSize;
            _saveAsButton.Enabled = false;

            _targetPatchesComboBox = new ComboBox
            {
                Enabled       = false,
                DropDownStyle = ComboBoxStyle.DropDownList,
                Width         = 120,
            };

            _targetPatchesComboBox.Items.AddRange(_appSettings.TargetPatches.OrderByDescending(targetPatch => targetPatch.Patch).Select(targetPatch => (object)targetPatch.Patch).ToArray());
            if (_targetPatchesComboBox.Items.Count == 1)
            {
                _targetPatchesComboBox.SelectedIndex = 0;
            }

            _targetPatchesComboBox.SelectedIndexChanged += (s, e) =>
            {
                _targetPatch            = (GamePatch?)_targetPatchesComboBox.SelectedItem;
                _adaptAllButton.Enabled = _targetPatch.HasValue && _fileList.Items.Count > 0;
            };

            _targetPatchesComboBox.FormattingEnabled = true;
            _targetPatchesComboBox.Format           += (s, e) =>
            {
                if (e.ListItem is GamePatch gamePatch)
                {
                    e.Value = gamePatch.ToString().Replace('_', '.');
                }
            };

            _archiveInput.TextChanged += OnArchiveInputTextChanged;

            _archiveInputBrowseButton = new Button
            {
                Text = "Browse",
            };

            _archiveInputBrowseButton.Size   = _archiveInputBrowseButton.PreferredSize;
            _archiveInputBrowseButton.Click += (s, e) =>
            {
                var openFileDialog = new OpenFileDialog
                {
                    CheckFileExists = false,
                };
                openFileDialog.Filter = string.Join('|', new[]
                {
                    "Warcraft III archive|*.w3m;*.w3x;*.w3n",
                    "Warcraft III map|*.w3m;*.w3x",
                    "Warcraft III campaign|*.w3n",
                    "All files|*.*",
                });
                var openFileDialogResult = openFileDialog.ShowDialog();
                if (openFileDialogResult == DialogResult.OK)
                {
                    _archiveInput.Text = openFileDialog.FileName;
                }
            };

            _fileList = new ListView
            {
                Dock = DockStyle.Fill,
            };

            _fileListSorter = new FileListSorter(_fileList);

            _fileList.ListViewItemSorter = _fileListSorter;
            _fileList.ColumnClick       += _fileListSorter.Sort;

            _fileList.View = View.Details;
            _fileList.Columns.AddRange(new[]
            {
                new ColumnHeader {
                    Text = "Status", Width = 102
                },
                new ColumnHeader {
                    Text = "FileName", Width = 300
                },
                new ColumnHeader {
                    Text = "FileType", Width = 130
                },
                new ColumnHeader {
                    Text = "Archive", Width = 87
                },
            });

            _fileList.FullRowSelect = true;
            _fileList.MultiSelect   = true;

            _fileList.HeaderStyle = ColumnHeaderStyle.Clickable;

            _fileList.SmallImageList = new ImageList();
            var statusColors = new Dictionary <MapFileStatus, Color>
            {
                { MapFileStatus.Adapted, Color.LimeGreen },
                { MapFileStatus.AdapterError, Color.Red },
                { MapFileStatus.Compatible, Color.ForestGreen },
                { MapFileStatus.ConfigError, Color.DarkSlateBlue },
                { MapFileStatus.Incompatible, Color.Yellow },
                { MapFileStatus.Locked, Color.OrangeRed },
                { MapFileStatus.Modified, Color.Blue },
                { MapFileStatus.ParseError, Color.Maroon },
                { MapFileStatus.Pending, Color.LightSkyBlue },
                { MapFileStatus.Removed, Color.DarkSlateGray },
                { MapFileStatus.Unadaptable, Color.IndianRed },
                { MapFileStatus.Unknown, Color.DarkViolet },
            };

            foreach (var status in Enum.GetValues(typeof(MapFileStatus)))
            {
                _fileList.SmallImageList.Images.Add(new Bitmap(16, 16).WithSolidColor(statusColors[(MapFileStatus)status]));
            }

            var fileListContextMenu = new ContextMenuStrip
            {
            };

            _editContextButton         = new ToolStripButton("Edit");
            _editContextButton.Enabled = false;
            _editContextButton.Click  += OnClickEditSelected;

            _adaptContextButton         = new ToolStripButton("Adapt");
            _adaptContextButton.Enabled = false;
            _adaptContextButton.Click  += OnClickAdaptSelected;

            _removeContextButton         = new ToolStripButton("Remove");
            _removeContextButton.Enabled = false;
            _removeContextButton.Click  += OnClickRemoveSelected;

            fileListContextMenu.Items.AddRange(new[]
            {
                _adaptContextButton,
                _editContextButton,
                _removeContextButton,
            });

            _fileList.ContextMenuStrip = fileListContextMenu;

            _openCloseArchiveButton.Size   = _openCloseArchiveButton.PreferredSize;
            _openCloseArchiveButton.Click += OnClickOpenCloseMap;

            _adaptAllButton.Click += (s, e) =>
            {
                _targetPatchesComboBox.Enabled = false;
                var parentsToUpdate = new HashSet <ItemTag>();
                for (var i = 0; i < _fileList.Items.Count; i++)
                {
                    var item = _fileList.Items[i];
                    var tag  = item.GetTag();

                    var adapter = tag.Adapter;
                    if (adapter != null && (tag.Status == MapFileStatus.Pending || tag.Status == MapFileStatus.Modified))
                    {
                        tag.CurrentStream.Position = 0;
                        var adaptResult = adapter.AdaptFile(tag.CurrentStream, GetTargetPatch(_targetPatch.Value), tag.GetOriginPatch(_originPatch.Value));
                        tag.UpdateAdaptResult(adaptResult);

                        if (tag.Parent != null)
                        {
                            parentsToUpdate.Add(tag.Parent);
                        }
                    }
                }

                foreach (var parent in parentsToUpdate)
                {
                    parent.ListViewItem.Update();
                }

                UpdateDiagnosticsDisplay();
            };

            _fileList.KeyDown += (s, e) =>
            {
                if (e.KeyCode == Keys.Delete)
                {
                    OnClickRemoveSelected(s, e);
                }
            };

            _fileList.SelectedIndexChanged += OnFileSelectionChanged;

            _fileList.ItemActivate += OnClickEditSelected;

            _saveAsButton.Click += (s, e) =>
            {
                var saveFileDialog = new SaveFileDialog
                {
                    OverwritePrompt = true,
                    CreatePrompt    = false,
                };

                var saveFileDialogResult = saveFileDialog.ShowDialog();
                if (saveFileDialogResult == DialogResult.OK)
                {
                    SaveArchive(saveFileDialog.FileName);
                }
            };

            var flowLayout = new FlowLayoutPanel
            {
                Dock          = DockStyle.Top,
                FlowDirection = FlowDirection.TopDown,
                Width         = 640,
            };

            var inputArchiveFlowLayout = new FlowLayoutPanel
            {
                FlowDirection = FlowDirection.LeftToRight,
            };

            var buttonsFlowLayout = new FlowLayoutPanel
            {
                FlowDirection = FlowDirection.LeftToRight,
            };

            var targetPatchLabel = new Label
            {
                Text      = "Target patch",
                TextAlign = ContentAlignment.BottomRight,
            };

            inputArchiveFlowLayout.AddControls(_archiveInput, _archiveInputBrowseButton, _openCloseArchiveButton);
            buttonsFlowLayout.AddControls(_adaptAllButton, _saveAsButton, targetPatchLabel, _targetPatchesComboBox);
            flowLayout.AddControls(inputArchiveFlowLayout, buttonsFlowLayout);

            splitContainer.Panel1.AddControls(_diagnosticsDisplay, flowLayout);
            splitContainer.Panel2.AddControls(_fileList);
            form.AddControls(splitContainer, _progressBar);

            targetPatchLabel.Size = targetPatchLabel.PreferredSize;

            splitContainer.Panel1.SizeChanged += (s, e) =>
            {
                var width = splitContainer.Panel1.Width;
                _archiveInput.Width = (width > 360 ? 360 : width) - 10;

                inputArchiveFlowLayout.Size = inputArchiveFlowLayout.GetPreferredSize(new Size(width, 0));
                buttonsFlowLayout.Size      = buttonsFlowLayout.GetPreferredSize(new Size(width, 0));
                flowLayout.Height
                    = inputArchiveFlowLayout.Margin.Top + inputArchiveFlowLayout.Height + inputArchiveFlowLayout.Margin.Bottom
                      + buttonsFlowLayout.Margin.Top + buttonsFlowLayout.Height + buttonsFlowLayout.Margin.Bottom;
            };

            splitContainer.SplitterDistance = 640 - splitContainer.SplitterWidth;
            splitContainer.Panel1MinSize    = 200;

            form.FormClosing += (s, e) =>
            {
                _archive?.Dispose();
                _openArchiveWorker?.Dispose();
                _saveArchiveWorker?.Dispose();
                _fileSelectionChangedEventTimer?.Dispose();
            };

            form.ShowDialog();
        }
示例#11
0
        private void TimerUpdate()
        {
            SuspendLayout();

            rxButtons1.updateStatus("");


            TTTStatus.Text = GrblCore.TranslateEnum(Core.MachineStatus);

            /*
             *                      if (Core.InProgram)
             *                              TTTEstimated.Text = Tools.Utils.TimeSpanToString(Core.ProjectedTime, Tools.Utils.TimePrecision.Second, Tools.Utils.TimePrecision.Second, " ,", true);
             *                      else
             *                              TTTEstimated.Text = Tools.Utils.TimeSpanToString(Core.LoadedFile.EstimatedTime, Tools.Utils.TimePrecision.Second, Tools.Utils.TimePrecision.Second, " ,", true);
             *
             *                      if (Core.InProgram)
             *                              TTLEstimated.Text = Strings.MainFormProjectedTime;
             *                      else
             *                              TTLEstimated.Text = Strings.MainFormEstimatedTime;
             */

            if (Core.InProgram)
            {
                rxMenuBarSecond1.valueOfTime = Strings.MainFormProjectedTime + Tools.Utils.TimeSpanToString(Core.ProjectedTime, Tools.Utils.TimePrecision.Second, Tools.Utils.TimePrecision.Second, " ,", true);
            }
            else
            {
                rxMenuBarSecond1.valueOfTime = Strings.MainFormEstimatedTime + Tools.Utils.TimeSpanToString(Core.LoadedFile.EstimatedTime, Tools.Utils.TimePrecision.Second, Tools.Utils.TimePrecision.Second, " ,", true);
            }

/*
 *          if (Core.InProgram)
 *              rxMenuBarSecond1.valueOfTime = Strings.MainFormProjectedTime;
 *          else
 *              rxMenuBarSecond1.valueOfTime = Strings.MainFormEstimatedTime;
 */

            MnFileOpen.Enabled          = Core.CanLoadNewFile;
            MnAdvancedSave.Enabled      = MnSaveProgram.Enabled = Core.HasProgram;
            MnFileSend.Enabled          = Core.CanSendFile;
            MnStartFromPosition.Enabled = Core.CanSendFile;
            MnRunMulti.Enabled          = Core.CanSendFile || Core.CanResumeHold || Core.CanFeedHold;
            MnGrblConfig.Enabled        = true;
            //MnExportConfig.Enabled = Core.CanImportExport;
            //MnImportConfig.Enabled = Core.CanImportExport;
            MnGrblReset.Enabled = Core.CanResetGrbl;

            MNEsp8266.Visible = false;            // (Settings.GetObject("ComWrapper Protocol", ComWrapper.WrapperType.UsBSerial)) == ComWrapper.WrapperType.LaserWebESP8266;

            MnConnect.Visible    = !Core.IsConnected;
            MnDisconnect.Visible = Core.IsConnected;

            MnGoHome.Visible = Core.Configuration.HomingEnabled;
            MnGoHome.Enabled = Core.CanDoHoming;
            MnUnlock.Enabled = Core.CanUnlock;

            TTOvG0.Visible = Core.SupportOverride;
            TTOvG1.Visible = Core.SupportOverride;
            TTOvS.Visible  = Core.SupportOverride;
            spacer.Visible = Core.SupportOverride;

            ComWrapper.WrapperType wt = Settings.GetObject("ComWrapper Protocol", ComWrapper.WrapperType.UsbSerial);
            MnWiFiDiscovery.Visible = wt == ComWrapper.WrapperType.LaserWebESP8266 || wt == ComWrapper.WrapperType.Telnet;
            MnWiFiDiscovery.Enabled = !Core.IsConnected;

            switch (Core.MachineStatus)
            {
            //Disconnected, Connecting, Idle, *Run, *Hold, *Door, Home, *Alarm, *Check, *Jog

            case GrblCore.MacStatus.Alarm:
                TTTStatus.BackColor = Color.Red;
                TTTStatus.ForeColor = Color.White;
                break;

            case GrblCore.MacStatus.Door:
            case GrblCore.MacStatus.Hold:
            case GrblCore.MacStatus.Cooling:
                TTTStatus.BackColor = Color.DarkOrange;
                TTTStatus.ForeColor = Color.Black;
                break;

            case GrblCore.MacStatus.Jog:
            case GrblCore.MacStatus.Run:
            case GrblCore.MacStatus.Check:
                TTTStatus.BackColor = Color.LightGreen;
                TTTStatus.ForeColor = Color.Black;
                break;

            default:
                TTTStatus.BackColor = ColorScheme.FormBackColor;
                TTTStatus.ForeColor = ColorScheme.FormForeColor;
                break;
            }

            /*
             * PbBuffer.Maximum = Core.BufferSize;
             * PbBuffer.Value = Core.UsedBuffer;
             * PbBuffer.ToolTipText = $"Buffer: {Core.UsedBuffer}/{Core.BufferSize} Free:{Core.FreeBuffer}";
             */

            TextProgressBar myBar = rxMenuBarSecond1.getBar();

            myBar.Maximum    = Core.BufferSize;
            myBar.CustomText = "Buffer";
            myBar.Value      = Core.UsedBuffer;
            rxMenuBarSecond1.setProgressBar(myBar);

            ResumeLayout();
        }
示例#12
0
        private static void Main(string[] args)
        {
            _watcher          = new FileSystemWatcher();
            _watcher.Created += OnWatchedFileEvent;
            _watcher.Renamed += OnWatchedFileEvent;
            _watcher.Deleted += OnWatchedFileEvent;

            var form = new Form();

            form.Text = Title;

            _archiveInput = new TextBox
            {
                PlaceholderText = "Input map...",
            };

            _openCloseArchiveButton = new Button
            {
                Text    = "Open archive",
                Enabled = false,
            };

            _saveAsButton = new Button
            {
                Text = "Save As...",
            };

            _saveAsButton.Size    = _saveAsButton.PreferredSize;
            _saveAsButton.Enabled = false;

            _autoDetectFilesToDecompileButton = new Button
            {
                Text = "Detect files to decompile",
            };

            _autoDetectFilesToDecompileButton.Size    = _autoDetectFilesToDecompileButton.PreferredSize;
            _autoDetectFilesToDecompileButton.Enabled = false;

            _filesToDecompileCheckBoxes = new[]
            {
                new MapFileCheckBox(MapFiles.Sounds, MapSounds.FileName),
                new MapFileCheckBox(MapFiles.Cameras, MapCameras.FileName),
                new MapFileCheckBox(MapFiles.Regions, MapRegions.FileName),
                new MapFileCheckBox(MapFiles.Triggers, MapSounds.FileName),
                new MapFileCheckBox(MapFiles.Units, MapUnits.FileName),
            };

            foreach (var checkBox in _filesToDecompileCheckBoxes)
            {
                checkBox.Size    = checkBox.PreferredSize;
                checkBox.Enabled = false;

                checkBox.CheckedChanged += (s, e) =>
                {
                    _saveAsButton.Enabled = _filesToDecompileCheckBoxes.Any(checkBox => checkBox.Checked);
                };
            }

            _archiveInput.TextChanged += OnArchiveInputTextChanged;

            _archiveInputBrowseButton = new Button
            {
                Text = "Browse",
            };

            _archiveInputBrowseButton.Size   = _archiveInputBrowseButton.PreferredSize;
            _archiveInputBrowseButton.Click += (s, e) =>
            {
                var openFileDialog = new OpenFileDialog
                {
                    CheckFileExists = false,
                };
                openFileDialog.Filter = string.Join('|', new[]
                {
                    "Warcraft III map|*.w3m;*.w3x",
                    "All files|*.*",
                });
                var openFileDialogResult = openFileDialog.ShowDialog();
                if (openFileDialogResult == DialogResult.OK)
                {
                    _archiveInput.Text = openFileDialog.FileName;
                }
            };

            _openCloseArchiveButton.Size   = _openCloseArchiveButton.PreferredSize;
            _openCloseArchiveButton.Click += OnClickOpenCloseMap;

            _saveAsButton.Click += (s, e) =>
            {
                var saveFileDialog = new SaveFileDialog
                {
                    OverwritePrompt = true,
                    CreatePrompt    = false,
                };

                var saveFileDialogResult = saveFileDialog.ShowDialog();
                if (saveFileDialogResult == DialogResult.OK)
                {
                    _progressBar.CustomText = "Starting...";
                    _progressBar.Value      = 0;

                    _openCloseArchiveButton.Enabled           = false;
                    _saveAsButton.Enabled                     = false;
                    _autoDetectFilesToDecompileButton.Enabled = false;
                    foreach (var checkBox in _filesToDecompileCheckBoxes)
                    {
                        checkBox.Enabled = false;
                    }

                    _progressBar.Visible = true;

                    _worker.RunWorkerAsync(saveFileDialog.FileName);
                }
            };

            _autoDetectFilesToDecompileButton.Click += (s, e) =>
            {
                var filesToDecompile = MapDecompiler.AutoDetectMapFilesToDecompile(_map);

                foreach (var checkBox in _filesToDecompileCheckBoxes)
                {
                    checkBox.Checked = filesToDecompile.HasFlag(checkBox.MapFile);
                }
            };

            _progressBar = new TextProgressBar
            {
                Dock       = DockStyle.Bottom,
                Style      = ProgressBarStyle.Continuous,
                VisualMode = TextProgressBar.ProgressBarDisplayMode.CustomText,
                Visible    = false,
            };

            _worker = new BackgroundWorker
            {
                WorkerReportsProgress      = true,
                WorkerSupportsCancellation = true,
            };

            _worker.DoWork             += DecompileMapBackgroundWork;
            _worker.ProgressChanged    += DecompileMapProgressChanged;
            _worker.RunWorkerCompleted += DecompileMapCompleted;

            // Initialize parser
            JassSyntaxFactory.ParseCompilationUnit(string.Empty);

            var flowLayout = new FlowLayoutPanel
            {
                Dock          = DockStyle.Fill,
                FlowDirection = FlowDirection.TopDown,
                WrapContents  = false,
            };

            var inputArchiveFlowLayout = new FlowLayoutPanel
            {
                FlowDirection = FlowDirection.LeftToRight,
            };

            var buttonsFlowLayout = new FlowLayoutPanel
            {
                FlowDirection = FlowDirection.LeftToRight,
            };

            var checkBoxesFlowLayout = new FlowLayoutPanel
            {
                FlowDirection = FlowDirection.TopDown,
                WrapContents  = false,
            };

            inputArchiveFlowLayout.AddControls(_archiveInput, _archiveInputBrowseButton, _openCloseArchiveButton);
            buttonsFlowLayout.AddControls(_saveAsButton, _autoDetectFilesToDecompileButton);
            checkBoxesFlowLayout.AddControls(_filesToDecompileCheckBoxes);
            checkBoxesFlowLayout.Size = checkBoxesFlowLayout.PreferredSize;

            flowLayout.AddControls(inputArchiveFlowLayout, buttonsFlowLayout, checkBoxesFlowLayout);

            form.AddControls(flowLayout, _progressBar);

            form.SizeChanged += (s, e) =>
            {
                var width = form.Width;
                _archiveInput.Width = (width > 360 ? 360 : width) - 10;

                inputArchiveFlowLayout.Size = inputArchiveFlowLayout.GetPreferredSize(new Size(width, 0));
                buttonsFlowLayout.Size      = buttonsFlowLayout.GetPreferredSize(new Size(width, 0));
                flowLayout.Height
                    = inputArchiveFlowLayout.Margin.Top + inputArchiveFlowLayout.Height + inputArchiveFlowLayout.Margin.Bottom
                      + buttonsFlowLayout.Margin.Top + buttonsFlowLayout.Height + buttonsFlowLayout.Margin.Bottom;
            };

            form.Size        = new Size(400, 400);
            form.MinimumSize = new Size(400, 300);

            form.FormClosing += (s, e) =>
            {
                _archive?.Dispose();
                _worker?.Dispose();
            };

            form.ShowDialog();
        }
示例#13
0
        ///////////////////////////////////////////////////////////////////////

        #region Windows Form Designer generated code
        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            Color lightBlueColor = Color.FromArgb(
                ((int)(((byte)(118)))), ((int)(((byte)(134)))),
                ((int)(((byte)(157)))));

            Color darkBlueColor = Color.FromArgb(
                ((int)(((byte)(72)))), ((int)(((byte)(93)))),
                ((int)(((byte)(124)))));

            Font font = new Font(
                "Segoe UI", 9.00F, FontStyle.Regular, GraphicsUnit.Point,
                ((byte)(0)));

            Font buttonFont = new Font(
                "Segoe UI", 13.00F, FontStyle.Regular, GraphicsUnit.Point,
                ((byte)(0)));

            BorderStyle labelBorderStyle = BorderStyle.None;

            ComponentResourceManager resources =
                new ComponentResourceManager(typeof(UpdateForm));

            ///////////////////////////////////////////////////////////////////

            this.btnCancel  = new Button();
            this.btnUpdate  = new Button();
            this.lblBanner  = new Label();
            this.lblPercent = new Label();
            this.lblUpdate  = new Label();
            this.lblUri     = new Label();
            this.prbUpdate  = new TextProgressBar();

            ///////////////////////////////////////////////////////////////////

            this.SuspendLayout();

            ///////////////////////////////////////////////////////////////////
            //
            // btnCancel
            //
            this.btnCancel.BackColor               = lightBlueColor;
            this.btnCancel.DialogResult            = DialogResult.Cancel;
            this.btnCancel.FlatStyle               = FlatStyle.Flat;
            this.btnCancel.Font                    = buttonFont;
            this.btnCancel.Location                = new Point(415, 180);
            this.btnCancel.Name                    = "btnCancel";
            this.btnCancel.Size                    = new Size(207, 41);
            this.btnCancel.TabIndex                = 6;
            this.btnCancel.Text                    = "&Cancel";
            this.btnCancel.UseVisualStyleBackColor = false;

            ///////////////////////////////////////////////////////////////////
            //
            // btnUpdate
            //
            this.btnUpdate.BackColor = lightBlueColor;
            this.btnUpdate.FlatStyle = FlatStyle.Flat;
            this.btnUpdate.Font      = buttonFont;
            this.btnUpdate.Location  = new Point(12, 180);
            this.btnUpdate.Name      = "btnUpdate";
            this.btnUpdate.Size      = new Size(207, 41);
            this.btnUpdate.TabIndex  = 5;
            this.btnUpdate.Text      = "&Update";
            this.btnUpdate.UseVisualStyleBackColor = false;

            ///////////////////////////////////////////////////////////////////
            //
            // lblBanner
            //
            this.lblBanner.BorderStyle = labelBorderStyle;
            this.lblBanner.Image       = Resources.bannerMini;
            this.lblBanner.Location    = new Point(12, 12);
            this.lblBanner.Name        = "lblBanner";
            this.lblBanner.Size        = new Size(180, 60);
            this.lblBanner.TabIndex    = 0;
            this.lblBanner.UseMnemonic = false;

            ///////////////////////////////////////////////////////////////////
            //
            // lblPercent
            //
            this.lblPercent.BorderStyle = labelBorderStyle;
            this.lblPercent.BackColor   = darkBlueColor;
            this.lblPercent.Font        = font;
            this.lblPercent.ForeColor   = Color.White;
            this.lblPercent.Location    = new Point(200, 62);
            this.lblPercent.Name        = "lblPercent";
            this.lblPercent.Size        = new Size(422, 22);
            this.lblPercent.TabIndex    = 2;
            this.lblPercent.UseMnemonic = false;

            ///////////////////////////////////////////////////////////////////
            //
            // lblUpdate
            //
            this.lblUpdate.BorderStyle = labelBorderStyle;
            this.lblUpdate.BackColor   = darkBlueColor;
            this.lblUpdate.Font        = font;
            this.lblUpdate.ForeColor   = Color.White;
            this.lblUpdate.Location    = new Point(200, 12);
            this.lblUpdate.Name        = "lblUpdate";
            this.lblUpdate.Size        = new Size(422, 42);
            this.lblUpdate.TabIndex    = 1;
            this.lblUpdate.UseMnemonic = false;

            ///////////////////////////////////////////////////////////////////
            //
            // lblUri
            //
            this.lblUri.BorderStyle = labelBorderStyle;
            this.lblUri.BackColor   = darkBlueColor;
            this.lblUri.Font        = font;
            this.lblUri.ForeColor   = Color.White;
            this.lblUri.Location    = new Point(12, 130);
            this.lblUri.Name        = "lblUri";
            this.lblUri.Size        = new Size(610, 42);
            this.lblUri.TabIndex    = 4;
            this.lblUri.UseMnemonic = false;

            ///////////////////////////////////////////////////////////////////
            //
            // prbUpdate
            //
            this.prbUpdate.ForeColor = lightBlueColor;
            this.prbUpdate.TextColor = Color.White;
            this.prbUpdate.Location  = new Point(12, 92);
            this.prbUpdate.Maximum   = 1000;
            this.prbUpdate.Name      = "prbUpdate";
            this.prbUpdate.Size      = new Size(610, 30);
            this.prbUpdate.Style     = ProgressBarStyle.Continuous;
            this.prbUpdate.TabIndex  = 3;

            ///////////////////////////////////////////////////////////////////
            //
            // UpdateForm
            //
            this.Controls.Add(this.btnCancel);
            this.Controls.Add(this.btnUpdate);
            this.Controls.Add(this.lblBanner);
            this.Controls.Add(this.lblPercent);
            this.Controls.Add(this.lblUpdate);
            this.Controls.Add(this.lblUri);
            this.Controls.Add(this.prbUpdate);

            ///////////////////////////////////////////////////////////////////
            //
            // HACK: *MONO* Disable auto-scaling when running on Mono as
            //       it makes the form the wrong size.
            //
            this.AutoScaleMode = VersionOps.IsMono() ?
                                 AutoScaleMode.None : AutoScaleMode.Font;

            //
            // HACK: *MONO* Slightly adjust the height of the form when
            //       running on Mono; otherwise, it gets the size wrong.
            //
            this.ClientSize = VersionOps.IsMono() ?
                              new Size(634, 259) : new Size(634, 233);

            ///////////////////////////////////////////////////////////////////

            this.AcceptButton        = this.btnUpdate;
            this.CancelButton        = this.btnCancel;
            this.AutoScaleDimensions = new SizeF(6F, 13F);
            this.BackColor           = darkBlueColor;
            this.ControlBox          = false;
            this.Font            = font;
            this.ForeColor       = Color.White;
            this.FormBorderStyle = FormBorderStyle.FixedSingle;
            this.Icon            = ((Icon)(resources.GetObject("$this.Icon")));
            this.KeyPreview      = true;
            this.Name            = "UpdateForm";
            this.StartPosition   = FormStartPosition.CenterScreen;
            this.Text            = DefaultFormText;

            ///////////////////////////////////////////////////////////////////

            this.ResumeLayout(false);
        }
示例#14
0
 private void InitializeComponent()
 {
     this.chkEject         = new vCheckBox();
     this.lbl_DiscDrive    = new Label();
     this.lbl_VolumeLabel  = new Label();
     this.lblMedia         = new Label();
     this.btn_DetectMedia  = new vButton();
     this.btn_BurnDisc     = new vButton();
     this.progBar          = new TextProgressBar();
     this.progSize         = new TextProgressBar();
     this.txtVolumeLabel   = new vTextBox();
     this.cboDevice        = new vComboBox();
     this.backgroundWorker = new BackgroundWorker();
     this.lbl_DiscStatus   = new Label();
     base.SuspendLayout();
     this.chkEject.BackColor  = Color.Transparent;
     this.chkEject.Checked    = true;
     this.chkEject.CheckState = CheckState.Checked;
     this.chkEject.Location   = new Point(130, 5);
     this.chkEject.Name       = "chkEject";
     this.chkEject.Size       = new Size(271, 24);
     this.chkEject.TabIndex   = 0;
     this.chkEject.Text       = "Eject Disc When Completed";
     this.chkEject.UseVisualStyleBackColor = false;
     this.chkEject.VIBlendTheme            = VIBLEND_THEME.VISTABLUE;
     this.lbl_DiscDrive.AutoSize           = true;
     this.lbl_DiscDrive.Location           = new Point(4, 40);
     this.lbl_DiscDrive.Name                      = "lbl_DiscDrive";
     this.lbl_DiscDrive.Size                      = new Size(56, 13);
     this.lbl_DiscDrive.TabIndex                  = 1;
     this.lbl_DiscDrive.Text                      = "Disc Drive";
     this.lbl_VolumeLabel.AutoSize                = true;
     this.lbl_VolumeLabel.Location                = new Point(4, 69);
     this.lbl_VolumeLabel.Name                    = "lbl_VolumeLabel";
     this.lbl_VolumeLabel.Size                    = new Size(95, 13);
     this.lbl_VolumeLabel.TabIndex                = 3;
     this.lbl_VolumeLabel.Text                    = "Disc Volume Label";
     this.lblMedia.BorderStyle                    = BorderStyle.FixedSingle;
     this.lblMedia.Location                       = new Point(308, 35);
     this.lblMedia.Name                           = "lblMedia";
     this.lblMedia.Size                           = new Size(121, 23);
     this.lblMedia.TabIndex                       = 5;
     this.lblMedia.Text                           = "No Media";
     this.lblMedia.TextAlign                      = ContentAlignment.MiddleCenter;
     this.btn_DetectMedia.AllowAnimations         = true;
     this.btn_DetectMedia.BackColor               = Color.Transparent;
     this.btn_DetectMedia.Location                = new Point(308, 64);
     this.btn_DetectMedia.Name                    = "btn_DetectMedia";
     this.btn_DetectMedia.RoundedCornersMask      = 15;
     this.btn_DetectMedia.RoundedCornersRadius    = 0;
     this.btn_DetectMedia.Size                    = new Size(121, 46);
     this.btn_DetectMedia.TabIndex                = 6;
     this.btn_DetectMedia.Text                    = "Detect Media";
     this.btn_DetectMedia.UseVisualStyleBackColor = false;
     this.btn_DetectMedia.VIBlendTheme            = VIBLEND_THEME.VISTABLUE;
     this.btn_DetectMedia.Click                  += new EventHandler(this.btn_DetectMedia_Click);
     this.btn_BurnDisc.AllowAnimations            = true;
     this.btn_BurnDisc.BackColor                  = Color.Transparent;
     this.btn_BurnDisc.Enabled                    = false;
     this.btn_BurnDisc.Location                   = new Point(308, 116);
     this.btn_BurnDisc.Name                       = "btn_BurnDisc";
     this.btn_BurnDisc.RoundedCornersMask         = 15;
     this.btn_BurnDisc.RoundedCornersRadius       = 0;
     this.btn_BurnDisc.Size                       = new Size(121, 46);
     this.btn_BurnDisc.TabIndex                   = 7;
     this.btn_BurnDisc.Text                       = "Burn Disc";
     this.btn_BurnDisc.UseVisualStyleBackColor    = false;
     this.btn_BurnDisc.VIBlendTheme               = VIBLEND_THEME.VISTABLUE;
     this.btn_BurnDisc.Click                     += new EventHandler(this.btn_BurnDisc_Click);
     this.progBar.Location                        = new Point(7, 98);
     this.progBar.Name                                = "progBar";
     this.progBar.Size                                = new Size(280, 12);
     this.progBar.TabIndex                            = 8;
     this.progBar.Text                                = "0%";
     this.progBar.TextForeColor                       = Color.Black;
     this.progBar.Visible                             = false;
     this.progSize.Location                           = new Point(7, 116);
     this.progSize.Name                               = "progSize";
     this.progSize.Size                               = new Size(280, 23);
     this.progSize.TabIndex                           = 9;
     this.progSize.Text                               = "0%";
     this.progSize.TextForeColor                      = Color.Black;
     this.txtVolumeLabel.BackColor                    = Color.White;
     this.txtVolumeLabel.BoundsOffset                 = new Size(1, 1);
     this.txtVolumeLabel.ControlBorderColor           = Color.FromArgb(39, 39, 39);
     this.txtVolumeLabel.DefaultText                  = "";
     this.txtVolumeLabel.Location                     = new Point(130, 64);
     this.txtVolumeLabel.MaxLength                    = 16;
     this.txtVolumeLabel.Name                         = "txtVolumeLabel";
     this.txtVolumeLabel.PasswordChar                 = '\0';
     this.txtVolumeLabel.ScrollBars                   = ScrollBars.None;
     this.txtVolumeLabel.SelectionLength              = 0;
     this.txtVolumeLabel.SelectionStart               = 0;
     this.txtVolumeLabel.Size                         = new Size(157, 23);
     this.txtVolumeLabel.TabIndex                     = 4;
     this.txtVolumeLabel.TextAlign                    = HorizontalAlignment.Left;
     this.txtVolumeLabel.VIBlendTheme                 = VIBLEND_THEME.VISTABLUE;
     this.cboDevice.BackColor                         = Color.White;
     this.cboDevice.DefaultText                       = "Select Disc...";
     this.cboDevice.DisplayMember                     = "";
     this.cboDevice.DropDownList                      = true;
     this.cboDevice.DropDownMaximumSize               = new Size(1000, 1000);
     this.cboDevice.DropDownMinimumSize               = new Size(10, 10);
     this.cboDevice.DropDownResizeDirection           = SizingDirection.Both;
     this.cboDevice.DropDownWidth                     = 157;
     this.cboDevice.Location                          = new Point(130, 35);
     this.cboDevice.Name                              = "cboDevice";
     this.cboDevice.RoundedCornersMaskListItem        = 15;
     this.cboDevice.Size                              = new Size(157, 23);
     this.cboDevice.TabIndex                          = 11;
     this.cboDevice.UseThemeBackColor                 = false;
     this.cboDevice.UseThemeDropDownArrowColor        = true;
     this.cboDevice.ValueMember                       = "";
     this.cboDevice.VIBlendScrollBarsTheme            = VIBLEND_THEME.VISTABLUE;
     this.cboDevice.VIBlendTheme                      = VIBLEND_THEME.VISTABLUE;
     this.backgroundWorker.WorkerReportsProgress      = true;
     this.backgroundWorker.WorkerSupportsCancellation = true;
     this.backgroundWorker.DoWork                    += new DoWorkEventHandler(this.backgroundWorker_DoWork);
     this.backgroundWorker.ProgressChanged           += new ProgressChangedEventHandler(this.backgroundWorker_ProgressChanged);
     this.backgroundWorker.RunWorkerCompleted        += new RunWorkerCompletedEventHandler(this.backgroundWorker_RunWorkerCompleted);
     this.lbl_DiscStatus.Location                     = new Point(7, 146);
     this.lbl_DiscStatus.Name                         = "lbl_DiscStatus";
     this.lbl_DiscStatus.Size                         = new Size(280, 16);
     this.lbl_DiscStatus.TabIndex                     = 12;
     this.lbl_DiscStatus.Text                         = "Ready...";
     base.AutoScaleDimensions                         = new SizeF(6f, 13f);
     base.AutoScaleMode                               = AutoScaleMode.Font;
     this.BackColor = Color.White;
     base.Controls.Add(this.lbl_DiscStatus);
     base.Controls.Add(this.cboDevice);
     base.Controls.Add(this.progSize);
     base.Controls.Add(this.progBar);
     base.Controls.Add(this.btn_BurnDisc);
     base.Controls.Add(this.btn_DetectMedia);
     base.Controls.Add(this.lblMedia);
     base.Controls.Add(this.txtVolumeLabel);
     base.Controls.Add(this.lbl_VolumeLabel);
     base.Controls.Add(this.lbl_DiscDrive);
     base.Controls.Add(this.chkEject);
     base.Name  = "CDCtrl";
     base.Size  = new Size(442, 174);
     base.Load += new EventHandler(this.CDCtrl_Load);
     base.ResumeLayout(false);
     base.PerformLayout();
 }
示例#15
0
        private static void Main(string[] args)
        {
            _watcher          = new FileSystemWatcher();
            _watcher.Created += OnWatchedFileEvent;
            _watcher.Renamed += OnWatchedFileEvent;
            _watcher.Deleted += OnWatchedFileEvent;

            var form = new Form();

            form.Text = Title;

            _archiveInput = new TextBox
            {
                PlaceholderText = "Input map...",
            };

            _openCloseArchiveButton = new Button
            {
                Text    = "Open archive",
                Enabled = false,
            };

            _saveAsButton = new Button
            {
                Text = "Save As...",
            };

            _saveAsButton.Size    = _saveAsButton.PreferredSize;
            _saveAsButton.Enabled = false;

            _targetScriptLanguagesComboBox = new ComboBox
            {
                Enabled       = false,
                DropDownStyle = ComboBoxStyle.DropDownList,
                Width         = 120,
            };

            _targetScriptLanguagesComboBox.SelectedIndexChanged += (s, e) =>
            {
                _targetScriptLanguage = (ScriptLanguage?)_targetScriptLanguagesComboBox.SelectedItem;
                _saveAsButton.Enabled = _targetScriptLanguage.HasValue;
            };

            _targetScriptLanguagesComboBox.FormattingEnabled = true;
            _targetScriptLanguagesComboBox.Format           += (s, e) =>
            {
                if (e.ListItem is ScriptLanguage scriptLanguage)
                {
                    e.Value = scriptLanguage.ToString();
                }
            };

            _archiveInput.TextChanged += OnArchiveInputTextChanged;

            _archiveInputBrowseButton = new Button
            {
                Text = "Browse",
            };

            _archiveInputBrowseButton.Size   = _archiveInputBrowseButton.PreferredSize;
            _archiveInputBrowseButton.Click += (s, e) =>
            {
                var openFileDialog = new OpenFileDialog
                {
                    CheckFileExists = false,
                };
                openFileDialog.Filter = string.Join('|', new[]
                {
                    "Warcraft III map|*.w3m;*.w3x",
                    "All files|*.*",
                });
                var openFileDialogResult = openFileDialog.ShowDialog();
                if (openFileDialogResult == DialogResult.OK)
                {
                    _archiveInput.Text = openFileDialog.FileName;
                }
            };

            _openCloseArchiveButton.Size   = _openCloseArchiveButton.PreferredSize;
            _openCloseArchiveButton.Click += OnClickOpenCloseMap;

            _saveAsButton.Click += (s, e) =>
            {
                var saveFileDialog = new SaveFileDialog
                {
                    OverwritePrompt = true,
                    CreatePrompt    = false,
                };

                var saveFileDialogResult = saveFileDialog.ShowDialog();
                if (saveFileDialogResult == DialogResult.OK)
                {
                    _progressStepIndex = 0;

                    _progressBar.CustomText = _progressBarSteps[_progressStepIndex];
                    _progressBar.Value      = 0;

                    _openCloseArchiveButton.Enabled        = false;
                    _saveAsButton.Enabled                  = false;
                    _targetScriptLanguagesComboBox.Enabled = false;
                    _progressBar.Visible = true;

                    _worker.RunWorkerAsync(saveFileDialog.FileName);
                }
            };

            _progressBar = new TextProgressBar
            {
                Dock       = DockStyle.Bottom,
                Style      = ProgressBarStyle.Continuous,
                VisualMode = TextProgressBar.ProgressBarDisplayMode.CustomText,
                Visible    = false,
            };

            _worker = new BackgroundWorker
            {
                WorkerReportsProgress      = true,
                WorkerSupportsCancellation = false,
            };

            _worker.DoWork             += TranspileMapBackgroundWork;
            _worker.ProgressChanged    += TranspileMapProgressChanged;
            _worker.RunWorkerCompleted += TranspileMapCompleted;

            // Initialize parser
            JassSyntaxFactory.ParseCompilationUnit(string.Empty);

            var flowLayout = new FlowLayoutPanel
            {
                Dock          = DockStyle.Fill,
                FlowDirection = FlowDirection.TopDown,
            };

            var inputArchiveFlowLayout = new FlowLayoutPanel
            {
                FlowDirection = FlowDirection.LeftToRight,
            };

            var buttonsFlowLayout = new FlowLayoutPanel
            {
                FlowDirection = FlowDirection.LeftToRight,
            };

            var targetScriptLanguageLabel = new Label
            {
                Text      = "Transpile to",
                TextAlign = ContentAlignment.BottomRight,
            };

            inputArchiveFlowLayout.AddControls(_archiveInput, _archiveInputBrowseButton, _openCloseArchiveButton);
            buttonsFlowLayout.AddControls(_saveAsButton, targetScriptLanguageLabel, _targetScriptLanguagesComboBox);
            flowLayout.AddControls(inputArchiveFlowLayout, buttonsFlowLayout);

            form.AddControls(flowLayout, _progressBar);

            targetScriptLanguageLabel.Size = targetScriptLanguageLabel.PreferredSize;

            form.SizeChanged += (s, e) =>
            {
                var width = form.Width;
                _archiveInput.Width = (width > 360 ? 360 : width) - 10;

                inputArchiveFlowLayout.Size = inputArchiveFlowLayout.GetPreferredSize(new Size(width, 0));
                buttonsFlowLayout.Size      = buttonsFlowLayout.GetPreferredSize(new Size(width, 0));
                flowLayout.Height
                    = inputArchiveFlowLayout.Margin.Top + inputArchiveFlowLayout.Height + inputArchiveFlowLayout.Margin.Bottom
                      + buttonsFlowLayout.Margin.Top + buttonsFlowLayout.Height + buttonsFlowLayout.Margin.Bottom;
            };

            form.Size        = new Size(400, 300);
            form.MinimumSize = new Size(400, 200);

            form.FormClosing += (s, e) =>
            {
                _archive?.Dispose();
                _worker?.Dispose();
            };

            form.ShowDialog();
        }