public List <ATypeRepresentation> GetRootTypes() { if (typeRepresentations == null) { LocalRememberedTypesDictionary = _dllSerializer.DeserializeXmlToObject(_pathToFile).LocalRememberedTypesDictionary; typeRepresentations = LocalRememberedTypesDictionary.Values.ToList(); } return(typeRepresentations); }
public void DllDeserializeObject() { DllSerializer dllSerializer = DllSerializer.SerializerInstance; TypeDictionaryHolder typeDictionaryHolder = new TypeDictionaryHolder(); typeDictionaryHolder.LocalRememberedTypesDictionary = new Dictionary <Guid, ATypeRepresentation>(); typeDictionaryHolder.LocalRememberedTypesDictionary.Add(Guid.NewGuid(), new DllTypeField(typeof(TestClass).GetField("TestInt"))); dllSerializer.SerializeObjectToXMl(typeDictionaryHolder, Environment.CurrentDirectory + "//test.xml"); TypeDictionaryHolder desTypeDictionaryHolder = dllSerializer.DeserializeXmlToObject(Environment.CurrentDirectory + "//test.xml"); Assert.AreEqual(desTypeDictionaryHolder.LocalRememberedTypesDictionary.Count, typeDictionaryHolder.LocalRememberedTypesDictionary.Count); }
private static void Main(string[] args) { Console.WriteLine(Directory.GetCurrentDirectory()); List <Type> types = DllReader.LoadConnectionTypes(Directory.GetCurrentDirectory()); var constructorInfos = types[12].GetProperties(BindingFlags.Public | BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.Instance); var test1 = constructorInfos[0].GetType(); var test2 = constructorInfos[0].PropertyType; Console.WriteLine(constructorInfos[0].ToString()); DllTypeManager dllTypeManager = new DllTypeManager(); var test = dllTypeManager.GetRootTypes(); DllSerializer dllSerializer = DllSerializer.SerializerInstance; dllSerializer.SerializeObjectToXMl(dllTypeManager, @"E:\Test.Xml"); TypeDictionaryHolder typeDictionaryHolder = dllSerializer.DeserializeXmlToObject(@"E:\Test.Xml"); Console.WriteLine("test"); }