diff --git a/RegulatedNoise/Enums and Utility Classes/RegulatedNoiseSettings.cs b/RegulatedNoise/Enums and Utility Classes/RegulatedNoiseSettings.cs index 1322eb0..97735f8 100644 --- a/RegulatedNoise/Enums and Utility Classes/RegulatedNoiseSettings.cs +++ b/RegulatedNoise/Enums and Utility Classes/RegulatedNoiseSettings.cs @@ -6,7 +6,7 @@ using System.Net; using System.Net.Mime; using System.Windows.Forms; -using Newtonsoft.Json; +using Newtonsoft.Json; using System.Collections.Generic; using RegulatedNoise.Enums_and_Utility_Classes; @@ -17,57 +17,57 @@ public class WindowData { public WindowData() { - Position.X = -1; - Position.Y = -1; - Position.Width = -1; - Position.Height = -1; - - State = FormWindowState.Normal; + Position.X = -1; + Position.Y = -1; + Position.Width = -1; + Position.Height = -1; + + State = FormWindowState.Normal; } - public Rectangle Position; - public FormWindowState State; + public Rectangle Position; + public FormWindowState State; } [Serializable] public class ColumnData { - public ColumnData() + public ColumnData() { ColumnName = ""; - Width = -1; - Visible = true; + Width = -1; + Visible = true; } public ColumnData(string Name) { ColumnName = Name; - Width = -1; - Visible = true; + Width = -1; + Visible = true; } public string ColumnName; - public Int32 Width; - public Boolean Visible; + public Int32 Width; + public Boolean Visible; } [Serializable] public class RegulatedNoiseSettings { - public readonly decimal Version = 1.84m; - -#if DukeJones + public readonly decimal Version = 1.84m; + +#if DukeJones public readonly decimal VersionDJ = 0.27m; #endif - public string PilotsName = String.Empty; + public string PilotsName = String.Empty; public string UserName = String.Empty; public bool usePilotsName = true; public string ProductsPath = ""; public string GamePath = ""; //Should Replace ProductsPath by always contain the newest FORC-FDEV dir. public string ProductAppData = ""; //2nd location for game configuration files - public string WebserverIpAddress = ""; + public string WebserverIpAddress = ""; public string WebserverPort = "8080"; public bool StartWebserverOnLoad = false; public string WebserverBackgroundColor = "#FFFFFF"; @@ -83,16 +83,16 @@ public class RegulatedNoiseSettings public string BackgroundColour = null; public bool AutoImport = false; public bool TestMode = false; - public string TraineddataFile = "big"; - public enLanguage Language = enLanguage.eng; - public int CmdrsLogSortColumn = 0; - public SortOrder CmdrsLogSortOrder = SortOrder.Descending; - public bool AutoEvent_JumpedTo = true; - public bool AutoEvent_Visited = true; - public bool AutoEvent_MarketDataCollected = true; - public bool AutoEvent_ReplaceVisited = true; - public float EBPixelThreshold = 0.6f; - public int EBPixelAmount = 22; + public string TraineddataFile = "big"; + public enLanguage Language = enLanguage.eng; + public int CmdrsLogSortColumn = 0; + public SortOrder CmdrsLogSortOrder = SortOrder.Descending; + public bool AutoEvent_JumpedTo = true; + public bool AutoEvent_Visited = true; + public bool AutoEvent_MarketDataCollected = true; + public bool AutoEvent_ReplaceVisited = true; + public float EBPixelThreshold = 0.6f; + public int EBPixelAmount = 22; public int lastStationCount = 4; public bool lastStationCountActive = false; public bool limitLightYears = false; @@ -104,12 +104,12 @@ public class RegulatedNoiseSettings public int lastMaxRouteDistance = 20; public bool PerLightYearRoundTrip = false; public decimal lastVersion = 0.00m; - public decimal lastVersionDJ = 0.00m; + public decimal lastVersionDJ = 0.00m; public int GUIColorCutoffLevel = 150; - public bool AutoActivateOCRTab = true; - public bool AutoActivateSystemTab = true; - public bool IncludeUnknownDTS = true; - public bool LoadStationsJSON = false; + public bool AutoActivateOCRTab = true; + public bool AutoActivateSystemTab = true; + public bool IncludeUnknownDTS = true; + public bool LoadStationsJSON = false; public Int32 oldDataPurgeDeadlineDays = 14; public bool checkedTestEDDNSetting = false; public bool SpoolEddnToFile = false; @@ -121,35 +121,35 @@ public class RegulatedNoiseSettings "EDAPI Trade Dangerous Plugin"}; public SerializableDictionary WindowBaseData = new SerializableDictionary() { - {"Form1", new WindowData()}, - {"EditOcrResults", new WindowData()}, - {"EditPriceData", new WindowData()}, - {"EDStationView", new WindowData()}, - {"EDCommodityView", new WindowData()}, - {"EDCommodityListView", new WindowData()}, - {"FilterTest", new WindowData()}, - {"HelpOCR", new WindowData()}, - {"HelpCommodities", new WindowData()}, - {"EBPixeltest", new WindowData()}, - {"ProgressView", new WindowData()} - }; - - public SerializableDictionary> ListViewColumnData = new SerializableDictionary>() { - {"lvCommandersLog", new List() { - new ColumnData("EventDate"), - new ColumnData("EventType"), - new ColumnData("Station"), - new ColumnData("System"), - new ColumnData("Cargo"), - new ColumnData("CargoAction"), - new ColumnData("CargoVolume"), - new ColumnData("Notes"), - new ColumnData("EventID"), - new ColumnData("TransactionAmount"), - new ColumnData("Credits") }}, - {"lvAllComms", new List() { new ColumnData("") }}, - {"lbPrices", new List() { new ColumnData("") }} - }; + {"Form1", new WindowData()}, + {"EditOcrResults", new WindowData()}, + {"EditPriceData", new WindowData()}, + {"EDStationView", new WindowData()}, + {"EDCommodityView", new WindowData()}, + {"EDCommodityListView", new WindowData()}, + {"FilterTest", new WindowData()}, + {"HelpOCR", new WindowData()}, + {"HelpCommodities", new WindowData()}, + {"EBPixeltest", new WindowData()}, + {"ProgressView", new WindowData()} + }; + + public SerializableDictionary> ListViewColumnData = new SerializableDictionary>() { + {"lvCommandersLog", new List() { + new ColumnData("EventDate"), + new ColumnData("EventType"), + new ColumnData("Station"), + new ColumnData("System"), + new ColumnData("Cargo"), + new ColumnData("CargoAction"), + new ColumnData("CargoVolume"), + new ColumnData("Notes"), + new ColumnData("EventID"), + new ColumnData("TransactionAmount"), + new ColumnData("Credits") }}, + {"lvAllComms", new List() { new ColumnData("") }}, + {"lbPrices", new List() { new ColumnData("") }} + }; public void CheckVersion2() { @@ -166,11 +166,11 @@ public void CheckVersion2() decimal maxVersionDJ = -1; try - { - string[] Versions; - decimal MainVersion; + { + string[] Versions; + decimal MainVersion; decimal DJVersion; - string release; + string release; bool PR; using (StreamReader responseReader = new StreamReader(webRequest.GetResponse().GetResponseStream())) @@ -184,56 +184,56 @@ public void CheckVersion2() dynamic releaseDetails = null; foreach (var x in data) - { - release = x.tag_name; - PR = (bool)x.prerelease; - - if (PR == false) - { - release = release.Replace("v", ""); + { + release = x.tag_name; + PR = (bool)x.prerelease; + + if (PR == false) + { + release = release.Replace("v", ""); Versions = release.Split('_'); - MainVersion = decimal.Parse(Versions[0], NumberStyles.Any, ci); - - if (Versions.GetUpperBound(0) > 0) - DJVersion = decimal.Parse(Versions[1], NumberStyles.Any, ci); - else - DJVersion = decimal.Parse("0.00", NumberStyles.Any, ci); - + MainVersion = decimal.Parse(Versions[0], NumberStyles.Any, ci); + + if (Versions.GetUpperBound(0) > 0) + DJVersion = decimal.Parse(Versions[1], NumberStyles.Any, ci); + else + DJVersion = decimal.Parse("0.00", NumberStyles.Any, ci); + if (maxVersion < MainVersion) { maxVersion = MainVersion; maxVersionDJ = DJVersion; releaseDetails = x; - } - else if ((maxVersion == MainVersion) && (maxVersionDJ < DJVersion)) - { - maxVersion = MainVersion; - maxVersionDJ = DJVersion; - releaseDetails = x; + } + else if ((maxVersion == MainVersion) && (maxVersionDJ < DJVersion)) + { + maxVersion = MainVersion; + maxVersionDJ = DJVersion; + releaseDetails = x; } } - } - + } + if ((Version < maxVersion) || ((Version == maxVersion) && (VersionDJ < maxVersionDJ))) { - - Form1.InstanceObject.lblUpdateInfo.Text = "newer DJ-version found!"; - Form1.InstanceObject.lblUpdateInfo.ForeColor = Color.Black; - Form1.InstanceObject.lblUpdateInfo.BackColor = Color.Yellow; - - Form1.InstanceObject.lblUpdateDetail.Text = maxVersion.ToString().Replace(",", ".") + "-" + maxVersionDJ.ToString().Replace(",", ".") + ":\r\n"; - - Form1.InstanceObject.lblUpdateDetail.Text += releaseDetails.body; - + + Form1.InstanceObject.lblUpdateInfo.Text = "newer DJ-version found!"; + Form1.InstanceObject.lblUpdateInfo.ForeColor = Color.Black; + Form1.InstanceObject.lblUpdateInfo.BackColor = Color.Yellow; + + Form1.InstanceObject.lblUpdateDetail.Text = maxVersion.ToString().Replace(",", ".") + "-" + maxVersionDJ.ToString().Replace(",", ".") + ":\r\n"; + + Form1.InstanceObject.lblUpdateDetail.Text += releaseDetails.body; + } - else + else { Form1.InstanceObject.lblUpdateInfo.Text = "you have the latest version of RegulatedNoise"; - Form1.InstanceObject.lblUpdateInfo.ForeColor = Color.DarkGreen; - - Form1.InstanceObject.lblUpdateDetail.Text = maxVersion.ToString().Replace(",", ".") + "-" + maxVersionDJ.ToString().Replace(",", ".") + ":\r\n"; - Form1.InstanceObject.lblUpdateDetail.Text += releaseDetails.body; + Form1.InstanceObject.lblUpdateInfo.ForeColor = Color.DarkGreen; + + Form1.InstanceObject.lblUpdateDetail.Text = maxVersion.ToString().Replace(",", ".") + "-" + maxVersionDJ.ToString().Replace(",", ".") + ":\r\n"; + Form1.InstanceObject.lblUpdateDetail.Text += releaseDetails.body; } } catch @@ -244,95 +244,95 @@ public void CheckVersion2() } - /// - /// checks if this is the first time of this version running - /// + /// + /// checks if this is the first time of this version running + /// + /// + public bool isFirstVersionRun() + { + + return lastVersionIsBefore(Version, VersionDJ); + } + + public bool lastVersionIsBefore(Decimal Version_Main, Decimal Version_DJ) + { + try + { + bool retValue = false; + + if ((lastVersion < Version_Main) || ((lastVersion == Version_Main) && (lastVersionDJ < Version_DJ))) + { + retValue = true; + } + + return retValue; + } + catch (Exception ex) + { + throw new Exception("Error when checking last version", ex); + } + } + + /// + /// returns the UI color as color object + /// + /// + public Color getUiColor() + { + return Color.FromArgb(int.Parse(UiColour.Substring(1, 2), System.Globalization.NumberStyles.HexNumber), + int.Parse(UiColour.Substring(3, 2), System.Globalization.NumberStyles.HexNumber), + int.Parse(UiColour.Substring(5, 2), System.Globalization.NumberStyles.HexNumber)); + } + + /// + /// returns the UI color as color object + /// /// - public bool isFirstVersionRun() - { - - return lastVersionIsBefore(Version, VersionDJ); + public Color getForegroundColor() + { + return Color.FromArgb(int.Parse(ForegroundColour.Substring(1, 2), System.Globalization.NumberStyles.HexNumber), + int.Parse(ForegroundColour.Substring(3, 2), System.Globalization.NumberStyles.HexNumber), + int.Parse(ForegroundColour.Substring(5, 2), System.Globalization.NumberStyles.HexNumber)); } - public bool lastVersionIsBefore(Decimal Version_Main, Decimal Version_DJ) - { - try - { - bool retValue = false; - - if ((lastVersion < Version_Main) || ((lastVersion == Version_Main) && (lastVersionDJ < Version_DJ))) - { - retValue = true; - } - - return retValue; - } - catch (Exception ex) - { - throw new Exception("Error when checking last version", ex); - } - } - - /// - /// returns the UI color as color object - /// - /// - public Color getUiColor() - { - return Color.FromArgb(int.Parse(UiColour.Substring(1, 2), System.Globalization.NumberStyles.HexNumber), - int.Parse(UiColour.Substring(3, 2), System.Globalization.NumberStyles.HexNumber), - int.Parse(UiColour.Substring(5, 2), System.Globalization.NumberStyles.HexNumber)); - } - - /// - /// returns the UI color as color object - /// - /// - public Color getForegroundColor() - { - return Color.FromArgb(int.Parse(ForegroundColour.Substring(1, 2), System.Globalization.NumberStyles.HexNumber), - int.Parse(ForegroundColour.Substring(3, 2), System.Globalization.NumberStyles.HexNumber), - int.Parse(ForegroundColour.Substring(5, 2), System.Globalization.NumberStyles.HexNumber)); - } - - /// - /// returns the UI color as color object - /// - /// - public Color getBackgroundColor() - { - return Color.FromArgb(int.Parse(BackgroundColour.Substring(1, 2), System.Globalization.NumberStyles.HexNumber), - int.Parse(BackgroundColour.Substring(3, 2), System.Globalization.NumberStyles.HexNumber), - int.Parse(BackgroundColour.Substring(5, 2), System.Globalization.NumberStyles.HexNumber)); - } - - - /// - /// really dirty but quick - /// - public void prepareVersion() - { - lastVersion = Version; - lastVersionDJ = VersionDJ; - } - - public String getVersionString() - { - return Version.ToString(CultureInfo.InvariantCulture) + "_" + VersionDJ.ToString(CultureInfo.InvariantCulture); - } + /// + /// returns the UI color as color object + /// + /// + public Color getBackgroundColor() + { + return Color.FromArgb(int.Parse(BackgroundColour.Substring(1, 2), System.Globalization.NumberStyles.HexNumber), + int.Parse(BackgroundColour.Substring(3, 2), System.Globalization.NumberStyles.HexNumber), + int.Parse(BackgroundColour.Substring(5, 2), System.Globalization.NumberStyles.HexNumber)); + } + + + /// + /// really dirty but quick + /// + public void prepareVersion() + { + lastVersion = Version; + lastVersionDJ = VersionDJ; + } + + public String getVersionString() + { + return Version.ToString(CultureInfo.InvariantCulture) + "_" + VersionDJ.ToString(CultureInfo.InvariantCulture); + } <<<<<<< HEAD - - public String GetUserID() - { - String UserID; - // get the user id - if (usePilotsName) - UserID = System.Net.WebUtility.HtmlEncode(PilotsName); - else - UserID = System.Net.WebUtility.HtmlEncode(UserName); - - return UserID; - } + + public String GetUserID() + { + String UserID; + // get the user id + if (usePilotsName) + UserID = System.Net.WebUtility.HtmlEncode(PilotsName); + else + UserID = System.Net.WebUtility.HtmlEncode(UserName); + + return UserID; + } ======= >>>>>>> 0ab1473d22bd17088215e369eb85a28c621b6a31 } diff --git a/RegulatedNoise/RegulatedNoise.csproj b/RegulatedNoise/RegulatedNoise.csproj index 35f0f46..090a958 100644 --- a/RegulatedNoise/RegulatedNoise.csproj +++ b/RegulatedNoise/RegulatedNoise.csproj @@ -132,10 +132,10 @@ -<<<<<<< HEAD +<<<<<<< HEAD -======= ->>>>>>> 0ab1473d22bd17088215e369eb85a28c621b6a31 +======= +>>>>>>> 0ab1473d22bd17088215e369eb85a28c621b6a31 Component @@ -810,11 +810,11 @@ - \ No newline at end of file diff --git a/ToDo.txt b/ToDo.txt index 909477b..e53b13a 100644 --- a/ToDo.txt +++ b/ToDo.txt @@ -22,7 +22,7 @@ todo: -<<<<<<< HEAD +<<<<<<< HEAD 1.84_0.27 * changed EDDN receiving routine to v2/v1 schema * cleaned up a little bit the involved codes @@ -36,8 +36,8 @@ todo: * added latest EDDB files * added a icon (thanks to SpyMaster356) ------------------------------------------------------------------------------------- -======= ->>>>>>> 0ab1473d22bd17088215e369eb85a28c621b6a31 +======= +>>>>>>> 0ab1473d22bd17088215e369eb85a28c621b6a31 1.84_0.27_1 * changed EDDN sending routine to v2 schema * cleaned up a little bit the involved codes