📄 settings.cs
字号:
using System;
using System.IO;
namespace SupermarketProject
{
/// <summary>
///Settings 的摘要说明。
/// </summary>
public class Settings
{
public string supermarketName, address, phone, fax,
mainDirectory, uiDirectory, appDirectory;
public int maxUsers;
public Settings()
{
this.appDirectory = Environment.CurrentDirectory;
this.mainDirectory = this.appDirectory;
this.uiDirectory = this.appDirectory;
try
{
StreamReader textStream = new StreamReader(mainDirectory + @"\Settings.txt",System.Text .Encoding .Default );
supermarketName = textStream.ReadLine();
textStream.ReadLine();
string test;
do
{
test = textStream.ReadLine();
if (test.CompareTo("电话") < 0)
address += test+"\n";
else
phone = test;
}while (test.CompareTo("电话")< 0);
fax = textStream.ReadLine();
maxUsers = int.Parse(textStream.ReadLine() .Substring(6));
DataConnection.database = textStream.ReadLine() .Substring(4);
}
catch(Exception e)
{
Console.WriteLine(e.Message );
}
}//构造函数结尾
}//类结尾
}//名称空间结尾
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -