public static int DeleteFiles(int packageId, string[] files) { // check account int accountCheck = SecurityContext.CheckAccount(DemandAccount.NotDemo); if (accountCheck < 0) { return(accountCheck); } // place log record TaskManager.StartTask("FILES", "DELETE_FILES", packageId); if (files != null) { foreach (string file in files) { TaskManager.Write(file); } } try { OS.OperatingSystem os = GetOS(packageId); for (int i = 0; i < files.Length; i++) { files[i] = GetFullPackagePath(packageId, files[i]); } // delete files os.DeleteFiles(files); return(0); } catch (Exception ex) { //Log and return a generic error rather than throwing an exception TaskManager.WriteError(ex); return(BusinessErrorCodes.ERROR_FILE_GENERIC_LOGGED); } finally { TaskManager.CompleteTask(); } }