Click here to Skip to main content
Click here to Skip to main content
Articles » Languages » C# » Utilities » Downloads
 
Add your own
alternative version

Project Tool

, 23 Sep 2007
Backup your C# solution and projects for archive or source code sharing. Temporary or unused files are excluded.
projecttool.zip
projecttool_0908_.zip
bin
Release
ICSharpCode.SharpZipLib.dll
ProjectTool.exe
CodeLib
Controls
ProjectTool
Items
Project
Propertys
Solution
Icon
cs.png
default.ico
dir.png
diro.png
dll.png
projecttool_20070924.zip
ProjectTool.exe
Checksums
Compress
Deflate
Common
Decode
Encode
Formats
Zip
HuffmanCoding
LempelZivWelch
LempelZiv
Resources
Icon
cs.png
default.ico
dir.png
diro.png
dll.png
projecttool_src.zip
ProjectTool.exe
cs.png
default.ico
dir.png
diro.png
dll.png
release.zip
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Windows.Forms;

namespace QiHe.CodeLib
{
    public class UIText
    {
        public static void Save(Control control, string filename)
        {
            StreamWriter writer = File.CreateText(filename);
            Write(control, writer);
            writer.Close();
        }
        public static void Load(Control control, string filename)
        {
            StreamReader reader = File.OpenText(filename);
            Read(control, reader);
            reader.Close();
        }

        public static void Write(Control control, StreamWriter writer)
        {
            if (control is TextBox) return;
            if (control is ComboBox) return;
            if (control is NumericUpDown) return;

            writer.WriteLine(control.Text);
            foreach (Control ctrl in control.Controls)
            {
                Write(ctrl, writer);
            }
        }

        public static void Read(Control control, StreamReader reader)
        {
            if (control is TextBox) return;
            if (control is ComboBox) return;
            if (control is NumericUpDown) return;

            string text = reader.ReadLine();
            if (text != null)
            {
                control.Text = text;
                foreach (Control ctrl in control.Controls)
                {
                    Read(ctrl, reader);
                }
            }
        }
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Liu Junfeng
Software Developer (Senior) Beyondsoft SH
China China
No Biography provided

| Advertise | Privacy | Mobile
Web03 | 2.8.140827.1 | Last Updated 23 Sep 2007
Article Copyright 2006 by Liu Junfeng
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid