Esempio n. 1
0
		public override bool Operate(LauncherCore core, MinecraftLaunchArguments args)
		{
			core.CopyVersionDirectory("mods", args.Version.Id);
			core.CopyVersionDirectory("coremods", args.Version.Id);
			core.CopyVersionDirectories(core.GetVersionRootPath(args.Version));
			return true;
		}
Esempio n. 2
0
 public override bool Operate(LauncherCore core, MinecraftLaunchArguments args)
 {
     core.CopyVersionDirectory("mods", args.Version.Id);
     core.CopyVersionDirectory("coremods", args.Version.Id);
     core.CopyVersionDirectories(core.GetVersionRootPath(args.Version));
     return(true);
 }
Esempio n. 3
0
		/// <summary>
		///     从CreationOption创建启动器核心
		/// </summary>
		/// <param name="option">启动器创建选项</param>
		/// <returns>创建的启动器核心</returns>
		public static LauncherCore Create(LauncherCoreCreationOption option)
		{
			var launcherCore = new LauncherCore
			{
				GameRootPath = option.GameRootPath,
				JavaPath = option.JavaPath,
				VersionLocator = option.VersionLocator
			};
			return launcherCore;
		}
        /// <summary>
        ///     从CreationOption创建启动器核心
        /// </summary>
        /// <param name="option">启动器创建选项</param>
        /// <returns>创建的启动器核心</returns>
        public static LauncherCore Create(LauncherCoreCreationOption option)
        {
            var launcherCore = new LauncherCore
            {
                GameRootPath   = option.GameRootPath,
                JavaPath       = option.JavaPath,
                VersionLocator = option.VersionLocator
            };

            return(launcherCore);
        }
Esempio n. 5
0
 public FullLaunchReport(LauncherCore core, LaunchResult result, LaunchOptions options) : base(core, result, options)
 {
     LaunchedVersionId = options.Version.Id;
     AutoConnectServer = (options.Server != null) ? options.Server.ToString() : "";
     LauncherDirectory = Environment.CurrentDirectory;
     GameDirectory     = core.GameRootPath;
     if (result.Handle != null)
     {
         PlayerName = result.Handle.Arguments.Authentication.DisplayName;
     }
 }
Esempio n. 6
0
            public BasicLaunchReport(LauncherCore core, LaunchResult result, LaunchOptions options) : base(result, options)
            {
                #region 系统信息

                VideoCardInfo = GetVideoCardInfo();
                ProcessorInfo = GetProcessorInfo();

                #endregion

                #region 启动信息

                JavaPath = core.JavaPath;

                #endregion
            }
Esempio n. 7
0
        /// <summary>
        ///     报告一次启动结果
        /// </summary>
        /// <param name="core">启动器核心</param>
        /// <param name="result">启动结果</param>
        /// <param name="options">启动选项</param>
        public static LaunchResult Report(this LauncherCore core, LaunchResult result, LaunchOptions options)
        {
            if (_reportLevel == ReportLevel.None)
            {
                return(result);
            }
            if (result.ErrorType == ErrorType.NoJAVA)
            {
                if (NoJavaReported)
                {
                    return(result);
                }
                NoJavaReported = true;
            }
            Task.Factory.StartNew(() =>
            {
                try
                {
                    using (var wc = new WebClient())
                    {
                        wc.Headers.Add("user-agent", _clientName);
                        wc.UploadString(LAUNCH_REPORT,
                                        JsonMapper.ToJson((_reportLevel == ReportLevel.Full)
                                ? new FullLaunchReport(core, result, options)
                                : (_reportLevel == ReportLevel.Basic)
                                    ? new BasicLaunchReport(core, result, options)
                                    : new MinLaunchReport(result, options))
#if DEBUG
                                        .Print()
#endif
                                        );
                    }
                }
                catch
                {
                    Console.WriteLine("[KMCCC] report failed");
                }
            });
            return(result);
        }
Esempio n. 8
0
 public static string GetVersionOptions(this LauncherCore core, string versionId)
 {
     return(String.Format(@"{0}\versions\{1}\options.txt", core.GameRootPath, versionId));
 }
Esempio n. 9
0
 public static string GetVersionOptions(this LauncherCore core, Version version)
 {
     return(GetVersionOptions(core, version.Id));
 }
Esempio n. 10
0
 public static string GetVersionJsonPath(this LauncherCore core, string versionId)
 {
     return(String.Format(@"{0}\versions\{1}\{1}.json", core.GameRootPath, versionId));
 }
Esempio n. 11
0
 public static string GetVersionJsonPath(this LauncherCore core, Version version)
 {
     return(GetVersionJsonPath(core, version.Id));
 }
