コード例 #1
0
 public List <TemplateViewModel> GetTemplates(string folder)
 {
     if (!Directory.Exists(folder))
     {
         dummyVar0 = Directory.CreateDirectory(folder);
     }
     stackVariable7 = (new DirectoryInfo(folder)).GetFiles(string.Format("*{0}", ".cshtml"));
     V_0            = new List <TemplateViewModel>();
     V_1            = stackVariable7;
     V_2            = 0;
     while (V_2 < (int)V_1.Length)
     {
         V_3 = V_1[V_2];
         V_4 = V_3.OpenText();
         try
         {
             stackVariable20 = new TemplateViewModel();
             stackVariable20.set_FileFolder(folder);
             stackVariable20.set_Filename(V_3.get_Name());
             stackVariable20.set_Extension(".cshtml");
             stackVariable20.set_Content(V_4.ReadToEnd());
             V_0.Add(stackVariable20);
         }
         finally
         {
             if (V_4 != null)
             {
                 ((IDisposable)V_4).Dispose();
             }
         }
         V_2 = V_2 + 1;
     }
     return(V_0);
 }
コード例 #2
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);
 }
コード例 #3
0
 public FileViewModel GetWebFile(string filename, string folder)
 {
     stackVariable4 = string.Concat("wwwroot/", folder, "/", filename);
     V_0            = string.Concat("wwwroot/content/", folder);
     V_1            = new FileInfo(stackVariable4);
     V_2            = null;
     try
     {
         V_3 = new DirectoryInfo(V_0);
         V_4 = V_1.OpenText();
         try
         {
             stackVariable14 = new FileViewModel();
             stackVariable14.set_FolderName(V_3.get_Name());
             stackVariable14.set_FileFolder(folder);
             stackVariable14.set_Filename(V_1.get_Name().Substring(0, V_1.get_Name().LastIndexOf('.')));
             stackVariable14.set_Extension(V_1.get_Extension());
             stackVariable14.set_Content(V_4.ReadToEnd());
             V_2 = stackVariable14;
         }
         finally
         {
             if (V_4 != null)
             {
                 ((IDisposable)V_4).Dispose();
             }
         }
     }
     catch
     {
         dummyVar0 = exception_0;
     }
     stackVariable30 = V_2;
     if (stackVariable30 == null)
     {
         dummyVar1       = stackVariable30;
         stackVariable30 = new FileViewModel();
         stackVariable30.set_FileFolder(folder);
     }
     return(stackVariable30);
 }