本文整理匯總了C#中Account.Read方法的典型用法代碼示例。如果您正苦於以下問題:C# Account.Read方法的具體用法?C# Account.Read怎麽用?C# Account.Read使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Account
的用法示例。
在下文中一共展示了Account.Read方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: Main
static void Main(string[] args)
{
// configure logging
{
RollingFileAppender a = new RollingFileAppender();
a.DatePattern = "yyyy-MM-dd";
a.AppendToFile = true;
a.StaticLogFileName = false;
a.File = FileUtil.CatDir(new string[]{ Program.DataDirectory, "log", "log-"});
// Directory.GetParent(a.File).Create();
a.RollingStyle = RollingFileAppender.RollingMode.Date;
a.Layout = new PatternLayout("%date [%thread] %-5level %logger [%property{NDC}] - %message%newline");
a.ActivateOptions();
log4net.Config.BasicConfigurator.Configure(a);
Hierarchy repository = log4net.LogManager.GetRepository() as Hierarchy;
repository.Root.Level = Level.Debug;
}
log.Info("Startup");
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Sidi.Net.Pop3.Server server = new Sidi.Net.Pop3.Server();
server.MailboxProvider = delegate(TcpClient client, string user, string pass)
{
Account a = new Account(user, pass);
if (a.Exists && a.Read())
{
Account.DefaultAccount = a;
// start collector thread
Thread collectorThread = new Thread
(
new ParameterizedThreadStart(delegate(object p)
{
Account account = (Account)p;
account.CheckCollect();
})
);
collectorThread.SetApartmentState(ApartmentState.STA);
collectorThread.Start(a);
return new PaymentMailBox(a);
}
else
{
return null;
}
};
try
{
server.StartLoopback();
}
catch (SocketException e)
{
log.Error("POP3 server cannot be started. Check if another POP3 server is already running.", e);
MessageBox.Show("POP3 server cannot be started. Check if another POP3 server is already running.", Sammy.ApplicationName, MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
Application.Run(new MyApplicationContext());
server.Stop();
log.Info("Shutdown");
}
示例2: ReadWrite
public void ReadWrite()
{
string script = "hello, script";
a.Settings.Script = script;
a.Write();
using (Account b = new Account(user, pass))
{
b.Read();
Assert.AreEqual(script, b.Settings.Script);
}
}