Esempio n. 1
0
 private void InitSafeToDeserializeArray()
 {
     this._safeToDeserialize = new bool[this._typeTable.Length];
     for (int index = 0; index < this._typeTable.Length; ++index)
     {
         long   position = this._store.BaseStream.Position;
         string typeName;
         try
         {
             this._store.BaseStream.Position = (long)this._typeNamePositions[index];
             typeName = this._store.ReadString();
         }
         finally
         {
             this._store.BaseStream.Position = position;
         }
         RuntimeType  runtimeType = (RuntimeType)Type.GetType(typeName, false);
         AssemblyName asmName2;
         string       typeName2;
         if (runtimeType == (RuntimeType)null)
         {
             asmName2  = (AssemblyName)null;
             typeName2 = typeName;
         }
         else
         {
             if (runtimeType.BaseType == typeof(Enum))
             {
                 this._safeToDeserialize[index] = true;
                 continue;
             }
             typeName2 = runtimeType.FullName;
             asmName2  = new AssemblyName();
             RuntimeAssembly runtimeAssembly = (RuntimeAssembly)runtimeType.Assembly;
             asmName2.Init(runtimeAssembly.GetSimpleName(), runtimeAssembly.GetPublicKey(), (byte[])null, (Version)null, runtimeAssembly.GetLocale(), AssemblyHashAlgorithm.None, AssemblyVersionCompatibility.SameMachine, (string)null, AssemblyNameFlags.PublicKey, (StrongNameKeyPair)null);
         }
         foreach (string asmTypeName1 in ResourceReader.TypesSafeForDeserialization)
         {
             if (ResourceManager.CompareNames(asmTypeName1, typeName2, asmName2))
             {
                 this._safeToDeserialize[index] = true;
             }
         }
     }
 }
 private void InitSafeToDeserializeArray()
 {
     this._safeToDeserialize = new bool[this._typeTable.Length];
     for (int i = 0; i < this._typeTable.Length; i++)
     {
         string       str;
         AssemblyName name;
         string       fullName;
         long         position = this._store.BaseStream.Position;
         try
         {
             this._store.BaseStream.Position = this._typeNamePositions[i];
             str = this._store.ReadString();
         }
         finally
         {
             this._store.BaseStream.Position = position;
         }
         RuntimeType type = (RuntimeType)Type.GetType(str, false);
         if (type == null)
         {
             name     = null;
             fullName = str;
         }
         else
         {
             if (type.BaseType == typeof(Enum))
             {
                 this._safeToDeserialize[i] = true;
                 continue;
             }
             fullName = type.FullName;
             name     = new AssemblyName();
             RuntimeAssembly assembly = (RuntimeAssembly)type.Assembly;
             name.Init(assembly.GetSimpleName(), assembly.GetPublicKey(), null, null, assembly.GetLocale(), AssemblyHashAlgorithm.None, AssemblyVersionCompatibility.SameMachine, null, AssemblyNameFlags.PublicKey, null);
         }
         foreach (string str3 in TypesSafeForDeserialization)
         {
             if (ResourceManager.CompareNames(str3, fullName, name))
             {
                 this._safeToDeserialize[i] = true;
             }
         }
     }
 }