Пример #1
0
 private bool ValidateModelSystem()
 {
     try
     {
         ErrorWithPath error = new ErrorWithPath();
         if (!_Root.Validate(ref error, new List <int>()))
         {
             InvokeValidationError(CreateFromSingleError(error));
             return(false);
         }
         if (!Project.CreateModule(Configuration, _Root, _Root, new List <int>(), ref error))
         {
             InvokeValidationError(CreateFromSingleError(error));
             return(false);
         }
         MST = _Root.Module as IModelSystemTemplate;
         if (MST == null)
         {
             InvokeValidationError(CreateFromSingleError(new ErrorWithPath(null, "Unable to generate MST!")));
             return(false);
         }
     }
     catch (Exception e)
     {
         InvokeValidationError(CreateFromSingleError(new ErrorWithPath(null, e.Message, e.StackTrace, exception: e)));
         return(false);
     }
     return(true);
 }
Пример #2
0
        private IModelSystemStructure CreateModelSystem(ref ErrorWithPath error)
        {
            IModelSystemStructure mstStructure;

            if (ModelSystemStructureModelRoot == null)
            {
                _MST         = ((Project)_Project).CreateModelSystem(ref error, Configuration, _ModelSystemIndex);
                mstStructure = _Project.ModelSystemStructure[_ModelSystemIndex];
            }
            else
            {
                _MST         = ((Project)_Project).CreateModelSystem(ref error, Configuration, ModelSystemStructureModelRoot.RealModelSystemStructure);
                mstStructure = ModelSystemStructureModelRoot.RealModelSystemStructure;
            }
            return(mstStructure);
        }
Пример #3
0
        private void Run()
        {
            string originalWorkingDirectory = Directory.GetCurrentDirectory();
            // create an empty error
            ErrorWithPath         error = new ErrorWithPath();
            IModelSystemStructure mstStructure;
            bool validationError = false;

            try
            {
                mstStructure = CreateModelSystem(ref error);
            }
            catch (Exception e)
            {
                InvokeValidationError(CreateFromSingleError(new ErrorWithPath(null, e.Message)));
                return;
            }
            if (_MST == null)
            {
                InvokeValidationError(CreateFromSingleError(error));
                return;
            }
            if (!validationError)
            {
                Exception caughtError = null;
                try
                {
                    RunModelSystem(out List <ErrorWithPath> errors, mstStructure);
                }
                catch (Exception e)
                {
                    if (!(e is ThreadAbortException))
                    {
                        caughtError = e;
                    }
                }
                finally
                {
                    mstStructure = CleanupModelSystem(originalWorkingDirectory, mstStructure, caughtError);
                }
            }
        }
Пример #4
0
        private static void WriteError(BinaryWriter writer, ErrorWithPath error)
        {
            var path = error.Path;

            if (path != null)
            {
                writer.Write(path.Count);
                foreach (var point in path)
                {
                    writer.Write(point);
                }
            }
            else
            {
                writer.Write((Int32)(-1));
            }
            writer.Write(error.Message);
            writer.Write(error.StackTrace ?? String.Empty);
            writer.Write(error.ModuleName ?? String.Empty);
        }
Пример #5
0
 private static void Run_RuntimeError(ErrorWithPath obj)
 {
     Console.WriteLine(obj.Message);
 }