From 919a79b8b2334fbd16041f6f5ca9725de164bf81 Mon Sep 17 00:00:00 2001 From: lukeIam <2lukeiam@gmail.com> Date: Fri, 19 Jan 2018 21:17:25 +0100 Subject: [PATCH] Add license to the files + rename some classes --- Vocaluxe/Reporting/Reporter.cs | 19 +++++++++- VocaluxeLib/Log/CBenchmark.cs | 19 +++++++++- VocaluxeLib/Log/CLog.cs | 36 +++++++++++++------ VocaluxeLib/Log/CLogFunctions.cs | 19 +++++++++- VocaluxeLib/Log/CLogFunctions.tt | 35 +++++++++++++++++- .../Enricher/CTimeStampFromStartEnricher.cs | 21 +++++++++-- .../{LogRoller.cs => CLogFileRoller.cs} | 21 +++++++++-- .../{SilentLogger.cs => CSilentLogger.cs} | 2 +- VocaluxeLib/Log/ShowReporterDelegate.cs | 18 +++++++++- VocaluxeLib/VocaluxeLib.csproj | 4 +-- 10 files changed, 172 insertions(+), 22 deletions(-) rename VocaluxeLib/Log/Rolling/{LogRoller.cs => CLogFileRoller.cs} (79%) rename VocaluxeLib/Log/Serilog/{SilentLogger.cs => CSilentLogger.cs} (99%) diff --git a/Vocaluxe/Reporting/Reporter.cs b/Vocaluxe/Reporting/Reporter.cs index e5e74105..2974836e 100644 --- a/Vocaluxe/Reporting/Reporter.cs +++ b/Vocaluxe/Reporting/Reporter.cs @@ -1,4 +1,21 @@ -using System; +#region license +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +#endregion + +using System; using System.Collections.Generic; using System.Net.Http; using System.Text; diff --git a/VocaluxeLib/Log/CBenchmark.cs b/VocaluxeLib/Log/CBenchmark.cs index 60e5818b..19ddf6c9 100644 --- a/VocaluxeLib/Log/CBenchmark.cs +++ b/VocaluxeLib/Log/CBenchmark.cs @@ -1,4 +1,21 @@ -using System; +#region license +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +#endregion + +using System; using System.Diagnostics; using VocaluxeLib.Utils; diff --git a/VocaluxeLib/Log/CLog.cs b/VocaluxeLib/Log/CLog.cs index 3d2ffa9b..da311ec7 100644 --- a/VocaluxeLib/Log/CLog.cs +++ b/VocaluxeLib/Log/CLog.cs @@ -1,6 +1,22 @@ -using System; +#region license +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +#endregion + +using System; using System.IO; -using System.Linq; using System.Text; using System.Text.RegularExpressions; using Serilog; @@ -15,8 +31,8 @@ namespace VocaluxeLib.Log private static readonly StringBuilder _MainLogStringBuilder = new StringBuilder(); private static readonly StringWriter _MainLogStringWriter = new StringWriter(_MainLogStringBuilder); - private static ILogger _MainLog = new SilentLogger(); - private static ILogger _SongLog = new SilentLogger(); + private static ILogger _MainLog = new CSilentLogger(); + private static ILogger _SongLog = new CSilentLogger(); private static string _LogFolder; private static string _CrashMarkerFilePath; private static ShowReporterDelegate _ShowReporterFunc; @@ -63,8 +79,8 @@ namespace VocaluxeLib.Log // Write new marker File.WriteAllText(_CrashMarkerFilePath, _CurrentVersion, Encoding.UTF8); - LogFileRoller.RollLogs(mainLogFilePath, 2); - LogFileRoller.RollLogs(songLogFilePath, 2); + CLogFileRoller.RollLogs(mainLogFilePath, 2); + CLogFileRoller.RollLogs(songLogFilePath, 2); _MainLog = new LoggerConfiguration() .Enrich.WithThreadId() @@ -88,19 +104,19 @@ namespace VocaluxeLib.Log public static void Close() { - if (!(_MainLog is SilentLogger)) + if (!(_MainLog is CSilentLogger)) { ILogger loggerToDispose = _MainLog; - _MainLog = new SilentLogger(); + _MainLog = new CSilentLogger(); (_MainLog as IDisposable)?.Dispose(); } - if (!(_SongLog is SilentLogger)) + if (!(_SongLog is CSilentLogger)) { ILogger loggerToDispose = _MainLog; - _SongLog = new SilentLogger(); + _SongLog = new CSilentLogger(); (_SongLog as IDisposable)?.Dispose(); } diff --git a/VocaluxeLib/Log/CLogFunctions.cs b/VocaluxeLib/Log/CLogFunctions.cs index c52ca532..1e234ed5 100644 --- a/VocaluxeLib/Log/CLogFunctions.cs +++ b/VocaluxeLib/Log/CLogFunctions.cs @@ -1,4 +1,21 @@ -using System; +#region license +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +#endregion + +using System; using System.Diagnostics.CodeAnalysis; using System.Runtime.CompilerServices; using Serilog.Context; diff --git a/VocaluxeLib/Log/CLogFunctions.tt b/VocaluxeLib/Log/CLogFunctions.tt index ec93f52c..e0bd38f8 100644 --- a/VocaluxeLib/Log/CLogFunctions.tt +++ b/VocaluxeLib/Log/CLogFunctions.tt @@ -1,9 +1,42 @@ -<#@ template debug="false" hostspecific="false" language="C#" #> +<# +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +#> +<#@ template debug="false" hostspecific="false" language="C#" #> <#@ assembly name="System.Core" #> <#@ import namespace="System.Linq" #> <#@ import namespace="System.Text" #> <#@ import namespace="System.Collections.Generic" #> <#@ output extension=".cs" #> +#region license +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +#endregion + using System; using System.Diagnostics.CodeAnalysis; using System.Runtime.CompilerServices; diff --git a/VocaluxeLib/Log/Enricher/CTimeStampFromStartEnricher.cs b/VocaluxeLib/Log/Enricher/CTimeStampFromStartEnricher.cs index 4b924dba..825285cc 100644 --- a/VocaluxeLib/Log/Enricher/CTimeStampFromStartEnricher.cs +++ b/VocaluxeLib/Log/Enricher/CTimeStampFromStartEnricher.cs @@ -1,4 +1,21 @@ -using System; +#region license +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +#endregion + +using System; using Serilog; using Serilog.Configuration; using Serilog.Core; @@ -6,7 +23,7 @@ using Serilog.Events; namespace VocaluxeLib.Log.Enricher { - public static class WithTimeStampFromStartExtension + public static class CWithTimeStampFromStartExtension { // ReSharper disable once InconsistentNaming public static LoggerConfiguration WithTimeStampFromStart(this LoggerEnrichmentConfiguration enrich) diff --git a/VocaluxeLib/Log/Rolling/LogRoller.cs b/VocaluxeLib/Log/Rolling/CLogFileRoller.cs similarity index 79% rename from VocaluxeLib/Log/Rolling/LogRoller.cs rename to VocaluxeLib/Log/Rolling/CLogFileRoller.cs index adb69ab5..82eb2340 100644 --- a/VocaluxeLib/Log/Rolling/LogRoller.cs +++ b/VocaluxeLib/Log/Rolling/CLogFileRoller.cs @@ -1,11 +1,28 @@ -using System; +#region license +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +#endregion + +using System; using System.Collections.Generic; using System.IO; using System.Text.RegularExpressions; namespace VocaluxeLib.Log.Rolling { - static class LogFileRoller + static class CLogFileRoller { public static void RollLogs(string mainLogFile, int numLogsToKeep) { diff --git a/VocaluxeLib/Log/Serilog/SilentLogger.cs b/VocaluxeLib/Log/Serilog/CSilentLogger.cs similarity index 99% rename from VocaluxeLib/Log/Serilog/SilentLogger.cs rename to VocaluxeLib/Log/Serilog/CSilentLogger.cs index 475a530f..d7c1a244 100644 --- a/VocaluxeLib/Log/Serilog/SilentLogger.cs +++ b/VocaluxeLib/Log/Serilog/CSilentLogger.cs @@ -22,7 +22,7 @@ using Serilog.Events; namespace VocaluxeLib.Log.Serilog { - class SilentLogger : ILogger + class CSilentLogger : ILogger { public ILogger ForContext(ILogEventEnricher enricher) { diff --git a/VocaluxeLib/Log/ShowReporterDelegate.cs b/VocaluxeLib/Log/ShowReporterDelegate.cs index c2750515..8edf6025 100644 --- a/VocaluxeLib/Log/ShowReporterDelegate.cs +++ b/VocaluxeLib/Log/ShowReporterDelegate.cs @@ -1,4 +1,20 @@ - +#region license +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +#endregion + namespace VocaluxeLib.Log { /// diff --git a/VocaluxeLib/VocaluxeLib.csproj b/VocaluxeLib/VocaluxeLib.csproj index 00d4b977..5172700f 100644 --- a/VocaluxeLib/VocaluxeLib.csproj +++ b/VocaluxeLib/VocaluxeLib.csproj @@ -119,8 +119,8 @@ - - + + True True