WEB开发网
开发学院软件开发C语言 C#发现之旅:C#开发Windows Service程序(下) 阅读

C#发现之旅:C#开发Windows Service程序(下)

 2009-04-06 08:24:16 来源:WEB开发网   
核心提示: 它的Load方法用于从数据库中加载配置信息,其处理过程为public void Load(){ myWatchedPaths = null; System.Collections.ArrayList paths = new System.Collections.ArrayList(); u

它的Load方法用于从数据库中加载配置信息,其处理过程为

public void Load()
{
    myWatchedPaths = null;
    System.Collections.ArrayList paths = new System.Collections.ArrayList();
    using (System.Data.IDbCommand cmd = Util.DBConnection.CreateCommand())
    {
        cmd.CommandText = "Select ConfigName , ConfigValue From SystemConfig";
        System.Data.IDataReader reader = cmd.ExecuteReader();
        while (reader.Read())
        {
            string Name = Convert.ToString(reader.GetValue(0));
            if (Name == null)
            {
                continue;
            }
            Name = Name.Trim().ToLower();
            string Value = Convert.ToString(reader.GetValue(1));
            if (Name.StartsWith("path"))
            {
                paths.Add(Value.Trim());
            }
            else if (Name == "logrenamed")
            {
                bolLogRenamed = Convert.ToBoolean(Value);
            }
            else if (Name == "logchanged")
            {
                bolLogChanged = Convert.ToBoolean(Value);
            }
            else if (Name == "logdeleted")
            {
               bolLogDeleted = Convert.ToBoolean(Value);
            }
            else if (Name == "logcreated")
            {
                bolLogCreated = Convert.ToBoolean(Value);
            }
        }
    }
    myWatchedPaths = (string[])paths.ToArray(typeof(string));
}

上一页  1 2 3 4 5 6 7 8  下一页

Tags:发现 之旅 开发

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接