public LanguagePackWriter(XPathNavigator manifestNav, InstallerInfo installer) { _Language = new Locale(); XPathNavigator cultureNav = manifestNav.SelectSingleNode("Culture"); _Language.Text = Util.ReadAttribute(cultureNav, "DisplayName"); _Language.Code = Util.ReadAttribute(cultureNav, "Code"); _Language.Fallback = Localization.Localization.SystemLocale; //Create a Package Package = new PackageInfo(installer); Package.Name = Language.Text; Package.FriendlyName = Language.Text; Package.Description = Null.NullString; Package.Version = new Version(1, 0, 0); Package.License = Util.PACKAGE_NoLicense; ReadLegacyManifest(manifestNav); if (_IsCore) { Package.PackageType = "CoreLanguagePack"; } else { Package.PackageType = "ExtensionLanguagePack"; } BasePath = Null.NullString; }
public PluginExecuteResult Execute() { EventProcessing(this, new PluginEventArgs(string.Format("Checking for {0}...", this))); bool newVersion = false; InstallerInfo installerInfo = http.LastModified(siteInfo.InstallerUrl); if (installerInfo.CreationTime.Date > latest.CreationTime.Date) { newVersion = true; } else if (installerInfo.Length != latest.Length) { newVersion = true; } if (newVersion) { EventUpdate(this, new PluginEventArgs("New version found!")); NewLatestVersion(installerInfo); latest = installerInfo; string path = PluginSaveHelper.BuildSavePath(info, latest.CreationTime, ".zip"); if (!File.Exists(path)) { down.FileAsync(siteInfo.InstallerUrl); } else { EventProcessing(this, new PluginEventArgs("File already exists already")); BuildVersion(path); } } return(PluginExecuteResult.Failed); }
private void NewLatestVersion(InstallerInfo installerInfo) { settings[info.Name]["Version"] = installerInfo.Version; settings[info.Name]["Time"] = installerInfo.CreationTime.Ticks.ToString(); settings[info.Name]["Length"] = installerInfo.Length.ToString(); settings.Save(Default.Name); }
public PluginExecuteResult Load() { http = new HttpClient(); down = new Downloader(); down.ResponseHandler += SetResponseInfo; down.ProgressHandler += Progress; down.DoneHandler += Done; settings = IniFile.FromFile(Default.Name); latest = new InstallerInfo(); latest.Version = settings[info.Name]["Version"] ?? "-"; long ticks; if (long.TryParse(settings[info.Name]["Time"], out ticks)) { latest.CreationTime = new DateTime(ticks); } long length; if (long.TryParse(settings[info.Name]["Length"], out length)) { latest.Length = length; } if (latest.CreationTime != DateTime.MinValue || latest.Length != 0) { EventStart(this, new PluginEventArgs(string.Format("Version: {0} (Date: {1}, Length: {2})", latest.Version, latest.CreationTime, latest.Length))); } return(PluginExecuteResult.Successfull); }
//State Init private void StateInit() { if (GeneralInfo.IsGameDirValid()) { GeneralInfo.LoadTracker(); isInstalled = !GeneralInfo.Tracker.Mod.newMod; GeneralInfo.isInstalled = isInstalled; } if (isInstalled) { //Set installstep for this InitialPrompt(); } else { if (InstallerInfo.HasInstallSteps()) { CurrentInstallState = InstallState.InstallSteps; InstallStepNext(); } else { InstallPrompt(); } } }
private void LoadInstallInfoZip() { try { //Look for .installinfo file string path = System.IO.Path.GetFullPath(String.Format("{0}.installinfo", System.Diagnostics.Process.GetCurrentProcess().ProcessName)); if (!File.Exists(path)) { MessageBox.Show(String.Format("The file \"{0}\" could not be found!\nThis file should be in the same directory as the executable.\n\nThe installer will now close.", System.IO.Path.GetFileName(path)), "Initialization", MessageBoxButton.OK, MessageBoxImage.Error); Environment.Exit(0); } //Load .installinfo zipManager = new ZipReader(ZipFile.Open(path, ZipArchiveMode.Read)); //Load installerXml from .installinfo if (!zipManager.Exists(GeneralInfo.InstallerXml)) { MessageBox.Show(string.Format("Could not find \"{0}\" in \"{1}\". This file must be at the root level in the archive.\n\nThe installer will now close.", GeneralInfo.InstallerXml, System.IO.Path.GetFileName(path)), "Initialization", MessageBoxButton.OK, MessageBoxImage.Error); Environment.Exit(0); } InstallerInfo = zipManager.DeserializeXmlFromArchive <InstallerXml>(GeneralInfo.InstallerXml); InstallerInfo.Init(); GeneralInfo.InstallerXmlInfo = InstallerInfo; } catch (Exception ex) { MessageBox.Show(ex.Message, "InstallInfo open failed.", MessageBoxButton.OK, MessageBoxImage.Error); Environment.Exit(0); } }
public PackageInstaller(string packageManifest, InstallerInfo info) { Package = new PackageInfo(info); Package.Manifest = packageManifest; if (!string.IsNullOrEmpty(packageManifest)) { XPathDocument doc = new XPathDocument(new StringReader(packageManifest)); XPathNavigator nav = doc.CreateNavigator().SelectSingleNode("package"); ReadManifest(nav); } }
public SkinControlPackageWriter(XPathNavigator manifestNav, InstallerInfo installer) { _SkinControl = new SkinControlInfo(); Package = new PackageInfo(installer); ReadLegacyManifest(manifestNav, true); Package.Description = Null.NullString; Package.Version = new Version(1, 0, 0); Package.PackageType = "SkinObject"; Package.License = Util.PACKAGE_NoLicense; BasePath = Path.Combine("DesktopModules", Package.Name.ToLower()).Replace("/", "\\"); AppCodePath = Path.Combine("App_Code", Package.Name.ToLower()).Replace("/", "\\"); }
/// ----------------------------------------------------------------------------- /// <summary> /// This Constructor creates a new PackageInstaller instance /// </summary> /// <param name="info">An InstallerInfo instance</param> /// <param name="packageManifest">The manifest as a string</param> /// <history> /// [cnurse] 01/16/2008 created /// </history> /// ----------------------------------------------------------------------------- public PackageInstaller(string packageManifest, InstallerInfo info) { IsValid = true; DeleteFiles = Null.NullBoolean; Package = new PackageInfo(info); Package.Manifest = packageManifest; if (!string.IsNullOrEmpty(packageManifest)) { //Create an XPathDocument from the Xml var doc = new XPathDocument(new StringReader(packageManifest)); XPathNavigator nav = doc.CreateNavigator().SelectSingleNode("package"); ReadManifest(nav); } }
private void InstallPromptBack() { if (InstallerInfo.HasInstallSteps()) { //Has install steps, revert to last shown one CurrentInstallStep = InstallerInfo.GetLastValidInstallStep(); CurrentInstallState = InstallState.InstallSteps; SetBrushesForCurrentInstallStep(); } else if (isInstalled) { //Has no install steps, but mod is installed so show InitialPrompt InitialPrompt(); } }
public ModulePackageWriter(XPathNavigator manifestNav, InstallerInfo installer) { _DesktopModule = new DesktopModuleInfo(); Package = new PackageInfo(installer); ReadLegacyManifest(manifestNav, true); Package.Name = DesktopModule.ModuleName; Package.FriendlyName = DesktopModule.FriendlyName; Package.Description = DesktopModule.Description; if (!string.IsNullOrEmpty(DesktopModule.Version)) { Package.Version = new Version(DesktopModule.Version); } Package.PackageType = "Module"; LegacyUtil.ParsePackageName(Package); Initialize(DesktopModule.FolderName); }
private void InstallStepNext() { CurrentInstallState = InstallState.InstallSteps; var nextStep = InstallerInfo.GetNextInstallStep(); if (nextStep != null) { //Display next step CurrentInstallStep = nextStep; SetBrushesForCurrentInstallStep(); } else { //There is no more steps. Go into InstallPrompt state. InstallPrompt(); } }
private void InstallStepPrev() { var prevStep = InstallerInfo.GetPreviousInstallStep(); if (prevStep != null) { //Go into previous step CurrentInstallStep = prevStep; SetBrushesForCurrentInstallStep(); } else { //We are already at the first viewable step, so go into InitialPrompt state if that is allowed, else just do nothing if (isInstalled) { InitialPrompt(); } } }
public ModulePackageWriter(XPathNavigator manifestNav, InstallerInfo installer) { this.DesktopModule = new DesktopModuleInfo(); // Create a Package this.Package = new PackageInfo(installer); this.ReadLegacyManifest(manifestNav, true); this.Package.Name = this.DesktopModule.ModuleName; this.Package.FriendlyName = this.DesktopModule.FriendlyName; this.Package.Description = this.DesktopModule.Description; if (!string.IsNullOrEmpty(this.DesktopModule.Version)) { this.Package.Version = new Version(this.DesktopModule.Version); } this.Package.PackageType = "Module"; LegacyUtil.ParsePackageName(this.Package); this.Initialize(this.DesktopModule.FolderName); }
/// ----------------------------------------------------------------------------- /// <summary> /// The AttachInstallerInfo method attachs an InstallerInfo instance to the Package /// </summary> /// <param name="installer">The InstallerInfo instance to attach</param> /// ----------------------------------------------------------------------------- public void AttachInstallerInfo(InstallerInfo installer) { InstallerInfo = installer; }
/// ----------------------------------------------------------------------------- /// <summary> /// This Constructor creates a new InstallPackage instance as defined by the /// Parameters /// </summary> /// ----------------------------------------------------------------------------- public PackageInfo(InstallerInfo info) : this() { AttachInstallerInfo(info); }