Skip to content

Commit

Permalink
Swap log writer
Browse files Browse the repository at this point in the history
  • Loading branch information
robinbaxon committed May 1, 2020
1 parent de7b8d0 commit b046a75
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 11 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -210,3 +210,5 @@ FakesAssemblies/
GeneratedArtifacts/
_Pvt_Extensions/
ModelManifest.xml

.idea/
20 changes: 16 additions & 4 deletions RiffChallengeDraft/Cli/DraftFacilitator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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()
{
Expand All @@ -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();
}
Expand Down Expand Up @@ -254,8 +258,16 @@ public void DrawContestant()
/// </summary>
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)
Expand Down
6 changes: 3 additions & 3 deletions RiffChallengeDraft/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("riff-challenge-draft")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyCopyright("Copyright © 2020")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

Expand All @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyVersion("1.0.5.0")]
[assembly: AssemblyFileVersion("1.0.5.0")]
11 changes: 7 additions & 4 deletions RiffChallengeDraft/RiffChallengeDraft.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,11 @@
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>2</ApplicationRevision>
<MapFileExtensions>false</MapFileExtensions>
<ProductName>RIff Challenge Draft</ProductName>
<PublisherName>Robin Hanssen</PublisherName>
<AutorunEnabled>true</AutorunEnabled>
<ApplicationRevision>8</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<UseApplicationTrust>false</UseApplicationTrust>
<PublishWizardCompleted>true</PublishWizardCompleted>
Expand Down Expand Up @@ -55,7 +58,7 @@
<GenerateManifests>true</GenerateManifests>
</PropertyGroup>
<PropertyGroup>
<SignManifests>true</SignManifests>
<SignManifests>false</SignManifests>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
Expand Down Expand Up @@ -114,4 +117,4 @@
<Target Name="AfterBuild">
</Target>
-->
</Project>
</Project>

0 comments on commit b046a75

Please sign in to comment.