public void AssureVersion() { lock (this) { var config = DB.Instance.GetConfig(); var myVersion = VersionUtils.getVersion(); if (config.NewVersionStatus != null && config.NewVersionStatus.myVersion != myVersion) { logger.Info("New version has been downloaded: " + myVersion); config.NewVersionStatus = null; DB.Instance.UpdateConfig(config); } } }
private static string GetHash(string[] arrLine, IReadOnlyList <ScenarioDefinition> scenarioDefinitions, int startLocation, ScenarioDefinition scenarioDefinition, IEnumerable <string> backgroundSteps) { var currentScenarioStartLocation = GherkinUtils.GetFirstStepLocation(scenarioDefinition); Location nextScenarioStartLocation = null; if (startLocation + 1 < scenarioDefinitions.Count) { nextScenarioStartLocation = GherkinUtils.GetFirstTagLocation(scenarioDefinitions[startLocation + 1]); } return(VersionUtils.GetVersion( arrLine, currentScenarioStartLocation, nextScenarioStartLocation, backgroundSteps)); }
private static bool IsReadyToShow(Sdk sdk) { if (sdk == null) { return(false); } var currentVersion = sdk.currentVersion; var latestVersion = sdk.version; return(!string.IsNullOrEmpty(latestVersion) && (!string.IsNullOrEmpty(currentVersion) || VersionUtils.CompareVersions(currentVersion, latestVersion) < 0) && !HasShown(sdk)); }
/** * Set translated text into labels */ private void SetTextTitles() { UiUtils.SetResourceText("ScreenTitleSettings", StringIds.IdSettingsTitle); UiUtils.SetResourceText("LanguageLabelSettings", StringIds.IdSettingsLanguageTitle); UiUtils.SetResourceText("GraphicsLabelSettings", StringIds.IdSettingsGraphicsTitle); UiUtils.SetResourceText("RoadObjectsLabelSettings", StringIds.IdSettingsRoadObjectsTitle); UiUtils.SetResourceText("TreesLabelSettings", StringIds.IdSettingsTreesTitle); UiUtils.SetResourceText("ModelLabelSettings", StringIds.IdSettingsModelsTitle); UiUtils.SetResourceText("ModelTypeLabelSettings", StringIds.IdSettingsModelsLoadingStorageTitle); UiUtils.SetResourceText("ShowTutorialLabel", StringIds.IdSettingsTutorialTitle); UiUtils.SetResourceText("TerrainLabelSettings", StringIds.IdSettingsTerrainTitle); UiUtils.SetResourceText("InfoTreesText", StringIds.IdSettingsTreesInfo); UiUtils.SetResourceText("InfoTerrainText", StringIds.IdSettingsTerrainInfo); VersionUtils.SetVersion(); }
private void SdkRow(Sdk sdkInfo, Func <bool, bool> customButton = null) { var sdkName = sdkInfo.sdkName; var latestVersion = sdkInfo.version.Replace("v", string.Empty); var cur = sdkInfo.currentVersion; cur = !string.IsNullOrEmpty(cur) ? sdkInfo.currentVersion.Replace("v", string.Empty) : ""; var isInst = !string.IsNullOrEmpty(cur); var canInst = !string.IsNullOrEmpty(latestVersion) && (!isInst || VersionUtils.CompareVersions(cur, latestVersion) < 0); var stillWorking = _editorCoroutine != null || _downloader != null; GUILayout.Space(4); using (new EditorGUILayout.HorizontalScope(GUILayout.ExpandWidth(false))) { GUILayout.Space(10); EditorGUILayout.LabelField(new GUIContent { text = sdkName }); GUILayout.Button(new GUIContent { text = string.IsNullOrEmpty(cur) ? "--" : cur, }, canInst ? EditorStyles.boldLabel : EditorStyles.label); GUILayout.Space(3); GUILayout.Button(new GUIContent { text = latestVersion ?? "--", }, canInst ? EditorStyles.boldLabel : EditorStyles.label); GUILayout.Space(3); if (customButton == null || !customButton(canInst)) { GUI.enabled = !stillWorking && (canInst) && !VersionUtils.IsEqualVersion(cur, latestVersion); if (GUILayout.Button(new GUIContent { text = isInst ? "Upgrade" : "Install", }, _fieldWidth)) { this.StartCoroutine(DownloadSDK(sdkInfo)); } GUI.enabled = true; } GUILayout.Space(5); } GUILayout.Space(4); }
public async Task Hello() { EmbedBuilder embed = new EmbedBuilder(); embed.WithTitle("Hello!"); embed.WithDescription($"Hello! My name is {Global.BotName}!\n\n**__Links__**" + $"\n:computer: [Commands]({Global.websiteCommands})" + $"\n<:GitHub:529571722991763456> [Github Page]({Global.githubPage})" + $"\n:bookmark: [Documentation]({Global.websiteHome})" + $"\n<:Discord:529572497130127360> [Voltstro Server]({Global.discordServers[0]})" + $"\n\nRunning Pootis-Bot version: {VersionUtils.GetAppVersion()}" + $"\nThis project is licensed under the [MIT license]({Global.githubPage}/blob/master/LICENSE.md)"); embed.WithColor(new Color(241, 196, 15)); await Context.Channel.SendMessageAsync("", false, embed.Build()); }
private static IList <string> GetBackgroundSteps(string[] arrLine, Feature feature) { var background = GetBackground(feature); if (background == null) { return(new List <string>()); } var firstScenario = feature.Children.FirstOrDefault(scenarioDefinition => !(scenarioDefinition is Background)); var backgroundFirstStepLocation = background.Steps.First()?.Location; return(VersionUtils.GetLinesList( arrLine, backgroundFirstStepLocation, GherkinUtils.GetFirstTagLocation(firstScenario))); }
private void AutoUpdate_Load(object sender, EventArgs e) { mainThread = new Thread(() => { if (VersionUtils.CheckForUpdates(out VersionData)) { this.DialogResult = System.Windows.Forms.DialogResult.OK; } try { this.Invoke(new MethodInvoker(() => { this.Close(); })); } catch { } }); mainThread.Start(); }
/// <summary> /// Handles the apply using the specified path /// </summary> /// <param name="path">The path</param> /// <param name="verbosity">The verbosity</param> /// <param name="config">The config</param> /// <param name="dryRun">The dry run</param> /// <param name="console">The console</param> /// <param name="cancellationToken">The cancellation token</param> /// <exception cref="Exception">No implementation found for service {nameof(IApplyDocumentHandler)}</exception> /// <returns>A task containing the int</returns> private static async Task <int> HandleApplyAsync(string path, string verbosity, string config, bool dryRun, IConsole console, CancellationToken cancellationToken) { // Configure the logger var logger = LoggingUtils.ConfigureLogger(verbosity); logger.Verbose("dotnet-runtime version: {Version}", VersionUtils.GetRuntimeVersion()); if (VersionUtils.TryGetVersion(out var version)) { logger.Verbose("dotnet-document version: {Version}", version); } logger.Verbose("Verbosity {verbosity} converted to log level {level}", verbosity, LoggingUtils.ParseLogLevel(verbosity)); logger.Verbose("Path to document: {path}", path); logger.Verbose("Is dry run: {dryRun}", dryRun); logger.Verbose("Config file from args: {config}", config); var configFilePath = IdentifyConfigFileToUse(config); // Declare a new service collection var services = new ServiceCollection(); services.AddLogging(o => o.AddSerilog(logger)); // Configure services collection services.ConfigureFromFile(configFilePath); services.AddDotnetDocument(); // Build the service provider var serviceProvider = services.BuildServiceProvider(); var handler = serviceProvider.GetService <IApplyDocumentHandler>(); if (handler is null) { logger.Error("No implementation found for service {Type}", nameof(IApplyDocumentHandler)); throw new Exception($"No implementation found for service {nameof(IApplyDocumentHandler)}"); } var result = handler.Apply(path, dryRun); return(await Task.FromResult((int)result)); }
private void CompareLocalResVer() { int result = VersionUtils.CompareVersion(UpdateMgr.PersistentResVer, UpdateMgr.StreamResVer); LogMgr.I("UnCompress", "CompareLocalResVer", " 沙盒版本:" + UpdateMgr.PersistentResVer + " 包内版本:" + UpdateMgr.StreamResVer + "比较结果:" + result, BeShowLog); switch (result) { case 0: //相同,不需要再次释放资源 case -1: //persistentResVer大,不需要释放资源 SetState(UnCompressState.unCompressComplete); break; case 1: //streamResVer大,释放资源 SetState(UnCompressState.readStreamResInfoList); break; } }
private static bool UpdateTestCase(ITestBase testCase, ScenarioDefinition scenarioDefinition, string hash, IEnumerable <TestCaseField> fieldsCollection) { testCase.Refresh(); var currentState = testCase.State; if (currentState.Equals(SyncUtil.RemovedState, StringComparison.InvariantCulture) || currentState.Equals(SyncUtil.ClosedState, StringComparison.InvariantCulture)) { Logger.Info(ResourceStrings.DECORATION, $"{testCase.Id} is {currentState}"); return(false); } var scenarioTags = GherkinUtils.GetTags(scenarioDefinition); var removedTag = scenarioTags.FirstOrDefault( scenarioTag => scenarioTag.Name.Trim().ToUpperInvariant().StartsWith( SyncUtil.RemovedTag, StringComparison.InvariantCulture)); if (removedTag != null) { testCase.State = SyncUtil.RemovedState; SaveTestCase(testCase); Logger.Info(ResourceStrings.DECORATION, $"{testCase.Id} is marked removed"); return(false); } var currentVersion = testCase.WorkItem.Fields[SyncUtil.VersionField].Value .ToString(); var isTestCaseDetailsChanged = TestCaseHelper.UpdateTestCaseDetails( scenarioDefinition, testCase); var isTestCaseFieldsChanged = TestCaseHelper.UpdateTestcaseFields( scenarioTags, testCase, fieldsCollection); var scenarioStepsUptoDate = VersionUtils.IsUptoDate(hash, currentVersion); if (isTestCaseDetailsChanged || isTestCaseFieldsChanged || !scenarioStepsUptoDate) { return(true); } Logger.Info(ResourceStrings.DECORATION, $"{scenarioDefinition.Name}<{testCase.Id}> is uptodate"); return(false); }
/// <summary> /// 比较沙盒与远程resVer /// </summary> private void CompareResVerPersist_Remote() { int result = VersionUtils.CompareVersion(UpdateMgr.PersistentResVer, UpdateMgr.RemoteResVer); switch (result) { case 0: //相同,不需要更新 case -1: //persistentResVer大,理论上不应该存在本地比server大的情况 LogMgr.I("DownloadRes", "CompareResVerPersist_Remote", "比较resVer persist:" + UpdateMgr.PersistentResVer + " remoteResVer" + UpdateMgr.RemoteResVer + " 不需要下载,准备进入复制流程", BeShowLog); SetState(DownloadResState.downloadComplete); break; case 1: //RemoteResVer,准备更新流程 LogMgr.I("DownloadRes", "CompareResVerPersist_Remote", "比较resVer persist:" + UpdateMgr.PersistentResVer + " remoteResVer" + UpdateMgr.RemoteResVer + " 需要下载,准备拉取remote resInfoList", BeShowLog); SetState(DownloadResState.pullRemoteResInfoList); break; } }
public static void Main() { Logger.InitiateLogger(); //Ascii art of Pootis-Bot because why not ¯\_(ツ)_/¯ Console.WriteLine(@"__________ __ .__ __________ __ "); Console.WriteLine(@"\______ \____ _____/ |_|__| ______ \______ \ _____/ |_ "); Console.WriteLine(@" | ___/ _ \ / _ \ __\ |/ ___/ ______ | | _// _ \ __\"); Console.WriteLine(@" | | ( <_> | <_> ) | | |\___ \ /_____/ | | ( <_> ) | "); Console.WriteLine(@" |____| \____/ \____/|__| |__/____ > |______ /\____/|__| "); Console.WriteLine(@" \/ \/ "); Console.WriteLine($" Version: {VersionUtils.GetAppVersion()}"); Console.WriteLine(); Logger.Log("Pootis-Bot starting..."); //This is just suggesting to use 64-bit if (!Environment.Is64BitOperatingSystem) { Logger.Log("This OS is a 32-bit os, 64-Bit is recommended!", LogVerbosity.Warn); } Logger.Log("Creating the HttpClient object...", LogVerbosity.Debug); Global.HttpClient = new HttpClient(); Logger.Log("Setting up global variable...", LogVerbosity.Debug); Global.BotName = Config.bot.BotName; Global.BotPrefix = Config.bot.BotPrefix; Global.BotToken = Config.bot.BotToken; //Check the audio services, if they are enabled AudioCheckService.CheckAudioService(); Console.Title = $"{Global.BotName} Console"; //Setup the bot, put in the name, prefix and token Logger.Log("Creating the bot instance...", LogVerbosity.Debug); Bot bot = new Bot(); Logger.Log("Starting the bot..."); //Start her up! bot.StartBot().GetAwaiter().GetResult(); }
private void DrawSdkUpdateComponent() { if (_updateCheckerSdkResponse != null) { if (_updateCheckerSdkResponse.IsError) { #if GOTOUDON_DEV SimpleGUI.ErrorBox(_updateCheckerSdkResponse.IsError, "Failed to check for VRChat SDK update."); #endif return; } ReleaseInfo releaseInfo = _updateCheckerSdkResponse.ReleaseInfo; if (releaseInfo.Version == null) { return; } string newestSdkVersion = NormalizeVrChatSDKVersion(releaseInfo.Version); string currentSdkVersion = NormalizeVrChatSDKVersion(GotoUdonEditor.CurrentSDKVersion); // I give up, TODO: save version in own repository instead of using vrchat if (currentSdkVersion.EndsWith("05.06") && newestSdkVersion.EndsWith("05.12")) { return; } if (releaseInfo.Version.StartsWith(GotoUdonEditor.ImplementedSDKVersion)) { return; } if (releaseInfo.UnityPackage != null && SimpleGUI.InfoBox( VersionUtils.IsRightNewerThanLeft(currentSdkVersion, newestSdkVersion), $"There is new VRChat UDON SDK version available: {releaseInfo.Version}!\n{releaseInfo.Name}\n{releaseInfo.Description}") ) { GUILayout.BeginHorizontal(); // if (!_downloadingSdk) // SimpleGUI.ActionButton($"Update to {releaseInfo.Version}!", UpdateSdk); SimpleGUI.ActionButton("Download manually.", () => Application.OpenURL(releaseInfo.UnityPackage.DownloadUrl)); GUILayout.EndHorizontal(); } } }
public Startup(IConfiguration configuration) { string logPath = Environment.GetEnvironmentVariable("MAGNUM_LOG_PATH"); LoggerConfiguration logConfig = new LoggerConfiguration(); logConfig.MinimumLevel.Is(LogEventLevel.Information); logConfig.Enrich.FromLogContext(); if (logPath != null) { logConfig.WriteTo.File(logPath, rollingInterval: RollingInterval.Day, retainedFileCountLimit: 7); } Log.Logger = logConfig.CreateLogger(); Log.Logger.Information("MagnumWeb version {Version} started", VersionUtils.GetVersion()); Configuration = configuration; }
public override int Compare(SdkFlutterVersion x, SdkFlutterVersion y) { if (x == null && y == null) { return(0); } if (x == null) { return(-1); } if (y == null) { return(1); } return(VersionUtils.Compare(x.Version, y.Version)); }
private static void OverrideMissionEscapeMenu(bool returnDefault = false) { if (returnDefault) { OverrideView(typeof(MissionOptionsUIHandler), typeof(MissionGauntletOptionsUIHandler)); } else { var types = AppDomain.CurrentDomain.GetAssemblies() .Where(a => !a.IsDynamic) .SelectMany(a => a.GetTypes()) .Where(t => ReflectionUtils.ImplementsOrImplementsEquivalent(t, typeof(IOptionsWithMCMOptionsMissionView))); var latestImplementation = VersionUtils.GetLastImplementation(ApplicationVersionUtils.GameVersion(), types); if (latestImplementation != null) { OverrideView(typeof(MissionOptionsUIHandler), latestImplementation?.Type !); } } }
private void powerAppbarIconBtn_Click(object sender, EventArgs e) { //체험판 체크 if (VersionUtils.CheckTrialVersion()) { MessageBox.Show(I18n.GetString("AppMessageTrialCannotuse") + " " + I18n.GetString("AppMessageTrialBuyInfo")); return; } //네트워크 연결체크 if (!NetworkUtils.IsNetworkAvailable) { NetworkUtils.ShowWiFiSettingPage(I18n.GetString("AppMessageRequiredDataNetwork"), I18n.GetString("AppMessageNotification")); return; } ServerInfo serverInfo = (ServerInfo)historyItemViewOnPage.SelectedItem; #if !WP7 if (NetworkUtils.IsPrivateNetwork(serverInfo.ServerIP)) { string wolIp = serverInfo.ServerIP.Substring(0, serverInfo.ServerIP.LastIndexOf(".") + 1); if (NetworkUtils.IsPrivateNetwork(NetworkUtils.MyIp) && NetworkUtils.MulticastIP.Contains(wolIp)) { //내부 IP의 경우 직접 브로드 캐스트 WakeOnLan(wolIp += "255"); } else { MessageBox.Show(I18n.GetString("HistoryPageWOLCannotRequest"), I18n.GetString("AppMessageNotification"), MessageBoxButton.OK); } } else { #endif //Subnet directed Broadcast //접속코드 입력 화면으로 이동 this.NavigationService.Navigate(new Uri(string.Format(Constant.PAGE_WOL_SUBNETMASK, serverInfo.ServerName, serverInfo.ServerIP, serverInfo.SubnetMask), UriKind.Relative)); #if !WP7 } #endif }
private static VRCVersionStatus IsVRChatSdkOutdated() { string currentSdkVersion = GotoUdonEditor.CurrentSDKVersion; string implementedSdkVersion = GotoUdonEditor.ImplementedSDKVersion; if (currentSdkVersion == implementedSdkVersion) { return(VRCVersionStatus.Same); } try { return(VersionUtils.IsRightNewerThanLeft(currentSdkVersion, implementedSdkVersion) ? VRCVersionStatus.Outdated : VRCVersionStatus.TooNew); } catch { return(VRCVersionStatus.Error); } }
public static void Main(string[] args) { Logger.Init(); ArgumentsProcessor.ParseArguments(args); //Ascii art of Pootis-Bot because why not ¯\_(ツ)_/¯ Console.WriteLine(@"__________ __ .__ __________ __ "); Console.WriteLine(@"\______ \____ _____/ |_|__| ______ \______ \ _____/ |_ "); Console.WriteLine(@" | ___/ _ \ / _ \ __\ |/ ___/ ______ | | _// _ \ __\"); Console.WriteLine(@" | | ( <_> | <_> ) | | |\___ \ /_____/ | | ( <_> ) | "); Console.WriteLine(@" |____| \____/ \____/|__| |__/____ > |______ /\____/|__| "); Console.WriteLine(@" \/ \/ "); Console.WriteLine($" Version: {VersionUtils.GetAppVersion()}"); Console.WriteLine(); Logger.Info("Pootis-Bot starting..."); Logger.Debug("Creating the HttpClient object..."); Global.HttpClient = new HttpClient(); Logger.Debug("Setting up global variables..."); Global.BotName = Config.bot.BotName; Global.BotPrefix = Config.bot.BotPrefix; Global.BotToken = Config.bot.BotToken; //Check the audio services, if they are enabled MusicLibsChecker.CheckMusicService(); Console.Title = $"{Global.BotName} Console"; //Setup the bot, put in the name, prefix and token Logger.Debug("Creating the bot instance..."); Bot bot = new Bot(); Logger.Debug("Starting the bot..."); //Start her up! bot.StartBot().GetAwaiter().GetResult(); }
/// <summary> /// Returns true if the specified version is known to be incompatible /// from list in KnownSaveIncompatibilityPoints /// </summary> /// <param name="saveVersion">The save's version to check</param> /// <returns>True if certainly incompatible</returns> public static bool IsKnownIncompatible(string saveVersion) { int currentVersionPlaceInList = -1; int savePlaceInList = -1; var current = Constants.Version; for (int i = 0; i < KnownSaveIncompatibilityPoints.Count; ++i) { var version = KnownSaveIncompatibilityPoints[i]; bool anyMatched = false; var currentDifference = VersionUtils.Compare(current, version); var saveDifference = VersionUtils.Compare(saveVersion, version); if (currentDifference >= 0) { anyMatched = true; currentVersionPlaceInList = i; } if (saveDifference >= 0) { anyMatched = true; savePlaceInList = i; } if (!anyMatched) { break; } } // If the current version and the save version don't fit in the same place in the save breakage points list // the save is either older or newer than the closes save breakage point to the current version. // Basically if numbers don't match, we know that the save is incompatible. return(currentVersionPlaceInList != savePlaceInList); }
//키보드를 화면에 표시한다. private void btnKeyboard_Tap(object sender, System.Windows.Input.GestureEventArgs e) { //체험판 체크 if (VersionUtils.CheckTrialVersion()) { MessageBox.Show(I18n.GetString("AppMessageTrialCannotuse") + " " + I18n.GetString("AppMessageTrialBuyInfo")); return; } if (!loadWorker.IsBusy) { Thickness margin = keybdLayer.Margin; if (SettingManager.Instance.SettingInfo.FullSizeKeyboard) { keybdLayer.Margin = new Thickness(0, this.ActualHeight * 0.3, 0, 0); } else { keybdLayer.Margin = new Thickness(50, this.ActualHeight * 0.5, 50, 0); } //키보드 사이즈가 바뀐경우 재생성 if (margin.Top != 0 && margin.Top != keybdLayer.Margin.Top) { Grid loadingGrd = CreateLoadingGrid("LoadingKeyboardSize"); loadWorker.RunWorkerAsync(new LoadingArgument() { LoadingGrid = loadingGrd, LoadingType = LoadingTypes.Keyboard }); } else { loadWorker.RunWorkerAsync(new LoadingArgument() { LoadingType = LoadingTypes.Keyboard }); } } }
private void LoadLocalConfig() { string configToLoadVersion = PlayerPrefs.GetString(configVersionKey); currentConfig.deviceType = (DeviceType)PlayerPrefs.GetInt(deviceTypeKey); if (!VersionUtils.AreVersionsCompatible(currentConfig.version, configToLoadVersion)) { Debug.LogWarning("Config found incompatible with current version"); LaunchConfigSetup(); } else { if (!VersionUtils.Equals(currentConfig.version, configToLoadVersion)) { // Save config with new version, some fields may be saved with default values SaveConfig(); Debug.LogWarning("Resaving config with latest version, check that everything is OK"); isConfLoaded = true; } } }
public void TestAddAndGetPrior() { DeleteAllDocuments(); string documentName = "test"; string instanceKey = null; string user = null; var oldestKey = new ConfigurationDocumentKey(documentName, new Version(3, 5, 21685, 22177), user, instanceKey); var oldest = new ConfigurationDocument { CreationTime = DateTime.Now, DocumentName = oldestKey.DocumentName, DocumentVersionString = VersionUtils.ToPaddedVersionString(oldestKey.Version, false, false), User = oldestKey.User, InstanceKey = oldestKey.InstanceKey, DocumentText = "oldest" }; var previousKey = new ConfigurationDocumentKey(documentName, new Version(4, 4, 21685, 22177), user, instanceKey); var previous = new ConfigurationDocument { CreationTime = DateTime.Now, DocumentName = previousKey.DocumentName, DocumentVersionString = VersionUtils.ToPaddedVersionString(previousKey.Version, false, false), User = previousKey.User, InstanceKey = previousKey.InstanceKey, DocumentText = "previous" }; var newestKey = new ConfigurationDocumentKey(documentName, new Version(5, 1, 21685, 22177), user, instanceKey); var newest = new ConfigurationDocument { CreationTime = DateTime.Now, DocumentName = newestKey.DocumentName, DocumentVersionString = VersionUtils.ToPaddedVersionString(newestKey.Version, false, false), User = newestKey.User, InstanceKey = newestKey.InstanceKey, DocumentText = "newest" }; using (var context = new DataAccessContext()) { var broker = context.GetConfigurationDocumentBroker(); broker.AddConfigurationDocument(oldest); broker.AddConfigurationDocument(previous); broker.AddConfigurationDocument(newest); context.Commit(); } using (var context = new DataAccessContext()) { var broker = context.GetConfigurationDocumentBroker(); var oldestRetrieved = broker.GetConfigurationDocument(oldestKey); Assert.AreEqual(oldestRetrieved.DocumentName, oldest.DocumentName); Assert.AreEqual(oldestRetrieved.DocumentVersionString, oldest.DocumentVersionString); var previousRetrieved = broker.GetConfigurationDocument(previousKey); Assert.AreEqual(previousRetrieved.DocumentName, previous.DocumentName); Assert.AreEqual(previousRetrieved.DocumentVersionString, previous.DocumentVersionString); var newestRetrieved = broker.GetConfigurationDocument(newestKey); Assert.AreEqual(newestRetrieved.DocumentName, newest.DocumentName); Assert.AreEqual(newestRetrieved.DocumentVersionString, newest.DocumentVersionString); var previousOfNewest = broker.GetPriorConfigurationDocument(newestKey); Assert.AreEqual(previousOfNewest.DocumentName, previous.DocumentName); Assert.AreEqual(previousOfNewest.DocumentVersionString, previous.DocumentVersionString); } }
public int CompareTo( IVersion value ) { return(VersionUtils.CompareTo(this, value)); }
public override string ToString( ) { return(VersionUtils.ToString(this)); }
public Task Upgrade(IVersionContext versionContext) { var databaseStandard = new StandardComponent { Id = "5d25f6abe88d28422061cfaf", Name = "databaseForm", DisplayName = "Database Form", AppId = Constants.CoreAppId, LayoutType = PageSectionLayoutType.OneColumn, Controls = new List <Portal.Entities.SectionParts.Controls.PageControl> { new Portal.Entities.SectionParts.Controls.PageControl { Name = "id", Order = 0, Type = Portal.Entities.SectionParts.Controls.ControlType.Textbox, Options = new List <Portal.Entities.Pages.ShellOption> { new Portal.Entities.Pages.ShellOption { Key = "label", Value = "id" }, new Portal.Entities.Pages.ShellOption { Key = "placeholder", Value = "id" }, new Portal.Entities.Pages.ShellOption { Key = "disabled", Value = "true" }, new Portal.Entities.Pages.ShellOption { Key = "hidden", Value = "true" }, new Portal.Entities.Pages.ShellOption { Key = "bindname", Value = "id" } } }, new Portal.Entities.SectionParts.Controls.PageControl { Name = "name", Order = 1, Type = Portal.Entities.SectionParts.Controls.ControlType.Textbox, Options = new List <Portal.Entities.Pages.ShellOption> { new Portal.Entities.Pages.ShellOption { Key = "label", Value = "Name" }, new Portal.Entities.Pages.ShellOption { Key = "placeholder", Value = "Name" }, new Portal.Entities.Pages.ShellOption { Key = "disabled", Value = "false" }, new Portal.Entities.Pages.ShellOption { Key = "hidden", Value = "false" }, new Portal.Entities.Pages.ShellOption { Key = "bindname", Value = "name" } }, Validators = new List <Portal.Entities.SectionParts.Controls.PageControlValidator> { new Portal.Entities.SectionParts.Controls.PageControlValidator { ValidatorType = Portal.Entities.SectionParts.Controls.ValidatorType.Required, IsActive = true, ValidatorMessage = "Please enter a database name" }, new Portal.Entities.SectionParts.Controls.PageControlValidator { ValidatorType = Portal.Entities.SectionParts.Controls.ValidatorType.Regex, IsActive = true, ValidatorMessage = "Please enter only characters and numberic", ValidatorOption = "[A-Za-z0-9]*" }, new Portal.Entities.SectionParts.Controls.PageControlValidator { ValidatorType = Portal.Entities.SectionParts.Controls.ValidatorType.MaxLength, IsActive = true, ValidatorMessage = "This field requires maximum 250 characters", ValidatorOption = "250" } }, AsyncValidators = new List <Portal.Entities.Components.Controls.PageControlAsyncValidator> { new Portal.Entities.Components.Controls.PageControlAsyncValidator { ValidatorName = "uniquename", IsActive = true, ValidatorMessage = "This database name is already existed. Please choose another name.", AsyncValidatorOptions = new Portal.Entities.Components.Controls.ControlAsyncValidatorOptions { EvaluatedExpression = "response.result == null", DatabaseOptions = new Portal.Entities.Shared.DatabaseOptions { DatabaseConnectionId = Constants.PortalDatabaseId, Query = "{\r\n \"$query\": {\r\n \"databases\": [\r\n {\r\n \"$match\": {\r\n \"name\": \"{{data.name}}\"\r\n }\r\n }\r\n ]\r\n }\r\n}" }, ValidatorType = Portal.Entities.Components.Controls.AsyncValidatorType.DatabaseValidator } } } }, new Portal.Entities.SectionParts.Controls.PageControl { Name = "dataSource", Order = 2, Type = Portal.Entities.SectionParts.Controls.ControlType.Textbox, Options = new List <Portal.Entities.Pages.ShellOption> { new Portal.Entities.Pages.ShellOption { Key = "label", Value = "Datasource" }, new Portal.Entities.Pages.ShellOption { Key = "placeholder", Value = "Datasource" }, new Portal.Entities.Pages.ShellOption { Key = "disabled", Value = "false" }, new Portal.Entities.Pages.ShellOption { Key = "hidden", Value = "false" }, new Portal.Entities.Pages.ShellOption { Key = "bindname", Value = "dataSource" } }, Validators = new List <Portal.Entities.SectionParts.Controls.PageControlValidator> { new Portal.Entities.SectionParts.Controls.PageControlValidator { ValidatorType = Portal.Entities.SectionParts.Controls.ValidatorType.Required, IsActive = true, ValidatorMessage = "Please enter a datasource" }, new Portal.Entities.SectionParts.Controls.PageControlValidator { ValidatorType = Portal.Entities.SectionParts.Controls.ValidatorType.MaxLength, IsActive = true, ValidatorMessage = "This field requires maximum 250 characters", ValidatorOption = "250" } } }, new Portal.Entities.SectionParts.Controls.PageControl { Name = "connectionString", Order = 3, Type = Portal.Entities.SectionParts.Controls.ControlType.Textbox, Options = new List <Portal.Entities.Pages.ShellOption> { new Portal.Entities.Pages.ShellOption { Key = "label", Value = "Connection String" }, new Portal.Entities.Pages.ShellOption { Key = "placeholder", Value = "Connection String" }, new Portal.Entities.Pages.ShellOption { Key = "disabled", Value = "false" }, new Portal.Entities.Pages.ShellOption { Key = "hidden", Value = "false" }, new Portal.Entities.Pages.ShellOption { Key = "bindname", Value = "connectionString" } }, Validators = new List <Portal.Entities.SectionParts.Controls.PageControlValidator> { new Portal.Entities.SectionParts.Controls.PageControlValidator { ValidatorType = Portal.Entities.SectionParts.Controls.ValidatorType.Required, IsActive = true, ValidatorMessage = "Please enter a connection string" }, new Portal.Entities.SectionParts.Controls.PageControlValidator { ValidatorType = Portal.Entities.SectionParts.Controls.ValidatorType.MaxLength, IsActive = true, ValidatorMessage = "This field requires maximum 500 characters", ValidatorOption = "500" } } }, new Portal.Entities.SectionParts.Controls.PageControl { Name = "databaseConnectionType", Order = 4, Type = Portal.Entities.SectionParts.Controls.ControlType.Select, Options = new List <Portal.Entities.Pages.ShellOption> { new Portal.Entities.Pages.ShellOption { Key = "label", Value = "Connection Type" }, new Portal.Entities.Pages.ShellOption { Key = "placeholder", Value = "" }, new Portal.Entities.Pages.ShellOption { Key = "disabled", Value = "false" }, new Portal.Entities.Pages.ShellOption { Key = "hidden", Value = "false" }, new Portal.Entities.Pages.ShellOption { Key = "bindname", Value = "databaseConnectionType" } }, DatasourceOptions = new Portal.Entities.Shared.DatasourceOptions { DatasourceStaticOptions = new Portal.Entities.Shared.DatasourceStaticOptions { JsonResource = "[{\"name\":\"MongoDB\",\"value\":\"mongodb\"},{\"name\":\"SQL Server\",\"value\":\"sqlserver\"}, {\"name\":\"PostgreSQL\",\"value\":\"postgresql\"}, {\"name\":\"MySQL\",\"value\":\"mysql\"}]" } }, Validators = new List <Portal.Entities.SectionParts.Controls.PageControlValidator> { new Portal.Entities.SectionParts.Controls.PageControlValidator { ValidatorType = Portal.Entities.SectionParts.Controls.ValidatorType.Required, IsActive = true, ValidatorMessage = "Please choose one connection type" } } } } }; var appStandard = new StandardComponent { Id = "5d3836194d8fa90874135d68", Name = "appForm", DisplayName = "App Form", AppId = Constants.CoreAppId, LayoutType = PageSectionLayoutType.OneColumn, Controls = new List <Portal.Entities.SectionParts.Controls.PageControl> { new Portal.Entities.SectionParts.Controls.PageControl { Name = "id", Order = 0, Type = Portal.Entities.SectionParts.Controls.ControlType.Textbox, Options = new List <Portal.Entities.Pages.ShellOption> { new Portal.Entities.Pages.ShellOption { Key = "label", Value = "Id" }, new Portal.Entities.Pages.ShellOption { Key = "placeholder", Value = "" }, new Portal.Entities.Pages.ShellOption { Key = "disabled", Value = "true" }, new Portal.Entities.Pages.ShellOption { Key = "hidden", Value = "true" }, new Portal.Entities.Pages.ShellOption { Key = "bindname", Value = "id" } } }, new Portal.Entities.SectionParts.Controls.PageControl { Name = "name", Order = 1, Type = Portal.Entities.SectionParts.Controls.ControlType.Textbox, Options = new List <Portal.Entities.Pages.ShellOption> { new Portal.Entities.Pages.ShellOption { Key = "label", Value = "Name" }, new Portal.Entities.Pages.ShellOption { Key = "placeholder", Value = "Name" }, new Portal.Entities.Pages.ShellOption { Key = "disabled", Value = "!!queryparams.id" }, new Portal.Entities.Pages.ShellOption { Key = "hidden", Value = "false" }, new Portal.Entities.Pages.ShellOption { Key = "bindname", Value = "name" } }, Validators = new List <Portal.Entities.SectionParts.Controls.PageControlValidator> { new Portal.Entities.SectionParts.Controls.PageControlValidator { ValidatorType = Portal.Entities.SectionParts.Controls.ValidatorType.Required, IsActive = true, ValidatorMessage = "Please enter a app name" }, new Portal.Entities.SectionParts.Controls.PageControlValidator { ValidatorType = Portal.Entities.SectionParts.Controls.ValidatorType.Regex, IsActive = true, ValidatorMessage = "Please enter only characters and numberic", ValidatorOption = "[A-Za-z0-9]*" }, new Portal.Entities.SectionParts.Controls.PageControlValidator { ValidatorType = Portal.Entities.SectionParts.Controls.ValidatorType.MaxLength, IsActive = true, ValidatorMessage = "This field requires maximum 250 characters", ValidatorOption = "250" } }, AsyncValidators = new List <Portal.Entities.Components.Controls.PageControlAsyncValidator> { new Portal.Entities.Components.Controls.PageControlAsyncValidator { ValidatorName = "uniquename", IsActive = true, ValidatorMessage = "This app name is already existed. Please choose another name.", AsyncValidatorOptions = new Portal.Entities.Components.Controls.ControlAsyncValidatorOptions { EvaluatedExpression = "response.result == null", DatabaseOptions = new Portal.Entities.Shared.DatabaseOptions { DatabaseConnectionId = Constants.PortalDatabaseId, Query = "{\r\n \"$query\": {\r\n \"apps\": [\r\n {\r\n \"$match\": {\r\n \"name\": \"{{data.name}}\"\r\n }\r\n }\r\n ]\r\n }\r\n}" }, ValidatorType = Portal.Entities.Components.Controls.AsyncValidatorType.DatabaseValidator } } } }, new Portal.Entities.SectionParts.Controls.PageControl { Name = "displayName", Order = 2, Type = Portal.Entities.SectionParts.Controls.ControlType.Textbox, Options = new List <Portal.Entities.Pages.ShellOption> { new Portal.Entities.Pages.ShellOption { Key = "label", Value = "Display Name" }, new Portal.Entities.Pages.ShellOption { Key = "placeholder", Value = "Display Name" }, new Portal.Entities.Pages.ShellOption { Key = "disabled", Value = "false" }, new Portal.Entities.Pages.ShellOption { Key = "hidden", Value = "false" }, new Portal.Entities.Pages.ShellOption { Key = "bindname", Value = "displayName" } }, Validators = new List <Portal.Entities.SectionParts.Controls.PageControlValidator> { new Portal.Entities.SectionParts.Controls.PageControlValidator { ValidatorType = Portal.Entities.SectionParts.Controls.ValidatorType.Required, IsActive = true, ValidatorMessage = "Please enter a display name" }, new Portal.Entities.SectionParts.Controls.PageControlValidator { ValidatorType = Portal.Entities.SectionParts.Controls.ValidatorType.MaxLength, IsActive = true, ValidatorMessage = "This field requires maximum 250 characters", ValidatorOption = "250" } } }, new Portal.Entities.SectionParts.Controls.PageControl { Name = "defaultUrl", Order = 3, Type = Portal.Entities.SectionParts.Controls.ControlType.Textbox, Options = new List <Portal.Entities.Pages.ShellOption> { new Portal.Entities.Pages.ShellOption { Key = "label", Value = "Default Url" }, new Portal.Entities.Pages.ShellOption { Key = "placeholder", Value = "Default Url" }, new Portal.Entities.Pages.ShellOption { Key = "disabled", Value = "false" }, new Portal.Entities.Pages.ShellOption { Key = "hidden", Value = "false" }, new Portal.Entities.Pages.ShellOption { Key = "bindname", Value = "defaultUrl" } }, Validators = new List <Portal.Entities.SectionParts.Controls.PageControlValidator> { new Portal.Entities.SectionParts.Controls.PageControlValidator { ValidatorType = Portal.Entities.SectionParts.Controls.ValidatorType.Required, IsActive = true, ValidatorMessage = "Please enter a default url" }, new Portal.Entities.SectionParts.Controls.PageControlValidator { ValidatorType = Portal.Entities.SectionParts.Controls.ValidatorType.MaxLength, IsActive = true, ValidatorMessage = "This field requires maximum 250 characters", ValidatorOption = "250" } } }, new Portal.Entities.SectionParts.Controls.PageControl { Name = "currentVersionNumber", Order = 4, Type = Portal.Entities.SectionParts.Controls.ControlType.Textbox, Options = new List <Portal.Entities.Pages.ShellOption> { new Portal.Entities.Pages.ShellOption { Key = "label", Value = "Version" }, new Portal.Entities.Pages.ShellOption { Key = "placeholder", Value = "App Version" }, new Portal.Entities.Pages.ShellOption { Key = "disabled", Value = "false" }, new Portal.Entities.Pages.ShellOption { Key = "hidden", Value = "false" }, new Portal.Entities.Pages.ShellOption { Key = "bindname", Value = "currentVersionNumber" } }, Validators = new List <Portal.Entities.SectionParts.Controls.PageControlValidator> { new Portal.Entities.SectionParts.Controls.PageControlValidator { ValidatorType = Portal.Entities.SectionParts.Controls.ValidatorType.Required, IsActive = true, ValidatorMessage = "Please enter a version number" }, new Portal.Entities.SectionParts.Controls.PageControlValidator { ValidatorType = Portal.Entities.SectionParts.Controls.ValidatorType.MaxLength, IsActive = true, ValidatorMessage = "This field requires maximum 50 characters", ValidatorOption = "50" } } }, new Portal.Entities.SectionParts.Controls.PageControl { Name = "logo", Order = 4, Type = Portal.Entities.SectionParts.Controls.ControlType.IconPicker, Options = new List <Portal.Entities.Pages.ShellOption> { new Portal.Entities.Pages.ShellOption { Key = "label", Value = "Icon" }, new Portal.Entities.Pages.ShellOption { Key = "placeholder", Value = "Icon" }, new Portal.Entities.Pages.ShellOption { Key = "disabled", Value = "false" }, new Portal.Entities.Pages.ShellOption { Key = "hidden", Value = "false" }, new Portal.Entities.Pages.ShellOption { Key = "bindname", Value = "logo" } }, Validators = new List <Portal.Entities.SectionParts.Controls.PageControlValidator> { new Portal.Entities.SectionParts.Controls.PageControlValidator { ValidatorType = Portal.Entities.SectionParts.Controls.ValidatorType.Required, IsActive = true, ValidatorMessage = "Please choose one icon" } } } } }; VersionUtils.GenerateControlEvents(databaseStandard); VersionUtils.GenerateControlEvents(appStandard); VersionUtils.GenerateStandardOptions(databaseStandard); VersionUtils.GenerateStandardOptions(appStandard); versionContext.InsertData(databaseStandard); versionContext.InsertData(appStandard); return(Task.CompletedTask); }
protected void SetSdkVersion() { requestObs.Headers.Add(HEADER_SDK_VERSION, VersionUtils.GetVersion() + "/" + VersionUtils.GetPlatform()); }
public string GetVersionString() { return(VersionUtils.GetVersionString(EpubVersion)); }
private void InitDebugInfo() { string gameVersion = VersionUtils.GetVersion(); _debugInfo.AddDebugLeft( () => { double avg = 0; /* if (World.ChunkManager.TotalChunkUpdates > 0) * { * avg = (World.ChunkManager.ChunkUpdateTime / World.ChunkManager.TotalChunkUpdates) * .TotalMilliseconds; * }*/ return ($"Alex {gameVersion} ({Alex.FpsMonitor.Value:##} FPS, {World.Ticker.TicksPerSecond:##} TPS, Chunk Updates: {World.EnqueuedChunkUpdates} queued, {World.ConcurrentChunkUpdates} active)"); }, TimeSpan.FromMilliseconds(50)); _debugInfo.AddDebugLeft(() => { var pos = World.Player.KnownPosition; var blockPos = pos.GetCoordinates3D(); return($"Position: (X={pos.X:F2}, Y={pos.Y:F2}, Z={pos.Z:F2}, OnGround={pos.OnGround}) / Block: ({blockPos.X:D}, {blockPos.Y:D}, {blockPos.Z:D})"); }); _debugInfo.AddDebugLeft(() => { var pos = World.Player.KnownPosition; return($"Facing: {GetCardinalDirection(pos)} (HeadYaw={pos.HeadYaw:F2}, Yaw={pos.Yaw:F2}, Pitch={pos.Pitch:F2})"); }); _debugInfo.AddDebugLeft(() => { var pos = World.Player.Velocity; return($"Velocity: (X={pos.X:F2}, Y={pos.Y:F2}, Z={pos.Z:F2}) ({World.Player.CurrentSpeed:F3} m/s)"); // / Target Speed: {(World.Player.CalculateMovementSpeed() * 20f):F3} m/s"; }); _debugInfo.AddDebugLeft(() => $"Primitives: {Alex.Metrics.PrimitiveCount:N0} Draw count: {Alex.Metrics.DrawCount}", TimeSpan.FromMilliseconds(500)); // _debugInfo.AddDebugLeft(() => $"IndexBuffer Elements: {World.IndexBufferSize:N0} ({GetBytesReadable(World.IndexBufferSize * 4)})"); _debugInfo.AddDebugLeft(() => $"Chunks: {World.ChunkCount}, {World.ChunkManager.RenderedChunks}", TimeSpan.FromMilliseconds(500)); _debugInfo.AddDebugLeft(() => $"Entities: {World.EntityManager.EntityCount}, {World.EntityManager.EntitiesRendered}", TimeSpan.FromMilliseconds(500)); _debugInfo.AddDebugLeft(() => { return($"Biome: {_currentBiome.Name} ({_currentBiomeId})"); }, TimeSpan.FromMilliseconds(500)); //_debugInfo.AddDebugLeft(() => { return $"Do DaylightCycle: {World.DoDaylightcycle}"; }); _debugInfo.AddDebugLeft( () => { return($"Exhaustion: {World.Player.HealthManager.Exhaustion:F1}/{World.Player.HealthManager.MaxExhaustion}"); }, TimeSpan.FromMilliseconds(250)); _debugInfo.AddDebugLeft( () => { return($"Saturation: {World.Player.HealthManager.Saturation:F1}/{World.Player.HealthManager.MaxSaturation}"); }, TimeSpan.FromMilliseconds(250)); _debugInfo.AddDebugLeft( () => { return($"Health: {World.Player.HealthManager.Health:F1}/{World.Player.HealthManager.MaxHealth}"); }, TimeSpan.FromMilliseconds(250)); _debugInfo.AddDebugLeft( () => { return($"Gamemode: {World.Player.Gamemode}"); }, TimeSpan.FromSeconds(5)); _debugInfo.AddDebugRight(Alex.OperatingSystem); _debugInfo.AddDebugRight(Alex.Gpu); _debugInfo.AddDebugRight($"{Alex.DotnetRuntime}\n"); _debugInfo.AddDebugRight(Alex.RenderingEngine); //_debugInfo.AddDebugRight(() => MemoryUsageDisplay); _debugInfo.AddDebugRight(() => $"RAM: {GetBytesReadable(_ramUsage, 2)}", TimeSpan.FromMilliseconds(1000)); _debugInfo.AddDebugRight(() => $"GPU: {GetBytesReadable(GpuResourceManager.GetMemoryUsage, 2)}", TimeSpan.FromMilliseconds(1000)); _debugInfo.AddDebugRight(() => { return ($"Threads: {(_threadsUsed):00}/{_maxThreads}"); }, TimeSpan.FromMilliseconds(50)); _debugInfo.AddDebugRight(() => { var player = World?.Player; if (player == null) { return(""); } if (player.HasRaytraceResult) { var raytracedBlock = player.RaytracedBlock; var adjacentBlock = player.AdjacentRaytraceBlock; var adj = Vector3.Floor(adjacentBlock) - Vector3.Floor(raytracedBlock); adj.Normalize(); var face = adj.GetBlockFace(); StringBuilder sb = new StringBuilder(); sb.AppendLine($"Target: {raytracedBlock} Face: {face}"); sb.AppendLine( $"Skylight: {World.GetSkyLight(raytracedBlock)} Face Skylight: {World.GetSkyLight(adjacentBlock)}"); sb.AppendLine( $"Blocklight: {World.GetBlockLight(raytracedBlock)} Face Blocklight: {World.GetBlockLight(adjacentBlock)}"); //sb.AppendLine($"Skylight scheduled: {World.IsScheduled((int) _raytracedBlock.X, (int) _raytracedBlock.Y, (int) _raytracedBlock.Z)}"); foreach (var bs in World .GetBlockStates((int)raytracedBlock.X, (int)raytracedBlock.Y, (int)raytracedBlock.Z)) { var blockstate = bs.State; if (blockstate != null && blockstate.Block.HasHitbox) { sb.AppendLine($"{blockstate.Name} (S: {bs.Storage})"); /*if (blockstate.IsMultiPart) * { * sb.AppendLine($"MultiPart=true"); * sb.AppendLine(); * * sb.AppendLine("Models:"); * * foreach (var model in blockstate.AppliedModels) * { * sb.AppendLine(model); * } * }*/ var dict = blockstate.ToDictionary(); if (dict.Count > 0) { sb.AppendLine(); sb.AppendLine("Blockstate:"); foreach (var kv in dict) { sb.AppendLine($"{kv.Key}={kv.Value}"); } } } } return(sb.ToString()); } else { return(string.Empty); } }, TimeSpan.FromMilliseconds(500)); _debugInfo.AddDebugRight(() => { var player = World.Player; if (player == null || player.HitEntity == null) { return(string.Empty); } var entity = player.HitEntity; return($"Hit entity: {entity.EntityId} / {entity.ToString()}"); }, TimeSpan.FromMilliseconds(500)); }