/// <summary> /// Retrieves instance of <see cref="Version"/> representing the first version of the application. /// </summary> /// <returns>Returns latest application version object.</returns> public async Task <Version> GetFirstVersion() { VersionRef versionRef = await GetLatestVersionRef(); if (versionRef == null) { return(null); } return(await versionRef.GetVersion()); }
/// <summary> /// Retrieves instance of <see cref="Version"/> representing a version of the application. /// </summary> /// <param name="versionString">String representing a version of the application.</param> /// <returns>Returns application version object.</returns> public async Task <Version> GetVersion(string versionString) { VersionRef versionRef = await GetVersionRef(versionString); if (versionRef == null) { return(null); } return(await versionRef.GetVersion()); }
public Change(VersionController versionController, string guid, string relativePath, string title, string description, VersionRef releaseVersion, object additionalData = null) { VersionController = versionController; Guid = guid; Title = title; Description = description; ReleaseVersion = releaseVersion; if (additionalData != null) { AdditionalData = JObject.FromObject(additionalData); } }
/// <summary> /// Retrieves list of all application changes between two given versions. /// </summary> /// <param name="versionOne">Name of first version.</param> /// <param name="versionTwo">Name of second version.</param> /// <param name="includeLast">Set to true to include changes of second version in returned IEnumerable.</param> /// <returns>List of references to application changes. Null if version doesn't exist.</returns> public async Task <IEnumerable <ChangeRef> > GetChangesBetween(string versionOne, string versionTwo, bool includeLast = false) { VersionRef refOne = await GetVersionRef(versionOne); VersionRef refTwo = await GetVersionRef(versionTwo); if (refOne == null || refTwo == null) { return(null); } return(await GetChangesBetween(refOne, refTwo, includeLast)); }
/// <summary> /// Retrieves list of all application changes between two given versions. /// </summary> /// <param name="versionOne">Reference to first version.</param> /// <param name="versionTwo">Reference to second version.</param> /// <param name="includeLast">Set to true to include changes of second version in returned IEnumerable.</param> /// <returns>List of references to application changes.</returns> public async Task <IEnumerable <ChangeRef> > GetChangesBetween(VersionRef versionOne, VersionRef versionTwo, bool includeLast = false) { IEnumerable <VersionRef> versionsBetween = await GetVersionsBetween(versionOne, versionTwo, includeLast); if (versionsBetween == null) { return(null); } List <ChangeRef> changes = new List <ChangeRef>(); foreach (VersionRef versionRef in versionsBetween) { Version version = await versionRef.GetVersion(); changes.AddRange(version.Changes); } return(changes); }
/// <summary> /// Retrieves list of all application versions between two given versions. /// </summary> /// <param name="versionOne">Reference to first version.</param> /// <param name="versionTwo">Reference to second version.</param> /// <param name="includeLast">Set to true to include second version in returned IEnumerable.</param> /// <returns>List of application version references.</returns> public async Task <IEnumerable <VersionRef> > GetVersionsBetween(VersionRef versionOne, VersionRef versionTwo, bool includeLast = false) { if (await GetChangeLog() == null) { return(null); } if (versionOne.VersionName == versionTwo.VersionName) { return(new List <VersionRef>()); } int indexOfOne = CachedChangeLog.Versions.IndexOf(versionOne); int indexOfTwo = CachedChangeLog.Versions.IndexOf(versionTwo); int minIndex = Math.Min(indexOfOne, indexOfTwo); int maxIndex = Math.Max(indexOfOne, indexOfTwo); int rangeStart = includeLast ? minIndex : minIndex + 1; int rangeEnd = maxIndex - rangeStart; return(CachedChangeLog.Versions.GetRange(rangeStart, rangeEnd)); }
/// <summary> /// Asynchronously retrieves <see cref="Version"/> object from the filesystem given a reference to it. /// </summary> /// <param name="versionRef">Reference to the JSON file.</param> /// <param name="cache">Should the resulting Version be cached?</param> /// <returns>Returns Version object.</returns> public static async Task <Version> GetVersion(this VersionRef versionRef, bool cache = true) { Version version = versionRef.VersionController.CachedVersions.FirstOrDefault(v => v.VersionName == versionRef.VersionName); if (version != null) { return(version); } string versionJson = await versionRef.VersionController.FileProvider.GetFile(versionRef.RelativeFilePath); if (versionJson == null) { return(null); } version = Version.FromJson(versionJson, versionRef.VersionController); if (version != null && cache) { versionRef.VersionController.CachedVersions.Add(version); } return(version); }