Exemplo n.º 1
0
        private static VersionsInformation ReadInformation(string filePath, bool compareVersion)
        {
            var fileContent   = File.ReadAllText(filePath);
            var versionBlocks = fileContent.Split(new [] { '{', '}' }).Where(block => !string.IsNullOrEmpty(block)).ToList();

            var currentVersion = Assembly.GetExecutingAssembly().GetName().Version;

            var versionInfo = new VersionsInformation();

            foreach (var block in versionBlocks)
            {
                var blockParts = block.Split(new [] { "::" }, StringSplitOptions.RemoveEmptyEntries);
                if (blockParts.Length == 2)
                {
                    var version = parseVersion(blockParts[0]);
                    if (compareVersion && version <= currentVersion)
                    {
                        continue;
                    }

                    var info = blockParts[1];
                    versionInfo.SetLatestVersionIfEmpty(version);
                    versionInfo.Add(version, info);
                }
            }
            return(versionInfo);
        }
Exemplo n.º 2
0
        private static VersionsInformation ReadInformation(string filePath, bool compareVersion)
        {
            var fileContent = File.ReadAllText(filePath);
            var versionBlocks = fileContent.Split(new []{'{','}'}).Where(block => !string.IsNullOrEmpty(block)).ToList();

            var currentVersion = Assembly.GetExecutingAssembly().GetName().Version;

            var versionInfo = new VersionsInformation();
            foreach (var block in versionBlocks)
            {
                var blockParts = block.Split(new []{"::"}, StringSplitOptions.RemoveEmptyEntries);
                if (blockParts.Length == 2)
                {
                    var version = parseVersion(blockParts[0]);
                    if (compareVersion && version <= currentVersion)
                    {
                        continue;
                    }

                    var info = blockParts[1];
                    versionInfo.SetLatestVersionIfEmpty(version);
                    versionInfo.Add(version, info);
                }
            }
            return versionInfo;
        }