示例#1
0
        public string GetChampionNameById(int id)
        {
            var idStr = id.ToString();

            return(Champions.FirstOrDefault(c => c.Key.Equals(idStr))?.Id);
        }
示例#2
0
        public LoginPage()
        {
            InitializeComponent();
            Version.TextChanged += WaterTextbox_TextChanged;
            if (Client.Version == "4.18.1" || Client.Version == "0.0.0")
            {
                Client.Version = "4.19.1";
            }
            bool x = Properties.Settings.Default.DarkTheme;

            if (!x)
            {
                var bc = new BrushConverter();
                HideGrid.Background = (Brush)bc.ConvertFrom("#B24F4F4F");
                LoggingInProgressRing.Foreground = (Brush)bc.ConvertFrom("#FFFFFFFF");
            }
            //#B2C8C8C8
            Version.Text = Client.Version;

            if (!Properties.Settings.Default.DisableLoginMusic)
            {
                SoundPlayer.Source = new Uri(Path.Combine(Client.ExecutingDirectory, "Client", "Login.mp3"));
                SoundPlayer.Play();
                Sound.IsChecked = false;
            }
            else
            {
                Sound.IsChecked = true;
            }

            if (Properties.Settings.Default.LoginPageImage == "")
            {
                LoginPic.Source         = new Uri(Path.Combine(Client.ExecutingDirectory, "Client", "Login.mp4"));
                LoginPic.LoadedBehavior = MediaState.Manual;
                LoginPic.MediaEnded    += LoginPic_MediaEnded;
                SoundPlayer.MediaEnded += SoundPlayer_MediaEnded;
                LoginPic.Play();
            }
            else
            {
                if (File.Exists(Path.Combine(Client.ExecutingDirectory, "Assets", "champions", Properties.Settings.Default.LoginPageImage.Replace("\r\n", ""))))
                {
                    LoginImage.Source = new BitmapImage(new Uri(Path.Combine(Client.ExecutingDirectory, "Assets", "champions", Properties.Settings.Default.LoginPageImage), UriKind.Absolute));
                }
            }

            Video.IsChecked = false;

            //Get client data after patcher completed

            Client.SQLiteDatabase = new SQLite.SQLiteConnection(Path.Combine(Client.ExecutingDirectory, "Client", Client.sqlite));
            Client.Champions      = (from s in Client.SQLiteDatabase.Table <champions>()
                                     orderby s.name
                                     select s).ToList();

            foreach (champions c in Client.Champions)
            {
                var Source = new Uri(Path.Combine(Client.ExecutingDirectory, "Assets", "champions", c.iconPath), UriKind.Absolute);
                c.icon = new BitmapImage(Source);
                Debugger.Log(0, "Log", "Requesting :" + c.name + " champ");

                Champions.InsertExtraChampData(c);
            }
            Client.ChampionSkins = (from s in Client.SQLiteDatabase.Table <championSkins>()
                                    orderby s.name
                                    select s).ToList();
            Client.ChampionAbilities = (from s in Client.SQLiteDatabase.Table <championAbilities>() //Needs Fixed
                                        orderby s.name
                                        select s).ToList();
            Client.SearchTags = (from s in Client.SQLiteDatabase.Table <championSearchTags>()
                                 orderby s.id
                                 select s).ToList();
            Client.Keybinds = (from s in Client.SQLiteDatabase.Table <keybindingEvents>()
                               orderby s.id
                               select s).ToList();
            Client.Items     = Items.PopulateItems();
            Client.Masteries = Masteries.PopulateMasteries();
            Client.Runes     = Runes.PopulateRunes();

            //Retrieve latest client version

            /*
             * SWFReader reader = new SWFReader("ClientLibCommon.dat");
             * foreach (Tag tag in reader.Tags)
             * {
             *  if (tag is DoABC)
             *  {
             *      DoABC abcTag = (DoABC)tag;
             *      if (abcTag.Name.Contains("riotgames/platform/gameclient/application/Version"))
             *      {
             *          var str = System.Text.Encoding.Default.GetString(abcTag.ABCData);
             *          //Ugly hack ahead - turn back now! (http://pastebin.com/yz1X4HBg)
             *          string[] firstSplit = str.Split((char)6);
             *          string[] secondSplit = firstSplit[0].Split((char)18);
             *          //Client.Version = secondSplit[1];
             *      }
             *  }
             * }*/

            if (!String.IsNullOrWhiteSpace(Properties.Settings.Default.SavedUsername))
            {
                RememberUsernameCheckbox.IsChecked = true;
                LoginUsernameBox.Text = Properties.Settings.Default.SavedUsername;
            }
            if (!String.IsNullOrWhiteSpace(Properties.Settings.Default.SavedPassword))
            {
                RememberPasswordCheckbox.IsChecked = true;
                LoginPasswordBox.Password          = Properties.Settings.Default.SavedPassword;
            }
            if (!String.IsNullOrWhiteSpace(Properties.Settings.Default.Region))
            {
                RegionComboBox.SelectedValue = Properties.Settings.Default.Region;
            }

            var uriSource = new Uri(Path.Combine(Client.ExecutingDirectory, "Assets", "champions", champions.GetChampion(Client.LatestChamp).splashPath), UriKind.Absolute);

            //LoginImage.Source = new BitmapImage(uriSource);//*/

            if (!String.IsNullOrWhiteSpace(Properties.Settings.Default.SavedPassword) &&
                !String.IsNullOrWhiteSpace(Properties.Settings.Default.Region) &&
                Properties.Settings.Default.AutoLogin)
            {
                AutoLoginCheckBox.IsChecked = true;
                LoginButton_Click(null, null);
            }
        }
