Beispiel #1
0
        static void SaveImages()
        {
            CheckInstalledGames checkInstalledGames = new CheckInstalledGames();

            foreach (Game game in checkInstalledGames.GetAllGames())
            {
                if (!String.IsNullOrEmpty(game.ID))
                {
                    Directory.CreateDirectory(Application.StartupPath + "\\images");
                    Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("ArcadeLauncher.Resources." + game.ID + ".jpg");
                    using (var fileStream = File.Create(Application.StartupPath + "\\images\\" + game.ID + ".jpg"))
                    {
                        stream.Seek(0, SeekOrigin.Begin);
                        stream.CopyTo(fileStream);
                    }
                }
            }
            Stream stream2 = Assembly.GetExecutingAssembly().GetManifestResourceStream("ArcadeLauncher.Resources.login.png");

            using (var fileStream = File.Create(Application.StartupPath + "\\images\\login.png"))
            {
                stream2.Seek(0, SeekOrigin.Begin);
                stream2.CopyTo(fileStream);
            }
        }
Beispiel #2
0
        public string GenerateInstalledGamesPage()
        {
            CheckInstalledGames checkInstalledGames = new CheckInstalledGames();

            string games = "";

            Game[] installedGames = checkInstalledGames.GetInstalledGames();

            foreach (var item in installedGames.Select((value, i) => new { i, value }))
            {
                /*if (item.i % 4 == 0 && item.i > 0)
                 * {
                 *  string nextRow = @"
                 * </div>
                 * <br>
                 * <div class=""row"">
                 * ";
                 *  games = games + nextRow + GenerateInstalledGameHTML(item.value.Name, item.value.ID);
                 * }
                 * else
                 * {
                 *  games = games + GenerateInstalledGameHTML(item.value.Name, item.value.ID);
                 * }*/
                games = games + GenerateInstalledGameHTML(item.value.Name, item.value.ID);
            }

            string title = @"
            <script>document.getElementById(""installed"").style.color = ""white"";</script>
            
			<div class=""row"">
";

            return(getHTML("Start") + title + games + getHTML("End"));
        }
        public async void Uninstall(string gameName)
        {
            MainWindow          mainWindow          = Application.OpenForms["MainWindow"] as MainWindow;
            CheckInstalledGames checkInstalledGames = new CheckInstalledGames();

            foreach (Game game in checkInstalledGames.GetAllGames())
            {
                if (game.ID == gameName)
                {
                    if (MessageBox.Show("Are you sure you want to uninstall " + game.Name + " ?", "", MessageBoxButtons.YesNo) == DialogResult.Yes)
                    {
                        mainWindow.UninstallGame(Properties.Settings.Default.InstallPath + "\\" + game.Name);
                    }
                    else
                    {
                    }
                }
            }
        }
        public async void Install(string gameName)
        {
            MainWindow mainWindow = Application.OpenForms["MainWindow"] as MainWindow;

            mainWindow.guna2Panel2.Invoke(new Action(() => mainWindow.guna2Panel2.Show()));
            CheckInstalledGames checkInstalledGames = new CheckInstalledGames();

            foreach (Game game in checkInstalledGames.GetAllGames())
            {
                if (game.ID == gameName)
                {
                    gameDownloader.Download(game.RemotePath, Properties.Settings.Default.InstallPath);

                    //MessageBox.Show("Installation concluded");
                    //mainWindow.guna2Panel2.Invoke(new Action(() => mainWindow.guna2Panel2.Hide()));

                    //mainWindow.InstallGame(game.RemotePath, Properties.Settings.Default.InstallPath);

                    //gameDownloader.DownloadAsync(game.RemotePath, Properties.Settings.Default.InstallPath, mainWindow.cancellationTokenSource);
                }
            }
        }
        public async void Play(string gameName)
        {
            CheckInstalledGames checkInstalledGames = new CheckInstalledGames();

            foreach (Game game in checkInstalledGames.GetAllGames())
            {
                if (game.ID == gameName)
                {
                    Process.Start(Properties.Settings.Default.InstallPath + game.EXEPath);

                    /*Discord.Discord discord = new Discord.Discord(828327510344859678, (ulong)Discord.CreateFlags.Default);
                     *
                     * discord.SetLogHook(Discord.LogLevel.Debug, (level, message) =>
                     * {
                     *  MessageBox.Show($"Log[{level}] {message}");
                     * });
                     *
                     * var applicationManager = discord.GetApplicationManager();
                     * // Get the current locale. This can be used to determine what text or audio the user wants.
                     * MessageBox.Show($"Current Locale: {applicationManager.GetCurrentLocale()}");
                     * // Get the current branch. For example alpha or beta.
                     * MessageBox.Show($"Current Branch: {applicationManager.GetCurrentBranch()}");
                     *
                     * var userManager = discord.GetUserManager();
                     * // The auth manager fires events as information about the current user changes.
                     * // This event will fire once on init.
                     * //
                     * // GetCurrentUser will error until this fires once.
                     * userManager.OnCurrentUserUpdate += () =>
                     * {
                     *  var currentUser = userManager.GetCurrentUser();
                     *  MessageBox.Show(currentUser.Username);
                     *  MessageBox.Show(currentUser.Id.ToString());
                     * };
                     *
                     * // If you store Discord user ids in a central place like a leaderboard and want to render them.
                     * // The users manager can be used to fetch arbitrary Discord users. This only provides basic
                     * // information and does not automatically update like relationships.
                     * userManager.GetUser(4444444444444, (Discord.Result result, ref Discord.User user) =>
                     * {
                     *  if (result == Discord.Result.Ok)
                     *  {
                     *      MessageBox.Show($"user fetched: {user.Username}");
                     *  }
                     *  else
                     *  {
                     *      MessageBox.Show($"user fetch error: {result}");
                     *  }
                     * });
                     *
                     * var activityManager = discord.GetActivityManager();
                     *
                     * var activity = new Discord.Activity
                     * {
                     *  State = "olleh",
                     *  Details = "foo details",
                     *  Timestamps =
                     * {
                     * Start = 5,
                     * End = 6,
                     * },
                     *  Assets =
                     * {
                     * LargeImage = "foo largeImageKey",
                     * LargeText = "foo largeImageText",
                     * SmallImage = "foo smallImageKey",
                     * SmallText = "foo smallImageText",
                     * },
                     *  Party = {
                     * Id = "1234",
                     * Size = {
                     * CurrentSize = 4,
                     * MaxSize = 4,
                     * },
                     * },
                     *  Secrets = {
                     * Join = "1221213122321",
                     * },
                     *  Instance = true,
                     * };
                     *
                     * activityManager.UpdateActivity(activity, result =>
                     * {
                     *  MessageBox.Show($"Update Activity {result}");
                     *
                     *  // Send an invite to another user for this activity.
                     *  // Receiver should see an invite in their DM.
                     *  // Use a relationship user's ID for this.
                     *  // activityManager
                     *  //   .SendInvite(
                     *  //       364843917537050624,
                     *  //       Discord.ActivityActionType.Join,
                     *  //       "",
                     *  //       inviteResult =>
                     *  //       {
                     *  //           Console.WriteLine("Invite {0}", inviteResult);
                     *  //       }
                     *  //   );
                     * });*/
                }
            }
        }