Exemple #1
0
        public Lobby(UI.Splash splash)
        {
            InitializeComponent();
            string FNCosmeticsPath = global.ProSwapperFolder + "lobby.ProSwapper";

            Icon      = Main.appIcon;
            BackColor = global.MainMenu;


            CurrentCID = new Item();
            var asset = new Asset();

            asset.AssetPath = "FortniteGame/AssetRegistry.bin";
            asset.UcasFile  = "pakchunk0-WindowsClient.pak";//Asset registry is always in pakchunk0 coz ue4 moment
            asset.Search    = new string[1] {
                $""
            };
            asset.Replace = new string[1] {
                $""
            };
            CurrentCID.Asset = new Asset[1] {
                asset
            };

            if (global.allskins == null)
            {
                SkinSearch.Root allitems = new();
                download : double TimeNow = global.GetEpochTime();
                if (global.CurrentConfig.LobbyLastOpened + 86400 < TimeNow)
                {
                    //More than 24hrs have passed
                    allitems = msgpack.MsgPacklz4 <SkinSearch.Root>($"{api.FNAPIEndpoint}v2/cosmetics/br?responseFormat=msgpack_lz4&responseOptions=ignore_null");
                    File.WriteAllText(FNCosmeticsPath, JsonConvert.SerializeObject(allitems));
                    global.CurrentConfig.LobbyLastOpened = TimeNow;
                    global.SaveConfig();
                }
                else
                {
                    if (!File.Exists(FNCosmeticsPath))
                    {
                        global.CurrentConfig.LobbyLastOpened = 0;
                        goto download;
                    }
                    allitems = JsonConvert.DeserializeObject <SkinSearch.Root>(File.ReadAllText(FNCosmeticsPath));
                }


                global.allskins      = new SkinSearch.Root();
                global.allskins.data = allitems.data.Where(x => CIDSelection.actuallyUsingBackends.Any(x.type.backendValue.Equals)).ToArray();
            }
            splash.Invoke(new Action(() => { splash.Close(); }));
        }
Exemple #2
0
        private static void Main()
        {
            try
            {
                //Kill duplicate Pro Swapper's
                Process CurrentProc = Process.GetCurrentProcess();
                foreach (Process proc in Process.GetProcessesByName(CurrentProc.ProcessName))
                {
                    if (proc.Id != CurrentProc.Id)
                    {
                        proc.Kill();
                    }
                }


                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                Directory.CreateDirectory(global.ProSwapperFolder + "\\Config");
                Directory.CreateDirectory(global.ProSwapperFolder + "\\Images");
                global.InitConfig();
                logger = new Logger.Logger(global.ProSwapperFolder + "Pro_Swapper.log");
                logger.Log($"Pro Swapper Version: {global.version}");
                UI.Splash splash = new UI.Splash();
                Task.Run(() => Application.Run(splash));
                logger.Log("Started Splash Screen");

                if (!File.Exists(global.CurrentConfig.Paks + @"\pakchunk0-WindowsClient.sig"))
                {
                    logger.Log("Fortnite paks have not been found! Searching for paks now");
                    if (EpicGamesLauncher.FindPakFiles() && global.CurrentConfig.Paks.Contains("Paks"))
                    {
                        logger.Log($"Found paks folder -> {global.CurrentConfig.Paks}");
                    }
                    else
                    {
                        logger.Log($"ERROR -> Paks folder could not be found!");
                        MessageBox.Show("Your Fortnite install location could not be found! Please make sure you have Fortnite installed!", "Pro Swapper", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                }
                logger.Log(global.GetPaksList);

                if (!File.Exists(oodledll))
                {
                    if (EpicGamesLauncher.GetOodleDll(out string oodleFilePath))
                    {
                        File.Copy(oodleFilePath, oodledll);
                        logger.Log($"Copied {oodledll} from {oodleFilePath}!");
                    }
                    else
                    {
                        File.WriteAllBytes(oodledll, new WebClient().DownloadData("https://cdn.proswapper.xyz/oo2core_5_win64.dll"));
                        logger.Log($"Downloaded {oodledll} from Pro Swapper cdn. ??? Not found in user's game files");
                    }
                }
                else
                {
                    logger.Log($"{oodledll} already exists so no need to fetch it!");
                }
                logger.Log("Running main form");
                Application.Run(new Main(splash));
            }
            catch (Exception ex)
            {
                logger.LogError(ex.Message);
            }
        }
Exemple #3
0
        public Main(UI.Splash splash)
        {
            InitializeComponent();
            Mainform = this;
            try
            {
                api.UpdateAPI();
                string apiversion = api.apidata.version;
                double TimeNow    = global.GetEpochTime();

                if (global.CurrentConfig.lastopened + 7200 < TimeNow)
                {
                    global.OpenUrl(api.apidata.discordurl);
                    global.CurrentConfig.lastopened = TimeNow;
                }

                int thisVer = int.Parse(global.version.Replace(".", ""));
                int apiVer  = int.Parse(api.apidata.version.Replace(".", ""));

                const string NewDownload = "https://linkvertise.com/86737/proswapper";

                if (apiVer > thisVer)
                {
                    MessageBox.Show("New Pro Swapper Update found! Redirecting you to the new download!", "Pro Swapper Update", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    global.OpenUrl(NewDownload);
                    Cleanup();
                }

                if (global.IsNameModified())
                {
                    ThrowError($"This Pro Swapper version has been renamed, this means you have not downloaded it from the official source. Please redownload it on the Discord server at {api.apidata.discordurl}");
                    global.OpenUrl(NewDownload);
                }

                if (api.apidata.status[0].IsUp == false)
                {
                    ThrowError(api.apidata.status[0].DownMsg);
                }

                Color[] theme = global.CurrentConfig.theme;
                global.MainMenu  = theme[0];
                global.ItemsBG   = theme[1];
                global.Button    = theme[2];
                global.TextColor = theme[3];
                RPC.InitializeRPC();

                Icon              = appIcon;
                Region            = Region.FromHrgn(CreateRoundRectRgn(0, 0, Width, Height, 30, 30));
                versionlabel.Text = global.version;

                panelContainer.Controls.Add(Dashboard.Instance);
                Control.ControlCollection MenuButtons = Controls["panel1"].Controls;
                for (int i = 0; i < MenuButtons.Count; i++)
                {
                    if (MenuButtons[i].GetType().Name == "BunifuFlatButton" && MenuButtons[i].Tag.Equals("TabButton"))
                    {
                        BunifuFlatButton btn = (BunifuFlatButton)MenuButtons[i];
                        btn.BackColor = btn.Normalcolor = btn.OnHovercolor = btn.Activecolor = global.Button;
                        btn.Textcolor = btn.OnHoverTextColor = global.TextColor;
                        if (btn.Text == "Settings")
                        {
                            continue;
                        }

                        btn.Click += delegate
                        {
                            NewPanel(btn.Text);
                        };
                    }
                }

                BackColor              = global.MainMenu;
                panel1.BackColor       = global.MainMenu;
                versionlabel.ForeColor = global.TextColor;
                global.SaveConfig();
                splash.Invoke(new Action(() => { splash.Close(); }));
            }
            catch (Exception ex)
            {
                Program.logger.LogError(ex.Message);
                ThrowError($"Source: {ex.Source} | Message: {ex.Message} | Stack Trace: {ex.StackTrace}", true);
            }
        }
Exemple #4
0
 private void pictureBox2_Click_1(object sender, EventArgs e)
 {
     UI.Splash splash = new UI.Splash();
     Task.Run(() => Application.Run(splash));
     new Lobby(splash).Show();
 }