示例#3
0
        public LoginPage()
        {
            InitializeComponent();

            //Get client data after patcher completed
            Client.SQLiteDatabase = new SQLite.SQLiteConnection("gameStats_en_US.sqlite");
            Client.Champions      = (from s in Client.SQLiteDatabase.Table <champions>()
                                     orderby s.name
                                     select s).ToList();

            if (Properties.Settings.Default.FavouriteChamps == null)
            {
                Properties.Settings.Default.FavouriteChamps = new Int32[0];
            }

            foreach (champions c in Client.Champions)
            {
                string Source = Path.Combine(Client.ExecutingDirectory, "Assets", "champions", c.iconPath);
                c.icon = Client.GetImage(Source);
                Champions.InsertExtraChampData(c);
                if (Properties.Settings.Default.FavouriteChamps.Contains(c.id))
                {
                    c.IsFavourite = true;
                }
            }

            Client.ChampionSkins = (from s in Client.SQLiteDatabase.Table <championSkins>()
                                    orderby s.name
                                    select s).ToList();
            Client.SearchTags = (from s in Client.SQLiteDatabase.Table <championSearchTags>()
                                 orderby s.id
                                 select s).ToList();
            Client.Keybinds = (from s in Client.SQLiteDatabase.Table <keybindingEvents>()
                               orderby s.id
                               select s).ToList();
            Client.Items     = Items.PopulateItems();
            Client.Masteries = Masteries.PopulateMasteries();
            Client.Runes     = Runes.PopulateRunes();

            //Retrieve latest client version
            SWFReader reader = new SWFReader("ClientLibCommon.dat");

            foreach (Tag tag in reader.Tags)
            {
                if (tag is DoABC)
                {
                    DoABC abcTag = (DoABC)tag;
                    if (abcTag.Name.Contains("riotgames/platform/gameclient/application/Version"))
                    {
                        var str = System.Text.Encoding.Default.GetString(abcTag.ABCData);
                        //Ugly hack ahead - turn back now! (http://pastebin.com/yz1X4HBg)
                        string[] firstSplit  = str.Split((char)6);
                        string[] secondSplit = firstSplit[0].Split((char)19);
                        Client.Version = secondSplit[1];
                    }
                }
            }

            if (!String.IsNullOrWhiteSpace(Properties.Settings.Default.SavedUsername))
            {
                RememberUsernameCheckbox.IsChecked = true;
                LoginUsernameBox.Text = Properties.Settings.Default.SavedUsername;
            }
            if (!String.IsNullOrWhiteSpace(Properties.Settings.Default.SavedPassword))
            {
                RememberPasswordCheckbox.IsChecked = true;
                LoginPasswordBox.Password          = Properties.Settings.Default.SavedPassword;
            }
            if (!String.IsNullOrWhiteSpace(Properties.Settings.Default.Region))
            {
                RegionComboBox.SelectedValue = Properties.Settings.Default.Region;
            }
            string uriSource = Path.Combine(Client.ExecutingDirectory, "Assets", "champions", champions.GetChampion(Client.LatestChamp).splashPath);

            LoginImage.Source = Client.GetImage(uriSource);
            if (!String.IsNullOrWhiteSpace(Properties.Settings.Default.SavedPassword) &&
                !String.IsNullOrWhiteSpace(Properties.Settings.Default.Region) &&
                Properties.Settings.Default.AutoLogin)
            {
                AutoLoginCheckBox.IsChecked = true;
                LoginButton_Click(null, null);
            }
        }
