コード例 #1
0
 public void BackendEvent(BackendActionType action, BackendEventType type, string path, long size)
 {
     foreach (var s in m_sinks)
     {
         s.BackendEvent(action, type, path, size);
     }
 }
コード例 #2
0
ファイル: ConsoleOutput.cs プロジェクト: xuchrist/duplicati
 public void BackendEvent(BackendActionType action, BackendEventType type, string path, long size)
 {
     lock (m_lock)
         if (type == BackendEventType.Started)
         {
             if (action == BackendActionType.Put)
             {
                 Console.WriteLine("  Uploading file ({0}) ...", Library.Utility.Utility.FormatSizeString(size));
             }
             else if (action == BackendActionType.Get)
             {
                 Console.WriteLine("  Downloading file ({0}) ...", size < 0 ? "unknown" : Library.Utility.Utility.FormatSizeString(size));
             }
             else if (action == BackendActionType.List)
             {
                 Console.WriteLine("  Listing remote folder ...");
             }
             else if (action == BackendActionType.CreateFolder)
             {
                 Console.WriteLine("  Creating remote folder ...");
             }
             else if (action == BackendActionType.Delete)
             {
                 Console.WriteLine("  Deleting file {0}{1} ...", path, size < 0 ? "" : (" (" + Library.Utility.Utility.FormatSizeString(size) + ")"));
             }
         }
 }
コード例 #3
0
        public void BackendEvent(BackendActionType action, BackendEventType type, string path, long size)
        {
            lock (m_lock)
                if (type == BackendEventType.Started)
                {
                    switch (action)
                    {
                    case BackendActionType.Put:
                        Output.WriteLine("  Uploading file ({0}) ...", Library.Utility.Utility.FormatSizeString(size));
                        break;

                    case BackendActionType.Get:
                        Output.WriteLine("  Downloading file ({0}) ...", size < 0 ? "unknown" : Library.Utility.Utility.FormatSizeString(size));
                        break;

                    case BackendActionType.List:
                        Output.WriteLine("  Listing remote folder ...");
                        break;

                    case BackendActionType.CreateFolder:
                        Output.WriteLine("  Creating remote folder ...");
                        break;

                    case BackendActionType.Delete:
                        Output.WriteLine("  Deleting file {0}{1} ...", path, size < 0 ? "" : (" (" + Library.Utility.Utility.FormatSizeString(size) + ")"));
                        break;
                    }
                }
        }
コード例 #4
0
ファイル: ConsoleOutput.cs プロジェクト: admz/duplicati
 public void BackendEvent(BackendActionType action, BackendEventType type, string path, long size)
 {
     lock(m_lock)
         if (type == BackendEventType.Started)
         {
             if (action == BackendActionType.Put)
                 Console.WriteLine("  Uploading file ({0}) ...", Library.Utility.Utility.FormatSizeString(size));
             else if (action == BackendActionType.Get)
                 Console.WriteLine("  Downloading file ({0}) ...", size < 0 ? "unknown" : Library.Utility.Utility.FormatSizeString(size));
             else if (action == BackendActionType.List)
                 Console.WriteLine("  Listing remote folder ...");
             else if (action == BackendActionType.CreateFolder)
                 Console.WriteLine("  Creating remote folder ...");
             else if (action == BackendActionType.Delete)
                 Console.WriteLine("  Deleting file {0}{1} ...", path, size < 0 ? "" : (" (" + Library.Utility.Utility.FormatSizeString(size) + ")"));
         }
 }
コード例 #5
0
        public void AddBackendEvent(BackendActionType action, BackendEventType type, string path, long size)
        {
            if (m_parent != null)
            {
                m_parent.AddBackendEvent(action, type, path, size);
            }
            else
            {
                if (type == BackendEventType.Started)
                {
                    this.BackendProgressUpdater.StartAction(action, path, size);
                }

                Logging.Log.WriteMessage(string.Format("Backend event: {0} - {1}: {2} ({3})", action, type, path, size <= 0 ? "" : Library.Utility.Utility.FormatSizeString(size)), Duplicati.Library.Logging.LogMessageType.Information);

                if (MessageSink != null)
                {
                    MessageSink.BackendEvent(action, type, path, size);
                }
            }
        }
