コード例 #1
0
 private void Serialize()
 {
     using (var stream = new MemoryStream())
     {
         _serializer.Serialize(stream);
         IoC.Get <IToolboxStateBackupProvider>().CreateBackupFromStream(stream);
     }
 }
コード例 #2
0
        public override void StoreSettings()
        {
            var document = new XmlDocument();

            using (var stream = new MemoryStream())
            {
                _serializer.Serialize(stream);
                stream.Seek(0L, SeekOrigin.Begin);
                document.Load(stream);
            }
            if (document.FirstChild.NodeType == XmlNodeType.XmlDeclaration)
            {
                document.RemoveChild(document.FirstChild);
            }
            SetSettingsModel(document, true);
        }