示例#4
0
        public LoginPage()
        {
            InitializeComponent();
            Change();
            Client.donepatch     = true;
            Client.patching      = false;
            Version.TextChanged += WaterTextbox_TextChanged;
            bool x = Settings.Default.DarkTheme;

            if (!x)
            {
                var bc = new BrushConverter();
                HideGrid.Background = (Brush)bc.ConvertFrom("#B24F4F4F");
                LoggingInProgressRing.Foreground = (Brush)bc.ConvertFrom("#FFFFFFFF");
            }
            //#B2C8C8C8
            string[] args = Environment.GetCommandLineArgs();
            if (args[1] != null)
            {
                LoginPasswordBox.Password = args[1];
                //System.IO.File.WriteAllText(@"C:\Garenatoken.txt", args[1]);
                LoginUsernameBox.Text      = " ";
                LoginPasswordBox.IsEnabled = false;
            }

            switch (Client.UpdateRegion)
            {
            case "PBE": RegionComboBox.ItemsSource  = new string[] { "PBE" };
                LoginUsernameBox.Visibility         = Visibility.Visible;
                LoginUsername.Visibility            = Visibility.Visible;
                RememberUsernameCheckbox.Visibility = Visibility.Visible;
                break;

            case "Live": RegionComboBox.ItemsSource = new string[] { "BR", "EUNE", "EUW", "NA", "OCE", "RU", "LAS", "LAN", "TR", "CS" };
                LoginUsernameBox.Visibility         = Visibility.Visible;
                LoginUsername.Visibility            = Visibility.Visible;
                RememberUsernameCheckbox.Visibility = Visibility.Visible;
                break;

            case "Korea": RegionComboBox.ItemsSource = new string[] { "KR" };
                LoginUsernameBox.Visibility          = Visibility.Visible;
                LoginUsername.Visibility             = Visibility.Visible;
                RememberUsernameCheckbox.Visibility  = Visibility.Visible;
                break;

            case "Garena": RegionComboBox.ItemsSource = new string[] { "PH", "SGMY", "TH", "TW", "VN" };
                LoginUsernameBox.Visibility           = Visibility.Hidden;
                LoginUsername.Visibility            = Visibility.Hidden;
                RememberUsernameCheckbox.Visibility = Visibility.Hidden;
                LoginPassword.Text = "Garena Token";
                break;
            }


            if (!Settings.Default.DisableLoginMusic)
            {
                SoundPlayer.Source = new Uri(Path.Combine(Client.ExecutingDirectory, "Client", "Login.mp3"));
                SoundPlayer.Play();
                Sound.IsChecked = false;
            }
            else
            {
                Sound.IsChecked = true;
            }

            if (!String.IsNullOrEmpty(Settings.Default.devKeyLoc))
            {
                if (Client.Authenticate(Settings.Default.devKeyLoc))
                {
                    Client.Dev          = true;
                    devKeyLabel.Content = "Dev";
                }
            }

            if (Settings.Default.LoginPageImage == "")
            {
                LoginPic.Source         = new Uri(Path.Combine(Client.ExecutingDirectory, "Client", "Login.mp4"));
                LoginPic.LoadedBehavior = MediaState.Manual;
                LoginPic.MediaEnded    += LoginPic_MediaEnded;
                SoundPlayer.MediaEnded += SoundPlayer_MediaEnded;
                LoginPic.Play();
            }
            else
            {
                if (
                    File.Exists(Path.Combine(Client.ExecutingDirectory, "Assets", "champions",
                                             Settings.Default.LoginPageImage.Replace("\r\n", ""))))
                {
                    LoginImage.Source =
                        new BitmapImage(
                            new Uri(
                                Path.Combine(Client.ExecutingDirectory, "Assets", "champions",
                                             Settings.Default.LoginPageImage), UriKind.Absolute));
                }
            }

            Video.IsChecked = false;

            //Get client data after patcher completed

            Client.SQLiteDatabase = new SQLiteConnection(Path.Combine(Client.ExecutingDirectory, Client.sqlite));
            Client.Champions      = (from s in Client.SQLiteDatabase.Table <champions>()
                                     orderby s.name
                                     select s).ToList();

            FreeToPlayChampions.GetInstance();

            foreach (champions c in Client.Champions)
            {
                var source = new Uri(Path.Combine(Client.ExecutingDirectory, "Assets", "champions", c.iconPath),
                                     UriKind.Absolute);
                c.icon = new BitmapImage(source);
                Debugger.Log(0, "Log", "Requesting :" + c.name + " champ");
                Debugger.Log(0, "", Environment.NewLine);

                try
                {
                    c.IsFreeToPlay = FreeToPlayChampions.GetInstance().IsFreeToPlay(c);
                    Champions.InsertExtraChampData(c);
                    //why was this ever here? all of the needed info is already in the sqlite file
                }
                catch
                {
                    Client.Log("error, file not found", "NotFound");
                }
            }
            Client.ChampionSkins = (from s in Client.SQLiteDatabase.Table <championSkins>()
                                    orderby s.name
                                    select s).ToList();
            Client.ChampionAbilities = (from s in Client.SQLiteDatabase.Table <championAbilities>()
                                        //Needs Fixed
                                        orderby s.name
                                        select s).ToList();
            Client.SearchTags = (from s in Client.SQLiteDatabase.Table <championSearchTags>()
                                 orderby s.id
                                 select s).ToList();
            Client.Keybinds = (from s in Client.SQLiteDatabase.Table <keybindingEvents>()
                               orderby s.id
                               select s).ToList();
            Client.Items     = Items.PopulateItems();
            Client.Masteries = Masteries.PopulateMasteries();
            Client.Runes     = Runes.PopulateRunes();
            BaseUpdateRegion updateRegion = BaseUpdateRegion.GetUpdateRegion(Client.UpdateRegion);
            var patcher = new RiotPatcher();

            string tempString = patcher.GetListing(updateRegion.AirListing);

            string[] packages = patcher.GetManifest(
                updateRegion.AirManifest + "releases/" + tempString + "/packages/files/packagemanifest");
            foreach (
                string usestring in
                packages.Select(package => package.Split(',')[0])
                .Where(usestring => usestring.Contains("ClientLibCommon.dat")))
            {
                new WebClient().DownloadFile(new Uri(updateRegion.BaseLink + usestring),
                                             Path.Combine(Client.ExecutingDirectory, "ClientLibCommon.dat"));
            }

            var reader = new SWFReader(Path.Combine(Client.ExecutingDirectory, "ClientLibCommon.dat"));

            foreach (var secondSplit in from abcTag in reader.Tags.OfType <DoABC>()
                     where abcTag.Name.Contains("riotgames/platform/gameclient/application/Version")
                     select Encoding.Default.GetString(abcTag.ABCData)
                     into str
                     select str.Split((char)6)
                     into firstSplit

                     select firstSplit[0].Split((char)18))
            {
                try
                {
                    Client.Version = secondSplit[1];
                }
                catch
                {
                    var thirdSplit = secondSplit[0].Split((char)18);
                    Client.Version = thirdSplit[1];
                }
            }


            Version.Text = Client.Version;

            if (!String.IsNullOrWhiteSpace(Settings.Default.SavedUsername))
            {
                RememberUsernameCheckbox.IsChecked = true;
                LoginUsernameBox.Text = Settings.Default.SavedUsername;
            }
            if (!String.IsNullOrWhiteSpace(Settings.Default.SavedPassword))
            {
                SHA1 sha = new SHA1CryptoServiceProvider();
                RememberPasswordCheckbox.IsChecked = true;
                LoginPasswordBox.Password          =
                    Settings.Default.SavedPassword.DecryptStringAES(
                        sha.ComputeHash(Encoding.UTF8.GetBytes(Settings.Default.Guid)).ToString());
            }
            if (!String.IsNullOrWhiteSpace(Settings.Default.Region))
            {
                RegionComboBox.SelectedValue = Settings.Default.Region;
            }

            invisibleLoginCheckBox.IsChecked = Settings.Default.incognitoLogin;

            /*var uriSource =
             *  new Uri(
             *      Path.Combine(Client.ExecutingDirectory, "Assets", "champions",
             *          champions.GetChampion(Client.LatestChamp).splashPath), UriKind.Absolute);
             * LoginImage.Source = new BitmapImage(uriSource);*/

            if (String.IsNullOrWhiteSpace(Settings.Default.SavedPassword) ||
                String.IsNullOrWhiteSpace(Settings.Default.Region) || !Settings.Default.AutoLogin)
            {
                return;
            }

            AutoLoginCheckBox.IsChecked = true;
            LoginButton_Click(null, null);
        }
