WatchThis.Models.SlideshowModel.Save C# (CSharp) Метод

Save() публичный Метод

public Save ( string filename ) : void
filename string
Результат void
		public void Save(string filename)
		{
            Directory.CreateDirectory(Path.GetDirectoryName(filename));

			var xml = new XDocument(
				new XElement(XmlRootName,
					new XAttribute(XmlAttrName, Name),
					new XAttribute(XmlAttrSlideDuration, SlideSeconds),
                    new XAttribute(XmlAttrTransitionDuration, TransitionSeconds)));

            if (FindAPhotoHost != null)
            {
                logger.Info("Handle saving host: {0}", FindAPhotoHost);
//                xml.Root.FirstNode.
//                    new XAttribute(XmlAttrFindAPhotoHost, FindAPhotoHost)));
            }

			foreach (var fm in FolderList)
			{
				xml.Root.Add(
					new XElement("folder", 
						new XAttribute("path", fm.Path)));
			}

            if (Search != null)
            {
                xml.Root.Add(
                    new XElement("search",
                        new XAttribute("query", Search)));
            }

			filename = EnsureExtension(filename);
			File.WriteAllText(filename, xml.ToString());
			this.Filename = filename;
		}