private void SyncPromoteButton_Click(object sender, EventArgs e) { string toolsPath = Path.Combine(MOG_ControllerProject.GetProjectPath(), "Tools"); ComboBoxItem filter = SyncFilterComboBox.SelectedItem as ComboBoxItem; if (filter != null) { string targetFilterName = ""; string filterFileName = filter.FullPath; if (filterFileName.Contains(MOG_ControllerProject.GetUserPath())) { targetFilterName = filterFileName.Replace(MOG_ControllerProject.GetUser().GetUserToolsPath(), toolsPath); } else { // This is a project tool and should be demoted targetFilterName = filterFileName.Replace(toolsPath, MOG_ControllerProject.GetUser().GetUserToolsPath()); } // This is a user tool and should be promoted if (DosUtils.FileCopyFast(filterFileName, targetFilterName, true)) { if (DosUtils.FileDeleteFast(filterFileName)) { UpdateFilterDropDown(Path.GetFileNameWithoutExtension(targetFilterName)); UpdatePromoteButton(); } } } }
private void UpdateFilterDropDown(string selectedText) { SyncFilterComboBox.Items.Clear(); //int comboWidth = SyncFilterComboBox.Width; // Get the users tools if (MOG_ControllerProject.GetUser() != null) { // Get all the filter files found within the users tools directory foreach (string filter in Directory.GetFiles(MOG_ControllerProject.GetUser().GetUserToolsPath(), "*.sync")) { // Add the names of each one of them to the comboBox int index = SyncFilterComboBox.Items.Add(new ComboBoxItem(Path.GetFileNameWithoutExtension(filter), Path.Combine(MOG_ControllerProject.GetUser().GetUserToolsPath(), filter))); SyncFilterComboBox.AutoCompleteCustomSource.Add(Path.GetFileNameWithoutExtension(filter)); // Adjust the width //SyncFilterComboBox.Width = SyncFilterComboBox.PreferredSize.Width; if (Path.GetFileNameWithoutExtension(filter) == selectedText) { SyncFilterComboBox.SelectedIndex = index; } } } if (!DesignMode) { // Get project tools // Get all the filter files found within the users tools directory string toolsPath = Path.Combine(MOG_ControllerProject.GetProjectPath(), "Tools"); foreach (string filter in Directory.GetFiles(toolsPath, "*.sync")) { // Add the names of each one of them to the comboBox int index = SyncFilterComboBox.Items.Add(new ComboBoxItem(Path.GetFileNameWithoutExtension(filter), Path.Combine(toolsPath, filter))); // Adjust the width //SyncFilterComboBox.Width = SyncFilterComboBox.PreferredSize.Width; if (Path.GetFileNameWithoutExtension(filter) == selectedText) { SyncFilterComboBox.SelectedIndex = index; } } } }
private void InitializeSpecialFolderIconsListView() { ImageList Icons = new ImageList(); FolderSpecialFolderListView.LargeImageList = Icons; FolderSpecialFolderListView.SmallImageList = Icons; FolderSpecialFolderListView.Items.Clear(); FolderSpecialFolderListView.ShowGroups = true; // Get all the system level icons string systemIcons = MOG_ControllerSystem.GetSystemRepositoryPath() + "\\Tools\\Images\\Filetypes"; LoadFileIcons("system", Icons, systemIcons); // Get all the system level icons if (MOG_ControllerProject.GetProject() != null) { string projectIcons = MOG_ControllerProject.GetProjectPath() + "\\Tools\\Images"; LoadFileIcons("project", Icons, projectIcons); } }
private void PopulateFilters() { GetLatestFiltersToolStripMenuItem.DropDownItems.Clear(); // Get the last set active tag string active = ""; if (GetLatestFiltersToolStripMenuItem.Tag is string) { active = GetLatestFiltersToolStripMenuItem.Tag as string; AddFilterItem(active, "None"); } else { AddFilterItem("None", "None"); } // Get the users tools if (MOG_ControllerProject.GetUser() != null) { // Get all the filter files found within the users tools directory foreach (string filter in Directory.GetFiles(MOG_ControllerProject.GetUser().GetUserToolsPath(), "*.sync")) { AddFilterItem(active, filter); } } if (!DesignMode) { // Get project tools // Get all the filter files found within the users tools directory string toolsPath = Path.Combine(MOG_ControllerProject.GetProjectPath(), "Tools"); foreach (string filter in Directory.GetFiles(toolsPath, "*.sync")) { AddFilterItem(active, filter); } } }
string ResolveToken(string token) { string value = ""; // Make sure this token starts with the '{'? if (token.StartsWith("{")) { // Get the name of this token string[] parts = token.Split("{}.".ToCharArray(), 3); // Make sure this resembled a real token? if (parts.Length == 3) { // Check for any contained commands? string testToken = "{" + parts[1] + "}"; // Determine which token we have? switch (testToken) { // Repository Tokens case TOKEN_Repository_Path: value = MOG_ControllerSystem.GetSystemRepositoryPath(); break; case TOKEN_Repository_ProjectsPath: value = MOG_ControllerSystem.GetSystemProjectsPath(); break; case TOKEN_Repository_ToolsPath: value = MOG_ControllerSystem.GetSystemRepositoryPath() + "\\Tools"; break; case TOKEN_Repository_Project_Path: value = MOG_ControllerProject.GetProjectPath(); break; case TOKEN_Repository_Project_ToolsPath: value = MOG_ControllerProject.GetProjectPath() + "\\Tools"; break; case TOKEN_Repository_Project_AssetsPath: value = MOG_ControllerRepository.GetRepositoryPath(); break; case TOKEN_Repository_Project_ArchivePath: value = MOG_ControllerRepository.GetArchivePath(); break; case TOKEN_Repository_Project_UsersPath: value = MOG_ControllerProject.GetProjectPath() + "\\Users"; break; // Project Tokens case TOKEN_Project_Name: value = MOG_ControllerProject.GetProjectName(); break; case TOKEN_Project_BranchName: value = MOG_ControllerProject.GetBranchName(); break; case TOKEN_Project_UserName: value = MOG_ControllerProject.GetUserName_DefaultAdmin(); break; case TOKEN_Project_PlatformName: value = MOG_ControllerProject.GetPlatformName(); break; case TOKEN_Project_WorkspaceDirectory: value = MOG_ControllerProject.GetWorkspaceDirectory(); break; // Ripper Tokens case TOKEN_Ripper_SourcePath: value = mRipperSourcePath; break; case TOKEN_Ripper_SourceFilePattern: value = mRipperSourceFilePattern; break; case TOKEN_Ripper_DestinationPath: value = mRipperDestinationPath; break; // Package Tokens case TOKEN_Package_WorkspaceDirectory: if (mPackageFileInfo != null) { value = mPackageFileInfo.mPackageWorkspaceDirectory; } break; case TOKEN_Package_DataDirectory: if (mPackageFileInfo != null) { value = mPackageFileInfo.mPackageDataDirectory; } break; case TOKEN_Package_PackageFile_Filename: if (mPackageFileInfo != null) { value = mPackageFileInfo.mPackageFile; } break; case TOKEN_Package_PackageFile_FullName: { MOG_Filename packageFilename = (mPackageFileInfo != null) ? mPackageFileInfo.mPackageAssetFilename : new MOG_Filename(MOG_ControllerPackage.GetPackageName(mPackageAssignment)); value = packageFilename.GetAssetFullName(); } break; case TOKEN_Package_PackageFile_Classification: { MOG_Filename packageFilename = (mPackageFileInfo != null) ? mPackageFileInfo.mPackageAssetFilename : new MOG_Filename(MOG_ControllerPackage.GetPackageName(mPackageAssignment)); value = packageFilename.GetAssetClassification(); } break; case TOKEN_Package_PackageFile_Label: { MOG_Filename packageFilename = (mPackageFileInfo != null) ? mPackageFileInfo.mPackageAssetFilename : new MOG_Filename(MOG_ControllerPackage.GetPackageName(mPackageAssignment)); value = packageFilename.GetAssetLabel(); } break; case TOKEN_Package_PackageFile_Platform: { MOG_Filename packageFilename = (mPackageFileInfo != null) ? mPackageFileInfo.mPackageAssetFilename : new MOG_Filename(MOG_ControllerPackage.GetPackageName(mPackageAssignment)); value = packageFilename.GetAssetPlatform(); } break; case TOKEN_Package_PackageFile_Group: value = MOG_ControllerPackage.GetPackageGroups(mPackageAssignment); break; case TOKEN_Package_PackageFile_Object: value = MOG_ControllerPackage.GetPackageObjects(mPackageAssignment); break; // Inbox Tokens case TOKEN_Inbox_UserName: value = mAssetFilename.GetUserName(); break; case TOKEN_Inbox_UserPath: value = mAssetFilename.GetUserPath(); break; case TOKEN_Inbox_BoxName: value = mAssetFilename.GetBoxName(); break; case TOKEN_Inbox_BoxPath: value = mAssetFilename.GetBoxPath(); break; // Asset Tokens case TOKEN_Asset_AssetName_Path: value = mAssetFilename.GetPath(); break; case TOKEN_Asset_AssetName_FullName: value = mAssetFilename.GetAssetFullName(); break; case TOKEN_Asset_AssetName_Classification: value = mAssetFilename.GetAssetClassification(); break; case TOKEN_Asset_AssetName_Name: value = mAssetFilename.GetAssetName(); break; case TOKEN_Asset_AssetName_PlatformName: value = mAssetFilename.GetAssetPlatform(); break; case TOKEN_Asset_AssetName_Label: value = mAssetFilename.GetAssetLabel(); break; case TOKEN_Asset_ImportedFile: case TOKEN_Asset_RippedFile: value = ResolveToken_AssetFile(token); break; case TOKEN_Asset_Property: value = ResolveToken_Property(token); break; case TOKEN_Asset_ClassificationPath: value = MOG_Filename.GetClassificationPath(mAssetFilename.GetAssetClassification()); break; case TOKEN_Asset_VersionTimeStamp: value = mAssetFilename.GetVersionTimeStamp(); break; } // Check if we have a command? if (parts[2] != ".") { } } } return(value); }