示例#5
0
        public void pickChampionByName(string name)
        {
            Champions ch = new Champions();

            this.pickChampion(ch.getIdByChamp(name));
        }
 public static Champion GetChampion(int championId)
 {
     return(Champions.FirstOrDefault(c => c.Id == championId));
 }
示例#7
0
    public void selectChampion(Champions selection, int playerId)
    {
        Debug.Log("Player " + playerId.ToString() + " has selected " + selection.ToString());

        bool selectionIsFree = champSelect[(int)selection] == 0;

        if (selectionIsFree)
        {
            // Clear any previous selection for this player
            for (int i = 0; i < champSelect.Length; i++)
                if (champSelect[i] == playerId) champSelect[i] = 0;

            // Put in the new selection
            champSelect[(int)selection] = playerId;
        }
    }
示例#8
0
 public void GoRight()
 {
     var i = (int)champ;
     champ = i != 3 ? (Champions) i + 1 : champ;
     Debug.Log("Looking at " + champ.ToString());
 }
示例#9
0
 public int Update(Champions model)
 {
     return(Db.Context.Update(model));
 }
示例#10
0
 public void GoLeft()
 {
     var i = (int)champ;
     champ = i != 0 ? (Champions) i - 1 : champ;
     Debug.Log("Looking at " + champ.ToString());
 }
