Ejemplo n.º 1
0
        /// <summary>
        /// Gets filters value based on the passed enum.
        /// </summary>
        /// <param name="filter"></param>
        /// <returns>Formatted string to attach to the headers</returns>
        public string GetFilterValue(Filters filter)
        {
            switch (filter)
            {
            case Filters.UserId:
                return(telemetrySession.UserId.ToString("N"));

            case Filters.IsInternal:
                if (!telemetrySession.IsUserMicrosoftInternal)
                {
                    return("0");
                }
                return("1");

            case Filters.ApplicationName:
                return(processInformation.GetExeName() ?? "unknown");

            case Filters.ApplicationVersion:
            {
                FileVersion processVersionInfo = processInformation.GetProcessVersionInfo();
                string      result             = "unknown";
                if (processVersionInfo != null)
                {
                    result = processVersionInfo.ToString();
                }
                return(result);
            }

            default:
                return(string.Empty);
            }
        }
        /// <inheritdoc />
        public override string GetApplicationVersion()
        {
            FileVersion processVersionInfo = processInformationProvider.GetProcessVersionInfo();

            if (processVersionInfo == null)
            {
                return(string.Empty);
            }
            return(processVersionInfo.ToString());
        }