Beispiel #1
0
 protected override void bw_Status_DoWork(object sender, DoWorkEventArgs e)
 {
     SA_StorageStatus st = new SA_StorageStatus(this.Status);
     try
     {
         if (Directory.Exists(this.LocalPath))
         {
             st.TerseStatus = StorageStatus.Ready;
             DriveInfo driveInfo = new DriveInfo(this.LocalPath);
             st.VerboseStatus = string.Format("{0} ({1})\r\n {2} fri plads", (object)this.LocalPath, (object)((object)driveInfo.DriveFormat).ToString(), (object)SA_Convert.BytesToPrefixedValue(driveInfo.AvailableFreeSpace));
             this.AddProviderStatus(st);
         }
         else
         {
             st.TerseStatus = StorageStatus.Unavailable;
             st.VerboseStatus = string.Format("{0} Kan ikke findes", (object)this.LocalPath);
         }
     }
     catch (Exception ex)
     {
         st.TerseStatus = StorageStatus.Error;
         st.VerboseStatus = string.Format("{0} Kan ikke tilgås \r\n Fejl: {1}", (object)this.LocalPath, (object)e.ToString());
     }
     e.Result = (object)st;
 }
Beispiel #2
0
 protected void AddProviderStatus(SA_StorageStatus st)
 {
     if (this.JobProviders.Count > 0)
       {
     SA_StorageStatus saStorageStatus = st;
     string str = saStorageStatus.VerboseStatus + "\r\n";
     saStorageStatus.VerboseStatus = str;
       }
       foreach (JobProvider jobProvider in this.JobProviders)
       {
     switch (jobProvider.Status.TerseStatus)
     {
       case ProviderStatus.Error:
     st.TerseStatus = StorageStatus.Error;
     SA_StorageStatus saStorageStatus1 = st;
     string str1 = saStorageStatus1.VerboseStatus + string.Format("\r\n Jobliste \"{0}\" melder fejl", (object) jobProvider.Name);
     saStorageStatus1.VerboseStatus = str1;
     break;
       case ProviderStatus.Unavailable:
     if (st.TerseStatus != StorageStatus.Error)
       st.TerseStatus = StorageStatus.Available;
     SA_StorageStatus saStorageStatus2 = st;
     string str2 = saStorageStatus2.VerboseStatus + string.Format("\r\n Jobliste \"{0}\" ikke fundet", (object) jobProvider.Name);
     saStorageStatus2.VerboseStatus = str2;
     break;
       case ProviderStatus.Ready:
     SA_StorageStatus saStorageStatus3 = st;
     string str3 = saStorageStatus3.VerboseStatus + string.Format("\r\n Jobliste \"{0}\" klar", (object) jobProvider.Name);
     saStorageStatus3.VerboseStatus = str3;
     break;
     }
       }
 }
 public SA_StorageStatus(SA_StorageStatus j)
     : base((SA_Status) j)
 {
 }
 protected override void bw_Status_DoWork(object sender, DoWorkEventArgs e)
 {
     SA_StorageStatus st = new SA_StorageStatus(this.Status);
     this.VerifySetup(st);
     if (stub.Running)
     {
         st.VerboseStatus = this.Name + " klar";
         st.TerseStatus = StorageStatus.Ready;
     }
     else
     {
         st.VerboseStatus = this.Name + " Venter";
         st.TerseStatus = StorageStatus.Unavailable;
     }
     e.Result = (object)st;
 }
 protected void VerifySetup(SA_StorageStatus st)
 {
     st.VerboseStatus = this.Name + " afventer";
     st.TerseStatus = StorageStatus.Available;
 }
 protected void VerifySetup(SA_StorageStatus st)
 {
     string str1 = "";
       string str2 = "";
       if (File.Exists(this.CmdPath))
       {
     StreamReader streamReader = new StreamReader(this.CmdPath);
     while (!streamReader.EndOfStream && (str1 == "" || str2 == ""))
     {
       string[] strArray = streamReader.ReadLine().Split(new char[1]
       {
     '='
       });
       if (strArray[0].Contains("set DEST"))
     str1 = strArray[1];
       if (strArray[0].Contains("set SSH"))
     str2 = strArray[1];
     }
     streamReader.Close();
     if (str1 == "")
       st.VerboseStatus = string.Format("{0} \r\n Problem med læsning af {1}\r\n Kunne ikke finde server-angivelse (set DEST)", (object) this.Name, (object) this.CmdPath);
     if (str2 == "")
       st.VerboseStatus = string.Format("{0} \r\n Problem med læsning af {1}\r\n Kunne ikke finde sti-angivelse til SSH (set SSH)", (object) this.Name, (object) this.CmdPath);
     else if (File.Exists(str2 + ".exe"))
     {
       st.VerboseStatus = string.Format("{0} på {1}\r\n", (object) this.Name, (object) str1);
       st.TerseStatus = StorageStatus.Available;
     }
     else
       st.VerboseStatus = string.Format("{0} \r\nKunne ikke finde {1}\r\n Check at stien er korrekt samt at CygWin med SSH er installeret\r\n", (object) this.Name, (object) str2);
       }
       else
     st.VerboseStatus = string.Format("{0} \r\n Kunne ikke finde {1}\r\n Check at stien er korrekt", (object) this.Name, (object) this.CmdPath);
 }
 protected override void bw_Status_DoWork(object sender, DoWorkEventArgs e)
 {
     SA_StorageWorker saStorageWorker = sender as SA_StorageWorker;
       string path = this.tmpPath + "\\spaceleft.txt" + this.GetHashCode().ToString();
       string resultfile = this.tmpPath + "\\spaceleft_result.txt" + this.GetHashCode().ToString();
       SA_StorageStatus st = new SA_StorageStatus(this.Status);
       st.TerseStatus = StorageStatus.Error;
       try
       {
     this.VerifySetup(st);
     if (st.TerseStatus == StorageStatus.Available)
     {
       this.Execute("getspace " + path + " " + resultfile).WaitForExit();
       string str1 = this.Result(resultfile);
       if (str1 == "0")
       {
     if (File.Exists(path))
     {
       StreamReader streamReader = new StreamReader(path);
       while (!streamReader.EndOfStream)
       {
         string[] strArray = streamReader.ReadLine().Split(new char[1]
         {
           ':'
         });
         if (strArray[0].Contains("Max file size"))
           this.maxFileSize = Convert.ToInt64(strArray[1].Trim());
         else
           this.freeSpace = Convert.ToInt64(strArray[1].Trim());
       }
       st.TerseStatus = StorageStatus.Ready;
       SA_StorageStatus saStorageStatus = st;
       string str2 = saStorageStatus.VerboseStatus + string.Format("{0} fri plads i permanent lager \r\n {1} fri plads i modtagebuffer", (object) SA_Convert.BytesToPrefixedValue(this.freeSpace), (object) SA_Convert.BytesToPrefixedValue(this.maxFileSize));
       saStorageStatus.VerboseStatus = str2;
       this.AddProviderStatus(st);
     }
       }
       else
       {
     st.TerseStatus = StorageStatus.Error;
     SA_StorageStatus saStorageStatus = st;
     string str2 = saStorageStatus.VerboseStatus + string.Format("{0} returnerer  fejl {1} på statusforespørgsel", (object) this.Name, (object) str1);
     saStorageStatus.VerboseStatus = str2;
       }
     }
       }
       catch (Exception ex)
       {
     st.TerseStatus = StorageStatus.Error;
     st.VerboseStatus = string.Format("{0} Kan ikke tilgås \r\n Fejl: {1}", (object) this.Name, (object) e.ToString());
     Program.Events.LogOrNotify(ex);
       }
       e.Result = (object) st;
 }