Skip to content

Commit

Permalink
1.84_0.17_5
Browse files Browse the repository at this point in the history
   * it's possible to add new stations
   * default value for EDDN is no longer <test> because it's only for dev testing
   * set value for EDDN schema from <test> to <normal> and add a hint for users who have EDDN active
  • Loading branch information
Duke-Jones committed Apr 30, 2015
1 parent 7792928 commit 39901f5
Show file tree
Hide file tree
Showing 9 changed files with 196 additions and 140 deletions.
27 changes: 22 additions & 5 deletions RegulatedNoise/EDDB_Data/EDMilkyway.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,22 @@ public List<EDStation> getStations(enDataType Stationtype)
/// <param name="systemName"></param>
/// <param name="stationName"></param>
/// <returns></returns>
/// <param name="System"></param>
public EDStation getStation(string systemName, string stationName)
{
EDSystem tempSystem;

return getStation(systemName, stationName, out tempSystem);
}

/// <summary>
/// returns a station in a system by name
/// </summary>
/// <param name="systemName"></param>
/// <param name="stationName"></param>
/// <returns></returns>
/// <param name="System"></param>
public EDStation getStation(string systemName, string stationName, out EDSystem System)
{
EDStation retValue;

Expand All @@ -76,6 +91,8 @@ public EDStation getStation(string systemName, string stationName)
else
retValue = null;

System = SystemData;

return retValue;
}

Expand All @@ -93,7 +110,7 @@ public Int32 getStationDistance(string systemName, string stationName)
{
EDStation retValue = getStation(systemName, stationName);

if (retValue != null)
if ((retValue != null) && (retValue.DistanceToStar != null))
{
Distance = (int)(retValue.DistanceToStar);
}
Expand Down Expand Up @@ -497,7 +514,7 @@ public Point3D getSystemCoordinates(string Systemname)

if (mySystem != null)
{
retValue = new Point3D((float)mySystem.X, (float)mySystem.Y, (float)mySystem.Z);
retValue = mySystem.SystemCoordinates();
m_cachedLocations.Add(Systemname, retValue);
}

Expand Down Expand Up @@ -775,7 +792,7 @@ internal void ChangeAddSystem(EDSystem m_currentSystemdata, string oldSystemName
List<EDSystem> ownSystems = getSystems(enDataType.Data_Own);
int newSystemIndex;

if(oldSystemName == null)
if(String.IsNullOrEmpty(oldSystemName.Trim()))
oldSystemName = m_currentSystemdata.Name;

if(!oldSystemName.Equals(m_currentSystemdata.Name))
Expand Down Expand Up @@ -842,7 +859,7 @@ internal void ChangeAddStation(string Systemname, EDStation m_currentStationdata
EDStation Station;
int newStationIndex;

if(oldStationName == null)
if(String.IsNullOrEmpty(oldStationName.Trim()))
oldStationName = m_currentStationdata.Name;

List<EDSystem> ownSystems = getSystems(enDataType.Data_Own);
Expand Down Expand Up @@ -943,7 +960,7 @@ internal void ChangeAddStation(string Systemname, EDStation m_currentStationdata
newStationIndex = mergedStations.Max(X => X.Id) + 1;

// add the new station in the merged station dictionary
ownStations.Add(new EDStation(newStationIndex, System.Id, m_currentStationdata));
mergedStations.Add(new EDStation(newStationIndex, System.Id, m_currentStationdata));
}
}

Expand Down
11 changes: 11 additions & 0 deletions RegulatedNoise/EDDB_Data/EDSystems.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using RegulatedNoise.Enums_and_Utility_Classes;
using System.Windows.Forms.DataVisualization.Charting;

namespace RegulatedNoise.EDDB_Data
{
Expand Down Expand Up @@ -151,5 +152,15 @@ public void clear()
UpdatedAt = 0;

}

/// <summary>
/// return the coordinates of the system
/// </summary>
/// <returns></returns>
internal System.Windows.Forms.DataVisualization.Charting.Point3D SystemCoordinates()
{
return new Point3D((float)X, (float)Y, (float)Z);
}

}
}
32 changes: 6 additions & 26 deletions RegulatedNoise/Enums and Utility Classes/RegulatedNoiseSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public class RegulatedNoiseSettings

#if DukeJones

public readonly decimal VersionDJ = 0.16m;
public readonly decimal VersionDJ = 0.17m;
#endif
private int _isFirstRun = -1;

Expand All @@ -77,8 +77,7 @@ public class RegulatedNoiseSettings
public bool IncludeExtendedCSVInfo = true;
public bool PostToEddnOnImport = false;
public bool DeleteScreenshotOnImport = false;
public bool WarnedAboutEddnSchema = false;
public bool UseEddnTestSchema = true;
public bool UseEddnTestSchema = false;
public string UiColour = "#FF8419";
public string ForegroundColour = null;
public string BackgroundColour = null;
Expand Down Expand Up @@ -107,8 +106,9 @@ public class RegulatedNoiseSettings
public bool AutoActivateOCRTab = true;
public bool AutoActivateSystemTab = true;
public string PilotsName = String.Empty;
public bool IncludeUnknownDTS = false;
public bool LoadStationsJSON = false;
public bool IncludeUnknownDTS = true;
public bool LoadStationsJSON = false;


public SerializableDictionary<string, WindowData> WindowBaseData = new SerializableDictionary<string, WindowData>() {
{"Form1", new WindowData()},
Expand Down Expand Up @@ -405,27 +405,7 @@ private void cbDeleteScreenshotOnImport_CheckedChanged(object sender, EventArgs

private void cbUseEddnTestSchema_CheckedChanged(object sender, EventArgs e)
{
if (RegulatedNoiseSettings.WarnedAboutEddnSchema == false)
{
var result = MessageBox.Show(
"Are you sure? It's very important to get your System Names correct before uploading to the live schema...", "Are you sure?",
MessageBoxButtons.YesNo);

if (result == DialogResult.Yes)
{
RegulatedNoiseSettings.UseEddnTestSchema = cbUseEddnTestSchema.Checked;
RegulatedNoiseSettings.WarnedAboutEddnSchema = true;
}
else
{
RegulatedNoiseSettings.UseEddnTestSchema = true;
cbUseEddnTestSchema.CheckedChanged -= cbUseEddnTestSchema_CheckedChanged;
cbUseEddnTestSchema.Checked = true;
cbUseEddnTestSchema.CheckedChanged += cbUseEddnTestSchema_CheckedChanged;
}
}
else
RegulatedNoiseSettings.UseEddnTestSchema = cbUseEddnTestSchema.Checked;
RegulatedNoiseSettings.UseEddnTestSchema = cbUseEddnTestSchema.Checked;
}

#region Theming
Expand Down
Loading

0 comments on commit 39901f5

Please sign in to comment.