Esempio n. 1
0
 private static void SaveUserProperties(DataElement container, PropertiesContainer properties)
 {
   foreach(KeyValuePair<string, IProperty> kvp in properties.UserProperties)
   {
     DataElement element = container.CreateChild("property");
     element.CreateAttribute("name", kvp.Key);
     element.CreateAttribute("value", kvp.Value.ToString());
   }
 }
Esempio n. 2
0
 private static void SaveScene(DataElement sceneElement, Scene scene)
 {
   sceneElement.CreateAttribute("size", scene.Size.ToString());
   DataElement sceneObjectContainer = sceneElement.CreateChild("shapes");
   foreach(Shape shape in scene.Shapes)
   {
     DataElement shapeEl = sceneObjectContainer.CreateChild("shape");
     shapeEl.CreateAttribute("name", shape.Name);
     SaveShape(shapeEl, shape);
   }
   
   DataElement propertiesContainer = sceneElement.CreateChild("properties");
   SaveUserProperties(propertiesContainer, scene);
 }
Esempio n. 3
0
    private static void SaveShape(DataElement node, Shape shape)
    {
      node.CreateAttribute("template_name", shape.Template.Name);
      node.CreateAttribute("z_order", shape.ZOrder.ToString());
      if(shape.EditableColor)
      {
        node.CreateAttribute("color", shape.Color.ToArgb().ToString());
      }

      DataElement circlesEl = node.CreateChild("circles");
      foreach(ShapeCircle circle in shape.Circles)
      {
        SaveShapeCircle(circlesEl.CreateChild("circle"), circle);
      }
      
      DataElement propertiesEl = node.CreateChild("user_properties");
      SaveUserProperties(propertiesEl, shape);
    }
Esempio n. 4
0
 private static void SaveBaseTemplate(DataElement node, string folder, ShapeTemplate template)
 {
   node.CreateAttribute("name", template.Name);
   node.CreateAttribute("color", template.Color.ToArgb().ToString());
   node.CreateAttribute("editable_color", template.EditableColor.ToString());
   node.CreateAttribute("background", template.Backgroud.ToString());
   DataElement circlesEl = node.CreateChild("circles");
   foreach(ShapeCircle circle in template.RootCircle.AllCircles)
   {
     DataElement circleEl = circlesEl.CreateChild("circle");
     circleEl.CreateAttribute("position", circle.Position.ToString());
     circleEl.CreateAttribute("radius", circle.Radius.ToString());
     circleEl.CreateAttribute("angle", circle.Angle.ToString());
   }
   
   DataElement circlesSettingsEl = node.CreateChild("circles_settings");
   foreach(ShapeTemplate.ShapeCircleSettings settings in template.PerCircleSettings)
   {
     DataElement circleSettingsEl = circlesSettingsEl.CreateChild("settings");
     circleSettingsEl.CreateAttribute("enable_offset", settings.EnableOffset.ToString());
     circleSettingsEl.CreateAttribute("enable_rotate", settings.EnableRotate.ToString());
   }
   
   if(!string.IsNullOrEmpty(template.PropertiesFilepath))
   {
     string relPropertiesFilepath = DirMethods.EvaluateRelativePath(folder, template.PropertiesFilepath);
     node.CreateAttribute("rel_properties_filepath", relPropertiesFilepath);
   }
 }