public void Setup() { _location = Assembly.GetExecutingAssembly().Location; _directory = Path.GetDirectoryName(_location); _directory = _directory.Substring(_directory.LastIndexOf('\\') + 1); _fileName = FileName.GetFileName(_location); }
public void CopyTo(FileName path) { //refactor? if (System.IO.File.Exists(path.GetPath())) System.IO.File.Delete(path.GetPath()); WithStream(s=> { using(var stream = System.IO.File.OpenWrite(path.GetPath())) { //.net 4.0 has a stream.CopyTo method var buff = new byte[32768]; while (true) { int read = s.Read(buff, 0, buff.Length); if (read <= 0) return; stream.Write(buff, 0, read); } } }); }
public void When_you_get_a_file_that_DOESNT_exist() { _fileName = FileName.GetFileName(".\\doesntexist.txt"); }
public void When_you_get_a_file_that_exists() { _fileName = FileName.GetFileName(Assembly.GetExecutingAssembly().Location); _fileInQuestion = Locator.GetFile(_fileName); }
public File GetFile(FileName name) { File file = ResolveFile(name.Name); return file; }
public DotNetFile(FileName name) { Name = name; }