TfsHipChat.Configuration.ConfigurationProvider.Validate C# (CSharp) Method

Validate() public method

public Validate ( ) : List
return List
        public List<string> Validate()
        {
            var errors = new List<string>();

            try
            {
                ReadConfig(Path);
            }
            catch (FileNotFoundException)
            {
                errors.Add(String.Format(
                    "Can't find configuration file. Copy SampleConfig.json to {0} and fill in the blanks.",
                    Path));
            }
            catch (JsonReaderException)
            {
                errors.Add(String.Format(
                    "Can't parse the {0} configuration file. Ensure it is a valid JSON file.",
                    Path));
            }

            return errors;
        }

Usage Example

Exemplo n.º 1
0
        static void Main()
        {
            var configurationProvider = new ConfigurationProvider { Path = GetConfigPath() };
            var errors = configurationProvider.Validate();

            if (errors.Count > 0)
            {
                errors.ForEach(e => System.Console.WriteLine("ERROR: " + e));
                return;
            }

            StartService(configurationProvider);
        }
All Usage Examples Of TfsHipChat.Configuration.ConfigurationProvider::Validate
ConfigurationProvider