Beispiel #1
0
        public AlvisProject GetAlvisProject()
        {
            var text = File.OpenText(FileLocation).ReadToEnd();

            XmlAlvisSerializer serializer= new XmlAlvisSerializer();

            return serializer.Deserialize(text);
        }
Beispiel #2
0
        public static void Main(string[] args)
        {
            string path = args [0];
            if (!string.IsNullOrWhiteSpace (path) && File.Exists (path)) {
                var text = File.OpenText(path).ReadToEnd();

                XmlAlvisSerializer serializer= new XmlAlvisSerializer();

                var projectObj = serializer.Deserialize(text);

                var validators = new List<IAlvisValidator> {

                    new AtLeastOneActiveAgentAlvisValidator(),

                    new AgentAlvisValidator(),

                    new ConnectionAlvisValidator(),

                    new CodeAlvisValidator() };

                bool notvalid = false;
                foreach (var validator in validators)
                {
                    string errorMessage = validator.Validate(projectObj);
                    if (!String.IsNullOrWhiteSpace(errorMessage))
                    {
                        Console.WriteLine(errorMessage);
                        notvalid = true;
                    }
                }

                if (notvalid) {
                    Console.WriteLine ("VALIDATION ERRORS");
                } else {
                    Console.WriteLine ("No validation errors");
                }

            } else {
                Console.WriteLine ("Wrong path to file");
                Console.ReadKey ();
            }
        }