public void BeginProcess(ProjectLoadForm.UpdateCallbacks callbacks)
        {
            callbacks.UpdateInfoLabel(Lang.Get["LoadArchiveExtracting"]);

            ZipArchive archive = new ZipArchive(file, extractPath);

            cancel = archive.ExtractAsync(path => {
                callbacks.OnReady(new FileSearch(new string[]{ path }));
                archive.Dispose();
            });
        }
Beispiel #2
0
        private static void Start()
        {
            IInputMethod immediateInput = Config.GetImmediateInputMethod();

            if (immediateInput != null){
                new ProjectLoadForm(immediateInput).ShowDialog();
                return;
            }

            while(true){
                MainForm form = new MainForm();

                if (form.ShowDialog() == DialogResult.OK){
                    DialogResult result = new ProjectLoadForm(form.InputMethod).ShowDialog();
                    if (result == DialogResult.Abort)return;
                }
                else return;
            }
        }
Beispiel #3
0
 public UpdateCallbacks(ProjectLoadForm form)
 {
     this.form = form;
 }
 public void BeginProcess(ProjectLoadForm.UpdateCallbacks callbacks)
 {
     callbacks.OnReady(new FileSearch(new string[0]));
 }
Beispiel #5
0
        public void BeginProcess(ProjectLoadForm.UpdateCallbacks callbacks)
        {
            string tmpDir = IOUtils.CreateTemporaryDirectory();
            string tmpFile = tmpDir == null ? "github.zip" : Path.Combine(tmpDir, "github.zip");

            DownloadProgressChanged = (sender, args) => {
                callbacks.UpdateProgress(args.TotalBytesToReceive == -1 ? -1 : args.ProgressPercentage);
                callbacks.UpdateDataLabel(args.TotalBytesToReceive == -1 ? (args.BytesReceived/1024)+" kB" : (args.BytesReceived/1024)+" / "+(args.TotalBytesToReceive/1024)+" kB");
            };

            DownloadFinished = (sender, args) => {
                if (args.Cancelled){ // apparently randomly throws IOException and ObjectDisposedException... WHAT THE F**K .NET
                    if (CancelFinish != null){
                        CancelFinish();
                    }

                    return;
                }

                if (args.Error != null){
                    callbacks.UpdateInfoLabel(Lang.Get["LoadGitHubDownloadError"]);
                    return;
                }

                callbacks.UpdateInfoLabel(Lang.Get["LoadGitHubExtractingRepo"]);

                ZipArchive archive = new ZipArchive(tmpFile);

                dlRepoCancel = archive.ExtractAsync(path => {
                    callbacks.OnReady(new FileSearch(new string[]{ path }));
                    archive.DeleteAndDispose();
                });
            };

            switch(DownloadRepositoryZip(tmpFile)){
                case DownloadStatus.Started:
                    callbacks.UpdateInfoLabel(Lang.Get["LoadGitHubDownloadingRepo"]);
                    break;

                case DownloadStatus.NoInternet:
                    callbacks.UpdateInfoLabel(Lang.Get["LoadGitHubNoInternet"]);
                    break;

                case DownloadStatus.NoConnection:
                    callbacks.UpdateInfoLabel(Lang.Get["LoadGitHubNoEstablishedConnection"]);
                    break;
            }
        }
 public UpdateCallbacks(ProjectLoadForm form)
 {
     this.form = form;
 }
Beispiel #7
0
 public void BeginProcess(ProjectLoadForm.UpdateCallbacks callbacks)
 {
     callbacks.OnReady(this);
 }