Skip to content
This repository has been archived by the owner on Jan 28, 2022. It is now read-only.

Commit

Permalink
CHANGE WriteToLog writes initial lines containing the ASsembly Versio…
Browse files Browse the repository at this point in the history
…n of the Logging Module; ReleaseBuild Script has been changed to update Assembly.cs of Logging Project
  • Loading branch information
digitalsigi committed Apr 11, 2018
1 parent c64c8e9 commit 85432ff
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 39 deletions.
21 changes: 11 additions & 10 deletions eRechnungWordPlugIn.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25420.1
# Visual Studio 15
VisualStudioVersion = 15.0.27428.2015
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ebIViewModels", "eRechnungWordPlugIn\ebIViewModels\ebIViewModels.csproj", "{DA41F877-C6C7-48E8-A5B3-7F126C657AF0}"
EndProject
Expand All @@ -13,9 +13,9 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SimpleEventBroker", "eRechn
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WinFormsMvvm", "eRechnungWordPlugIn\WinFormsMvvm\WinFormsMvvm.csproj", "{2C9CCB95-9E62-419F-BED1-27623EAE81E3}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "UnitTests", "eRechnungWordPlugIn\UnitTests", "{F3A7F157-7A2A-4849-8904-1B68884317CC}"
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "UnitTests", "UnitTests", "{F3A7F157-7A2A-4849-8904-1B68884317CC}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "FrameWork", "eRechnungWordPlugIn\FrameWork", "{B22F178E-9B52-45F8-A41E-A3D95A9005F9}"
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "FrameWork", "FrameWork", "{B22F178E-9B52-45F8-A41E-A3D95A9005F9}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ebIModelsUnitTests", "eRechnungWordPlugIn\UnitTests\ebIModelsUnitTests\ebIModelsUnitTests.csproj", "{80C2EC76-7E37-4FC4-9222-7E5F7E23D2AA}"
EndProject
Expand Down Expand Up @@ -51,15 +51,15 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "eRechnung", "eRechnungWordP
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ebIModelsTests", "eRechnungWordPlugIn\ebIModelsTests\ebIModelsTests.csproj", "{29BFC195-34E9-4CA3-ACA3-FD5F90773323}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Scripts", "eRechnungWordPlugIn\Scripts", "{D602502B-6A6C-4823-A399-E82411132766}"
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Scripts", "Scripts", "{D602502B-6A6C-4823-A399-E82411132766}"
ProjectSection(SolutionItems) = preProject
Scripts\PlugInCfg.txt = Scripts\PlugInCfg.txt
Scripts\ReleaseBuild.ps1 = Scripts\ReleaseBuild.ps1
Scripts\setVersion.ps1 = Scripts\setVersion.ps1
Scripts\Version.xml = Scripts\Version.xml
eRechnungWordPlugIn\Scripts\PlugInCfg.txt = eRechnungWordPlugIn\Scripts\PlugInCfg.txt
eRechnungWordPlugIn\Scripts\ReleaseBuild.ps1 = eRechnungWordPlugIn\Scripts\ReleaseBuild.ps1
eRechnungWordPlugIn\Scripts\setVersion.ps1 = eRechnungWordPlugIn\Scripts\setVersion.ps1
eRechnungWordPlugIn\Scripts\Version.xml = eRechnungWordPlugIn\Scripts\Version.xml
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Handbuch", "eRechnungWordPlugIn\Handbuch", "{29392638-F0FE-42D6-BB91-ABEB04CC8E70}"
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Handbuch", "Handbuch", "{29392638-F0FE-42D6-BB91-ABEB04CC8E70}"
ProjectSection(SolutionItems) = preProject
Handbuch\Anleitung.docx = Handbuch\Anleitung.docx
Handbuch\Anleitung.pdf = Handbuch\Anleitung.pdf
Expand Down Expand Up @@ -289,5 +289,6 @@ Global
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
EnterpriseLibraryConfigurationToolBinariesPathV6 = packages\EnterpriseLibrary.Common.6.0.1304.0\lib\NET45;packages\EnterpriseLibrary.Logging.6.0.1304.0\lib\NET45;packages\EnterpriseLibrary.Validation.6.0.1304.0\lib\NET45;packages\EnterpriseLibrary.Validation.Integration.WinForms.6.0.1304.0\lib\NET45
SolutionGuid = {9C14C1FE-C995-4B16-B801-17627B2C35EA}
EndGlobalSection
EndGlobal
28 changes: 19 additions & 9 deletions eRechnungWordPlugIn/Logging/Logging.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,16 @@ private static void GetLogFn()
}
else
{
logCleanup(logDir);
LogCleanup(logDir);
}
logfn = System.IO.Path.Combine(logDir, _logFileName + DateTime.Now.ToString("yyyy-MM-dd-HHmmssff") + ".log");
_logfn = logfn;
}