Esempio n. 12
0
 public override bool Operate(LauncherCore core, MinecraftLaunchArguments args)
 {
     return(_operatorMethod.Invoke(core, args));
 }
Esempio n. 13
0
 public override bool Operate(LauncherCore core, MinecraftLaunchArguments args)
 {
     args.Tokens["game_directory"] = String.Format(@".\versions\{0}\", args.Version.Id);
     return(true);
 }
Esempio n. 14
0
            public BasicLaunchReport(LauncherCore core, LaunchResult result, LaunchOptions options)
                : base(result, options)
            {
                #region 系统信息

                VideoCardInfo = GetVideoCardInfo();
                ProcessorInfo = GetProcessorInfo();

                #endregion

                #region 启动信息

                JavaPath = core.JavaPath;

                #endregion
            }
Esempio n. 15
0
 /// <summary>
 ///     启动模式
 /// </summary>
 /// <returns>模式是否应用成功</returns>
 public abstract bool Operate(LauncherCore core, MinecraftLaunchArguments args);
Esempio n. 16
0
		public override bool Operate(LauncherCore core, MinecraftLaunchArguments args)
		{
			return _operatorMethod.Invoke(core, args);
		}
Esempio n. 17
0
		public override bool Operate(LauncherCore core, MinecraftLaunchArguments args)
		{
			args.Tokens["game_directory"] = String.Format(@".\versions\{0}\", args.Version.Id);
			return true;
		}
Esempio n. 18
0
 public static string GetVersionJsonPath(this LauncherCore core, string versionId)
 {
     return(String.Format(SystemTools.GetIsWindows() ? @"{0}\versions\{1}\{1}.json" : "{0}/versions/{1}/{1}.json", core.GameRootPath, versionId));
 }
Esempio n. 19
0
		/// <summary>
		///     启动模式
		/// </summary>
		/// <returns>模式是否应用成功</returns>
		public abstract bool Operate(LauncherCore core, MinecraftLaunchArguments args);
Esempio n. 20
0
 public static string GetLibPath(this LauncherCore core, Library lib)
 {
     return(String.Format(@"{0}\libraries\{1}\{2}\{3}\{2}-{3}.jar", core.GameRootPath, lib.NS.Replace(".", "\\"), lib.Name, lib.Version));
 }
Esempio n. 21
0
 public static string GetNativePath(this LauncherCore core, Native native)
 {
     return(String.Format(@"{0}\libraries\{1}\{2}\{3}\{2}-{3}-{4}.jar", core.GameRootPath, native.NS.Replace(".", "\\"), native.Name, native.Version,
                          native.NativeSuffix));
 }
Esempio n. 22
0
 public static string GetLibPath(this LauncherCore core, Library lib)
 {
     return(String.Format(SystemTools.GetIsWindows() ? @"{0}\libraries\{1}\{2}\{3}\{2}-{3}.jar" : "{0}/libraries/{1}/{2}/{3}/{2}-{3}.jar", core.GameRootPath, lib.NS.Replace(".", (SystemTools.GetIsWindows() ? @"\" : "/")), lib.Name, lib.Version));
 }
Esempio n. 23
0
 public FullLaunchReport(LauncherCore core, LaunchResult result, LaunchOptions options)
     : base(core, result, options)
 {
     LaunchedVersionId = options.Version.Id;
     AutoConnectServer = (options.Server != null) ? options.Server.ToString() : "";
     LauncherDirectory = Environment.CurrentDirectory;
     GameDirectory = core.GameRootPath;
     if (result.Handle != null)
     {
         PlayerName = result.Handle.Arguments.Authentication.DisplayName;
     }
 }
Esempio n. 24
0
 public static string GetNativePath(this LauncherCore core, Native native)
 {
     return(String.Format(SystemTools.GetIsWindows() ? @"{0}\libraries\{1}\{2}\{3}\{2}-{3}-{4}.jar" : "{0}/libraries/{1}/{2}/{3}/{2}-{3}-{4}.jar", core.GameRootPath, native.NS.Replace(".", (SystemTools.GetIsWindows() ? @"\" : "/")), native.Name, native.Version,
                          native.NativeSuffix));
 }
Esempio n. 25
0
 public override bool Operate(LauncherCore core, MinecraftLaunchArguments args)
 {
     args.Tokens["game_directory"] = Tools.SystemTools.GetIsWindows() ? String.Format(@".\versions\{0}\", args.Version.Id) : String.Format(core.GameRootPath + "/versions/{0}/", args.Version.Id);
     return(true);
 }
Esempio n. 26
0
 public static string GetVersionOptions(this LauncherCore core, string versionId)
 {
     return(String.Format(SystemTools.GetIsWindows() ? @"{0}\versions\{1}\options.txt" : "{0}/versions/{1}/options.txt", core.GameRootPath, versionId));
 }