コード例 #6
0
        public void SendEvent(BackendActionType action, BackendEventType type, string path, long size)
        {
            if (type == BackendEventType.Started)
            {
                System.Threading.Interlocked.Increment(ref m_remoteCalls);
            }
            else if (type == BackendEventType.Retrying)
            {
                System.Threading.Interlocked.Increment(ref m_retryAttemptCount);
            }
            else if (type == BackendEventType.Completed)
            {
                switch (action)
                {
                case BackendActionType.CreateFolder:
                    System.Threading.Interlocked.Increment(ref m_foldersCreated);
                    break;

                case BackendActionType.List:
                    break;

                case BackendActionType.Delete:
                    System.Threading.Interlocked.Increment(ref m_filesDeleted);
                    break;

                case BackendActionType.Get:
                    System.Threading.Interlocked.Increment(ref m_filesDownloaded);
                    System.Threading.Interlocked.Add(ref m_bytesDownloaded, size);
                    break;

                case BackendActionType.Put:
                    System.Threading.Interlocked.Increment(ref m_filesUploaded);
                    System.Threading.Interlocked.Add(ref m_bytesUploaded, size);
                    break;
                }
            }

            base.AddBackendEvent(action, type, path, size);
        }
コード例 #7
0
        public void AddBackendEvent(BackendActionType action, BackendEventType type, string path, long size)
        {
            if (m_parent != null)
            {
                m_parent.AddBackendEvent(action, type, path, size);
            }
            else
            {
                lock (Logging.Log.Lock)
                {
                    if (m_is_reporting)
                    {
                        return;
                    }

                    try
                    {
                        m_is_reporting = true;
                        if (type == BackendEventType.Started)
                        {
                            this.BackendProgressUpdater.StartAction(action, path, size);
                        }

                        Logging.Log.WriteInformationMessage(LOGTAG, "BackendEvent", "Backend event: {0} - {1}: {2} ({3})", action, type, path, size <= 0 ? "" : Library.Utility.Utility.FormatSizeString(size));

                        if (MessageSink != null)
                        {
                            MessageSink.BackendEvent(action, type, path, size);
                        }
                    }
                    finally
                    {
                        m_is_reporting = false;
                    }
                }
            }
        }
コード例 #8
0
ファイル: ResultClasses.cs プロジェクト: AlexFRAN/duplicati
        public void AddBackendEvent(BackendActionType action, BackendEventType type, string path, long size)
        {
            if (m_parent != null)
            {
                m_parent.AddBackendEvent(action, type, path, size);
            }
            else
            {
                if (type == BackendEventType.Started)
                    this.BackendProgressUpdater.StartAction(action, path, size);

                Logging.Log.WriteMessage(string.Format("Backend event: {0} - {1}: {2} ({3})", action, type, path, size <= 0 ? "" : Library.Utility.Utility.FormatSizeString(size)), Duplicati.Library.Logging.LogMessageType.Information);

                if (MessageSink != null)
                    MessageSink.BackendEvent(action, type, path, size);
            }
                
        }
コード例 #9
0
ファイル: ResultClasses.cs プロジェクト: AlexFRAN/duplicati
 public void SendEvent(BackendActionType action, BackendEventType type, string path, long size)
 {
     if (type == BackendEventType.Started)
     {
         System.Threading.Interlocked.Increment(ref m_remoteCalls);
     }
     else if (type == BackendEventType.Retrying)
     {
         System.Threading.Interlocked.Increment(ref m_retryAttemptCount);
     }
     else if (type == BackendEventType.Completed)
     {
         switch (action)
         {
             case BackendActionType.CreateFolder:
                 System.Threading.Interlocked.Increment(ref m_foldersCreated);
                 break;
             case BackendActionType.List:
                 break;
             case BackendActionType.Delete:
                 System.Threading.Interlocked.Increment(ref m_filesDeleted);
                 break;
             case BackendActionType.Get:
                 System.Threading.Interlocked.Increment(ref m_filesDownloaded);
                 System.Threading.Interlocked.Add(ref m_bytesDownloaded, size);
                 break;
             case BackendActionType.Put:
                 System.Threading.Interlocked.Increment(ref m_filesUploaded);
                 System.Threading.Interlocked.Add(ref m_bytesUploaded, size);
                 break;
         }
     }
     
     base.AddBackendEvent(action, type, path, size);
 }
コード例 #10
0
 public Task SendEventAsync(BackendActionType action, BackendEventType type, string path, long size, bool updateProgress = true)
 {
     return(RunOnMain(() => m_bw.SendEvent(action, type, path, size, updateProgress)));
 }
コード例 #11
0
 public Task SendEventAsync(BackendActionType action, BackendEventType type, string path, long size)
 {
     return(RunOnMain(() => m_bw.SendEvent(action, type, path, size)));
 }