コード例 #1
0
        private static void DeserializeInternal(ILPanelEditor editor, IDeserializer deserializer, object instance, IEnumerable<PropertyInfo> properties, string path)
        {
            foreach (PropertyInfo property in properties)
            {
                if (property.CanRead && property.CanWrite)
                {
                    object value = property.GetValue(instance, null);

                    string configPrefixChild = String.Format("{0}:{1}", path, ToIdentifier(property.Name));
                    if (deserializer.Contains(SplitPath(configPrefixChild)))
                    {
                        PropertyInfo[] childProperties = GetProperties(value);
                        if (childProperties.Length > 0 && editor.WrapperMap.Values.Contains(value.GetType()))
                        {
                            DeserializeInternal(editor, deserializer, value, childProperties, String.Format("{0}:{1}", path, ToIdentifier(property.Name)));
                            continue;
                        }
                    }

                    try
                    {
                        string[] pathParts = SplitPath(path);
                        if (deserializer.Contains(pathParts, property.Name))
                            property.SetValue(instance, deserializer.Get(pathParts, property.Name, property.PropertyType), null);
                    }
                    catch
                    {
                        // Exception in deserialization (e.g. ElementNotFound or not deserializable)
                    }
                }
            }
        }
コード例 #2
0
        public PanelEditorForm(ILPanelEditor editor)
        {
            this.editor = editor;
            plotBrowser = new PlotBrowserForm(editor);

            InitializeComponent();
        }
コード例 #3
0
ファイル: XmlSerializer.cs プロジェクト: profix898/ILNEditor
        public static void SerializeToFile(ILPanelEditor editor, string filename)
        {
            var serializer = new XmlSerializer();
            editor.Serialize(serializer);

            serializer.SaveToFile(filename);
        }
コード例 #4
0
ファイル: ILTickWrapper.cs プロジェクト: profix898/ILNEditor
        public ILTickWrapper(ILTick source, ILPanelEditor editor, string path, string name = null, string label = null)
            : base(source, editor, path, String.IsNullOrEmpty(name) ? "Tick" : name, label)
        {
            this.source = source;

            this.label = new ILLabelWrapper(source.Label, editor, path, ILTickCollection.TickLabelTag);
        }
コード例 #5
0
        public ILSelectionRectangleWrapper(ILSelectionRectangle source, ILPanelEditor editor, string path, string name = null, string label = null)
            : base(source, editor, path, BuildName(name, editor.Panel, source, ILSelectionRectangle.LineTag), label)
        {
            this.source = source;

            lines = new ILLinesWrapper(source.Lines, editor, Path, ILScreenObject.BorderTag, "Lines");
        }
コード例 #6
0
ファイル: XmlSerializer.cs プロジェクト: profix898/ILNEditor
        public static string SerializeToString(ILPanelEditor editor)
        {
            var serializer = new XmlSerializer();
            editor.Serialize(serializer);

            return serializer.SaveToString();
        }
コード例 #7
0
        public ILCameraWrapper(ILCamera source, ILPanelEditor editor, string path, string name = null, string label = null)
            : base(source, editor, path, BuildName(name, editor.Panel, source, "Camera"), label)
        {
            // ILCamera needs to be accessed from SceneSyncRoot (instead of Scene)
            this.source = GetSyncNode(source);

            this.source.MouseDoubleClick += OnMouseDoubleClick;
        }
コード例 #8
0
        public ILLegendItemWrapper(ILLegendItem source, ILPanelEditor editor, string path, string name = null, string label = null)
            : base(source, editor, path, BuildName(name, editor.Panel, source, ILLegendItem.LegendItemTag),
                   String.IsNullOrEmpty(label) ? GetLegendItemLabel(source) : label)
        {
            this.source = source;

            this.label = new ILLabelWrapper(source.Label, editor, Path, ILLegendItem.LabelTag);
        }
コード例 #9
0
        public ILMarkerWrapper(ILMarker source, ILPanelEditor editor, string path, string name = null, string label = null)
            : base(source, editor, path, BuildName(name, editor.Panel, source, "Marker"), label)
        {
            this.source = source;

            fill = new ILTrianglesWrapper(source.Fill, editor, Path, ILMarker.DefaultFillTag, "Fill");
            border = new ILLinesWrapper(source.Border, editor, Path, ILMarker.DefaultBorderTag, "Border");
        }
