コード例 #1
0
 public override int GetHashCode()
 {
     unchecked
     {
         return((UserId * 397) ^ OldType.GetHashCode());
     }
 }
コード例 #2
0
            public async Task ShouldMigrateFromAssemblyAndTypeNameToType()
            {
                // Arrange
                var binder = new JsonTypeMigrationSerializationBinder();
                await binder.AddTypeMigrationAsync(new JsonTypeMigration(
                                                       "MADE.Data.Serialization.Tests",
                                                       "MADE.Data.Serialization.Tests.Tests.JsonTypeMigrationSerializationBinderTests+OldType",
                                                       typeof(NewType)));

                var oldType    = new OldType();
                var serialized = JsonConvert.SerializeObject(
                    oldType,
                    new JsonSerializerSettings {
                    TypeNameHandling = TypeNameHandling.All
                });

                // Act
                var deserialized = JsonConvert.DeserializeObject(
                    serialized,
                    new JsonSerializerSettings {
                    TypeNameHandling = TypeNameHandling.All, SerializationBinder = binder
                });

                // Assert
                deserialized.ShouldBeOfType(typeof(NewType));

                var newType = (NewType)deserialized;

                newType.Name.ShouldBe(oldType.Name);
                newType.Number.ShouldBe((double)oldType.Number);
            }
コード例 #3
0
        public override int GetHashCode()
        {
            unchecked
            {
                var hashCode = Type != null?Type.GetHashCode() : 0;

                hashCode = (hashCode * 397) ^ (Value != null ? Value.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ (OldType != null ? OldType.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ (OldValue != null ? OldValue.GetHashCode() : 0);
                return(hashCode);
            }
        }
コード例 #4
0
        protected override void InternalProcessRecord()
        {
            bool test = false;
            ShouldProcessReason reason;

            if (!base.ShouldProcess(null, null, null, out reason))
            {
                if (reason == ShouldProcessReason.WhatIf)
                {
                    test = true;
                }
            }

            string fileUrl = File.FileUrl;

            SetWebPart(fileUrl, OldType.Read(), NewType.Read(), Title, Properties, Publish, test);

            base.InternalProcessRecord();
        }
コード例 #5
0
ファイル: Program.cs プロジェクト: DongHyukLee74/Csharp60
        static void Main(string[] args)
        {
            #region 309

            /*
             * string txt = ConfigurationSettings.AppSettings["AdminEmailAddress"];
             * Console.WriteLine(txt);     // 출력 결과: [email protected]
             *
             * txt = ConfigurationSettings.AppSettings["Delay"];
             * int delay = int.Parse(txt);
             * Console.WriteLine(delay);   // 출력 결과: 5000
             *
             * txt = ConfigurationManager.AppSettings["AdminEmailAddress"];
             * Console.WriteLine(txt);
             * txt = ConfigurationManager.AppSettings["Delay"];
             * Console.WriteLine(txt);*/
            #endregion 309
            OldType my = new OldType();
        }
コード例 #6
0
        public void Write(SerializedWriter writer)
        {
            if (HasScriptTypeIndex(writer.Generation))
            {
                writer.Write((int)TypeID);
            }
            else
            {
                writer.Write(OriginalTypeID);
            }
            if (HasIsStrippedType(writer.Generation))
            {
                writer.Write(IsStrippedType);
            }
            if (HasScriptTypeIndex(writer.Generation))
            {
                writer.Write(ScriptTypeIndex);
            }

            if (HasHash(writer.Generation))
            {
                if (TypeID == ClassIDType.MonoBehaviour)
                {
                    ScriptID.Write(writer);
                }
                OldTypeHash.Write(writer);
            }

            if (OldType != null)
            {
                OldType.Write(writer);
                if (HasTypeDependencies(writer.Generation))
                {
                    writer.WriteArray(TypeDependencies);
                }
            }
        }
コード例 #7
0
        public void Read(SerializedReader reader)
        {
            if (HasScriptTypeIndex(reader.Generation))
            {
                TypeID = (ClassIDType)reader.ReadInt32();
            }
            else
            {
                OriginalTypeID = reader.ReadInt32();
            }
            if (HasIsStrippedType(reader.Generation))
            {
                IsStrippedType = reader.ReadBoolean();
            }
            if (HasScriptTypeIndex(reader.Generation))
            {
                ScriptTypeIndex = reader.ReadInt16();
            }

            if (HasHash(reader.Generation))
            {
                if (TypeID == ClassIDType.MonoBehaviour)
                {
                    ScriptID.Read(reader);
                }
                OldTypeHash.Read(reader);
            }

            if (OldType != null)
            {
                OldType.Read(reader);
                if (HasTypeDependencies(reader.Generation))
                {
                    TypeDependencies = reader.ReadInt32Array();
                }
            }
        }
コード例 #8
0
 static void Main(string[] args)
 {
     OldType my = new OldType();
 }