protected virtual void Dispose(bool disposing)
 {
     if (!this.disposed)
     {
         if (disposing)
         {
             if (this.serverTimer != null)
             {
                 this.serverTimer.Tick -= new EventHandler(this.serverTimer_Tick);
             }
             this.serverTimer = null;
             if (this.clientTimer != null)
             {
                 this.clientTimer.Tick -= new EventHandler(this.clientTimer_Tick);
             }
             this.clientTimer = null;
             if (this._log != null)
             {
                 foreach (LoggerData data in this._log)
                 {
                     data.Dispose();
                 }
                 this._log = null;
             }
             this.CustomLogToServerFunction = null;
             this.logService = null;
         }
         this.disposed = true;
     }
 }
 public void SaveToServer()
 {
     AsyncCallback callback = null;
     this.Save();
     this.Load();
     if ((this._log == null) || (this._log.Count <= 0))
     {
         goto Label_00B9;
     }
     if (this.LogToServerViaLoggingService)
     {
         try
         {
             if (this.logService == null)
             {
                 BasicHttpBinding binding = new BasicHttpBinding();
                 EndpointAddress remoteAddress = new EndpointAddress(this.LoggingServiceEndpointAddress);
                 this.logService = new ChannelFactory<ILoggingServiceClient>(binding, remoteAddress).CreateChannel();
             }
             if (callback == null)
             {
                 callback = asyncResult => this.logService.EndSaveLogs(asyncResult);
             }
             this.logService.BeginSaveLogs(this._log, callback, null);
             goto Label_00B2;
         }
         catch (Exception exception)
         {
             throw new Exception("Error while trying to log to server", exception);
         }
     }
     if (this.CustomLogToServerFunction == null)
     {
         throw new ArgumentException("Custom log to server function should be provided.");
     }
     this.CustomLogToServerFunction();
     Label_00B2:
     this.Clear(false);
     Label_00B9:
     if (this.serverTimer != null)
     {
         this.serverTimer.Stop();
         this.serverTimer.Start();
     }
 }