Exemple #1
0
 internal static Opc.Dx.SourceServer[] GetSourceServers(ref IntPtr pInput, int count, bool deallocate)
 {
     Opc.Dx.SourceServer[] serverArray = null;
     if ((pInput != IntPtr.Zero) && (count > 0))
     {
         serverArray = new Opc.Dx.SourceServer[count];
         IntPtr ptr = pInput;
         for (int i = 0; i < count; i++)
         {
             OpcRcw.Dx.SourceServer server = (OpcRcw.Dx.SourceServer)Marshal.PtrToStructure(ptr, typeof(OpcRcw.Dx.SourceServer));
             serverArray[i]                  = new Opc.Dx.SourceServer();
             serverArray[i].ItemName         = server.szItemName;
             serverArray[i].ItemPath         = server.szItemPath;
             serverArray[i].Version          = server.szVersion;
             serverArray[i].Name             = server.szName;
             serverArray[i].Description      = server.szDescription;
             serverArray[i].ServerType       = server.szServerType;
             serverArray[i].ServerURL        = server.szServerURL;
             serverArray[i].DefaultConnected = server.bDefaultSourceServerConnected != 0;
             ptr = (IntPtr)(ptr.ToInt32() + Marshal.SizeOf(typeof(OpcRcw.Dx.SourceServer)));
         }
         if (deallocate)
         {
             Marshal.FreeCoTaskMem(pInput);
             pInput = IntPtr.Zero;
         }
     }
     return(serverArray);
 }
Exemple #2
0
        // Token: 0x0600033D RID: 829 RVA: 0x00008894 File Offset: 0x00007894
        public virtual object Clone()
        {
            SourceServerCollection sourceServerCollection = (SourceServerCollection)base.MemberwiseClone();

            sourceServerCollection.m_servers = new ArrayList();
            foreach (object obj in this.m_servers)
            {
                SourceServer sourceServer = (SourceServer)obj;
                sourceServerCollection.m_servers.Add(sourceServer.Clone());
            }
            return(sourceServerCollection);
        }
Exemple #3
0
 // Token: 0x0600033C RID: 828 RVA: 0x0000882C File Offset: 0x0000782C
 internal void Initialize(ICollection sourceServers)
 {
     this.m_servers.Clear();
     if (sourceServers != null)
     {
         foreach (object obj in sourceServers)
         {
             SourceServer value = (SourceServer)obj;
             this.m_servers.Add(value);
         }
     }
 }
Exemple #4
0
 // Token: 0x06000336 RID: 822 RVA: 0x000086C8 File Offset: 0x000076C8
 public SourceServer(SourceServer server) : base(server)
 {
     if (server != null)
     {
         this.m_name                      = server.m_name;
         this.m_description               = server.m_description;
         this.m_serverType                = server.m_serverType;
         this.m_serverURL                 = server.m_serverURL;
         this.m_defaultConnected          = server.m_defaultConnected;
         this.m_defaultConnectedSpecified = server.m_defaultConnectedSpecified;
     }
 }
        /// <summary>
        /// Deletes a single source server from the configuration.
        /// </summary>
        /// <param name="server">The source server to delete.</param>
        public void DeleteSourceServer(SourceServer server)
        {
            GeneralResponse response = DeleteSourceServers(new Opc.Dx.ItemIdentifier[] { server });

            if (response == null || response.Count != 1)
            {
                throw new Opc.InvalidResponseException();
            }

            if (response[0].ResultID.Failed())
            {
                throw new Opc.ResultIDException(response[0].ResultID);
            }
        }
Exemple #6
0
 // Token: 0x170000AB RID: 171
 public SourceServer this[string name]
 {
     get
     {
         foreach (object obj in this.m_servers)
         {
             SourceServer sourceServer = (SourceServer)obj;
             if (sourceServer.Name == name)
             {
                 return(sourceServer);
             }
         }
         return(null);
     }
 }
Exemple #7
0
        // Token: 0x06000060 RID: 96 RVA: 0x00003820 File Offset: 0x00002820
        public void DeleteSourceServer(SourceServer server)
        {
            GeneralResponse generalResponse = this.DeleteSourceServers(new ItemIdentifier[]
            {
                server
            });

            if (generalResponse == null || generalResponse.Count != 1)
            {
                throw new InvalidResponseException();
            }
            if (generalResponse[0].ResultID.Failed())
            {
                throw new ResultIDException(generalResponse[0].ResultID);
            }
        }
        /// <summary>
        /// Adds a single source server to the configuration.
        /// </summary>
        /// <param name="server">The source server to add.</param>
        /// <returns>Returns the new source server object.</returns>
        public SourceServer AddSourceServer(SourceServer server)
        {
            GeneralResponse response = AddSourceServers(new SourceServer[] { server });

            if (response == null || response.Count != 1)
            {
                throw new Opc.InvalidResponseException();
            }

            if (response[0].ResultID.Failed())
            {
                throw new Opc.ResultIDException(response[0].ResultID);
            }

            SourceServer result = new SourceServer(server);

            result.ItemName = response[0].ItemName;
            result.ItemPath = response[0].ItemPath;
            result.Version  = response[0].Version;

            return(result);
        }
Exemple #9
0
        // Token: 0x0600005F RID: 95 RVA: 0x00003788 File Offset: 0x00002788
        public SourceServer ModifySourceServer(SourceServer server)
        {
            GeneralResponse generalResponse = this.ModifySourceServers(new SourceServer[]
            {
                server
            });

            if (generalResponse == null || generalResponse.Count != 1)
            {
                throw new InvalidResponseException();
            }
            if (generalResponse[0].ResultID.Failed())
            {
                throw new ResultIDException(generalResponse[0].ResultID);
            }
            return(new SourceServer(server)
            {
                ItemName = generalResponse[0].ItemName,
                ItemPath = generalResponse[0].ItemPath,
                Version = generalResponse[0].Version
            });
        }