示例#1
0
        private static void set_environment_options(ChocolateyConfiguration config)
        {
            config.Information.PlatformType             = Platform.get_platform();
            config.Information.PlatformVersion          = Platform.get_version();
            config.Information.PlatformName             = Platform.get_name();
            config.Information.ChocolateyVersion        = VersionInformation.get_current_assembly_version();
            config.Information.ChocolateyProductVersion = VersionInformation.get_current_informational_version();
            config.Information.FullName = Assembly.GetExecutingAssembly().FullName;
            config.Information.Is64BitOperatingSystem = Environment.Is64BitOperatingSystem;
            config.Information.Is64BitProcess         = (IntPtr.Size == 8);
            config.Information.IsInteractive          = Environment.UserInteractive;
            config.Information.IsUserAdministrator    = ProcessInformation.user_is_administrator();
            config.Information.IsProcessElevated      = ProcessInformation.process_is_elevated();

            if (!string.IsNullOrWhiteSpace(Environment.GetEnvironmentVariable("https_proxy")) && string.IsNullOrWhiteSpace(config.Proxy.Location))
            {
                config.Proxy.Location = Environment.GetEnvironmentVariable("https_proxy");
            }

            if (!string.IsNullOrWhiteSpace(Environment.GetEnvironmentVariable("http_proxy")) && string.IsNullOrWhiteSpace(config.Proxy.Location))
            {
                config.Proxy.Location = Environment.GetEnvironmentVariable("http_proxy");
            }

            if (!string.IsNullOrWhiteSpace(Environment.GetEnvironmentVariable("no_proxy")) && string.IsNullOrWhiteSpace(config.Proxy.BypassList))
            {
                config.Proxy.BypassList = Environment.GetEnvironmentVariable("no_proxy");
            }
        }
        private static void set_environment_options(ChocolateyConfiguration config)
        {
            config.Information.PlatformType             = Platform.get_platform();
            config.Information.PlatformVersion          = Platform.get_version();
            config.Information.PlatformName             = Platform.get_name();
            config.Information.ChocolateyVersion        = VersionInformation.get_current_assembly_version();
            config.Information.ChocolateyProductVersion = VersionInformation.get_current_informational_version();
            config.Information.FullName = Assembly.GetExecutingAssembly().FullName;
            config.Information.Is64BitOperatingSystem = Environment.Is64BitOperatingSystem;
            config.Information.Is64BitProcess         = Environment.Is64BitProcess;
            config.Information.IsInteractive          = Environment.UserInteractive;
            config.Information.UserName            = System.Environment.UserName;
            config.Information.UserDomainName      = System.Environment.UserDomainName;
            config.Information.CurrentDirectory    = Environment.CurrentDirectory;
            config.Information.IsUserAdministrator = ProcessInformation.user_is_administrator();
            config.Information.IsUserSystemAccount = ProcessInformation.user_is_system();
            config.Information.IsUserRemoteDesktop = ProcessInformation.user_is_terminal_services();
            config.Information.IsUserRemote        = ProcessInformation.user_is_remote();
            config.Information.IsProcessElevated   = ProcessInformation.process_is_elevated();

            if (!string.IsNullOrWhiteSpace(Environment.GetEnvironmentVariable("https_proxy")) && string.IsNullOrWhiteSpace(config.Proxy.Location))
            {
                config.Proxy.Location = Environment.GetEnvironmentVariable("https_proxy");
            }

            if (!string.IsNullOrWhiteSpace(Environment.GetEnvironmentVariable("http_proxy")) && string.IsNullOrWhiteSpace(config.Proxy.Location))
            {
                config.Proxy.Location = Environment.GetEnvironmentVariable("http_proxy");
            }

            if (!string.IsNullOrWhiteSpace(Environment.GetEnvironmentVariable("no_proxy")) && string.IsNullOrWhiteSpace(config.Proxy.BypassList))
            {
                config.Proxy.BypassList = Environment.GetEnvironmentVariable("no_proxy");
            }
        }
示例#3
0
        private static ConfigFileSettings get_config_file_settings(IFileSystem fileSystem, IXmlService xmlService)
        {
            var globalConfigPath = ApplicationParameters.GlobalConfigFileLocation;

            AssemblyFileExtractor.extract_text_file_from_assembly(fileSystem, Assembly.GetExecutingAssembly(), ApplicationParameters.ChocolateyConfigFileResource, globalConfigPath);

            return(xmlService.deserialize <ConfigFileSettings>(globalConfigPath));
        }
示例#4
0
 private static void set_environment_options(ChocolateyConfiguration config)
 {
     config.Information.PlatformType             = Platform.get_platform();
     config.Information.PlatformVersion          = Platform.get_version();
     config.Information.PlatformName             = Platform.get_name();
     config.Information.ChocolateyVersion        = VersionInformation.get_current_assembly_version();
     config.Information.ChocolateyProductVersion = VersionInformation.get_current_informational_version();
     config.Information.FullName            = Assembly.GetExecutingAssembly().FullName;
     config.Information.Is64Bit             = Environment.Is64BitOperatingSystem;
     config.Information.IsInteractive       = Environment.UserInteractive;
     config.Information.IsUserAdministrator = ProcessInformation.user_is_administrator();
     config.Information.IsProcessElevated   = ProcessInformation.process_is_elevated();
 }
示例#5
0
 public string get_current_assembly_path()
 {
     return(Assembly.GetExecutingAssembly().CodeBase.Replace("file:///", string.Empty));
 }
示例#6
0
 public string get_current_assembly_path()
 {
     return(Assembly.GetExecutingAssembly().CodeBase.Replace(Platform.get_platform() == PlatformType.Windows ? "file:///" : "file://", string.Empty));
 }