Beispiel #1
0
 public TemporaryFile GetTemporaryFile(string name)
 {
     if (name == "." || name.Contains(".."))
     {
         throw new ArgumentException("Cannot refer to temp dir or parent.", "name");
     }
     if (name.Contains(@"\") || name.Contains("/"))
     {
         throw new ArgumentException("Cannot be more than one level deep.", "name");
     }
     return(TemporaryFileHelper.GetFile(TemporaryFileHelper.GetTemporaryName(path, name), keep));
 }
Beispiel #2
0
 /// <summary>
 /// Creates a new instance of <see cref="TemporaryFile"/> given the path,
 /// pattern, and whether to keep the file on disposal..
 /// </summary>
 /// <param name="path">The path the file is contained within.</param>
 /// <param name="pattern"></param>
 /// <param name="keep"></param>
 internal TemporaryFile(string path, string pattern, bool keep)
     : this(TemporaryFileHelper.GetTemporaryName(path, pattern), keep)
 {
 }