コード例 #1
0
        public void RequestSession(IEtpSession session, string applicationName, string applicationVersion, string requestedCompression)
        {
            var requestedProtocols = session.GetSupportedProtocols();

            session.Handler <ICoreClient>()
            .RequestSession(applicationName, applicationVersion, requestedProtocols, requestedCompression);
        }
コード例 #2
0
ファイル: EtpExtensions.cs プロジェクト: smg-bg/witsml
        /// <summary>
        /// Creates the server capabilities object for the ETP session.
        /// </summary>
        /// <param name="etpSession">The ETP session.</param>
        /// <param name="supportedObjects">The supported objects.</param>
        /// <param name="supportedEncodings">The supported encodings.</param>
        /// <returns>A new server capabilities instance.</returns>
        public static object CreateServerCapabilities(this IEtpSession etpSession, IList <string> supportedObjects, IList <string> supportedEncodings)
        {
            if (etpSession.Adapter is Energistics.Etp.v11.Etp11Adapter)
            {
                return(new Energistics.Etp.v11.Datatypes.ServerCapabilities
                {
                    ApplicationName = etpSession.ApplicationName,
                    ApplicationVersion = etpSession.ApplicationVersion,
                    SupportedProtocols = etpSession.GetSupportedProtocols()
                                         .Cast <Energistics.Etp.v11.Datatypes.SupportedProtocol>()
                                         .ToList(),
                    SupportedObjects = supportedObjects,
                    SupportedEncodings = string.Join(";", supportedEncodings),
                    ContactInformation = new Energistics.Etp.v11.Datatypes.Contact
                    {
                        OrganizationName = WitsmlSettings.DefaultVendorName,
                        ContactName = WitsmlSettings.DefaultContactName,
                        ContactEmail = WitsmlSettings.DefaultContactEmail,
                        ContactPhone = WitsmlSettings.DefaultContactPhone
                    }
                });
            }

            return(new Energistics.Etp.v12.Datatypes.ServerCapabilities
            {
                ApplicationName = etpSession.ApplicationName,
                ApplicationVersion = etpSession.ApplicationVersion,
                SupportedProtocols = etpSession.GetSupportedProtocols()
                                     .Cast <Energistics.Etp.v12.Datatypes.SupportedProtocol>()
                                     .ToList(),
                SupportedObjects = supportedObjects,
                SupportedEncodings = string.Join(";", supportedEncodings),
                SupportedCompression = new[] { OptionsIn.CompressionMethod.Gzip.Value },
                ContactInformation = new Energistics.Etp.v12.Datatypes.Contact
                {
                    OrganizationName = WitsmlSettings.DefaultVendorName,
                    ContactName = WitsmlSettings.DefaultContactName,
                    ContactEmail = WitsmlSettings.DefaultContactEmail,
                    ContactPhone = WitsmlSettings.DefaultContactPhone
                }
            });
        }