public void InitializeItems(MenuItem menu) { string dir = mCustomToolsInfo.Substring(0, mCustomToolsInfo.LastIndexOf("\\")); string wildcard = mCustomToolsInfo.Substring(mCustomToolsInfo.LastIndexOf("\\") + 1, (mCustomToolsInfo.Length - mCustomToolsInfo.LastIndexOf("\\")) - 1); foreach (FileInfo file in DosUtils.FileGetList(dir, wildcard)) { MOG_Ini customTools = new MOG_Ini(file.FullName); // Remove the beginning of the info name string tmp = wildcard.Substring(0, wildcard.IndexOf("*")); string name = file.Name.Replace(tmp, ""); // Remove the .info name = name.Replace(".info", ""); // Create the main Item MenuItem parent = new MenuItem(name); if (customTools.SectionExist("USER_TOOLS")) { mClickHandlers = new ArrayList(); for (int i = 0; i < customTools.CountKeys("USER_TOOLS"); i++) { parent.MenuItems.Add(CreateItem(customTools.GetKeyNameByIndexSLOW("USER_TOOLS", i), new MogMenuItem_Click(CustomToolMenuItem_Click))); } } menu.MenuItems.Add(parent); } }
private void InitializeSourceVersions() { MilestoneSourceComboBox.Items.Clear(); // Add the local version first string platform = MilestonePlatformComboBox.Text; if (mMog.GetProject().GetPlatform(platform) != null) { MilestoneSourceComboBox.Items.Add(string.Concat(mMog.GetProject().GetPlatform(platform).mPlatformTargetPath, "\\MOG\\LocalVersion.info")); } else if (string.Compare(platform, "All", true) == 0) { // error out for now MOG_REPORT.ShowMessageBox("ERROR", "All platform not supported yet.", MessageBoxButtons.OK); } // Add the global current version next string globalPath = string.Concat(mMog.GetProject().GetProjectPath(), "\\Versions\\"); MilestoneSourceComboBox.Items.Add(string.Concat(globalPath, "Current.info")); foreach (FileInfo file in DosUtils.FileGetList(globalPath, "*.info")) { if (string.Compare(file.Name, "Current.info", true) != 0) { MilestoneSourceComboBox.Items.Add(string.Concat(globalPath, file.Name)); } } }
/// <summary> InitializeAssetIcons /// Loads all the bmp's specified in the asset declarations /// in the Project.ini files. Each bmp is added to a /// list allong with its key added to a corresponding list /// for later searching. /// </summary> static public void ClassIconInitialize() { // Check to see if our project is loaded if (!MOG_ControllerProject.IsProject()) { return; } // Only allow population of the images array once if (mAssetTypes.Count > 0) { return; } lock (mAssetTypes) { // Add the active item icon first // Get the image if (DosUtils.FileExist(MOG_ControllerSystem.LocateTool("Images", "BaseNode.bmp"))) { // Get the group image Image myImage = new Bitmap(MOG_ControllerSystem.LocateTool("Images", "BaseNode.bmp")); // Add the image and the type to the arrayLists mAssetTypeImages.Images.Add(myImage); mAssetTypes.Add("dot"); } if (DosUtils.FileExist(MOG_ControllerSystem.LocateTool("Images", "Group.bmp"))) { // Get the group image Image myImage = new Bitmap(MOG_ControllerSystem.LocateTool("Images", "Group.bmp")); // Add the image and the type to the arrayLists mAssetTypeImages.Images.Add(myImage); mAssetTypes.Add("group"); } } mAssetTypeImages.TransparentColor = Color.Magenta; // Initialize state icons FileInfo [] stateImages = DosUtils.FileGetList(MOG_ControllerSystem.LocateTool("Images\\States", ""), "*.bmp"); foreach (FileInfo stateImage in stateImages) { LoadRawIcon(mStateTypeImages, mStateTypes, stateImage.FullName, Path.GetFileNameWithoutExtension(stateImage.Name)); } // Load our file icons as small icons mFileTypeManager = new IconListManager(mAssetTypeImages, IconReader.IconSize.Small); }
/// <summary> InitializeAssetIcons /// Loads all the bmp's specified in the asset declarations /// in the Project.ini files. Each bmp is added to a /// list allong with its key added to a corresponding list /// for later searching. /// </summary> static public void ClassIconInitialize() { // Check to see if our project is loaded if (!MOG_ControllerProject.IsProject()) { return; } // Only allow population of the images array once if (mAssetTypes.Count > 0) { return; } // Add the active item icon first // Get the image AddIcon("Images", "BaseNode.bmp", "dot"); AddIcon("Images", "Group.bmp", "group"); AddIcon("Images", "FileLocked.png", "locked"); //mAssetTypeImages.TransparentColor = Color.Magenta; mAssetTypeImages.ColorDepth = ColorDepth.Depth32Bit; // Initialize state icons FileInfo [] stateImages = DosUtils.FileGetList(MOG_ControllerSystem.LocateTool("Images\\States", ""), "*.bmp"); foreach (FileInfo stateImage in stateImages) { LoadRawIcon(mStateTypeImages, mStateTypes, stateImage.FullName.ToLower(), Path.GetFileNameWithoutExtension(stateImage.Name).ToLower()); } // Initialize state icons stateImages = DosUtils.FileGetList(MOG_ControllerSystem.LocateTool("Images\\States", ""), "*.png"); foreach (FileInfo stateImage in stateImages) { LoadRawIcon(mStateTypeImages, mStateTypes, stateImage.FullName.ToLower(), Path.GetFileNameWithoutExtension(stateImage.Name).ToLower()); } // Load our file icons as small icons mFileTypeManager = new IconListManager(mAssetTypeImages, IconReader.IconSize.Small); }
public void DownloadSkins() { if (DosUtils.DirectoryExist(MOG.MOG_Main.GetExecutablePath() + "\\Skin") == false) { DosUtils.DirectoryCreate(MOG.MOG_Main.GetExecutablePath() + "\\Skin"); } string sourcePath = MOG.CONTROLLER.CONTROLLERSYSTEM.MOG_ControllerSystem.GetSystemRepositoryPath() + "\\Updates\\Skins"; string targetPath = MOG.MOG_Main.GetExecutablePath() + "\\Skin"; if (DosUtils.DirectoryExist(sourcePath)) { // Copy all the files down FileInfo [] files = DosUtils.FileGetList(sourcePath, "*.*"); foreach (FileInfo file in files) { DosUtils.FileCopyModified(file.FullName, targetPath + "\\" + file.Name); } } }
private bool SyncFiles(string fullFilename, string filePattern) { FileInfo[] files = DosUtils.FileGetList(fullFilename, filePattern); if (files != null) { foreach (FileInfo file in files) { // Replace the source dir of this file with the target dir and call the copy routine string targetFile = file.FullName.ToLower().Replace(mSourcePath, mSyncRoot); if (!CheckExclusions(file.Name, file.DirectoryName)) { if (mGetFileCount) { if (!SyncFile(file.FullName, targetFile)) { return(false); } } else { if (!SyncFile(file.FullName, targetFile)) { return(false); } // Check if the user cancels Application.DoEvents(); if (mProgress.DialogProcess()) { return(false); } } } } } return(true); }
public ArrayList LocateAssetBinary(MOG_Filename filename, AssetDirectories AssetDirectoryType) { string targetDir = ""; ArrayList binaryFiles = new ArrayList(); MOG_Properties assetProperties = new MOG_Properties(filename); switch (AssetDirectoryType) { case AssetDirectories.IMPORTED: targetDir = MOG_ControllerAsset.GetAssetImportedDirectory(assetProperties); break; case AssetDirectories.PROCESSED: string platformName = ""; // If we have a valid gameDataController? if (MOG_ControllerProject.GetCurrentSyncDataController() != null) { platformName = MOG_ControllerProject.GetCurrentSyncDataController().GetPlatformName(); } targetDir = MOG_ControllerAsset.GetAssetProcessedDirectory(assetProperties, platformName); break; } if (targetDir.Length != 0 && DosUtils.Exist(targetDir)) { FileInfo [] files = DosUtils.FileGetList(targetDir, "*.*"); foreach (FileInfo file in files) { binaryFiles.Add(file.FullName); } } else { MOG_Prompt.PromptMessage("Asset View", "Asset (" + targetDir + ") does not exist or is a zero length file! Cannot View.", Environment.StackTrace); } return(binaryFiles); }
/// <summary> InitializeAssetIcons /// Loads all the bmp's specified in the asset declarations /// in the Project.ini files. Each bmp is added to a /// list allong with its key added to a corresponding list /// for later searching. /// </summary> static public void AssetIconInitialize() { // Check to see if our project is loaded if (!MOG_ControllerProject.IsProject()) { return; } // Only allow population of the images array once if (mAssetTypes.Count > 0) { return; } // Add the active item icon first // Get the image if (DosUtils.FileExist(string.Concat(MOG_ControllerSystem.GetSystem().GetSystemToolsPath(), "\\Images\\SelectIcon.bmp"))) { // Get the group image Image myImage = new Bitmap(string.Concat(MOG_ControllerSystem.GetSystem().GetSystemToolsPath(), "\\Images\\SelectIcon.bmp")); // Add the image and the type to the arrayLists mAssetTypeImages.Images.Add(myImage); mAssetTypes.Add("dot"); } // Open the project.ini MOG_Ini ini = new MOG_Ini(MOG_ControllerProject.GetProject().GetProjectConfigFilename()); // Walk through all the assets for (int x = 0; x < ini.CountKeys("Assets"); x++) { // Get the asset name string imageName = ini.GetString(ini.GetKeyNameByIndex("Assets", x), "Icon"); // Check if we have an image? if (imageName.Length > 0) { string assetKey = ini.GetKeyNameByIndex("Assets", x).ToLower(); LoadIcon(imageName, ini.GetKeyNameByIndex("Assets", x).ToLower()); // Check for a lock image string lockImageName = Path.GetFileNameWithoutExtension(imageName) + "_locked"; string lockFullImageName = imageName.Replace(Path.GetFileNameWithoutExtension(imageName), lockImageName); LoadIcon(lockFullImageName, assetKey + "_locked"); // Check for a ReadLock image lockImageName = Path.GetFileNameWithoutExtension(imageName) + "_readlocked"; lockFullImageName = imageName.Replace(Path.GetFileNameWithoutExtension(imageName), lockImageName); LoadIcon(lockFullImageName, assetKey + "_readlocked"); } } if (DosUtils.FileExist(string.Concat(MOG_ControllerSystem.GetSystem().GetSystemToolsPath(), "\\Images\\Group.bmp"))) { // Get the group image Image myImage = new Bitmap(string.Concat(MOG_ControllerSystem.GetSystem().GetSystemToolsPath(), "\\Images\\Group.bmp")); // Add the image and the type to the arrayLists mAssetTypeImages.Images.Add(myImage); mAssetTypes.Add("group"); } mAssetTypeImages.TransparentColor = Color.Magenta; // Initialize state icons if (DosUtils.DirectoryExist(MOG_ControllerSystem.GetSystem().GetSystemToolsPath() + "\\Images\\States")) { FileInfo [] stateImages = DosUtils.FileGetList(MOG_ControllerSystem.GetSystem().GetSystemToolsPath() + "\\Images\\States", "*.bmp"); foreach (FileInfo stateImage in stateImages) { LoadRawIcon(mStateTypeImages, mStateTypes, stateImage.FullName, Path.GetFileNameWithoutExtension(stateImage.Name)); } } }
/// <summary> /// Scans the local branches data to locate all binaries that do not have a counterpart in the project database /// </summary> private bool LocateNonMogAssetsScanFiles(BackgroundWorker worker, string path, ArrayList rogueFiles, HybridDictionary MergeableAssets, string targetProjectPath, MOG_Properties classificationProperties) { // Check if this is a library path? if (MOG_ControllerLibrary.GetWorkingDirectory().Length > 0 && path.StartsWith(MOG_ControllerLibrary.GetWorkingDirectory(), StringComparison.CurrentCultureIgnoreCase)) { // Build us our library classification for this library path string classification = MOG_ControllerLibrary.ConstructLibraryClassificationFromPath(path); // Check if this library classification exists? if (MOG_ControllerProject.IsValidClassification(classification)) { // Obtain the properties for this library classification classificationProperties = new MOG_Properties(classification); } } // Get all the files withing this directory FileInfo [] files = DosUtils.FileGetList(path, "*.*"); if (files != null) { // For each file, check to see if we have a DB link for that filename foreach (FileInfo file in files) { if (worker.CancellationPending) { return(false); } try { // Check to see if we have a DB link for that filename if (MergeableAssets.Contains(file.FullName) == false) { // Check if we have a classificationProperties? if (classificationProperties != null) { // Make sure this does not violate the classification filters // Check the classification's inclusion filter. if (classificationProperties.FilterInclusions.Length > 0) { FilePattern inclusions = new FilePattern(classificationProperties.FilterInclusions); if (inclusions.IsFilePatternMatch(file.FullName) == false) { // Skip this file as it is not included continue; } } // Check the classification's exclusion filter. if (classificationProperties.FilterExclusions.Length > 0) { FilePattern exclusions = new FilePattern(classificationProperties.FilterExclusions); if (exclusions.IsFilePatternMatch(file.FullName) == true) { // Skip this file as it is excluded continue; } } } // Make sure it is not hidden if (Convert.ToBoolean(file.Attributes & FileAttributes.Hidden) == false) { // If no match was found, add to our list of rogue assets rogueFiles.Add(file.FullName); } } } catch { // Needed just in case we have some files larger than 260 in length } } } // Now check all these subDirs DirectoryInfo [] dirs = DosUtils.DirectoryGetList(path, "*.*"); if (dirs != null) { foreach (DirectoryInfo dir in dirs) { // Make sure it is not hidden if (Convert.ToBoolean(dir.Attributes & FileAttributes.Hidden) == false) { // Scan their respective files if (!LocateNonMogAssetsScanFiles(worker, dir.FullName, rogueFiles, MergeableAssets, targetProjectPath, classificationProperties)) { return(false); } } } } return(true); }
static protected void assetTreeViewCreate_AddFilesNodes(TreeNode parent, int defaultIndex) { // Create files node TreeNode filesRoot = new TreeNode("Files", defaultIndex, 0); guiAssetTreeTag parentTag = (guiAssetTreeTag)parent.Tag; filesRoot.Tag = parentTag; ((guiAssetTreeTag)filesRoot.Tag).Level = guiAssetTreeTag.TREE_FOCUS.SUBVERSION; // Populate files TreeNode sourceRoot = new TreeNode("Imported Files", defaultIndex, 0); sourceRoot.Tag = filesRoot.Tag; TreeNode gameDataRoot = new TreeNode("Processed Files", defaultIndex, 0); gameDataRoot.Tag = filesRoot.Tag; DirectoryInfo[] directories = DosUtils.DirectoryGetList(parentTag.FullFilename, ""); // Go through each platform only for the asset of this parent node foreach (DirectoryInfo directory in directories) { // If this is a gamedata, add it with its subnode and file(s) if (directory.Name.ToLower().IndexOf("gamedata") > -1) { // Get rid of gamedata from directory.Name string gamedataName = directory.Name.ToLower().Replace("files.", ""); // Create a new node for each platform TreeNode platformNode = new TreeNode(gamedataName, defaultIndex, 0); platformNode.Tag = filesRoot.Tag; FileInfo[] files = DosUtils.FileGetList(directory.FullName, ""); // Add files in gamedata directory to platformNode if (files != null) { // Add each file to each gamedata<platform> node foreach (FileInfo file in files) { TreeNode fileNode = assetTreeViewCreate_GetTreeNodeWithIcon(file.Name, defaultIndex); fileNode.Tag = filesRoot.Tag; platformNode.Nodes.Add(fileNode); } } gameDataRoot.Nodes.Add(platformNode); } // Else if this is a files folder, add it to the source node else if (directory.Name.ToLower().IndexOf("files") > -1) { FileInfo[] files = DosUtils.FileGetList(directory.FullName, ""); if (files != null) { foreach (FileInfo file in files) { TreeNode fileNode = assetTreeViewCreate_GetTreeNodeWithIcon(file.Name, defaultIndex); fileNode.Tag = filesRoot.Tag; sourceRoot.Nodes.Add(fileNode); } } } } filesRoot.Nodes.Clear(); filesRoot.Nodes.AddRange(new TreeNode[] { sourceRoot, gameDataRoot }); parent.Nodes.Add(filesRoot); }
private MOG_PropertiesIni Post(string targetFolder, MOG_PropertiesIni fileList) { bool title = false; MOG_PropertiesIni copiedFiles = new MOG_PropertiesIni(); string fullTargetPath = mSourceBinaries + "\\" + targetFolder + "\\" + mArchiveVersion; Console.WriteLine("----------------------------------------"); Console.WriteLine("Create " + targetFolder + " VERSION: " + mArchiveVersion); // Make our target directory DosUtils.DirectoryCreate(fullTargetPath); Console.WriteLine("---------------------------"); Console.WriteLine("Posting new " + targetFolder + " version"); Console.WriteLine("---------------------------"); if (fileList.SectionExist("Files")) { for (int i = 0; i < fileList.CountKeys("Files"); i++) { string label = fileList.GetKeyByIndexSLOW("Files", i); string filename = fileList.GetKeyNameByIndexSLOW("Files", i); string path = MOG_Tokens.GetFormattedString(Path.GetDirectoryName(filename), "{BuildType}=" + mBuildType); string file = Path.GetFileName(filename); if (!title && mVerbose) { Console.WriteLine(label); title = true; } // Copy the files foreach (FileInfo fileHandle in DosUtils.FileGetList(path, file)) { if (!title && !mVerbose) { Console.WriteLine(label); title = true; } try { fileHandle.CopyTo(fullTargetPath + "\\" + fileHandle.Name, true); copiedFiles.PutSectionString("FILES", fullTargetPath + "\\" + fileHandle.Name); Console.WriteLine(" POSTED: " + "<" + fileHandle.LastWriteTime.ToShortDateString().ToString() + " " + fileHandle.LastWriteTime.ToShortTimeString().ToString() + ">\t" + fileHandle.Name); } catch (Exception e) { Console.WriteLine(" ERROR POSTING: " + fileHandle.Name); Console.WriteLine(" ERROR MESSAGE: "+ e.Message); } } title = false; Console.WriteLine(""); } } return(copiedFiles); }
public guiSound(MogMainForm handle, SplashForm SplashScreen, string configFilename, string soundClass) { mTheme = soundClass; mHandle = handle; mSoundAvailable = true; InitializeSoundEngine(); // Load the sound ini string iniPath = Application.StartupPath; string configFile = string.Concat(iniPath, "\\", configFilename); if (DosUtils.FileExist(configFile)) { mConfig = new MOG_Ini(configFile); mSoundPath = string.Concat(iniPath, "\\ClientSounds"); // Update the sound menu with the scheme choices if (mConfig.SectionExist("Themes")) { // Add a menuItem for each them found in the ini for (int i = 0; i < mConfig.CountKeys("Themes"); i++) { // Assign the click event to each menu item ToolStripMenuItem item = new ToolStripMenuItem(mConfig.GetKeyNameByIndexSLOW("Themes", i)); item.Click += new System.EventHandler(this.SoundMenu_OnClick); // Set the check mark on the theme that pass passed in to the constructor if (string.Compare(item.Text, mTheme, true) == 0) { item.Checked = true; } // Add th menu item mHandle.themeToolStripMenuItem.DropDownItems.Add(item); } // Setup default theme if (mTheme == null) { if (mHandle.themeToolStripMenuItem.DropDownItems.Count > 0) { mTheme = mHandle.themeToolStripMenuItem.DropDownItems[0].Text; ToolStripMenuItem defaultTheme = mHandle.themeToolStripMenuItem.DropDownItems[0] as ToolStripMenuItem; defaultTheme.Checked = true; } } } // Get our current sounds version if (mConfig.SectionExist("Version")) { mVersion = Convert.ToInt32(mConfig.GetString("SoundsVersion", "Version")); } else { mVersion = 0; } // Get all default sounds if (mConfig.SectionExist("SOUNDS")) { string SourceSoundPath = MOG_ControllerSystem.GetSystemRepositoryPath() + "\\" + mConfig.GetString("Sounds", "Root"); // Make sure we have a current sound directory if (!DosUtils.DirectoryExist(mSoundPath)) { DosUtils.DirectoryCreate(mSoundPath); } // Make sure we have all the needed sounds if (DosUtils.FileExist(string.Concat(SourceSoundPath, "\\version.ini"))) { MOG_Ini soundVersion = new MOG_Ini(string.Concat(SourceSoundPath, "\\version.ini")); int sourceVersion = Convert.ToInt32(soundVersion.GetString("SoundsVersion", "Version")); if (sourceVersion > mVersion) { // Update all our sounds foreach (FileInfo file in DosUtils.FileGetList(SourceSoundPath, "*.wav")) { string target = string.Concat(mSoundPath, "\\", file.Name); if (DosUtils.FileCopyModified(file.FullName, target)) { SplashScreen.updateSplashNoStep("UPDATING: " + file.Name, 0); } } // Update our version number mConfig.PutString("SoundsVersion", "Version", sourceVersion.ToString()); mConfig.Save(); } } } } // Set the main theme to be the same as this private version mHandle.mSoundScheme = mTheme; }
private void LoadUserSyncFiles() { #region Initialize the project filemaps // Get any additional maps SyncProjectMapComboBox.Items.Clear(); FileInfo [] files = DosUtils.FileGetList(MOG_ControllerProject.GetProject().GetProjectToolsPath(), "*.sync"); if (files != null) { // Add the default 'none' SyncProjectMapComboBox.Items.Add("None"); foreach (FileInfo file in files) { SyncProjectMapComboBox.Items.Add(file.Name); } if (files.Length > 0) { SyncProjectMapComboBox.SelectedIndex = 0; } } // Set the project map if (mProjectMap.Length != 0) { SyncProjectMapComboBox.Text = mProjectMap; } else { mProjectMap = "None"; SyncProjectMapComboBox.Text = mProjectMap; } #endregion #region Initialize the user filemaps // Get any aditional sync files SyncUserMapComboBox.Items.Clear(); files = DosUtils.FileGetList(MOG_ControllerProject.GetUser().GetUserToolsPath(), "*.sync"); if (files != null) { // Add the default user map SyncUserMapComboBox.Items.Add("None"); foreach (FileInfo file in files) { SyncUserMapComboBox.Items.Add(file.Name); } if (files.Length > 0) { SyncUserMapComboBox.SelectedIndex = 0; } } // Set the user map if (mUserMap.Length != 0) { SyncUserMapComboBox.Text = mUserMap; } else { mUserMap = "None"; SyncUserMapComboBox.Text = mUserMap; } #endregion }