private string InitializeSummaryMap() { // Summary filename string summaryFile = string.Concat(mSourcePath, "\\MOG\\platformSincSummary.", mMog.GetActivePlatform().mPlatformName, ".info"); // Clear out the summary file if it exists if (DosUtils.FileExist(summaryFile)) { if (!DosUtils.FileDelete(summaryFile)) { throw(new Exception("Could not delete summaryFile:" + summaryFile)); } } string summaryPendingFile = summaryFile + "." + Path.GetFileNameWithoutExtension(mTargetConsole) + ".pending"; if (DosUtils.FileExist(summaryPendingFile)) { if (!DosUtils.FileDelete(summaryPendingFile)) { throw(new Exception("Could not delete summaryPendingFile:" + summaryPendingFile)); } } mSummary = new MOG_Ini(summaryFile); mPendingCopy = new MOG_Ini(summaryPendingFile); return(summaryFile); }
private bool InitializeTimeStampMap() { // Get our target root string platformTimeStampsFile = string.Concat(mSourcePath, "\\MOG\\platform.", mMog.GetActivePlatform().mPlatformName, ".", Path.GetFileNameWithoutExtension(mTargetConsole), ".timestamps.info"); // Is this a force if (mForce) { if (DosUtils.FileExist(platformTimeStampsFile)) { DosUtils.FileDelete(platformTimeStampsFile); } if (mConsoleCopy) { // Delete the target directory on the xbox if (!XboxUtils.DirectoryDelete(mSyncRoot, true)) { // Error //MOG_REPORT.ShowMessageBox("Xbox Delete Error", string.Concat(mSyncRoot, " could not be deleted!"), MessageBoxButtons.OK); throw new Exception(mSyncRoot + " could not be deleted!"); } } else { if (!DosUtils.DirectoryDelete(mSyncRoot)) { //Error //MOG_REPORT.ShowMessageBox("Delete Error", string.Concat(mSyncRoot, " could not be deleted!"), MessageBoxButtons.OK); throw new Exception(mSyncRoot + " could not be deleted!"); } } } // Open the timestamp ini mTargetTimestamps = new MOG_Ini(platformTimeStampsFile); return(true); }
void ExportTo_Worker(object sender, DoWorkEventArgs e) { BackgroundWorker worker = sender as BackgroundWorker; List <object> args = e.Argument as List <object>; ArrayList items = args[0] as ArrayList; EXPORTS format = (EXPORTS)args[1]; string tempListFilename; switch (format) { case EXPORTS.EXCEL: tempListFilename = CreateUniqueFilename(MOG_ControllerProject.GetUser().GetUserToolsPath(), "AssetList.slk"); break; case EXPORTS.TEXT: tempListFilename = CreateUniqueFilename(MOG_ControllerProject.GetUser().GetUserToolsPath(), "AssetList.txt"); break; default: tempListFilename = ""; break; } // Clear out any previous temp file if (DosUtils.FileExist(tempListFilename)) { DosUtils.FileDelete(tempListFilename); } for (int i = 0; i < items.Count; i++) { ListViewItem item = items[i] as ListViewItem; string message = "Adding:\n" + " " + item.SubItems[(int)ASSET_LIST.NAME].Text; worker.ReportProgress(i * 100 / items.Count, message); string text = item.SubItems[(int)ASSET_LIST.NAME].Text + "\t" + item.SubItems[(int)ASSET_LIST.CLASSIFICATION].Text + "\t" + item.SubItems[(int)ASSET_LIST.PLATFORM].Text + "\t" + item.SubItems[(int)ASSET_LIST.VERSION].Text + "\t" + item.SubItems[(int)ASSET_LIST.SIZE].Text + "\t" + item.SubItems[(int)ASSET_LIST.OWNER].Text; switch (format) { case EXPORTS.EXCEL: DosUtils.AppendTextToSlkFile(tempListFilename, text); break; case EXPORTS.TEXT: DosUtils.AppendTextToFile(tempListFilename, text + "\r\n"); break; default: break; } } if (format == EXPORTS.EXCEL) { DosUtils.FileCloseSlk(tempListFilename); } e.Result = tempListFilename; }
public void TargetConsoleRemoveSync() { // Build a list of exactly what should be on the xbox mGetFileCount = true; mTotalFilesToCopy = 0; bool success = true; string CopyFileMap = mSourcePath + "\\MOG\\platformSincMap." + mMog.GetActivePlatform().mPlatformName + ".info"; if (DosUtils.FileExist(CopyFileMap)) { if (!DosUtils.FileDelete(CopyFileMap)) { return; } } // Create the new map mPendingCopy = new MOG_Ini(CopyFileMap); InitializeFileMap(); mFileMapCreate = true; // Initialize our progress dialog mProgress = new CallbackDialogForm(); string message = "Preforming platform remove data Sync: \n" + " Project Sync file map:" + mProjectSyncFile + "\n" + " User Sync file map:" + mUserSyncFile + "\n"; mProgress.DialogInitialize("(" + mTargetConsole + ")Platform Remove Data Sync", message, ""); Application.DoEvents(); for (int i = 0; i < mPlatformSync.CountKeys("FileMap"); i++) { string sourcePath = FormatString(mPlatformSync.GetKeyNameByIndex("FileMap", i).ToLower()); string targetPath = sourcePath.Replace(mSourcePath, mSyncRoot); string filePattern = mPlatformSync.GetKeyByIndex("FileMap", i).ToLower(); success = SyncDirectories(sourcePath, filePattern, mSyncRoot); mProgress.DialogUpdate((i * 100) / mPlatformSync.CountKeys("FileMap"), sourcePath + "\n" + targetPath); Application.DoEvents(); // Create the needed directory on the xbox string newDirName = RemapDirectoryString(targetPath); if (mConsoleCopy) { if (!XboxUtils.FileExist(newDirName)) { mPendingCopy.PutSectionString("CREATE_DIR", newDirName); mPendingCopy.Save(); } } else { if (!DosUtils.FileExist(newDirName)) { mPendingCopy.PutSectionString("CREATE_DIR", newDirName); mPendingCopy.Save(); } } } if (mConsoleCopy) { // Logon to correct xbox XboxUtils.SetXboxName(mTargetConsole, false); } mProgress.DialogInitialize("Sync Remove", "Scanning console for non-needed assets", ""); ArrayList deletableAssets = new ArrayList(); // Verify the xbox for each of these files for (int j = 0; j < mPlatformSync.CountKeys("FileMap"); j++) { string sourcePath = FormatString(mPlatformSync.GetKeyNameByIndex("FileMap", j).ToLower()); string targetPath = sourcePath.Replace(mSourcePath, mSyncRoot); string walkFiles = XboxUtils.GetFiles(targetPath + "\\"); mProgress.DialogUpdate((j * 100) / mPlatformSync.CountKeys("FileMap"), sourcePath + "\n" + targetPath); Application.DoEvents(); if (walkFiles.Length != 0 && walkFiles.IndexOf(",") != -1) { string [] files = walkFiles.Split(",".ToCharArray()); for (int k = 0; k < files.Length; k++) { string targetFile = files[k]; if (Path.GetExtension(targetFile) != "") { // Check to see if this file exists in the map if (!mPendingCopy.KeyExist("MAP", targetFile)) { // Get the list of deletable assets deletableAssets.Add(targetFile); } } } } } mProgress.DialogKill(); mProgress = null; if (deletableAssets.Count != 0) { if (guiConfirmDialog.MessageBoxDialog("Console Remove Sync", "Is is OK to Delete the Following Assets?", deletableAssets, MessageBoxButtons.OKCancel) == DialogResult.OK) { // Delete the assets in the list from off the xbox foreach (string str in guiConfirmDialog.SelectedItems) { string [] parts = str.Split(",;".ToCharArray()); if (parts != null && parts.Length >= 2) { string assetDeleteName = parts[0]; XboxUtils.FileDelete(assetDeleteName); } } } } else { MOG_REPORT.ShowMessageBox("Sync Remove", "This target does not have any files that need to be deleted", MessageBoxButtons.OK); } }