Exemplo n.º 1
0
 public List <FileViewModel> GetUploadFiles(string folder)
 {
     stackVariable1    = new string[2];
     stackVariable1[0] = "Content/Uploads";
     stackVariable1[1] = folder;
     V_0 = CommonHelper.GetFullPath(stackVariable1);
     this.CreateDirectoryIfNotExist(V_0);
     stackVariable11 = (new DirectoryInfo(V_0)).GetFiles();
     V_1             = new List <FileViewModel>();
     stackVariable13 = FileRepository.u003cu003ec.u003cu003e9__26_0;
     if (stackVariable13 == null)
     {
         dummyVar0       = stackVariable13;
         stackVariable13 = new Func <FileInfo, DateTime>(FileRepository.u003cu003ec.u003cu003e9.u003cGetUploadFilesu003eb__26_0);
         FileRepository.u003cu003ec.u003cu003e9__26_0 = stackVariable13;
     }
     V_2 = ((IEnumerable <FileInfo>)stackVariable11).OrderByDescending <FileInfo, DateTime>(stackVariable13).GetEnumerator();
     try
     {
         while (V_2.MoveNext())
         {
             V_3 = V_2.get_Current();
             V_4 = V_3.OpenText();
             try
             {
                 stackVariable23 = new FileViewModel();
                 stackVariable23.set_FileFolder(folder);
                 stackVariable23.set_Filename(V_3.get_Name().Substring(0, V_3.get_Name().LastIndexOf('.')));
                 stackVariable23.set_Extension(V_3.get_Extension());
                 stackVariable23.set_Content(V_4.ReadToEnd());
                 V_1.Add(stackVariable23);
             }
             finally
             {
                 if (V_4 != null)
                 {
                     ((IDisposable)V_4).Dispose();
                 }
             }
         }
     }
     finally
     {
         if (V_2 != null)
         {
             V_2.Dispose();
         }
     }
     return(V_1);
 }
Exemplo n.º 2
0
 public List <FileViewModel> GetTopFiles(string folder)
 {
     V_0 = new List <FileViewModel>();
     if (Directory.Exists(folder))
     {
         stackVariable5 = new DirectoryInfo(folder);
         V_1            = stackVariable5.get_Name();
         stackVariable7 = stackVariable5.GetFiles();
         stackVariable8 = FileRepository.u003cu003ec.u003cu003e9__28_0;
         if (stackVariable8 == null)
         {
             dummyVar0      = stackVariable8;
             stackVariable8 = new Func <FileInfo, DateTime>(FileRepository.u003cu003ec.u003cu003e9.u003cGetTopFilesu003eb__28_0);
             FileRepository.u003cu003ec.u003cu003e9__28_0 = stackVariable8;
         }
         V_2 = ((IEnumerable <FileInfo>)stackVariable7).OrderByDescending <FileInfo, DateTime>(stackVariable8).GetEnumerator();
         try
         {
             while (V_2.MoveNext())
             {
                 V_3             = V_2.get_Current();
                 stackVariable15 = V_0;
                 stackVariable16 = new FileViewModel();
                 stackVariable16.set_FolderName(V_1);
                 stackVariable16.set_FileFolder(folder);
                 stackVariable20 = V_3.get_Name();
                 if (V_3.get_Name().LastIndexOf('.') >= 0)
                 {
                     stackVariable30 = V_3.get_Name().LastIndexOf('.');
                 }
                 else
                 {
                     stackVariable30 = 0;
                 }
                 stackVariable16.set_Filename(stackVariable20.Substring(0, stackVariable30));
                 stackVariable16.set_Extension(V_3.get_Extension());
                 stackVariable15.Add(stackVariable16);
             }
         }
         finally
         {
             if (V_2 != null)
             {
                 V_2.Dispose();
             }
         }
     }
     return(V_0);
 }