Esempio n. 1
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;

                Program.Controller.StartFetcher(PendingInvite.Address, PendingInvite.Fingerprint,
                                                PendingInvite.RemotePath, PendingInvite.AnnouncementsUrl, false); // TODO: checkbox on invite page
            }).Start();
        }
        public void AddPageCompleted(string address, string remote_path)
        {
            SyncingFolder         = Path.GetFileNameWithoutExtension(remote_path);
            SyncingFolder         = SyncingFolder.Replace("-crypto", "");
            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;

            new Thread(() => {
                Program.Controller.StartFetcher(address, SelectedPlugin.Fingerprint, remote_path,
                                                SelectedPlugin.AnnouncementsUrl, this.fetch_prior_history);
            }).Start();
        }
Esempio n. 3
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,
                Backend           = SelectedPlugin.Backend
            };

            new Thread(() => { Program.Controller.StartFetcher(info); }).Start();
        }
Esempio n. 4
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.ReplaceUnderscoreWithSpace();
            PreviousAddress = PendingInvite.Address;
            PreviousPath    = PendingInvite.RemotePath;

            ChangePageEvent(PageType.Syncing, null);

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

                SparkleShare.Controller.FolderFetched    += InvitePageFetchedDelegate;
                SparkleShare.Controller.FolderFetchError += InvitePageFetchErrorDelegate;
                SparkleShare.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
                };

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