コード例 #1
0
 public RepositoryResponse <FileViewModel> SaveFile(IFormFile file, string filename, string folder)
 {
     V_0 = new RepositoryResponse <FileViewModel>();
     try
     {
         if (file.get_Length() <= (long)0)
         {
             V_0.set_IsSucceed(false);
             V_0.get_Errors().Add("File not found");
         }
         else
         {
             this.CreateDirectoryIfNotExist(folder);
             stackVariable14    = new string[2];
             stackVariable14[0] = folder;
             stackVariable14[1] = filename;
             V_1 = CommonHelper.GetFullPath(stackVariable14);
             if (File.Exists(V_1))
             {
                 dummyVar0 = this.DeleteFile(V_1);
             }
             V_2 = new FileStream(V_1, 2);
             try
             {
                 file.CopyTo(V_2);
             }
             finally
             {
                 if (V_2 != null)
                 {
                     ((IDisposable)V_2).Dispose();
                 }
             }
             V_0.set_IsSucceed(true);
             stackVariable30 = new FileViewModel();
             stackVariable30.set_Filename(filename.Substring(0, file.get_FileName().LastIndexOf('.')));
             stackVariable30.set_Extension(filename.Substring(file.get_FileName().LastIndexOf('.')));
             stackVariable30.set_FileFolder(folder);
             V_0.set_Data(stackVariable30);
         }
     }
     catch (Exception exception_0)
     {
         V_3 = exception_0;
         V_0.set_IsSucceed(false);
         V_0.set_Exception(V_3);
         V_0.get_Errors().Add(V_3.get_Message());
     }
     return(V_0);
 }