public void TypeDictionaryHolderTest() { TypeDictionaryHolder typeDictionaryHolder = new TypeDictionaryHolder(); typeDictionaryHolder.LocalRememberedTypesDictionary = new Dictionary <Guid, ATypeRepresentation>(); typeDictionaryHolder.LocalRememberedTypesDictionary.Add(Guid.NewGuid(), new DllTypeMethod(this.GetType().GetMethods()[0])); Assert.AreEqual(1, typeDictionaryHolder.LocalRememberedTypesDictionary.Count); }
public void SerializeObjectToXMl(TypeDictionaryHolder typeDictionaryHolder, string pathToFile) { TypeDictionaryHolder dictionaryHolder = new TypeDictionaryHolder(); dictionaryHolder.LocalRememberedTypesDictionary = typeDictionaryHolder.LocalRememberedTypesDictionary; using (FileStream stream = File.Create(pathToFile)) { dataContractSerializer.WriteObject(stream, dictionaryHolder); } }
public void DllSerializeObject() { 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"); Assert.IsTrue(File.Exists(Environment.CurrentDirectory + "//test.xml")); }
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"); }