Exemple #1
0
 public virtual void Connect(URL url, ConnectData connectData)
 {
     if (url == null)
     {
         throw new ArgumentNullException("url");
     }
     if (this.m_server != null)
     {
         throw new AlreadyConnectedException();
     }
     this.SetUrl(url);
     try
     {
         this.m_server      = this.m_factory.CreateInstance(url, connectData);
         this.m_connectData = connectData;
         this.GetSupportedLocales();
         this.SetLocale(this.m_locale);
     }
     catch (Exception exception)
     {
         if (this.m_server != null)
         {
             try
             {
                 this.Disconnect();
             }
             catch
             {
             }
         }
         throw exception;
     }
 }
Exemple #2
0
 public Server(Factory factory, URL url)
 {
     this.m_server           = null;
     this.m_url              = null;
     this.m_factory          = null;
     this.m_connectData      = null;
     this.m_name             = null;
     this.m_locale           = null;
     this.m_supportedLocales = null;
     this.m_resourceManager  = null;
     if (factory == null)
     {
         throw new ArgumentNullException("factory");
     }
     this.m_factory          = (IFactory)factory.Clone();
     this.m_server           = null;
     this.m_url              = null;
     this.m_name             = null;
     this.m_supportedLocales = null;
     this.m_resourceManager  = new ResourceManager("Opc.Resources.Strings", Assembly.GetExecutingAssembly());
     if (url != null)
     {
         this.SetUrl(url);
     }
 }
Exemple #3
0
 public virtual IServer CreateInstance(URL url, ConnectData connectData)
 {
     if (!this.m_useRemoting)
     {
         return((IServer)Activator.CreateInstance(this.m_systemType, new object[] { url, connectData }));
     }
     return((IServer)Activator.GetObject(this.m_systemType, url.ToString()));
 }
Exemple #4
0
 protected Server(SerializationInfo info, StreamingContext context)
 {
     this.m_server           = null;
     this.m_url              = null;
     this.m_factory          = null;
     this.m_connectData      = null;
     this.m_name             = null;
     this.m_locale           = null;
     this.m_supportedLocales = null;
     this.m_resourceManager  = null;
     this.m_name             = info.GetString("Name");
     this.m_url              = (URL)info.GetValue("Url", typeof(URL));
     this.m_factory          = (IFactory)info.GetValue("Factory", typeof(IFactory));
 }
Exemple #5
0
 public virtual void Connect(ConnectData connectData)
 {
     this.Connect(this.m_url, connectData);
 }