Exemple #1
0
        public static DBFilesClient Load(string path)
        {
            XmlSerializer deser = new XmlSerializer(typeof(DBFilesClient));

            using (var fs = new FileStream(path, FileMode.Open))
            {
                DBFilesClient cat = (DBFilesClient)deser.Deserialize(fs);
                cat.File = path;
                return(cat);
            }
        }
        public static void Save(DBFilesClient db)
        {
            string dir = Path.GetDirectoryName(db.File);

            if (!Directory.Exists(dir))
                Directory.CreateDirectory(dir);

            XmlSerializer ser = new XmlSerializer(typeof(DBFilesClient));
            XmlSerializerNamespaces namespaces = new XmlSerializerNamespaces();
            namespaces.Add(string.Empty, string.Empty);
            using (var fs = new FileStream(db.File, FileMode.Create))
                ser.Serialize(fs, db, namespaces);
        }
Exemple #3
0
        public static void Save(DBFilesClient db)
        {
            string dir = Path.GetDirectoryName(db.File);

            if (!Directory.Exists(dir))
            {
                Directory.CreateDirectory(dir);
            }

            XmlSerializer           ser        = new XmlSerializer(typeof(DBFilesClient));
            XmlSerializerNamespaces namespaces = new XmlSerializerNamespaces();

            namespaces.Add(string.Empty, string.Empty);
            using (var fs = new FileStream(db.File, FileMode.Create))
                ser.Serialize(fs, db, namespaces);
        }