private bool InitializeTargetDirectory() { if (mConsoleCopy) { if (!XboxUtils.FileExist(mSyncRoot)) { if (!XboxUtils.DirectoryCreateVerify(mSyncRoot, true)) { // Error //MOG_REPORT.ShowMessageBox("Xbox Dir Error", string.Concat(mSyncRoot, " could not be created!"), MessageBoxButtons.OK); throw new Exception(mSyncRoot + " could not be created!"); } } } else { // Create the initial directory on the pc if (!DosUtils.Exist(mSyncRoot)) { try { Directory.CreateDirectory(mSyncRoot); } catch (Exception e) { // Error MOG_REPORT.ShowMessageBox("Dir Error", string.Concat(mSyncRoot, " could not be created!", "\n", e.ToString()), MessageBoxButtons.OK); throw new Exception(mSyncRoot + " could not be created!", e); //return false; } } } return(true); }
private bool CreateTargetDirectoryPath(string targetPath) { // Check for a sub-dir int index = targetPath.LastIndexOf("\\"); if (index != -1 && targetPath[index - 1] != ':') { string RootDir = targetPath.Substring(0, index); if (!CreateTargetDirectoryPath(RootDir)) { return(false); } } if (mConsoleCopy) { // Check if it already exists if (!XboxUtils.FileExist(targetPath)) { // if (!XboxUtils.DirectoryCreateVerify(targetPath, false)) { // Error MOG_REPORT.ShowMessageBox("Create Target Directory Path", string.Concat(RemapDirectoryString(targetPath), " could not be created!"), MessageBoxButtons.OK); return(false); } XboxUtils.DM_FILE_ATTRIBUTES att = new XboxUtils.DM_FILE_ATTRIBUTES(); XboxUtils.GetFileAttributes(targetPath, ref att); if (!(att.SizeHigh != 0 && att.SizeLow != 0)) { // Error MOG_REPORT.ShowMessageBox("Create Target Directory Path", string.Concat(RemapDirectoryString(targetPath), " could not be created!"), MessageBoxButtons.OK); return(false); } } } else { // Check if it already exists if (!DosUtils.FileExist(targetPath)) { // try { Directory.CreateDirectory(targetPath); } catch (Exception e) { // Error MOG_REPORT.ShowMessageBox("Create Directory Error", string.Concat(RemapDirectoryString(targetPath), " could not be created!", "\n", e.ToString()), MessageBoxButtons.OK); return(false); } } } return(true); }