Esempio n. 1
0
        private static RompConfigValues MungeConfig(params RompConfigValues[] configs)
        {
            var result = new RompConfigValues();

            foreach (var c in configs)
            {
                result = RompConfigValues.Merge(result, c, false);
            }

            return(result);
        }
Esempio n. 2
0
        public static void Initialize(ArgList args)
        {
            var configArgs = ParseConfigArguments(args);

            var overridden = MungeConfig(
                configArgs,
                LoadConfigFile(Path.Combine(Environment.CurrentDirectory, "rompconfig.json")),
                LoadConfigFile(Path.Combine(UserConfigPath, "rompconfig.json")),
                LoadConfigFile(Path.Combine(MachineConfigPath, "rompconfig.json"))
                );

            OverriddenValues = overridden;
            Values           = RompConfigValues.Merge(overridden, getDefaults(), true);

            if (CeipEnabled)
            {
                InitializeLoupe();
            }

            RompConfigValues getDefaults()
            {
                // some defaults are dependent on whether running in user mode or not
                var path = overridden.UserMode == true ? UserConfigPath : MachineConfigPath;

                return(new RompConfigValues
                {
                    StoreLogs = true,
                    LogLevel = MessageLevel.Warning,
                    CachePackages = true,
                    UserMode = false,
                    SecureCredentials = false,
                    ExtensionsPath = Path.Combine(path, "extensions"),
                    ExtensionsTempPath = Path.Combine(path, "temp", "extensions"),
                    Rafts = new Dictionary <string, string>()
                });
            }
        }