예제 #1
0
        static EdgeObject ParseObject(JObject obj)
        {
            var        type = (EdgeObjectType)Enum.Parse(typeof(EdgeObjectType), (string)obj ["type"], true);
            EdgeObject edgeObject;

            switch (type)
            {
            case EdgeObjectType.Image:
                edgeObject = new EdgeImage {
                    ImageName = HttpUtility.UrlDecode((string)obj ["fill"] [1]),
                };
                break;

            case EdgeObjectType.Text:
                edgeObject = new EdgeText {
                    Text = (string)obj ["text"],
                    Font = ParseFont((JArray)obj ["font"]),
                };
                break;

            default:
                edgeObject = new EdgeObject();
                break;
            }
            bool autoWidth;
            bool autoHeight;

            edgeObject.Name       = (string)obj ["id"];
            edgeObject.Rect       = ParseRect((JArray)obj ["rect"], out autoWidth, out autoHeight);
            edgeObject.AutoWidth  = autoWidth;
            edgeObject.AutoHeight = autoHeight;
            edgeObject.Hidden     = Parsehidden(obj);
            edgeObject.Opacity    = ParseOpacity(obj);
            return(edgeObject);
        }
예제 #2
0
 static EdgeObject ParseObject(JObject obj)
 {
     var type = (EdgeObjectType)Enum.Parse (typeof(EdgeObjectType), (string)obj ["type"], true);
     EdgeObject edgeObject;
     switch (type) {
     case EdgeObjectType.Image:
         edgeObject = new EdgeImage {
             ImageName = HttpUtility.UrlDecode ((string)obj ["fill"] [1]),
         };
         break;
     case EdgeObjectType.Text:
         edgeObject = new EdgeText {
             Text = (string)obj ["text"],
             Font = ParseFont ((JArray)obj ["font"]),
         };
         break;
     default:
         edgeObject = new EdgeObject ();
         break;
     }
     bool autoWidth;
     bool autoHeight;
     edgeObject.Name = (string)obj ["id"];
     edgeObject.Rect = ParseRect ((JArray)obj ["rect"], out autoWidth, out autoHeight);
     edgeObject.AutoWidth = autoWidth;
     edgeObject.AutoHeight = autoHeight;
     edgeObject.Hidden = Parsehidden (obj);
     edgeObject.Opacity = ParseOpacity (obj);
     return edgeObject;
 }