示例#1
0
        public ProjectDebugForm(Handling.Project project)
        {
            InitializeComponent();

            Text = Lang.Get["TitleDebug"];
            btnReprocess.Text    = Lang.Get["DebugProjectReprocess"];
            btnLoadOriginal.Text = Lang.Get["DebugProjectLoadOriginal"];
            btnDebug.Text        = Lang.Get["DebugProjectDebug"];

            foreach (File file in project.SearchData.Files.Where(file => HandlerList.GetFileHandler(file) is AbstractLanguageFileHandler))
            {
                entries.Add(new RelativeFile(project.SearchData.Root, file));
            }

            textBoxFilterFiles_TextChanged(textBoxFilterFiles, new EventArgs());
            listBoxFiles_SelectedValueChange(listBoxFiles, new EventArgs());

            #if WINDOWS
            SendMessage(textBoxCode.Handle, 0x00CB, new IntPtr(1), new [] { 16 });
            #endif
        }
示例#2
0
        private void BeginProjectLoad()
        {
            labelLoadInfo.Text = Lang.Get["LoadProjectSearchIO"];
            labelLoadData.Text = "";

            search.Refresh += count => this.InvokeSafe(() => {
                labelLoadData.Text = count.ToString(CultureInfo.InvariantCulture);
            });

            search.Finish += data => this.InvokeSafe(() => {
                labelLoadInfo.Text = Lang.Get["LoadProjectProcess"];
                labelLoadData.Text = "";
                UpdateProgress(ProgressBarStyle.Continuous, 0);

                project = new Handling.Project(data);

                project.Progress += (percentage, processedEntries, totalEntries) => this.InvokeSafe(() => {
                    UpdateProgress(ProgressBarStyle.Continuous, percentage);
                    labelLoadData.Text = Lang.Get["LoadProjectProcessingFiles", processedEntries, totalEntries];
                });

                project.Finish += vars => this.InvokeSafe(() => {
                    variables = Program.Config.IsDebuggingTemplate ? new Variables.Dummy() : vars;

                    labelLoadInfo.Text = Lang.Get["LoadProjectProcessingDone"];

                    btnCancel.Visible = false;
                    flowLayoutButtonsReady.Visible = true;

                    #if DEBUG
                    flowLayoutButtonsDebug.Visible = true;
                    #else
                    flowLayoutButtonsDebug.Visible = Program.Config.IsDebuggingProject;
                    #endif

                    while (!GenerateOutputFile())
                    {
                        DialogResult res = MessageBox.Show(lastOutputGenError, Lang.Get["LoadProjectError"], MessageBoxButtons.RetryCancel, MessageBoxIcon.Warning);

                        if (res == DialogResult.Cancel)
                        {
                            DialogResult = DialogResult.Abort;
                            Close();
                            break;
                        }
                    }

                    if (Program.Config.AutoOpenBrowser)
                    {
                        btnOpenOutput_Click(null, new EventArgs());
                    }

                    if (Program.Config.CloseOnFinish)
                    {
                        DialogResult = DialogResult.Abort;
                        Close();
                    }

                    if (Program.Config.IsDebuggingTemplate)
                    {
                        string templateFile = Program.Config.GetCustomTemplateFilePath();
                        if (templateFile == null)
                        {
                            return;                      // WTF
                        }
                        FileSystemWatcher watcher = new FileSystemWatcher {
                            Path         = Path.GetDirectoryName(templateFile),
                            Filter       = Path.GetFileName(templateFile),
                            NotifyFilter = NotifyFilters.LastWrite
                        };

                        watcher.Changed += (sender, args) => {
                            labelLoadData.Text = Lang.Get["LoadProjectDummyTemplateRebuild"];
                            labelLoadData.Text = GenerateOutputFile() ? Lang.Get["LoadProjectDummyTemplateWait"] : Lang.Get["LoadProjectDummyTemplateFailed"];
                        };

                        watcher.EnableRaisingEvents = true;

                        labelLoadData.Text = Lang.Get["LoadProjectDummyTemplateWait"];
                    }
                });

                project.Failure += ex => this.InvokeSafe(() => {
                    MessageBox.Show(Lang.Get["LoadProjectErrorProcessing", ex.ToString()], Lang.Get["LoadProjectError"], MessageBoxButtons.OK, MessageBoxIcon.Error);
                    Close();
                });

                project.ProcessAsync();
            });

            search.Failure += ex => this.InvokeSafe(() => {
                MessageBox.Show(Lang.Get["LoadProjectErrorFileSearch", ex.ToString()], Lang.Get["LoadProjectError"], MessageBoxButtons.OK, MessageBoxIcon.Error);
                Close();
            });

            search.StartAsync();
        }
