SparkleLib.SparkleRepoBase.SparkleRepoBase C# (CSharp) Méthode

SparkleRepoBase() public méthode

public SparkleRepoBase ( string path, SparkleConfig config ) : System
path string
config SparkleConfig
Résultat System
        public SparkleRepoBase (string path, SparkleConfig config)
        {
            SparkleLogger.LogInfo (path, "Initializing...");

            Status            = SyncStatus.Idle;
            Error             = ErrorStatus.None;
            this.local_config = config;
            LocalPath         = path;
            Name              = Path.GetFileName (LocalPath);
            RemoteUrl         = new Uri (this.local_config.GetUrlForFolder (Name));
            IsBuffering       = false;
            this.identifier   = Identifier;
            ChangeSets        = GetChangeSets ();

			string identifier_file_path = Path.Combine (LocalPath, ".sparkleshare");
			File.SetAttributes (identifier_file_path, FileAttributes.Hidden);

            SyncStatusChanged += delegate (SyncStatus status) { Status = status; };

            if (!UseCustomWatcher)
                this.watcher = new SparkleWatcher (LocalPath);

            new Thread (() => CreateListener ()).Start ();

            this.remote_timer.Elapsed += delegate {
                if (this.is_syncing || IsBuffering)
                    return;

                int time_comparison = DateTime.Compare (this.last_poll, DateTime.Now.Subtract (this.poll_interval));

                if (time_comparison < 0) {
                    if (HasUnsyncedChanges && !this.is_syncing)
                        SyncUpBase ();

                    this.last_poll = DateTime.Now;

                    if (HasRemoteChanges && !this.is_syncing)
                        SyncDownBase ();

                    if (this.listener.IsConnected)
                        this.poll_interval = PollInterval.Long;
                }

                // In the unlikely case that we haven't synced up our
                // changes or the server was down, sync up again
                if (HasUnsyncedChanges && !this.is_syncing && Error == ErrorStatus.None)
                    SyncUpBase ();
            };
        }