コード例 #1
0
        /// <summary>
        /// 设定配置
        /// </summary>
        /// <param name="config"></param>
        public void SetConfig(Hashtable config)
        {
            if (packer == null && config.ContainsKey("packing"))
            {
                packer = App.Make(config["packing"].ToString()) as IPacking;
            }

            if (render == null && config.ContainsKey("render"))
            {
                if (config["render"] is Array)
                {
                    List <IRender> renders = new List <IRender>();
                    foreach (object obj in config["render"] as Array)
                    {
                        renders.Add(App.Make(obj.ToString()) as IRender);
                    }
                    render = renders.ToArray();
                }
                else
                {
                    render = new IRender[] { App.Make(config["render"].ToString()) as IRender };
                }
            }

            if (protocol == null && config.ContainsKey("protocol"))
            {
                protocol = App.Make(config["protocol"].ToString()) as IProtocol;
            }

            if (config.ContainsKey("host"))
            {
                host = config["host"].ToString();
            }

            if (config.ContainsKey("port"))
            {
                port = Convert.ToInt32(config["port"].ToString());
            }

            if (config.ContainsKey("event.level"))
            {
                if (config["event.level"] is Hashtable)
                {
                    triggerLevel = config["event.level"] as Hashtable;
                }
            }
        }
コード例 #2
0
ファイル: Unpacking.cs プロジェクト: fjiang2/sqlcon
        public static void Unpack(Assembly asm, bool insert)
        {
            SqlTrans transaction = new SqlTrans();


            foreach (Type type in asm.GetExportedTypes())
            {
                if (type.HasInterface <IPacking>())
                {
                    IPacking packing = (IPacking)Activator.CreateInstance(type);
                    packing.Unpack(transaction, insert);
                }
            }

            transaction.Commit();
            return;
        }
コード例 #3
0
ファイル: Unpacking.cs プロジェクト: fjiang2/sqlcon
        private static void Unpack(Level level, Assembly asm, BackgroundTask worker, SqlTrans transaction, bool insert)
        {
            foreach (Type type in asm.GetExportedTypes())
            {
                if (type.HasInterface <IPacking>() && type != typeof(BasePackage <>))
                {
                    IPacking packing = (IPacking)Activator.CreateInstance(type);
                    if (level == packing.Level)
                    {
                        worker.SetProgress(0, string.Format("Unpacking #record={0} of table [{1}].", packing.Count, packing.TableName));
                        packing.Unpack(worker, transaction, insert);
                    }
                }
            }

            return;
        }
コード例 #4
0
ファイル: TcpRequest.cs プロジェクト: yb199478/CatLib
        /// <summary>
        /// 设定配置
        /// </summary>
        /// <param name="config"></param>
        public void SetConfig(Hashtable config)
        {
            if(packer == null && config.ContainsKey("packing")){
                packer = App.Make(config["packing"].ToString()) as IPacking;
            }

            if (render == null && config.ContainsKey("render"))
            {
                if(config["render"] is Array)
                {
                    List<IRender> renders = new List<IRender>();
                    foreach(object obj in config["render"] as Array)
                    {
                        renders.Add(App.Make(obj.ToString()) as IRender);
                    }
                    render = renders.ToArray();
                }else
                {
                    render = new IRender[] { App.Make(config["render"].ToString()) as IRender };
                }
            }

            if (protocol == null && config.ContainsKey("protocol")){
                protocol = App.Make(config["protocol"].ToString()) as IProtocol;
            }

            if(config.ContainsKey("host")){
                host = config["host"].ToString();
            }

            if(config.ContainsKey("port")){
                port = Convert.ToInt32(config["port"].ToString());
            }

            if (config.ContainsKey("trigger"))
            {
                if(config["trigger"] is Hashtable)
                {
                    triggerLevel = config["trigger"] as Hashtable;
                }
            }
        }
コード例 #5
0
 public void AddItem(IPacking packs)
 {
     Items.Add(packs);
 }
コード例 #6
0
 public void AddPacking(IPacking item)
 {
     _items.Add(item);
 }