private void LoadConfiguration(BuildForm bf) { _objConfig = new InstallerConfig(SparkGlobals.BuildConfigPath); _objConfig.Load(); _objConfig.BuildFileList(); if (_objConfig.Options.GetOption(InstallOption.AppGuid) == null) { Globals.Throw("The install option 'AppGuid' is required. Please add this option to the input configuration file."); } //Attempt to parse GUID - if it is invalid an exception will throw. ProgramInfo.TryParseGuidToUninstallGuid(_objConfig.Options.GetOption(InstallOption.AppGuid).Value); if (_objConfig.Options.GetOption(InstallOption.DisplayName) == null) { Globals.Throw("The install option 'DisplayName' is required. Please add this option to the input configuration file."); } Globals.Logger.LogInfo("Excluded " + _objConfig.NumExcludedFiles + " files."); Globals.Logger.LogInfo("Excluded " + _objConfig.NumExcludedDirectories + " directories."); Globals.Logger.LogInfo("Packaging " + _objConfig.GetFiles().Count + " total files."); _objFileTable = new InstallerFileTable(_objConfig); bf.Progress(0.01); }
public byte[] PackFiles(BuildForm bf, double remainingProgress) { byte[] ret = new byte[0]; byte[] tmp; double baseProgress = bf.CurrentProgress(); int iFile = 0; foreach (InstallerFile file in _objConfig.GetFiles()) { if (!System.IO.File.Exists(file.LocalPath)) { Globals.Throw("The file " + file.LocalPath + " does not seem to exist, or there is a lock preventing Spark from reading it. Skip Failures is not set to true. Spark will now exit."); } bf.DetailMessage("Packing: " + file.LocalPath); Globals.Logger.LogInfo("Packing " + file.LocalPath); tmp = System.IO.File.ReadAllBytes(file.LocalPath); ret = BufferUtils.Combine(ret, tmp); iFile++; double progress = baseProgress + ((double)iFile / (double)_objConfig.GetFiles().Count) * (1.0 - baseProgress - remainingProgress); bf.Progress(progress); } return(ret); }
private void BuildPostfixedBinary(BuildForm bf) { byte[] temp; bf.DetailMessage("Building Binary."); temp = InstallerBinary.GetBytes(); _final = BufferUtils.Combine(_final, temp); Globals.Logger.LogInfo("Binary:" + temp.Length.ToString() + "B Total:" + _final.Length.ToString() + "B"); bf.Progress(0.03); }
private void BuildFileTable(BuildForm bf) { byte[] temp; bf.DetailMessage("Building File Table."); temp = _objFileTable.Build(_final.Length); _final = BufferUtils.Combine(_final, temp); Globals.Logger.LogInfo("FileTable:" + temp.Length.ToString() + "B Total:" + _final.Length.ToString() + "B"); bf.Progress(0.12); }
private void BuildConfig(BuildForm bf) { byte[] temp; bf.DetailMessage("Building Config."); temp = _objConfig.Serialize(); _final = BufferUtils.Combine(_final, temp); Globals.Logger.LogInfo("Config:" + temp.Length.ToString() + "B Total:" + _final.Length.ToString() + "B"); bf.Progress(0.05); }
private void BuildFiles(BuildForm bf) { double remainingProgress = 0.02; byte[] temp; bf.DetailMessage("Building Files."); temp = _objFileTable.PackFiles(bf, remainingProgress); _final = BufferUtils.Combine(_final, temp); Globals.Logger.LogInfo("Files:" + temp.Length.ToString() + "B Total:" + _final.Length.ToString() + "B"); bf.Progress(1.0 - remainingProgress); }
private void WriteFile(BuildForm bf) { bf.DetailMessage("Saving " + SparkGlobals.OutputFile + "."); System.IO.File.WriteAllBytes(SparkGlobals.OutputFile, _final); bf.Progress(1.0); }