//Initial Prompt private void InitialPrompt() { CurrentInstallState = InstallState.InitialPrompt; GeneralInfo.InstallerXmlInfo.CurrentInstallStep = -1; InstallStep step = null; if (GeneralInfo.Tracker.GetCurrentMod().Version > GeneralInfo.InstallerXmlInfo.Version) { //Installing an older ver step = InstallStep.InitialPromptReinstall_PrevVer; } else if (GeneralInfo.Tracker.GetCurrentMod().Version < GeneralInfo.InstallerXmlInfo.Version) { //Installing an new ver step = InstallStep.InitialPromptUpdate; } else if (GeneralInfo.Tracker.GetCurrentMod().Version == GeneralInfo.InstallerXmlInfo.Version) { //Installing the same ver step = InstallStep.InitialPromptReinstall; } CurrentInstallStep = step; SetBrushesForCurrentInstallStep(); }
public IEnumerable <InstallStep> GetInstallSteps(int stationId) { var result = new List <InstallStep>(); var parameters = new List <SqlParameter>(); if (stationId > 0) { parameters.Add(new SqlParameter("@StationId", stationId)); } ExecuteDataReader("syncbak.InstallStepGet", parameters, reader => { while (reader.Read()) { var step = new InstallStep(); step.InstallStepId = reader.ReadInt("InstallStepId"); step.StepId = reader.ReadInt("StepId"); step.AccountOwner = reader.ReadString("AccountOwner"); step.StepName = reader.ReadString("StepName"); step.StartDate = reader.ReadDateTime("StartDate"); step.EndDate = reader.ReadDateTime("EndDate"); step.Status = reader.ReadString("Status"); step.Owner = reader.ReadString("Owner"); step.CategoryId = reader.ReadInt("CategoryId"); step.CategoryName = reader.ReadString("CategoryName"); step.StationId = reader.ReadInt("StationId"); step.CallSign = reader.ReadString("CallSign"); step.CurrentStep = reader.ReadBool("CurrentStep"); result.Add(step); } }); return(result); }
/// <summary> /// Unparses the given <see cref="InstallStep"/>. /// </summary> /// <remarks> /// This method can be overidden to provide game-specific or newer-version unparsing. /// </remarks> /// <param name="p_ispStep">The <see cref="InstallStep"/> for which to generate XML.</param> /// <returns>The XML representation of the given <see cref="InstallStep"/>.</returns> protected override XElement UnparseInstallStep(InstallStep p_ispStep) { XElement xelStep = base.UnparseInstallStep(p_ispStep); if (xelStep != null) xelStep.Add(new XAttribute("order", UnparseSortOrder(p_ispStep.GroupSortOrder))); return xelStep; }
protected void HandleInstallStepPropertyChange(XmlScriptTreeNode p_stnNode, InstallStep p_ispStep, string p_strPropertyName) { if (p_strPropertyName.Equals(ObjectHelper.GetPropertyName <InstallStep>(x => x.OptionGroups))) { SelectedNode = p_stnNode; AddOptionGroups((XmlScriptTreeNode <InstallStep>)p_stnNode); } }
/// <summary> /// Gets the editor to use to edit an <see cref="InstallStep"/>. /// </summary> /// <param name="p_ispStep">The <see cref="InstallStep"/> to edit.</param> /// <param name="p_lstModFiles">The list of files in the mod to which the <see cref="XmlScript"/> /// being edited belongs.</param> /// <returns>The editor to use to edit an <see cref="InstallStep"/>. <c>null</c> is returned if the /// current <see cref="XmlScript"/> does not support editing <see cref="InstallStep"/>s.</returns> public override NodeEditor GetInstallStepEditor(InstallStep p_ispStep, IList<VirtualFileSystemItem> p_lstModFiles) { SkyrimCplConverter cvtConverter = new SkyrimCplConverter(ScriptType.GetCplParserFactory()); ConditionEditorVM vmlConditionEditor = CreateConditionEditorVM(p_lstModFiles, cvtConverter); InstallStepEditorVM vmlStepEditor = new InstallStepEditorVM(vmlConditionEditor, p_ispStep, InstallStepProperties.Name | InstallStepProperties.GroupSortOrder | InstallStepProperties.Visibility); return new InstallStepEditor(vmlStepEditor); }
/// <summary> /// Unparses the given <see cref="InstallStep"/>. /// </summary> /// <remarks> /// This method can be overidden to provide game-specific or newer-version unparsing. /// </remarks> /// <param name="p_ispStep">The <see cref="InstallStep"/> for which to generate XML.</param> /// <returns>The XML representation of the given <see cref="InstallStep"/>.</returns> protected override XElement UnparseInstallStep(InstallStep p_ispStep) { XElement xelStep = new XElement("installStep", new XAttribute("name", p_ispStep.Name)); if (p_ispStep.VisibilityCondition != null) xelStep.Add(UnparseCondition(p_ispStep.VisibilityCondition, "visible")); xelStep.Add(base.UnparseInstallStep(p_ispStep)); return xelStep; }
/// <summary> /// Gets the editor to use to edit an <see cref="InstallStep"/>. /// </summary> /// <param name="p_ispStep">The <see cref="InstallStep"/> to edit.</param> /// <param name="p_lstModFiles">The list of files in the mod to which the <see cref="XmlScript"/> /// being edited belongs.</param> /// <returns>The editor to use to edit an <see cref="InstallStep"/>. <c>null</c> is returned if the /// current <see cref="XmlScript"/> does not support editing <see cref="InstallStep"/>s.</returns> public virtual NodeEditor GetInstallStepEditor(InstallStep p_ispStep, IList <VirtualFileSystemItem> p_lstModFiles) { CPLConverter cvtConverter = new CPLConverter(ScriptType.GetCplParserFactory()); ConditionEditorVM vmlConditionEditor = CreateConditionEditorVM(p_lstModFiles, cvtConverter); InstallStepEditorVM vmlStepEditor = new InstallStepEditorVM(vmlConditionEditor, p_ispStep, InstallStepProperties.Name | InstallStepProperties.GroupSortOrder | InstallStepProperties.Visibility); return(new InstallStepEditor(vmlStepEditor)); }
/// <summary> /// Creates an install step based on the given info. /// </summary> /// <param name="p_xndStep">The configuration file node corresponding to the install step to add.</param> /// <returns>The added install step.</returns> protected InstallStep parseInstallStep(XmlNode p_xndStep) { var strName = p_xndStep.Attributes["name"].InnerText; var cmpVisibility = loadDependency(p_xndStep.SelectSingleNode("visible")); var lstGroups = loadGroupedPlugins(p_xndStep.SelectSingleNode("optionalFileGroups")); var stpStep = new InstallStep(strName, cmpVisibility, lstGroups); return(stpStep); }
/// <summary> /// Unparses the given <see cref="InstallStep"/>. /// </summary> /// <remarks> /// This method can be overidden to provide game-specific or newer-version unparsing. /// </remarks> /// <param name="p_ispStep">The <see cref="InstallStep"/> for which to generate XML.</param> /// <returns>The XML representation of the given <see cref="InstallStep"/>.</returns> protected override XElement UnparseInstallStep(InstallStep p_ispStep) { XElement xelStep = base.UnparseInstallStep(p_ispStep); if (xelStep != null) { xelStep.Add(new XAttribute("order", UnparseSortOrder(p_ispStep.GroupSortOrder))); } return(xelStep); }
/// <summary> /// Deletes the given <see cref="InstallStep"/> from the script. /// </summary> /// <param name="p_ispStep">The <see cref="InstallStep"/> to delete.</param> /// <exception cref="Exception">Thrown if the given <see cref="InstallStep"/> is the only one /// in the XML script.</exception> protected void DeleteInstallStep(InstallStep p_ispStep) { if (p_ispStep == null) { return; } if (Script.InstallSteps.Count == 1) { throw new Exception("Cannot delete last Install Step."); } Script.InstallSteps.Remove(p_ispStep); }
private static void AddStep(Project p) { if (p.ModuleConfiguration.InstallSteps == null) { p.ModuleConfiguration.InstallSteps = StepList.Create(); } if (p.ModuleConfiguration.InstallSteps.InstallStep == null) { p.ModuleConfiguration.InstallSteps.InstallStep = new ObservableCollection <InstallStep>(); } p.ModuleConfiguration.InstallSteps.InstallStep.Add(InstallStep.Create()); }
/// <summary> /// Unparses the given <see cref="InstallStep"/>. /// </summary> /// <remarks> /// This method can be overidden to provide game-specific or newer-version unparsing. /// </remarks> /// <param name="p_ispStep">The <see cref="InstallStep"/> for which to generate XML.</param> /// <returns>The XML representation of the given <see cref="InstallStep"/>.</returns> protected override XElement UnparseInstallStep(InstallStep p_ispStep) { XElement xelStep = new XElement("installStep", new XAttribute("name", p_ispStep.Name)); if (p_ispStep.VisibilityCondition != null) { xelStep.Add(UnparseCondition(p_ispStep.VisibilityCondition, "visible")); } xelStep.Add(base.UnparseInstallStep(p_ispStep)); return(xelStep); }
/// <summary> /// Parses <see cref="XmlScript.InstallSteps"/>. /// </summary> /// <returns>The <see cref="Script"/>'s <see cref="XmlScript.InstallSteps"/>, based on the XML, /// or <c>null</c> if the script doesn't describe any <see cref="XmlScript.InstallSteps"/>.</returns> protected override List<InstallStep> GetInstallSteps() { InstallStep stpStep = new InstallStep(null, null, SortOrder.Explicit); XElement xelGroups = Script.Element("optionalFileGroups"); if (xelGroups != null) foreach (XElement xelGroup in xelGroups.Elements()) stpStep.OptionGroups.Add(ParseGroup(xelGroup)); List<InstallStep> lstStep = new List<InstallStep>(); lstStep.Add(stpStep); return lstStep; }
private static void AddGroup(InstallStep p) { if (p.OptionalFileGroups == null) { p.OptionalFileGroups = GroupList.Create(); } if (p.OptionalFileGroups.Group == null) { p.OptionalFileGroups.Group = new ObservableCollection <Group>(); } p.OptionalFileGroups.Group.Add(Group.Create()); }
/// <summary> /// Creates an install step based on the given info. /// </summary> /// <param name="p_xelStep">The configuration file node corresponding to the install step to add.</param> /// <returns>The added install step.</returns> protected virtual InstallStep ParseInstallStep(XElement p_xelStep) { string strName = p_xelStep.Attribute("name").Value; ICondition cndVisibility = LoadCondition(p_xelStep.Element("visible")); XElement xelGroups = p_xelStep.Element("optionalFileGroups"); SortOrder sodGroupOrder = ParseSortOrder(xelGroups.Attribute("order").Value); InstallStep stpStep = new InstallStep(strName, cndVisibility, sodGroupOrder); foreach (XElement xelGroup in xelGroups.Elements()) stpStep.OptionGroups.Add(ParseGroup(xelGroup)); return stpStep; }
public InstallStepEditorVM(ConditionEditorVM p_vmlConditionEditor, InstallStep p_stpStep, InstallStepProperties p_ispEditableProperties) { NameVisible = (p_ispEditableProperties & InstallStepProperties.Name) > 0; GroupSortOrderVisible = (p_ispEditableProperties & InstallStepProperties.GroupSortOrder) > 0; VisibilityVisible = (p_ispEditableProperties & InstallStepProperties.Visibility) > 0; ConditionEditorVM = p_vmlConditionEditor; InstallStep = p_stpStep; SortOrders = Enum.GetValues(typeof(SortOrder)); Errors = new ErrorContainer(); ConditionEditorVM.ConditionSaved += new EventHandler(ConditionSaved); }
/// <summary> /// Parses <see cref="XmlScript.InstallSteps"/>. /// </summary> /// <returns>The <see cref="Script"/>'s <see cref="XmlScript.InstallSteps"/>, based on the XML, /// or <c>null</c> if the script doesn't describe any <see cref="XmlScript.InstallSteps"/>.</returns> protected override List<InstallStep> GetInstallSteps() { XElement xelGroups = Script.Element("optionalFileGroups"); SortOrder sodGroupOrder = ParseSortOrder(xelGroups.Attribute("order").Value); InstallStep stpStep = new InstallStep(null, null, sodGroupOrder); if (xelGroups != null) foreach (XElement xelGroup in xelGroups.Elements()) stpStep.OptionGroups.Add(ParseGroup(xelGroup)); List<InstallStep> lstStep = new List<InstallStep>(); lstStep.Add(stpStep); return lstStep; }
private void AddInstallSteps(XmlScriptTreeNode <XmlScript> p_tndScript) { p_tndScript.Nodes.Clear(); XmlScriptTreeNode <InstallStep> tndStep = null; Int32 intMaxStepIndex = (Script.Version > new Version(3, 0, 0, 0)) ? p_tndScript.Object.InstallSteps.Count : 1; InstallStep ispStep = null; for (Int32 i = 0; i < intMaxStepIndex; i++) { ispStep = p_tndScript.Object.InstallSteps[i]; tndStep = p_tndScript.AddNode(ispStep, NodeAdapter.GetInstallStepEditor, FormatInstallStep, HandleInstallStepPropertyChange); AddOptionGroups(tndStep); } }
/// <summary> /// Unparses the given <see cref="InstallStep"/>. /// </summary> /// <remarks> /// This method can be overidden to provide game-specific or newer-version unparsing. /// </remarks> /// <param name="p_ispStep">The <see cref="InstallStep"/> for which to generate XML.</param> /// <returns>The XML representation of the given <see cref="InstallStep"/>.</returns> protected virtual XElement UnparseInstallStep(InstallStep p_ispStep) { XElement xelStep = null; if (p_ispStep.OptionGroups.Count > 0) { xelStep = new XElement("optionalFileGroups"); foreach (OptionGroup ogpGroup in p_ispStep.OptionGroups) { xelStep.Add(UnparseOptionGroup(ogpGroup)); } } return(xelStep); }
/// <summary> /// Creates an install step based on the given info. /// </summary> /// <param name="p_xelStep">The configuration file node corresponding to the install step to add.</param> /// <returns>The added install step.</returns> protected virtual InstallStep ParseInstallStep(XElement p_xelStep) { string strName = p_xelStep.Attribute("name").Value; ICondition cndVisibility = LoadCondition(p_xelStep.Element("visible")); XElement xelGroups = p_xelStep.Element("optionalFileGroups"); SortOrder sodGroupOrder = ParseSortOrder(xelGroups.Attribute("order").Value); InstallStep stpStep = new InstallStep(strName, cndVisibility, sodGroupOrder); foreach (XElement xelGroup in xelGroups.Elements()) { stpStep.OptionGroups.Add(ParseGroup(xelGroup)); } return(stpStep); }
/// <summary> /// Parses <see cref="XmlScript.InstallSteps"/>. /// </summary> /// <returns>The <see cref="Script"/>'s <see cref="XmlScript.InstallSteps"/>, based on the XML, /// or <c>null</c> if the script doesn't describe any <see cref="XmlScript.InstallSteps"/>.</returns> protected override List <InstallStep> GetInstallSteps() { InstallStep stpStep = new InstallStep(null, null, SortOrder.Explicit); XElement xelGroups = Script.Element("optionalFileGroups"); if (xelGroups != null) { foreach (XElement xelGroup in xelGroups.Elements()) { stpStep.OptionGroups.Add(ParseGroup(xelGroup)); } } List <InstallStep> lstStep = new List <InstallStep>(); lstStep.Add(stpStep); return(lstStep); }
/// <summary> /// Parses <see cref="XmlScript.InstallSteps"/>. /// </summary> /// <returns>The <see cref="Script"/>'s <see cref="XmlScript.InstallSteps"/>, based on the XML, /// or <c>null</c> if the script doesn't describe any <see cref="XmlScript.InstallSteps"/>.</returns> protected override List <InstallStep> GetInstallSteps() { XElement xelGroups = Script.Element("optionalFileGroups"); SortOrder sodGroupOrder = ParseSortOrder(xelGroups.Attribute("order").Value); InstallStep stpStep = new InstallStep(null, null, sodGroupOrder); if (xelGroups != null) { foreach (XElement xelGroup in xelGroups.Elements()) { stpStep.OptionGroups.Add(ParseGroup(xelGroup)); } } List <InstallStep> lstStep = new List <InstallStep>(); lstStep.Add(stpStep); return(lstStep); }
public BuildPipelineExecuter(ExecutionContext executionContext) { _executionContext = executionContext; _environmentStep = new InitStandardEnvironmentVariablesStep(); _initStep = new InitStep(executionContext.RepositoryDirectory, executionContext.BuildConfiguration.InitializationScript); _cloneStep = new CloneFolderStep(executionContext.FileSystem); _installStep = new InstallStep(executionContext.CloneDirectory, executionContext.BuildConfiguration.InstallScript); _assemblyInfoStep = new AssemblyInfoRewriteStep(); _beforeBuildStep = new BeforeBuildStep(executionContext.CloneDirectory, executionContext.BuildConfiguration.BeforeBuildScript); _buildScriptStep = new BuildScriptStep(executionContext.CloneDirectory, executionContext.BuildConfiguration.BuildScript); _buildStep = new BuildStep(); _afterBuildStep = new AfterBuildStep(executionContext.CloneDirectory, executionContext.BuildConfiguration.AfterBuildScript); _testScriptStep = new TestScriptStep(executionContext.CloneDirectory, executionContext.BuildConfiguration.TestScript); _onSuccessStep = new OnSuccessStep(executionContext.CloneDirectory, executionContext.BuildConfiguration.OnSuccessScript); _onFailureStep = new OnFailureStep(executionContext.CloneDirectory, executionContext.BuildConfiguration.OnFailureScript); _onFinishStep = new OnFinishStep(executionContext.CloneDirectory, executionContext.BuildConfiguration.OnFinishScript); }
public XmlScript Commit(string p_strPropertyName) { if (p_strPropertyName.Equals(ObjectHelper.GetPropertyName(() => this.InstallStepSortOrder))) { Script.InstallStepSortOrder = InstallStepSortOrder; } else if (p_strPropertyName.Equals(ObjectHelper.GetPropertyName(() => this.InstallSteps))) { if (InstallStepSortOrder == SortOrder.Explicit) { Script.InstallSteps.Clear(); for (Int32 i = 0; i < InstallSteps.Count; i++) { InstallStep stpStep = InstallSteps[i]; Script.InstallSteps.Add(stpStep); } } } return(Script); }
public InstallStep GetStepInfo(int stationId) { var result = new InstallStep(); var parameters = new List <SqlParameter>(); if (stationId > 0) { parameters.Add(new SqlParameter("@StationId", stationId)); } ExecuteDataReader("syncbak.InstallStepInfoGet", parameters, reader => { if (reader.Read()) { result.InstallStepId = reader.ReadInt("InstallStepId"); result.AccountOwner = reader.ReadString("AccountOwner"); result.StationId = reader.ReadInt("StationId"); result.IsComplete = reader.ReadBool("IsComplete"); } }); return(result); }
/// <summary> /// Adds a new <see cref="OptionGroup"/> to the script. /// </summary> /// <param name="p_ispParent">The step to which to add the <see cref="OptionGroup"/>.</param> protected void AddOptionGroup(InstallStep p_ispParent) { if (p_ispParent == null) { return; } string strGroupName = null; for (Int32 i = 1; i < Int32.MaxValue; i++) { strGroupName = String.Format("New Option Group {0}", i); if (!p_ispParent.OptionGroups.Contains(x => strGroupName.Equals(x.Name))) { break; } strGroupName = null; } if (strGroupName == null) { throw new Exception("Unable to new new Option Group: too many groups exist."); } p_ispParent.OptionGroups.Add(new OptionGroup(strGroupName, OptionGroupType.SelectAny, SortOrder.Ascending)); }
/// <summary> /// Process a download and install queue. /// </summary> /// <param name="steps">Which steps to perform.</param> /// <param name="queue">The queue to process</param> /// <param name="cancellation">Cancellation token</param> public async Task <Installation> Process(InstallStep steps, Queue queue, bool skipChecks = false, CancellationToken cancellation = default) { if (queue == null) { throw new ArgumentNullException(nameof(queue)); } if ((steps & InstallStep.DownloadAndInstall) == InstallStep.None) { throw new ArgumentException("Install steps cannot be None", nameof(steps)); } var download = (steps & InstallStep.Download) > 0; var install = (steps & InstallStep.Install) > 0; Logger.LogDebug($"download = {download}, install = {install}"); foreach (var item in queue.items) { var size = skipChecks ? -1 : item.package.size; var hash = skipChecks ? null : item.package.md5; if (!download) { if (!File.Exists(item.filePath)) { throw new InvalidOperationException($"File for package {item.package.name} not found at path: {item.filePath}"); } if (hash == null) { Logger.LogWarning($"File exists but cannot be checked for completeness: {item.filePath}"); item.currentState = QueueItem.State.WaitingForInstall; } else { item.downloader = new Downloader(); item.downloader.Prepare(null, item.filePath, size, hash); item.currentState = QueueItem.State.WaitingForDownload; } } else { // Some packages (Vistual Studio, Mono) have wrong size and no hash if (hash == null && File.Exists(item.filePath)) { Logger.LogWarning($"File exists but cannot be checked for completeness: {item.filePath}"); item.currentState = install ? QueueItem.State.WaitingForInstall : QueueItem.State.Complete; } else { item.downloader = new Downloader(); item.downloader.Resume = Configuration.resumeDownloads; item.downloader.Timeout = Configuration.requestTimeout; item.downloader.Prepare(item.downloadUrl, item.filePath, size, hash); } } } if (install) { string installationPaths = null; if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) { installationPaths = Configuration.installPathMac; } else { throw new NotImplementedException("Installer does not currently support the platform: " + RuntimeInformation.OSDescription); } await Platform.PrepareInstall(queue, installationPaths, cancellation); } try { var editorItem = queue.items.FirstOrDefault(i => i.package.name == PackageMetadata.EDITOR_PACKAGE_NAME); while (!cancellation.IsCancellationRequested) { // Check completed and count active int downloading = 0, installing = 0, complete = 0; foreach (var item in queue.items) { if (item.currentState == QueueItem.State.Hashing || item.currentState == QueueItem.State.Downloading) { if (item.downloadTask.IsCompleted) { if (item.downloadTask.IsFaulted) { if (!download || item.retries <= 0) { throw item.downloadTask.Exception; } else { item.retries--; Logger.LogError(item.downloadTask.Exception.InnerException.Message + $" (retrying in {Configuration.retryDelay}s, {item.retries} retries remaining)"); item.waitUntil = DateTime.UtcNow + TimeSpan.FromSeconds(Configuration.retryDelay); item.downloader.Reset(); item.currentState = QueueItem.State.WaitingForDownload; } } else { item.currentState = install ? QueueItem.State.WaitingForInstall : QueueItem.State.Complete; Logger.LogDebug($"{item.package.name} download complete: now {item.currentState}"); } } else { if (item.currentState == QueueItem.State.Hashing && item.downloader.CurrentState == Downloader.State.Downloading) { item.currentState = QueueItem.State.Downloading; Logger.LogDebug($"{item.package.name} hashed: now {item.currentState}"); } downloading++; } } else if (item.currentState == QueueItem.State.Installing) { if (item.installTask.IsCompleted) { if (item.installTask.IsFaulted) { throw item.installTask.Exception; } item.currentState = QueueItem.State.Complete; Logger.LogDebug($"{item.package.name}: install complete"); } else { installing++; } } if (item.currentState == QueueItem.State.Complete) { complete++; } } if (complete == queue.items.Count) { Logger.LogDebug($"All packages processed"); break; } // Start new items foreach (var item in queue.items) { if (downloading < Configuration.maxConcurrentDownloads && item.currentState == QueueItem.State.WaitingForDownload) { if (item.waitUntil > DateTime.UtcNow) { continue; } Logger.LogDebug($"{item.package.name}: Starting download"); if (download) { item.downloadTask = item.downloader.Start(cancellation); } else { item.downloadTask = item.downloader.AssertExistingFileHash(cancellation); } item.currentState = QueueItem.State.Hashing; downloading++; } else if (installing < Configuration.maxConcurrentInstalls && item.currentState == QueueItem.State.WaitingForInstall) { if (editorItem != null && item != editorItem && editorItem.currentState != QueueItem.State.Complete) { // Wait for the editor to complete installation continue; } Logger.LogDebug($"{item.package.name}: Starting install"); item.installTask = Platform.Install(queue, item, cancellation); item.currentState = QueueItem.State.Installing; installing++; } } await Task.Delay(100); } } catch { if (install) { Logger.LogInformation("Cleaning up aborted installation"); await Platform.CompleteInstall(true, cancellation); } throw; } if (install) { return(await Platform.CompleteInstall(false, cancellation)); } else { return(null); } }
/// <summary> /// Gets the editor to use to edit an <see cref="InstallStep"/>. /// </summary> /// <param name="p_ispStep">The <see cref="InstallStep"/> to edit.</param> /// <param name="p_lstModFiles">The list of files in the mod to which the <see cref="XmlScript"/> /// being edited belongs.</param> /// <returns>The editor to use to edit an <see cref="InstallStep"/>. <c>null</c> is returned if the /// current <see cref="XmlScript"/> does not support editing <see cref="InstallStep"/>s.</returns> public virtual NodeEditor GetInstallStepEditor(InstallStep p_ispStep, IList <VirtualFileSystemItem> p_lstModFiles) { return(null); }
protected void FormatInstallStep(XmlScriptTreeNode p_stnNode, InstallStep p_ispStep) { p_stnNode.Text = String.Format("Install Step: {0}", p_ispStep.Name); }
/// <summary> /// Adds a new <see cref="OptionGroup"/> to the script. /// </summary> /// <param name="p_ispParent">The step to which to add the <see cref="OptionGroup"/>.</param> protected void AddOptionGroup(InstallStep p_ispParent) { if (p_ispParent == null) return; string strGroupName = null; for (Int32 i = 1; i < Int32.MaxValue; i++) { strGroupName = String.Format("New Option Group {0}", i); if (!p_ispParent.OptionGroups.Contains(x => strGroupName.Equals(x.Name))) break; strGroupName = null; } if (strGroupName == null) throw new Exception("Unable to new new Option Group: too many groups exist."); p_ispParent.OptionGroups.Add(new OptionGroup(strGroupName, OptionGroupType.SelectAny, SortOrder.Ascending)); }
protected void HandleInstallStepPropertyChange(XmlScriptTreeNode p_stnNode, InstallStep p_ispStep, string p_strPropertyName) { if (p_strPropertyName.Equals(ObjectHelper.GetPropertyName<InstallStep>(x => x.OptionGroups))) { SelectedNode = p_stnNode; AddOptionGroups((XmlScriptTreeNode<InstallStep>)p_stnNode); } }
public InstallStepVM(InstallStep p_stpStep) { InstallStep = p_stpStep; Reset(); }
/// <summary> /// Gets the editor to use to edit an <see cref="InstallStep"/>. /// </summary> /// <param name="p_ispStep">The <see cref="InstallStep"/> to edit.</param> /// <param name="p_lstModFiles">The list of files in the mod to which the <see cref="XmlScript"/> /// being edited belongs.</param> /// <returns>The editor to use to edit an <see cref="InstallStep"/>. <c>null</c> is returned if the /// current <see cref="XmlScript"/> does not support editing <see cref="InstallStep"/>s.</returns> public virtual NodeEditor GetInstallStepEditor(InstallStep p_ispStep, IList<VirtualFileSystemItem> p_lstModFiles) { return null; }
/// <summary> /// Creates an install step based on the given info. /// </summary> /// <param name="p_xndStep">The configuration file node corresponding to the install step to add.</param> /// <returns>The added install step.</returns> protected InstallStep parseInstallStep(XmlNode p_xndStep) { var strName = p_xndStep.Attributes["name"].InnerText; var cmpVisibility = loadDependency(p_xndStep.SelectSingleNode("visible")); var lstGroups = loadGroupedPlugins(p_xndStep.SelectSingleNode("optionalFileGroups")); var stpStep = new InstallStep(strName, cmpVisibility, lstGroups); return stpStep; }
/// <summary> /// Gets the editor to use to edit an <see cref="InstallStep"/>. /// </summary> /// <param name="p_ispStep">The <see cref="InstallStep"/> to edit.</param> /// <param name="p_lstModFiles">The list of files in the mod to which the <see cref="XmlScript"/> /// being edited belongs.</param> /// <returns>The editor to use to edit an <see cref="InstallStep"/>. <c>null</c> is returned if the /// current <see cref="XmlScript"/> does not support editing <see cref="InstallStep"/>s.</returns> public override NodeEditor GetInstallStepEditor(InstallStep p_ispStep, IList <VirtualFileSystemItem> p_lstModFiles) { InstallStepEditorVM vmlStepEditor = new InstallStepEditorVM(null, p_ispStep, InstallStepProperties.GroupSortOrder); return(new InstallStepEditor(vmlStepEditor)); }
/// <summary> /// Gets the editor to use to edit an <see cref="InstallStep"/>. /// </summary> /// <param name="p_ispStep">The <see cref="InstallStep"/> to edit.</param> /// <param name="p_lstModFiles">The list of files in the mod to which the <see cref="XmlScript"/> /// being edited belongs.</param> /// <returns>The editor to use to edit an <see cref="InstallStep"/>. <c>null</c> is returned if the /// current <see cref="XmlScript"/> does not support editing <see cref="InstallStep"/>s.</returns> public override NodeEditor GetInstallStepEditor(InstallStep p_ispStep, IList<VirtualFileSystemItem> p_lstModFiles) { InstallStepEditorVM vmlStepEditor = new InstallStepEditorVM(null, p_ispStep, InstallStepProperties.GroupSortOrder); return new InstallStepEditor(vmlStepEditor); }
public override StepResult DoIt(InstallStep step) { return(step.Install()); }
/// <summary> /// Unparses the given <see cref="InstallStep"/>. /// </summary> /// <remarks> /// This method can be overidden to provide game-specific or newer-version unparsing. /// </remarks> /// <param name="p_ispStep">The <see cref="InstallStep"/> for which to generate XML.</param> /// <returns>The XML representation of the given <see cref="InstallStep"/>.</returns> protected virtual XElement UnparseInstallStep(InstallStep p_ispStep) { XElement xelStep = null; if (p_ispStep.OptionGroups.Count > 0) { xelStep = new XElement("optionalFileGroups"); foreach (OptionGroup ogpGroup in p_ispStep.OptionGroups) xelStep.Add(UnparseOptionGroup(ogpGroup)); } return xelStep; }
/// <summary> /// Determines if the given <see cref="InstallStep"/> can be deleted from /// the XML Script. /// </summary> /// <param name="p_ispStep">The <see cref="InstallStep"/> to delete.</param> /// <returns><c>true</c> if the given <see cref="InstallStep"/> can be deleted; /// <c>false</c> otherwise.</returns> public bool CanDelete(InstallStep p_ispStep) { return (Script.InstallSteps.Count > 1); }
private void Done() { string savePath = GetSavePath(); if (string.IsNullOrWhiteSpace(savePath)) { return; } //Change acbFile saveFormat if needed (undoable action) if (acbFile.SaveFormat != SaveFormat.MusicPackage) { UndoManager.Instance.AddUndo(new UndoableProperty <ACB_File>(nameof(acbFile.SaveFormat), acbFile, acbFile.SaveFormat, SaveFormat.MusicPackage, "Save Format")); acbFile.SaveFormat = SaveFormat.MusicPackage; } if ((int)acbFile.MusicPackageType != (MusicPackageType)) { acbFile.MusicPackageType = (MusicPackageType)MusicPackageType; } //Create MusicPackage byte[] musicPackageBytes = acbFile.SaveMusicPackageToBytes(); string musicPackagePath = $"CAR_BGM{ACB_File.MUSIC_PACKAGE_EXTENSION}"; //Create InstallerXml InstallerXml installerXml = new InstallerXml(); installerXml.Name = ModName; installerXml.Author = ModAuthor; installerXml.VersionString = ModVersion; installerXml.InstallOptionSteps = new List <InstallStep>(); installerXml.InstallFiles = new List <FilePath>(); if (!string.IsNullOrWhiteSpace(ModDescription)) { InstallStep installStep = new InstallStep(); installStep.Name = "Info"; installStep.Message = ModDescription; installStep.StepType = InstallStep.StepTypes.Message; installerXml.InstallOptionSteps.Add(installStep); } FilePath file = new FilePath(); file.SourcePath = musicPackagePath; installerXml.InstallFiles.Add(file); YAXSerializer serializer = new YAXSerializer(typeof(InstallerXml)); string strXml = serializer.Serialize(installerXml); byte[] xmlBytes = Encoding.UTF8.GetBytes(strXml); //Create installinfo zip using (var stream = File.Create(savePath)) { using (var zip = new ZipArchive(stream, ZipArchiveMode.Create)) { ZipWriter zipWriter = new ZipWriter(zip); zipWriter.AddFile("InstallerXml.xml", xmlBytes, CompressionLevel.Optimal, true); zipWriter.AddFile("data/" + musicPackagePath, musicPackageBytes, CompressionLevel.Optimal, true); } } Success = true; InstallInfoPath = savePath; Close(); }
/// <summary> /// Deletes the given <see cref="InstallStep"/> from the script. /// </summary> /// <param name="p_ispStep">The <see cref="InstallStep"/> to delete.</param> /// <exception cref="Exception">Thrown if the given <see cref="InstallStep"/> is the only one /// in the XML script.</exception> protected void DeleteInstallStep(InstallStep p_ispStep) { if (p_ispStep == null) return; if (Script.InstallSteps.Count == 1) throw new Exception("Cannot delete last Install Step."); Script.InstallSteps.Remove(p_ispStep); }
/// <summary> /// Determines if the given <see cref="InstallStep"/> can be deleted from /// the XML Script. /// </summary> /// <param name="p_ispStep">The <see cref="InstallStep"/> to delete.</param> /// <returns><c>true</c> if the given <see cref="InstallStep"/> can be deleted; /// <c>false</c> otherwise.</returns> public bool CanDelete(InstallStep p_ispStep) { return(Script.InstallSteps.Count > 1); }
public abstract StepResult DoIt(InstallStep step);