/// <summary>
        /// Returns the version set in the <see cref="AssemblyFileVersionAttribute"/> set in the assembly
        /// containing this <see cref="IPlatformInformation"/> implementation.
        /// </summary>
        /// <param name="platformInformation"></param>
        /// <returns>The version set in the </returns>
        internal static string GetVersionFromAssemblyFileVersion(this IPlatformInformation platformInformation)
        {
            var attribute = platformInformation.GetType().GetTypeInfo().Assembly
                            .GetCustomAttributes(typeof(AssemblyFileVersionAttribute)).FirstOrDefault() as AssemblyFileVersionAttribute;

            return(attribute != null ? attribute.Version : string.Empty);
        }
 public OnePasswordEnvironmentSessionStorage(
     IPlatformInformation platformInfo,
     IEnvironmentAccessor envAccessor)
 {
     _platformInfo = platformInfo ?? throw new ArgumentNullException(nameof(platformInfo));
     _envAccessor  = envAccessor ?? throw new ArgumentNullException(nameof(envAccessor));
 }
Esempio n. 3
0
 public OnePasswordSessionStorageSelector(
     IPlatformInformation platformInfo,
     IOnePasswordSessionStorage environmentSessionStorage,
     IOnePasswordSessionStorage fileSessionStorage)
 {
     _platformInfo = platformInfo ?? throw new ArgumentNullException(nameof(platformInfo));
     _environmentSessionStorage = environmentSessionStorage ?? throw new ArgumentNullException(nameof(environmentSessionStorage));
     _fileSessionStorage        = fileSessionStorage ?? throw new ArgumentNullException(nameof(fileSessionStorage));
 }
 public MainPageViewModel()
 {
     GetInformationCommand = new Command(() =>
     {
         IPlatformInformation platformInformation = DependencyService.Get <IPlatformInformation>();
         var info = platformInformation.GetCurrentInformation();
         Model    = info.Model;
         Version  = info.Version;
     });
 }
Esempio n. 5
0
        /// <summary>
        /// Gets the user-agent header to use with all requests.
        /// </summary>
        /// <returns>
        /// An HTTP user-agent header.
        /// </returns>
        private string GetUserAgentHeader()
        {
            IPlatformInformation platformInformation = Platform.Instance.PlatformInformation;

            string sdkVersion = string.Join(".", platformInformation.Version.Split('.').Take(2)); // Get just the major and minor versions

            return(string.Format(
                       CultureInfo.InvariantCulture,
                       "ZUMO/{0} (lang={1}; os={2}; os_version={3}; arch={4}; version={5})",
                       sdkVersion,
                       "Managed",
                       platformInformation.OperatingSystemName,
                       platformInformation.OperatingSystemVersion,
                       platformInformation.OperatingSystemArchitecture,
                       platformInformation.Version));
        }
        /// <summary>
        /// Gets the user-agent header to use with all requests.
        /// </summary>
        /// <returns>
        /// An HTTP user-agent header.
        /// </returns>
        private string GetUserAgentHeader()
        {
            AssemblyFileVersionAttribute fileVersionAttribute = typeof(MobileServiceClient).GetTypeInfo().Assembly
                                                                        .GetCustomAttributes(typeof(AssemblyFileVersionAttribute))
                                                                        .Cast<AssemblyFileVersionAttribute>()
                                                                        .FirstOrDefault();
            string fileVersion = fileVersionAttribute.Version;
            string sdkVersion = string.Join(".", fileVersion.Split('.').Take(2)); // Get just the major and minor versions

            IPlatformInformation platformInformation = Platform.Instance.PlatformInformation;
            return string.Format(
                CultureInfo.InvariantCulture,
                "ZUMO/{0} (lang={1}; os={2}; os_version={3}; arch={4}; version={5})",
                sdkVersion,
                "Managed",
                platformInformation.OperatingSystemName,
                platformInformation.OperatingSystemVersion,
                platformInformation.OperatingSystemArchitecture,
                fileVersion);
        }
Esempio n. 7
0
 /// <summary>
 /// Returns the version set in the <see cref="AssemblyFileVersionAttribute"/> set in the assembly
 /// containing this <see cref="IPlatformInformation"/> implementation.
 /// </summary>
 /// <param name="platformInformation">The object being extended</param>
 /// <returns>The version set in the assembly.</returns>
 internal static string GetVersionFromAssemblyFileVersion(this IPlatformInformation platformInformation)
 => platformInformation.GetType()
 .GetTypeInfo().Assembly
 .GetCustomAttributes(typeof(AssemblyFileVersionAttribute))
 .FirstOrDefault() is AssemblyFileVersionAttribute attribute ? attribute.Version : string.Empty;