void launcherChooseCharTimer_Tick(object sender, EventArgs e) { try { // Override - instead of using the plugin xml, use the launch file var launchInfo = LaunchControl.GetLaunchInfo(); if (launchInfo.IsValid) { TimeSpan FiveMinutes = new TimeSpan(0, 0, 5, 0); if (DateTime.UtcNow - launchInfo.LaunchTime < FiveMinutes) { var ourCharacter = new DefaultFirstCharacter(launchInfo.ServerName, zonename, launchInfo.CharacterName); if (ourCharacter.ZoneId == zonename && ourCharacter.Server == server) { // Bypass movies/logos if (state == 1 || state == 2) { PostMessageTools.SendMouseClick(350, 100); } if (state == 3) { //bool ok = loginCharacterTools.CreateCharacter(); //bool ok = loginCharacterTools.LoginCharacter(ourCharacter.CharacterName); Heartbeat.RecordCharacterName(ourCharacter.CharacterName); //if (ok) //{ //} } } } else { log.WriteInfo("launcherChooseCharTimer_Tick: LaunchInfo too old: " + launchInfo.LaunchTime.ToString()); } } else { log.WriteInfo("launcherChooseCharTimer_Tick: LaunchInfo not valid"); } if (state >= 3) { launcherChooseCharTimer.Stop(); } state++; } catch (Exception ex) { Debug.LogException(ex); } }
public static void SetDefaultFirstCharacter(DefaultFirstCharacter newDefaultFirstCharacter) { SettingsFile.ReloadXmlDocument(); Collection <DefaultFirstCharacter> characters = DefaultFirstCharacters; for (int i = 0; i < characters.Count; i++) { if (characters[i].Server == newDefaultFirstCharacter.Server && characters[i].ZoneId == newDefaultFirstCharacter.ZoneId) { characters.RemoveAt(i); break; } } Collection <Dictionary <string, string> > collection = new Collection <Dictionary <string, string> >(); foreach (DefaultFirstCharacter character in characters) { Dictionary <string, string> attributes = new Dictionary <string, string>(); attributes.Add("Server", character.Server); attributes.Add("ZoneId", character.ZoneId); attributes.Add("CharacterName", character.CharacterName); collection.Add(attributes); } Dictionary <string, string> newAttributes = new Dictionary <string, string>(); newAttributes.Add("Server", newDefaultFirstCharacter.Server); newAttributes.Add("ZoneId", newDefaultFirstCharacter.ZoneId); newAttributes.Add("CharacterName", newDefaultFirstCharacter.CharacterName); collection.Add(newAttributes); SettingsFile.SetNodeChildrenAndSaveToDisk("CharacterSelectionScreen/DefaultLoginChars", "DefaultLoginChar", collection); }