예제 #1
0
        public void AddCmdWorkItems(WeaveTCPCommand cmd)
        {
            cmd.SetGlobalQueueTable(weaveTable, TcpToken);
            WeaveTCPCommandItem cmdItem = new WeaveTCPCommandItem();

            // Ic.SetGlobalQueueTable(weaveTable, TcpTokenList);
            cmdItem.WeaveTcpCmd = cmd;
            cmdItem.CmdName     = cmd.Getcommand();
            GetAttributeInfo(cmd, cmd.GetType(), cmd);
            weaveTCPCommandItems.Add(cmdItem);
        }
예제 #2
0
        public void ReloadFlies()
        {
            try
            {
#if !NETSTANDARD2_0
                String[] strfilelist = System.IO.Directory.GetFiles(AppDomain.CurrentDomain.SetupInformation.ApplicationBase + "command");
#else
                String[] strfilelist = System.IO.Directory.GetFiles(AppContext.BaseDirectory + "command");
#endif
                foreach (string file in strfilelist)
                {
                    Assembly ab    = Assembly.LoadFile(file);
                    Type[]   types = ab.GetExportedTypes();
                    foreach (Type t in types)
                    {
                        try
                        {
                            if (t.IsSubclassOf(typeof(WeaveTCPCommand)))
                            {
                                CmdWorkItem     ci  = new CmdWorkItem();
                                object          obj = ab.CreateInstance(t.FullName);
                                WeaveTCPCommand Ic  = obj as WeaveTCPCommand;
                                Ic.SetGlobalQueueTable(weaveTable, TcpTokenList);
                                ci.WeaveTcpCmd = Ic;
                                ci.CmdName     = Ic.Getcommand();
                                GetAttributeInfo(Ic, obj.GetType(), obj);
                                CmdWorkItems.Add(ci);
                            }
                        }
                        catch //(Exception ex)
                        { }
                    }
                }
            }
            catch (Exception ex)
            {
                if (WeaveLogEvent != null)
                {
                    WeaveLogEvent("加载异常", ex.Message);
                }
            }
        }