From 3fa5f1a5101b2621cdea7ad7aa09b7ef172a7df1 Mon Sep 17 00:00:00 2001 From: Byron Warwick Date: Mon, 5 Jul 2021 00:54:36 +0100 Subject: [PATCH 01/14] Initial Commit after Import from Git --- .vscode/launch.json | 26 ++++++++++++++++++++++++++ .vscode/tasks.json | 42 ++++++++++++++++++++++++++++++++++++++++++ Program.cs | 12 ++++++++++++ files-module.csproj | 9 +++++++++ 4 files changed, 89 insertions(+) create mode 100644 .vscode/launch.json create mode 100644 .vscode/tasks.json create mode 100644 Program.cs create mode 100644 files-module.csproj diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..1c8faeb --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,26 @@ +{ + "version": "0.2.0", + "configurations": [ + { + // Use IntelliSense to find out which attributes exist for C# debugging + // Use hover for the description of the existing attributes + // For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md + "name": ".NET Core Launch (console)", + "type": "coreclr", + "request": "launch", + "preLaunchTask": "build", + // If you have changed target frameworks, make sure to update the program path. + "program": "${workspaceFolder}/bin/Debug/net5.0/files-module.dll", + "args": [], + "cwd": "${workspaceFolder}", + // For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console + "console": "internalConsole", + "stopAtEntry": false + }, + { + "name": ".NET Core Attach", + "type": "coreclr", + "request": "attach" + } + ] +} \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 0000000..4f923f1 --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,42 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "label": "build", + "command": "dotnet", + "type": "process", + "args": [ + "build", + "${workspaceFolder}/files-module.csproj", + "/property:GenerateFullPaths=true", + "/consoleloggerparameters:NoSummary" + ], + "problemMatcher": "$msCompile" + }, + { + "label": "publish", + "command": "dotnet", + "type": "process", + "args": [ + "publish", + "${workspaceFolder}/files-module.csproj", + "/property:GenerateFullPaths=true", + "/consoleloggerparameters:NoSummary" + ], + "problemMatcher": "$msCompile" + }, + { + "label": "watch", + "command": "dotnet", + "type": "process", + "args": [ + "watch", + "run", + "${workspaceFolder}/files-module.csproj", + "/property:GenerateFullPaths=true", + "/consoleloggerparameters:NoSummary" + ], + "problemMatcher": "$msCompile" + } + ] +} \ No newline at end of file diff --git a/Program.cs b/Program.cs new file mode 100644 index 0000000..2fa0d10 --- /dev/null +++ b/Program.cs @@ -0,0 +1,12 @@ +using System; + +namespace files_module +{ + class Program + { + static void Main(string[] args) + { + Console.WriteLine("Hello World!"); + } + } +} diff --git a/files-module.csproj b/files-module.csproj new file mode 100644 index 0000000..f120ba8 --- /dev/null +++ b/files-module.csproj @@ -0,0 +1,9 @@ + + + + Exe + net5.0 + files_module + + + From fe88d9e759239da8dc6996ccbed28457d162e9d8 Mon Sep 17 00:00:00 2001 From: Byron Warwick Date: Mon, 5 Jul 2021 00:57:25 +0100 Subject: [PATCH 02/14] Push 2 to test github From 5167d221fcd6cb2100b4a6ba5d73e70072152038 Mon Sep 17 00:00:00 2001 From: Byron Warwick Date: Mon, 5 Jul 2021 01:00:18 +0100 Subject: [PATCH 03/14] test 3 From eff3b7b8dfd568ffc9581fca938a212aa16d5190 Mon Sep 17 00:00:00 2001 From: Byron Warwick Date: Mon, 5 Jul 2021 01:02:03 +0100 Subject: [PATCH 04/14] test 4 From 3a4809b26547aaf2d9d1cccba87e2fa0d97b3e61 Mon Sep 17 00:00:00 2001 From: Byron Warwick Date: Mon, 5 Jul 2021 01:05:12 +0100 Subject: [PATCH 05/14] Test commit 5 fff From 01560c57f0b22240d17a143a4b70b02292e836f4 Mon Sep 17 00:00:00 2001 From: Byron Warwick Date: Mon, 5 Jul 2021 01:44:52 +0100 Subject: [PATCH 06/14] Exercise - Work with the file system - Complete --- Program.cs | 39 ++++++++++++++++++++++++++++++++++++--- 1 file changed, 36 insertions(+), 3 deletions(-) diff --git a/Program.cs b/Program.cs index 2fa0d10..93587e8 100644 --- a/Program.cs +++ b/Program.cs @@ -1,4 +1,6 @@ using System; +using System.IO; +using System.Collections.Generic; namespace files_module { @@ -6,7 +8,38 @@ class Program { static void Main(string[] args) { - Console.WriteLine("Hello World!"); + // Pass in the name of the folder "stores" to the FindFiles method + var salesFiles = FindFiles("stores"); + + // For each file that matched the search criteria in the FindFiles method + // it was added to "salesFile" - and we now print each filename and its location + foreach (var file in salesFiles) + { + Console.WriteLine(file); + } } - } -} + + // Create a new function called FindFiles that takes a folderName parameter. + static IEnumerable FindFiles(string folderName) + { + // Create a new list of type strings named "salesFiles" + List salesFiles = new List(); + + // Searches the directory location specified and returns the full file names + // and the relevant file paths + var foundFiles = Directory.EnumerateFiles(folderName, "*", SearchOption.AllDirectories); + + // Search and check each file in "foundFiles" against parameter + foreach (var file in foundFiles) + { + // The file name will contain the full path so only check the end of it and if a match + // add this file to "salesFile" + if (file.EndsWith("sales.json")) + { + salesFiles.Add(file); + } + } + return salesFiles; // Return the contents to "salesfile" to memory + }//findFiles + }//Program +}//files_module From b3bc8beaeef1ac5a4ee3eb31955faa349d72ca85 Mon Sep 17 00:00:00 2001 From: Byron Warwick Date: Mon, 5 Jul 2021 01:47:50 +0100 Subject: [PATCH 07/14] Exercise - Work with the file system - Complete From 2de71d86069178915677ef3ec4e1d3b75aab47d3 Mon Sep 17 00:00:00 2001 From: Byron Warwick Date: Mon, 5 Jul 2021 01:51:33 +0100 Subject: [PATCH 08/14] Exercise - Work with the file system From ff7af5b688f9b8a30460cdb4980f8fa4b92a18ca Mon Sep 17 00:00:00 2001 From: Byron Warwick Date: Mon, 5 Jul 2021 01:52:37 +0100 Subject: [PATCH 09/14] Exercise - Work with the file system - Final --- Program.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Program.cs b/Program.cs index 93587e8..3e83d82 100644 --- a/Program.cs +++ b/Program.cs @@ -39,7 +39,7 @@ static IEnumerable FindFiles(string folderName) salesFiles.Add(file); } } - return salesFiles; // Return the contents to "salesfile" to memory + return salesFiles; // Return the contents of "salesfile" to memory }//findFiles }//Program }//files_module From ad51ea319ac781d9bba02f90fef8f1884887c2bd Mon Sep 17 00:00:00 2001 From: Byron Warwick Date: Mon, 5 Jul 2021 01:59:00 +0100 Subject: [PATCH 10/14] Test From 7afebd37c8f9ecd2e509aa89b8d367b79bc25cf6 Mon Sep 17 00:00:00 2001 From: Byron Warwick Date: Mon, 5 Jul 2021 01:59:44 +0100 Subject: [PATCH 11/14] test From 3c74fbf6b3b540936bbc7dd0127789ce1fc4bc38 Mon Sep 17 00:00:00 2001 From: Byron Warwick Date: Mon, 5 Jul 2021 02:00:48 +0100 Subject: [PATCH 12/14] test From e44fc0ec1ebb89b4931ce514582b47c1e9cb7cdb Mon Sep 17 00:00:00 2001 From: Byron Warwick Date: Mon, 5 Jul 2021 02:16:05 +0100 Subject: [PATCH 13/14] test 10 From 0627887e219ef422ed3225e22cdbf01cdf1e54d4 Mon Sep 17 00:00:00 2001 From: Byron Warwick Date: Mon, 5 Jul 2021 02:17:28 +0100 Subject: [PATCH 14/14] Test 11