private static void logCleanup(string logDir)
private static void LogCleanup(string logDir)
{
string pattern = Path.Combine(_logFileName + "*") + ".log";
List<string> entries = new List<string>(Directory.GetFiles(logDir,pattern));
List<string> entries = new List<string>(Directory.GetFiles(logDir, pattern));
if (entries.Count() > _numLogFiles)
{
Debug.WriteLine("Anzahl Files:{0}", entries.Count());
Expand All @@ -74,24 +74,34 @@ public static void LogWrite(CallerInfo cInfo, LogPriority level, string format,
public static void TraceWrite(CallerInfo cInfo, string format, params object[] parms)
{
if (!_traceEnabled) return;
WriteToLog("Trace", string.Format(format, parms),cInfo);
WriteToLog("Trace", string.Format(format, parms), cInfo);
}
public static void TraceWrite(CallerInfo cInfo, string message)
{
if (!_traceEnabled) return;
WriteToLog("Trace", message, cInfo);
}
private static void WriteToLog(string level, string message, CallerInfo cInfo )
{
string msg = "";
msg = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss,ff\t") + level + "\t" + cInfo.CallerFilePath+ "\t" +cInfo.CallerMemberName+ "\t" + cInfo.CallerLineNumber + "\t" + message;
private static void WriteToLog(string level, string message, CallerInfo cInfo)
{
string msg = "";
msg = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss,ff\t") + level + "\t" + cInfo.CallerFilePath + "\t" + cInfo.CallerMemberName + "\t" + cInfo.CallerLineNumber + "\t" + message;
if (_semaphore.WaitOne(100))
{
if (string.IsNullOrEmpty(_logfn))
{
GetLogFn();
string msg1 = "Timestamp\tType\tFile\tMethod\tLine\tMessage";
File.AppendAllLines(_logfn, new List<string> { msg1 });
Assembly asm = Assembly.GetExecutingAssembly();
var version = asm.GetName().Version;
string initStamp = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss,ff\t");
var initstrings = new List<string>{
initStamp+"Init\tLog Init\t******************************",
initStamp+$"Init\tLog Init\teRechnung Word PlugIn Version {version.ToString()}",
initStamp+"Init\tLog Init\t******************************",

};
File.AppendAllLines(_logfn, initstrings);
}
File.AppendAllLines(_logfn, new List<string> { msg });
_semaphore.ReleaseMutex();
Expand All @@ -100,7 +110,7 @@ private static void WriteToLog(string level, string message, CallerInfo cInfo )
{
// Silently skip
Debug.WriteLine("Semaphore not acquired: '" + msg + "'");
}
}
return;
}

Expand Down
25 changes: 12 additions & 13 deletions eRechnungWordPlugIn/Logging/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -1,36 +1,35 @@
using System.Reflection;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// Allgemeine Informationen über eine Assembly werden über die folgenden
// Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern,
// die mit einer Assembly verknüpft sind.
// Allgemeine Informationen über eine Assembly werden über die folgenden
// Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern,
// die mit einer Assembly verknüpft sind.
[assembly: AssemblyTitle("Log")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Bogad & Partner Consulting OG")]
[assembly: AssemblyProduct("Log")]
[assembly: AssemblyCopyright("Copyright © 2010-2015")]
[assembly: AssemblyCopyright("Copyright © 2010-2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// Durch Festlegen von ComVisible auf "false" werden die Typen in dieser Assembly unsichtbar
// für COM-Komponenten. Wenn Sie auf einen Typ in dieser Assembly von
// COM zugreifen müssen, legen Sie das ComVisible-Attribut für diesen Typ auf "true" fest.
// für COM-Komponenten. Wenn Sie auf einen Typ in dieser Assembly von
// COM zugreifen müssen, legen Sie das ComVisible-Attribut für diesen Typ auf "true" fest.
[assembly: ComVisible(false)]

// Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird
// Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird
[assembly: Guid("fefb7e3a-50bb-4ad7-ac6a-082940adbf8f")]

// Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten:
// Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten:
//
// Hauptversion
// Nebenversion
// Buildnummer
// Revision
//
// Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern
// übernehmen, indem Sie "*" eingeben:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("4.3.0.0")]
// Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern
// übernehmen, indem Sie "*" eingeben:
[assembly: AssemblyVersion("4.3.0.5")]
[assembly: AssemblyFileVersion("1.0.0.0")]
4 changes: 3 additions & 1 deletion eRechnungWordPlugIn/Scripts/ReleaseBuild.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,10 @@ function UpdateVstoProject([string]$project,[string]$publishDir){
$fileVersion = [Version]$svers
# C:\GitHub\ebinterface-word-plugin\eRechnungWordPlugIn\eRechnung\Properties\AssemblyInfo.cs
$asmPath = (Split-Path -Path $project)+"\Properties\AssemblyInfo.cs"
Write-Host $asmPath
UpdateAssembly -path $asmPath -fileVersion $fileVersion

[string]$logAsmPath = $asmPath -replace "\\eRechnung\\", "\Logging\"
UpdateAssembly -path $logAsmPath -fileVersion $fileVersion
$pUrl
return
}
Expand Down
2 changes: 1 addition & 1 deletion eRechnungWordPlugIn/eRechnung/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System.Reflection;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Security;
Expand Down
8 changes: 4 additions & 4 deletions eRechnungWordPlugIn/ebIModels/XmlData/ProductInfo.xml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<ProductInfo>
<Title>ebInterface 4.2 Word PlugIn</Title>
<Title>ebInterface 4.3 Word PlugIn</Title>
<Version>4.3.0+5</Version>
<CompileInfo>Debug</CompileInfo>
<CompileTime>2018-02-06 17:50:35</CompileTime>
<CompileTime>2018-04-11 18:03:04</CompileTime>
<Branch>Bugfix</Branch>
<LastCommit>2018-02-06 17:50:35</LastCommit>
<ChangeSetId>d244ebb</ChangeSetId>
<LastCommit>2018-04-11 18:03:03</LastCommit>
<ChangeSetId>c64c8e9</ChangeSetId>
</ProductInfo>
2 changes: 1 addition & 1 deletion eRechnungWordPlugIn/ebIModels/ebIModels.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PreBuildEvent>Powershell "$(SolutionDir)\Scripts\setVersion.ps1" -cfgName $(ConfigurationName) -ProductFile "$(ProjectDir)XmlData\ProductInfo.xml" -VersionFile "$(SolutionDir)Scripts\Version.xml"</PreBuildEvent>
<PreBuildEvent>Powershell "$(SolutionDir)\eRechnungWordPlugIn\Scripts\setVersion.ps1" -cfgName $(ConfigurationName) -ProductFile "$(ProjectDir)XmlData\ProductInfo.xml" -VersionFile "$(SolutionDir)\eRechnungWordPlugIn\Scripts\Version.xml"</PreBuildEvent>
</PropertyGroup>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
Expand Down

0 comments on commit 85432ff

Please sign in to comment.