コード例 #1
0
        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();
            });
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: chylex/Code-Statistics
        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;
            }
        }
コード例 #3
0
 public UpdateCallbacks(ProjectLoadForm form)
 {
     this.form = form;
 }
コード例 #4
0
 public void BeginProcess(ProjectLoadForm.UpdateCallbacks callbacks)
 {
     callbacks.OnReady(new FileSearch(new string[0]));
 }
コード例 #5
0
ファイル: GitHub.cs プロジェクト: chylex/Code-Statistics
        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;
            }
        }
コード例 #6
0
 public UpdateCallbacks(ProjectLoadForm form)
 {
     this.form = form;
 }
コード例 #7
0
ファイル: FileSearch.cs プロジェクト: chylex/Code-Statistics
 public void BeginProcess(ProjectLoadForm.UpdateCallbacks callbacks)
 {
     callbacks.OnReady(this);
 }