コード例 #1
0
        private ActionOutcome ReplaceMultipartFile()
        {
            ShowConfiguration si = Episode?.Show ?? SelectedShow;

            //We will replace the file as too difficult to update multiparts
            //We can't use XDocument as it's not fully valid XML
            List <XElement> episodeXmLs = new List <XElement>();

            if (Episode != null)
            {
                foreach (Episode ep in Episode.SourceEpisodes)
                {
                    XElement epNode = new XElement("episodedetails");
                    UpdateEpisodeFields(ep, si, epNode, true);
                    episodeXmLs.Add(epNode);
                }
            }

            try
            {
                using (StreamWriter writer = File.CreateText(Where.FullName))
                {
                    foreach (XElement ep in episodeXmLs)
                    {
                        writer.WriteLine(ep);
                    }
                }
            }
            catch (IOException e)
            {
                return(new ActionOutcome(e));
            }

            return(ActionOutcome.Success());
        }
コード例 #2
0
 public override StreamWriter CreateText(string path)
 {
     return(AfsFile.CreateText(path));
 }