private static void ReadAllElements(XmlElement root, AttributePackage pack) { ReadPack rpack = new ReadPack(root, pack); SafeReadElement(rpack, ReadInformation, "Information"); SafeReadElement(rpack, ReadCaption, "Caption"); SafeReadElement(rpack, ReadHowto, "Howto"); SafeReadElement(rpack, ReadDerivate, "Derivate"); SafeReadElement(rpack, ReadRemark, "Remark"); SafeReadElement(rpack, ReadLicense, "License"); SafeReadElement(rpack, ReadUpdate, "Update"); }
private static void SafeReadElement(ReadPack rpack, DelegateToReadElement method, string sectionName) { // どこで読み込み不全を起こしているのかチェックする用 try { method(rpack.root, rpack.pack); } catch { MessageBox.Show(sectionName + "の読み込みに失敗しました.\n読み込んだXMLファイルのタグの閉じ忘れ等確認してください.", "読み込みエラー", MessageBoxButtons.OK, MessageBoxIcon.Error); } }