当前位置: 首页>>代码示例>>C#>>正文


C# Account.Read方法代码示例

本文整理汇总了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");
        }
开发者ID:al-main,项目名称:sammy,代码行数:65,代码来源:Program.cs

示例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);
            }
        }
开发者ID:al-main,项目名称:sammy,代码行数:12,代码来源:AccountUt.cs


注:本文中的Account.Read方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。