コード例 #10
0
ファイル: ILLabelWrapper.cs プロジェクト: profix898/ILNEditor
        public ILLabelWrapper(ILLabel source, ILPanelEditor editor, string path, string name = null, string label = null)
            : base(source, editor, path, BuildName(name, editor.Panel, source, "Label"),
                   String.IsNullOrEmpty(label) ? GetLabel(source) : label)
        {
            this.source = source;

            this.source.MouseDoubleClick += OnMouseDoubleClick;
        }
コード例 #11
0
        public ILScreenObjectWrapper(ILScreenObject source, ILPanelEditor editor, string path, string name = null, string label = null)
            : base(source, editor, path, BuildName(name, editor.Panel, source, "ScreenObject"), label)
        {
            this.source = source;

            border = new ILLinesWrapper(source.Border, editor, Path, ILScreenObject.BorderTag, "Border");
            background = new ILTrianglesWrapper(source.Background, editor, Path, ILScreenObject.BackgroundTag, "Background");
        }
コード例 #12
0
        public ILAxisCollectionWrapper(ILAxisCollection source, ILPanelEditor editor, string path, string name = null, string label = null)
            : base(source, editor, path, BuildName(name, editor.Panel, source, ILAxisCollection.DefaultTag), label)
        {
            this.source = source;

            xAxis = new ILAxisWrapper(source.XAxis, editor, Path);
            yAxis = new ILAxisWrapper(source.YAxis, editor, Path);
            zAxis = new ILAxisWrapper(source.ZAxis, editor, Path);
        }
コード例 #13
0
        public ILPlotCubeScaleGroupWrapper(ILPlotCubeScaleGroup source, ILPanelEditor editor, string path, string name = null, string label = null)
            : base(source, editor, path, BuildName(name, editor.Panel, source, ILPlotCubeScaleGroup.DefaultTag),
                   String.IsNullOrEmpty(label) ? GetPlotCubeScaleGroupLabel(source, editor.Panel) : label)
        {
            this.source = source;

            axes = new ILAxisCollectionWrapper(source.First<ILAxisCollection>(ILPlotCubeScaleGroup.AxesTag), editor, Path, ILPlotCubeScaleGroup.AxesTag);
            lines = new ILLinesWrapper(source.First<ILLines>(ILPlotCubeScaleGroup.LinesTag), editor, Path, ILPlotCubeScaleGroup.LinesTag);
        }
コード例 #14
0
        public ILPlotCubeDataGroupWrapper(ILPlotCubeDataGroup source, ILPanelEditor editor, string path, string name = null, string label = null)
            : base(source, editor, path, BuildName(name, editor.Panel, source, ILPlotCubeScaleGroup.PlotsTag),
                   String.IsNullOrEmpty(label) ? GetPlotCubeDataGroupLabel(source, editor.Panel) : label)
        {
            this.source = source;

            scaleModes = new ILScaleModesWrapper(source.ScaleModes, editor, Path);
            limits = new ILLimitsWrapper(source.Limits, GetSyncNode(source).Limits, editor, Path);
        }
コード例 #15
0
        public ILTickCollectionWrapper(ILTickCollection source, ILPanelEditor editor, string path, string name = null, string label = null)
            : base(source, editor, path, BuildName(name, editor.Panel, source, ILPlotCube.DefaultTag), label)
        {
            // ILTickCollection needs to be accessed from SceneSyncRoot (instead of Scene)
            this.source = GetSyncNode(source);

            lines = new ILLinesWrapper(this.source.Lines, editor, Path, ILTickCollection.TickLinesTag, "TickLines");
            ticks = new ReadOnlyCollection<ILTickWrapper>(((IEnumerable<ILTick>) source).Select(tick => new ILTickWrapper(tick, editor, Path)).ToList());
        }
コード例 #16
0
ファイル: ILShapeWrapper.cs プロジェクト: profix898/ILNEditor
        protected ILShapeWrapper(ILShape source, ILPanelEditor editor, string path, string name = null, string label = null)
            : base(source, editor, path, BuildName(name, editor.Panel, source, "Shape"), label)
        {
            this.source = source;

            // Subscribe mouse events on SceneSyncRoot (instead of Scene)
            sourceSync = GetSyncNode(source);
            sourceSync.MouseDoubleClick += OnMouseDoubleClick;
        }
