public static void SaveToFile(KPTranslation kpTrl, string strFileName, IXmlSerializerEx xs) { if (xs == null) { throw new ArgumentNullException("xs"); } FileStream fs = new FileStream(strFileName, FileMode.Create, FileAccess.Write, FileShare.None); #if !KeePassLibSD GZipStream gz = new GZipStream(fs, CompressionMode.Compress); #else GZipOutputStream gz = new GZipOutputStream(fs); #endif XmlWriterSettings xws = new XmlWriterSettings(); xws.CheckCharacters = true; xws.Encoding = StrUtil.Utf8; xws.Indent = true; xws.IndentChars = "\t"; XmlWriter xw = XmlWriter.Create(gz, xws); xs.Serialize(xw, kpTrl); xw.Close(); gz.Close(); fs.Close(); }
public static void Save(KPTranslation kpTrl, Stream sOut, IXmlSerializerEx xs) { if (xs == null) { throw new ArgumentNullException("xs"); } #if !KeePassLibSD GZipStream gz = new GZipStream(sOut, CompressionMode.Compress); #else GZipOutputStream gz = new GZipOutputStream(sOut); #endif XmlWriterSettings xws = new XmlWriterSettings(); xws.CheckCharacters = true; xws.Encoding = StrUtil.Utf8; xws.Indent = true; xws.IndentChars = "\t"; XmlWriter xw = XmlWriter.Create(gz, xws); xs.Serialize(xw, kpTrl); xw.Close(); gz.Close(); sOut.Close(); }
public static KPTranslation Load(Stream s, IXmlSerializerEx xs) { if (xs == null) { throw new ArgumentNullException("xs"); } KPTranslation kpTrl = null; #if !KeePassLibSD using (GZipStream gz = new GZipStream(s, CompressionMode.Decompress)) #else using (GZipInputStream gz = new GZipInputStream(s)) #endif { kpTrl = (xs.Deserialize(gz) as KPTranslation); } #if KeePassUWP s.Dispose(); #else s.Close(); #endif return(kpTrl); }
public static void Save(KPTranslation kpTrl, Stream sOut, IXmlSerializerEx xs) { if (xs == null) { throw new ArgumentNullException("xs"); } #if !KeePassLibSD using (GZipStream gz = new GZipStream(sOut, CompressionMode.Compress)) #else using (GZipOutputStream gz = new GZipOutputStream(sOut)) #endif { using (XmlWriter xw = XmlUtilEx.CreateXmlWriter(gz)) { xs.Serialize(xw, kpTrl); } } #if KeePassUWP sOut.Dispose(); #else sOut.Close(); #endif }
public static void Save(KPTranslation kpTrl, string strFileName, IXmlSerializerEx xs) { using (FileStream fs = new FileStream(strFileName, FileMode.Create, FileAccess.Write, FileShare.None)) { Save(kpTrl, fs, xs); } }
public static KPTranslation Load(string strFile, IXmlSerializerEx xs) { KPTranslation kpTrl = null; using (FileStream fs = new FileStream(strFile, FileMode.Open, FileAccess.Read, FileShare.Read)) { kpTrl = Load(fs, xs); } return(kpTrl); }
public static KPTranslation LoadFromFile(string strFile, IXmlSerializerEx xs) { if (xs == null) { throw new ArgumentNullException("xs"); } FileStream fs = new FileStream(strFile, FileMode.Open, FileAccess.Read, FileShare.Read); #if !KeePassLibSD GZipStream gz = new GZipStream(fs, CompressionMode.Decompress); #else GZipInputStream gz = new GZipInputStream(fs); #endif KPTranslation kpTrl = (xs.Deserialize(gz) as KPTranslation); gz.Close(); fs.Close(); return(kpTrl); }
public static void SaveToFile(KPTranslation kpTrl, string strFileName, IXmlSerializerEx xs) { if(xs == null) throw new ArgumentNullException("xs"); FileStream fs = new FileStream(strFileName, FileMode.Create, FileAccess.Write, FileShare.None); #if !KeePassLibSD GZipStream gz = new GZipStream(fs, CompressionMode.Compress); #else GZipOutputStream gz = new GZipOutputStream(fs); #endif XmlWriterSettings xws = new XmlWriterSettings(); xws.CheckCharacters = true; xws.Encoding = StrUtil.Utf8; xws.Indent = true; xws.IndentChars = "\t"; XmlWriter xw = XmlWriter.Create(gz, xws); xs.Serialize(xw, kpTrl); xw.Close(); gz.Close(); fs.Close(); }
public static KPTranslation LoadFromFile(string strFile, IXmlSerializerEx xs) { if(xs == null) throw new ArgumentNullException("xs"); FileStream fs = new FileStream(strFile, FileMode.Open, FileAccess.Read, FileShare.Read); #if !KeePassLibSD GZipStream gz = new GZipStream(fs, CompressionMode.Decompress); #else GZipInputStream gz = new GZipInputStream(fs); #endif KPTranslation kpTrl = (xs.Deserialize(gz) as KPTranslation); gz.Close(); fs.Close(); return kpTrl; }
public static void Save(KPTranslation kpTrl, Stream sOut, IXmlSerializerEx xs) { if(xs == null) throw new ArgumentNullException("xs"); #if !KeePassLibSD GZipStream gz = new GZipStream(sOut, CompressionMode.Compress); #else GZipOutputStream gz = new GZipOutputStream(sOut); #endif XmlWriterSettings xws = new XmlWriterSettings(); xws.CheckCharacters = true; xws.Encoding = StrUtil.Utf8; xws.Indent = true; xws.IndentChars = "\t"; XmlWriter xw = XmlWriter.Create(gz, xws); xs.Serialize(xw, kpTrl); xw.Close(); gz.Close(); sOut.Close(); }
public static void Save(KPTranslation kpTrl, string strFileName, IXmlSerializerEx xs) { using(FileStream fs = new FileStream(strFileName, FileMode.Create, FileAccess.Write, FileShare.None)) { Save(kpTrl, fs, xs); } }
public static KPTranslation Load(Stream s, IXmlSerializerEx xs) { if(xs == null) throw new ArgumentNullException("xs"); #if !KeePassLibSD GZipStream gz = new GZipStream(s, CompressionMode.Decompress); #else GZipInputStream gz = new GZipInputStream(s); #endif KPTranslation kpTrl = (xs.Deserialize(gz) as KPTranslation); gz.Close(); s.Close(); return kpTrl; }
public static KPTranslation Load(string strFile, IXmlSerializerEx xs) { KPTranslation kpTrl = null; using(FileStream fs = new FileStream(strFile, FileMode.Open, FileAccess.Read, FileShare.Read)) { kpTrl = Load(fs, xs); } return kpTrl; }