From 500a28f0061f6fe31470b1ef0506f6316d7bb127 Mon Sep 17 00:00:00 2001 From: Robin Hanssen Date: Fri, 1 May 2020 12:00:56 +0200 Subject: [PATCH] Make it work --- .gitignore | 2 ++ RiffChallengeDraft/Cli/DraftFacilitator.cs | 20 ++++++++++++++++---- RiffChallengeDraft/RiffChallengeDraft.csproj | 11 +++++++---- 3 files changed, 25 insertions(+), 8 deletions(-) diff --git a/.gitignore b/.gitignore index f8720a9..3d70571 100644 --- a/.gitignore +++ b/.gitignore @@ -210,3 +210,5 @@ FakesAssemblies/ GeneratedArtifacts/ _Pvt_Extensions/ ModelManifest.xml + +.idea/ diff --git a/RiffChallengeDraft/Cli/DraftFacilitator.cs b/RiffChallengeDraft/Cli/DraftFacilitator.cs index a64952b..22b0f60 100644 --- a/RiffChallengeDraft/Cli/DraftFacilitator.cs +++ b/RiffChallengeDraft/Cli/DraftFacilitator.cs @@ -14,6 +14,7 @@ public class DraftFacilitator { private string _logFilePath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); private string _fileName; + private string _absolutePath; private Genre? _weeklyWildcardGenre = null; private DateTime _initiatedDateTime; @@ -30,7 +31,10 @@ public DraftFacilitator() WeeklyTheme = new WeeklyTheme(true); _initiatedDateTime = DateTime.Now; _fileName = "RCD-" + _initiatedDateTime.ToString("yyyy-MM-dd-hh-mm") + ".log"; // draft-2016-08-27-06-17.log - } + _absolutePath = _logFilePath + "\\" + _fileName; + } + + public void StartDraft() { @@ -48,7 +52,7 @@ public void StartDraft() UIHelper.AwaitUserInput(); - UIHelper.WriteLine(String.Format("{0}: {1}", Texts.LOG_CAN_BE_FOUND_HERE, (_logFilePath + "\\" + _fileName))); + UIHelper.WriteLine(String.Format("{0}: {1}", Texts.LOG_CAN_BE_FOUND_HERE, (_absolutePath))); UIHelper.WriteLine(Texts.ENDING_TEXT); UIHelper.AwaitUserInput(); } @@ -254,8 +258,16 @@ public void DrawContestant() /// private void LogResults(string logString) { - - File.AppendAllText(_logFilePath+"\\"+_fileName, logString + Environment.NewLine); + //File.AppendAllText(_absolutePath, logString + Environment.NewLine); + using (FileStream fs = new FileStream(_absolutePath,FileMode.Append, FileAccess.Write)) + { + StreamWriter sw = new StreamWriter(fs); + long endPoint=fs.Length; + // Set the stream position to the end of the file. + fs.Seek(endPoint, SeekOrigin.Begin); + sw.WriteLine(logString); + sw.Flush(); + } } private void LogResultsHeadline(string logString) diff --git a/RiffChallengeDraft/RiffChallengeDraft.csproj b/RiffChallengeDraft/RiffChallengeDraft.csproj index 9ad3570..56e1fb7 100644 --- a/RiffChallengeDraft/RiffChallengeDraft.csproj +++ b/RiffChallengeDraft/RiffChallengeDraft.csproj @@ -22,8 +22,11 @@ Days false false - true - 2 + false + RIff Challenge Draft + Robin Hanssen + true + 5 1.0.0.%2a false true @@ -55,7 +58,7 @@ true - true + false @@ -114,4 +117,4 @@ --> - + \ No newline at end of file