コード例 #17
0
        public ILCircleWrapper(ILCircle source, ILPanelEditor editor, string path, string name = null, string label = null)
            : base(source, editor, path, BuildName(name, editor.Panel, source, ILCircle.CircleGroupTag), label)
        {
            this.source = source;

            fill = new ILTrianglesWrapper(source.Fill, editor, Path, ILCircle.FillTagDefault);
            border = new ILLinesWrapper(source.Border, editor, Path, ILCircle.BorderTagDefault);

            this.source.MouseDoubleClick += OnMouseDoubleClick;
        }
コード例 #18
0
ファイル: ILWrapperBase.cs プロジェクト: profix898/ILNEditor
        protected ILWrapperBase(object source, ILPanelEditor editor, string path, string name, string label = null)
        {
            this.source = source;
            this.editor = editor;
            this.path = String.IsNullOrEmpty(path) ? name : path + ":" + name;
            this.name = name;
            this.label = String.IsNullOrEmpty(label) ? name : label;

            editor.Wrappers.Add(this);
        }
コード例 #19
0
        public ILPlotCubeWrapper(ILPlotCube source, ILPanelEditor editor, string path, string name = null, string label = null)
            : base(source, editor, path, BuildName(name, editor.Panel, source, ILPlotCube.DefaultTag),
                   String.IsNullOrEmpty(label) ? GetPlotCubeLabel(source, editor.Panel) : label)
        {
            this.source = source;

            // Subscribe mouse events on SceneSyncRoot (instead of Scene)
            sourceSync = GetSyncNode(source);
            sourceSync.MouseClick += OnMouseClick;
        }
コード例 #20
0
        public ILSphereWrapper(ILSphere source, ILPanelEditor editor, string path, string name = null, string label = null)
            : base(source, editor, path, BuildName(name, editor.Panel, source, ILSphere.DefaultSphereTag), label)
        {
            this.source = source;

            fill = new ILTrianglesWrapper(source.Fill, editor, Path, ILSphere.DefaultFillTag);
            wireframe = new ILLinesWrapper(source.Wireframe, editor, Path, ILSphere.DefaultWireframeTag);

            this.source.MouseDoubleClick += OnMouseDoubleClick;
        }
コード例 #21
0
        public ILSurfaceWrapper(ILSurface source, ILPanelEditor editor, string path, string name = null, string label = null)
            : base(source, editor, path, BuildName(name, editor.Panel, source, ILLinePlot.LinePlotTag),
                   String.IsNullOrEmpty(label) ? GetSurfaceLabelFromLegend(source, editor.Panel) : label)
        {
            this.source = source;

            fill = new ILTrianglesWrapper(source.Fill, editor, Path, ILSurface.FillTag, "Fill");
            wireframe = new ILLinesWrapper(source.Wireframe, editor, Path, ILSurface.WireframeTag, "Wireframe");
            positions = new ReadOnlyCollection<float>(source.Positions.ToList());
        }
コード例 #22
0
ファイル: ILGearWrapper.cs プロジェクト: profix898/ILNEditor
        public ILGearWrapper(ILGear source, ILPanelEditor editor, string path, string name = null, string label = null)
            : base(source, editor, path, BuildName(name, editor.Panel, source, "Gear"), label)
        {
            this.source = source;

            fill = new ILTrianglesWrapper(source.Fill, editor, Path, "Fill");
            wireframe = new ILLinesWrapper(source.Wireframe, editor, Path, "Wireframe");

            this.source.MouseDoubleClick += OnMouseDoubleClick;
        }
コード例 #23
0
        public ILLinePlotWrapper(ILLinePlot source, ILPanelEditor editor, string path, string name = null, string label = null)
            : base(source, editor, path, BuildName(name, editor.Panel, source, ILLinePlot.LinePlotTag),
                   String.IsNullOrEmpty(label) ? GetLinePlotLabelFromLegend(source, editor.Panel) : label)
        {
            this.source = source;

            line = new ILLinesWrapper(source.Line, editor, Path, ILLinePlot.LineTag, "Line");
            marker = new ILMarkerWrapper(source.Marker, editor, Path, ILLinePlot.MarkerTag, "Marker");
            positions = new ReadOnlyCollection<float>(source.Positions.ToList());
        }
