/// <summary> /// 数値特殊指定数値初期値 /// </summary> /// <param name="status">読み込み経過状態</param> /// <returns>数値特殊指定数値初期値リスト</returns> private List <int> ReadInitValue(FileReadStatus status) { Logger.Debug(FileIOMessage.StartCommonRead(typeof(SpecialArgDescReader), "数値特殊指定数値初期値")); var result = new List <int>(); var length = status.ReadInt(); status.IncreaseIntOffset(); Logger.Debug(FileIOMessage.SuccessRead(typeof(SpecialArgDescReader), "数値特殊指定数値初期値の数", length)); for (var i = 0; i < length; i++) { var value = status.ReadInt(); status.IncreaseIntOffset(); result.Add(value); Logger.Debug(FileIOMessage.SuccessRead(typeof(SpecialArgDescReader), $"数値特殊指定数値{i}の初期値", value)); } Logger.Debug(FileIOMessage.EndCommonRead(typeof(SpecialArgDescReader), "数値特殊指定数値初期値")); return(result); }
/// <summary> /// データIDの設定方法 /// </summary> /// <param name="status">読み込み経過状態</param> /// <param name="setting">結果格納インスタンス</param> private void ReadDataSettingType(FileReadStatus status, DBDataSetting setting) { var typeCode = status.ReadInt(); status.IncreaseIntOffset(); var settingType = DBDataSettingType.FromValue(typeCode); Logger.Debug(FileIOMessage.SuccessRead(typeof(DBDataSettingReader), "データID設定方法", settingType)); // 「指定DBの指定タイプ」の場合、DB種別とタイプIDを取り出す DBKind dbKind = null; TypeId typeId = 0; if (settingType == DBDataSettingType.DesignatedType) { dbKind = DbKindFromSettingTypeCode(typeCode); Logger.Debug(FileIOMessage.SuccessRead(typeof(DBDataSettingReader), "DB種別", dbKind)); typeId = TypeIdFromSettingTypeCode(typeCode); Logger.Debug(FileIOMessage.SuccessRead(typeof(DBDataSettingReader), "タイプID", typeId)); } setting.SetDataSettingType(settingType, dbKind, typeId); }
/// <summary> /// タイルセット設定 /// </summary> /// <param name="status">読み込み経過状態</param> /// <param name="nodes">読み込み結果格納インスタンス</param> private void ReadTreeNodeList(FileReadStatus status, out List <MapTreeNode> nodes) { // ノード数 var length = status.ReadInt(); status.IncreaseIntOffset(); Logger.Debug(FileIOMessage.SuccessRead(typeof(MapTreeDataFileReader), "マップツリーノード数", length)); nodes = new List <MapTreeNode>(); for (var i = 0; i < length; i++) { var parent = status.ReadInt(); status.IncreaseIntOffset(); Logger.Debug(FileIOMessage.SuccessRead(typeof(MapTreeDataFileReader), $"マップツリーノード{i} 親マップID", parent)); var me = status.ReadInt(); status.IncreaseIntOffset(); Logger.Debug(FileIOMessage.SuccessRead(typeof(MapTreeDataFileReader), $"マップツリーノード{i} 自身マップID", me)); nodes.Add(new MapTreeNode(me, parent)); } }
// _/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/ // ReadMethod // _/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/ private void ReadOneData(TIniTarget target) { var section = target.SectionName; var properties = GetAllPropertyInfo(); foreach (var propertyInfo in properties) { var iniTargetAttr = (IniTargetAttribute)propertyInfo.GetCustomAttribute(typeof(IniTargetAttribute), true); if (VersionConfig.IsUnderVersion(iniTargetAttr.SupportMinVersion)) { // サポート対象外の場合、ファイルからは取得できないため固定で空文字をセット propertyInfo.SetValue(target, string.Empty); continue; } var sb = new StringBuilder(256); IniFileHelper.GetPrivateProfileString(section ?? "", propertyInfo.Name, "", sb, sb.Capacity, FilePath); var result = sb.ToString(); Logger.Debug(FileIOMessage.SuccessRead(GetType(), $"プロパティ:{propertyInfo.Name}", result)); propertyInfo.SetValue(target, sb.ToString()); } }
/// <summary> /// DBデータの文字列項目 /// </summary> /// <param name="status">読み込み経過状態</param> /// <param name="values">読み込み結果</param> private void ReadDbDataStringValues(FileReadStatus status, out IReadOnlyList <DBItemValue> values) { // 数値項目数 var length = status.ReadInt(); status.IncreaseIntOffset(); Logger.Debug(FileIOMessage.SuccessRead(typeof(DBDataFileReader), "文字列項目数", length)); var result = new List <DBItemValue>(); for (var i = 0; i < length; i++) { var value = status.ReadString(); status.AddOffset(value.ByteLength); Logger.Debug(FileIOMessage.SuccessRead(typeof(DBDataFileReader), $" 文字列項目{i,2}", value)); DBValueString dbValueString = value.String; result.Add(dbValueString); } values = result; }
/// <summary> /// DBデータの数値項目 /// </summary> /// <param name="status">読み込み経過状態</param> /// <param name="values">読み込み結果</param> private void ReadDbDataIntValues(FileReadStatus status, out IReadOnlyList <DBItemValue> values) { // 数値項目数 var length = status.ReadInt(); status.IncreaseIntOffset(); Logger.Debug(FileIOMessage.SuccessRead(typeof(DBDataFileReader), "数値項目数", length)); var result = new List <DBItemValue>(); for (var i = 0; i < length; i++) { var value = status.ReadInt(); status.IncreaseIntOffset(); Logger.Debug(FileIOMessage.SuccessRead(typeof(DBDataFileReader), $" 数値項目{i,2}", value)); result.Add((DBValueInt)value); } values = result; }
/// <summary> /// イベントコマンドの動作指定コマンド /// </summary> /// <param name="status">読み込み経過状態</param> /// <param name="actionEntry">データ格納先</param> /// <exception cref="InvalidOperationException">ファイル仕様が異なる場合</exception> private void ReadEventActionEntry(FileReadStatus status, ActionEntry actionEntry) { Logger.Debug(FileIOMessage.StartCommonRead(typeof(EventCommandListReader), "動作指定コマンド")); // ヘッダチェック foreach (var b in ActionEntry.HeaderBytes) { if (status.ReadByte() != b) { throw new InvalidOperationException( $"イベントコマンド中のイベントコマンドヘッダの値が異なります。(offset: {status.Offset})"); } status.IncreaseByteOffset(); } Logger.Debug(FileIOMessage.CheckOk(typeof(EventCommandListReader), "動作指定コマンドヘッダ")); // 動作フラグ var optionFlag = status.ReadByte(); actionEntry.SetOptionFlag(optionFlag); status.IncreaseByteOffset(); Logger.Debug(FileIOMessage.SuccessRead(typeof(EventCommandListReader), "数値変数の数", optionFlag)); // 動作コマンドリスト actionEntry.CommandList = ReadCharaMoveCommand(status); Logger.Debug(FileIOMessage.EndCommonRead(typeof(EventCommandListReader), "動作指定コマンド")); }
/// <summary> /// 項目特殊指定 /// </summary> /// <param name="status">読み込み経過状態</param> /// <returns>項目項目特殊指定リスト</returns> private List <DBItemSpecialSettingType> ReadItemSpecialSettingType(FileReadStatus status) { var length = status.ReadInt(); status.IncreaseIntOffset(); Logger.Debug(FileIOMessage.SuccessRead(typeof(DBTypeSettingReader), "項目特殊指定数", length)); var result = new List <DBItemSpecialSettingType>(); for (var i = 0; i < length; i++) { var value = status.ReadByte(); status.IncreaseByteOffset(); var type = DBItemSpecialSettingType.FromByte(value); Logger.Debug(FileIOMessage.SuccessRead(typeof(DBTypeSettingReader), $" 項目特殊指定{i,2}", type)); result.Add(type); } return(result); }
/// <summary> /// マップサイズ縦 /// </summary> /// <param name="status">読み込み経過状態</param> /// <param name="mapData">データ格納マップデータインスタンス</param> private void ReadMapSizeHeight(FileReadStatus status, MapData mapData) { mapData.UpdateMapSizeHeight(status.ReadInt()); status.IncreaseIntOffset(); Logger.Debug(FileIOMessage.SuccessRead(typeof(MpsFileReader), "マップサイズ縦", mapData.MapSizeHeight)); }
/// <summary> /// タイルセットID /// </summary> /// <param name="status">読み込み経過状態</param> /// <param name="mapData">データ格納マップデータインスタンス</param> private void ReadTileSetId(FileReadStatus status, MapData mapData) { mapData.TileSetId = status.ReadInt(); status.IncreaseIntOffset(); Logger.Debug(FileIOMessage.SuccessRead(typeof(MpsFileReader), "タイルセットID", mapData.TileSetId)); }
/// <summary> /// 文字列引数の数 /// </summary> /// <param name="status">読み込み経過状態</param> /// <param name="commonEvent">結果格納インスタンス</param> private void ReadStringArgLength(FileReadStatus status, CommonEvent commonEvent) { commonEvent.StrArgsLength = status.ReadByte(); status.IncreaseByteOffset(); Logger.Debug(FileIOMessage.SuccessRead(typeof(CommonEventReader), "文字列引数の数", commonEvent.StrArgsLength)); }
/// <summary> /// コモンイベントID /// </summary> /// <param name="status">読み込み経過状態</param> /// <param name="commonEvent">結果格納インスタンス</param> private void ReadCommonEventId(FileReadStatus status, CommonEvent commonEvent) { commonEvent.Id = status.ReadInt(); status.IncreaseIntOffset(); Logger.Debug(FileIOMessage.SuccessRead(typeof(CommonEventReader), "コモンイベントID", commonEvent.Id)); }
/// <summary> /// 起動条件右辺 /// </summary> /// <param name="status">読み込み経過状態</param> /// <param name="condition">結果格納インスタンス</param> private void ReadBootConditionRightSide(FileReadStatus status, CommonEventBootCondition condition) { condition.RightSide = status.ReadInt(); status.IncreaseIntOffset(); Logger.Debug(FileIOMessage.SuccessRead(typeof(CommonEventReader), "起動条件右辺", condition.RightSide)); }
/// <summary> /// メモ前の文字列 /// </summary> /// <param name="status">読み込み経過状態</param> /// <param name="commonEvent">結果格納インスタンス</param> private void ReadBeforeMemoString(FileReadStatus status, CommonEvent commonEvent) { var str = status.ReadString(); commonEvent.Description = str.String; status.AddOffset(str.ByteLength); Logger.Debug(FileIOMessage.SuccessRead(typeof(CommonEventReader), "メモ前の文字列", commonEvent.Description)); }
/// <summary> /// コモンイベント名 /// </summary> /// <param name="status">読み込み経過状態</param> /// <param name="commonEvent">結果格納インスタンス</param> private void ReadCommonEventName(FileReadStatus status, CommonEvent commonEvent) { var commonEventName = status.ReadString(); commonEvent.Name = commonEventName.String; status.AddOffset(commonEventName.ByteLength); Logger.Debug(FileIOMessage.SuccessRead(typeof(CommonEventReader), "コモンイベント名", commonEvent.Name)); }
/// <summary> /// ヘッダ文字列 /// </summary> /// <param name="status">読み込み経過状態</param> /// <param name="mapData">データ格納マップデータインスタンス</param> private void ReadHeaderMemo(FileReadStatus status, MapData mapData) { var woditorString = status.ReadString(); mapData.Memo = woditorString.String; status.AddOffset(woditorString.ByteLength); Logger.Debug(FileIOMessage.SuccessRead(typeof(MpsFileReader), "ヘッダ文字列", mapData.Memo)); }
/// <summary> /// メモ /// </summary> /// <param name="status">読み込み経過状態</param> /// <param name="commonEvent">結果格納インスタンス</param> private void ReadMemo(FileReadStatus status, CommonEvent commonEvent) { var str = status.ReadString(); commonEvent.Memo = str.String; status.AddOffset(str.ByteLength); Logger.Debug(FileIOMessage.SuccessRead(typeof(CommonEventReader), "メモ", commonEvent.Memo)); }
/// <summary> /// 基本タイルセットファイル名 /// </summary> /// <param name="status">読み込み経過状態</param> /// <param name="fileName">結果格納インスタンス</param> private void ReadBaseTileSetFileName(FileReadStatus status, out BaseTileSetFileName fileName) { var read = status.ReadString(); fileName = read.String; status.AddOffset(read.ByteLength); Logger.Debug(FileIOMessage.SuccessRead(typeof(TileSetSettingReader), "基本タイルセットファイル名", fileName)); }
/// <summary> /// メモ /// </summary> /// <param name="status">読み込み経過状態</param> /// <param name="setting">結果格納インスタンス</param> private void ReadMemo(FileReadStatus status, DBTypeSetting setting) { var memo = status.ReadString(); setting.Memo = memo.String; status.AddOffset(memo.ByteLength); Logger.Debug(FileIOMessage.SuccessRead(typeof(DBTypeSettingReader), "メモ", memo.String)); }
/// <summary> /// タイプ名 /// </summary> /// <param name="status">読み込み経過状態</param> /// <param name="setting">結果格納インスタンス</param> private void ReadTypeName(FileReadStatus status, DBTypeSetting setting) { var typeName = status.ReadString(); setting.TypeName = typeName.String; status.AddOffset(typeName.ByteLength); Logger.Debug(FileIOMessage.SuccessRead(typeof(DBTypeSettingReader), "タイプ名", setting.TypeName)); }
/// <summary> /// ラベル色 /// </summary> /// <param name="status">読み込み経過状態</param> /// <param name="commonEvent">結果格納インスタンス</param> private void ReadLabelColor(FileReadStatus status, CommonEvent commonEvent) { var colorNumber = status.ReadInt(); status.IncreaseIntOffset(); commonEvent.LabelColor = CommonEventLabelColor.FromInt(colorNumber); Logger.Debug(FileIOMessage.SuccessRead(typeof(CommonEventReader), "ラベル色", commonEvent.LabelColor)); }
/// <summary> /// マップイベント数 /// </summary> /// <param name="status">読み込み経過状態</param> private int ReadMapEventLength(FileReadStatus status) { var length = status.ReadInt(); status.IncreaseIntOffset(); Logger.Debug(FileIOMessage.SuccessRead(typeof(MpsFileReader), "マップイベント数", length)); return(length); }
/// <summary> /// タイプ名 /// </summary> /// <param name="status">読み込み経過状態</param> /// <param name="name">結果格納インスタンス</param> private void ReadName(FileReadStatus status, out TileSetName name) { var read = status.ReadString(); name = read.String; status.AddOffset(read.ByteLength); Logger.Debug(FileIOMessage.SuccessRead(typeof(TileSetSettingReader), "設定名", name)); }
/// <summary> /// 返戻セルフ変数インデックス /// </summary> /// <param name="status">読み込み経過状態</param> /// <param name="commonEvent">結果格納インスタンス</param> private void ReadReturnVariableIndex(FileReadStatus status, CommonEvent commonEvent) { var index = status.ReadInt(); status.IncreaseIntOffset(); commonEvent.SetReturnVariableIndex(index); Logger.Debug(FileIOMessage.SuccessRead(typeof(CommonEventReader), "返戻セルフ変数インデックス", index)); }
/// <summary> /// 返戻値の意味 /// </summary> /// <param name="status">読み込み経過状態</param> /// <param name="commonEvent">結果格納インスタンス</param> private void ReadReturnValueDescription(FileReadStatus status, CommonEvent commonEvent) { var description = status.ReadString(); status.AddOffset(description.ByteLength); commonEvent.ReturnValueDescription = description.String; Logger.Debug(FileIOMessage.SuccessRead(typeof(CommonEventReader), "返戻値の意味", commonEvent.ReturnValueDescription)); }
/// <summary> /// フッタ文字列 /// </summary> /// <param name="status">読み込み経過状態</param> /// <param name="commonEvent">結果格納インスタンス</param> private void ReadFooterString(FileReadStatus status, CommonEvent commonEvent) { var footerString = status.ReadString(); status.AddOffset(footerString.ByteLength); commonEvent.FooterString = footerString.String; Logger.Debug(FileIOMessage.SuccessRead(typeof(CommonEventReader), "フッタ文字列", commonEvent.FooterString)); }
/// <summary> /// イベントコマンド /// </summary> /// <param name="status">読み込み経過状態</param> /// <param name="commonEvent">結果格納インスタンス</param> private void ReadEventCommand(FileReadStatus status, CommonEvent commonEvent) { var length = status.ReadInt(); status.IncreaseIntOffset(); Logger.Debug(FileIOMessage.SuccessRead(typeof(CommonEventReader), "イベントコマンド数", length)); var reader = new EventCommandListReader(status, length); commonEvent.EventCommands = reader.Read(); }
/// <summary> /// 起動条件比較演算子 & 起動条件 /// </summary> /// <param name="status">読み込み経過状態</param> /// <param name="condition">結果格納インスタンス</param> private void ReadBootConditionOperationAndType(FileReadStatus status, CommonEventBootCondition condition) { var b = status.ReadByte(); status.IncreaseByteOffset(); condition.Operation = CriteriaOperator.FromByte((byte)(b & 0xF0)); condition.CommonEventBootType = CommonEventBootType.FromByte((byte)(b & 0x0F)); Logger.Debug(FileIOMessage.SuccessRead(typeof(CommonEventReader), "起動条件比較演算子", condition.Operation)); Logger.Debug(FileIOMessage.SuccessRead(typeof(CommonEventReader), "起動条件", condition.CommonEventBootType)); }
/// <summary> /// DBデータ設定 /// </summary> /// <param name="status">読み込み経過状態</param> /// <param name="data">結果格納インスタンス</param> private void ReadDBData(FileReadStatus status, DatabaseDat data) { var length = status.ReadInt(); status.IncreaseIntOffset(); Logger.Debug(FileIOMessage.SuccessRead(typeof(DBDataSettingReader), "タイプ数", length)); var reader = new DBDataSettingReader(status, length); data.SettingList.AddRange(reader.Read()); Logger.Debug(FileIOMessage.EndCommonRead( typeof(DatabaseDatFileReader), "DBデータ設定")); }
/// <summary> /// オートタイルファイル名 /// </summary> /// <param name="status">読み込み経過状態</param> /// <param name="listLength">オートタイルファイル名数</param> /// <param name="list">結果格納インスタンス</param> private void ReadAutoTileSetFileNameList(FileReadStatus status, int listLength, out List <AutoTileFileName> list) { list = new List <AutoTileFileName>(); for (var i = 0; i < listLength; i++) { var read = status.ReadString(); AutoTileFileName fileName = read.String; list.Add(fileName); status.AddOffset(read.ByteLength); Logger.Debug(FileIOMessage.SuccessRead(typeof(TileSetSettingReader), $"オートタイル{i}ファイル名", fileName)); } }