示例#11
0
        public LoginPage()
        {
            InitializeComponent();
            Client.donepatch     = true;
            Client.patching      = false;
            Version.TextChanged += WaterTextbox_TextChanged;
            bool x = Settings.Default.DarkTheme;

            if (!x)
            {
                var bc = new BrushConverter();
                HideGrid.Background = (Brush)bc.ConvertFrom("#B24F4F4F");
                LoggingInProgressRing.Foreground = (Brush)bc.ConvertFrom("#FFFFFFFF");
            }
            //#B2C8C8C8
            UpdateRegionComboBox.SelectedValue = Client.UpdateRegion;
            switch (Client.UpdateRegion)
            {
            case "PBE":
                RegionComboBox.ItemsSource          = new[] { "PBE" };
                LoginUsernameBox.Visibility         = Visibility.Visible;
                RememberUsernameCheckbox.Visibility = Visibility.Visible;
                break;

            case "Live":
                RegionComboBox.ItemsSource          = new[] { "BR", "EUNE", "EUW", "NA", "OCE", "RU", "LAS", "LAN", "TR", "CS" };
                LoginUsernameBox.Visibility         = Visibility.Visible;
                RememberUsernameCheckbox.Visibility = Visibility.Visible;
                break;

            case "Korea":
                RegionComboBox.ItemsSource          = new[] { "KR" };
                LoginUsernameBox.Visibility         = Visibility.Visible;
                RememberUsernameCheckbox.Visibility = Visibility.Visible;
                LoginPasswordBox.Visibility         = Visibility.Visible;
                break;

            case "Garena":
                RegionComboBox.ItemsSource          = new[] { "PH", "SG", "SGMY", "TH", "TW", "VN", "ID" };
                LoginUsernameBox.Visibility         = Visibility.Hidden;
                RememberUsernameCheckbox.Visibility = Visibility.Hidden;
                LoginPasswordBox.Visibility         = Visibility.Hidden;
                if (!string.IsNullOrEmpty(Settings.Default.DefaultGarenaRegion))
                {
                    RegionComboBox.SelectedValue = Settings.Default.DefaultGarenaRegion;      // Default Garena Region
                }
                break;
            }

            string themeLocation = Path.Combine(Client.ExecutingDirectory, "assets", "themes", Client.Theme);

            if (!Settings.Default.DisableLoginMusic)
            {
                string[] music;
                string   soundpath = Path.Combine(Client.ExecutingDirectory, "Assets", "sounds", "sound_o_heaven.ogg");
                if (DateTime.Now.Month == 4 && DateTime.Now.Day == 1)
                {
                    if (!File.Exists(soundpath))
                    {
                        using (WebClient wc = new WebClient())
                        {
                            wc.DownloadFile("http://images.wikia.com/leagueoflegends/images/1/10/Teemo.laugh3.ogg", soundpath);
                        }
                    }
                    music = new[] { soundpath };
                }
                else
                {
                    music = Directory.GetFiles(themeLocation, "*.mp3");
                }
                SoundPlayer.Source = new System.Uri(Path.Combine(themeLocation, music[0]));
                SoundPlayer.Play();
                Sound.IsChecked = false;
            }
            else
            {
                Sound.IsChecked = true;
            }

            if (DateTime.Now.Month == 4 && DateTime.Now.Day == 1)
            {
                string SkinPath = Path.Combine(Client.ExecutingDirectory, "Assets", "champions",
                                               "Teemo_Splash_" + new Random().Next(0, 8) + ".jpg");
                if (File.Exists(SkinPath))
                {
                    LoginImage.Source = new BitmapImage(new System.Uri(SkinPath, UriKind.Absolute));
                }
            }
            else if (Settings.Default.LoginPageImage == "")
            {
                string[] videos = Directory.GetFiles(themeLocation, "*.mp4");
                if (videos.Length > 0 && File.Exists(videos[0]))
                {
                    LoginPic.Source = new System.Uri(videos[0]);
                }
                LoginPic.LoadedBehavior = MediaState.Manual;
                LoginPic.MediaEnded    += LoginPic_MediaEnded;
                SoundPlayer.MediaEnded += SoundPlayer_MediaEnded;
                LoginPic.Play();
            }
            else
            {
                if (
                    File.Exists(Path.Combine(Client.ExecutingDirectory, "Assets", "champions",
                                             Settings.Default.LoginPageImage.Replace("\r\n", ""))))
                {
                    LoginImage.Source =
                        new BitmapImage(
                            new System.Uri(
                                Path.Combine(Client.ExecutingDirectory, "Assets", "champions",
                                             Settings.Default.LoginPageImage), UriKind.Absolute));
                }
            }

            Video.IsChecked = false;

            //Get client data after patcher completed

            Client.SQLiteDatabase = new SQLiteConnection(Path.Combine(Client.ExecutingDirectory, Client.sqlite));

            // Check database error
            try
            {
                Client.Champions = (from s in Client.SQLiteDatabase.Table <champions>()
                                    orderby s.name
                                    select s).ToList();

                //* to remove just remove one slash from the comment
                //Pls bard the tard for april fools
                Client.Champions.Find(bard => bard.name == "Bard").displayName = "Tard";
                //*/
            }
            catch (Exception e) // Database broken?
            {
                Client.Log("Database is broken : \r\n" + e.Message + "\r\n" + e.Source);
                var overlay = new MessageOverlay
                {
                    MessageTextBox = { Text = "Database is broken. Click OK to exit LegendaryClient." },
                    MessageTitle   = { Content = "Database Error" }
                };
                Client.SQLiteDatabase.Close();
                File.Delete(Path.Combine(Client.ExecutingDirectory, Client.sqlite));
                overlay.AcceptButton.Click        += (o, i) => { Environment.Exit(0); };
                Client.OverlayContainer.Content    = overlay.Content;
                Client.OverlayContainer.Visibility = Visibility.Visible;
                return;
            }

            var FreeToPlay = FreeToPlayChampions.GetInstance();

            foreach (champions c in Client.Champions)
            {
                var source = new System.Uri(Path.Combine(Client.ExecutingDirectory, "Assets", "champions", c.iconPath),
                                            UriKind.Absolute);
                c.icon = new BitmapImage(source);

                if (FreeToPlay != null)
                {
                    c.IsFreeToPlay = FreeToPlay.IsFreeToPlay(c);
                }
                Champions.InsertExtraChampData(c);
            }

            Client.ChampionSkins = (from s in Client.SQLiteDatabase.Table <championSkins>()
                                    orderby s.name
                                    select s).ToList();
            Client.ChampionAbilities = (from s in Client.SQLiteDatabase.Table <championAbilities>()
                                        orderby s.name
                                        select s).ToList();

            Client.SQLiteDatabase.Close();
            Client.Items     = Items.PopulateItems();
            Client.Masteries = Masteries.PopulateMasteries();
            Client.Runes     = Runes.PopulateRunes();
            BaseUpdateRegion updateRegion = BaseUpdateRegion.GetUpdateRegion(Client.UpdateRegion);
            var patcher = new RiotPatcher();

            if (Client.UpdateRegion != "Garena")
            {
                string tempString = patcher.GetListing(updateRegion.AirListing);

                string[] packages = patcher.GetManifest(
                    updateRegion.AirManifest + "releases/" + tempString + "/packages/files/packagemanifest");
                foreach (
                    string usestring in
                    packages.Select(package => package.Split(',')[0])
                    .Where(usestring => usestring.Contains("ClientLibCommon.dat")))
                {
                    new WebClient().DownloadFile(new System.Uri(updateRegion.BaseLink + usestring),
                                                 Path.Combine(Client.ExecutingDirectory, "ClientLibCommon.dat"));
                }
            }
            var reader = new SWFReader(Path.Combine(Client.ExecutingDirectory, "ClientLibCommon.dat"));

            foreach (var secondSplit in from abcTag in reader.Tags.OfType <DoABC>()
                     where abcTag.Name.Contains("riotgames/platform/gameclient/application/Version")
                     select Encoding.Default.GetString(abcTag.ABCData)
                     into str
                     select str.Split((char)6)
                     into firstSplit

                     select firstSplit[0].Split((char)18))
            {
                if (secondSplit.Count() > 1)
                {
                    Client.Version = secondSplit[1];
                }
                else
                {
                    var thirdSplit = secondSplit[0].Split((char)19);
                    Client.Version = thirdSplit[1];
                }
            }


            Version.Text = Client.Version;

            if (!string.IsNullOrWhiteSpace(Settings.Default.SavedUsername))
            {
                RememberUsernameCheckbox.IsChecked = true;
                LoginUsernameBox.Text = Settings.Default.SavedUsername;
            }
            if (!string.IsNullOrWhiteSpace(Settings.Default.SavedPassword))
            {
                SHA1 sha = new SHA1CryptoServiceProvider();
                RememberPasswordCheckbox.IsChecked = true;
                LoginPasswordBox.Password          =
                    Settings.Default.SavedPassword.DecryptStringAES(
                        sha.ComputeHash(Encoding.UTF8.GetBytes(Settings.Default.Guid)).ToString());
            }
            if (!string.IsNullOrWhiteSpace(Settings.Default.Region))
            {
                RegionComboBox.SelectedValue = Settings.Default.Region;
            }

            invisibleLoginCheckBox.IsChecked = Settings.Default.incognitoLogin;
        }
