Beispiel #1
0
        public void AddPageCompleted(string address, string remote_path)
        {
            SyncingFolder = Path.GetFileName(remote_path);

            if (remote_path.EndsWith(".git"))
            {
                SyncingFolder = remote_path.Substring(0, remote_path.Length - 4);
            }

            SyncingFolder         = SyncingFolder.Replace("-crypto", "");
            SyncingFolder         = SyncingFolder.Replace("_", " ");
            ProgressBarPercentage = 1.0;

            ChangePageEvent(PageType.Syncing, null);

            address     = Uri.EscapeUriString(address.Trim());
            remote_path = remote_path.Trim();
            remote_path = remote_path.TrimEnd("/".ToCharArray());

            if (SelectedPlugin.PathUsesLowerCase)
            {
                remote_path = remote_path.ToLower();
            }

            PreviousAddress = address;
            PreviousPath    = remote_path;

            Program.Controller.FolderFetched    += AddPageFetchedDelegate;
            Program.Controller.FolderFetchError += AddPageFetchErrorDelegate;
            Program.Controller.FolderFetching   += SyncingPageFetchingDelegate;

            SparkleFetcherInfo info = new SparkleFetcherInfo {
                Address           = address,
                Fingerprint       = SelectedPlugin.Fingerprint,
                RemotePath        = remote_path,
                FetchPriorHistory = this.fetch_prior_history,
                AnnouncementsUrl  = SelectedPlugin.AnnouncementsUrl
            };

            new Thread(() => { Program.Controller.StartFetcher(info); }).Start();
        }
Beispiel #2
0
        public void InvitePageCompleted()
        {
            SyncingFolder = Path.GetFileName(PendingInvite.RemotePath);

            if (PendingInvite.RemotePath.EndsWith(".git"))
            {
                SyncingFolder = PendingInvite.RemotePath.Substring(0, PendingInvite.RemotePath.Length - 4);
            }

            SyncingFolder   = SyncingFolder.Replace("-crypto", "");
            SyncingFolder   = SyncingFolder.Replace("_", " ");
            PreviousAddress = PendingInvite.Address;
            PreviousPath    = PendingInvite.RemotePath;

            ChangePageEvent(PageType.Syncing, null);

            new Thread(() => {
                if (!PendingInvite.Accept(Program.Controller.CurrentUser.PublicKey))
                {
                    PreviousUrl = PendingInvite.Address + PendingInvite.RemotePath.TrimStart("/".ToCharArray());
                    ChangePageEvent(PageType.Error, new string [] { "error: Failed to upload the public key" });
                    return;
                }

                Program.Controller.FolderFetched    += InvitePageFetchedDelegate;
                Program.Controller.FolderFetchError += InvitePageFetchErrorDelegate;
                Program.Controller.FolderFetching   += SyncingPageFetchingDelegate;

                SparkleFetcherInfo info = new SparkleFetcherInfo {
                    Address           = PendingInvite.Address,
                    Fingerprint       = PendingInvite.Fingerprint,
                    RemotePath        = PendingInvite.RemotePath,
                    FetchPriorHistory = false, // TODO: checkbox on invite page
                    AnnouncementsUrl  = PendingInvite.AnnouncementsUrl
                };

                Program.Controller.StartFetcher(info);
            }).Start();
        }