public static void Start(OptionsGui data) { var projects = SolutionFileParser.GetSolutionProjects(data.SolutionPath); if (!projects.Any()) { return; } if (!Directory.Exists(data.OutputFolder)) { Directory.CreateDirectory(data.OutputFolder); } new ZipSolution { Comment = "Created by SolutionTemplateGenerator", IncludeSubfolders = true, OptionsGuiData = data, OutPathname = Path.Combine(data.OutputFolder, data.ProductName + ".zip"), NumberOfProjects = projects.Count, ProjectFiles = projects.Select(x => x.FullPath).ToList() }.ZipFolder(); Process.Start(data.OutputFolder); }
public static string GetSolutionVSTemplate(OptionsGui data) { var template = new VSTemplate { Version = "3.0.0", Type = "ProjectGroup" }; template.TemplateData.Name.Value = data.ProductName; template.TemplateData.Description.Value = data.ProductDescription; template.TemplateData.ProjectType = data.ProjectType; template.TemplateData.ProjectSubType = data.ProjectSubType; template.TemplateData.SortOrder = "1000"; template.TemplateData.CreateNewFolderSpecified = true; template.TemplateData.CreateNewFolder = true; template.TemplateData.DefaultName = data.ProductName; template.TemplateData.ProvideDefaultNameSpecified = true; template.TemplateData.ProvideDefaultName = true; template.TemplateData.LocationFieldSpecified = true; template.TemplateData.LocationField = VSTemplateTemplateDataLocationField.Enabled; template.TemplateData.EnableLocationBrowseButtonSpecified = true; template.TemplateData.EnableLocationBrowseButton = true; template.TemplateData.Icon.Value = "__Template_small.png"; template.TemplateData.PreviewImage.Value = "__Template_large.png"; var projectCollection = new VSTemplateTemplateContentProjectCollection(); var projects = SolutionFileParser.GetSolutionProjects(data.SolutionPath); foreach (var project in projects) { var name = project.ProjectName.Replace(data.DefaultNamespace, "$saferootprojectname$"); var link = new ProjectTemplateLink { ProjectName = name, Value = string.Format("{0}\\MyTemplate.vstemplate", name), ReplaceParameters = true }; projectCollection.Items.Add(link); } template.TemplateContent.Items.Add(projectCollection); template.WizardExtension = new List <VSTemplateWizardExtension> { new VSTemplateWizardExtension { Assembly = new List <object> { typeof(SafeRootProjectWizard.RootWizard).Assembly.FullName }, FullClassName = new List <object> { typeof(SafeRootProjectWizard.RootWizard).FullName } } }; return(Serializer.Serialize(template)); }
// Public Methods (1) public static string GetProjectVSTemplate(OptionsGui data, string projectFilePath) { var regex = new Regex(@"[^\p{Ll}\p{Lu}\p{Lt}\p{Lo}\p{Nd}\p{Nl}\p{Mn}\p{Mc}\p{Cf}\p{Pc}\p{Lm}]"); var template = new VSTemplate { Type = "Project", Version = "3.0.0" }; template.TemplateData.Name.Value = data.ProductName; template.TemplateData.Description.Value = data.ProductDescription; template.TemplateData.ProjectType = data.ProjectType; template.TemplateData.ProjectSubType = data.ProjectSubType; template.TemplateData.SortOrder = "1000"; template.TemplateData.CreateNewFolderSpecified = true; template.TemplateData.CreateNewFolder = true; template.TemplateData.DefaultName = regex.Replace(data.ProductName, ""); template.TemplateData.ProvideDefaultNameSpecified = true; template.TemplateData.ProvideDefaultName = true; template.TemplateData.LocationFieldSpecified = true; template.TemplateData.LocationField = VSTemplateTemplateDataLocationField.Enabled; template.TemplateData.EnableLocationBrowseButtonSpecified = true; template.TemplateData.EnableLocationBrowseButton = true; template.TemplateData.Icon.Value = "__Template_small.png"; template.TemplateData.PreviewImage.Value = "__Template_large.png"; var contentProject = new VSTemplateTemplateContentProject { File = projectFilePath.GetFileName().replaceNamespace(data), ReplaceParameters = true, ReplaceParametersSpecified = true, TargetFileName = projectFilePath.GetFileName().replaceNamespace(data) }; var rootDir = projectFilePath.GetDirectoryName() + "\\"; addAllFiles(rootDir, rootDir, contentProject, data); template.TemplateContent.Items.Add(contentProject); template.WizardExtension = new List <VSTemplateWizardExtension> { new VSTemplateWizardExtension { Assembly = new List <object> { typeof(SafeRootProjectWizard.ChildWizard).Assembly.FullName }, FullClassName = new List <object> { typeof(SafeRootProjectWizard.ChildWizard).FullName } } }; return(Serializer.Serialize(template)); }
public static void SaveSettings(OptionsGui data) { var xml = Serializer.Serialize(data); File.WriteAllText(XmlPath, xml); }
private void StroopMainForm_Load(object sender, EventArgs e) { // Temp: Remove "Other" tab #if RELEASE tabControlMain.TabPages.Remove(tabPageExpressions); #endif _sm64Stream = new ProcessStream(); _sm64Stream.OnUpdate += OnUpdate; _disManager = new DisassemblyManager(this, richTextBoxDissasembly, maskedTextBoxDisStart, _sm64Stream, buttonDisGo); _scriptManager = new ScriptManager(_sm64Stream, _scriptParser, checkBoxUseRomHack); _hackManager = new HackManager(_sm64Stream, _romHacks, checkedListBoxHacks); // Create map manager MapGui mapGui = new MapGui(); mapGui.GLControl = glControlMap; mapGui.MapIdLabel = labelMapId; mapGui.MapNameLabel = labelMapName; mapGui.MapSubNameLabel = labelMapSubName; mapGui.PuValueLabel = labelMapPuValue; mapGui.QpuValueLabel = labelMapQpuValue; mapGui.MapIconSizeTrackbar = trackBarMapIconSize; mapGui.MapZoomTrackbar = trackBarMapZoom; mapGui.MapShowInactiveObjects = checkBoxMapShowInactive; mapGui.MapShowMario = checkBoxMapShowMario; mapGui.MapShowObjects = checkBoxMapShowObj; mapGui.MapShowHolp = checkBoxMapShowHolp; mapGui.MapShowCamera = checkBoxMapShowCamera; mapGui.MapShowFloorTriangle = checkBoxMapShowFloor; _mapManager = new MapManager(_sm64Stream, _mapAssoc, _objectAssoc, mapGui); _marioManager = new MarioManager(_sm64Stream, _marioData, panelMarioBorder, flowLayoutPanelMario, _mapManager); _hudManager = new HudManager(_sm64Stream, _hudData, tabPageHud); _miscManager = new MiscManager(_sm64Stream, _miscData, flowLayoutPanelMisc, groupBoxPuController); _cameraManager = new CameraManager(_sm64Stream, _cameraData, panelCameraBorder, flowLayoutPanelCamera); _triangleManager = new TriangleManager(_sm64Stream, tabPageTriangles, _triangleData); _debugManager = new DebugManager(); // Create object manager var objectGui = new ObjectDataGui() { ObjectBorderPanel = panelObjectBorder, ObjectFlowLayout = flowLayoutPanelObject, ObjectImagePictureBox = pictureBoxObject, ObjAddressLabelValue = labelObjAddValue, ObjAddressLabel = labelObjAdd, ObjBehaviorLabel = labelObjBhvValue, ObjectNameTextBox = textBoxObjName, ObjSlotIndexLabel = labelObjSlotIndValue, ObjSlotPositionLabel = labelObjSlotPosValue, CloneButton = buttonObjClone, MoveMarioToButton = buttonObjGoTo, MoveToMarioButton = buttonObjRetrieve, UnloadButton = buttonObjUnload }; _objectManager = new ObjectManager(_sm64Stream, _objectAssoc, _objectData, objectGui); // Create options manager var optionGui = new OptionsGui(); optionGui.CheckBoxStartFromOne = checkBoxStartSlotIndexOne; _optionsManager = new OptionsManager(optionGui); // Create Object Slots _slotManagerGui.TabControl = tabControlMain; _slotManagerGui.LockLabelsCheckbox = checkBoxObjLockLabels; _slotManagerGui.MapObjectToggleModeComboBox = comboBoxMapToggleMode; _slotManagerGui.FlowLayoutContainer = flowLayoutPanelObjects; _slotManagerGui.SortMethodComboBox = comboBoxSortMethod; _slotManagerGui.LabelMethodComboBox = comboBoxLabelMethod; _objectSlotManager = new ObjectSlotsManager(_sm64Stream, _objectAssoc, _objectManager, _slotManagerGui, _mapManager, _miscManager); SetupViews(); _resizing = false; _defaultSplitValue = splitContainerMain.SplitterDistance; labelVersionNumber.Text = _version; // Load process var processes = GetAvailableProcesses(); if (processes.Count == 1) { if (MessageBox.Show(String.Format("Found process \"{0}\". Connect?", processes[0].ProcessName), "Process Found", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { var processSelect = new ProcessSelection(processes[0]); comboBoxProcessSelection.Items.Add(processSelect); comboBoxProcessSelection.SelectedIndex = 0; } } }
// Public Methods (1) /// <summary> /// Creates extension.vsixmanifest file's content. /// </summary> public static string GetVsixManifest(OptionsGui data) { var vsix = new Vsix { Version = "1.0.0", Identifier = { Id = data.ProductName + "." + Guid.NewGuid(), Name = data.ProductName, Version = data.Version, Author = data.CompanyName } }; if (string.IsNullOrEmpty(vsix.Identifier.Author)) { vsix.Identifier.Author = "Author"; } vsix.Identifier.Description = data.ProductDescription; vsix.Identifier.InstalledByMsiSpecified = true; vsix.Identifier.InstalledByMsi = false; vsix.Identifier.Locale = 1033; vsix.Identifier.SupportedFrameworkRuntimeEdition.MaxVersion = data.ShouldSupportVS2012 ? "4.5" : "4.0"; vsix.Identifier.SupportedFrameworkRuntimeEdition.MinVersion = "4.0"; vsix.Identifier.SupportedProducts = new List <object>(); if (data.ShouldSupportVS2010) { vsix.Identifier.SupportedProducts.Add(new VsixIdentifierVisualStudio { Version = "10.0", Edition = new List <string> { "Ultimate", "Premium", "Pro", "Express_All" } }); } if (data.ShouldSupportVS2012) { vsix.Identifier.SupportedProducts.Add(new VsixIdentifierVisualStudio { Version = "11.0", Edition = new List <string> { "Ultimate", "Premium", "Pro", "Express_All" } }); } if (data.ShouldSupportVS2013) { vsix.Identifier.SupportedProducts.Add(new VsixIdentifierVisualStudio { Version = "12.0", Edition = new List <string> { "Ultimate", "Premium", "Pro", "Express_All" } }); } if (data.ShouldSupportVS2015) { vsix.Identifier.SupportedProducts.Add(new VsixIdentifierVisualStudio { Version = "14.0", Edition = new List <string> { "Ultimate", "Premium", "Pro", "Express_All", "Community" } }); } if (data.ShouldSupportVS2017) { vsix.Identifier.SupportedProducts.Add(new VsixIdentifierVisualStudio { Version = "15.0", Edition = new List <string> { "Ultimate", "Premium", "Pro", "Express_All", "Enterprise", "Community" } }); } if (!string.IsNullOrEmpty(data.GettingStartedGuideUrl)) { vsix.Identifier.GettingStartedGuide = Uri.EscapeUriString(data.GettingStartedGuideUrl); } vsix.Identifier.PreviewImage = "__Template_large.png"; vsix.Identifier.Icon = "__Template_small.png"; vsix.Identifier.License = Uri.EscapeUriString(!string.IsNullOrEmpty(data.LicenseFilePath) ? data.LicenseFilePath.GetFileName() : "MIT.txt"); var list = new List <ItemsChoiceType> { ItemsChoiceType.ProjectTemplate, ItemsChoiceType.Assembly }; vsix.Content.ItemsElementName = list.ToArray(); var list2 = new List <object> { TemplatePath }; list2.Add(new VsixAssembly { AssemblyName = typeof(SafeRootProjectWizard.ChildWizard).Assembly.FullName, Value = typeof(SafeRootProjectWizard.ChildWizard).Assembly.Location.GetFileName() }); vsix.Content.Items = list2.ToArray(); return(Serializer.Serialize(vsix)); }
public OptionsManager(OptionsGui gui) { _gui = gui; _gui.CheckBoxStartFromOne.CheckedChanged += CheckBoxStartFromOne_CheckedChanged; }
// Private Methods (2) private static void addAllFiles(string rootDir, string path, VSTemplateTemplateContentProject contentProject, OptionsGui data) { var files = Directory.GetFiles(path); foreach (var filePath in files) { var shouldReplace = ModifyFactory.IsCodeFile(filePath) || ModifyFactory.IsProjectFile(filePath); var projectItem = new ProjectItem { ReplaceParameters = shouldReplace, ReplaceParametersSpecified = shouldReplace, TargetFileName = filePath.GetFileName().replaceNamespace(data), Value = filePath.Replace(rootDir, string.Empty).replaceNamespace(data) }; contentProject.Items.Add(projectItem); } var folders = Directory.GetDirectories(path); foreach (var folder in folders) { if (folder.EndsWith("bin", StringComparison.InvariantCultureIgnoreCase) || folder.EndsWith("obj", StringComparison.InvariantCultureIgnoreCase)) { continue; } addAllFiles(rootDir, folder, contentProject, data); } }
private static string replaceNamespace(this string text, OptionsGui data) { return(text.Replace(data.DefaultNamespace, "$saferootprojectname$")); }