public Patcher(List <string> sources, string outputHdi, PatchContainer patchData, string sysDisk, Form1 form) { _sourceImages = sources.ToArray(); outputHDI = outputHdi; this.patchData = patchData; this.sysDisk = sysDisk; this.form = form; }
public void PatchDetectOutletValueChangeDuringExecution() { ChangeOutlet patch = new ChangeOutlet(); PatchContainer pc = new PatchContainer(patch); Assert.IsFalse(patch.output.HasChanged, "#1"); pc.ExecutePatch(); Assert.IsTrue(patch.output.HasChanged, "#2"); }
private void OnValidate() { if (HeightInputType.Type == null) { HeightInput = null; } else if (HeightInput == null || HeightInput.GetType() != HeightInputType.Type) { HeightInput = Activator.CreateInstance(HeightInputType) as HeightInput; } if (DimensionsInputType.Type == null) { DimensionsInput = null; } else if (DimensionsInput == null || DimensionsInput.GetType() != DimensionsInputType.Type) { DimensionsInput = Activator.CreateInstance(DimensionsInputType) as DimensionsInput; } if (GrassMapInputType.Type == null) { GrassMapInput = null; } else if (GrassMapInput == null || GrassMapInput.GetType() != GrassMapInputType.Type) { GrassMapInput = Activator.CreateInstance(GrassMapInputType) as GrassMapInput; } if (NormalInputType.Type == null) { NormalInput = null; } else if (NormalInput == null || NormalInput.GetType() != NormalInputType.Type) { NormalInput = Activator.CreateInstance(NormalInputType) as NormalInput; } if (PositionInputType.Type == null) { PositionInput = null; } else if (PositionInput == null || PositionInput.GetType() != PositionInputType.Type) { PositionInput = Activator.CreateInstance(PositionInputType) as PositionInput; } if (PatchContainerType.Type == null) { PatchContainer = null; } else if (PatchContainer == null || PatchContainer.GetType() != PatchContainerType.Type) { PatchContainer = Activator.CreateInstance(PatchContainerType) as PatchContainer; } }
public void PatchDetectInletValueChangeBetweenExecutions() { CheckInletChanged patch = new CheckInletChanged(); PatchContainer pc = new PatchContainer(patch); Assert.IsFalse(patch.hasChanged, "#1"); pc.ExecutePatch(); Assert.IsFalse(patch.hasChanged, "#2"); patch.input.Value = 20; pc.ExecutePatch(); Assert.IsTrue(patch.hasChanged, "#3"); pc.ExecutePatch(); Assert.IsFalse(patch.hasChanged, "#4"); }
private void RestoreInitialState() { lSourceSelected.Text = "NOT SELECTED"; lSourcePath.Text = ""; lSysDiskSelected.Text = "NOT SELECTED"; lSysDiskPath.Text = ""; imgLogo.Image = null; tbDescription.Text = "Select patch"; bSelectSource.Enabled = false; bSelectSysDisk.Enabled = false; bApplyPatch.Enabled = false; _sysImage = ""; _patch = null; _patchFile = ""; _sourceFiles = new List <string>(); }
private bool LoadPatch(string file) { _patch = PatchContainer.Load(file); if (_patch != null) { if (!string.IsNullOrEmpty(_patch.Description)) { tbDescription.Text = _patch.Description; } if (_patch.LogoImage != null && _patch.LogoImage.Length > 0) { var ms = new MemoryStream(_patch.LogoImage); var img = new Bitmap(ms); imgLogo.Image = img; } return(true); } return(false); }
public static bool CheckGameSource(PatchContainer patch, string file, Action cb) { var found = false; using (var disk = Disk.OpenDisk(file, FileAccess.Read)) { SparseStream s; if (IsFloppy(file)) { s = disk.Content; } else if (file.ToLower().EndsWith(".hdi")) { s = disk.Partitions[0].Open(); } else { return(false); } using (var fs = new PC98FatFileSystem(s)) { var filelist = new Dictionary <string, string>(); BuildChecksums(filelist, fs, @"\"); foreach (var fdata in patch.PatchData) { if (fdata.Found) { continue; } if (!string.IsNullOrEmpty(FindFile(fdata, filelist))) { fdata.Found = true; cb(); found = true; patch.FoundFiles++; } } } } return(found); }