internal static XbmcVersionInfo GerVersion() { var installedVersion = new XbmcVersionInfo(); try { string versionFilePath = string.Format(@"{0}\{1}", Settings.XbmcPath, VersionFile); if (File.Exists(versionFilePath)) { string fileContent = Serilizer.ReadFile(versionFilePath); installedVersion = Serilizer.DeserializeObject<XbmcVersionInfo>(fileContent); if (installedVersion != null) { Logger.Info("Rev:{0}, Installation Date:{1}, Supplier:{2}", installedVersion.BuildNumber, installedVersion.InstallationDate, installedVersion.Suplier); } // if deserilization failes installedVersion will be set to null, // this will reset the installed version to version 0.0 else { installedVersion = new XbmcVersionInfo(); } } else { Logger.Info("No xbmcVersion files were found. The latest revision will be installed on next update"); } } catch (Exception e) { Logger.Fatal("An error has occurred while getting installed xbmcVersion info. {0}", e.ToString()); installedVersion = new XbmcVersionInfo(); } return installedVersion; }
internal static void SaveVersion(XbmcVersionInfo xbmcVersion) { Logger.Info("Updating your installation status"); string fileContent = Serilizer.SerializeObject(xbmcVersion); Serilizer.WriteToFile(string.Format(@"{0}\{1}", Settings.XbmcPath, VersionFile), fileContent, false); }
private void InstallBuild() { if (OnInstallStart != null) { OnInstallStart(this, "Killing XBMC"); } try { XbmcManager.StopXbmc(); //Sleeping for 1 seconds. just to make sure all file locks are released Thread.Sleep(1000); if (OnInstallStart != null) { OnInstallStart(this, "Installing Update..."); } CopyFolder(_uncompressedBuildPath, Settings.XbmcPath); //Register Build var verInfo = new XbmcVersionInfo {BuildNumber = OnlineBuildNumber, InstallationDate = DateTime.Now}; XbmcManager.SaveVersion(verInfo); CleanTemp(); if (OnInstallStop != null) { OnInstallStop(this, "Successfully Installed XBMC " + OnlineBuildNumber); } } catch (Exception e) { Logger.FatalException("An error has occurred while installing update", e); throw; } }