public void CompareTo(string left, string right, int expected) { VersionString vLeft = new VersionString(left); VersionString vRight = new VersionString(right); Assert.AreEqual(expected, vLeft.CompareTo(vRight)); }
private void FillRawVersion() { BuildTypes = VersionString.Split(MainVersionSeparators, StringSplitOptions.RemoveEmptyEntries); var strver = VersionString.Split(BuildVersionSeparators, StringSplitOptions.RemoveEmptyEntries); RawVersion = Array.ConvertAll(strver, int.Parse); }
/// <summary>Initializes a new instance of the <see cref="MySqlStorage" /> class.</summary> /// <param name="connectionString">the connection details.</param> /// <param name="flags">The connection flags.</param> public MySqlStorage(ConnectionString connectionString, ConnectionFlags flags = default) : base(connectionString, flags) { VersionString = (string)QueryValue("SELECT VERSION()"); if (VersionString == null) { throw new InvalidDataException("Could not read mysql version!"); } if (VersionString.IndexOf('-') > -1) { Version = new Version(VersionString.Substring(0, VersionString.IndexOf('-'))); } else { Version = new Version(VersionString); } if (Version < new Version(5, 5, 3)) { SupportsFullUTF8 = false; CharacterSet = "utf8"; } else { SupportsFullUTF8 = true; CharacterSet = "utf8mb4"; } Trace.TraceInformation($"mysql version <cyan>{Version}<default> supports full utf-8 {(SupportsFullUTF8 ? "<green>" : "<red>") + SupportsFullUTF8}"); ClearCachedConnections(); }
public ImprovementContext GetFor( ImprovableId improvable, VersionString version) { var tenant = _executionContextManager.Current.Tenant; return(null); }
public void CanParseVersionString(string input, string major, string minor, string build, string revision) { var versionString = new VersionString(input); Assert.AreEqual(major, versionString.Major, "Major"); Assert.AreEqual(minor, versionString.Minor, "Minor"); Assert.AreEqual(build, versionString.Build, "Build"); Assert.AreEqual(revision, versionString.Revision, "Revision"); }
private void UpdateFooterText() { var lines = new List <string>() { VersionString.Stylize(FontStyle.BoldAndItalic).Colorize(Color.cyan), AuthorString }; FooterText.text = lines.JoinString("\n"); }
public MakeRunner(Context context, Log?log = null, string?makePath = null) : base(context, log, makePath) { ProcessTimeout = TimeSpan.FromMinutes(60); string vs = VersionString.Trim(); if (String.IsNullOrEmpty(vs) || !Version.TryParse(vs, out version)) { version = new Version(0, 0); } }
public SevenZipRunner(Context context, Log log = null, string toolPath = null) : base(context, log, toolPath ?? Context.Instance.Tools.SevenZipPath) { ProcessTimeout = TimeSpan.FromMinutes(DefaultTimeout); string vs = VersionString?.Trim(); if (String.IsNullOrEmpty(vs) || !Version.TryParse(vs, out version)) { version = new Version(0, 0); } }
public DepConfig(XElement packageElement) { var attrs = packageElement.Attributes(); if (attrs?.Any() == true) { foreach (var attr in attrs) { switch (attr.Name.LocalName) { case "id": { Name = attr.Value; break; } case "version": { VersionString = attr.Value; try { if (!VersionString.Contains('-')) { Version = new Version(VersionString); } } catch (Exception ex) { //LogEx(ex, isVerbose: false); } break; } case "targetFramework": { TargetFramework = attr.Value; break; } case "developmentDependency": { IsDevelopmentDependency = true; break; } default: throw new NotImplementedException(); } } } }
public void HandleFailedStep( RecipeType recipeType, StepNumber stepNumber, ImprovementId improvement, ImprovableId improvable, VersionString version) { var context = _improvementContextFactory.GetFor(improvable, version); var recipe = _recipeLocator.GetByName(recipeType); var steps = recipe.GetStepsFor(context).ToArray(); var step = steps[stepNumber]; var events = step.GetFailedEventsFor(context); events = events.Concat(new[] { new StepFailed(stepNumber) }); ApplyEventsFor(context, events); }
public async Task <IActionResult> RedirectToDownload(string version, string file) { if (!VersionString.TryParse(version, out var versionString) || String.IsNullOrEmpty(file)) { return(this.Redirect("/releases")); } // The blob.core.windows.net is case sensitive and all files there are lower case. var redirect = String.Format("https://wixdl.blob.core.windows.net/releases/{0}/{1}", versionString.Prefixed, file).ToLowerInvariant(); var visit = await this.HttpContext.CreateVisitEntityAsync("download", $"Version={versionString.Nonprefixed}+File={file}"); await this.StorageService.LogVisitAsync(visit); return(this.Redirect(redirect)); }
private Status RedirectToDownload() { UserService.CreateAnonymousUser(); string[] parsed = this.DownloadPath.Split(new char[] { '/' }, 2, StringSplitOptions.RemoveEmptyEntries); if (2 != parsed.Length) { return(Status.FoundAt("~/releases/")); } VersionString version; string file; try { version = new VersionString(parsed[0]); file = parsed[1].Replace("..", String.Empty); } catch { return(Status.FoundAt("~/releases/")); } // See if there is a version redirect file for the requested release. string redirect = null; try { redirect = this.RedirectedRelease(version.Prefixed, file); } catch { return(Status.NotFound); } // If redirect was not found, assume we're looking for a file on the download server. if (String.IsNullOrEmpty(redirect)) { Visit.CreateFromHttpContext().Log(logger); // New static.wixtoolset.org is case sensitive and all files there are lower case. redirect = String.Format(Configuration.DownloadServerFormat, version.Prefixed, file).ToLowerInvariant(); } return(Status.FoundAt(redirect)); }
static SharpInfo() { #if DEBUG IsDebugBuild = true; #endif try { using Stream s = Assembly.GetExecutingAssembly().GetManifestResourceStream(@"SharpChat.version.txt"); using StreamReader sr = new StreamReader(s); VersionString = sr.ReadLine(); VersionStringShort = IsDebugBuild ? VersionString.Substring(0, 7) : VersionString; } catch { VersionStringShort = VersionString = UNKNOWN; } StringBuilder sb = new StringBuilder(); sb.Append(NAME); sb.Append('/'); sb.Append(VersionStringShort); ProgramName = sb.ToString(); }
bool CheckWarnAndDeleteIfPodIsMissingLabels(V1Pod pod) { TenantId tenantId = new Guid(pod.Metadata.Labels[PodLabels.Tenant]); RecipeType recipeType = pod.Metadata.Labels[PodLabels.RecipeType]; ImprovementId improvementId = new Guid(pod.Metadata.Labels[PodLabels.Improvement]); ImprovableId improvableId = new Guid(pod.Metadata.Labels[PodLabels.Improvable]); VersionString versionString = pod.Metadata.Labels[PodLabels.Version]; var missing = false; missing |= CheckAndWarnIfPodIsMissingLabel(pod, PodLabels.Tenant); missing |= CheckAndWarnIfPodIsMissingLabel(pod, PodLabels.RecipeType); missing |= CheckAndWarnIfPodIsMissingLabel(pod, PodLabels.Improvement); missing |= CheckAndWarnIfPodIsMissingLabel(pod, PodLabels.Improvable); missing |= CheckAndWarnIfPodIsMissingLabel(pod, PodLabels.Version); if (missing) { DeletePod(pod); } return(missing); }
public void Initiate(ImprovableId improvable, VersionString version, bool isFromPullRequest) { Apply(new ImprovementInitiated(improvable, version, isFromPullRequest)); }
public override string ToString() { var str = VersionString.Format(Major, Minor, Patch, PatchMinor); return(Family + (!string.IsNullOrEmpty(str) ? (" " + str) : null)); }
void ReportStepStatuses(V1Pod pod) { if (CheckWarnAndDeleteIfPodIsMissingLabels(pod)) { return; } TenantId tenantId = new Guid(pod.Metadata.Labels[PodLabels.Tenant]); RecipeType recipeType = pod.Metadata.Labels[PodLabels.RecipeType]; ImprovementId improvementId = new Guid(pod.Metadata.Labels[PodLabels.Improvement]); ImprovableId improvableId = new Guid(pod.Metadata.Labels[PodLabels.Improvable]); VersionString versionString = pod.Metadata.Labels[PodLabels.Version]; _executionContextManager.CurrentFor(tenantId); var stepResultHandler = _stepResultHandlerFactory(); var buildSteps = new Dictionary <StepNumber, List <StepStatus> >(); pod.Status.InitContainerStatuses.ForEach(container => { var match = _stepNameRegex.Match(container.Name); if (match.Success) { StepNumber stepNumber = int.Parse(match.Groups[1].Value); //int subStepNumber = int.Parse(match.Groups[2].Value); //var subStepName = match.Groups[3].Value; var exitCode = container.State.Terminated?.ExitCode; var subStepStatus = StepStatus.NotStarted; if (exitCode.HasValue && exitCode != 0) { subStepStatus = StepStatus.Failed; } else if (exitCode.HasValue) { subStepStatus = StepStatus.Succeeded; } else if (container.State.Running != null) { subStepStatus = StepStatus.InProgress; } if (buildSteps.TryGetValue(stepNumber, out var subStepStatuses)) { subStepStatuses.Add(subStepStatus); } else { buildSteps.Add(stepNumber, new List <StepStatus>(new [] { subStepStatus })); } } }); buildSteps.ForEach(kv => { var stepNumber = kv.Key; var subStepStatuses = kv.Value; // TODO: These will be called multiple times for each step (at least for successful ones), make sure the state is kept somewhere else! if (subStepStatuses.Any(_ => _ == StepStatus.Failed)) { stepResultHandler.HandleFailedStep(recipeType, stepNumber, improvementId, improvableId, versionString); } else if (subStepStatuses.All(_ => _ == StepStatus.Succeeded)) { stepResultHandler.HandleSuccessfulStep(recipeType, stepNumber, improvementId, improvableId, versionString); } }); }