public PhotoAggregationInfo GetPhotoAggregationInfoFromFile() { XmlNode xmlNode = AggregationData.xmlDoc.DocumentElement.SelectNodes("/Aggregationinfo/Aggregationpage/Albumindex/Albumconfig")[0]; __photoAggregationInfo = new PhotoAggregationInfo(); if (xmlNode != null) { __photoAggregationInfo.Focusphotoshowtype = ((AggregationData.xmlDoc.GetSingleNodeValue(xmlNode, "Focusphotoshowtype") == null) ? 0 : Convert.ToInt32(AggregationData.xmlDoc.GetSingleNodeValue(xmlNode, "Focusphotoshowtype"))); __photoAggregationInfo.Focusphotodays = ((AggregationData.xmlDoc.GetSingleNodeValue(xmlNode, "Focusphotodays") == null) ? 0 : Convert.ToInt32(AggregationData.xmlDoc.GetSingleNodeValue(xmlNode, "Focusphotodays"))); __photoAggregationInfo.Focusphotocount = ((AggregationData.xmlDoc.GetSingleNodeValue(xmlNode, "Focusphotocount") == null) ? 0 : Convert.ToInt32(AggregationData.xmlDoc.GetSingleNodeValue(xmlNode, "Focusphotocount"))); __photoAggregationInfo.Focusalbumshowtype = ((AggregationData.xmlDoc.GetSingleNodeValue(xmlNode, "Focusalbumshowtype") == null) ? 0 : Convert.ToInt32(AggregationData.xmlDoc.GetSingleNodeValue(xmlNode, "Focusalbumshowtype"))); __photoAggregationInfo.Focusalbumdays = ((AggregationData.xmlDoc.GetSingleNodeValue(xmlNode, "Focusalbumdays") == null) ? 0 : Convert.ToInt32(AggregationData.xmlDoc.GetSingleNodeValue(xmlNode, "Focusalbumdays"))); __photoAggregationInfo.Focusalbumcount = ((AggregationData.xmlDoc.GetSingleNodeValue(xmlNode, "Focusalbumcount") == null) ? 0 : Convert.ToInt32(AggregationData.xmlDoc.GetSingleNodeValue(xmlNode, "Focusalbumcount"))); __photoAggregationInfo.Weekhot = ((AggregationData.xmlDoc.GetSingleNodeValue(xmlNode, "Weekhot") == null) ? 0 : Convert.ToInt32(AggregationData.xmlDoc.GetSingleNodeValue(xmlNode, "Weekhot"))); } return(__photoAggregationInfo); }
/// <summary> /// 保存图片聚合对象信息到聚合数据文件 /// </summary> /// <param name="__photoaggregationinfo"></param> public void SaveAggregationData(PhotoAggregationInfo photoAggregationInfo) { XmlNode photoaggregationsetting = xmlDoc.SelectSingleNode("/Aggregationinfo/Aggregationpage/Albumindex/Albumconfig"); if (photoaggregationsetting != null) photoaggregationsetting.RemoveAll(); else photoaggregationsetting = xmlDoc.CreateNode("/Aggregationinfo/Aggregationdata/Space"); xmlDoc.AppendChildElementByNameValue(ref photoaggregationsetting, "Focusphotoshowtype", photoAggregationInfo.Focusphotoshowtype); xmlDoc.AppendChildElementByNameValue(ref photoaggregationsetting, "Focusphotodays", photoAggregationInfo.Focusphotodays); xmlDoc.AppendChildElementByNameValue(ref photoaggregationsetting, "Focusphotocount", photoAggregationInfo.Focusphotocount); xmlDoc.AppendChildElementByNameValue(ref photoaggregationsetting, "Focusalbumshowtype", photoAggregationInfo.Focusalbumshowtype); xmlDoc.AppendChildElementByNameValue(ref photoaggregationsetting, "Focusalbumdays", photoAggregationInfo.Focusalbumdays); xmlDoc.AppendChildElementByNameValue(ref photoaggregationsetting, "Focusalbumcount", photoAggregationInfo.Focusalbumcount); xmlDoc.AppendChildElementByNameValue(ref photoaggregationsetting, "Weekhot", photoAggregationInfo.Weekhot); xmlDoc.Save(DataFilePath); }
/// <summary> /// 从文件中获得数据并初始化图片聚合对象 /// </summary> /// <returns></returns> public PhotoAggregationInfo GetPhotoAggregationInfoFromFile() { XmlNode xmlnode = xmlDoc.DocumentElement.SelectNodes("/Aggregationinfo/Aggregationpage/Albumindex/Albumconfig")[0]; __photoAggregationInfo = new PhotoAggregationInfo(); if (xmlnode != null) { __photoAggregationInfo.Focusphotoshowtype = (xmlDoc.GetSingleNodeValue(xmlnode, "Focusphotoshowtype") == null) ? 0 : Convert.ToInt32(xmlDoc.GetSingleNodeValue(xmlnode, "Focusphotoshowtype")); __photoAggregationInfo.Focusphotodays = (xmlDoc.GetSingleNodeValue(xmlnode, "Focusphotodays") == null) ? 0 : Convert.ToInt32(xmlDoc.GetSingleNodeValue(xmlnode, "Focusphotodays")); __photoAggregationInfo.Focusphotocount = (xmlDoc.GetSingleNodeValue(xmlnode, "Focusphotocount") == null) ? 0 : Convert.ToInt32(xmlDoc.GetSingleNodeValue(xmlnode, "Focusphotocount")); __photoAggregationInfo.Focusalbumshowtype = (xmlDoc.GetSingleNodeValue(xmlnode, "Focusalbumshowtype") == null) ? 0 : Convert.ToInt32(xmlDoc.GetSingleNodeValue(xmlnode, "Focusalbumshowtype")); __photoAggregationInfo.Focusalbumdays = (xmlDoc.GetSingleNodeValue(xmlnode, "Focusalbumdays") == null) ? 0 : Convert.ToInt32(xmlDoc.GetSingleNodeValue(xmlnode, "Focusalbumdays")); __photoAggregationInfo.Focusalbumcount = (xmlDoc.GetSingleNodeValue(xmlnode, "Focusalbumcount") == null) ? 0 : Convert.ToInt32(xmlDoc.GetSingleNodeValue(xmlnode, "Focusalbumcount")); __photoAggregationInfo.Weekhot = (xmlDoc.GetSingleNodeValue(xmlnode, "Weekhot") == null) ? 0 : Convert.ToInt32(xmlDoc.GetSingleNodeValue(xmlnode, "Weekhot")); } return __photoAggregationInfo; }
public void SaveAggregationData(PhotoAggregationInfo photoAggregationInfo) { XmlNode xmlNode = AggregationData.xmlDoc.SelectSingleNode("/Aggregationinfo/Aggregationpage/Albumindex/Albumconfig"); if (xmlNode != null) { xmlNode.RemoveAll(); } else { xmlNode = AggregationData.xmlDoc.CreateNode("/Aggregationinfo/Aggregationdata/Space"); } AggregationData.xmlDoc.AppendChildElementByNameValue(ref xmlNode, "Focusphotoshowtype", photoAggregationInfo.Focusphotoshowtype); AggregationData.xmlDoc.AppendChildElementByNameValue(ref xmlNode, "Focusphotodays", photoAggregationInfo.Focusphotodays); AggregationData.xmlDoc.AppendChildElementByNameValue(ref xmlNode, "Focusphotocount", photoAggregationInfo.Focusphotocount); AggregationData.xmlDoc.AppendChildElementByNameValue(ref xmlNode, "Focusalbumshowtype", photoAggregationInfo.Focusalbumshowtype); AggregationData.xmlDoc.AppendChildElementByNameValue(ref xmlNode, "Focusalbumdays", photoAggregationInfo.Focusalbumdays); AggregationData.xmlDoc.AppendChildElementByNameValue(ref xmlNode, "Focusalbumcount", photoAggregationInfo.Focusalbumcount); AggregationData.xmlDoc.AppendChildElementByNameValue(ref xmlNode, "Weekhot", photoAggregationInfo.Weekhot); AggregationData.xmlDoc.Save(AggregationData.DataFilePath); }
/// <summary> /// 清空数据绑定 /// </summary> public override void ClearDataBind() { __photoAggregationInfo = null; }