Esempio n. 1
0
 public void Update(ClientProtocol client, ClientRequest firstRequest, string product, string directory, string tempDirectory)
 {
     this._Client               = client;
     this._Product              = product;
     this._SourceDirectory      = new DirectoryInfo(directory);
     this._DestinationDirectory = (tempDirectory != "") ? new DirectoryInfo(tempDirectory) : this._SourceDirectory;
     this._filesUpdated         = 0;
     client.ResponseReceived   += new ClientProtocol.ResponseReceivedEventHandler(this.ClientResponseReceived);
     Auxiliary.WriteLog(
         $"ClientSideUpdateProtocol::\r\nSourceDirectory: {this._SourceDirectory.FullName}\r\nDestinationDirectory: {this._DestinationDirectory.FullName}");
     firstRequest.Request = "UPDATE " + this._Product;
 }
Esempio n. 2
0
 private void RequestNextFile(ClientRequest Request)
 {
     if (this._files.Count > 0)
     {
         Request.Request = this._files[0].FileName;
         Auxiliary.WriteLog("Requesting the file " + Request.Request);
     }
     else
     {
         this.AbortUpdate(Request);
     }
 }
Esempio n. 3
0
 private void ParseFileList(string files)
 {
     Auxiliary.WriteLog("Files for product " + this._Product + ":\r\n" + files);
     this._files = new List <ShortFileInfo>();
     if (files != ":empty:")
     {
         string[] strArray = files.Split(new char[] { '\n' });
         for (int i = 0; i < strArray.Length; i++)
         {
             ShortFileInfo fileInfo = this.GetFileInfo(strArray[i]);
             if (fileInfo != null)
             {
                 FileInfo info2 = new FileInfo(Path.Combine(this._SourceDirectory.FullName, fileInfo.FileName));
                 if ((!info2.Exists || (info2.LastWriteTimeUtc < fileInfo.CreationTime)) || (System.Convert.ToInt32(info2.Length) != fileInfo.FileSize))
                 {
                     this._files.Add(fileInfo);
                 }
             }
         }
     }
 }