private static C1StreamWriter GetOrCreateFile(string path) { if (!C1File.Exists(path)) { lock (SyncRoot) { if (!C1File.Exists(path)) { return(C1File.CreateText(path)); } } } return(C1File.AppendText(path)); }
/// <exclude/> public override IEnumerable <XElement> Install() { Verify.IsNotNull(_contentToAdd, "FileModifyPackageFragmentInstaller has not been validated"); foreach (ContentToAdd content in _contentToAdd) { if (C1File.Exists(content.Path)) { using (C1StreamWriter sw = C1File.AppendText(content.Path)) { sw.Write(content.Content); sw.Close(); } } else { C1File.WriteAllText(content.Path, content.Content); } } return(new[] { this.Configuration.FirstOrDefault() }); }