Exemple #1
0
        public Uri GetTimestampAuthorityUri()
        {
            Uri uri = null;

            if (!string.IsNullOrWhiteSpace(TimestampAuthority) && !Uri.TryCreate(TimestampAuthority, UriKind.Absolute, out uri))
            {
                throw new Exception(string.Format(CultureInfo.InvariantCulture, Resources.InvalidTimeAuthority, uri));
            }

            if (string.IsNullOrWhiteSpace(TimestampAuthority))
            {
                uri = SignConfig.LoadUserProfileConfig()?.TimeAuthorityUrl;
            }

            if (uri == null)
            {
                return(null);
            }

            if (uri.Scheme != Uri.UriSchemeHttp && uri.Scheme != Uri.UriSchemeHttps)
            {
                throw new Exception(Resources.InvalidTimeAuthorityScheme + uri);
            }

            return(uri);
        }
        static TelemetryHelper()
        {
            if (SignConfig.LoadUserProfileConfig()?.DisableTelemetry ?? false)
            {
                return;
            }

            TelemetryConfiguration.Active.InstrumentationKey = "a2d03416-ac19-4444-b75e-b9e2eaf2d2f1";
            TelemetryConfiguration.Active.TelemetryChannel   = new InMemoryChannel();

            Client = new TelemetryClient();

            // Set session data:
            Client.Context.User.Id                = Environment.UserName;
            Client.Context.Session.Id             = Guid.NewGuid().ToString();
            Client.Context.Device.OperatingSystem = Environment.OSVersion.ToString();

            Client.Context.Component.Version = FileVersionInfo.GetVersionInfo(Assembly.GetExecutingAssembly().Location).ProductVersion;
        }