Exemplo n.º 1
0
 public IEnumerator <TemporaryDirectory> GetEnumerator()
 {
     string[] files = Directory.GetDirectories(this.path);
     foreach (string file in files)
     {
         yield return(TemporaryFileHelper.GetDirectory(System.IO.Path.GetFullPath(file)));
     }
 }
Exemplo n.º 2
0
            void ICollection <TemporaryDirectory> .CopyTo(TemporaryDirectory[] array, int arrayIndex)
            {
                string[] files       = Directory.GetDirectories(this.path);
                int      arrayOffset = arrayIndex;

                foreach (string file in files)
                {
                    array[arrayOffset++] = TemporaryFileHelper.GetDirectory(System.IO.Path.GetFullPath(file));
                }
            }
Exemplo n.º 3
0
 public TemporaryDirectory GetTemporaryDirectory(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.GetDirectory(this.path + name));
 }
Exemplo n.º 4
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));
 }
Exemplo n.º 5
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)
 {
 }
Exemplo n.º 6
0
 internal static TemporaryFile GetFile(string file)
 {
     return(TemporaryFileHelper.GetFile(file, true));
 }