コード例 #1
0
ファイル: Program.cs プロジェクト: JGTM2016/bdhero
        static void Main(string[] args)
        {
            string outputPath = "src/update.json";
            var update = new UpdateResponse
                {
                    Version = VersionUtils.CurrentVersion
                };

            var optionSet = new OptionSet
                {
                    { "h|?|help", s => PrintUsageAndExit() },

                    { "workspace=", s => Environment.CurrentDirectory = s },

                    { "r=|mirror=",  s => update.Mirrors.Add(s) },

                    { "w|windows", s => _curPlatform = update.Platforms.Windows },
                    { "m|mac",     s => _curPlatform = update.Platforms.Mac     },
                    { "l|linux",   s => _curPlatform = update.Platforms.Linux   },

                    { "s=|setup=",              s => _curPlatform.Packages.Setup    = CreatePackage(s) },
                    { "x=|sfx=",                s => _curPlatform.Packages.Sfx      = CreatePackage(s) },
                    { "7=|7z=|7zip=|sevenZip=", s => _curPlatform.Packages.SevenZip = CreatePackage(s) },
                    { "z=|zip=",                s => _curPlatform.Packages.Zip      = CreatePackage(s) },

                    { "o=|output=", s => outputPath = s },
                };

            var extra = optionSet.Parse(args);

            if (extra.Any())
            {
                Logger.WarnFormat("Warning: Unknown arguments passed; ignoring: [ \"{0}\" ]", string.Join("\", \"", extra));
            }

            var json = JsonConvert.SerializeObject(update, Formatting.Indented);
            File.WriteAllText(outputPath, json);
        }
コード例 #2
0
ファイル: Updater.cs プロジェクト: JGTM2016/bdhero
 private static Platform GetPlatform(UpdateResponse response)
 {
     var platforms = response.Platforms;
     var osType = SystemInfo.Instance.OS.Type;
     if (OSType.Mac == osType)
         return platforms.Mac;
     if (OSType.Linux == osType)
         return platforms.Linux;
     return platforms.Windows;
 }
コード例 #3
0
ファイル: Updater.cs プロジェクト: JGTM2016/bdhero
        private Update FromResponse(UpdateResponse response)
        {
            var mirror = response.Mirrors.First();
            var platform = GetPlatform(response);
            var package = GetPackage(platform);

            // No package available for the user's OS
            if (package == null)
            {
                return null;
            }

            var version = response.Version;
            var filename = package.FileName;
            var uri = mirror + filename;

            return new Update(version, filename, uri, package.SHA1, package.Size);
        }
コード例 #4
0
ファイル: Update.cs プロジェクト: rafntor/bdhero
        public static Update FromResponse([NotNull] UpdateResponse response, bool isPortable)
        {
            var version = response.Version;

            return(new Update(version));
        }