예제 #1
0
 public bool SaveWebFile(FileViewModel file)
 {
     try
     {
         stackVariable1    = new string[2];
         stackVariable1[0] = "wwwroot";
         stackVariable1[1] = file.get_FileFolder();
         V_0 = CommonHelper.GetFullPath(stackVariable1);
         if (string.IsNullOrEmpty(file.get_Filename()))
         {
             V_3 = false;
         }
         else
         {
             this.CreateDirectoryIfNotExist(V_0);
             stackVariable16    = new string[2];
             stackVariable16[0] = V_0;
             stackVariable16[1] = string.Concat(file.get_Filename(), file.get_Extension());
             V_1 = CommonHelper.GetFullPath(stackVariable16);
             if (File.Exists(V_1))
             {
                 dummyVar0 = this.DeleteFile(V_1);
             }
             if (string.IsNullOrEmpty(file.get_Content()))
             {
                 if (file.get_FileStream().IndexOf(',') >= 0)
                 {
                     stackVariable42 = file.get_FileStream().Split(',', 0)[1];
                 }
                 else
                 {
                     stackVariable42 = file.get_FileStream();
                 }
                 V_4 = stackVariable42;
                 if (string.IsNullOrEmpty(ImageResizer.getContentType(V_1)))
                 {
                     V_5 = Convert.FromBase64String(V_4);
                     V_6 = File.Create(V_1);
                     try
                     {
                         V_6.Write(V_5, 0, (int)V_5.Length);
                         V_3 = true;
                     }
                     finally
                     {
                         if (V_6 != null)
                         {
                             ((IDisposable)V_6).Dispose();
                         }
                     }
                 }
                 else
                 {
                     V_3 = ImageResizer.ResizeImage(MixService.GetConfig <int>("ImageSize"), V_4, V_1);
                 }
             }
             else
             {
                 V_2 = File.CreateText(V_1);
                 try
                 {
                     V_2.WriteLine(file.get_Content());
                     V_3 = true;
                 }
                 finally
                 {
                     if (V_2 != null)
                     {
                         ((IDisposable)V_2).Dispose();
                     }
                 }
             }
         }
     }
     catch
     {
         dummyVar1 = exception_0;
         V_3       = false;
     }
     return(V_3);
 }