Ejemplo n.º 1
0
        internal LoginCommands ReadQueueFromText(string text, bool global, int optionalWaitTimeMs = -1)
        {
            var loginCommands = new LoginCommands();
            var settings      = (new SettingsFileLoader()).ReadSettingsFromText(text);

            if (optionalWaitTimeMs != -1)
            {
                loginCommands.WaitMillisencds = optionalWaitTimeMs;
            }
            else
            {
                loginCommands.WaitMillisencds = int.Parse(settings.GetValue("WaitMilliseconds").SingleValue);
            }
            int count = -1;

            if (settings.ContainsKey("CommandCount"))
            {
                count = int.Parse(settings.GetValue("CommandCount").SingleValue);
            }
            else
            {
                count = settings.Count;
            }
            for (int i = 0; i < count; ++i)
            {
                string cmd = settings.GetValue(string.Format("Command{0}", i)).SingleValue;
                if (!string.IsNullOrEmpty(cmd))
                {
                    log.WriteInfo("cmd: '" + cmd + "'");
                }
                loginCommands.Commands.Enqueue(cmd);
            }
            return(loginCommands);
        }
Ejemplo n.º 2
0
        private static LoginCommands ParseCommandsFromText(string text)
        {
            var cmds = new LoginCommands();

            foreach (var line in SplitLines(text))
            {
                cmds.Commands.Enqueue(line);
            }
            return(cmds);
        }
Ejemplo n.º 3
0
        internal LoginCommands ReadQueue(bool global)
        {
            var    loginCommands = new LoginCommands();
            string filepath      = GetFilepath(global);

            if (File.Exists(filepath))
            {
                string contents = File.ReadAllText(filepath);
                var    cmds     = ReadQueueFromText(contents, global);
                return(cmds);
            }
            return(loginCommands);
        }
Ejemplo n.º 4
0
        internal void WriteQueue(LoginCommands loginCommands, bool global)
        {
            string filepath = GetFilepath(global);

            using (var file = new StreamWriter(filepath, append: false))
            {
                file.WriteLine("WaitMilliseconds:{0}", loginCommands.GetInternalWaitValue());
                file.WriteLine("CommandCount:{0}", loginCommands.Commands.Count);
                int i = 0;
                foreach (string cmd in loginCommands.Commands)
                {
                    file.WriteLine("Command{0}:{1}", i, cmd);
                    ++i;
                }
            }
        }
Ejemplo n.º 5
0
        public void FilterCore_ClientDispatch(object sender, NetworkMessageEventArgs e)
        {
            if (e.Message.Type == 0xF7C8) // Enter Game
            {
                freshLogin = true;
            }

            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;

                string characterName = GameRepo.Game.Character;
                if (string.IsNullOrEmpty(characterName))
                {
                    // Do not know why GameRepo.Game.Character is not yet populated, but it isn't
                    var launchInfo = LaunchControl.GetLaunchInfo();
                    if (launchInfo.IsValid)
                    {
                        characterName = launchInfo.CharacterName;
                    }
                }

                var persister = new LoginCommandPersister(GameRepo.Game.Account, GameRepo.Game.Server, characterName);

                log.WriteDebug("FilterCore_ClientDispatch: Character: '{0}'", GameRepo.Game.Character);

                _loginCmds = persister.ReadAndCombineQueues();

                if (_loginCmds.Commands.Count > 0)
                {
                    loginCompleteTime = DateTime.Now;

                    sendingLastEnter = false;
                    CoreManager.Current.RenderFrame += new EventHandler <EventArgs>(Current_RenderFrame);
                }
            }
        }