示例#3
0
        private void BeginProjectLoad()
        {
            labelLoadInfo.Text = Lang.Get["LoadProjectSearchIO"];
            labelLoadData.Text = "";

            search.Refresh += count => this.InvokeSafe(() => {
                labelLoadData.Text = count.ToString(CultureInfo.InvariantCulture);
            });

            search.Finish += data => this.InvokeSafe(() => {
                labelLoadInfo.Text = Lang.Get["LoadProjectProcess"];
                labelLoadData.Text = "";
                UpdateProgress(ProgressBarStyle.Continuous, 0);

                project = new Handling.Project(data);

                project.Progress += (percentage, processedEntries, totalEntries) => this.InvokeSafe(() => {
                    UpdateProgress(ProgressBarStyle.Continuous, percentage);
                    labelLoadData.Text = Lang.Get["LoadProjectProcessingFiles", processedEntries, totalEntries];
                });

                project.Finish += vars => this.InvokeSafe(() => {
                    variables = Program.Config.IsDebuggingTemplate ? new Variables.Dummy() : vars;

                    labelLoadInfo.Text = Lang.Get["LoadProjectProcessingDone"];

                    btnCancel.Visible = false;
                    flowLayoutButtonsReady.Visible = true;

                    #if DEBUG
                    flowLayoutButtonsDebug.Visible = true;
                    #else
                    flowLayoutButtonsDebug.Visible = Program.Config.IsDebuggingProject;
                    #endif

                    while(!GenerateOutputFile()){
                        DialogResult res = MessageBox.Show(lastOutputGenError, Lang.Get["LoadProjectError"], MessageBoxButtons.RetryCancel, MessageBoxIcon.Warning);

                        if (res == DialogResult.Cancel){
                            DialogResult = DialogResult.Abort;
                            Close();
                            break;
                        }
                    }

                    if (Program.Config.AutoOpenBrowser){
                        btnOpenOutput_Click(null, new EventArgs());
                    }

                    if (Program.Config.CloseOnFinish){
                        DialogResult = DialogResult.Abort;
                        Close();
                    }

                    if (Program.Config.IsDebuggingTemplate){
                        string templateFile = Program.Config.GetCustomTemplateFilePath();
                        if (templateFile == null)return; // WTF

                        FileSystemWatcher watcher = new FileSystemWatcher{
                            Path = Path.GetDirectoryName(templateFile),
                            Filter = Path.GetFileName(templateFile),
                            NotifyFilter = NotifyFilters.LastWrite
                        };

                        watcher.Changed += (sender, args) => {
                            labelLoadData.Text = Lang.Get["LoadProjectDummyTemplateRebuild"];
                            labelLoadData.Text = GenerateOutputFile() ? Lang.Get["LoadProjectDummyTemplateWait"] : Lang.Get["LoadProjectDummyTemplateFailed"];
                        };

                        watcher.EnableRaisingEvents = true;

                        labelLoadData.Text = Lang.Get["LoadProjectDummyTemplateWait"];
                    }
                });

                project.Failure += ex => this.InvokeSafe(() => {
                    MessageBox.Show(Lang.Get["LoadProjectErrorProcessing", ex.ToString()], Lang.Get["LoadProjectError"], MessageBoxButtons.OK, MessageBoxIcon.Error);
                    Close();
                });

                project.ProcessAsync();
            });

            search.Failure += ex => this.InvokeSafe(() => {
                MessageBox.Show(Lang.Get["LoadProjectErrorFileSearch", ex.ToString()], Lang.Get["LoadProjectError"], MessageBoxButtons.OK, MessageBoxIcon.Error);
                Close();
            });

            search.StartAsync();
        }