csettings.cs

来自「一个pocketPC 程序」· CS 代码 · 共 81 行

CS
81
字号
using System;
using System.IO;

namespace SmartWKN
{
	/// <summary>
	/// Save and Read the Settings
	/// </summary>
	public class cSettings
	{
		public cSettings()
		{
		}

		private string mYahooURL = string.Empty;
		private string mGraphURL = string.Empty;
		private string mTickerSymbol = string.Empty;

		public string YahooURL
		{
			get { return mYahooURL; }
			set { mYahooURL = value; }
		}

		public string GraphURL
		{
			get {return mGraphURL; }
			set { mGraphURL = value; }
		}

		public string TickerSymbol
		{
			get {return mTickerSymbol; }
			set { mTickerSymbol = value; }
		}

		public bool LoadData(string Path)
		{
			bool RetValue = false;

			try
			{
				StreamReader reader = new StreamReader(Path, System.Text.Encoding.Default);
				mYahooURL = reader.ReadLine();
				mGraphURL = reader.ReadLine();
				mTickerSymbol = reader.ReadLine();
				reader.Close();
				RetValue = true;
			}
			catch
			{
				RetValue = false;
			}
			return RetValue;
		}

		public bool SaveData(string Path)
		{

			bool RetValue = false;

			try
			{
				StreamWriter writer = new StreamWriter(Path, false, System.Text.Encoding.Default);
				writer.WriteLine(mYahooURL);
				writer.WriteLine(mGraphURL);
				writer.WriteLine(mTickerSymbol);
				writer.Close();
				RetValue = true;
			}
			catch
			{
				RetValue = false;
			}
			return RetValue;

		}

	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?