public string TransPicture(string fileFullPath, string toolCode, TransPictureType transPictureType) { if (string.IsNullOrEmpty(fileFullPath)) { return(null); } if (!File.Exists(fileFullPath)) { return(null); } string newFilePath = GetNewFilePath(fileFullPath, toolCode); if (newFilePath.ToLower() != fileFullPath.ToLower()) { if (File.Exists(newFilePath)) { File.Delete(newFilePath); } switch (transPictureType) { case TransPictureType.CopyPicture: File.Copy(fileFullPath, newFilePath, true); break; case TransPictureType.MovePicture: File.Move(fileFullPath, newFilePath); break; } } return(newFilePath.Substring(ConfigHelper.GetCurrentDomainDirectory().Length)); }
public string TransPicture(string fileFullPath, string toolCode, string onlineKey, TransPictureType transPictureType) { return(TransPicture(fileFullPath, toolCode, onlineKey, transPictureType, false)); }
public string TransPicture(string fileFullPath, string toolCode, string onlineKey, TransPictureType transPictureType, bool replaceOld) { if (string.IsNullOrEmpty(fileFullPath)) { return(null); } if (!File.Exists(fileFullPath)) { return(null); } string newFilePath = GetNewFilePath(fileFullPath, toolCode, onlineKey, replaceOld); if (newFilePath.ToLower() != fileFullPath.ToLower()) { try { if (File.Exists(newFilePath)) { File.Delete(newFilePath); } switch (transPictureType) { case TransPictureType.CopyPicture: File.Copy(fileFullPath, newFilePath, true); break; case TransPictureType.MovePicture: File.Move(fileFullPath, newFilePath); break; } } catch (Exception ex) { Log.WriteLog(ex); } } return(newFilePath.Substring(ConfigHelper.GetCurrentDomainDirectory().Length)); }