Esempio n. 1
0
        static public bool SendPoints(NetworkStream stream, int points)
        {
            string msg    = "{\"score\":" + points.ToString() + "}";
            var    byData = Encoding.UTF8.GetBytes(msg);
            var    bytes  = HeaderParser.Encode(Header.END, Convert.ToUInt32(byData.Length));

            stream.Write(bytes, 0, bytes.Length);
            try
            {
                stream.Write(byData, 0, byData.Length);
            }
            catch (System.IO.IOException e) { }

            var buffer      = new byte[3];
            int messageSize = stream.Read(buffer, 0, 3);
            var head        = HeaderParser.Decode(buffer);
            var buffer2     = new byte[head.Item2];

            stream.Read(buffer2, 0, buffer2.Length);
            string receive = Encoding.UTF8.GetString(buffer2);
            //string[] jsonified = new string[9];
            PersonalStats personalStats = JsonSerializer.Deserialize <PersonalStats>(receive);

            if (head.Item1 == Header.ACK)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 2
0
        static public PersonalStats GetPersonalStats(NetworkStream stream)
        {
            string msg    = "{\"msg\":\"GimmeStats\",\"category\":[]}";
            var    byData = Encoding.UTF8.GetBytes(msg);
            var    bytes  = HeaderParser.Encode(Header.STR, Convert.ToUInt32(byData.Length));

            stream.Write(bytes, 0, bytes.Length);
            try
            {
                stream.Write(byData, 0, byData.Length);
            }
            catch (System.IO.IOException e) { }

            var buffer      = new byte[3];
            int messageSize = stream.Read(buffer, 0, 3);
            var head        = HeaderParser.Decode(buffer);
            var buffer2     = new byte[head.Item2];

            stream.Read(buffer2, 0, buffer2.Length);
            string receive = Encoding.UTF8.GetString(buffer2);
            //string[] jsonified = new string[9];
            PersonalStats personalStats = JsonSerializer.Deserialize <PersonalStats>(receive);

            if (head.Item1 == Header.STA)
            {
                return(personalStats);
            }
            else
            {
                return(new PersonalStats());
            }
        }
Esempio n. 3
0
        private void loadData()
        {
            PersonalStats personalStats = QuizClient.GetPersonalStats(stream);

            for (int i = 0; i < personalStats.stats.Length; i++)
            {
                DataGridViewRow row = (DataGridViewRow)dataGridView1.Rows[0].Clone();
                row.Cells[0].Value = personalStats.stats[i].category;
                row.Cells[1].Value = personalStats.stats[i].score;
                dataGridView1.Rows.Add(row);
            }
        }
Esempio n. 4
0
        static void Main(string[] args)
        {
            Console.WriteLine($"Loading settings from {args[0]}...");
            var settings = ClassifyXml.DeserializeFile <Settings>(args[0]);

            ClassifyXml.SerializeToFile(settings, args[0]);

            Console.Write("Loading static data...");
            LeagueStaticData.Load(Path.Combine(settings.DataPath, "Static"));
            Console.WriteLine(" done");

            Console.Write("Initialising global data...");
            DataStore.Initialise(settings.DataPath, "", autoRewrites: false);
            Console.WriteLine(" done");

            if (settings.ItemsOutputPath != null)
            {
                ItemSheet.Generate(settings.ItemsOutputPath);
            }

            if (settings.ItemSetsSettings != null && settings.LeagueInstallPath != null)
            {
                ItemSets.Generate(settings.DataPath, settings.LeagueInstallPath, settings.ItemSetsSettings);
            }

            if (settings.PersonalOutputPathTemplate != null)
            {
                PersonalStats.Generate(settings.DataPath, settings.PersonalOutputPathTemplate, settings.Humans);
            }

            if (settings.EventStatsSettings != null && settings.EventStatsSettings.OutputPath != null)
            {
                new EventStats(settings.EventStatsSettings).Generate();
            }

            if (settings.SummonerRift5v5StatsSettings != null)
            {
                new SummonerRift5v5Stats(settings.SummonerRift5v5StatsSettings).Generate();
            }
        }
Esempio n. 5
0
 public ProfileInfo()
 {
     UserStats = new PersonalStats();
 }