Ejemplo n.º 1
0
        public int Run(string[] args)
        {
            // parse commandline and swicth based on selected command
            return(Parser.Default.ParseArguments <CheckOptions, ExportDefaultConfigOptions, ListRulesOptions>(args).MapResult(

                       // run consistency check
                       (CheckOptions options) =>
            {
                if (!Directory.Exists(options.Path))
                {
                    Console.Error.Write($"Directory '{options.Path}'not found");
                    return 1;
                }

                // load file system
                var rootDirectory = m_FileSystemLoader.LoadDirectory(options.Path);

                //load configuration
                m_ConfigLoader.LoadConfiguration(rootDirectory);

                //load media metadata
                m_MetadataLoader.LoadMetadata(rootDirectory);

                // run actual consistency check
                m_ConsistencyChecker.CheckConsistency(rootDirectory);

                //write results to file
                using (var stream = new StreamWriter(System.IO.File.Open(options.OutputFile, FileMode.Create)))
                {
                    m_OutputWriter.WriteTo(stream);
                }

                return 0;
            },

                       // export the default configuration to a file
                       (ExportDefaultConfigOptions opts) =>
            {
                m_ConfigWriter.WriteConfiguration(m_DefaultConfiguration, opts.OutputFile);
                return 0;
            },

                       //print a list of rules to the console
                       (ListRulesOptions opts) =>
            {
                foreach (var rule in m_RuleSet.AllRules)
                {
                    Console.WriteLine();

                    Console.WriteLine(" " + rule.Id);
                    Console.WriteLine(" \t" + rule.Description);
                }

                return 0;
            },

                       // unknown parameters => error
                       (IEnumerable <Error> errs) => 1
                       ));
        }
Ejemplo n.º 2
0
 public void Load()
 {
     AppSettings = _configurationLoader.LoadConfiguration <AppSettings>("settings.json");
     if (AppSettings == null)
     {
         AppSettings = new AppSettings();
         Save();
     }
 }
Ejemplo n.º 3
0
 public override Task <ConfigurationReply> ConfigureSystem(SystemConfiguration request, ServerCallContext context)
 {
     // TODO: handle failure to apply configuration
     _configurationLoader.LoadConfiguration(request);
     return(Task.FromResult(new ConfigurationReply
     {
         Status = ConfigurationStatus.Applied,
         StatusMessage = "Configuration succeeded."
     }));
 }
Ejemplo n.º 4
0
        private Profile LoadConfiguration(string[] args)
        {
            var response = _configurationLoader.LoadConfiguration(args, argsList);

            platform = response.Platform;
            version  = response.Version;
            var profile = response.Profile;

            _profileStorage.Set(profile);

            //LITE.profile.runningCodeVersion = version;

            return(profile);
        }
Ejemplo n.º 5
0
 public void Load()
 {
     AppSettings = _configurationLoader.LoadConfiguration <AppSettings>("config.json") ?? new AppSettings();
 }