private static AnimationChainListSave DeserializeManually(string fileName) { AnimationChainListSave toReturn = new AnimationChainListSave(); System.Xml.Linq.XDocument xDocument = null; using (var stream = FileManager.GetStreamForFile(fileName)) { xDocument = System.Xml.Linq.XDocument.Load(stream); } System.Xml.Linq.XElement foundElement = null; foreach (var element in xDocument.Elements()) { if (element.Name.LocalName == "AnimationChainArraySave") { foundElement = element; break; } } LoadFromElement(toReturn, foundElement); return(toReturn); }
public IEnumerable <Tehe> FindAll() { return(xmlDatas.Elements().Elements().Select(tehe => { Tehe t = new Tehe(); t.Dwa = tehe.Elements().ElementAt(1).Value; t.Raz = tehe.Elements().ElementAt(0).Value; return t; })); }
/// <summary> /// Gets the label. /// </summary> /// <param name="fieldName">Name of the field.</param> /// <param name="parentTypeId">The parent type identifier.</param> /// <returns></returns> public static string GetChoiceLabel(this ItemViewModel item, string fieldName, Type typeFullName) { var fieldValue = item.Fields.GetMemberValue(fieldName).ToString(); var man = new Telerik.Sitefinity.DynamicModules.Builder.ModuleBuilderManager(); var moduleType = man.Provider.GetDynamicModuleTypes().SingleOrDefault(t => (t.TypeNamespace + "." + t.TypeName) == typeFullName.FullName); string label = fieldValue; if (moduleType != null && moduleType.Fields != null) { var field = moduleType.Fields.Where(f => f.Name == fieldName).FirstOrDefault(); if (field != null) { System.Xml.Linq.XDocument doc = System.Xml.Linq.XDocument.Parse(field.Choices); var element = doc.Elements("element").Where(e => e.Attribute("value").Value == fieldValue).FirstOrDefault(); label = (element != null) ? element.Attribute("text").Value : fieldValue; } } return(label); }