コード例 #1
0
        private fsResult InternalSerialize_3_ProcessVersioning(Type overrideConverterType, object instance, out fsData data)
        {
            // note: We do not have to take a Type parameter here, since at this
            //       point in the serialization algorithm inheritance has
            // *always* been handled. If we took a type parameter, it will
            // *always* be equal to instance.GetType(), so why bother taking the
            //  parameter?

            // Check to see if there is versioning information for this type. If
            // so, then we need to serialize it.
            fsOption <fsVersionedType> optionalVersionedType = fsVersionManager.GetVersionedType(instance.GetType());

            if (optionalVersionedType.HasValue)
            {
                fsVersionedType versionedType = optionalVersionedType.Value;

                // Serialize the actual object content; we'll just wrap it with
                // versioning metadata here.
                var result = InternalSerialize_4_Converter(overrideConverterType, instance, out data);
                if (result.Failed)
                {
                    return(result);
                }

                // Add the versioning information
                EnsureDictionary(data);
                data.AsDictionary[Key_Version] = new fsData(versionedType.VersionString);

                return(result);
            }

            // This type has no versioning information -- directly serialize it
            // using the selected converter.
            return(InternalSerialize_4_Converter(overrideConverterType, instance, out data));
        }
コード例 #2
0
ファイル: fsSerializer.cs プロジェクト: dqtoy/Irobata
        private fsResult InternalSerialize_3_ProcessVersioning(Type overrideConverterType, object instance, out fsData data)
        {
            // note: We do not have to take a Type parameter here, since at this point in the serialization
            //       algorithm inheritance has *always* been handled. If we took a type parameter, it will
            //       *always* be equal to instance.GetType(), so why bother taking the parameter?
            // 注:ここでは、直列化アルゴリズム継承のこの時点で*常に*処理されているので、ここではTypeパラメータを取る必要はありません。 型パラメータを取った場合、常に* instance * .GetType()と等しくなります。

            // Check to see if there is versioning information for this type. If so, then we need to serialize it.
            //このタイプのバージョニング情報があるかどうかを確認してください。 もしそうなら、それを直列化する必要があります。
            fsOption <fsVersionedType> optionalVersionedType = fsVersionManager.GetVersionedType(instance.GetType());

            if (optionalVersionedType.HasValue)
            {
                fsVersionedType versionedType = optionalVersionedType.Value;

                // Serialize the actual object content; we'll just wrap it with versioning metadata here.
                //実際のオブジェクトの内容をシリアル化する。 ここでバージョン管理のメタデータでラップします。
                var result = InternalSerialize_4_Converter(overrideConverterType, instance, out data);
                if (result.Failed)
                {
                    return(result);
                }

                // Add the versioning information
                //バージョン情報を追加する
                EnsureDictionary(data);
                data.AsDictionary[Key_Version] = new fsData(versionedType.VersionString);

                return(result);
            }

            // This type has no versioning information -- directly serialize it using the selected converter.
            // このタイプにはバージョン管理情報はありません。選択したコンバータを使用して直接シリアル化します。
            return(InternalSerialize_4_Converter(overrideConverterType, instance, out data));
        }