Ejemplo n.º 1
0
        /// <summary>
        /// Reading file system
        /// </summary>
        /// <param name="pFilePath">File path</param>
        public void LoadFileSystem(string pFilePath)
        {
            this.FileSystem = XmlSerialiser <FileSystem> .ReadFromXmlFile(pFilePath);

            this.FileSystem.FilePath = pFilePath;
            this.TriggerOnFileSystem();
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Loading icons
        /// </summary>
        /// <param name="pFilePath">File path</param>
        public void LoadIcons(string pFilePath)
        {
            this.Icons = XmlSerialiser <Icons> .ReadFromXmlFile(pFilePath);

            this.Icons.FilePath = pFilePath;
            this.TriggerOnIconSet();
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Reading object from XML content
        /// </summary>
        /// <param name="pXmlContent">XML content</param>
        /// <returns>Object</returns>
        public static TClass ReadFromXmlContent(string pXmlContent)
        {
            XmlReader lXmlReader = XmlReader.Create(new StringReader(pXmlContent));
            TClass    lObject    = XmlSerialiser <TClass> .ReadFromXmlReader(lXmlReader);

            lXmlReader.Close();
            return(lObject);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Saving data
        /// </summary>
        /// <param name="pObject">Object</param>
        /// <param name="pXmlFilePath">XML file path</param>
        public static void WriteToXmlFile(TClass pObject, string pXmlFilePath)
        {
            XmlTextWriter lXmlTextWriter = new XmlTextWriter(pXmlFilePath, System.Text.Encoding.Default);

            XmlSerialiser <TClass> .WriteToXmlWriter(pObject, lXmlTextWriter);

            lXmlTextWriter.Close();
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Reading object from file
        /// </summary>
        /// <param name="pXmlFilePath">XML file path</param>
        /// <returns>Object</returns>
        public static TClass ReadFromXmlFile(string pXmlFilePath)
        {
            XmlTextReader lXmlTextReader = new XmlTextReader(pXmlFilePath);
            TClass        lObject        = XmlSerialiser <TClass> .ReadFromXmlReader(lXmlTextReader);

            lXmlTextReader.Close();
            return(lObject);
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Writing object to XML content
        /// </summary>
        /// <param name="pObject">Object</param>
        /// <returns>XML content</returns>
        public static string WriteToXmlContent(TClass pObject)
        {
            StringWriter lStringWriter = new StringWriter(CultureInfo.CurrentCulture);
            XmlWriter    lXmlWriter    = new XmlTextWriter(lStringWriter);

            XmlSerialiser <TClass> .WriteToXmlWriter(pObject, lXmlWriter);

            lXmlWriter.Close();
            return(lStringWriter.ToString());
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Writing object to XML content (with encoding)
        /// </summary>
        /// <param name="pObject">Object</param>
        /// <param name="pEncoding">Encoding</param>
        /// <returns>XML content</returns>
        public static string WriteToXmlContent(TClass pObject, Encoding pEncoding)
        {
            MemoryStream  lMemoryStream  = new MemoryStream();
            XmlTextWriter lXmlTextWriter = new XmlTextWriter(lMemoryStream, pEncoding);

            XmlSerialiser <TClass> .WriteToXmlWriter(pObject, lXmlTextWriter);

            lXmlTextWriter.Flush();
            lMemoryStream.Seek(0, System.IO.SeekOrigin.Begin);
            StreamReader lStreamReader = new System.IO.StreamReader(lMemoryStream, pEncoding);
            string       lXmlContent   = lStreamReader.ReadToEnd();

            return(lXmlContent);
        }