/// <summary> /// Checks to see if file exists. file.FileName /// must include path. /// </summary> /// <param name="file">DashboardFile with valid filename</param> /// <returns>Boolean true if file exists.</returns> internal bool Exists(Wp7AzureMgmt.DashboardFeeds.DashboardFile file) { if (file == null) { throw new ArgumentNullException("file"); } return File.Exists(file.FileName); }
/// <summary> /// Create new file with write access then save content. /// </summary> /// <param name="file">DashboardFile with filename and contents</param> public void Save(Wp7AzureMgmt.DashboardFeeds.DashboardFile file) { if (file == null) { throw new ArgumentNullException("file"); } if (string.IsNullOrEmpty(file.FileName)) { throw new ArgumentNullException("filename is empty or null"); } using (FileStream stream = new FileStream(file.FileName, FileMode.CreateNew, FileAccess.Write)) { using (StreamWriter outfile = new StreamWriter(stream)) { outfile.Write(file.FileContents); } } }