From d5ee339baa38ee24fb80d098600a03695e074c93 Mon Sep 17 00:00:00 2001 From: ezet Date: Tue, 22 Jul 2014 15:09:02 +0200 Subject: [PATCH] Replaced the old IndustryJobs with the Crius version. Changes some int types to long in IndustryJobs. --- EveLib.EveCrest/EveCrest.cs | 4 +- .../Models/CrestIndustryTeamAuction.cs | 3 - EveLib.EveOnline/Character.cs | 31 +- EveLib.EveOnline/Corporation.cs | 31 +- EveLib.EveOnline/EveLib.EveOnline.csproj | 3 +- .../Models/Character/IndustryJobs.cs | 299 +++++++++++------- .../Models/Character/NewIndustryJobs.cs | 225 ------------- EveLib.Tests/CharacterKey_Beta.cs | 9 - EveLib.Tests/CharacterKey_ValidKeyTests.cs | 10 +- EveLib.Tests/CorporationKey_Beta.cs | 13 - EveLib.Tests/CorporationKey_ValidKeyTests.cs | 15 +- 11 files changed, 223 insertions(+), 420 deletions(-) delete mode 100644 EveLib.EveOnline/Models/Character/NewIndustryJobs.cs diff --git a/EveLib.EveCrest/EveCrest.cs b/EveLib.EveCrest/EveCrest.cs index 1586895..09982d9 100644 --- a/EveLib.EveCrest/EveCrest.cs +++ b/EveLib.EveCrest/EveCrest.cs @@ -28,7 +28,7 @@ public EveCrest() { /// /// public Task GetRootAsync() { - string relPath = ""; + const string relPath = ""; return requestAsync(relPath); } @@ -154,7 +154,7 @@ public CrestMarketHistory GetMarketHistory(int regionId, int typeId) { /// /// public Task GetMarketPricesAsync() { - string relpath = "market/prices/"; + const string relpath = "market/prices/"; return requestAsync(relpath); } diff --git a/EveLib.EveCrest/Models/CrestIndustryTeamAuction.cs b/EveLib.EveCrest/Models/CrestIndustryTeamAuction.cs index f8db406..d991f15 100644 --- a/EveLib.EveCrest/Models/CrestIndustryTeamAuction.cs +++ b/EveLib.EveCrest/Models/CrestIndustryTeamAuction.cs @@ -63,9 +63,6 @@ public class TeamAuction { [DataMember(Name = "workers")] public List Workers { get; set; } - - - } } } \ No newline at end of file diff --git a/EveLib.EveOnline/Character.cs b/EveLib.EveOnline/Character.cs index a1a72e9..98a46c0 100644 --- a/EveLib.EveOnline/Character.cs +++ b/EveLib.EveOnline/Character.cs @@ -423,16 +423,8 @@ public Task> GetFactionWarfareStatsAsync() { return requestAsync(relPath, ApiKey, "characterId", CharacterId); } - /// - /// Returns the characters industry jobs. - /// - /// - public EveApiResponse GetIndustryJobs() { - return GetIndustryJobsAsync().Result; - } - - /// - /// Returns the characters industry jobs. + /// + /// Returns the currently running industry jobs. /// /// public Task> GetIndustryJobsAsync() { @@ -444,17 +436,8 @@ public Task> GetIndustryJobsAsync() { /// Returns the currently running industry jobs. /// /// - public Task> GetNewIndustryJobsAsync() { - const string relPath = "/char/IndustryJobs.xml.aspx"; - return requestAsync(relPath, ApiKey, "characterId", CharacterId); - } - - /// - /// Returns the currently running industry jobs. - /// - /// - public EveApiResponse GetNewIndustryJobs() { - return GetNewIndustryJobsAsync().Result; + public EveApiResponse GetIndustryJobs() { + return GetIndustryJobsAsync().Result; } @@ -462,16 +445,16 @@ public EveApiResponse GetNewIndustryJobs() { /// Returns currently running and ended industry jobs. /// /// - public Task> GetIndustryJobsHistoryAsync() { + public Task> GetIndustryJobsHistoryAsync() { const string relPath = "/char/IndustryJobsHistory.xml.aspx"; - return requestAsync(relPath, ApiKey, "characterId", CharacterId); + return requestAsync(relPath, ApiKey, "characterId", CharacterId); } /// /// Returns currently running and ended industry jobs. /// /// - public EveApiResponse GetIndustryJobsHistory() { + public EveApiResponse GetIndustryJobsHistory() { return GetIndustryJobsHistoryAsync().Result; } diff --git a/EveLib.EveOnline/Corporation.cs b/EveLib.EveOnline/Corporation.cs index 35fec67..3153949 100644 --- a/EveLib.EveOnline/Corporation.cs +++ b/EveLib.EveOnline/Corporation.cs @@ -347,16 +347,7 @@ public Task> GetFactionWarfareStatsAsync() { } /// - /// Returns the corporation industry jobs. - /// - /// - public EveApiResponse GetIndustryJobs() { - return GetIndustryJobsAsync().Result; - } - - - /// - /// Returns the corporation industry jobs. + /// Returns the currently running industry jobs. /// /// public Task> GetIndustryJobsAsync() { @@ -364,38 +355,28 @@ public Task> GetIndustryJobsAsync() { return requestAsync(relPath, ApiKey); } - - /// - /// Returns the currently running industry jobs. - /// - /// - public Task> GetNewIndustryJobsAsync() { - const string relPath = "/corp/IndustryJobs.xml.aspx"; - return requestAsync(relPath, ApiKey); - } - /// /// Returns the currently running industry jobs. /// /// - public EveApiResponse GetNewIndustryJobs() { - return GetNewIndustryJobsAsync().Result; + public EveApiResponse GetIndustryJobs() { + return GetIndustryJobsAsync().Result; } /// /// Returns currently running and ended industry jobs. /// /// - public Task> GetIndustryJobsHistoryAsync() { + public Task> GetIndustryJobsHistoryAsync() { const string relPath = "/corp/IndustryJobsHistory.xml.aspx"; - return requestAsync(relPath, ApiKey); + return requestAsync(relPath, ApiKey); } /// /// Returns currently running and ended industry jobs. /// /// - public EveApiResponse GetIndustryHistoryJobs() { + public EveApiResponse GetIndustryHistoryJobs() { return GetIndustryJobsHistoryAsync().Result; } diff --git a/EveLib.EveOnline/EveLib.EveOnline.csproj b/EveLib.EveOnline/EveLib.EveOnline.csproj index ec4c5b7..a4eadda 100644 --- a/EveLib.EveOnline/EveLib.EveOnline.csproj +++ b/EveLib.EveOnline/EveLib.EveOnline.csproj @@ -132,7 +132,6 @@ - @@ -194,7 +193,7 @@ - + diff --git a/EveLib.EveOnline/Models/Character/IndustryJobs.cs b/EveLib.EveOnline/Models/Character/IndustryJobs.cs index 0baed19..e55368c 100644 --- a/EveLib.EveOnline/Models/Character/IndustryJobs.cs +++ b/EveLib.EveOnline/Models/Character/IndustryJobs.cs @@ -3,146 +3,223 @@ using eZet.EveLib.Modules.Util; namespace eZet.EveLib.Modules.Models.Character { + /// + /// Represents a IndustryJobs response + /// [Serializable] - [XmlRoot("result", IsNullable = false)] + [XmlRoot("result")] public class IndustryJobs { - public enum CompletedStatusType { - [XmlEnum("0")] Failed, - [XmlEnum("1")] Delivered, - [XmlEnum("2")] Aborted, - [XmlEnum("3")] GmAborted, - [XmlEnum("4")] Unanchored, - [XmlEnum("5")] Destroyed - } + /// + /// A list of industry jobs + /// [XmlElement("rowset")] - public EveOnlineRowCollection Jobs { get; set; } + public EveOnlineRowCollection Jobs { get; set; } + /// + /// Represents a industry job + /// [Serializable] [XmlRoot("row")] - public class IndustryJob { + public class NewIndustryJob { + /// + /// The job ID + /// [XmlAttribute("jobID")] public long JobId { get; set; } - [XmlAttribute("assemblyLineID")] - public long AssemblyLineId { get; set; } - - [XmlAttribute("containerID")] - public long ContainerId { get; set; } - - [XmlAttribute("installedItemID")] - public long InstalledItemId { get; set; } - - [XmlAttribute("installedItemLocationID")] - public long InstalledItemLocationId { get; set; } - - [XmlAttribute("installedItemQuantity")] - public int InstalledItemQuantity { get; set; } - - [XmlAttribute("installedItemProductivityLevel")] - public int InstalledItemProducivityLevel { get; set; } - - [XmlAttribute("installedItemMaterialLevel")] - public int InstalledItemMaterialLevel { get; set; } + /// + /// The installer entity ID + /// + [XmlAttribute("installerID")] + public long InstallerId { get; set; } - [XmlAttribute("installedItemLicenseProductionRunsRemaining")] - public int InstalledItemLicenseProductionRunsRemaining { get; set; } + /// + /// The installer's name + /// + [XmlAttribute("installerName")] + public string InstallerName { get; set; } + + /// + /// The id of the facility the job was installed in + /// + [XmlAttribute("facilityID")] + public long FacilityId { get; set; } + + /// + /// The solar system ID of the facility + /// + [XmlAttribute("solarSystemID")] + public int SolarSystemId { get; set; } + + /// + /// The solar system name + /// + [XmlAttribute("solarSystemName")] + public string SolarSystemName { get; set; } + + /// + /// The station ID + /// + [XmlAttribute("stationID")] + public int StationId { get; set; } + + /// + /// The activity ID + /// + [XmlAttribute("activityID")] + public int ActivityId { get; set; } + /// + /// The blueprint ID + /// + [XmlAttribute("blueprintID")] + public long BlueprintId { get; set; } + + /// + /// The blueprint type ID + /// + [XmlAttribute("blueprintTypeID")] + public int BlueprintTypeId { get; set; } + + /// + /// The blueprint name + /// + [XmlAttribute("blueprintTypeName")] + public string BueprintTypeName { get; set; } + + /// + /// The location ID for the blueprint + /// + [XmlAttribute("blueprintLocationID")] + public long BlueprintLocationId { get; set; } + + /// + /// The location ID for the job output + /// [XmlAttribute("outputLocationID")] public long OutputLocationId { get; set; } - [XmlAttribute("installerID")] - public long InstallerId { get; set; } - + /// + /// The number of runs + /// [XmlAttribute("runs")] public int Runs { get; set; } - [XmlAttribute("licensedProductionRuns")] - public int LicensedProductionRuns { get; set; } - - [XmlAttribute("installedInSolarSystemID")] - public long InstalledInSolarSystemId { get; set; } - - [XmlAttribute("containerLocationID")] - public long ContainerLocationId { get; set; } - - [XmlAttribute("materialMultiplier")] - public float MaterialMultiplier { get; set; } - - [XmlAttribute("charMaterialMultiplier")] - public float CharMaterialMultiplier { get; set; } - - [XmlAttribute("timeMultiplier")] - public float TimeMultiplier { get; set; } - - [XmlAttribute("charTimeMultiplier")] - public float CharTimeMultiplier { get; set; } - - [XmlAttribute("installedItemTypeID")] - public long InstalledItemTypeId { get; set; } - - [XmlAttribute("outputTypeID")] - public long OutputTypeId { get; set; } - - [XmlAttribute("containerTypeID")] - public long containerTypeId { get; set; } - - [XmlAttribute("intalledItemCopy")] - public bool InstalledItemCopy { get; set; } - - [XmlAttribute("completed")] - public bool Completed { get; set; } - - [XmlAttribute("completedSuccessfully")] - public bool CompletedSuccessfully { get; set; } - - [XmlAttribute("installedItemFlag")] - public int InstalledItemFlag { get; set; } - - [XmlAttribute("outputFlag")] - public int OutputFlag { get; set; } - - [XmlAttribute("activityID")] - public int ActivityId { get; set; } - - [XmlAttribute("completedStatus")] - public CompletedStatusType CompletedStatus { get; set; } - + /// + /// The job cost + /// + [XmlAttribute("cost")] + public decimal Cost { get; set; } + + /// + /// The team ID + /// + [XmlAttribute("teamID")] + public int TeamId { get; set; } + + /// + /// The number of licensed runs + /// + [XmlAttribute("licensedRuns")] + public int LicensedRuns { get; set; } + + /// + /// The probability of success for invention + /// + [XmlAttribute("probability")] + public float Probability { get; set; } + + /// + /// The type ID of the final product + /// + [XmlAttribute("productTypeID")] + public int ProductTypeId { get; set; } + + /// + /// The type name of the final product + /// + [XmlAttribute("productTypeName")] + public string ProductTypeName { get; set; } + + /// + /// The job status + /// + [XmlAttribute("status")] + public string Status { get; set; } + + /// + /// The time left on the job, in seconds + /// + [XmlAttribute("timeInSeconds")] + public int timeInSeconds { get; set; } + + /// + /// The start date + /// [XmlIgnore] - public DateTime InstallTime { get; private set; } - - [XmlAttribute("installTime")] - public string InstallTimeAsString { - get { return InstallTime.ToString(XmlHelper.DateFormat); } - set { InstallTime = DateTime.ParseExact(value, XmlHelper.DateFormat, null); } + public DateTime StartDate { get; private set; } + + /// + /// The start date + /// + [XmlAttribute("startDate")] + public string StartDateAsString { + get { return StartDate.ToString(XmlHelper.DateFormat); } + set { StartDate = DateTime.ParseExact(value, XmlHelper.DateFormat, null); } } + /// + /// The end date + /// [XmlIgnore] - public DateTime BeginProductionTime { get; private set; } - - [XmlAttribute("beginProductionTime")] - public string BeginProductionTimeAsString { - get { return BeginProductionTime.ToString(XmlHelper.DateFormat); } - set { BeginProductionTime = DateTime.ParseExact(value, XmlHelper.DateFormat, null); } + public DateTime EndDate { get; private set; } + + /// + /// The end date + /// + [XmlAttribute("endDate")] + public string EndDateAsString { + get { return EndDate.ToString(XmlHelper.DateFormat); } + set { EndDate = DateTime.ParseExact(value, XmlHelper.DateFormat, null); } } - [XmlIgnore] - public DateTime EndProductionTime { get; private set; } - [XmlAttribute("endProductionTime")] - public string EndProductionTimeAsString { - get { return EndProductionTime.ToString(XmlHelper.DateFormat); } - set { EndProductionTime = DateTime.ParseExact(value, XmlHelper.DateFormat, null); } + /// + /// The pause date, if any + /// + [XmlIgnore] + public DateTime PauseDate { get; private set; } + + /// + /// The pause date, if any + /// + [XmlAttribute("pauseDate")] + public string PauseDateAsString { + get { return PauseDate.ToString(XmlHelper.DateFormat); } + set { PauseDate = DateTime.ParseExact(value, XmlHelper.DateFormat, null); } } + /// + /// The date the job completed, if any + /// [XmlIgnore] - public DateTime PauseProductionTime { get; private set; } - - [XmlAttribute("pauseProductionTime")] - public string PauseProductionTimeAsString { - get { return PauseProductionTime.ToString(XmlHelper.DateFormat); } - set { PauseProductionTime = DateTime.ParseExact(value, XmlHelper.DateFormat, null); } + public DateTime CompletedDate { get; private set; } + + /// + /// The date the job completed, if any + /// + [XmlAttribute("completedDate")] + public string CompletedDateAsString { + get { return CompletedDate.ToString(XmlHelper.DateFormat); } + set { CompletedDate = DateTime.ParseExact(value, XmlHelper.DateFormat, null); } } + + /// + /// The ID of the character that completed the job + /// + [XmlAttribute("completedCharacterID")] + public long CompletedCharacterId { get; set; } } } } \ No newline at end of file diff --git a/EveLib.EveOnline/Models/Character/NewIndustryJobs.cs b/EveLib.EveOnline/Models/Character/NewIndustryJobs.cs deleted file mode 100644 index 4ce2a87..0000000 --- a/EveLib.EveOnline/Models/Character/NewIndustryJobs.cs +++ /dev/null @@ -1,225 +0,0 @@ -using System; -using System.Xml.Serialization; -using eZet.EveLib.Modules.Util; - -namespace eZet.EveLib.Modules.Models.Character { - /// - /// Represents a IndustryJobs response - /// - [Serializable] - [XmlRoot("result")] - public class NewIndustryJobs { - - /// - /// A list of industry jobs - /// - [XmlElement("rowset")] - public EveOnlineRowCollection Jobs { get; set; } - - /// - /// Represents a industry job - /// - [Serializable] - [XmlRoot("row")] - public class NewIndustryJob { - /// - /// The job ID - /// - [XmlAttribute("jobID")] - public long JobId { get; set; } - - /// - /// The installer entity ID - /// - [XmlAttribute("installerID")] - public long InstallerId { get; set; } - - /// - /// The installer's name - /// - [XmlAttribute("installerName")] - public string InstallerName { get; set; } - - /// - /// The id of the facility the job was installed in - /// - [XmlAttribute("facilityID")] - public long FacilityId { get; set; } - - /// - /// The solar system ID of the facility - /// - [XmlAttribute("solarSystemID")] - public int SolarSystemId { get; set; } - - /// - /// The solar system name - /// - [XmlAttribute("solarSystemName")] - public string SolarSystemName { get; set; } - - /// - /// The station ID - /// - [XmlAttribute("stationID")] - public int StationId { get; set; } - - /// - /// The activity ID - /// - [XmlAttribute("activityID")] - public int ActivityId { get; set; } - - /// - /// The blueprint ID - /// - [XmlAttribute("blueprintID")] - public int BlueprintId { get; set; } - - /// - /// The blueprint type ID - /// - [XmlAttribute("blueprintTypeID")] - public int BlueprintTypeId { get; set; } - - /// - /// The blueprint name - /// - [XmlAttribute("blueprintTypeName")] - public string BueprintTypeName { get; set; } - - /// - /// The location ID for the blueprint - /// - [XmlAttribute("blueprintLocationID")] - public long BlueprintLocationId { get; set; } - - /// - /// The location ID for the job output - /// - [XmlAttribute("outputLocationID")] - public long OutputLocationId { get; set; } - - /// - /// The number of runs - /// - [XmlAttribute("runs")] - public int Runs { get; set; } - - /// - /// The job cost - /// - [XmlAttribute("cost")] - public decimal Cost { get; set; } - - /// - /// The team ID - /// - [XmlAttribute("teamID")] - public int TeamId { get; set; } - - /// - /// The number of licensed runs - /// - [XmlAttribute("licensedRuns")] - public int LicensedRuns { get; set; } - - /// - /// The probability of success for invention - /// - [XmlAttribute("probability")] - public float Probability { get; set; } - - /// - /// The type ID of the final product - /// - [XmlAttribute("productTypeID")] - public int ProductTypeId { get; set; } - - /// - /// The type name of the final product - /// - [XmlAttribute("productTypeName")] - public string ProductTypeName { get; set; } - - /// - /// The job status - /// - [XmlAttribute("status")] - public string Status { get; set; } - - /// - /// The time left on the job, in seconds - /// - [XmlAttribute("timeInSeconds")] - public int timeInSeconds { get; set; } - - /// - /// The start date - /// - [XmlIgnore] - public DateTime StartDate { get; private set; } - - /// - /// The start date - /// - [XmlAttribute("startDate")] - public string StartDateAsString { - get { return StartDate.ToString(XmlHelper.DateFormat); } - set { StartDate = DateTime.ParseExact(value, XmlHelper.DateFormat, null); } - } - - /// - /// The end date - /// - [XmlIgnore] - public DateTime EndDate { get; private set; } - - /// - /// The end date - /// - [XmlAttribute("endDate")] - public string EndDateAsString { - get { return EndDate.ToString(XmlHelper.DateFormat); } - set { EndDate = DateTime.ParseExact(value, XmlHelper.DateFormat, null); } - } - - - /// - /// The pause date, if any - /// - [XmlIgnore] - public DateTime PauseDate { get; private set; } - - /// - /// The pause date, if any - /// - [XmlAttribute("pauseDate")] - public string PauseDateAsString { - get { return PauseDate.ToString(XmlHelper.DateFormat); } - set { PauseDate = DateTime.ParseExact(value, XmlHelper.DateFormat, null); } - } - - /// - /// The date the job completed, if any - /// - [XmlIgnore] - public DateTime CompletedDate { get; private set; } - - /// - /// The date the job completed, if any - /// - [XmlAttribute("completedDate")] - public string CompletedDateAsString { - get { return CompletedDate.ToString(XmlHelper.DateFormat); } - set { CompletedDate = DateTime.ParseExact(value, XmlHelper.DateFormat, null); } - } - - /// - /// The ID of the character that completed the job - /// - [XmlAttribute("completedCharacterID")] - public long CompletedCharacterId { get; set; } - } - } -} \ No newline at end of file diff --git a/EveLib.Tests/CharacterKey_Beta.cs b/EveLib.Tests/CharacterKey_Beta.cs index c79e07e..d50bc65 100644 --- a/EveLib.Tests/CharacterKey_Beta.cs +++ b/EveLib.Tests/CharacterKey_Beta.cs @@ -21,14 +21,5 @@ public CharacterKey_Beta() { _sisiKey.Characters.First().BaseUri = "https://api.testeveonline.com"; } - [TestMethod] - public async Task GetNewIndustryJobs_NoErrors() { - EveApiResponse data = await _sisiKey.Characters.First().GetNewIndustryJobsAsync(); - } - - [TestMethod] - public async Task GetIndustryJobsHistory_NoErrors() { - EveApiResponse data = await _sisiKey.Characters.First().GetNewIndustryJobsAsync(); - } } } \ No newline at end of file diff --git a/EveLib.Tests/CharacterKey_ValidKeyTests.cs b/EveLib.Tests/CharacterKey_ValidKeyTests.cs index d390914..6b394f9 100644 --- a/EveLib.Tests/CharacterKey_ValidKeyTests.cs +++ b/EveLib.Tests/CharacterKey_ValidKeyTests.cs @@ -101,9 +101,13 @@ public void GetFactionWarfareStats_InvalidRequest_InvalidRequestException() { } [TestMethod] - public void GetIndustryJobs_ValidRequest_HasResult() { - EveApiResponse res = _validKey.Characters[0].GetIndustryJobs(); - Assert.IsNotNull(res.Result); + public async Task GetIndustryJobs_NoErrors() { + EveApiResponse data = await _validKey.Characters.First().GetIndustryJobsAsync(); + } + + [TestMethod] + public async Task GetIndustryJobsHistory_NoErrors() { + EveApiResponse data = await _validKey.Characters.First().GetIndustryJobsAsync(); } [TestMethod] diff --git a/EveLib.Tests/CorporationKey_Beta.cs b/EveLib.Tests/CorporationKey_Beta.cs index 5b26bb8..98688d8 100644 --- a/EveLib.Tests/CorporationKey_Beta.cs +++ b/EveLib.Tests/CorporationKey_Beta.cs @@ -21,19 +21,6 @@ public CorporationKey_Beta() { _sisiKey.Corporation.BaseUri = "https://api.testeveonline.com"; } - [TestMethod] - public async Task GetNewIndustryJobs_NoErrors() { - EveApiResponse result = await _sisiKey.Corporation.GetIndustryJobsAsync(); - } - - [TestMethod] - public async Task GetIndustryJobsHistory_NoErrors() { - EveApiResponse result = await _sisiKey.Corporation.GetIndustryJobsAsync(); - } - [TestMethod] - public async Task GetFacilities_NoErrors() { - EveApiResponse result = await _sisiKey.Corporation.GetFacilitiesAsync(); - } } } \ No newline at end of file diff --git a/EveLib.Tests/CorporationKey_ValidKeyTests.cs b/EveLib.Tests/CorporationKey_ValidKeyTests.cs index 0a5c238..08e062d 100644 --- a/EveLib.Tests/CorporationKey_ValidKeyTests.cs +++ b/EveLib.Tests/CorporationKey_ValidKeyTests.cs @@ -82,9 +82,18 @@ public void GetFactionalWarfareStats_InvalidRequest_InvalidRequestException() { } [TestMethod] - public void GetIndustryJobs_ValidRequest_HasResult() { - EveApiResponse res = _validKey.Corporation.GetIndustryJobs(); - Assert.IsNotNull(res.Result); + public async Task GetIndustryJobs_NoErrors() { + EveApiResponse result = await _validKey.Corporation.GetIndustryJobsAsync(); + } + + [TestMethod] + public async Task GetIndustryJobsHistory_NoErrors() { + EveApiResponse result = await _validKey.Corporation.GetIndustryJobsAsync(); + } + + [TestMethod] + public async Task GetFacilities_NoErrors() { + EveApiResponse result = await _validKey.Corporation.GetFacilitiesAsync(); } [TestMethod]