コード例 #1
0
        /// <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);
        }
コード例 #2
0
        /// <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);
        }
コード例 #3
0
        /// <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));
            }
        }
コード例 #4
0
        // _/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
        //     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());
            }
        }
コード例 #5
0
        /// <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;
        }
コード例 #6
0
        /// <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;
        }
コード例 #7
0
        /// <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),
                                                     "動作指定コマンド"));
        }
コード例 #8
0
        /// <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);
        }
コード例 #9
0
ファイル: MpsFileReader.cs プロジェクト: sono8stream/UniWolf
        /// <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));
        }
コード例 #10
0
ファイル: MpsFileReader.cs プロジェクト: sono8stream/UniWolf
        /// <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));
        }
コード例 #11
0
        /// <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));
        }
コード例 #12
0
        /// <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));
        }
コード例 #13
0
        /// <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));
        }
コード例 #14
0
        /// <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));
        }
コード例 #15
0
        /// <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));
        }
コード例 #16
0
ファイル: MpsFileReader.cs プロジェクト: sono8stream/UniWolf
        /// <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));
        }
コード例 #17
0
        /// <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));
        }
コード例 #18
0
        /// <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));
        }
コード例 #19
0
        /// <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));
        }
コード例 #20
0
        /// <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));
        }
コード例 #21
0
        /// <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));
        }
コード例 #22
0
ファイル: MpsFileReader.cs プロジェクト: sono8stream/UniWolf
        /// <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);
        }
コード例 #23
0
        /// <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));
        }
コード例 #24
0
        /// <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));
        }
コード例 #25
0
        /// <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));
        }
コード例 #26
0
        /// <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));
        }
コード例 #27
0
        /// <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();
        }
コード例 #28
0
        /// <summary>
        /// 起動条件比較演算子 &amp; 起動条件
        /// </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));
        }
コード例 #29
0
        /// <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データ設定"));
        }
コード例 #30
0
        /// <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));
            }
        }