/// <summary> /// Checks the display FW Version /// </summary> // Revision History // MM/DD/YY Who Version ID Number Description // -------- --- ------- -- ------ ------------------------------------------- // 09/17/09 RCG 2.30.00 Created // 09/23/14 jrf 4.00.63 WR 534158 Modified way test details are set. private void CheckDisplayFWVersion() { // Only check this value if it's HW 2.0 or later and earlier than HW 3.0 if (VersionChecker.CompareTo(m_AmiDevice.HWRevision, CENTRON_AMI.HW_VERSION_2_0) >= 0 && VersionChecker.CompareTo(m_AmiDevice.HWRevision, CENTRON_AMI.HW_VERSION_3_0) < 0) { XMLOpenWayActiveFiles ActiveFiles = new XMLOpenWayActiveFiles(); FirmwareSet MeterFWSet = ActiveFiles.GetFirmwareSet(FirmwareSet.DetermineMeterType(m_AmiDevice.DeviceClass, m_AmiDevice.HWRevision, m_AmiDevice.MeterKey_TransparentDeviceSupported)); string MeterValue = m_AmiDevice.DisplayModVer + "." + m_AmiDevice.DisplayModBuild; string ExpectedValue = ""; string Result = ""; string Details = ""; string Reason = ""; if (MeterFWSet != null && File.Exists(FW_PATH + MeterFWSet.DisplayFWFile)) { CENTRON_AMI_FW_File FWFile = new CENTRON_AMI_FW_File(FW_PATH + MeterFWSet.DisplayFWFile); ExpectedValue = FWFile.CompleteVersion; } else { Reason = TestResources.ReasonNoFirmwareFile; } // Get the result string. We skip if the expected value is empty string. Pass if the values are equal Result = GetResultString(String.IsNullOrEmpty(ExpectedValue), MeterValue.Equals(ExpectedValue)); Details = GetFWVersionDetails(MeterValue, ExpectedValue); AddTestDetail(TestResources.DisplayFirmwareVersion, Result, Details, Reason); } }
public override void Logon(Google.ProtocolBuffers.IRpcController controller, bnet.protocol.authentication.LogonRequest request, Action <bnet.protocol.NoData> done) { Logger.Trace("LogonRequest(): Email={0}", request.Email); if (!VersionChecker.Check(this.Client, request)) // if the client trying to connect doesn't match required version, disconnect him. { Logger.Error("Client [{0}] doesn't match required version {1}, disconnecting..", request.Email, VersionInfo.LogNet.RequiredClientVersion); // create the disconnection reason. var reason = bnet.protocol.connection.DisconnectNotification.CreateBuilder() .SetErrorCode(3018).Build(); // Error 3018 => A new patch for Diablo III is available. The game will now close and apply the patch automatically. You will be able to continue playing after the patch has been applied. // FIXME: D3 client somehow doesn't show the correct error message yet, and in debug output we only miss a message like [ Recv ] service_id: 254 token: 6 status: 28 // when I compare NullD's output. That could be the reason. /raist. // force disconnect the client as it does not satisfy required version. /raist. this.Client.MakeRPC(() => bnet.protocol.connection.ConnectionService.CreateStub(this.Client).ForceDisconnect(null, reason, callback => { })); this.Client.Connection.Disconnect(); return; } done(bnet.protocol.NoData.CreateBuilder().Build()); AuthManager.StartAuthentication(this.Client, request); }
protected override void ProcessRecord() { cancellationTokenSource = new CancellationTokenSource(); CancellationToken token = cancellationTokenSource.Token; #pragma warning disable CS0618 // NoTelemetry and NoVersionCheck needs to be set through environment variables now if (NoTelemetry) { Environment.SetEnvironmentVariable("PNPPOWERSHELL_DISABLETELEMETRY", "true"); } if (NoVersionCheck) { Environment.SetEnvironmentVariable("PNPPOWERSHELL_UPDATECHECK", "false"); } #pragma warning restore CS6018 VersionChecker.CheckVersion(this); try { Connect(ref token); } catch (Exception ex) { ex.Data["TimeStampUtc"] = DateTime.UtcNow; throw; } }
public void LoadConfigTest() { var dbFile = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\cherrytomato\\database.sqlite"; var ver = new Version(Application.ProductVersion); var configString = "<?xml version=\"1.0\" encoding=\"utf-16\"?>\r\n" + "<cherryTomato>\r\n" + " <hasRun />\r\n" + " <newestKnownVersion major=\"" + ver.Major + "\" minor=\"" + ver.Minor + "\" />\r\n" + " <databaseFile path=\"" + dbFile + "\" />\r\n" + " <config />\r\n" + "</cherryTomato>"; var reader = new StringReader(configString); using (var cs = new CherryService()) { var vc = new VersionChecker(); cs.PluginRepository.RegisterPlugin(new PomodoroSensor()); cs.PluginRepository.RegisterPlugin(new FakeTimeProvider()); cs.PluginRepository.RegisterPlugin(new DatabaseController()); var fr = new FirstRunSensor(); cs.PluginRepository.RegisterPlugin(fr); cs.PluginRepository.RegisterPlugin(vc); cs.InitializeCherryServiceEventsAndCommands(); cs.PluginRepository.TieEvents(); cs.LoadConfiguration(reader); Assert.AreEqual(true, fr.HasRun); Assert.AreEqual(ver.Major, vc.NewestKnownVersion.Major); Assert.AreEqual(ver.Minor, vc.NewestKnownVersion.Minor); } }
// ReSharper disable once UnusedParameter.Local private static void Main(string[] args) { Loading.OnLoadingComplete += delegate { VersionChecker.LoadVersionChecker(); }; }
public MainWindow() { logger = NLogBuilder.ConfigureNLog("nlog.config").GetCurrentClassLogger(); telemetryWriter = new TelemetryWriter(); logger.Info("\n\nApp start"); telemetryWriter.WriteAppStart(); messageBoxService = new MessageBoxService(); dbService = new DbService(); drawService = new DrawService(logger); throwService = new ThrowService(logger); configService = new ConfigService(logger, dbService); scoreBoardService = new ScoreBoardService(logger, configService, drawService); camsDetectionBoard = new CamsDetectionBoard(configService, logger, drawService); fileSystemService = new FileSystemService(); versionChecker = new VersionChecker(appVersion, fileSystemService, dbService, configService, messageBoxService); detectionService = new DetectionService(drawService, configService, throwService, logger, camsDetectionBoard); manualThrowPanel = new ManualThrowPanel(logger, detectionService); gameService = new GameService(scoreBoardService, camsDetectionBoard, detectionService, logger, dbService, manualThrowPanel); InitializeComponent(); viewModel = new MainWindowViewModel(logger, messageBoxService, dbService, versionChecker, scoreBoardService, camsDetectionBoard, drawService, detectionService, manualThrowPanel, gameService, configService); DataContext = viewModel; }
public void CheckForNewVersion() { //NewVersionAvailable try { VersionChecker vcReleasedPageStripper = new VersionChecker("Pulse", new RssFeedReleases()); //get the release record for the version installed on the client Release client = vcReleasedPageStripper.GetReleaseByName(string.Format("Pulse {0}", System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString())); //if we weren't able to find the current version then return if (client == null) { return; } //get the default release Release defaultRelease = vcReleasedPageStripper.GetDefaultRelease(); //compare against the version installed on client (logic is up to you) if (defaultRelease.ReleaseDate > client.ReleaseDate) { //Notify user of upgrade if (NewVersionAvailable != null) { NewVersionAvailable(defaultRelease); } } } catch (Exception ex) { Log.Logger.Write(string.Format("Error checking for new Pulse Versions: {0}", ex.ToString()), Log.LoggerLevels.Warnings); } }
public LoginWindowViewModel(UserControl view) { _view = view as LoginView; ForceRefresh = Settings.UserSettings.ContainsKey("ForceRefresh") ? bool.Parse(Settings.UserSettings["ForceRefresh"]) : true; Email = Settings.UserSettings["AccountLogin"]; if (!string.IsNullOrEmpty(Settings.UserSettings["AccountPassword"])) { _view.txtPassword.Password = string.Empty.PadLeft(8); //For the visuals } _view.txtPassword.PasswordChanged += new RoutedEventHandler(TxtPassword_PasswordChanged); PropertyChanged += LoginWindow_PropertyChanged; _characterInjector = new CharacterTabInjector(); _statusController = new StatusController(_view.StatusBox); ApplicationState.Model.Authenticating += Model_Authenticating; ApplicationState.Model.Throttled += Model_Throttled; ApplicationState.InitializeFont(Properties.Resources.fontin_regular_webfont); ApplicationState.InitializeFont(Properties.Resources.fontin_smallcaps_webfont); _statusController.DisplayMessage(ApplicationState.Version + " Initialized.\r"); VersionChecker.CheckForUpdates(); //Todo: Feed this in from a setting so that console players will have their preference remembered SelectedRealm = AvailableRealms.First(); }
void Check(string fodyFile) { if (VersionChecker.IsVersionNewer(fodyFile)) { taskFileReplacer.AddFile(Path.GetDirectoryName(fodyFile)); } }
public async Task <string> GetUpdatesHistory() { string result = ""; try { var updatesInfo = await VersionChecker.GetUpdatesInformation(false); if (updatesInfo.ChangesByVersions.Keys.Count() == 0) { result = "Історія оновлень не знайдена."; } else { var sb = new StringBuilder(); foreach (var updateVersion in updatesInfo.ChangesByVersions.Keys) { sb.AppendLine(updateVersion.ToString()); sb.AppendLine(updatesInfo.ChangesByVersions[updateVersion]); sb.AppendLine(); } result = sb.ToString(); } } catch (WebException ex) { logger.Error("Error occured during update download"); logger.Error(ex.Message); } return(result); }
public override void Entry(IModHelper helper) { // init modPath = helper.DirectoryPath; Config = helper.ReadConfig <MorePetsConfig>(); // load textures EntoFramework.GetContentRegistry().RegisterTexture("paths_objects_MorePetsTilesheet", Path.Combine(modPath, "box.png")); this.LoadPetSkins(out CatTextures, out DogTextures); Monitor.Log($"Found [{CatTextures.Length}] Cat and [{DogTextures.Length}] Dog skins", LogLevel.Info); // hook events GameEvents.UpdateTick += GameEvents_UpdateTick; TimeEvents.AfterDayStarted += TimeEvents_AfterDayStarted; ControlEvents.ControllerButtonPressed += ControlEvents_ControllerButtonPressed; ControlEvents.MouseChanged += ControlEvents_MouseChanged; //LocationEvents.CurrentLocationChanged += LocationEvents_CurrentLocationChanged; helper.ConsoleCommands.Add("kill_pets", "Kills all the pets you adopted using MorePets, you monster", this.CommandFired_KillPets); // add console commands if (Config.DebugMode) { // DEV COMMANDS, kept in should they be needed in the future helper.ConsoleCommands .Add("spawn_pet", "Spawns either a `dog` or a `cat` depending on the given name | spawn_pet <type> <skin>", this.CommandFired_SpawnPet) .Add("test_adoption", "Triggers the adoption dialogue", this.CommandFired_TestAdoption); } // check version Version version = new Version(this.ModManifest.Version.MajorVersion, this.ModManifest.Version.MinorVersion, this.ModManifest.Version.PatchVersion); VersionChecker.AddCheck("MorePets", version, "https://raw.githubusercontent.com/Entoarox/StardewMods/master/VersionChecker/MorePets.json"); }
public LoginWindowViewModel(UserControl view) { this.view = view as LoginView; UseSession = Settings.UserSettings.ContainsKey("UseSessionID") ? bool.Parse(Settings.UserSettings["UseSessionID"]) : false; ForceRefresh = Settings.UserSettings.ContainsKey("ForceRefresh") ? bool.Parse(Settings.UserSettings["ForceRefresh"]) : true; Email = Settings.UserSettings["AccountLogin"]; if (!string.IsNullOrEmpty(Settings.UserSettings["AccountPassword"])) { this.view.txtPassword.Password = string.Empty.PadLeft(8); //For the visuals } this.view.txtPassword.PasswordChanged += new RoutedEventHandler(txtPassword_PasswordChanged); PropertyChanged += loginWindow_PropertyChanged; characterInjector = new CharacterTabInjector(); statusController = new StatusController(this.view.StatusBox); ApplicationState.Model.Authenticating += model_Authenticating; ApplicationState.Model.Throttled += model_Throttled; ApplicationState.InitializeFont(Properties.Resources.fontin_regular_webfont); ApplicationState.InitializeFont(Properties.Resources.fontin_smallcaps_webfont); statusController.DisplayMessage($"WTF is {ApplicationState.Version} Initialized. RIP TotalBiscuit.\r"); VersionChecker.CheckForUpdates(); }
public async Task <string> GetUpdatesInformation() { string result = ""; try { var updatesInfo = await VersionChecker.GetUpdatesInformation(true); if (!updatesInfo.HasNewVersion) { result = "Версія програми є найновішою."; } else { var sb = new StringBuilder(); foreach (var updateVersion in updatesInfo.ChangesByVersions.Keys) { sb.AppendLine(updateVersion.ToString()); sb.AppendLine(updatesInfo.ChangesByVersions[updateVersion]); sb.AppendLine(); } result = sb.ToString(); MsgDispatcher.Post(MessageType.UPDATES_AVAILABLE); } } catch (WebException ex) { logger.Error("Error occured during update download"); logger.Error(ex.Message); } return(result); }
/// <summary> /// Called when [load]. /// </summary> protected sealed override void OnLoad() { this.versionChecker = new VersionChecker(GlobalVariables.GitHubPath); this.Menu = new Menu(this.Name, this.Name); this.Menu.AddItem(new MenuItem(this.Name + "Enabled", "Enabled").SetValue(true)); //this.AssemblyVersion.Check(Variables.GitHubPath); this.Menu.AddItem( this.versionChecker.UpdateAvailable ? new MenuItem(this.Name + "Version", "Version: " + 1337) : new MenuItem(this.Name + "Version", "Version is outdated")); this.Menu.AddItem( new MenuItem(this.Name + "LiveCheck", "Check For new Version").SetValue(true) .SetTooltip( "If this is enabled, the assembly will look every few minutes if a newer version is available")); this.Menu.AddItem( new MenuItem(this.Name + "NotifyNewVersion", "Notify if new Version available").SetValue(true) .SetTooltip( "If this is enabled, the assembly will notify you when a new version is available. It will always inform you about important updates.")); this.Parent.Menu.AddSubMenu(this.Menu); this.lastChecked = Game.Time; }
public AuthController( ServiceLocation serviceLocation, IConfiguration configuration, IHostingEnvironment env, AuthService <KahlaUser> authService, OAuthService oauthService, UserManager <KahlaUser> userManager, SignInManager <KahlaUser> signInManager, UserService userService, AppsContainer appsContainer, KahlaPushService pusher, ChannelService channelService, VersionChecker version, KahlaDbContext dbContext, IMemoryCache cache) { _serviceLocation = serviceLocation; _configuration = configuration; _env = env; _authService = authService; _oauthService = oauthService; _userManager = userManager; _signInManager = signInManager; _userService = userService; _appsContainer = appsContainer; _pusher = pusher; _channelService = channelService; _version = version; _dbContext = dbContext; _cache = cache; }
public AuthController( ServiceLocation serviceLocation, IWebHostEnvironment env, AuthService <KahlaUser> authService, UserManager <KahlaUser> userManager, SignInManager <KahlaUser> signInManager, UserService userService, AppsContainer appsContainer, KahlaPushService pusher, ChannelService channelService, VersionChecker version, KahlaDbContext dbContext, IOptions <List <DomainSettings> > optionsAccessor, AiurCache cache) { _serviceLocation = serviceLocation; _env = env; _authService = authService; _userManager = userManager; _signInManager = signInManager; _userService = userService; _appsContainer = appsContainer; _pusher = pusher; _channelService = channelService; _version = version; _dbContext = dbContext; _cache = cache; _appDomains = optionsAccessor.Value; }
void MenuVersionCheckDoWork(object sender, System.ComponentModel.DoWorkEventArgs e) { VersionChecker vc = GetVersionChecker(); e.Result = vc; vc.CheckForNewVersion(); }
private void Window_Opened(object sender, EventArgs e) { Height = _prefsShown ? 277 + 320 : 277; Width = 504; if (Environment.OSVersion.Version.Major > 5 && ConfigManager.SettingsManager.LoadSetting("ControlCenter", "AeroWarning", true)) { bool aeroEnabled; NativeMethods.DwmIsCompositionEnabled(out aeroEnabled); if (!aeroEnabled) { AeroWarning warningDialog = new AeroWarning(); warningDialog.Owner = this; warningDialog.ShowDialog(); if (warningDialog.DisplayAgainCheckbox.IsChecked == true) { ConfigManager.SettingsManager.SaveSetting("ControlCenter", "AeroWarning", false); } } } App app = Application.Current as App; if (app != null && app.StartupProfile != null && File.Exists(app.StartupProfile)) { LoadProfileList(app.StartupProfile); LoadProfile(app.StartupProfile); StartProfile(); } VersionChecker.CheckVersion(); }
void Configure(ConfigureWindowModel model, Project project) { var directoryInfo = fullPathResolver.GetFullPath(model.ToolsDirectory, project); var targetFile = new FileInfo(Path.Combine(directoryInfo.FullName, "NotifyPropertyWeaverMsBuildTask.dll")); if (!targetFile.Exists || VersionChecker.IsVersionNewer(targetFile)) { if (!fileExporter.ExportTask(directoryInfo)) { taskFileReplacer.AddFile(directoryInfo); } } if (model.IncludeAttributeAssembly) { var frameworkType = FrameworkTypeReader.GetFrameworkType(project.FullName); fileExporter.ExportAttribute(fullPathResolver.GetFullPath(model.DependenciesDirectory, project), frameworkType); } var defaulter = new Defaulter(); var projectInjector = new NotifyPropertyWeaverProjectInjector { ProjectFile = project.FullName }; defaulter.FromModel(projectInjector, model); projectInjector.Execute(); }
private async void afterActions() { try { await Client.Current.RefreshCookiesAsync(); } catch (Exception) { //Ignore exceptions here. } try { var ver = await VersionChecker.CheckAsync(); if (ver is VersionChecker.GitHubRelease v) { var dialog = new UpdateDialog(v); await dialog.ShowAsync(); } } catch (Exception) { //Ignore exceptions here. } try { await ExClient.HentaiVerse.HentaiVerseInfo.FetchAsync(); } catch (Exception) { //Ignore exceptions here. } try { if (await EhTagTranslatorClient.Client.NeedUpdateAsync()) { AboutControl.UpdateETT.Execute(); } } catch (Exception) { RootControl.RootController.SendToast(Strings.Resources.Database.EhTagTranslatorClient.Update.Failed, null); } if (DateTimeOffset.Now - EhTagClient.Client.LastUpdate > new TimeSpan(7, 0, 0, 0)) { AboutControl.UpdateEhWiki.Execute(); } if (DateTimeOffset.Now - BannerProvider.Provider.LastUpdate > new TimeSpan(7, 0, 0, 0)) { try { await BannerProvider.Provider.FetchBanners(); } catch (Exception) { //Ignore exceptions here. } } }
// Method invoked when the user requests to download the latest update public async void DownloadNewVersion(object sender, EventArgs e) { mnuNewVersion.Enabled = false; stripUpdateProgress.Visible = true; stripUpdateProgress.AutoSize = true; await VersionChecker.DownloadUpdate(stripNewVersion.Tag as VersionChecker.VersionState, Core.UserDownloadsPath, DownloadProgressUpdated, DownloadComplete).ConfigureAwait(false); }
public void DbExistsChecks() { CreateVersionChecker(); VersionChecker.CheckAndUpdate(); FileSystemServiceMock.Verify(fss => fss.CheckFileExists(DbService.DatabaseName), Times.Once); }
public AboutWindowViewModel(AboutWindow view) { this.view = view; applicationInformation = new ApplicationInformation(); versionChecker = new VersionChecker(view, true); versionChecker.TaskFinished += VersionCheckerTaskFinished; CreateCommands(); }
public void GetServerVersionIdShouldReturnExactlyFourCharacters() { var versionChecker = new VersionChecker(string.Empty); var serverVersion = versionChecker.GetServerVersionId(); Console.WriteLine(serverVersion); Assert.AreEqual(4, serverVersion.Length); }
public void Test_ThisVersionIsUpToDate() { var c = new VersionChecker(); Console.WriteLine("Current version is " + c.CurrentVersion()); Console.WriteLine("Latest version is " + c.LatestVersion()); Assert.IsTrue(c.ThisVersionIsUpToDate()); }
public void Test_VersionChecker_VersionIsNotZero() { // can't confirm what version to test platform has Version ver = VersionChecker.GetDotnetVersion(); Assert.NotNull(ver); Assert.NotZero(ver.Major); }
public void Test_VersionChecker_DoesNotCrashOrReturnNull() { // can't confirm what version to test platform has string output = VersionChecker.GetConsoleOutput("dotnet --version"); Console.WriteLine(output); Assert.NotNull(output); }
public async Task <IActionResult> EntryPlayer([FromBody] EntryPlayer.Request req) { if (req.pingResults != null) { var results = new List <LogModels.PingResults.Result>(); foreach (var pingResult in req.pingResults) { results.Add(new LogModels.PingResults.Result { regionCode = pingResult.regionCode, time = pingResult.time, }); } Logger.Logging( new LogObj().AddChild(new LogModels.PingResults { PlayerId = SelfHost.playerInfo.playerId, Results = results, }) ); } if (!VersionChecker.Get(VersionChecker.CheckTarget.EnabledMatchmake).Check()) { return(BuildErrorResponse(Error.LowCode.DisabledMatchmake)); } var requester = new evomatching.ProtocolModels.Matching.EntryPlayer(); requester.request.playerId = SelfHost.playerInfo.playerId; requester.request.matchType = req.matchType.Value; var response = await requester.PostAsyncXXX(MatchingServerInfo.AreaUri(SelfHost.matchingArea)); if (response.StatusCode != System.Net.HttpStatusCode.OK) { return(BuildErrorResponse(Error.LowCode.ServerInternalError)); } switch (response.Payload.resultCode) { case evomatching.ProtocolModels.Matching.EntryPlayer.Response.ResultCode.Ok: return(Ok(new EntryPlayer.Response())); case evomatching.ProtocolModels.Matching.EntryPlayer.Response.ResultCode.OldPackageVersion: return(BuildErrorResponse(Error.LowCode.NgPackageVersion)); case evomatching.ProtocolModels.Matching.EntryPlayer.Response.ResultCode.SendedPgInvitation: return(BuildErrorResponse(Error.LowCode.SentPgInvitation)); case evomatching.ProtocolModels.Matching.EntryPlayer.Response.ResultCode.RecievedPgInvitation: return(BuildErrorResponse(Error.LowCode.RecievedPgInvitation)); default: return(BuildErrorResponse(Error.LowCode.CouldNotMatchingEnty)); } }
protected override void OnStartup(StartupEventArgs e) { VersionChecker.CheckVersion("v0.9"); Current.DispatcherUnhandledException += new DispatcherUnhandledExceptionEventHandler(DispatcherUnhandledExceptionHandler); _config = new DependencyInjectionConfig(); _config.ShowMainWindow(); }
void FillNewerVersionAvailable(PSObject result) { var versionAvailable = VersionChecker.GetAvailableVersion(); if (versionAvailable != null && VersionChecker.IsNewer(versionAvailable)) { AddProperty(result, "NewerVersionAvailable", versionAvailable.ToString()); } }
public static void Main(string[] args) { Application.Init (); MainWindow win = new MainWindow (); VersionChecker vc = new VersionChecker (); win.ShowAll(); Application.Run (); }
public void SimpleTest() { var vc = new VersionChecker(); var v = vc.GetNewestVersion(); if (v == null) { // The internet is not available. return; } Assert.That(v, Is.EqualTo(new Version(0, 4)), "Test is not up to date"); }
public void TestDialog() { var xmlData = "<cherrytomatoVersionHistory>" + "<version major=\"0\" minor=\"2\">" + "<comment>First release</comment>" + "</version>" + "</cherrytomatoVersionHistory>"; var currentVersion = new Version(0, 1); var vc = new VersionChecker(xmlData, currentVersion); vc.CheckNewestVersion(new Version(0, 1)); }
public void CheckForNewVersion() { //NewVersionAvailable try { VersionChecker vcReleasedPageStripper = new VersionChecker("Pulse", new RssFeedReleases()); //get the release record for the version installed on the client Release client = vcReleasedPageStripper.GetReleaseByName(string.Format("Pulse {0}", System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString())); //if we weren't able to find the current version then return if (client == null) return; //get the default release Release defaultRelease = vcReleasedPageStripper.GetDefaultRelease(); //compare against the version installed on client (logic is up to you) if (defaultRelease.ReleaseDate > client.ReleaseDate) { //Notify user of upgrade if (NewVersionAvailable != null) NewVersionAvailable(defaultRelease); } } catch (Exception ex) { Log.Logger.Write(string.Format("Error checking for new Pulse Versions: {0}", ex.ToString()), Log.LoggerLevels.Warnings); } }
public MainWindow() : base(Gtk.WindowType.Toplevel) { Build(); //textview2.Visible=false; //endMark = textview2.Buffer.CreateMark("end-mark", textview2.Buffer.EndIter, false); string settingFile = System.IO.Path.Combine(MainClass.Paths.SettingDir, "moscrif.mss"); if(!File.Exists(settingFile)){ SetLabel("Setting file not found!"); btnQuit.Visible = true; return; } try{ Console.WriteLine(settingFile); XmlDocument xml = new XmlDocument(); //xml.LoadXml(settingFile); StreamReader reader = new StreamReader(settingFile); xml.LoadXml(reader.ReadToEnd()); XmlNodeList xnList = xml.SelectNodes("/Settings"); filePublishPath= xnList[0].Attributes["publishDir"].Value ; fileLibsPath= xnList[0].Attributes["frameworkDir"].Value ; fileEmulatorPath= xnList[0].Attributes["emulatorDir"].Value ; } catch(Exception ex){ Console.WriteLine(ex.Message); SetLabel("Setting file is corrupted"); btnQuit.Visible = true; return; } //timer.Interval = 250; //timer.Elapsed += new ElapsedEventHandler(OnTimeElapsed); ZipConstants.DefaultCodePage = Encoding.UTF8.CodePage; /*for (int i = 0; i < args.Length; i++){ WriteMesage(args[i]); }*/ /*if (!MainClass.Auto){ messageLabel.LabelProp = "ERROR."; WriteMesage("Incorect parameter."); return; }*/ //tag = new TextTag("0"); if(MainClass.Platform.IsWindows){ WriteMesage("Process -->"); Process []pArry = Process.GetProcesses(); foreach(Process p in pArry) { string s = p.ProcessName; s = s.ToLower(); WriteMesage("\t"+s); if (s.CompareTo("moscrif-ide") ==0){ try{ p.Kill(); } catch{ SetLabel("Moscrif IDE is already running!"); btnQuit.Visible = true; return; } } } } string moscriftIdePath = System.IO.Path.Combine(MainClass.Paths.AppPath, "moscrif-ide.exe"); if (!System.IO.File.Exists(moscriftIdePath)){ SetLabel("Moscrif IDE not found!"); btnQuit.Visible = true; return; } string version = ""; FileVersionInfo moFI = FileVersionInfo.GetVersionInfo(moscriftIdePath); VersionChecker vers = new VersionChecker(); if (moFI== null){ WriteMesage("ERROR: Unknown version."); btnQuit.Visible = true; return; } else { version = moFI.FileVersion; string[] versions = version.Split('.'); if (versions.Length != 4){ WriteMesage("ERROR: Invalid Version."); btnQuit.Visible = true; return; } string webVersion = vers.VersionConverter(version); WriteMesage("Old Version "+ webVersion); //return; } string newVersion; string message ; try{ if(!String.IsNullOrEmpty(MainClass.Token) ) message = vers.CheckVersionSynch(version,MainClass.Token,out newVersion,false,test); else message = vers.CheckVersionSynch(version,"",out newVersion,false,test); }catch(Exception ex){ SetLabel(ex.Message); WriteMesage(ex.Message); btnQuit.Visible = true; return; } bool nextVersion = true; while(nextVersion){ nextVersion = false; newVersion = System.IO.Path.GetFileNameWithoutExtension(newVersion); if(String.IsNullOrEmpty(newVersion) ){ SetLabel("Your version is up-to-date."); WriteMesage( message); btnQuit.Visible = true; return; } WriteMesage( message); WriteMesage("New Version "+ newVersion); //pd = new ProgressDialog("Download",ProgressDialog.CancelButtonType.None,1,null);//MainClass.MainWindow Reset(1,"Downloading version : " + newVersion); string fullpath = System.IO.Path.Combine(MainClass.Paths.TempDir,newVersion+".zip");//Temp //timer.Start(); // data = null; //Stream str ; isFinish = false; isError = false; try{ if(!String.IsNullOrEmpty(MainClass.Token) ){ //vers.GetVersionSynch(newVersion,MainClass.Token,out str); GetVersionAsynch(newVersion,MainClass.Token,fullpath,test); // GetVersionHandler } else GetVersionAsynch(newVersion,"",fullpath,test); int indx = 0; while (!isFinish)//(client.IsBusy) { //progressBar.Text=indx.ToString(); AutomaticUpdate(); indx++; while (Application.EventsPending ()) Application.RunIteration (); Thread.Sleep(150); } } catch(Exception ex){ SetLabel(ex.Message); WriteMesage(ex.Message); //timer.Enabled = false; //timer.Stop(); btnQuit.Visible = true; return; } if((!File.Exists(fullpath)) || (isError)){ WriteMesage("Error downloading file."); SetLabel("Error downloading file!"); //timer.Enabled = false; //timer.Stop(); btnQuit.Visible = true; //if(pd != null) pd.Destroy(); return; } /*if (data!= null){ //str FileStream writeStream = new FileStream(fullpath, FileMode.Create, FileAccess.Write); Copy(data,writeStream); writeStream.Close(); writeStream.Dispose(); } else { WriteMesage("Error downloading file."); SetLabel("Error downloading file!"); timer.Enabled = false; timer.Stop(); btnQuit.Visible = true; //if(pd != null) pd.Destroy(); return; }*/ //timer.Enabled = false; //timer.Stop(); //if(pd != null) pd.Destroy(); Reset(1,"Download Finish"); string outputPath = System.IO.Path.Combine(MainClass.Paths.Temp,newVersion); if(!Directory.Exists(outputPath)){ try{ Directory.CreateDirectory(outputPath); }catch{ SetLabel("Error creating output directory!"); WriteMesage("ERROR: FILE CANNOT BY CREATE."); btnQuit.Visible = true; return; } } List<string> listFile = new List<string>(); try{ listFile = UnzipFile(fullpath,outputPath); } catch{ SetLabel("Error unpacking new version!"); WriteMesage("ERROR:FILE CANNOT BY UNPACK."); btnQuit.Visible = true; return; } Console.WriteLine("btnQuit.Visible 4 -> {0}",btnQuit.Visible); if ((listFile == null) || (listFile.Count<1)){ SetLabel("Error unpacking new version!"); WriteMesage("ERROR:FILE CANNOT BY UNPACK."); btnQuit.Visible = true; return; } Console.WriteLine("btnQuit.Visible 5 -> {0}",btnQuit.Visible); foreach(string file in listFile){ string fileName = System.IO.Path.GetFileName(file).ToLower(); string fileNameWE = System.IO.Path.GetFileNameWithoutExtension(file).ToLower(); string fileOutputPath = ""; switch (fileName){ case "emu.win.zip": if (MainClass.Platform.IsWindows){ fileOutputPath = fileEmulatorPath; } else continue; break; case "emu.mac.zip": if (MainClass.Platform.IsMac){ fileOutputPath = fileEmulatorPath; } else continue; break; case "emu.lin.zip": if (MainClass.Platform.IsX11){ fileOutputPath = fileEmulatorPath; } else continue; break; case "ide.zip": fileOutputPath = MainClass.Paths.AppPath; break; case "lib.zip": fileOutputPath = fileLibsPath; break; /*case "pub.zip": fileOutputPath = filePublishPath; break; */ case "pub.win.zip": if (MainClass.Platform.IsWindows){ fileOutputPath = filePublishPath; } else continue; break; case "pub.mac.zip": if (MainClass.Platform.IsMac){ fileOutputPath = filePublishPath; } else continue; break; case "pub.lin.zip": if (MainClass.Platform.IsX11){ fileOutputPath = filePublishPath; } else continue; break; case "sam.zip": fileOutputPath = MainClass.Paths.SampleDir; break; default: fileOutputPath =System.IO.Path.Combine(MainClass.Paths.AppPath,fileNameWE); break; } WriteMesage("fileName :"+file); try{ UnzipFile(file,fileOutputPath); if (cancelUnpack){ WriteMesage("SKIP "); goto nav; } }catch (Exception ex) { WriteMesage("Error unpacking file: "+ex.Message); SetLabel("Error unpacking file '"+file + "'!"); } } string fixVersion = ""; if(newVersion.Length == 7) fixVersion = newVersion[6].ToString(); string versionPath = System.IO.Path.Combine(MainClass.Paths.AppPath,"version.txt"); using (StreamWriter fileVersion = new StreamWriter(versionPath)) { fileVersion.Write(fixVersion); fileVersion.Close(); fileVersion.Dispose(); } nav:; try{ WriteMesage("Delete temp file."); SetLabel("Deleting temporary files."); System.IO.File.Delete(fullpath); System.IO.Directory.Delete(outputPath,true); }catch{ } try{ version = newVersion; Console.WriteLine("newVersion -> {0}",newVersion); Console.WriteLine("version -> {0}",version); if(!String.IsNullOrEmpty(MainClass.Token) ) message = vers.CheckVersionSynch(version,MainClass.Token,out newVersion,true,test); else message = vers.CheckVersionSynch(version,"",out newVersion,true,test); if(String.IsNullOrEmpty(newVersion) ){ nextVersion = false; } else { nextVersion = true; } }catch{//(Exception ex){ //SetLabel(ex.Message); //WriteMesage(ex.Message); //btnQuit.Visible = true; //return; nextVersion = false; } } btnQuit.Visible = true; SetLabel("Update is completed."); }