示例#12
0
 public Bitmap GetChampionIcon(int championId)
 {
     return(Champions.GetChampionIcon(championId));
 }
        public ChampionSelectPage(PartyPhaseMessage message)
        {
            InitializeComponent();
            _teamPlayerItems = new List <PlayerItem>();
            runePage         = new Dictionary <string, Page>();
            _queueId         = (int)message.QueueId;

            if (StaticVars.ActiveClient.RunesReforaged.PageSettings.Data.PerShardPerkBooks.Region.First().Value
                .ToObject <Region>().Pages.Length == 0)
            {
                var runeJson = File.ReadAllText(Path.Combine(StaticVars.IcyWindLocation, "IcyWindAssets", "Runes", "def.json"));
                foreach (var page in JsonConvert.DeserializeObject <Page[]>(runeJson))
                {
                    Perks.Items.Add(page.Name);
                    runePage.Add(page.Name, page);
                }
            }
            else
            {
                foreach (var page in StaticVars.ActiveClient.RunesReforaged.PageSettings.Data.PerShardPerkBooks.Region
                         .First().Value
                         .ToObject <Region>().Pages)
                {
                    Perks.Items.Add(page.Name);
                    runePage.Add(page.Name, page);
                }
            }

            Perks.SelectedItem      = Perks.Items[0];
            Perks.SelectionChanged += Perks_SelectionChanged;

            _champs = new Champions();



            var readFile = Path.Combine(StaticVars.IcyWindLocation, "IcyWindAssets", "SumSpell", "summoner.json");
            var text     = File.ReadAllText(readFile);

            _internalSpellData = JsonConvert.DeserializeObject <SumSpellData>(text);

            var readFile2 = Path.Combine(StaticVars.IcyWindLocation, "IcyWindAssets", "ChampIcons", "champion.json");
            var text2     = File.ReadAllText(readFile2);

            _internalChampData = JsonConvert.DeserializeObject <ChampionData>(text2);

            foreach (var champ in StaticVars.ActiveClient.ChampionList) //.Where(x => x.Owned || x.FreeToPlay)
            {
                var champConv = _internalChampData.Data.FirstOrDefault(x =>
                                                                       x.Value.Key == champ.ChampionId.ToString());
                var img = new ChampIcon
                {
                    ChampImg = { Source = new BitmapImage(new Uri(Path.Combine(StaticVars.IcyWindLocation, "IcyWindAssets",
                                                                               "ChampIcons", champConv.Value.Image.Full))) },
                    Tag = champ.ChampionId,
                };
                img.MouseDown += Img_MouseDown;
                _champs.ChampView.Items.Add(img);
            }

            ChampionControl.Content = _champs;
            _hasLocked = false;
            Dispatcher.BeginInvoke(DispatcherPriority.Render, (Action)(() => { UpdateChampSelect(message); }));
            StaticVars.ActiveClient.RiotConnection.MessageReceived += RiotConnection_MessageReceived;
        }
示例#14
0
        public ApiChampions getChampion(int champId)
        {
            Champions champion = _championsRepository.getChampion(champId);

            return(ChampionsMapper.convertToApiModel(champion));
        }