示例#1
0
        private string BuildStripeClientUserAgentString()
        {
            var values = new Dictionary <string, object>
            {
                { "bindings_version", StripeConfiguration.StripeNetVersion },
                { "lang", ".net" },
                { "publisher", "stripe" },
                { "lang_version", RuntimeInformation.GetLanguageVersion() },
                { "os_version", RuntimeInformation.GetOSVersion() },
            };

#if NET45
            string monoVersion = RuntimeInformation.GetMonoVersion();
            if (!string.IsNullOrEmpty(monoVersion))
            {
                values.Add("mono_version", monoVersion);
            }
#endif

            if (this.appInfo != null)
            {
                values.Add("application", this.appInfo);
            }

            return(JsonConvert.SerializeObject(values, Formatting.None));
        }
示例#2
0
        private string BuildStripeClientUserAgentString()
        {
            var values = new Dictionary <string, object>
            {
                { "bindings_version", StripeConfiguration.StripeNetVersion },
                { "lang", ".net" },
                { "publisher", "stripe" },
                { "lang_version", RuntimeInformation.GetLanguageVersion() },
                { "os_version", RuntimeInformation.GetOSVersion() },
            };

#if NET45
            string monoVersion = RuntimeInformation.GetMonoVersion();
            if (!string.IsNullOrEmpty(monoVersion))
            {
                values.Add("mono_version", monoVersion);
            }
#endif

            var stripeNetTargetFramework =
#if NET45
                "net45"
#elif NETSTANDARD1_2
                "netstandard1.2"
#elif NETSTANDARD2_0
                "netstandard2.0"
#else
                "unknown"
#endif
            ;
            values.Add("stripe_net_target_framework", stripeNetTargetFramework);

            if (this.appInfo != null)
            {
                values.Add("application", this.appInfo);
            }

            return(JsonUtils.SerializeObject(values, Formatting.None));
        }