Ejemplo n.º 1
0
        public static void Main(string[] args)
        {
            var name = "PixelClient";
            var lb   = new LibrariesLocator(Locator);

            lb.GetNatives(name).ForEach(x =>
            {
                Console.WriteLine(x.Name);
            });

            var la = new LauncherArguments
            {
                Authentication = "awd",

                MaxMemorySize    = "6G",
                LauncherName     = "AHpxLauncher",
                MinecraftLocator = Locator
            };
            var savePath = $@"C:\Users\ahpx\Desktop\LOG_{$"{DateTime.Now:T}".Replace(':','-')}.txt";

            Console.WriteLine(la.GetArgument(name));
            File.WriteAllText(savePath, la.GetArgument(name));
            Process.Start(savePath);

            var lc = new LauncherCore
            {
                LauncherArguments = la,
                JavaPath          = @"C:\Program Files\Java\jdk1.8.0_241\bin\javaw.exe"
            };

            var pro = lc.Launch(name);

            while (pro.StandardOutput.ReadLine() != null)
            {
                Console.WriteLine(pro.StandardOutput.ReadLine());
            }
        }
Ejemplo n.º 2
0
        public void ExtractNatives(string name)
        {
            var locator   = LauncherArguments.MinecraftLocator;
            var lib       = new LibrariesLocator(locator);
            var ls        = lib.GetNatives(name);
            var directory =
                new DirectoryInfo(
                    $"{LauncherArguments.MinecraftLocator.Location}\\versions\\{name}\\{name}-natives");

            if (directory.Exists)
            {
                directory.GetFiles().ToList().ForEach(x => File.Delete(x.FullName));
            }
            else
            {
                directory.Create();
            }

            ls.ForEach(x =>
            {
                if (!File.Exists(x.Path))
                {
                    return;
                }

                var archive = ZipFile.OpenRead(x.Path);
                archive.Entries.ToList().ForEach(z =>
                {
                    if (z.FullName.EndsWith("dll"))
                    {
                        z.ExtractToFile($"{locator.Location}\\versions\\{name}\\{name}-natives\\{z.FullName}",
                                        true);
                    }
                });
            });
        }