コード例 #1
0
        public async static void OnHttpResponse(Task <HttpResponseMessage> resp, RAHttpRequest req)
        {
            //string s = await resp.Result.Content.ReadAsStringAsync();
            byte[] b = await resp.Result.Content.ReadAsByteArrayAsync();

            XmlDictionaryReader r    = JsonReaderWriterFactory.CreateJsonReader(b, new XmlDictionaryReaderQuotas());
            XElement            root = XElement.Load(r);

            switch (req.RequestType)
            {
            case WebRequest.RequestLogin:
                string User         = root.Element("User").Value;
                string Token        = root.Element("Token").Value;
                UInt64 UserScore    = Convert.ToUInt64(root.Element("Score").Value);
                UInt64 UserMessages = Convert.ToUInt64(root.Element("Messages").Value);

                Console.WriteLine("{0} is logged in, {1} points, {2} messages", User, UserScore, UserMessages);

                RACore.LocalUser.Setup(User, Token, UserScore, UserMessages);

                RAWebInterface.GetFriendList();

                RACore.EventService.CauseEvent(RAEventType.Login);

                break;

            case WebRequest.RequestFriendList:
                //  GetFriendList
                XElement friendList = root.Element("Friends");
                if (friendList != null)
                {
                    foreach (var friend in friendList.Elements())
                    {
                        string Friend         = friend.Element("Friend").Value;
                        int    FriendScore    = Convert.ToInt32(friend.Element("RAPoints").Value);
                        string FriendActivity = friend.Element("LastSeen").Value;
                        //friend;
                        Console.WriteLine("{0} ({1}): {2}", Friend, FriendScore, FriendActivity);
                    }
                }
                break;

            case WebRequest.RequestScore:

                break;

            case WebRequest.RequestPostActivity:
                //  FAF
                break;
            }
        }
コード例 #2
0
        public static void Update()
        {
            RAWebInterface.Update();
            EventService.Update();

            if (ActiveAchievementSet == RAAchievementSet.Core)
            {
                CoreAchievements.Update();
            }
            else if (ActiveAchievementSet == RAAchievementSet.Unofficial)
            {
                UnofficialAchievements.Update();
            }
            else //(ActiveAchievementSet == RAAchievementSet.Local)
            {
                LocalAchievements.Update();
            }

            //if (Global.Emulator.MemoryDomains.Count() > 0)
            //{
            //    byte nTest = Global.Emulator.MemoryDomains.ElementAt(0).PeekByte(0x0010);
            //    // Console.WriteLine(nTest);
            //}
        }