Skip to content

Commit

Permalink
Refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
Citrinate committed Jan 2, 2024
1 parent 64ca70d commit cd3c579
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 13 deletions.
15 changes: 3 additions & 12 deletions BoosterManager/Commands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1139,10 +1139,7 @@ internal static class Commands {

ItemIdentifier itemIdentifier;
try {
itemIdentifier = new ItemIdentifier(itemIdentifierAsText);
if (marketable != null) {
itemIdentifier.Marketable = marketable;
}
itemIdentifier = new ItemIdentifier(itemIdentifierAsText, marketable);
} catch (Exception) {
return FormatBotResponse(bot, String.Format("Invalid Item Identifier: {0}", itemIdentifierAsText));
}
Expand Down Expand Up @@ -1231,10 +1228,7 @@ internal static class Commands {

ItemIdentifier itemIdentifier;
try {
itemIdentifier = new ItemIdentifier(itemIdentifierAsText);
if (marketable != null) {
itemIdentifier.Marketable = marketable;
}
itemIdentifier = new ItemIdentifier(itemIdentifierAsText, marketable);
} catch (Exception) {
return FormatBotResponse(bot, String.Format("Invalid Item Identifier: {0}", itemIdentifierAsText));
}
Expand Down Expand Up @@ -1362,10 +1356,7 @@ internal static class Commands {
List<ItemIdentifier> itemIdentifiers = new List<ItemIdentifier>();
foreach (string itemIdentifierString in itemIdentifierStrings) {
try {
ItemIdentifier itemIdentifier = new ItemIdentifier(itemIdentifierString);
if (marketable != null) {
itemIdentifier.Marketable = marketable;
}
ItemIdentifier itemIdentifier = new ItemIdentifier(itemIdentifierString, marketable);
itemIdentifiers.Add(itemIdentifier);
} catch (Exception) {
return FormatBotResponse(bot, String.Format("Invalid Item Identifier: {0}", itemIdentifierString));
Expand Down
4 changes: 3 additions & 1 deletion BoosterManager/Data/ItemIdentifier.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ internal sealed class ItemIdentifier {

internal ItemIdentifier() {}

internal ItemIdentifier(string identityString) {
internal ItemIdentifier(string identityString, bool? marketable = null) {
Marketable = marketable;

string[] ids = identityString.Split(Separator);
uint appID;
ulong contextID;
Expand Down

0 comments on commit cd3c579

Please sign in to comment.