Skip to content
This repository has been archived by the owner on Jul 25, 2020. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Ocelot1210 committed Jun 9, 2020
2 parents c9cc8aa + d802524 commit def6c83
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 10 deletions.
File renamed without changes.
6 changes: 3 additions & 3 deletions X4_DataExporterWPF/Export/Equipment/Equipment.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using LibX4.FileSystem;
using LibX4.FileSystem;
using LibX4.Lang;
using System.Data;
using System.Data.SQLite;
Expand Down Expand Up @@ -132,8 +132,8 @@ FOREIGN KEY (SizeID) REFERENCES Size(SizeID)
string[] sizes = { "extrasmall", "small", "medium", "large", "extralarge" };

// 一致するサイズを探す
var tags = component.Attribute("tags").Value.Split(" ");
var size = sizes.Where(x => tags.Contains(x)).FirstOrDefault();
var tags = component?.Attribute("tags").Value.Split(" ");
var size = sizes.Where(x => tags?.Contains(x) == true).FirstOrDefault();
if (string.IsNullOrEmpty(size))
{
// 一致するサイズがなかった場合
Expand Down
6 changes: 3 additions & 3 deletions X4_DataExporterWPF/Export/Module/ModuleProduct.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using LibX4.FileSystem;
using LibX4.FileSystem;
using LibX4.Lang;
using System.Data;
using System.Data.SQLite;
Expand Down Expand Up @@ -113,8 +113,8 @@ FOREIGN KEY (WareID) REFERENCES Ware(WareID)

return (
module.Attribute("id").Value,
prod.Attribute("ware").Value,
prod.Attribute("method")?.Value ?? "default"
prod?.Attribute("ware").Value,
prod?.Attribute("method")?.Value ?? "default"
);
}
catch
Expand Down
9 changes: 5 additions & 4 deletions X4_DataExporterWPF/Export/Module/ModuleStorage.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using LibX4.FileSystem;
using LibX4.FileSystem;
using LibX4.Lang;
using System.Data;
using System.Data.SQLite;
Expand Down Expand Up @@ -103,15 +103,16 @@ FOREIGN KEY (TransportTypeID) REFERENCES TransportType(TransportTypeID)
var cargo = macroXml.Root.XPathSelectElement("macro/properties/cargo");

// 総合保管庫は飛ばす
if (cargo.Attribute("tags").Value.Contains(' '))
var tags = cargo?.Attribute("tags")?.Value;
if (tags?.Contains(' ') == true)
{
return ("", "", 0);
}

return (
module.Attribute("id").Value,
cargo.Attribute("tags").Value,
int.Parse(cargo.Attribute("max").Value)
tags,
int.Parse(cargo?.Attribute("max").Value)
);
}
catch
Expand Down

0 comments on commit def6c83

Please sign in to comment.