コード例 #1
0
ファイル: BaseFetcher.cs プロジェクト: tdck/SparkleShare
        protected BaseFetcher(SparkleFetcherInfo info)
        {
            FetchedRepoStorageType = StorageType.Unknown;

            AvailableStorageTypes.Add(
                new StorageTypeInfo(StorageType.Plain, "Plain Storage", "Nothing fancy;\nmaximum compatibility"));

            OriginalFetcherInfo = info;
            RequiredFingerprint = info.Fingerprint;
            FetchPriorHistory   = info.FetchPriorHistory;
            string remote_path = info.RemotePath.Trim("/".ToCharArray());
            string address     = info.Address;

            if (address.EndsWith("/", StringComparison.InvariantCulture))
            {
                address = address.Substring(0, address.Length - 1);
            }

            if (!remote_path.StartsWith("/", StringComparison.InvariantCulture))
            {
                remote_path = "/" + remote_path;
            }

            if (!address.Contains("://"))
            {
                address = "ssh://" + address;
            }

            TargetFolder = info.TargetDirectory;

            RemoteUrl = new Uri(address + remote_path);
            IsActive  = false;
        }
コード例 #2
0
ファイル: SSHFetcher.cs プロジェクト: zz38/SparkleShare
 protected SSHFetcher(SparkleFetcherInfo info) : base(info)
 {
 }
コード例 #3
0
ファイル: SetupController.cs プロジェクト: Rud5G/SparkleShare
        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 ();
        }
コード例 #4
0
ファイル: SetupController.cs プロジェクト: Rud5G/SparkleShare
        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.ReplaceUnderscoreWithSpace ();
            ProgressBarPercentage = 1.0;

            ChangePageEvent (PageType.Syncing, null);

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

            if (SelectedPreset.PathUsesLowerCase)
                remote_path = remote_path.ToLower ();

            PreviousAddress = address;
            PreviousPath    = remote_path;

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

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

            new Thread (() => { SparkleShare.Controller.StartFetcher (info); }).Start ();
        }
コード例 #5
0
ファイル: SSHFetcher.cs プロジェクト: Rud5G/SparkleShare
 protected SSHFetcher(SparkleFetcherInfo info)
     : base(info)
 {
 }
コード例 #6
0
ファイル: BaseFetcher.cs プロジェクト: Rud5G/SparkleShare
        protected BaseFetcher (SparkleFetcherInfo info)
        {
            FetchedRepoStorageType = StorageType.Unknown;

            AvailableStorageTypes.Add (
                new StorageTypeInfo (StorageType.Plain, "Plain Storage", "Nothing fancy;\nmaximum compatibility"));

            OriginalFetcherInfo = info;
            RequiredFingerprint = info.Fingerprint;
            FetchPriorHistory   = info.FetchPriorHistory;
            string remote_path  = info.RemotePath.Trim ("/".ToCharArray ());
            string address      = info.Address;

            if (address.EndsWith ("/", StringComparison.InvariantCulture))
                address = address.Substring (0, address.Length - 1);

            if (!remote_path.StartsWith ("/", StringComparison.InvariantCulture))
                remote_path = "/" + remote_path;

            if (!address.Contains ("://"))
                address = "ssh://" + address;

            TargetFolder = info.TargetDirectory;

            RemoteUrl = new Uri (address + remote_path);
            IsActive  = false;
        }
コード例 #7
0
ファイル: BaseController.cs プロジェクト: Rud5G/SparkleShare
        public void StartFetcher (SparkleFetcherInfo info)
        {
            string canonical_name = Path.GetFileName (info.RemotePath);
            string backend        = info.Backend; 
            
            if (string.IsNullOrEmpty (backend))
                backend = BaseFetcher.GetBackend (info.Address);
            
            info.TargetDirectory = Path.Combine (Config.TmpPath, canonical_name);

            if (Directory.Exists (info.TargetDirectory))
                Directory.Delete (info.TargetDirectory, true);
            
            try {
                this.fetcher = (BaseFetcher) Activator.CreateInstance (
                    Type.GetType ("Sparkles." + backend + "." + backend + "Fetcher, Sparkles." + backend),
                        new object [] { info, UserAuthenticationInfo});
                
            } catch (Exception e) {
                Logger.LogInfo ("Controller",
                    "Failed to load '" + backend + "' backend for '" + canonical_name + "' " + e.Message);
                
                FolderFetchError (Path.Combine (info.Address, info.RemotePath).Replace (@"\", "/"),
                                  new string [] {"Failed to load \"" + backend + "\" backend for \"" + canonical_name + "\""});
                
                return;
            }
            
            this.fetcher.Finished += FetcherFinishedDelegate;
            this.fetcher.Failed += FetcherFailedDelegate;
            this.fetcher.ProgressChanged += FetcherProgressChangedDelgate;

            this.fetcher.Start ();
        }