示例#1
0
        public void Add(string boundAssemblyName, string boundTypeName, Type type)
        {
            if (this._asmNameToType.ContainsKey(boundAssemblyName))
            {
                Dictionary <string, Type> nameToType = this._asmNameToType[boundAssemblyName];
                if (nameToType.ContainsKey(boundTypeName))
                {
                    throw new ArgumentException("Assembly ve TypeName zaten içeriyor.");
                }
                else
                {
                    nameToType.Add(boundTypeName, type);
                }
            }
            else
            {
                Dictionary <string, Type> nameToType = new Dictionary <string, Type>();
                this._asmNameToType.Add(boundAssemblyName, nameToType);
                nameToType.Add(boundTypeName, type);
            }

            if (this._typeToNames.ContainsKey(type))
            {
                throw new ArgumentException("Tip zaten eklenmiş.");
            }
            else
            {
                AsmTypePair pair = new AsmTypePair();
                pair.AssemblyName = boundAssemblyName;
                pair.TypeName     = boundTypeName;
                this._typeToNames.Add(type, pair);
            }
        }
示例#2
0
 public override void BindToName(Type serializedType, ref string assemblyName, ref string typeName)
 {
     if (this._typeToNames.ContainsKey(serializedType))
     {
         AsmTypePair pair = this._typeToNames[serializedType];
         assemblyName = pair.AssemblyName;
         typeName     = pair.TypeName;
     }
 }