File() public method

Appends a filename onto the Directory
public File ( string name ) : File
name string The name (or filter) of the file
return File
        public FluentFileSample()
        {
            var file = new FluentFs.Core.File(@"c:\temp\test.txt");

            file.Copy.To(@"c:\temp\test2.txt");
            file.Move.To(@"c:\NewDirectory");
            file.Move.ContinueOnError.To(@"c:\DirectoryThatMayNotExist");
            file.Rename.To("test41.txt");
            file.Delete(OnError.Continue);

            var directory = new FluentFs.Core.Directory(@"c:\temp\sample");

            directory.Delete(OnError.Continue).Create(OnError.Fail);
            directory.Files();                                    //returns all files in the folder
            directory.Files("*.txt");                             //returns all files ending in .txt
            var childFolder = directory.SubFolder("childFolder"); //creates a new Directory object with a path of c:\temp\sample\childFolder

            directory.ToString();                                 //returns the path of the folder
            directory.File("test.txt");                           // returns back a FluentFilesystem.File object with a path of c:\temp\sample\test.txt

            var fileset = new FluentFs.Core.FileSet();

            fileset.Include(@"c:\Project\GUI\*.cs").RecurseAllSubDirectories
            .Exclude("assemblyInfo.cs")
            .Include(@"c:\Project\globalconfig.xml");

            ReadOnlyCollection <string> files = fileset.Files;

            fileset.Copy.To(@"c:\temp");
        }
Example #2
0
        public Default()
        {
            directory_base = new Directory(System.IO.Directory.GetCurrentDirectory());
            directory_compile = directory_base.SubFolder("compile");
            AssemblyFluentFsRelease = directory_compile.File("FluentFs.dll");

            AddTask(Clean);
            AddTask(CompileCoreWithoutTests);
        }
        public MultiTargetingSample()
        {
            _baseDirectory = new Directory(Properties.CurrentDirectory);
            _compileDirectory = _baseDirectory.SubFolder("compile");
            _outputAssembly = _compileDirectory.File("output.dll");

            AddTask(Clean);
            AddTask("Compile .NET 2.0", Compile_20);
            AddTask(Clean);
            AddTask("Compile .NET 3.0", Compile_30);
        }
Example #4
0
        public DefaultSample()
        {
            directory_base = new Directory(Properties.CurrentDirectory);
            directory_compile = directory_base.SubFolder("compile");
            directory_release = directory_base.SubFolder("release");
            directory_tools = directory_base.SubFolder("tools");

            assembly_FluentBuild = directory_compile.File("FluentBuild.dll");
            assembly_FluentBuild_Tests = directory_compile.File("FluentBuild.Tests.dll");
            thirdparty_nunit = directory_tools.File("nunit.framework.dll");
            thirdparty_rhino = directory_tools.File("rhino.mocks.dll");

            AddTask(Clean);
            AddTask(CompileSources);
            AddTask(CompileTests);
            AddTask(RunTests);
            AddTask(Package);

            //set the verbosity. Can also be set via command line
            Defaults.Logger.Verbosity = VerbosityLevel.TaskNamesOnly;
        }
Example #5
0
        public void DirectoryExamples()
        {
            var dir = new Directory(@"c:\temp");
            dir.Create(OnError.Continue);
            dir.Delete(OnError.Continue);

            var stuffDir = dir.SubFolder("stuff");
            var allFiles = dir.Files();
            var dllFiles = dir.Files("*.dll");

            var file = dir.File("web.config");
        }
Example #6
0
        public DebugBuild()
        {
            _baseDirectory = new Directory(Properties.CurrentDirectory);
            _compileDirectory = _baseDirectory.SubFolder("compile");
            _toolsDirectory = _baseDirectory.SubFolder("tools");

            _outputAssembly = _compileDirectory.File("output.dll");
            _creditCardProcessor = _toolsDirectory.File("CreditCardDevelopment.dll");

            AddTask(Clean);
            AddTask(Compile);
        }
Example #7
0
        public Default()
        {
            directory_base = new Directory(System.IO.Directory.GetCurrentDirectory());
            directory_compile = directory_base.SubFolder("compile");
            directory_release = directory_base.SubFolder("release");
            directory_tools = directory_base.SubFolder("tools");
            directory_src_core = directory_base.SubFolder("src").SubFolder("FluentBuild");
            directory_src_runner = directory_base.SubFolder("src").SubFolder("FluentBuild.BuildExe");
            directory_src_converter = directory_base.SubFolder("src").SubFolder("FluentBuild.BuildFileConverter");
            file_src_UI = directory_base.SubFolder("src").SubFolder("FluentBuild.BuildUI").File("FluentBuild.BuildUI.csproj");

            assembly_BuildFileConverter_WithTests = directory_compile.File("BuildFileConverter.exe");
            assembly_FluentBuild_UI = directory_compile.File("fb.ui.exe");
            assembly_FluentBuild_WithTests_Partial = directory_compile.File("FluentBuildWithTests_partial.dll");
            assembly_FluentBuild_WithTests_Merged = directory_compile.File("FluentBuild.dll");
            assembly_Functional_Tests = directory_compile.File("FluentBuild_Functional_Tests.dll");

            assembly_FluentBuild_Runner = directory_compile.File("fb.exe");

            thirdparty_nunit = directory_tools.SubFolder("nunit").File("nunit.framework.dll");
            thirdparty_rhino = directory_tools.SubFolder("rhino").File("rhino.mocks.dll");
            thirdparty_sharpzip = directory_base.SubFolder("lib").SubFolder("SharpZipLib-net2.0").File("ICSharpCode.SharpZipLib.dll");
            thirdparty_fluentFs = directory_base.SubFolder("lib").SubFolder("FluentFs").File("FluentFs.dll");

            _version = "0.0.0.0";

            Defaults.FrameworkVersion = FrameworkVersion.NET4_0.Full;

            AddTask(Clean);
            AddTask(GenerateAssemblyInfoFiles);
            AddTask(CopyDependantAssembliesToCompileDir);
            AddTask(CompileCoreSources);
            AddTask(CompileRunnerSources);
            AddTask(RunTests);
            AddTask(CompileFunctionalTests);
            //AddTask(RunFunctionalTests);
            AddTask(CompileBuildFileConverter);
            AddTask(TestBuildFileConverter);
            AddTask(CompileBuildUi);
        }
Example #8
0
        public FluentFileSample()
        {
            var file = new FluentFs.Core.File(@"c:\temp\test.txt");
            file.Copy.To(@"c:\temp\test2.txt");
            file.Move.To(@"c:\NewDirectory");
            file.Move.ContinueOnError.To(@"c:\DirectoryThatMayNotExist");
            file.Rename.To("test41.txt");
            file.Delete(OnError.Continue);

            var directory = new FluentFs.Core.Directory(@"c:\temp\sample");
            directory.Delete(OnError.Continue).Create(OnError.Fail);
            directory.Files(); //returns all files in the folder
            directory.Files("*.txt"); //returns all files ending in .txt
            var childFolder = directory.SubFolder("childFolder"); //creates a new Directory object with a path of c:\temp\sample\childFolder
            directory.ToString(); //returns the path of the folder
            directory.File("test.txt"); // returns back a FluentFilesystem.File object with a path of c:\temp\sample\test.txt

            var fileset = new FluentFs.Core.FileSet();
            fileset.Include(@"c:\Project\GUI\*.cs").RecurseAllSubDirectories
              .Exclude("assemblyInfo.cs")
              .Include(@"c:\Project\globalconfig.xml");

            ReadOnlyCollection<string> files = fileset.Files;

            fileset.Copy.To(@"c:\temp");
        }