Beispiel #1
0
    /// <summary>
    /// Saves the Email accont settings to a file.
    /// </summary>
    /// <param name="file">The file path to save to.</param>
    /// <param name="c">AccountSettings object.</param>
    public static void Save(string file, AccountSettings c)
    {
        try
        {
            if (File.Exists(file))
            {
                File.Delete(file);
            }

            // TODO: MAke this binary
            System.Xml.Serialization.XmlSerializer xs
                = new System.Xml.Serialization.XmlSerializer(c.GetType());
            StreamWriter writer = File.CreateText(file);
            xs.Serialize(writer, c);
            writer.Flush();
            writer.Close();
        }
        catch (Exception ex)
        {
            MessageBox.Show(ex.Message);
        }
    }
    /// <summary>
    /// Saves the Email accont settings to a file.
    /// </summary>
    /// <param name="file">The file path to save to.</param>
    /// <param name="c">AccountSettings object.</param>
    public static void Save(string file, AccountSettings c)
    {
        try
        {
            if (File.Exists(file))
                File.Delete(file);

            // TODO: MAke this binary
            System.Xml.Serialization.XmlSerializer xs
               = new System.Xml.Serialization.XmlSerializer(c.GetType());
            StreamWriter writer = File.CreateText(file);
            xs.Serialize(writer, c);
            writer.Flush();
            writer.Close();
        }
        catch (Exception ex)
        {
            MessageBox.Show(ex.Message);
        }
    }