コード例 #1
0
        public void FilterCore_ClientDispatch(object sender, NetworkMessageEventArgs e)
        {
            if (e.Message.Type == 0xF7C8) // Enter Game
            {
                freshLogin = true;
                try
                {
                    LaunchControl.RecordLaunchResponse(DateTime.UtcNow);
                }
                catch
                {
                    log.WriteInfo("FilterCore_ClientDispatch: Exception trying to record launch response");
                }
                Heartbeat.LaunchHeartbeat();
            }

            if (freshLogin && e.Message.Type == 0xF7B1 && Convert.ToInt32(e.Message["action"]) == 0xA1)             // Character Materialize (Any time is done portalling in, login or portal)
            {
                freshLogin = false;

                if (loginMessageQueue.Count > 0)
                {
                    sendingLastEnter = false;
                    CoreManager.Current.RenderFrame += new EventHandler <EventArgs>(Current_RenderFrame);
                }
            }
        }
コード例 #2
0
        public static void WriteCharacters(string ServerName, string zonename, List <Character> characters)
        {
            var launchInfo = LaunchControl.GetLaunchInfo();

            if (!launchInfo.IsValid)
            {
                log.WriteError("LaunchInfo not valid");
                return;
            }

            if (!IsValidCharacterName(launchInfo.CharacterName))
            {
                try
                {
                    log.WriteInfo("WriteCharacters called with no character name, so writing launch response");
                    LaunchControl.RecordLaunchResponse(DateTime.UtcNow);
                }
                catch
                {
                    log.WriteError("WriteCharacters: Exception trying to record launch response");
                }
            }

            // Pass info to Heartbeat
            Heartbeat.RecordServer(launchInfo.ServerName);
            Heartbeat.RecordAccount(launchInfo.AccountName);

            string key   = GetKey(server: launchInfo.ServerName, accountName: launchInfo.AccountName);
            var    clist = new ServerCharacterListByAccount()
            {
                ZoneId        = zonename,
                CharacterList = characters
            };

            // Create a dictionary of only our characters to save
            Dictionary <string, ServerCharacterListByAccount> solodict = new Dictionary <string, ServerCharacterListByAccount>();

            solodict[key] = clist;

            string contents = JsonConvert.SerializeObject(solodict, Formatting.Indented);
            string path     = FileLocations.GetCharacterFilePath(ServerName: launchInfo.ServerName, AccountName: launchInfo.AccountName);

            using (var file = new StreamWriter(path, append: false))
            {
                file.Write(contents);
            }
        }