Пример #1
0
 public List <FileViewModel> GetFilesWithContent(string fullPath)
 {
     this.CreateDirectoryIfNotExist(fullPath);
     V_0 = new List <FileViewModel>();
     V_1 = Directory.GetDirectories(fullPath, "*", 1);
     V_2 = 0;
     while (V_2 < (int)V_1.Length)
     {
         stackVariable15 = new DirectoryInfo(V_1[V_2]);
         V_3             = stackVariable15.get_Name();
         stackVariable17 = stackVariable15.GetFiles();
         stackVariable18 = FileRepository.u003cu003ec.u003cu003e9__29_0;
         if (stackVariable18 == null)
         {
             dummyVar0       = stackVariable18;
             stackVariable18 = new Func <FileInfo, DateTime>(FileRepository.u003cu003ec.u003cu003e9.u003cGetFilesWithContentu003eb__29_0);
             FileRepository.u003cu003ec.u003cu003e9__29_0 = stackVariable18;
         }
         V_4 = ((IEnumerable <FileInfo>)stackVariable17).OrderByDescending <FileInfo, DateTime>(stackVariable18).GetEnumerator();
         try
         {
             while (V_4.MoveNext())
             {
                 V_5 = V_4.get_Current();
                 V_6 = V_5.OpenText();
                 try
                 {
                     V_7 = new FileViewModel();
                     V_7.set_FolderName(V_3);
                     stackVariable33    = new string[2];
                     stackVariable33[0] = fullPath;
                     stackVariable33[1] = V_3;
                     V_7.set_FileFolder(CommonHelper.GetFullPath(stackVariable33));
                     V_7.set_Filename(V_5.get_Name().Substring(0, V_5.get_Name().LastIndexOf('.')));
                     V_7.set_Extension(V_5.get_Extension());
                     V_7.set_Content(V_6.ReadToEnd());
                     V_0.Add(V_7);
                 }
                 finally
                 {
                     if (V_6 != null)
                     {
                         ((IDisposable)V_6).Dispose();
                     }
                 }
             }
         }
         finally
         {
             if (V_4 != null)
             {
                 V_4.Dispose();
             }
         }
         V_2 = V_2 + 1;
     }
     return(V_0);
 }
Пример #2
0
 public static void LogException(Exception ex)
 {
     stackVariable0 = Environment.get_CurrentDirectory();
     V_2            = DateTime.get_Now();
     V_0            = string.Concat(stackVariable0, "/logs/", V_2.ToString("dd-MM-yyyy"));
     if (!string.IsNullOrEmpty(V_0) && !Directory.Exists(V_0))
     {
         dummyVar0 = Directory.CreateDirectory(V_0);
     }
     V_1 = string.Concat(V_0, "/log_exceptions.json");
     try
     {
         V_3 = new FileInfo(V_1);
         V_4 = "[]";
         if (V_3.get_Exists())
         {
             V_6 = V_3.OpenText();
             try
             {
                 V_4 = V_6.ReadToEnd();
             }
             finally
             {
                 if (V_6 != null)
                 {
                     ((IDisposable)V_6).Dispose();
                 }
             }
             File.Delete(V_1);
         }
         stackVariable18 = JArray.Parse(V_4);
         stackVariable19 = new JObject();
         stackVariable19.Add(new JProperty("CreatedDateTime", (object)DateTime.get_UtcNow()));
         stackVariable19.Add(new JProperty("Details", JObject.FromObject(ex)));
         stackVariable18.Add(stackVariable19);
         V_4 = stackVariable18.ToString();
         V_7 = File.CreateText(V_1);
         try
         {
             V_7.WriteLine(V_4);
         }
         finally
         {
             if (V_7 != null)
             {
                 ((IDisposable)V_7).Dispose();
             }
         }
     }
     catch
     {
         dummyVar1 = exception_0;
         Console.Write(string.Concat("Cannot write log file ", V_1));
     }
     return;
 }