コード例 #24
0
        public ILCylinderWrapper(ILCylinder source, ILPanelEditor editor, string path, string name = null, string label = null)
            : base(source, editor, path, BuildName(name, editor.Panel, source, ILCylinder.CylinderGroupTag), label)
        {
            this.source = source;

            bottom = new ILCircleWrapper(source.Bottom, editor, Path, ILCylinder.BottomTag);
            top = new ILCircleWrapper(source.Top, editor, Path, ILCylinder.TopTag);
            hull = new ILTrianglesWrapper(source.Hull, editor, Path, ILCylinder.HullTag);

            this.source.MouseDoubleClick += OnMouseDoubleClick;
        }
コード例 #25
0
ファイル: ILConeWrapper.cs プロジェクト: profix898/ILNEditor
        public ILConeWrapper(ILCone source, ILPanelEditor editor, string path, string name = null, string label = null)
            : base(source, editor, path, BuildName(name, editor.Panel, source, ILCone.ConeGroupTag), label)
        {
            this.source = source;

            bottom = new ILTrianglesWrapper(source.Bottom, editor, Path, ILCone.BottomTag);
            hull = new ILTrianglesWrapper(source.Hull, editor, Path, ILCone.HullTag);
            border = new ILLinesWrapper(source.Border, editor, Path, ILCone.BorderTag);

            this.source.MouseDoubleClick += OnMouseDoubleClick;
        }
コード例 #26
0
ファイル: ILAxisWrapper.cs プロジェクト: profix898/ILNEditor
        public ILAxisWrapper(ILAxis source, ILPanelEditor editor, string path, string name = null, string label = null)
            : base(source, editor, path, String.IsNullOrEmpty(name) ? source.AxisName.ToString().Replace(" ", String.Empty) : name,
                   String.IsNullOrEmpty(label) ? source.AxisName.ToString() : label)
        {
            this.source = source;

            this.label = new ILLabelWrapper(source.Label, editor, Path, ILAxis.LabelTag, "AxisLabel");
            scaleLabel = new ILLabelWrapper(source.ScaleLabel, editor, Path, ILAxis.ScaleLabelTag, "ScaleLabel");
            ticks = new ILTickCollectionWrapper(source.Ticks, editor, Path, "TicksCollection");
            gridMajor = new ILLinesWrapper(source.GridMajor, editor, Path, ILAxis.GridMajorLinesTag, "GridMajor");
            gridMinor = new ILLinesWrapper(source.GridMinor, editor, Path, ILAxis.GridMinorLinesTag, "GridMinor");
        }
コード例 #27
0
        private static void SerializeInternal(ILPanelEditor editor, ISerializer serializer, object instance, IEnumerable<PropertyInfo> properties, string path)
        {
            foreach (PropertyInfo property in properties)
            {
                if (property.CanRead)
                {
                    object value = property.GetValue(instance, null);

                    if (value != null && editor.WrapperMap.Values.Contains(value.GetType()))
                    {
                        PropertyInfo[] childProperties = GetProperties(value);
                        if (childProperties.Length > 0)
                        {
                            SerializeInternal(editor, serializer, value, childProperties, String.Format("{0}:{1}", path, ToIdentifier(property.Name)));
                            continue;
                        }
                    }

                    if (property.CanWrite)
                        serializer.Set(SplitPath(path), ToIdentifier(property.Name), value);
                }
            }
        }
コード例 #28
0
 protected ILDrawableWrapper(ILDrawable source, ILPanelEditor editor, string path, string name = null, string label = null)
     : base(source, editor, path, String.IsNullOrEmpty(name) ? "Drawable" : name, label)
 {
     this.source = source;
 }
コード例 #29
0
 public ILTrianglesWrapper(ILTriangles source, ILPanelEditor editor, string path, string name = null, string label = null)
     : base(source, editor, path, BuildName(name, editor.Panel, source, "Triangles"), label)
 {
     this.source = source;
 }
コード例 #30
0
 public ILPointLightWrapper(ILPointLight source, ILPanelEditor editor, string path, string name = null, string label = null)
     : base(source, editor, path, BuildName(name, editor.Panel, source, ILPointLight.DefaultPointLightTag), label)
 {
     this.source = source;
 }