updated the tool project
This commit is contained in:
parent
3ef5a35176
commit
1555e40ad1
@ -1,22 +1,51 @@
|
|||||||
|
|
||||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
# Visual Studio 14
|
# Visual Studio Version 16
|
||||||
VisualStudioVersion = 14.0.25123.0
|
VisualStudioVersion = 16.0.33328.57
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "bsmd.Tool", "bsmd.Tool\bsmd.Tool.csproj", "{5F5E65EE-9351-4F30-817A-9C6C6D6835AE}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "bsmd.Tool", "bsmd.Tool\bsmd.Tool.csproj", "{5F5E65EE-9351-4F30-817A-9C6C6D6835AE}"
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "bsmd.database", "bsmd.database\bsmd.database.csproj", "{19945AF2-379B-46A5-B27A-303B5EC1D557}"
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug 64|Any CPU = Debug 64|Any CPU
|
||||||
|
Debug 64|x64 = Debug 64|x64
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
Debug|x64 = Debug|x64
|
||||||
Release|Any CPU = Release|Any CPU
|
Release|Any CPU = Release|Any CPU
|
||||||
|
Release|x64 = Release|x64
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{5F5E65EE-9351-4F30-817A-9C6C6D6835AE}.Debug 64|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{5F5E65EE-9351-4F30-817A-9C6C6D6835AE}.Debug 64|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{5F5E65EE-9351-4F30-817A-9C6C6D6835AE}.Debug 64|x64.ActiveCfg = Debug|Any CPU
|
||||||
|
{5F5E65EE-9351-4F30-817A-9C6C6D6835AE}.Debug 64|x64.Build.0 = Debug|Any CPU
|
||||||
{5F5E65EE-9351-4F30-817A-9C6C6D6835AE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{5F5E65EE-9351-4F30-817A-9C6C6D6835AE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{5F5E65EE-9351-4F30-817A-9C6C6D6835AE}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{5F5E65EE-9351-4F30-817A-9C6C6D6835AE}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{5F5E65EE-9351-4F30-817A-9C6C6D6835AE}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||||
|
{5F5E65EE-9351-4F30-817A-9C6C6D6835AE}.Debug|x64.Build.0 = Debug|Any CPU
|
||||||
{5F5E65EE-9351-4F30-817A-9C6C6D6835AE}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{5F5E65EE-9351-4F30-817A-9C6C6D6835AE}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{5F5E65EE-9351-4F30-817A-9C6C6D6835AE}.Release|Any CPU.Build.0 = Release|Any CPU
|
{5F5E65EE-9351-4F30-817A-9C6C6D6835AE}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{5F5E65EE-9351-4F30-817A-9C6C6D6835AE}.Release|x64.ActiveCfg = Release|Any CPU
|
||||||
|
{5F5E65EE-9351-4F30-817A-9C6C6D6835AE}.Release|x64.Build.0 = Release|Any CPU
|
||||||
|
{19945AF2-379B-46A5-B27A-303B5EC1D557}.Debug 64|Any CPU.ActiveCfg = Debug 64|Any CPU
|
||||||
|
{19945AF2-379B-46A5-B27A-303B5EC1D557}.Debug 64|Any CPU.Build.0 = Debug 64|Any CPU
|
||||||
|
{19945AF2-379B-46A5-B27A-303B5EC1D557}.Debug 64|x64.ActiveCfg = Debug 64|x64
|
||||||
|
{19945AF2-379B-46A5-B27A-303B5EC1D557}.Debug 64|x64.Build.0 = Debug 64|x64
|
||||||
|
{19945AF2-379B-46A5-B27A-303B5EC1D557}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{19945AF2-379B-46A5-B27A-303B5EC1D557}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{19945AF2-379B-46A5-B27A-303B5EC1D557}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
|
{19945AF2-379B-46A5-B27A-303B5EC1D557}.Debug|x64.Build.0 = Debug|x64
|
||||||
|
{19945AF2-379B-46A5-B27A-303B5EC1D557}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{19945AF2-379B-46A5-B27A-303B5EC1D557}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{19945AF2-379B-46A5-B27A-303B5EC1D557}.Release|x64.ActiveCfg = Release|x64
|
||||||
|
{19945AF2-379B-46A5-B27A-303B5EC1D557}.Release|x64.Build.0 = Release|x64
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
|
SolutionGuid = {6B3F5B6D-3615-4A93-A6A7-46BD448CEED6}
|
||||||
|
EndGlobalSection
|
||||||
EndGlobal
|
EndGlobal
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
<?xml version="1.0" encoding="utf-8" ?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<configuration>
|
<configuration>
|
||||||
<configSections>
|
<configSections>
|
||||||
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,Log4net"/>
|
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,Log4net"/>
|
||||||
@ -24,7 +24,7 @@
|
|||||||
</appender>
|
</appender>
|
||||||
</log4net>
|
</log4net>
|
||||||
<startup>
|
<startup>
|
||||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
|
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/>
|
||||||
</startup>
|
</startup>
|
||||||
<userSettings>
|
<userSettings>
|
||||||
<bsmd.Tool.Properties.Settings>
|
<bsmd.Tool.Properties.Settings>
|
||||||
|
|||||||
@ -14,9 +14,9 @@ using log4net;
|
|||||||
|
|
||||||
namespace bsmd.Tool
|
namespace bsmd.Tool
|
||||||
{
|
{
|
||||||
public class CheckRules
|
public static class CheckRules
|
||||||
{
|
{
|
||||||
private static ILog log = LogManager.GetLogger("CheckRules");
|
private static readonly ILog log = LogManager.GetLogger("CheckRules");
|
||||||
public static void Check(Guid messageCoreId)
|
public static void Check(Guid messageCoreId)
|
||||||
{
|
{
|
||||||
if(DBManager.Instance.Connect(Properties.Settings.Default.ConnectionString))
|
if(DBManager.Instance.Connect(Properties.Settings.Default.ConnectionString))
|
||||||
@ -28,15 +28,14 @@ namespace bsmd.Tool
|
|||||||
List<Message> messages = DBManager.Instance.GetMessagesForCore(core, DBManager.MessageLoad.ALL);
|
List<Message> messages = DBManager.Instance.GetMessagesForCore(core, DBManager.MessageLoad.ALL);
|
||||||
RuleEngine ruleEngine = new RuleEngine();
|
RuleEngine ruleEngine = new RuleEngine();
|
||||||
|
|
||||||
foreach(Message message in messages) {
|
foreach(Message message in messages)
|
||||||
|
{
|
||||||
// clear old results
|
// clear old results
|
||||||
DBManager.Instance.DeleteMessageErrors(message);
|
DBManager.Instance.DeleteMessageErrors(message);
|
||||||
DBManager.Instance.DeleteMessageViolations(message);
|
DBManager.Instance.DeleteMessageViolations(message);
|
||||||
|
|
||||||
// perform validation
|
// perform validation
|
||||||
ruleEngine.Validate(message);
|
ruleEngine.Validate(message);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@ -7,9 +7,8 @@ using System.IO;
|
|||||||
|
|
||||||
namespace bsmd.Tool
|
namespace bsmd.Tool
|
||||||
{
|
{
|
||||||
class CleanupFiles
|
internal static class CleanupFiles
|
||||||
{
|
{
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Alle XML Dateien in einem Dateipfad(rootPath) (recursive) löschen, die älter als (staleDays) Tage sind
|
/// Alle XML Dateien in einem Dateipfad(rootPath) (recursive) löschen, die älter als (staleDays) Tage sind
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -35,6 +34,5 @@ namespace bsmd.Tool
|
|||||||
Cleanup(directory, staleDays, recursive);
|
Cleanup(directory, staleDays, recursive);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -19,30 +19,19 @@ namespace bsmd.Tool
|
|||||||
[Option('c', "core", Required=false, HelpText="MessageCoreId to process")]
|
[Option('c', "core", Required=false, HelpText="MessageCoreId to process")]
|
||||||
public string MessageCoreId { get; set; }
|
public string MessageCoreId { get; set; }
|
||||||
|
|
||||||
[Option('v',"verbose", DefaultValue=true, HelpText="print messages to console")]
|
[Option('v',"verbose", Default=true, HelpText="print messages to console")]
|
||||||
public bool Verbose { get; set; }
|
public bool Verbose { get; set; }
|
||||||
|
|
||||||
[Option('r', "checkrules", MutuallyExclusiveSet = "command", HelpText = "Use rule engine on message core")]
|
[Option('r', "checkrules", HelpText = "Use rule engine on message core")]
|
||||||
public bool CheckRules { get; set; }
|
public bool CheckRules { get; set; }
|
||||||
|
|
||||||
[Option('s', "staledays", DefaultValue = 30, HelpText ="Delete files older than X days")]
|
[Option('s', "staledays", Default = 30, HelpText ="Delete files older than X days")]
|
||||||
public int StaleDays { get; set; }
|
public int StaleDays { get; set; }
|
||||||
|
|
||||||
[Option('p', "path", HelpText ="Path to cleanup root folder")]
|
[Option('p', "path", HelpText ="Path to cleanup root folder")]
|
||||||
public string CleanupFolderRoot { get; set; }
|
public string CleanupFolderRoot { get; set; }
|
||||||
|
|
||||||
[Option('x', "recursive", DefaultValue = false, HelpText ="Cleanup subdirectories recursively")]
|
[Option('x', "recursive", Default = false, HelpText ="Cleanup subdirectories recursively")]
|
||||||
public bool CleanupRecursive { get; set; }
|
public bool CleanupRecursive { get; set; }
|
||||||
|
|
||||||
[ParserState]
|
|
||||||
public IParserState LastParserState { get; set; }
|
|
||||||
|
|
||||||
[HelpOption]
|
|
||||||
public string GetUsage()
|
|
||||||
{
|
|
||||||
return HelpText.AutoBuild(this, (HelpText current) => HelpText.DefaultParsingErrorsHandler(this, current));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,28 +1,25 @@
|
|||||||
using System;
|
using CommandLine;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using log4net;
|
using log4net;
|
||||||
|
using System;
|
||||||
|
|
||||||
namespace bsmd.Tool
|
namespace bsmd.Tool
|
||||||
{
|
{
|
||||||
class Program
|
public static class Program
|
||||||
{
|
{
|
||||||
private static ILog log = LogManager.GetLogger("Tool");
|
private static readonly ILog log = LogManager.GetLogger("Tool");
|
||||||
|
|
||||||
static int Main(string[] args)
|
public static int Main(string[] args)
|
||||||
{
|
{
|
||||||
|
int result = 0;
|
||||||
log4net.Config.XmlConfigurator.Configure();
|
log4net.Config.XmlConfigurator.Configure();
|
||||||
Options options = new Options();
|
Options options = new Options();
|
||||||
if (CommandLine.Parser.Default.ParseArguments(args, options))
|
|
||||||
{
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (options.CheckRules)
|
Parser.Default.ParseArguments<Options>(args).WithParsed<Options>(o =>
|
||||||
{
|
{
|
||||||
Guid coreId;
|
if (o.CheckRules)
|
||||||
if (Guid.TryParse(options.MessageCoreId, out coreId))
|
{
|
||||||
|
if (Guid.TryParse(options.MessageCoreId, out Guid coreId))
|
||||||
{
|
{
|
||||||
CheckRules.Check(coreId);
|
CheckRules.Check(coreId);
|
||||||
}
|
}
|
||||||
@ -32,27 +29,18 @@ namespace bsmd.Tool
|
|||||||
log.FatalFormat("CheckRules: cannot parse message core id");
|
log.FatalFormat("CheckRules: cannot parse message core id");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if((options.CleanupFolderRoot != null) && (options.CleanupFolderRoot.Length > 0))
|
if (!string.IsNullOrEmpty(o.CleanupFolderRoot))
|
||||||
{
|
{
|
||||||
CleanupFiles.Cleanup(options.CleanupFolderRoot, options.StaleDays, options.CleanupRecursive);
|
CleanupFiles.Cleanup(options.CleanupFolderRoot, options.StaleDays, options.CleanupRecursive);
|
||||||
}
|
}
|
||||||
else
|
});
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
log.ErrorFormat("an exception occurred: {0}", ex.Message);
|
log.Fatal(ex.Message);
|
||||||
return 1;
|
result = 1;
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Console.WriteLine(options.GetUsage());
|
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
2
bsmd.Tool/Properties/Settings.Designer.cs
generated
2
bsmd.Tool/Properties/Settings.Designer.cs
generated
@ -12,7 +12,7 @@ namespace bsmd.Tool.Properties {
|
|||||||
|
|
||||||
|
|
||||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "12.0.0.0")]
|
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.10.0.0")]
|
||||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
|
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
|
||||||
|
|
||||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||||
|
|||||||
@ -9,8 +9,9 @@
|
|||||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||||
<RootNamespace>bsmd.Tool</RootNamespace>
|
<RootNamespace>bsmd.Tool</RootNamespace>
|
||||||
<AssemblyName>bsmd.Tool</AssemblyName>
|
<AssemblyName>bsmd.Tool</AssemblyName>
|
||||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
|
||||||
<FileAlignment>512</FileAlignment>
|
<FileAlignment>512</FileAlignment>
|
||||||
|
<TargetFrameworkProfile />
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||||
@ -38,15 +39,19 @@
|
|||||||
<AssemblyOriginatorKeyFile>..\bsmdKey.snk</AssemblyOriginatorKeyFile>
|
<AssemblyOriginatorKeyFile>..\bsmdKey.snk</AssemblyOriginatorKeyFile>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="CommandLine">
|
<Reference Include="bsmd.database">
|
||||||
<HintPath>..\packages\CommandLineParser.1.9.71\lib\net45\CommandLine.dll</HintPath>
|
<HintPath>..\bsmd.database\bin\Debug\bsmd.database.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="log4net, Version=2.0.8.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
|
<Reference Include="CommandLine, Version=2.9.1.0, Culture=neutral, PublicKeyToken=5a870481e358d379, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\log4net.2.0.8\lib\net45-full\log4net.dll</HintPath>
|
<HintPath>..\packages\CommandLineParser.2.9.1\lib\net461\CommandLine.dll</HintPath>
|
||||||
<Private>True</Private>
|
</Reference>
|
||||||
|
<Reference Include="log4net, Version=2.0.15.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\log4net.2.0.15\lib\net45\log4net.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
|
<Reference Include="System.Configuration" />
|
||||||
<Reference Include="System.Core" />
|
<Reference Include="System.Core" />
|
||||||
|
<Reference Include="System.Web" />
|
||||||
<Reference Include="System.Xml.Linq" />
|
<Reference Include="System.Xml.Linq" />
|
||||||
<Reference Include="System.Data.DataSetExtensions" />
|
<Reference Include="System.Data.DataSetExtensions" />
|
||||||
<Reference Include="Microsoft.CSharp" />
|
<Reference Include="Microsoft.CSharp" />
|
||||||
@ -83,12 +88,6 @@
|
|||||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||||
</None>
|
</None>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
|
||||||
<ProjectReference Include="..\bsmd.database\bsmd.database.csproj">
|
|
||||||
<Project>{19945af2-379b-46a5-b27a-303b5ec1d557}</Project>
|
|
||||||
<Name>bsmd.database</Name>
|
|
||||||
</ProjectReference>
|
|
||||||
</ItemGroup>
|
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
<!-- 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.
|
Other similar extension points exist, see Microsoft.Common.targets.
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<packages>
|
<packages>
|
||||||
<package id="CommandLineParser" version="1.9.71" targetFramework="net45" />
|
<package id="CommandLineParser" version="2.9.1" targetFramework="net48" />
|
||||||
<package id="log4net" version="2.0.8" targetFramework="net45" />
|
<package id="log4net" version="2.0.15" targetFramework="net48" />
|
||||||
</packages>
|
</packages>
|
||||||
Loading…
Reference in New Issue
Block a user