private void LoadTravelHistorySignatures(StarSystemEntity location) { listHistorySignatures.Items.Clear(); listCosmicSifnatures.Items.Clear(); var fileName = @"Data/TravelHistory/" + location.System + ".csv"; try { if (File.Exists(fileName) == false) { return; } using (var sr = new StreamReader(fileName)) { var records = new CsvReader(sr).GetRecords <BasicCosmicSignature>(); foreach (var record in records) { Log.DebugFormat("[whlTravelHistory.LoadTravelHistorySignatures] Read csv row. {0} {1}", record.Key, record.Value); listHistorySignatures.Items.Add(record.Key.Trim()); } } } catch (Exception ex) { Log.ErrorFormat("[whlTravelHistory.LoadTravelHistorySignatures] Critical error = {0}", ex); } }
private void RefreshSolarSystemInformation(StarSystemEntity location) { if (InvokeRequired) { Invoke(new Action(() => RefreshSolarSystemInformation(location))); } if (Global.Pilots.Count() > 0) { ucContainreSolarSystem.RefreshSolarSystem(location); } }
public void RefreshSolarSystem(StarSystemEntity location) { SolarSystem = location.Clone() as StarSystemEntity; txtSolarSystemName.Text = Global.Pilots.Selected.Location.System; txtSolarSystemClass.Text = Global.Pilots.Selected.Location.Class; txtSolarSystemEffect.Text = Global.Pilots.Selected.Location.Effect.Trim(); txtSolarSystemRegion.Text = Global.Pilots.Selected.Location.Region.Replace(" Unknown (", "").Replace(")", ""); txtSolarSystemConstellation.Text = Global.Pilots.Selected.Location.Constelation.Replace(" Unknown (", "").Replace(")", ""); txtSolarSystemStaticI.Text = ""; txtSolarSystemStaticII.Text = ""; txtSolarSystemStaticIData.Text = ""; txtSolarSystemStaticIIData.Text = ""; txtSolarSystemStaticI.Visible = false; txtSolarSystemStaticII.Visible = false; txtSolarSystemStaticIData.Visible = false; txtSolarSystemStaticIIData.Visible = false; if (string.IsNullOrEmpty(Global.Pilots.Selected.Location.Static) == false) { var wormholeI = Global.Space.Wormholes[Global.Pilots.Selected.Location.Static.Trim()]; txtSolarSystemStaticI.Text = wormholeI.Name; txtSolarSystemStaticI.Visible = true; txtSolarSystemStaticI.ForeColor = Tools.GetColorBySolarSystem(wormholeI.LeadsTo); txtSolarSystemStaticIData.Text = wormholeI.LeadsTo; txtSolarSystemStaticIData.Visible = true; toolTip1.SetToolTip(txtSolarSystemStaticI, "Max Stable Mass=" + wormholeI.TotalMass + "\r\nMax Jump Mass=" + wormholeI.SingleMass); } if (string.IsNullOrEmpty(Global.Pilots.Selected.Location.Static2) == false) { var wormholeII = Global.Space.Wormholes[Global.Pilots.Selected.Location.Static2.Trim()]; txtSolarSystemStaticII.Text = wormholeII.Name; txtSolarSystemStaticII.Visible = true; txtSolarSystemStaticII.ForeColor = Tools.GetColorBySolarSystem(wormholeII.LeadsTo); txtSolarSystemStaticIIData.Text = wormholeII.LeadsTo; txtSolarSystemStaticIIData.Visible = true; toolTip2.SetToolTip(txtSolarSystemStaticII, "Max Stable Mass=" + wormholeII.TotalMass + "\r\nMax Jump Mass=" + wormholeII.SingleMass); } }
private void LoadLocationInfo(string solarSystemName) { Log.DebugFormat("[whlSolarSystemOffline.LoadLocationInfo] starting for solarSystemName = {0}", solarSystemName); try { if (SolarSystem == null) { SolarSystem = new StarSystemEntity(); } if (Global.Space.SolarSystems.ContainsKey(solarSystemName)) { var location = Global.Space.SolarSystems[solarSystemName]; SolarSystem = location.Clone() as StarSystemEntity; if (SolarSystem != null) { SolarSystem.Id = Global.Space.BasicSolarSystems[solarSystemName]; } } else { SolarSystem.Region = ""; SolarSystem.Constelation = ""; SolarSystem.Effect = ""; SolarSystem.Class = ""; SolarSystem.Static2 = ""; SolarSystem.Static = ""; SolarSystem.Id = Global.Space.BasicSolarSystems[solarSystemName]; SolarSystem.System = solarSystemName; } } catch (Exception ex) { Log.ErrorFormat("[whlSolarSystemOffline.LoadLocationInfo] Critical error. Exception {0}", ex); if (SolarSystem != null) { SolarSystem.System = "unknown"; } } }
private void LoadWormholeStarSystems() { //Log.Debug("[SpaceEntity.LoadStarSystems] Read csv file \"Data/WSpaceSystemInfo - Systems.csv\". "); try { var dataFile = HttpContext.Current.Server.MapPath("~/Data/WSpaceSystemInfo - Systems.csv"); using (var sr = new StreamReader(dataFile)) { var records = new CsvReader(sr).GetRecords <StarSystem>(); foreach (var record in records) { var solarSystem = new StarSystemEntity { Id = record.Id, SolarSystemName = record.SolarSystemName, Class = record.Class, ConnectedSolarSystems = new List <string>(), Constelation = record.Constelation, Effect = record.Effect, Moons = record.Moons, Planets = record.Planets, Region = record.Region, Static = record.Static, Static2 = record.Static2, Sun = record.Sun, Security = SecurityStatus.WSpace }; SolarSystems.Add(record.SolarSystemName.Trim(), solarSystem); } } } catch (Exception ex) { //Log.ErrorFormat("[SpaceEntity.LoadStarSystems] Critical error = {0}", ex); } }
private void LoadEmpireSolarSystems() { try { var dataFile = HttpContext.Current.Server.MapPath("~/Data/WSpaceSystemInfo - Base Solar Systems.csv"); using (var sr = new StreamReader(dataFile)) { var records = new CsvReader(sr).GetRecords <BaseSolarSystem>(); foreach (var record in records) { var solarSystem = new StarSystemEntity { SolarSystemName = record.System, Class = null, ConnectedSolarSystems = new List <string>(), Constelation = null, Effect = null, Moons = null, Planets = null, Region = record.Region, Static = null, Static2 = null, Sun = null }; solarSystem.Security = GetStatus(record.SecurityRating); SolarSystems.Add(solarSystem.SolarSystemName.Trim(), solarSystem); } } } catch (Exception ex) { //Log.ErrorFormat("[SpaceEntity.LoadBasicSolarSystems] Critical error = {0}", ex); } }
private void RefreshSolarSystemInformation(StarSystemEntity location) { if (InvokeRequired) { Invoke(new Action(() => RefreshSolarSystemInformation(location))); } if (Global.Pilots.Count() > 0) { _containerSolarSystem.RefreshSolarSystem(location); _containerTravelHistory.RefreshSolarSystem(location); try { var wormhole = Global.LostAndFoundOffice.WormholeInspection(location.System); if (wormhole != null) { if (Visible == false) { Show(); WindowState = FormWindowState.Normal; } _containerLostAndFoundOffice.ShowMessage("Good news, Commander. Pilot " + wormhole.Publisher + " search this solar system (" + wormhole.Name + ") and pay reward " + wormhole.Reward + " . Name of this pilot already in your clipboard."); Clipboard.SetText(wormhole.Publisher); ContainerTabs.Activate("LostAndFoundOffice"); } } catch (Exception ex) { Log.ErrorFormat("[WindowMonitoring.RefreshSolarSystemInformation] Critical error. Exception {0}", ex); } } }
public void RefreshSolarSystem(StarSystemEntity location) { LoadTravelHistorySignatures(location); }
public void RefreshSolarSystem(StarSystemEntity location) { if (location == null) { return; } SolarSystem = location.Clone() as StarSystemEntity; if (Global.Pilots.Selected.Location.System == "unknown") { return; } txtSolarSystemName.Text = Global.Pilots.Selected.Location.System; txtSolarSystemClass.Text = Global.Pilots.Selected.Location.Class; txtSolarSystemEffect.Text = Global.Pilots.Selected.Location.Effect.Trim(); txtSolarSystemRegion.Text = Global.Pilots.Selected.Location.Region.Replace(" Unknown (", "").Replace(")", ""); txtSolarSystemConstellation.Text = Global.Pilots.Selected.Location.Constelation.Replace(" Unknown (", "").Replace(")", ""); txtSolarSystemStaticI.Text = ""; txtSolarSystemStaticII.Text = ""; txtSolarSystemStaticIData.Text = ""; txtSolarSystemStaticIIData.Text = ""; txtSolarSystemStaticI.Visible = false; txtSolarSystemStaticII.Visible = false; txtSolarSystemStaticIData.Visible = false; txtSolarSystemStaticIIData.Visible = false; var title = Global.Pilots.Selected.Location.System + ""; if (string.IsNullOrEmpty(Global.Pilots.Selected.Location.Class) == false) { title = title + "[C" + Global.Pilots.Selected.Location.Class + "]"; } if (string.IsNullOrEmpty(Global.Pilots.Selected.Location.Static) == false) { var wormholeI = Global.Space.Wormholes[Global.Pilots.Selected.Location.Static.Trim()]; txtSolarSystemStaticI.Text = wormholeI.Name; txtSolarSystemStaticI.Visible = true; txtSolarSystemStaticI.ForeColor = Tools.GetColorBySolarSystem(wormholeI.LeadsTo); txtSolarSystemStaticIData.Text = wormholeI.LeadsTo; txtSolarSystemStaticIData.Visible = true; toolTip1.SetToolTip(txtSolarSystemStaticI, "Max Stable Mass=" + wormholeI.TotalMass + "\r\nMax Jump Mass=" + wormholeI.SingleMass + "\r\nMax Life time =" + wormholeI.Lifetime); title = title + " " + wormholeI.Name + "[" + wormholeI.LeadsTo + "]"; } if (string.IsNullOrEmpty(Global.Pilots.Selected.Location.Static2) == false) { var wormholeII = Global.Space.Wormholes[Global.Pilots.Selected.Location.Static2.Trim()]; txtSolarSystemStaticII.Text = wormholeII.Name; txtSolarSystemStaticII.Visible = true; txtSolarSystemStaticII.ForeColor = Tools.GetColorBySolarSystem(wormholeII.LeadsTo); txtSolarSystemStaticIIData.Text = wormholeII.LeadsTo; txtSolarSystemStaticIIData.Visible = true; toolTip2.SetToolTip(txtSolarSystemStaticII, "Max Stable Mass=" + wormholeII.TotalMass + "\r\nMax Jump Mass=" + wormholeII.SingleMass + "\r\nMax Life time =" + wormholeII.Lifetime); title = title + " " + wormholeII.Name + "[" + wormholeII.LeadsTo + "]"; } if (_changeSolarSystemInfo == null) { return; } try { _changeSolarSystemInfo(title); } catch (Exception ex) { Log.ErrorFormat("[whlSolarSystem.RefreshSolarSystem] Critical error = {0}", ex); } }