Пример #1
0
        static List <UIModel> DeserializeModelsV2(opr opr, DirectoryInfo oprPath)
        {
            List <UIModel> models = new List <UIModel>();

            if (opr.models == null)
            {
                return(models);
            }

            UIModel  uiModel;
            FileInfo omiFile = null;

            foreach (oprModel model in opr.models)
            {
                try
                {
                    omiFile = Utils.GetAbsoluteOmiFile(model.omi, oprPath);

                    uiModel = new UIModel();
                    uiModel.OmiDeserializeAndInitialize(omiFile);

                    uiModel.Rect.X      = Int32.Parse(model.rect_x);
                    uiModel.Rect.Y      = Int32.Parse(model.rect_y);
                    uiModel.Rect.Width  = Int32.Parse(model.rect_width);
                    uiModel.Rect.Height = Int32.Parse(model.rect_height);
                    uiModel.IsTrigger   = model.is_trigger;

                    models.Add(uiModel);
                }
                catch (Exception e)
                {
                    throw new Exception("Cannot instatiate model " + omiFile == null ? model.omi : omiFile.FullName, e);
                }
            }

            return(models);
        }
Пример #2
0
        static List <UIModel> DeserializeModelsV1(guiComposition opr, DirectoryInfo oprPath)
        {
            throw new NotImplementedException();
#if DEPRECATED
            if (opr.models != null)
            {
                UIModel  uiModel;
                FileInfo omiFile;

                foreach (guiCompositionModel oprModel in opr.models)
                {
                    try
                    {
                        omiFile = Utils.GetAbsoluteOmiFile(
                            oprModel.omi, oprPath);

                        uiModel = new UIModel();
                        uiModel.OmiDeserializeAndInitialize(omiFile);

                        uiModel.Rect.X      = Int32.Parse(oprModel.rect_x);
                        uiModel.Rect.Y      = Int32.Parse(oprModel.rect_y);
                        uiModel.Rect.Width  = Int32.Parse(oprModel.rect_width);
                        uiModel.Rect.Height = Int32.Parse(oprModel.rect_height);

                        ModelAdd(uiModel);
                    }
                    catch (Exception e)
                    {
                        throw new Exception("Cannot add model " + oprModel.omi, e);
                    }
                }

                // TODO ADH Connections
            }
#endif
        }