Beispiel #1
0
        private void Run(string[] args)
        {
            if (args.Length != 1)
            {
                Console.Error.WriteLine("Error: No input file specified.");
                return;
            }
            if (!File.Exists(args[0]))
            {
                Console.Error.WriteLine("Input file not found.");
                return;
            }
            var project = new DataSchemaProject();
            var context = new VerificationContext();
            project.LoadFrom(args[0], context, this);
            ShowMessages(context);

            if (context.Entries.Count != 0)
            {
                WriteWarning("No script file written.");
                return;
            }

            context.Clear();

            project.Build(context, this);
            ShowMessages(context);
        }
Beispiel #2
0
        private void OpenFile(string filePath)
        {
            try
            {
                Cursor.Current = Cursors.WaitCursor;
                verificationContext.Clear();

                project = new DataSchemaProject();
                project.LoadFrom(filePath, verificationContext, this);

                //dataSchema = new DataSchema();
                //using (StreamReader reader = new StreamReader(filePath))
                //{
                //    dataSchema.LoadDataSchemaFile(reader, verificationContext);
                //}
                //dataSchema.Verify(verificationContext);

                AddRecentlyUsedFile(filePath);

            }
            catch (Exception ex)
            {
                if (!ex.IsCritical())
                {
                    ReportError(string.Format("Error loading file '{0}'.", filePath), ex);
                    return;
                }
                else
                {
                    throw;
                }
            }

            MessageLog.WriteLine("'" + Path.GetFileName(filePath) + "' loaded.");
            projectView.Project = project;
        }