| 2828 | | MessageBox.Show("EveMon Settings File Not Found." & ControlChars.CrLf & ControlChars.CrLf & "Please check the EveMon installation.", "EveMon Settings Not Found", MessageBoxButtons.OK, MessageBoxIcon.Warning) |
| 2829 | | Exit Sub |
| 2830 | | Else |
| 2831 | | Try |
| 2832 | | ' Load the Settings file into an XMLDocument |
| 2833 | | Dim EMXML As New Xml.XmlDocument |
| 2834 | | EMXML.Load(EveMonLocation) |
| 2835 | | ' Get a list of the characters that are in files (not API) |
| 2836 | | Dim EMPilots As New SortedList |
| 2837 | | Dim CharDetails As Xml.XmlNodeList |
| 2838 | | Dim CharNode As Xml.XmlNode |
| 2839 | | CharDetails = EMXML.SelectNodes("/logindata2/CharFileList/CharFileInfo") |
| 2840 | | If CharDetails.Count > 0 Then |
| 2841 | | ' Need to add details of pilots here |
| 2842 | | For Each CharNode In CharDetails |
| 2843 | | EMPilots.Add(CharNode.ChildNodes(0).InnerText, CharNode.ChildNodes(3).InnerText) |
| 2844 | | Next |
| 2845 | | End If |
| 2846 | | ' Don't need to get a list of the characters that are in the API - this info is retrieved direct from the plan! |
| 2847 | | 'CharDetails = EMXML.SelectNodes("/logindata2/CharacterList/CharLoginInfo") |
| 2848 | | 'If CharDetails.Count > 0 Then |
| 2849 | | ' ' Need to add details of pilots here |
| 2850 | | ' For Each CharNode In CharDetails |
| 2851 | | ' ' Check char nodes for the "CharacterName" node |
| 2852 | | ' For Each cNode As Xml.XmlNode In CharNode.ChildNodes |
| 2853 | | ' If cNode.InnerXml = "CharacterName" Then |
| 2854 | | ' 'EMPilots.Add("API" & CharNode.ChildNodes(3).InnerText, CharNode.ChildNodes(3).InnerText) |
| 2855 | | ' End If |
| 2856 | | ' Next |
| 2857 | | ' Next |
| 2858 | | 'End If |
| 2859 | | |
| 2860 | | ' Try and get the plan information |
| 2861 | | Dim PlanDetails As Xml.XmlNodeList |
| 2862 | | Dim PlanNode As Xml.XmlNode |
| 2863 | | Dim PlansItemNode As Xml.XmlNode |
| 2864 | | Dim PlansParentNode As Xml.XmlNode |
| 2865 | | PlanDetails = EMXML.SelectNodes("/logindata2/Plans/PairOfStringPlan") |
| 2866 | | If PlanDetails.Count > 0 Then |
| 2867 | | Dim PlanInfo(PlanDetails.Count, 2) As String |
| 2868 | | Dim count As Integer = -1 |
| 2869 | | For Each PlanNode In PlanDetails |
| 2870 | | count += 1 |
| 2871 | | Dim planText As String = PlanNode.ChildNodes(0).InnerText.Replace("::", "#") |
| 2872 | | Dim planTexts() As String = planText.Split("#".ToCharArray) |
| 2873 | | Dim pilotName As String = "" |
| 2874 | | Dim planName As String = planTexts(1) |
| 2875 | | If EMPilots.Contains(planTexts(0)) = True Then |
| 2876 | | ' File pilot |
| 2877 | | pilotName = CStr(EMPilots.Item(planTexts(0))) |
| 2878 | | Else |
| 2879 | | ' API pilot |
| 2880 | | pilotName = planTexts(0) |
| 2881 | | End If |
| 2882 | | PlanInfo(count, 0) = pilotName : PlanInfo(count, 1) = planName |
| 2883 | | PlansParentNode = PlanNode.ChildNodes(1) |
| 2884 | | Dim SQ As New Collection |
| 2885 | | Dim SQCount As Integer = 0 |
| 2886 | | For Each PlansItemNode In PlansParentNode.ChildNodes(0) |
| 2887 | | SQCount += 1 |
| 2888 | | Dim SQI As New EveHQ.Core.SkillQueueItem |
| 2889 | | SQI.Name = PlansItemNode.ChildNodes(0).InnerText |
| 2890 | | SQI.ToLevel = CInt(PlansItemNode.ChildNodes(1).InnerText) |
| 2891 | | SQI.FromLevel = SQI.ToLevel - 1 |
| 2892 | | SQI.Pos = SQCount |
| 2893 | | SQI.Key = SQI.Name & SQI.FromLevel & SQI.ToLevel |
| 2894 | | SQ.Add(SQI, SQI.Key) |
| 2895 | | Next |
| 2896 | | PlanInfo(count, 2) = SQ.Count.ToString |
| 2897 | | |
| 2898 | | ' Check if we have a relevant pilot! |
| 2899 | | If EveHQ.Core.HQ.EveHQSettings.Pilots.Contains(PlanInfo(count, 0)) = True Then |
| 2900 | | ' Ok, load up the plan |
| 2901 | | Dim newSQ As New EveHQ.Core.SkillQueue |
| 2902 | | newSQ.Name = PlanInfo(count, 1) |
| 2903 | | newSQ.IncCurrentTraining = True |
| 2904 | | newSQ.Primary = False |
| 2905 | | newSQ.Queue = SQ |
| 2906 | | Dim QPilot As EveHQ.Core.Pilot = CType(EveHQ.Core.HQ.EveHQSettings.Pilots(PlanInfo(count, 0)), Core.Pilot) |
| 2907 | | If QPilot.TrainingQueues.Contains(PlanInfo(count, 1)) = False Then |
| 2908 | | QPilot.TrainingQueues.Add(newSQ.Name, newSQ) |
| 2909 | | RecalcQueues = True |
| | 2828 | ' Try for the settings-debug file which is common during development |
| | 2829 | EveMonLocation = Path.Combine(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "EveMon"), "Settings-debug.xml") |
| | 2830 | If My.Computer.FileSystem.FileExists(EveMonLocation) = False Then |
| | 2831 | MessageBox.Show("EveMon Settings File Not Found." & ControlChars.CrLf & ControlChars.CrLf & "Please check the EveMon installation.", "EveMon Settings Not Found", MessageBoxButtons.OK, MessageBoxIcon.Warning) |
| | 2832 | Exit Sub |
| | 2833 | End If |
| | 2834 | End If |
| | 2835 | Try |
| | 2836 | ' Load the Settings file into an XMLDocument |
| | 2837 | Dim EMXML As New Xml.XmlDocument |
| | 2838 | EMXML.Load(EveMonLocation) |
| | 2839 | ' Get a list of the characters that are in files (not API) |
| | 2840 | Dim EMPilots As New SortedList |
| | 2841 | Dim CharDetails As Xml.XmlNodeList |
| | 2842 | Dim CharNode As Xml.XmlNode |
| | 2843 | ' Get details of characters assigned to an API account |
| | 2844 | CharDetails = EMXML.SelectNodes("Settings/characters/ccp") |
| | 2845 | If CharDetails.Count > 0 Then |
| | 2846 | ' Need to add details of pilots here |
| | 2847 | For Each CharNode In CharDetails |
| | 2848 | EMPilots.Add(CharNode.Attributes.GetNamedItem("guid").Value, CharNode.ChildNodes(1).InnerText) ' Adds the GUID and name |
| | 2849 | Next |
| | 2850 | End If |
| | 2851 | ' Get details of characters added by a file |
| | 2852 | CharDetails = EMXML.SelectNodes("Settings/characters/uri") |
| | 2853 | If CharDetails.Count > 0 Then |
| | 2854 | ' Need to add details of pilots here |
| | 2855 | For Each CharNode In CharDetails |
| | 2856 | EMPilots.Add(CharNode.Attributes.GetNamedItem("guid").Value, CharNode.ChildNodes(1).InnerText) ' Adds the GUID and name |
| | 2857 | Next |
| | 2858 | End If |
| | 2859 | |
| | 2860 | ' Try and get the plan information |
| | 2861 | Dim PlanDetails As Xml.XmlNodeList |
| | 2862 | Dim PlanNode As Xml.XmlNode |
| | 2863 | Dim PlansItemNode As Xml.XmlNode |
| | 2864 | Dim PlansParentNode As Xml.XmlNode |
| | 2865 | PlanDetails = EMXML.SelectNodes("Settings/plans/plan") |
| | 2866 | If PlanDetails.Count > 0 Then |
| | 2867 | Dim PlanInfo(PlanDetails.Count, 2) As String |
| | 2868 | Dim count As Integer = -1 |
| | 2869 | For Each PlanNode In PlanDetails |
| | 2870 | count += 1 |
| | 2871 | Dim planOwner As String = PlanNode.Attributes.GetNamedItem("owner").Value |
| | 2872 | If EMPilots.ContainsKey(planOwner) = True Then |
| | 2873 | Dim pilotName As String = CStr(EMPilots(planOwner)) |
| | 2874 | If EveHQ.Core.HQ.EveHQSettings.Pilots.Contains(pilotName) = True Then |
| | 2875 | Dim planName As String = PlanNode.Attributes.GetNamedItem("name").Value |
| | 2876 | PlanInfo(count, 0) = pilotName : PlanInfo(count, 1) = planName |
| | 2877 | PlansParentNode = PlanNode.ChildNodes(1) |
| | 2878 | Dim SQ As New Collection |
| | 2879 | Dim SQCount As Integer = 0 |
| | 2880 | Dim planItems As XmlNodeList = PlanNode.SelectNodes("entry") |
| | 2881 | If planItems.Count > 0 Then |
| | 2882 | For Each PlansItemNode In planItems |
| | 2883 | SQCount += 1 |
| | 2884 | Dim SQI As New EveHQ.Core.SkillQueueItem |
| | 2885 | SQI.Name = PlansItemNode.Attributes.GetNamedItem("skill").Value |
| | 2886 | SQI.ToLevel = CInt(PlansItemNode.Attributes.GetNamedItem("level").Value) |
| | 2887 | SQI.FromLevel = SQI.ToLevel - 1 |
| | 2888 | SQI.Pos = SQCount |
| | 2889 | SQI.Key = SQI.Name & SQI.FromLevel & SQI.ToLevel |
| | 2890 | SQI.Notes = PlansItemNode.ChildNodes(0).InnerText |
| | 2891 | SQ.Add(SQI, SQI.Key) |
| | 2892 | Next |
| | 2893 | PlanInfo(count, 2) = SQ.Count.ToString |
| | 2894 | |
| | 2895 | ' Ok, load up the plan |
| | 2896 | Dim newSQ As New EveHQ.Core.SkillQueue |
| | 2897 | newSQ.Name = PlanInfo(count, 1) |
| | 2898 | newSQ.IncCurrentTraining = True |
| | 2899 | newSQ.Primary = False |
| | 2900 | newSQ.Queue = SQ |
| | 2901 | Dim QPilot As EveHQ.Core.Pilot = CType(EveHQ.Core.HQ.EveHQSettings.Pilots(PlanInfo(count, 0)), Core.Pilot) |
| | 2902 | If QPilot.TrainingQueues.Contains(PlanInfo(count, 1)) = False Then |
| | 2903 | QPilot.TrainingQueues.Add(newSQ.Name, newSQ) |
| | 2904 | RecalcQueues = True |
| | 2905 | End If |