Esempio n. 1
0
        /// <summary>
        /// 注册远程代理对象
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="remotingserver"></param>
        /// <param name="uriname"></param>
        /// <param name="wellmode"></param>
        public static void RegisterObject <T>(RemotingServer remotingserver, string uriname, string wellmode)
        {
            string typeinfo = remotingserver.RegisteRemoteObject(typeof(T), uriname, wellmode);//设置代理类

            //Console.ForegroundColor = ConsoleColor.Red;
            Console.WriteLine("------------------------------");
        }
Esempio n. 2
0
        /// <summary>
        /// 注册广播对象
        /// </summary>
        /// <param name="remotingserver"></param>
        /// <param name="obj"></param>
        /// <param name="uriName"></param>
        public static void RegisteRemoteStaticObject(RemotingServer remotingserver, object obj, string uriName)
        {
            string re = remotingserver.RegisteRemoteStaticObject(null, obj as MarshalByRefObject, uriName);

            //Console.ForegroundColor = ConsoleColor.Red;
            Console.WriteLine("------------------------------");
        }
Esempio n. 3
0
        /// <summary>
        /// 注册远程代理对象
        /// </summary>
        public static void RegisterObject(RemotingServer remotingserver)
        {
            List <string> alltypepaths = RemoteObjectManager.GetAllRegisterTypes();//获取所有要注册的类前缀路径

            foreach (string beforekey in alltypepaths)
            {
                string regist = RemoteObjectManager.GetRemoteServerValue(beforekey + "/Register");
                if (!string.IsNullOrEmpty(regist) && regist.ToLower(CultureInfo.CurrentCulture).Trim() == "false")
                {
                    continue;
                }
                string dllpath   = RemoteObjectManager.GetRemoteServerValue(beforekey + "/" + "Path/value");
                string classname = RemoteObjectManager.GetRemoteServerValue(beforekey + "/" + "ClassName/value");
                string uriname   = RemoteObjectManager.GetRemoteServerValue(beforekey + "/" + "UriName/value");
                string wellmode  = RemoteObjectManager.GetRemoteServerValue(beforekey + "/" + "WellKnownObjectMode/value");
                string isstatic  = RemoteObjectManager.GetRemoteServerValue(beforekey + "/isStatic");

                string typeinfo = "";
                dllpath = IO.PathMg.CheckPath(dllpath);

                if (!string.IsNullOrEmpty(isstatic) && isstatic.ToLower(CultureInfo.CurrentCulture).Trim() == "true")
                {
                    string property = RemoteObjectManager.GetRemoteServerValue(beforekey + "/" + "Property/value");
                    typeinfo = remotingserver.RegisteRemoteStaticObject(dllpath, classname, property, uriname);//设置代理类
                }
                else
                {
                    typeinfo = remotingserver.RegisteRemoteObject(dllpath, classname, uriname, wellmode);//设置代理类
                }

                //Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine("------------------------------");
            }
        }