protected virtual void Parse(XmlElement element) { Version = element.GetString("element", "UNKNOWN"); Generator = element.GetString("generator", "UNKNOWN"); GeneratorVersion = element.GetString("generator_version", "UNKNOWN"); string pixelArt = element.GetString("pixel_art_mode", "false"); PixelArtMode = pixelArt == "true"; LoadFolders(element); LoadEntities(element); }
public static ObjectType Parse(XmlElement element) { ObjectType value; string objectType = element.GetString("object_type", "sprite"); switch (objectType) { case "point": value = ObjectType.Point; break; case "box": value = ObjectType.Box; break; case "sprite": value = ObjectType.Sprite; break; case "sound": value = ObjectType.Sound; break; case "entity": value = ObjectType.Entity; break; case "variable": value = ObjectType.Variable; break; default: value = ObjectType.INVALID; break; } return value; }
protected virtual void Parse(XmlElement element, Timeline timeline) { string curveString = element.GetString("curve_type", "linear"); switch (curveString) { case "instant": CurveType = Spriter.CurveType.Instant; break; case "linear": CurveType = Spriter.CurveType.Linear; break; case "quadratic": CurveType = Spriter.CurveType.Quadratic; break; case "cubic": CurveType = Spriter.CurveType.Cubic; break; case "quartic": CurveType = Spriter.CurveType.Quartic; break; case "quintic": CurveType = Spriter.CurveType.Quintic; break; default: CurveType = Spriter.CurveType.INVALID; break; } Timeline = timeline; GetCurveParams(element); }
protected virtual void Parse(XmlElement element, ScmlObject scml) { Scml = scml; Name = element.GetString("name", ""); LoadAnimations(element); }
protected virtual void Parse(XmlElement element, Folder folder) { Folder = folder; var type = element.GetString("type", "image"); switch(type) { case "image": FileType = FileType.Image; break; case "atlas_image": FileType = FileType.AtlasImage; break; case "sound_effect": FileType = FileType.SoundEffect; break; case "entity": FileType = FileType.Entity; break; default: FileType = FileType.INVALID_TYPE; break; } Name = element.GetString("name", ""); Vector2 pivot; pivot.x = element.GetFloat("pivot_x", 0.0f); pivot.y = element.GetFloat("pivot_y", 0.0f); Pivot = pivot; Vector2 size; size.x = element.GetInt("width", 0); size.y = element.GetInt("height", 0); Size = size; Vector2 offset; offset.x = element.GetInt("offset_x", 0); offset.y = element.GetInt("offset_y", 0); Offset = offset; Vector2 originalSize; originalSize.x = element.GetInt("original_width", 0); originalSize.y = element.GetInt("original_height", 0); OriginalSize = originalSize; }
public ModuleResult ProcessElement(XmlElement moduleElement, ViewConfiguration configuration) { XmlNamespaceManager nm = XmlNamespaces.Manager; bool isPublic = moduleElement.GetBoolean("mod:config/mod:public", nm); string threadName = moduleElement.GetString("mod:config/mod:thread", nm); string loggerName = moduleElement.GetString("mod:config/mod:logger", DefaultLoggerName, nm); SageContext context = configuration.Context; if (!isPublic && !context.IsDeveloperRequest) { log.Warn("Skipping work for non-developer reqest. To override this set mod:config/mod:public to 'true'."); return null; } if (string.IsNullOrEmpty(threadName)) { log.Warn("Thread name parameter is missing. Set mod:config/mod:thread be a non-empty string."); return new ModuleResult(ModuleResultStatus.MissingParameters); } if (!IsLoggingEnabled) { log.Warn("Logging is disabled."); log.WarnFormat("Make sure to enable log4net logging, and to add an appender with the following configuration:"); log.WarnFormat(ConfigurationExample, loggerName); return new ModuleResult(ModuleResultStatus.NoData); } FileAppender appender = GetAppender(loggerName) as FileAppender; if (appender == null) { log.WarnFormat("The log appender '{0}' does not exist or is not a FileAppender.", loggerName); log.WarnFormat("Either create an appender with that name or specify another using mod:config/mod:logger."); log.WarnFormat("Make sure to enable log4net logging, and to add an appender with the following configuration:"); log.WarnFormat(ConfigurationExample, loggerName); return new ModuleResult(ModuleResultStatus.NoData); } ModuleResult result = new ModuleResult(moduleElement); result.AppendDataElement(CreateLogElement(moduleElement.OwnerDocument, appender, threadName)); return result; }
protected virtual void Parse(XmlElement element, Entity entity) { Entity = entity; Name = element.GetString("name", ""); Length_Ms = element.GetInt("length", -1); LoopType = LoopTypeUtils.Parse(element); LoopTo = element.GetInt("loop_to", 0); LoadTimelines(element); LoadMainline(element); }
protected virtual void Parse(XmlElement element, SpriterAnimation animation) { Animation = animation; Name = element.GetString("name", ""); ObjectType = ObjectType.Parse(element); var children = element.GetElementsByTagName(TimelineKey.XmlKey); foreach (XmlElement childElement in children) { keys.Add(GetKey(childElement)); } }
public void Parse(XmlElement configElement) { this.Enabled = configElement.GetAttribute("enabled").EqualsAnyOf("yes", "true", "1"); this.Directory = configElement.GetString("p:directory", XmlNamespaces.Manager); var groups = configElement.SelectNodes("p:groups/p:group", XmlNamespaces.Manager); this.Groups = new Dictionary<string, Group>(); foreach (XmlElement node in groups) { var group = new Group(node); this.Groups.Add(group.Name, group); } }
public static LoopType Parse(XmlElement element) { var looping = element.GetString("looping", "true"); switch (looping) { case "true": return LoopType.True; case "false": return LoopType.False; case "ping_pong": return LoopType.PingPong; } return LoopType.INVALID; }
protected override void Parse(XmlElement element) { base.Parse(element); Name = element.GetString("name", ""); //Parse file elements var fileElements = element.GetElementsByTagName("file"); var files = new List<File>(fileElements.Count); foreach(XmlElement fileElement in fileElements) { files.Add(new File(fileElement, this)); } Files = files; }
public static DropdownListItem Create(XmlElement row) { var text = row.GetString("text"); var value = row.GetString("value"); return new DropdownListItem(text, value); }
public ReplaceFilter(XmlElement filterElement) : base(filterElement) { expression = new Regex(filterElement.GetString("p:from", XmlNamespaces.Manager)); replacement = filterElement.GetString("p:to", XmlNamespaces.Manager); }