diff --git a/X4_DataExporterWPF/Export/Effect.cs b/X4_DataExporterWPF/Export/Common.cs similarity index 100% rename from X4_DataExporterWPF/Export/Effect.cs rename to X4_DataExporterWPF/Export/Common.cs diff --git a/X4_DataExporterWPF/Export/Equipment/Equipment.cs b/X4_DataExporterWPF/Export/Equipment/Equipment.cs index d15e84d..63604fb 100644 --- a/X4_DataExporterWPF/Export/Equipment/Equipment.cs +++ b/X4_DataExporterWPF/Export/Equipment/Equipment.cs @@ -1,4 +1,4 @@ -using LibX4.FileSystem; +using LibX4.FileSystem; using LibX4.Lang; using System.Data; using System.Data.SQLite; @@ -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)) { // 一致するサイズがなかった場合 diff --git a/X4_DataExporterWPF/Export/Module/ModuleProduct.cs b/X4_DataExporterWPF/Export/Module/ModuleProduct.cs index c8c40d3..d11edb9 100644 --- a/X4_DataExporterWPF/Export/Module/ModuleProduct.cs +++ b/X4_DataExporterWPF/Export/Module/ModuleProduct.cs @@ -1,4 +1,4 @@ -using LibX4.FileSystem; +using LibX4.FileSystem; using LibX4.Lang; using System.Data; using System.Data.SQLite; @@ -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 diff --git a/X4_DataExporterWPF/Export/Module/ModuleStorage.cs b/X4_DataExporterWPF/Export/Module/ModuleStorage.cs index ac99d63..2ef1ec3 100644 --- a/X4_DataExporterWPF/Export/Module/ModuleStorage.cs +++ b/X4_DataExporterWPF/Export/Module/ModuleStorage.cs @@ -1,4 +1,4 @@ -using LibX4.FileSystem; +using LibX4.FileSystem; using LibX4.Lang; using System.Data; using System.Data.SQLite; @@ -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