コード例 #1
0
 public static Config Get()
 {
     if (File.Exists(AuroraConfig._path))
     {
         return((Config)JsonConvert.DeserializeObject <Config>(AuroraConfig.Decompress(File.ReadAllBytes(AuroraConfig._path))));
     }
     AuroraConfig.Create();
     return(AuroraConfig.Get());
 }
コード例 #2
0
        public static async Task CreateDeviceAuth()
        {
            WebClient webClient = new WebClient();

            webClient.Headers.Add("Authorization", "bearer " + Globals.AuthData.AccessToken);
            try
            {
                AuroraConfig.SaveDeviceAuth((DeviceAuth)JsonConvert.DeserializeObject <DeviceAuth>(await webClient.UploadStringTaskAsync(Endpoints.DeviceAuth(Globals.AuthData.AccountId), "")));
            }
            catch (Exception ex)
            {
            }
        }
コード例 #3
0
        public async Task StartGame(
            string arguments,
            bool injectNative = true,
            string antiCheat  = null,
            string path       = null)
        {
            FortniteLauncher fortniteLauncher       = this;
            string           tempDirPath            = Path.Combine(Path.GetTempPath(), "FortniteClient-Win64-Shipping_" + (antiCheat ?? "BE") + ".exe");
            Stream           manifestResourceStream = Assembly.GetExecutingAssembly().GetManifestResourceStream("Aurora.Launcher.Resources.FortniteClient-Win64-Shipping_" + (antiCheat ?? "BE") + ".exe");
            FileStream       file       = new FileStream(tempDirPath, FileMode.Create, FileAccess.ReadWrite);
            FileStream       fileStream = file;
            await manifestResourceStream.CopyToAsync((Stream)fileStream);

            file.Close();
            fortniteLauncher._antiCheatProcess = new Process()
            {
                StartInfo = new ProcessStartInfo(tempDirPath, arguments)
                {
                    UseShellExecute = false,
                    CreateNoWindow  = true
                }
            };
            fortniteLauncher._antiCheatProcess.Start();
            fortniteLauncher._clientProcess = new Process()
            {
                StartInfo = new ProcessStartInfo(path ?? Path.Combine(AuroraConfig.Get()?.Path, "FortniteGame\\Binaries\\Win64\\FortniteClient-Win64-Shipping.exe"), arguments)
                {
                    UseShellExecute = false,
                    CreateNoWindow  = true
                }
            };
            fortniteLauncher._clientProcess.Start();
            if (injectNative)
            {
                Injector.Inject(fortniteLauncher._clientProcess.Id, Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Aurora.Runtime.dll"));
            }
            await fortniteLauncher._clientProcess.WaitForExitAsync();

            fortniteLauncher._antiCheatProcess.Kill();
            Thread.Sleep(200);
            File.Delete(tempDirPath);
            tempDirPath = (string)null;
            file        = (FileStream)null;
        }
コード例 #4
0
 public static void Create() => AuroraConfig.Save(new Config()
 {
     DeviceAuth = (DeviceAuth)null,
     Path       = EpicLauncher.GetInstallLocations().FirstOrDefault <Installation>((Func <Installation, bool>)(x => x.AppName == "Fortnite"))?.InstallLocation
 });
コード例 #5
0
 public static void SavePath(string path) => AuroraConfig.Save(new Config()
 {
     DeviceAuth = AuroraConfig.Get()?.DeviceAuth,
     Path       = path
 });
コード例 #6
0
 public static void SaveDeviceAuth(DeviceAuth deviceAuth) => AuroraConfig.Save(new Config()
 {
     DeviceAuth = deviceAuth,
     Path       = AuroraConfig.Get()?.Path
 });
コード例 #7
0
 public static void Save(Config config) => File.WriteAllBytes(AuroraConfig._path, AuroraConfig.Compress(JsonConvert.SerializeObject((object)config)));