當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。