Exemplo n.º 1
0
        private static void XmlSerializer(DiscoveryResultBase data)
        {
            Type type = typeof(DiscoveryResultBase);

            using (FileStream fileStream = new FileStream(DiscoveryResultManager.GetFilename(type), FileMode.Create))
            {
                new DataContractSerializer(type).WriteObject(XmlDictionaryWriter.CreateTextWriter((Stream)fileStream), (object)data);
                fileStream.Flush();
                fileStream.Close();
            }
        }
        // Token: 0x060002C3 RID: 707 RVA: 0x00011648 File Offset: 0x0000F848
        private static void XmlSerializer(DiscoveryResultBase data)
        {
            Type typeFromHandle = typeof(DiscoveryResultBase);
            DataContractSerializer dataContractSerializer = new DataContractSerializer(typeFromHandle);

            using (FileStream fileStream = new FileStream(DiscoveryResultManager.GetFilename(typeFromHandle), FileMode.Create))
            {
                XmlDictionaryWriter writer = XmlDictionaryWriter.CreateTextWriter(fileStream);
                dataContractSerializer.WriteObject(writer, data);
                fileStream.Flush();
                fileStream.Close();
            }
        }
Exemplo n.º 3
0
        private static void BinarySerializer(DiscoveryResultBase data)
        {
            FileStream      fileStream      = new FileStream(DiscoveryResultManager.GetFilename(typeof(DiscoveryResultBase)), FileMode.Create);
            BinaryFormatter binaryFormatter = new BinaryFormatter();

            try
            {
                binaryFormatter.Serialize((Stream)fileStream, (object)data);
            }
            finally
            {
                fileStream.Close();
            }
        }