Initial check-in
This commit is contained in:
63
.gitattributes
vendored
Normal file
63
.gitattributes
vendored
Normal file
@@ -0,0 +1,63 @@
|
||||
###############################################################################
|
||||
# Set default behavior to automatically normalize line endings.
|
||||
###############################################################################
|
||||
* text=auto
|
||||
|
||||
###############################################################################
|
||||
# Set default behavior for command prompt diff.
|
||||
#
|
||||
# This is need for earlier builds of msysgit that does not have it on by
|
||||
# default for csharp files.
|
||||
# Note: This is only used by command line
|
||||
###############################################################################
|
||||
#*.cs diff=csharp
|
||||
|
||||
###############################################################################
|
||||
# Set the merge driver for project and solution files
|
||||
#
|
||||
# Merging from the command prompt will add diff markers to the files if there
|
||||
# are conflicts (Merging from VS is not affected by the settings below, in VS
|
||||
# the diff markers are never inserted). Diff markers may cause the following
|
||||
# file extensions to fail to load in VS. An alternative would be to treat
|
||||
# these files as binary and thus will always conflict and require user
|
||||
# intervention with every merge. To do so, just uncomment the entries below
|
||||
###############################################################################
|
||||
#*.sln merge=binary
|
||||
#*.csproj merge=binary
|
||||
#*.vbproj merge=binary
|
||||
#*.vcxproj merge=binary
|
||||
#*.vcproj merge=binary
|
||||
#*.dbproj merge=binary
|
||||
#*.fsproj merge=binary
|
||||
#*.lsproj merge=binary
|
||||
#*.wixproj merge=binary
|
||||
#*.modelproj merge=binary
|
||||
#*.sqlproj merge=binary
|
||||
#*.wwaproj merge=binary
|
||||
|
||||
###############################################################################
|
||||
# behavior for image files
|
||||
#
|
||||
# image files are treated as binary by default.
|
||||
###############################################################################
|
||||
#*.jpg binary
|
||||
#*.png binary
|
||||
#*.gif binary
|
||||
|
||||
###############################################################################
|
||||
# diff behavior for common document formats
|
||||
#
|
||||
# Convert binary document formats to text before diffing them. This feature
|
||||
# is only available from the command line. Turn it on by uncommenting the
|
||||
# entries below.
|
||||
###############################################################################
|
||||
#*.doc diff=astextplain
|
||||
#*.DOC diff=astextplain
|
||||
#*.docx diff=astextplain
|
||||
#*.DOCX diff=astextplain
|
||||
#*.dot diff=astextplain
|
||||
#*.DOT diff=astextplain
|
||||
#*.pdf diff=astextplain
|
||||
#*.PDF diff=astextplain
|
||||
#*.rtf diff=astextplain
|
||||
#*.RTF diff=astextplain
|
||||
52
.gitignore
vendored
52
.gitignore
vendored
@@ -1,8 +1,12 @@
|
||||
# ---> VisualStudio
|
||||
## Ignore Visual Studio temporary files, build results, and
|
||||
## files generated by popular Visual Studio add-ons.
|
||||
##
|
||||
## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore
|
||||
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
|
||||
|
||||
Source/LogDashboard/_Deployment
|
||||
Source/LogDashboard/Nuget/cache
|
||||
|
||||
Thumbs.db
|
||||
|
||||
# User-specific files
|
||||
*.rsuser
|
||||
@@ -30,6 +34,7 @@ x86/
|
||||
bld/
|
||||
[Bb]in/
|
||||
[Oo]bj/
|
||||
[Oo]ut/
|
||||
[Ll]og/
|
||||
[Ll]ogs/
|
||||
|
||||
@@ -83,8 +88,6 @@ StyleCopReport.xml
|
||||
*.pgc
|
||||
*.pgd
|
||||
*.rsp
|
||||
# but not Directory.Build.rsp, as it configures directory-level build defaults
|
||||
!Directory.Build.rsp
|
||||
*.sbr
|
||||
*.tlb
|
||||
*.tli
|
||||
@@ -93,7 +96,6 @@ StyleCopReport.xml
|
||||
*.tmp_proj
|
||||
*_wpftmp.csproj
|
||||
*.log
|
||||
*.tlog
|
||||
*.vspscc
|
||||
*.vssscc
|
||||
.builds
|
||||
@@ -196,7 +198,7 @@ publish/
|
||||
PublishScripts/
|
||||
|
||||
# NuGet Packages
|
||||
*.nupkg
|
||||
#*.nupkg
|
||||
# NuGet Symbol Packages
|
||||
*.snupkg
|
||||
# The packages folder can be ignored because of Package Restore
|
||||
@@ -297,17 +299,6 @@ node_modules/
|
||||
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
|
||||
*.vbw
|
||||
|
||||
# Visual Studio 6 auto-generated project file (contains which files were open etc.)
|
||||
*.vbp
|
||||
|
||||
# Visual Studio 6 workspace and project file (working project files containing files to include in project)
|
||||
*.dsw
|
||||
*.dsp
|
||||
|
||||
# Visual Studio 6 technical files
|
||||
*.ncb
|
||||
*.aps
|
||||
|
||||
# Visual Studio LightSwitch build output
|
||||
**/*.HTMLClient/GeneratedArtifacts
|
||||
**/*.DesktopClient/GeneratedArtifacts
|
||||
@@ -364,9 +355,6 @@ ASALocalRun/
|
||||
# Local History for Visual Studio
|
||||
.localhistory/
|
||||
|
||||
# Visual Studio History (VSHistory) files
|
||||
.vshistory/
|
||||
|
||||
# BeatPulse healthcheck temp database
|
||||
healthchecksdb
|
||||
|
||||
@@ -377,26 +365,4 @@ MigrationBackup/
|
||||
.ionide/
|
||||
|
||||
# Fody - auto-generated XML schema
|
||||
FodyWeavers.xsd
|
||||
|
||||
# VS Code files for those working on multiple tools
|
||||
.vscode/*
|
||||
!.vscode/settings.json
|
||||
!.vscode/tasks.json
|
||||
!.vscode/launch.json
|
||||
!.vscode/extensions.json
|
||||
*.code-workspace
|
||||
|
||||
# Local History for Visual Studio Code
|
||||
.history/
|
||||
|
||||
# Windows Installer files from build outputs
|
||||
*.cab
|
||||
*.msi
|
||||
*.msix
|
||||
*.msm
|
||||
*.msp
|
||||
|
||||
# JetBrains Rider
|
||||
*.sln.iml
|
||||
|
||||
FodyWeavers.xsd
|
||||
110
Source/LogDashboard/LogDashboard.UI/App.config
Normal file
110
Source/LogDashboard/LogDashboard.UI/App.config
Normal file
@@ -0,0 +1,110 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<!--
|
||||
App.config
|
||||
12/4/2023
|
||||
|
||||
RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
|
||||
PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
|
||||
AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
|
||||
UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
|
||||
RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
|
||||
CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
|
||||
OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
|
||||
COMPANY.
|
||||
|
||||
THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. GOVERNMENT
|
||||
|
||||
UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
|
||||
WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE
|
||||
EXPORT OR DISCLOSURE TO NON-U.S. PERSONS, WHEREVER LOCATED, IS RESTRICTED
|
||||
BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R. SECTION
|
||||
120-130) OR THE EXPORT ADMINISTRATION REGULATIONS (EAR) (15 C.F.R. SECTION
|
||||
730-774). THIS DOCUMENT CANNOT BE EXPORTED (E.G., PROVIDED TO A SUPPLIER
|
||||
OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S. PERSON, WHEREVER
|
||||
LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS
|
||||
BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S. GOVERNMENT
|
||||
APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL
|
||||
PENALTIES.
|
||||
|
||||
DOD 5220.22-M, INDUSTRIAL SECURITY MANUAL, CHAPTER 5, SECTION 1 THROUGH 9 :
|
||||
FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN OR DOD 5200.1-R,
|
||||
INFORMATION SECURITY PROGRAM, CHAPTER 6. FOR UNCLASSIFIED, LIMITED DOCUMENTS
|
||||
DESTROY BY ANY METHOD THAT WILL PREVENT DISCLOSURE OF CONTENTS OR
|
||||
RECONSTRUCTION OF THE DOCUMENT.
|
||||
POC: Alex Kravchenko (1118268)
|
||||
-->
|
||||
<configuration>
|
||||
<configSections>
|
||||
<section name="nlog" type="NLog.Config.ConfigSectionHandler, NLog"/>
|
||||
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
|
||||
<section name="Raytheon.LogDashboard.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
|
||||
</sectionGroup>
|
||||
</configSections>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2"/>
|
||||
</startup>
|
||||
|
||||
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" autoReload="true">
|
||||
<targets>
|
||||
<target fileName="${logger}.txt"
|
||||
xsi:type="File"
|
||||
name="file"
|
||||
layout="${date:format=MM/dd/yyyy hh.mm.ss} ${message}"
|
||||
archiveAboveSize="100000000"/>
|
||||
<target name="fileLog" type="AsyncWrapper" queueLimit="5000" overflowAction="Block">
|
||||
<target type="File" fileName="${specialfolder:folder=MyDocuments}/LogDashboard/logs/${shortdate}.txt"
|
||||
layout="${longdate};${level};${threadid};${callsite};${logger};${message};${exception:format=tostring}"
|
||||
archiveFileName="${specialfolder:folder=MyDocuments}/LogDashboard/logs/archive/{#}.zip"
|
||||
archiveDateFormat="MM-dd-yyyy"
|
||||
archiveNumbering="Date"
|
||||
enableArchiveFileCompression="True"
|
||||
maxArchiveFiles="7"
|
||||
archiveEvery="Day"/>
|
||||
</target>
|
||||
</targets>
|
||||
<rules>
|
||||
<logger name="*" minlevel="Debug" writeTo="fileLog"/>
|
||||
</rules>
|
||||
</nlog>
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Windows.Interactivity" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0"/>
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
<userSettings>
|
||||
<Raytheon.LogDashboard.Properties.Settings>
|
||||
<setting name="CurrentWindowHeight" serializeAs="String">
|
||||
<value>600</value>
|
||||
</setting>
|
||||
<setting name="PreviousWindowHeight" serializeAs="String">
|
||||
<value>600</value>
|
||||
</setting>
|
||||
<setting name="CurrentWindowWidth" serializeAs="String">
|
||||
<value>800</value>
|
||||
</setting>
|
||||
<setting name="PreviousWindowWidth" serializeAs="String">
|
||||
<value>800</value>
|
||||
</setting>
|
||||
<setting name="CurrentWindowLeft" serializeAs="String">
|
||||
<value>100</value>
|
||||
</setting>
|
||||
<setting name="PreviousWindowLeft" serializeAs="String">
|
||||
<value>100</value>
|
||||
</setting>
|
||||
<setting name="CurrentWindowTop" serializeAs="String">
|
||||
<value>100</value>
|
||||
</setting>
|
||||
<setting name="PreviousWindowTop" serializeAs="String">
|
||||
<value>100</value>
|
||||
</setting>
|
||||
<setting name="SettingsPath" serializeAs="String">
|
||||
<value></value>
|
||||
</setting>
|
||||
</Raytheon.LogDashboard.Properties.Settings>
|
||||
</userSettings>
|
||||
</configuration>
|
||||
59
Source/LogDashboard/LogDashboard.UI/App.xaml
Normal file
59
Source/LogDashboard/LogDashboard.UI/App.xaml
Normal file
@@ -0,0 +1,59 @@
|
||||
<!--
|
||||
App.xaml
|
||||
12/4/2023
|
||||
|
||||
RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
|
||||
PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
|
||||
AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
|
||||
UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
|
||||
RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
|
||||
CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
|
||||
OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
|
||||
COMPANY.
|
||||
|
||||
THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. GOVERNMENT
|
||||
|
||||
UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
|
||||
WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE
|
||||
EXPORT OR DISCLOSURE TO NON-U.S. PERSONS, WHEREVER LOCATED, IS RESTRICTED
|
||||
BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R. SECTION
|
||||
120-130) OR THE EXPORT ADMINISTRATION REGULATIONS (EAR) (15 C.F.R. SECTION
|
||||
730-774). THIS DOCUMENT CANNOT BE EXPORTED (E.G., PROVIDED TO A SUPPLIER
|
||||
OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S. PERSON, WHEREVER
|
||||
LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS
|
||||
BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S. GOVERNMENT
|
||||
APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL
|
||||
PENALTIES.
|
||||
|
||||
DOD 5220.22-M, INDUSTRIAL SECURITY MANUAL, CHAPTER 5, SECTION 1 THROUGH 9 :
|
||||
FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN OR DOD 5200.1-R,
|
||||
INFORMATION SECURITY PROGRAM, CHAPTER 6. FOR UNCLASSIFIED, LIMITED DOCUMENTS
|
||||
DESTROY BY ANY METHOD THAT WILL PREVENT DISCLOSURE OF CONTENTS OR
|
||||
RECONSTRUCTION OF THE DOCUMENT.
|
||||
POC: Alex Kravchenko (1118268)
|
||||
-->
|
||||
<Application x:Class="LogDashboard.App"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
d1p1:Ignorable="d"
|
||||
xmlns:d1p1="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
StartupUri="View/MainWindow.xaml"
|
||||
>
|
||||
<Application.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<!-- MahApps.Metro resource dictionaries. Make sure that all file names are Case Sensitive! -->
|
||||
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.xaml" />
|
||||
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Fonts.xaml" />
|
||||
<!-- Theme setting -->
|
||||
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Themes/Light.Blue.xaml" />
|
||||
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
|
||||
<vm:ViewModelLocator x:Key="Locator" d:IsDataSource="True" xmlns:vm="clr-namespace:Raytheon.LogDashboard.ViewModel" />
|
||||
<vm:LogDashViewModelLocator x:Key="LogDashLocator" d:IsDataSource="True" xmlns:vm="clr-namespace:Raytheon.LogDashboard.ViewModel;assembly=Raytheon.LogDashboardLib" />
|
||||
</ResourceDictionary>
|
||||
</Application.Resources>
|
||||
</Application>
|
||||
221
Source/LogDashboard/LogDashboard.UI/App.xaml.cs
Normal file
221
Source/LogDashboard/LogDashboard.UI/App.xaml.cs
Normal file
@@ -0,0 +1,221 @@
|
||||
//******************************************************************************//
|
||||
// App.xaml.cs
|
||||
// 12/4/2023
|
||||
//
|
||||
// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
|
||||
// PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
|
||||
// AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
|
||||
// UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
|
||||
// RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
|
||||
// CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
|
||||
// OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
|
||||
// COMPANY.
|
||||
//
|
||||
// THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. GOVERNMENT
|
||||
//
|
||||
// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
//
|
||||
// WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE
|
||||
// EXPORT OR DISCLOSURE TO NON-U.S. PERSONS, WHEREVER LOCATED, IS RESTRICTED
|
||||
// BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R. SECTION
|
||||
// 120-130) OR THE EXPORT ADMINISTRATION REGULATIONS (EAR) (15 C.F.R. SECTION
|
||||
// 730-774). THIS DOCUMENT CANNOT BE EXPORTED (E.G., PROVIDED TO A SUPPLIER
|
||||
// OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S. PERSON, WHEREVER
|
||||
// LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS
|
||||
// BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S. GOVERNMENT
|
||||
// APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL
|
||||
// PENALTIES.
|
||||
//
|
||||
// DOD 5220.22-M, INDUSTRIAL SECURITY MANUAL, CHAPTER 5, SECTION 1 THROUGH 9 :
|
||||
// FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN OR DOD 5200.1-R,
|
||||
// INFORMATION SECURITY PROGRAM, CHAPTER 6. FOR UNCLASSIFIED, LIMITED DOCUMENTS
|
||||
// DESTROY BY ANY METHOD THAT WILL PREVENT DISCLOSURE OF CONTENTS OR
|
||||
// RECONSTRUCTION OF THE DOCUMENT.
|
||||
// POC: Alex Kravchenko (1118268)
|
||||
//******************************************************************************//
|
||||
using Microsoft.Win32;
|
||||
using NLog;
|
||||
using Raytheon.LogDashboard.Helpers;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Windows;
|
||||
using System.IO;
|
||||
using Raytheon.LogDashboard.View;
|
||||
using GalaSoft.MvvmLight.Messaging;
|
||||
using System.Reflection;
|
||||
|
||||
namespace LogDashboard
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for App.xaml
|
||||
/// </summary>
|
||||
public partial class App : Application
|
||||
{
|
||||
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
|
||||
|
||||
public static bool IsManualStartup { get; private set; } = false;
|
||||
public ResourceDictionary ThemeDictionary => Resources.MergedDictionaries[1];
|
||||
|
||||
public void ChangeTheme(Uri uri)
|
||||
{
|
||||
ThemeDictionary.MergedDictionaries[1] = new ResourceDictionary { Source = uri };
|
||||
}
|
||||
|
||||
static Mutex mutex = new Mutex(true, "{8F6F0AC4-B9A1-45fd-A8CF-72F04E6BDE8F}");
|
||||
|
||||
[STAThread]
|
||||
protected override void OnStartup(StartupEventArgs e)
|
||||
{
|
||||
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
|
||||
Current.DispatcherUnhandledException += Current_DispatcherUnhandledException;
|
||||
|
||||
if(e.Args.Any(x => (x.EndsWith(".txt") || x.EndsWith(".log")) && File.Exists(x)))
|
||||
{
|
||||
IsManualStartup = true;
|
||||
|
||||
try
|
||||
{
|
||||
if(!mutex.WaitOne(TimeSpan.Zero, true))
|
||||
{
|
||||
Process proc = Process.GetCurrentProcess();
|
||||
string processName = proc.ProcessName.Replace(".vshost", "");
|
||||
var runningProcess = Process.GetProcesses()
|
||||
.FirstOrDefault(x => (x.ProcessName == processName || x.ProcessName == proc.ProcessName || x.ProcessName == proc.ProcessName + ".vshost") && x.Id != proc.Id);
|
||||
|
||||
if(runningProcess == null)
|
||||
{
|
||||
App app = new App();
|
||||
app.InitializeComponent();
|
||||
MainWindow window = new MainWindow();
|
||||
Raytheon.LogDashboard.View.MainWindow.HandleParameter(e.Args);
|
||||
app.Run(window);
|
||||
return;
|
||||
}
|
||||
|
||||
UnsafeNative.SendMessage(runningProcess.MainWindowHandle, string.Join(" ", e.Args));
|
||||
|
||||
Environment.Exit(0);
|
||||
}
|
||||
}
|
||||
catch(Exception exception)
|
||||
{
|
||||
logger.Warn(exception, "OnStartup check exception (open with arguments)");
|
||||
}
|
||||
}
|
||||
|
||||
string assemblyFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
|
||||
string logDashboardConfigFilePath = Path.Combine(assemblyFolder, "LogDashboard.xml");
|
||||
// load settings from configuration file
|
||||
Raytheon.LogDashboard.Model.Settings.SetInstance(logDashboardConfigFilePath).Load();
|
||||
|
||||
if(Raytheon.LogDashboard.Model.Settings.Instance.OnlyOneAppInstance)
|
||||
{
|
||||
try
|
||||
{
|
||||
if(mutex.WaitOne(TimeSpan.Zero, true))
|
||||
{
|
||||
mutex.ReleaseMutex();
|
||||
}
|
||||
else
|
||||
{
|
||||
logger.Trace("OnStartup: one instance of Log Viewer already started");
|
||||
Messenger.Default.Send("OnStartup: one instance of Log Viewer already started", "DisplayCustomMessage");
|
||||
Environment.Exit(0);
|
||||
}
|
||||
}
|
||||
catch(Exception exception)
|
||||
{
|
||||
logger.Warn(exception, "OnStartup check exception");
|
||||
}
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
if(!IsAssociated())
|
||||
{
|
||||
string filePath = Process.GetCurrentProcess().MainModule.FileName;
|
||||
|
||||
SetAssociation(".txt", "LogDashboard", filePath);
|
||||
SetAssociation(".log", "LogDashboard", filePath);
|
||||
SetAssociation(".csv", "LogDashboard", filePath);
|
||||
}
|
||||
}
|
||||
catch(Exception exception)
|
||||
{
|
||||
logger.Warn(exception, "OnStartup set file association exception");
|
||||
}
|
||||
|
||||
base.OnStartup(e);
|
||||
}
|
||||
private void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
|
||||
{
|
||||
logger.Fatal($"Unhandled exception {e.ExceptionObject as Exception}");
|
||||
Environment.Exit(1);
|
||||
}
|
||||
|
||||
private void Current_DispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e)
|
||||
{
|
||||
logger.Fatal($"Unhandled Exception: {e.Exception}");
|
||||
Environment.Exit(2);
|
||||
}
|
||||
|
||||
#region File Association
|
||||
|
||||
private bool IsAssociated()
|
||||
{
|
||||
return Registry.CurrentUser.OpenSubKey(@"Software\Classes\LogViewer", false) != null;
|
||||
}
|
||||
|
||||
[DllImport("Shell32.dll")]
|
||||
private static extern int SHChangeNotify(int eventId, int flags, IntPtr item1, IntPtr item2);
|
||||
|
||||
private const int SHCNE_ASSOCCHANGED = 0x8000000;
|
||||
private const int SHCNF_FLUSH = 0x1000;
|
||||
|
||||
private void SetAssociation(string extension, string progId, string applicationFilePath)
|
||||
{
|
||||
bool madeChanges = false;
|
||||
|
||||
madeChanges |= SetKeyDefaultValue($@"Software\Classes\{progId}\shell\open\command", "\"" + applicationFilePath + "\" \"%1\"");
|
||||
madeChanges |= SetProgIdValue($@"Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\{extension}\OpenWithProgids", progId);
|
||||
|
||||
if(madeChanges)
|
||||
{
|
||||
SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_FLUSH, IntPtr.Zero, IntPtr.Zero);
|
||||
}
|
||||
}
|
||||
|
||||
private bool SetProgIdValue(string path, string progId)
|
||||
{
|
||||
using(var key = Registry.CurrentUser.CreateSubKey(path))
|
||||
{
|
||||
if(key.GetValueNames().All(x => x != progId))
|
||||
{
|
||||
key.SetValue(progId, Encoding.Unicode.GetBytes(string.Empty), RegistryValueKind.Binary);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private bool SetKeyDefaultValue(string keyPath, string value)
|
||||
{
|
||||
using(var key = Registry.CurrentUser.CreateSubKey(keyPath))
|
||||
{
|
||||
if(key.GetValue(null) as string != value)
|
||||
{
|
||||
key.SetValue(null, value);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
101
Source/LogDashboard/LogDashboard.UI/Helpers/UnsafeNative.cs
Normal file
101
Source/LogDashboard/LogDashboard.UI/Helpers/UnsafeNative.cs
Normal file
@@ -0,0 +1,101 @@
|
||||
//******************************************************************************//
|
||||
// UnsafeNative.cs
|
||||
// 12/4/2023
|
||||
//
|
||||
// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
|
||||
// PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
|
||||
// AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
|
||||
// UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
|
||||
// RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
|
||||
// CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
|
||||
// OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
|
||||
// COMPANY.
|
||||
//
|
||||
// THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. GOVERNMENT
|
||||
//
|
||||
// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
//
|
||||
// WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE
|
||||
// EXPORT OR DISCLOSURE TO NON-U.S. PERSONS, WHEREVER LOCATED, IS RESTRICTED
|
||||
// BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R. SECTION
|
||||
// 120-130) OR THE EXPORT ADMINISTRATION REGULATIONS (EAR) (15 C.F.R. SECTION
|
||||
// 730-774). THIS DOCUMENT CANNOT BE EXPORTED (E.G., PROVIDED TO A SUPPLIER
|
||||
// OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S. PERSON, WHEREVER
|
||||
// LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS
|
||||
// BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S. GOVERNMENT
|
||||
// APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL
|
||||
// PENALTIES.
|
||||
//
|
||||
// DOD 5220.22-M, INDUSTRIAL SECURITY MANUAL, CHAPTER 5, SECTION 1 THROUGH 9 :
|
||||
// FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN OR DOD 5200.1-R,
|
||||
// INFORMATION SECURITY PROGRAM, CHAPTER 6. FOR UNCLASSIFIED, LIMITED DOCUMENTS
|
||||
// DESTROY BY ANY METHOD THAT WILL PREVENT DISCLOSURE OF CONTENTS OR
|
||||
// RECONSTRUCTION OF THE DOCUMENT.
|
||||
// POC: Alex Kravchenko (1118268)
|
||||
//******************************************************************************//
|
||||
|
||||
// Ignore Spelling: COPYDATA
|
||||
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
|
||||
namespace Raytheon.LogDashboard.Helpers
|
||||
{
|
||||
internal static class UnsafeNative
|
||||
{
|
||||
public const int WM_COPYDATA = 0x004A;
|
||||
|
||||
public static string GetMessage(int message, IntPtr lParam)
|
||||
{
|
||||
if (message == WM_COPYDATA)
|
||||
{
|
||||
try
|
||||
{
|
||||
var data = Marshal.PtrToStructure<CopyDataStruct>(lParam);
|
||||
string result = string.Copy(data.lpData);
|
||||
return result;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void SendMessage(IntPtr hwnd, string message)
|
||||
{
|
||||
byte[] messageBytes = Encoding.Unicode.GetBytes(message); /* ANSII encoding */
|
||||
CopyDataStruct data = new CopyDataStruct
|
||||
{
|
||||
dwData = IntPtr.Zero,
|
||||
lpData = message,
|
||||
cbData = messageBytes.Length + 1 /* +1 because of \0 string termination */
|
||||
};
|
||||
|
||||
if (SendMessage(hwnd, WM_COPYDATA, IntPtr.Zero, ref data) != 0)
|
||||
{
|
||||
throw new Win32Exception(Marshal.GetLastWin32Error());
|
||||
}
|
||||
}
|
||||
|
||||
[DllImport("user32.dll")]
|
||||
public static extern bool SetForegroundWindow(IntPtr hWnd);
|
||||
|
||||
[DllImport("User32.dll", EntryPoint = "SendMessage")]
|
||||
private static extern int SendMessage(IntPtr hWnd, int Msg, IntPtr wParam, ref CopyDataStruct lParam);
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
private struct CopyDataStruct
|
||||
{
|
||||
public IntPtr dwData;
|
||||
public int cbData;
|
||||
|
||||
[MarshalAs(UnmanagedType.LPWStr)]
|
||||
public string lpData;
|
||||
}
|
||||
}
|
||||
}
|
||||
105
Source/LogDashboard/LogDashboard.UI/LogDashboard.UI.csproj
Normal file
105
Source/LogDashboard/LogDashboard.UI/LogDashboard.UI.csproj
Normal file
@@ -0,0 +1,105 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net48</TargetFramework>
|
||||
<AssemblyName>Raytheon.LogDashboard</AssemblyName>
|
||||
<RootNamespace>Raytheon.LogDashboard</RootNamespace>
|
||||
<Company>Raytheon Technologies</Company>
|
||||
<Product>Logging Dashboard Application</Product>
|
||||
<Authors>Specialty Engineering</Authors>
|
||||
<Copyright>Raytheon Technologies</Copyright>
|
||||
<Version>1.3.10</Version>
|
||||
<AssemblyVersion>$(Version)</AssemblyVersion>
|
||||
<FileVersion>$(Version)</FileVersion>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<UseWPF>true</UseWPF>
|
||||
<ApplicationIcon>Resources\LogDashboard.ico</ApplicationIcon>
|
||||
<DeploymentFolder>$(SolutionDir)_Deployment\</DeploymentFolder>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Remove="Resources\rt_logo_30h.png" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Include="Resources\LogDashboard.ico">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="MahApps.Metro" Version="2.4.10" />
|
||||
<PackageReference Include="MahApps.Metro.Resources" Version="0.6.1" />
|
||||
<PackageReference Include="MvvmLight" Version="5.4.1.1" />
|
||||
<PackageReference Include="NLog" Version="5.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\LogDashboard\LogDashboard.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Reference Include="PresentationCore" />
|
||||
<Reference Include="PresentationFramework" />
|
||||
<Reference Include="System.Deployment" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Windows.Interactivity" />
|
||||
<Reference Include="System.ServiceModel" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Update="Properties\Settings.Designer.cs">
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Update="Resources\Resource1.Designer.cs">
|
||||
<DesignTime>True</DesignTime>
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Resource1.resx</DependentUpon>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Resource Include="Resources\rt_logo_30h.png" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Update="Resources\Resource1.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resource1.Designer.cs</LastGenOutput>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Update="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||
</None>
|
||||
<None Update="Properties\Resources.resx">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
</None>
|
||||
<None Update="Properties\Locals.resx">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Locals.Designer.cs</LastGenOutput>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
<Target Name="CopyFilesToDeploymentDir" AfterTargets="AfterBuild">
|
||||
<ItemGroup>
|
||||
<FILES_1 Include="$(OutDir)*.dll" />
|
||||
<FILES_2 Include="$(TargetPath)" />
|
||||
</ItemGroup>
|
||||
<Copy SourceFiles="@(FILES_1)" DestinationFolder="$(DeploymentFolder)" />
|
||||
<Copy SourceFiles="@(FILES_2)" DestinationFolder="$(DeploymentFolder)" />
|
||||
</Target>
|
||||
|
||||
<Target Name="ProjClean" AfterTargets="AfterClean">
|
||||
<RemoveDir Directories="$(DeploymentFolder)" />
|
||||
</Target>
|
||||
|
||||
</Project>
|
||||
134
Source/LogDashboard/LogDashboard.UI/Properties/Settings.Designer.cs
generated
Normal file
134
Source/LogDashboard/LogDashboard.UI/Properties/Settings.Designer.cs
generated
Normal file
@@ -0,0 +1,134 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Raytheon.LogDashboard.Properties {
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.13.0.0")]
|
||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
|
||||
|
||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||
|
||||
public static Settings Default {
|
||||
get {
|
||||
return defaultInstance;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("600")]
|
||||
public double CurrentWindowHeight {
|
||||
get {
|
||||
return ((double)(this["CurrentWindowHeight"]));
|
||||
}
|
||||
set {
|
||||
this["CurrentWindowHeight"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("600")]
|
||||
public double PreviousWindowHeight {
|
||||
get {
|
||||
return ((double)(this["PreviousWindowHeight"]));
|
||||
}
|
||||
set {
|
||||
this["PreviousWindowHeight"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("800")]
|
||||
public double CurrentWindowWidth {
|
||||
get {
|
||||
return ((double)(this["CurrentWindowWidth"]));
|
||||
}
|
||||
set {
|
||||
this["CurrentWindowWidth"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("800")]
|
||||
public double PreviousWindowWidth {
|
||||
get {
|
||||
return ((double)(this["PreviousWindowWidth"]));
|
||||
}
|
||||
set {
|
||||
this["PreviousWindowWidth"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("100")]
|
||||
public double CurrentWindowLeft {
|
||||
get {
|
||||
return ((double)(this["CurrentWindowLeft"]));
|
||||
}
|
||||
set {
|
||||
this["CurrentWindowLeft"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("100")]
|
||||
public double PreviousWindowLeft {
|
||||
get {
|
||||
return ((double)(this["PreviousWindowLeft"]));
|
||||
}
|
||||
set {
|
||||
this["PreviousWindowLeft"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("100")]
|
||||
public double CurrentWindowTop {
|
||||
get {
|
||||
return ((double)(this["CurrentWindowTop"]));
|
||||
}
|
||||
set {
|
||||
this["CurrentWindowTop"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("100")]
|
||||
public double PreviousWindowTop {
|
||||
get {
|
||||
return ((double)(this["PreviousWindowTop"]));
|
||||
}
|
||||
set {
|
||||
this["PreviousWindowTop"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("./LogDashboard.xml")]
|
||||
public string SettingsPath {
|
||||
get {
|
||||
return ((string)(this["SettingsPath"]));
|
||||
}
|
||||
set {
|
||||
this["SettingsPath"] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="Raytheon.LogDashboard.Properties" GeneratedClassName="Settings">
|
||||
<Profiles />
|
||||
<Settings>
|
||||
<Setting Name="CurrentWindowHeight" Type="System.Double" Scope="User">
|
||||
<Value Profile="(Default)">600</Value>
|
||||
</Setting>
|
||||
<Setting Name="PreviousWindowHeight" Type="System.Double" Scope="User">
|
||||
<Value Profile="(Default)">600</Value>
|
||||
</Setting>
|
||||
<Setting Name="CurrentWindowWidth" Type="System.Double" Scope="User">
|
||||
<Value Profile="(Default)">800</Value>
|
||||
</Setting>
|
||||
<Setting Name="PreviousWindowWidth" Type="System.Double" Scope="User">
|
||||
<Value Profile="(Default)">800</Value>
|
||||
</Setting>
|
||||
<Setting Name="CurrentWindowLeft" Type="System.Double" Scope="User">
|
||||
<Value Profile="(Default)">100</Value>
|
||||
</Setting>
|
||||
<Setting Name="PreviousWindowLeft" Type="System.Double" Scope="User">
|
||||
<Value Profile="(Default)">100</Value>
|
||||
</Setting>
|
||||
<Setting Name="CurrentWindowTop" Type="System.Double" Scope="User">
|
||||
<Value Profile="(Default)">100</Value>
|
||||
</Setting>
|
||||
<Setting Name="PreviousWindowTop" Type="System.Double" Scope="User">
|
||||
<Value Profile="(Default)">100</Value>
|
||||
</Setting>
|
||||
<Setting Name="SettingsPath" Type="System.String" Scope="User">
|
||||
<Value Profile="(Default)">./LogDashboard.xml</Value>
|
||||
</Setting>
|
||||
</Settings>
|
||||
</SettingsFile>
|
||||
BIN
Source/LogDashboard/LogDashboard.UI/Resources/LogDashboard.ico
Normal file
BIN
Source/LogDashboard/LogDashboard.UI/Resources/LogDashboard.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 41 KiB |
73
Source/LogDashboard/LogDashboard.UI/Resources/Resource1.Designer.cs
generated
Normal file
73
Source/LogDashboard/LogDashboard.UI/Resources/Resource1.Designer.cs
generated
Normal file
@@ -0,0 +1,73 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Raytheon.LogDashboard.Resources {
|
||||
using System;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// A strongly-typed resource class, for looking up localized strings, etc.
|
||||
/// </summary>
|
||||
// This class was auto-generated by the StronglyTypedResourceBuilder
|
||||
// class via a tool like ResGen or Visual Studio.
|
||||
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||
// with the /str option, or rebuild your VS project.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Resource1 {
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal Resource1() {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the cached ResourceManager instance used by this class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||
get {
|
||||
if (object.ReferenceEquals(resourceMan, null)) {
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Raytheon.LogDashboard.Resources.Resource1", typeof(Resource1).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Overrides the current thread's CurrentUICulture property for all
|
||||
/// resource lookups using this strongly typed resource class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture {
|
||||
get {
|
||||
return resourceCulture;
|
||||
}
|
||||
set {
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
|
||||
/// </summary>
|
||||
internal static System.Drawing.Icon LogDashboard {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("LogDashboard", resourceCulture);
|
||||
return ((System.Drawing.Icon)(obj));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
124
Source/LogDashboard/LogDashboard.UI/Resources/Resource1.resx
Normal file
124
Source/LogDashboard/LogDashboard.UI/Resources/Resource1.resx
Normal file
@@ -0,0 +1,124 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<data name="LogDashboard" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>LogDashboard.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
</root>
|
||||
BIN
Source/LogDashboard/LogDashboard.UI/Resources/rt_logo_30h.png
Normal file
BIN
Source/LogDashboard/LogDashboard.UI/Resources/rt_logo_30h.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 40 KiB |
105
Source/LogDashboard/LogDashboard.UI/View/MainWindow.xaml
Normal file
105
Source/LogDashboard/LogDashboard.UI/View/MainWindow.xaml
Normal file
@@ -0,0 +1,105 @@
|
||||
<!--
|
||||
MainWindow.xaml
|
||||
12/4/2023
|
||||
|
||||
RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
|
||||
PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
|
||||
AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
|
||||
UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
|
||||
RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
|
||||
CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
|
||||
OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
|
||||
COMPANY.
|
||||
|
||||
THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. GOVERNMENT
|
||||
|
||||
UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
|
||||
WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE
|
||||
EXPORT OR DISCLOSURE TO NON-U.S. PERSONS, WHEREVER LOCATED, IS RESTRICTED
|
||||
BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R. SECTION
|
||||
120-130) OR THE EXPORT ADMINISTRATION REGULATIONS (EAR) (15 C.F.R. SECTION
|
||||
730-774). THIS DOCUMENT CANNOT BE EXPORTED (E.G., PROVIDED TO A SUPPLIER
|
||||
OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S. PERSON, WHEREVER
|
||||
LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS
|
||||
BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S. GOVERNMENT
|
||||
APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL
|
||||
PENALTIES.
|
||||
|
||||
DOD 5220.22-M, INDUSTRIAL SECURITY MANUAL, CHAPTER 5, SECTION 1 THROUGH 9 :
|
||||
FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN OR DOD 5200.1-R,
|
||||
INFORMATION SECURITY PROGRAM, CHAPTER 6. FOR UNCLASSIFIED, LIMITED DOCUMENTS
|
||||
DESTROY BY ANY METHOD THAT WILL PREVENT DISCLOSURE OF CONTENTS OR
|
||||
RECONSTRUCTION OF THE DOCUMENT.
|
||||
POC: Alex Kravchenko (1118268)
|
||||
-->
|
||||
<mah:MetroWindow x:Class="Raytheon.LogDashboard.View.MainWindow"
|
||||
xmlns:mah="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:ctrl="clr-namespace:Raytheon.LogDashboard.View;assembly=Raytheon.LogDashboardLib"
|
||||
xmlns:Dialog="clr-namespace:MahApps.Metro.Controls.Dialogs;assembly=MahApps.Metro"
|
||||
DataContext="{Binding Main, Source={StaticResource Locator}}"
|
||||
Dialog:DialogParticipation.Register="{Binding}"
|
||||
WindowTitleBrush="{Binding IconColor}"
|
||||
mc:Ignorable="d"
|
||||
Title="Common Platforms Log Dashboard"
|
||||
ResizeMode="CanResizeWithGrip"
|
||||
Closing="MetroWindow_Closing"
|
||||
Height="{Binding CurrentWindowHeight, Mode=TwoWay}"
|
||||
Width="{Binding CurrentWindowWidth, Mode=TwoWay}"
|
||||
Left="{Binding CurrentWindowLeft, Mode=TwoWay}"
|
||||
Top="{Binding CurrentWindowTop, Mode=TwoWay}"
|
||||
Icon="/Resources/rt_logo_30h.png"
|
||||
Loaded="MainWindow_OnLoaded">
|
||||
|
||||
<mah:MetroWindow.Flyouts>
|
||||
<mah:FlyoutsControl>
|
||||
<mah:FlyoutsControl.ItemContainerStyle>
|
||||
<Style TargetType="{x:Type mah:Flyout}">
|
||||
<Setter Property="RenderTransform" Value="{x:Null}"></Setter>
|
||||
<Setter Property="AreAnimationsEnabled" Value="True" />
|
||||
<Setter Property="AnimateOpacity" Value="True" />
|
||||
<Setter Property="Theme" Value="Adapt" />
|
||||
<Setter Property="Position" Value="Right" />
|
||||
</Style>
|
||||
</mah:FlyoutsControl.ItemContainerStyle>
|
||||
|
||||
<mah:Flyout Header="Settings"
|
||||
MinWidth="600"
|
||||
Theme="Adapt"
|
||||
IsOpen="{Binding LogDashboard.ShowSettings, Source={StaticResource LogDashLocator}}">
|
||||
|
||||
<mah:MetroContentControl Margin="0,0,20,0">
|
||||
<ctrl:SettingsCtrl DataContext="{Binding Settings, Source={StaticResource LogDashLocator}}" />
|
||||
</mah:MetroContentControl>
|
||||
|
||||
</mah:Flyout>
|
||||
|
||||
<mah:Flyout Header="Search Namespaces"
|
||||
Theme="Adapt"
|
||||
MinWidth="400"
|
||||
IsOpen="{Binding LogDashboard.ShowTree, Source={StaticResource Locator}}">
|
||||
|
||||
<mah:MetroContentControl Margin="0,0,60,0">
|
||||
<ctrl:SidebarTreeView DataContext="{Binding LogDashboard, Source={StaticResource LogDashLocator}}" />
|
||||
</mah:MetroContentControl>
|
||||
|
||||
</mah:Flyout>
|
||||
|
||||
</mah:FlyoutsControl>
|
||||
|
||||
</mah:MetroWindow.Flyouts>
|
||||
|
||||
<Grid>
|
||||
<mah:MetroContentControl>
|
||||
<ctrl:LogDashboardCtrl DataContext="{Binding LogDashboard, Source={StaticResource Locator}}" />
|
||||
</mah:MetroContentControl>
|
||||
</Grid>
|
||||
|
||||
</mah:MetroWindow>
|
||||
|
||||
|
||||
|
||||
212
Source/LogDashboard/LogDashboard.UI/View/MainWindow.xaml.cs
Normal file
212
Source/LogDashboard/LogDashboard.UI/View/MainWindow.xaml.cs
Normal file
@@ -0,0 +1,212 @@
|
||||
//******************************************************************************//
|
||||
// MainWindow.xaml.cs
|
||||
// 12/4/2023
|
||||
//
|
||||
// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
|
||||
// PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
|
||||
// AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
|
||||
// UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
|
||||
// RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
|
||||
// CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
|
||||
// OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
|
||||
// COMPANY.
|
||||
//
|
||||
// THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. GOVERNMENT
|
||||
//
|
||||
// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
//
|
||||
// WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE
|
||||
// EXPORT OR DISCLOSURE TO NON-U.S. PERSONS, WHEREVER LOCATED, IS RESTRICTED
|
||||
// BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R. SECTION
|
||||
// 120-130) OR THE EXPORT ADMINISTRATION REGULATIONS (EAR) (15 C.F.R. SECTION
|
||||
// 730-774). THIS DOCUMENT CANNOT BE EXPORTED (E.G., PROVIDED TO A SUPPLIER
|
||||
// OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S. PERSON, WHEREVER
|
||||
// LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS
|
||||
// BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S. GOVERNMENT
|
||||
// APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL
|
||||
// PENALTIES.
|
||||
//
|
||||
// DOD 5220.22-M, INDUSTRIAL SECURITY MANUAL, CHAPTER 5, SECTION 1 THROUGH 9 :
|
||||
// FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN OR DOD 5200.1-R,
|
||||
// INFORMATION SECURITY PROGRAM, CHAPTER 6. FOR UNCLASSIFIED, LIMITED DOCUMENTS
|
||||
// DESTROY BY ANY METHOD THAT WILL PREVENT DISCLOSURE OF CONTENTS OR
|
||||
// RECONSTRUCTION OF THE DOCUMENT.
|
||||
// POC: Alex Kravchenko (1118268)
|
||||
//******************************************************************************//
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
using System.Windows.Interop;
|
||||
using System.Windows.Forms;
|
||||
using NLog;
|
||||
using Raytheon.LogDashboard.Helpers;
|
||||
using Raytheon.LogDashboard.ViewModel;
|
||||
using Application = System.Windows.Application;
|
||||
using Raytheon.LogDashboard.Resources;
|
||||
using MahApps.Metro.Controls;
|
||||
using MahApps.Metro.Controls.Dialogs;
|
||||
using GalaSoft.MvvmLight.Messaging;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Raytheon.LogDashboard.View
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for MainWindow.xaml
|
||||
/// </summary>
|
||||
public partial class MainWindow : MetroWindow, IDisposable
|
||||
{
|
||||
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
|
||||
private NotifyIcon trayIcon;
|
||||
|
||||
public MainWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
Loaded += (s, e) =>
|
||||
{
|
||||
WindowHandle = new WindowInteropHelper(Application.Current.MainWindow).Handle;
|
||||
HwndSource.FromHwnd(WindowHandle)?.AddHook(HandleMessages);
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// On Loaded Event
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void MainWindow_OnLoaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (AppDomain.CurrentDomain.SetupInformation.ActivationArguments?.ActivationData != null)
|
||||
{
|
||||
string[] activationData = AppDomain.CurrentDomain.SetupInformation.ActivationArguments.ActivationData;
|
||||
foreach (var arg in activationData.Where(x => x.EndsWith(".txt") || x.EndsWith(".log") || x.EndsWith(".csv")))
|
||||
{
|
||||
ViewModelLocator.LogDashboard.ImportLogs(arg);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
List<string> args = Environment.GetCommandLineArgs().Where(x => x.EndsWith(".txt") || x.EndsWith(".log") || x.EndsWith(".csv")).ToList();
|
||||
if (args.Any())
|
||||
{
|
||||
ViewModelLocator.LogDashboard.ImportLogs(args.Where(x => x.EndsWith(".txt") || x.EndsWith(".log") || x.EndsWith(".csv")));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
#region tray
|
||||
|
||||
protected override void OnStateChanged(EventArgs e)
|
||||
{
|
||||
if (WindowState == WindowState.Minimized && Model.Settings.Instance.MinimizeToTray)
|
||||
{
|
||||
if (trayIcon == null)
|
||||
{
|
||||
trayIcon = new NotifyIcon
|
||||
{
|
||||
Icon = Resource1.LogDashboard,
|
||||
Visible = true,
|
||||
Text = "Log Viewer"
|
||||
};
|
||||
trayIcon.DoubleClick += delegate
|
||||
{
|
||||
Show();
|
||||
WindowState = WindowState.Normal;
|
||||
};
|
||||
|
||||
trayIcon.ContextMenuStrip = new ContextMenuStrip();
|
||||
ToolStripMenuItem openAppMenuItem = new ToolStripMenuItem("Open");
|
||||
ToolStripMenuItem exitAppMenuItem = new ToolStripMenuItem("Exit");
|
||||
|
||||
trayIcon.ContextMenuStrip.Items.AddRange(new ToolStripItem[] { openAppMenuItem, exitAppMenuItem });
|
||||
trayIcon.ContextMenuStrip.ItemClicked += TrayIconContextMenuClick;
|
||||
}
|
||||
Hide();
|
||||
}
|
||||
|
||||
base.OnStateChanged(e);
|
||||
}
|
||||
|
||||
private void TrayIconContextMenuClick(object sender, ToolStripItemClickedEventArgs e)
|
||||
{
|
||||
switch (e.ClickedItem.Text)
|
||||
{
|
||||
case "Open":
|
||||
Show();
|
||||
WindowState = WindowState.Normal;
|
||||
break;
|
||||
case "Exit":
|
||||
Close();
|
||||
Environment.Exit(0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnClosed(EventArgs e)
|
||||
{
|
||||
if (trayIcon != null)
|
||||
{
|
||||
trayIcon.Visible = false;
|
||||
trayIcon.Dispose();
|
||||
trayIcon.Icon = null;
|
||||
}
|
||||
|
||||
base.OnClosed(e);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region param transfer
|
||||
|
||||
public static IntPtr WindowHandle { get; private set; }
|
||||
|
||||
internal static void HandleParameter(string[] args)
|
||||
{
|
||||
if (Application.Current?.MainWindow is MainWindow mainWindow &&
|
||||
args != null && args.Length > 0 && args.All(x => x.EndsWith(".txt") || x.EndsWith(".log") || x.EndsWith(".csv")))
|
||||
{
|
||||
ViewModelLocator.LogDashboard.ImportLogs(args.First());
|
||||
}
|
||||
}
|
||||
|
||||
private static IntPtr HandleMessages(IntPtr handle, int message, IntPtr wParameter, IntPtr lParameter, ref Boolean handled)
|
||||
{
|
||||
string data = UnsafeNative.GetMessage(message, lParameter);
|
||||
|
||||
if (data != null)
|
||||
{
|
||||
if(Application.Current.MainWindow == null)
|
||||
{
|
||||
return IntPtr.Zero;
|
||||
}
|
||||
|
||||
if(Application.Current.MainWindow.WindowState == WindowState.Minimized)
|
||||
{
|
||||
Application.Current.MainWindow.WindowState = WindowState.Normal;
|
||||
}
|
||||
|
||||
UnsafeNative.SetForegroundWindow(new WindowInteropHelper(Application.Current.MainWindow).Handle);
|
||||
|
||||
string[] args = data.Split(' ');
|
||||
HandleParameter(args);
|
||||
handled = true;
|
||||
}
|
||||
|
||||
return IntPtr.Zero;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
trayIcon?.Dispose();
|
||||
}
|
||||
|
||||
private void MetroWindow_Closing(object sender, CancelEventArgs e)
|
||||
{
|
||||
ViewModelLocator.LogDashboard.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,167 @@
|
||||
//******************************************************************************//
|
||||
// MainWindowViewModel.cs
|
||||
// 12/4/2023
|
||||
//
|
||||
// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
|
||||
// PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
|
||||
// AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
|
||||
// UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
|
||||
// RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
|
||||
// CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
|
||||
// OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
|
||||
// COMPANY.
|
||||
//
|
||||
// THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. GOVERNMENT
|
||||
//
|
||||
// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
//
|
||||
// WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE
|
||||
// EXPORT OR DISCLOSURE TO NON-U.S. PERSONS, WHEREVER LOCATED, IS RESTRICTED
|
||||
// BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R. SECTION
|
||||
// 120-130) OR THE EXPORT ADMINISTRATION REGULATIONS (EAR) (15 C.F.R. SECTION
|
||||
// 730-774). THIS DOCUMENT CANNOT BE EXPORTED (E.G., PROVIDED TO A SUPPLIER
|
||||
// OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S. PERSON, WHEREVER
|
||||
// LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS
|
||||
// BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S. GOVERNMENT
|
||||
// APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL
|
||||
// PENALTIES.
|
||||
//
|
||||
// DOD 5220.22-M, INDUSTRIAL SECURITY MANUAL, CHAPTER 5, SECTION 1 THROUGH 9 :
|
||||
// FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN OR DOD 5200.1-R,
|
||||
// INFORMATION SECURITY PROGRAM, CHAPTER 6. FOR UNCLASSIFIED, LIMITED DOCUMENTS
|
||||
// DESTROY BY ANY METHOD THAT WILL PREVENT DISCLOSURE OF CONTENTS OR
|
||||
// RECONSTRUCTION OF THE DOCUMENT.
|
||||
// POC: Alex Kravchenko (1118268)
|
||||
//******************************************************************************//
|
||||
using ControlzEx.Theming;
|
||||
using GalaSoft.MvvmLight;
|
||||
using GalaSoft.MvvmLight.Messaging;
|
||||
using MahApps.Metro.Controls.Dialogs;
|
||||
using System.Windows;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace Raytheon.LogDashboard.ViewModel
|
||||
{
|
||||
public class MainWindowViewModel : ViewModelBase
|
||||
{
|
||||
protected static LogDashViewModelLocator LocatorInstance;
|
||||
private IDialogCoordinator _dialogCoordinator;
|
||||
|
||||
public MainWindowViewModel(IDialogCoordinator instance)
|
||||
{
|
||||
_dialogCoordinator = instance;
|
||||
|
||||
Messenger.Default.Register<string>(this, "ColorChange", ColorChangeHandler);
|
||||
Messenger.Default.Register<string>(this, "ThemeChange", ThemeChangeHandler);
|
||||
|
||||
Messenger.Default.Register<string>(this, "DisplayCustomMessage", DisplayCustomMessageHandler);
|
||||
|
||||
LocatorInstance = (Application.Current.Resources["LogDashLocator"] as LogDashViewModelLocator);
|
||||
}
|
||||
|
||||
private void ThemeChangeHandler(string theme)
|
||||
{
|
||||
if(!string.IsNullOrEmpty(theme))
|
||||
{
|
||||
if(theme.Contains("Dark"))
|
||||
{
|
||||
ThemeManager.Current.ChangeThemeBaseColor(Application.Current.MainWindow, "Dark");
|
||||
}
|
||||
else
|
||||
{
|
||||
ThemeManager.Current.ChangeThemeBaseColor(Application.Current.MainWindow, "Light");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ColorChangeHandler(string selectedColor)
|
||||
{
|
||||
if(!string.IsNullOrEmpty(selectedColor) && Application.Current.MainWindow != null)
|
||||
{
|
||||
ThemeManager.Current.ChangeThemeColorScheme(Application.Current.MainWindow, selectedColor);
|
||||
|
||||
Application.Current.Resources["MahApps.Brushes.ToggleSwitch.FillOn"] = ColorConverter.ConvertFromString(selectedColor);
|
||||
|
||||
RaisePropertyChanged(() => IconColor);
|
||||
}
|
||||
}
|
||||
|
||||
public SolidColorBrush IconColor
|
||||
{
|
||||
get => LocatorInstance.SelectedColorTheme.Color;
|
||||
}
|
||||
|
||||
public static double PreviousWindowHeight
|
||||
{
|
||||
get { return Properties.Settings.Default.PreviousWindowHeight; }
|
||||
set { Properties.Settings.Default.PreviousWindowHeight = value; }
|
||||
}
|
||||
public static double CurrentWindowHeight
|
||||
{
|
||||
get { return Properties.Settings.Default.CurrentWindowHeight; }
|
||||
set
|
||||
{
|
||||
Properties.Settings.Default.PreviousWindowHeight = Properties.Settings.Default.CurrentWindowHeight;
|
||||
Properties.Settings.Default.CurrentWindowHeight = value;
|
||||
Properties.Settings.Default.Save();
|
||||
}
|
||||
}
|
||||
|
||||
public static double PreviousWindowWidth
|
||||
{
|
||||
get { return Properties.Settings.Default.PreviousWindowWidth; }
|
||||
set { Properties.Settings.Default.PreviousWindowWidth = value; }
|
||||
}
|
||||
public static double CurrentWindowWidth
|
||||
{
|
||||
get { return Properties.Settings.Default.CurrentWindowWidth; }
|
||||
set
|
||||
{
|
||||
Properties.Settings.Default.PreviousWindowWidth = Properties.Settings.Default.CurrentWindowWidth;
|
||||
Properties.Settings.Default.CurrentWindowWidth = value;
|
||||
Properties.Settings.Default.Save();
|
||||
}
|
||||
}
|
||||
|
||||
public static double PreviousWindowLeft
|
||||
{
|
||||
get { return Properties.Settings.Default.PreviousWindowLeft; }
|
||||
set { Properties.Settings.Default.PreviousWindowLeft = value; }
|
||||
}
|
||||
public static double CurrentWindowLeft
|
||||
{
|
||||
get { return Properties.Settings.Default.CurrentWindowLeft; }
|
||||
set
|
||||
{
|
||||
Properties.Settings.Default.PreviousWindowLeft = Properties.Settings.Default.CurrentWindowLeft;
|
||||
Properties.Settings.Default.CurrentWindowLeft = value;
|
||||
Properties.Settings.Default.Save();
|
||||
}
|
||||
}
|
||||
|
||||
public static double PreviousWindowTop
|
||||
{
|
||||
get { return Properties.Settings.Default.PreviousWindowTop; }
|
||||
set { Properties.Settings.Default.PreviousWindowTop = value; }
|
||||
}
|
||||
public static double CurrentWindowTop
|
||||
{
|
||||
get { return Properties.Settings.Default.CurrentWindowTop; }
|
||||
set
|
||||
{
|
||||
Properties.Settings.Default.PreviousWindowTop = Properties.Settings.Default.CurrentWindowTop;
|
||||
Properties.Settings.Default.CurrentWindowTop = value;
|
||||
Properties.Settings.Default.Save();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// handles custom message with single Okay button
|
||||
/// </summary>
|
||||
/// <param name="message"></param>
|
||||
private async void DisplayCustomMessageHandler(string message)
|
||||
{
|
||||
await _dialogCoordinator.ShowMessageAsync(this, "Log Dashboard", message).ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
//******************************************************************************//
|
||||
// ViewModelLocator.cs
|
||||
// 12/4/2023
|
||||
//
|
||||
// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
|
||||
// PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
|
||||
// AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
|
||||
// UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
|
||||
// RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
|
||||
// CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
|
||||
// OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
|
||||
// COMPANY.
|
||||
//
|
||||
// THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. GOVERNMENT
|
||||
//
|
||||
// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
//
|
||||
// WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE
|
||||
// EXPORT OR DISCLOSURE TO NON-U.S. PERSONS, WHEREVER LOCATED, IS RESTRICTED
|
||||
// BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R. SECTION
|
||||
// 120-130) OR THE EXPORT ADMINISTRATION REGULATIONS (EAR) (15 C.F.R. SECTION
|
||||
// 730-774). THIS DOCUMENT CANNOT BE EXPORTED (E.G., PROVIDED TO A SUPPLIER
|
||||
// OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S. PERSON, WHEREVER
|
||||
// LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS
|
||||
// BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S. GOVERNMENT
|
||||
// APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL
|
||||
// PENALTIES.
|
||||
//
|
||||
// DOD 5220.22-M, INDUSTRIAL SECURITY MANUAL, CHAPTER 5, SECTION 1 THROUGH 9 :
|
||||
// FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN OR DOD 5200.1-R,
|
||||
// INFORMATION SECURITY PROGRAM, CHAPTER 6. FOR UNCLASSIFIED, LIMITED DOCUMENTS
|
||||
// DESTROY BY ANY METHOD THAT WILL PREVENT DISCLOSURE OF CONTENTS OR
|
||||
// RECONSTRUCTION OF THE DOCUMENT.
|
||||
// POC: Alex Kravchenko (1118268)
|
||||
//******************************************************************************//
|
||||
|
||||
// Ignore Spelling: Locator
|
||||
|
||||
using CommonServiceLocator;
|
||||
using GalaSoft.MvvmLight;
|
||||
using GalaSoft.MvvmLight.Ioc;
|
||||
using MahApps.Metro.Controls.Dialogs;
|
||||
|
||||
namespace Raytheon.LogDashboard.ViewModel
|
||||
{
|
||||
public class ViewModelLocator : ViewModelBase
|
||||
{
|
||||
public ViewModelLocator()
|
||||
{
|
||||
ServiceLocator.SetLocatorProvider(() => SimpleIoc.Default);
|
||||
|
||||
SimpleIoc.Default.Register(() => new MainWindowViewModel(DialogCoordinator.Instance));
|
||||
SimpleIoc.Default.Register<LogDashboardViewModel>();
|
||||
}
|
||||
public static MainWindowViewModel Main => ServiceLocator.Current.GetInstance<MainWindowViewModel>();
|
||||
public static LogDashboardViewModel LogDashboard => ServiceLocator.Current.GetInstance<LogDashboardViewModel>();
|
||||
}
|
||||
}
|
||||
36
Source/LogDashboard/LogDashboard.sln
Normal file
36
Source/LogDashboard/LogDashboard.sln
Normal file
@@ -0,0 +1,36 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.6.33801.468
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{99AAB3BD-FA07-44B0-AEFE-8C3424A773CC}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
LogDashboard.sln.licenseheader = LogDashboard.sln.licenseheader
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LogDashboard.UI", "LogDashboard.UI\LogDashboard.UI.csproj", "{AF3B84E0-E237-44F3-9043-26D571F8B31D}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LogDashboard", "LogDashboard\LogDashboard.csproj", "{66F98C3C-539E-4A4F-AF39-DF2A62AD1C5C}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{AF3B84E0-E237-44F3-9043-26D571F8B31D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{AF3B84E0-E237-44F3-9043-26D571F8B31D}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{AF3B84E0-E237-44F3-9043-26D571F8B31D}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{AF3B84E0-E237-44F3-9043-26D571F8B31D}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{66F98C3C-539E-4A4F-AF39-DF2A62AD1C5C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{66F98C3C-539E-4A4F-AF39-DF2A62AD1C5C}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{66F98C3C-539E-4A4F-AF39-DF2A62AD1C5C}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{66F98C3C-539E-4A4F-AF39-DF2A62AD1C5C}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {2F4122A7-E92D-4788-BD7F-12983BC7718A}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
79
Source/LogDashboard/LogDashboard.sln.licenseheader
Normal file
79
Source/LogDashboard/LogDashboard.sln.licenseheader
Normal file
@@ -0,0 +1,79 @@
|
||||
extensions: designer.cs generated.cs
|
||||
extensions: .cs .cpp .h
|
||||
//******************************************************************************//
|
||||
// %FileName%
|
||||
// %CurrentMonth%/%CurrentDay%/%CurrentYear%
|
||||
//
|
||||
// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
|
||||
// PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
|
||||
// AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
|
||||
// UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
|
||||
// RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
|
||||
// CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
|
||||
// OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
|
||||
// COMPANY.
|
||||
//
|
||||
// THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. GOVERNMENT
|
||||
//
|
||||
// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
//
|
||||
// WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE
|
||||
// EXPORT OR DISCLOSURE TO NON-U.S. PERSONS, WHEREVER LOCATED, IS RESTRICTED
|
||||
// BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R. SECTION
|
||||
// 120-130) OR THE EXPORT ADMINISTRATION REGULATIONS (EAR) (15 C.F.R. SECTION
|
||||
// 730-774). THIS DOCUMENT CANNOT BE EXPORTED (E.G., PROVIDED TO A SUPPLIER
|
||||
// OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S. PERSON, WHEREVER
|
||||
// LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS
|
||||
// BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S. GOVERNMENT
|
||||
// APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL
|
||||
// PENALTIES.
|
||||
//
|
||||
// DOD 5220.22-M, INDUSTRIAL SECURITY MANUAL, CHAPTER 5, SECTION 1 THROUGH 9 :
|
||||
// FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN OR DOD 5200.1-R,
|
||||
// INFORMATION SECURITY PROGRAM, CHAPTER 6. FOR UNCLASSIFIED, LIMITED DOCUMENTS
|
||||
// DESTROY BY ANY METHOD THAT WILL PREVENT DISCLOSURE OF CONTENTS OR
|
||||
// RECONSTRUCTION OF THE DOCUMENT.
|
||||
// POC: %UserDisplayName% (%UserName%)
|
||||
//******************************************************************************//
|
||||
extensions: .aspx .ascx
|
||||
<%--
|
||||
COPYRIGHT RAYTHEON COMPANY
|
||||
--%>
|
||||
extensions: .vb
|
||||
'Sample license text.
|
||||
extensions: .xaml .xml .config .xsd
|
||||
<!--
|
||||
%FileName%
|
||||
%CurrentMonth%/%CurrentDay%/%CurrentYear%
|
||||
|
||||
RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
|
||||
PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
|
||||
AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
|
||||
UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
|
||||
RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
|
||||
CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
|
||||
OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
|
||||
COMPANY.
|
||||
|
||||
THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. GOVERNMENT
|
||||
|
||||
UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
|
||||
WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE
|
||||
EXPORT OR DISCLOSURE TO NON-U.S. PERSONS, WHEREVER LOCATED, IS RESTRICTED
|
||||
BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R. SECTION
|
||||
120-130) OR THE EXPORT ADMINISTRATION REGULATIONS (EAR) (15 C.F.R. SECTION
|
||||
730-774). THIS DOCUMENT CANNOT BE EXPORTED (E.G., PROVIDED TO A SUPPLIER
|
||||
OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S. PERSON, WHEREVER
|
||||
LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS
|
||||
BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S. GOVERNMENT
|
||||
APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL
|
||||
PENALTIES.
|
||||
|
||||
DOD 5220.22-M, INDUSTRIAL SECURITY MANUAL, CHAPTER 5, SECTION 1 THROUGH 9 :
|
||||
FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN OR DOD 5200.1-R,
|
||||
INFORMATION SECURITY PROGRAM, CHAPTER 6. FOR UNCLASSIFIED, LIMITED DOCUMENTS
|
||||
DESTROY BY ANY METHOD THAT WILL PREVENT DISCLOSURE OF CONTENTS OR
|
||||
RECONSTRUCTION OF THE DOCUMENT.
|
||||
POC: %UserDisplayName% (%UserName%)
|
||||
-->
|
||||
@@ -0,0 +1,59 @@
|
||||
//******************************************************************************//
|
||||
// CountToVisibilityConverter.cs
|
||||
// 12/4/2023
|
||||
//
|
||||
// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
|
||||
// PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
|
||||
// AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
|
||||
// UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
|
||||
// RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
|
||||
// CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
|
||||
// OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
|
||||
// COMPANY.
|
||||
//
|
||||
// THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. GOVERNMENT
|
||||
//
|
||||
// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
//
|
||||
// WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE
|
||||
// EXPORT OR DISCLOSURE TO NON-U.S. PERSONS, WHEREVER LOCATED, IS RESTRICTED
|
||||
// BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R. SECTION
|
||||
// 120-130) OR THE EXPORT ADMINISTRATION REGULATIONS (EAR) (15 C.F.R. SECTION
|
||||
// 730-774). THIS DOCUMENT CANNOT BE EXPORTED (E.G., PROVIDED TO A SUPPLIER
|
||||
// OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S. PERSON, WHEREVER
|
||||
// LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS
|
||||
// BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S. GOVERNMENT
|
||||
// APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL
|
||||
// PENALTIES.
|
||||
//
|
||||
// DOD 5220.22-M, INDUSTRIAL SECURITY MANUAL, CHAPTER 5, SECTION 1 THROUGH 9 :
|
||||
// FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN OR DOD 5200.1-R,
|
||||
// INFORMATION SECURITY PROGRAM, CHAPTER 6. FOR UNCLASSIFIED, LIMITED DOCUMENTS
|
||||
// DESTROY BY ANY METHOD THAT WILL PREVENT DISCLOSURE OF CONTENTS OR
|
||||
// RECONSTRUCTION OF THE DOCUMENT.
|
||||
// POC: Alex Kravchenko (1118268)
|
||||
//******************************************************************************//
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Windows.Data;
|
||||
using System.Windows;
|
||||
|
||||
namespace Raytheon.LogDashboard.Converters
|
||||
{
|
||||
public class CountToVisibilityConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
if (value is int count)
|
||||
{
|
||||
return count > 0 ? Visibility.Visible : Visibility.Collapsed;
|
||||
}
|
||||
return Visibility.Visible;
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
63
Source/LogDashboard/LogDashboard/Converters/DataConverter.cs
Normal file
63
Source/LogDashboard/LogDashboard/Converters/DataConverter.cs
Normal file
@@ -0,0 +1,63 @@
|
||||
//******************************************************************************//
|
||||
// DataConverter.cs
|
||||
// 12/4/2023
|
||||
//
|
||||
// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
|
||||
// PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
|
||||
// AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
|
||||
// UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
|
||||
// RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
|
||||
// CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
|
||||
// OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
|
||||
// COMPANY.
|
||||
//
|
||||
// THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. GOVERNMENT
|
||||
//
|
||||
// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
//
|
||||
// WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE
|
||||
// EXPORT OR DISCLOSURE TO NON-U.S. PERSONS, WHEREVER LOCATED, IS RESTRICTED
|
||||
// BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R. SECTION
|
||||
// 120-130) OR THE EXPORT ADMINISTRATION REGULATIONS (EAR) (15 C.F.R. SECTION
|
||||
// 730-774). THIS DOCUMENT CANNOT BE EXPORTED (E.G., PROVIDED TO A SUPPLIER
|
||||
// OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S. PERSON, WHEREVER
|
||||
// LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS
|
||||
// BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S. GOVERNMENT
|
||||
// APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL
|
||||
// PENALTIES.
|
||||
//
|
||||
// DOD 5220.22-M, INDUSTRIAL SECURITY MANUAL, CHAPTER 5, SECTION 1 THROUGH 9 :
|
||||
// FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN OR DOD 5200.1-R,
|
||||
// INFORMATION SECURITY PROGRAM, CHAPTER 6. FOR UNCLASSIFIED, LIMITED DOCUMENTS
|
||||
// DESTROY BY ANY METHOD THAT WILL PREVENT DISCLOSURE OF CONTENTS OR
|
||||
// RECONSTRUCTION OF THE DOCUMENT.
|
||||
// POC: Alex Kravchenko (1118268)
|
||||
//******************************************************************************//
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace Raytheon.LogDashboard.Converters
|
||||
{
|
||||
public class DataConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
if(value != null && value is DateTime dateValue)
|
||||
{
|
||||
string dataFormat = Model.Settings.Instance.DataFormat;
|
||||
if(string.IsNullOrEmpty(dataFormat))
|
||||
{
|
||||
return dateValue;
|
||||
}
|
||||
return dateValue.ToString(Model.Settings.Instance.DataFormat);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
//******************************************************************************//
|
||||
// LoggerDisplayConverter.cs
|
||||
// 12/4/2023
|
||||
//
|
||||
// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
|
||||
// PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
|
||||
// AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
|
||||
// UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
|
||||
// RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
|
||||
// CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
|
||||
// OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
|
||||
// COMPANY.
|
||||
//
|
||||
// THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. GOVERNMENT
|
||||
//
|
||||
// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
//
|
||||
// WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE
|
||||
// EXPORT OR DISCLOSURE TO NON-U.S. PERSONS, WHEREVER LOCATED, IS RESTRICTED
|
||||
// BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R. SECTION
|
||||
// 120-130) OR THE EXPORT ADMINISTRATION REGULATIONS (EAR) (15 C.F.R. SECTION
|
||||
// 730-774). THIS DOCUMENT CANNOT BE EXPORTED (E.G., PROVIDED TO A SUPPLIER
|
||||
// OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S. PERSON, WHEREVER
|
||||
// LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS
|
||||
// BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S. GOVERNMENT
|
||||
// APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL
|
||||
// PENALTIES.
|
||||
//
|
||||
// DOD 5220.22-M, INDUSTRIAL SECURITY MANUAL, CHAPTER 5, SECTION 1 THROUGH 9 :
|
||||
// FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN OR DOD 5200.1-R,
|
||||
// INFORMATION SECURITY PROGRAM, CHAPTER 6. FOR UNCLASSIFIED, LIMITED DOCUMENTS
|
||||
// DESTROY BY ANY METHOD THAT WILL PREVENT DISCLOSURE OF CONTENTS OR
|
||||
// RECONSTRUCTION OF THE DOCUMENT.
|
||||
// POC: Alex Kravchenko (1118268)
|
||||
//******************************************************************************//
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace Raytheon.LogDashboard.Converters
|
||||
{
|
||||
public class LoggerDisplayConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
if(value != null && value is string strValue && !string.IsNullOrEmpty(strValue))
|
||||
{
|
||||
if(strValue.Split('.').Length > 0)
|
||||
{
|
||||
return strValue.Split('.').Last();
|
||||
}
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
//******************************************************************************//
|
||||
// MaxLengthConverter.cs
|
||||
// 12/4/2023
|
||||
//
|
||||
// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
|
||||
// PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
|
||||
// AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
|
||||
// UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
|
||||
// RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
|
||||
// CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
|
||||
// OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
|
||||
// COMPANY.
|
||||
//
|
||||
// THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. GOVERNMENT
|
||||
//
|
||||
// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
//
|
||||
// WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE
|
||||
// EXPORT OR DISCLOSURE TO NON-U.S. PERSONS, WHEREVER LOCATED, IS RESTRICTED
|
||||
// BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R. SECTION
|
||||
// 120-130) OR THE EXPORT ADMINISTRATION REGULATIONS (EAR) (15 C.F.R. SECTION
|
||||
// 730-774). THIS DOCUMENT CANNOT BE EXPORTED (E.G., PROVIDED TO A SUPPLIER
|
||||
// OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S. PERSON, WHEREVER
|
||||
// LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS
|
||||
// BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S. GOVERNMENT
|
||||
// APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL
|
||||
// PENALTIES.
|
||||
//
|
||||
// DOD 5220.22-M, INDUSTRIAL SECURITY MANUAL, CHAPTER 5, SECTION 1 THROUGH 9 :
|
||||
// FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN OR DOD 5200.1-R,
|
||||
// INFORMATION SECURITY PROGRAM, CHAPTER 6. FOR UNCLASSIFIED, LIMITED DOCUMENTS
|
||||
// DESTROY BY ANY METHOD THAT WILL PREVENT DISCLOSURE OF CONTENTS OR
|
||||
// RECONSTRUCTION OF THE DOCUMENT.
|
||||
// POC: Alex Kravchenko (1118268)
|
||||
//******************************************************************************//
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace Raytheon.LogDashboard.Converters
|
||||
{
|
||||
public class MaxLengthConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
if(value is string str && !string.IsNullOrEmpty(str) && int.TryParse((string)parameter, out int maxLength))
|
||||
{
|
||||
int indexNewLine = str.IndexOf(Environment.NewLine, StringComparison.Ordinal);
|
||||
if(indexNewLine != -1 && indexNewLine < maxLength)
|
||||
{
|
||||
return str.Substring(0, indexNewLine) + "...";
|
||||
}
|
||||
|
||||
int indexN = str.IndexOf('\n');
|
||||
if(indexN != -1 && indexN < maxLength)
|
||||
{
|
||||
return str.Substring(0, indexN) + "...";
|
||||
}
|
||||
|
||||
if(str.Length > maxLength)
|
||||
{
|
||||
return str.Substring(0, maxLength) + "...";
|
||||
}
|
||||
return str;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
//******************************************************************************//
|
||||
// ProgressStateConverter.cs
|
||||
// 12/4/2023
|
||||
//
|
||||
// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
|
||||
// PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
|
||||
// AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
|
||||
// UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
|
||||
// RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
|
||||
// CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
|
||||
// OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
|
||||
// COMPANY.
|
||||
//
|
||||
// THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. GOVERNMENT
|
||||
//
|
||||
// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
//
|
||||
// WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE
|
||||
// EXPORT OR DISCLOSURE TO NON-U.S. PERSONS, WHEREVER LOCATED, IS RESTRICTED
|
||||
// BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R. SECTION
|
||||
// 120-130) OR THE EXPORT ADMINISTRATION REGULATIONS (EAR) (15 C.F.R. SECTION
|
||||
// 730-774). THIS DOCUMENT CANNOT BE EXPORTED (E.G., PROVIDED TO A SUPPLIER
|
||||
// OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S. PERSON, WHEREVER
|
||||
// LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS
|
||||
// BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S. GOVERNMENT
|
||||
// APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL
|
||||
// PENALTIES.
|
||||
//
|
||||
// DOD 5220.22-M, INDUSTRIAL SECURITY MANUAL, CHAPTER 5, SECTION 1 THROUGH 9 :
|
||||
// FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN OR DOD 5200.1-R,
|
||||
// INFORMATION SECURITY PROGRAM, CHAPTER 6. FOR UNCLASSIFIED, LIMITED DOCUMENTS
|
||||
// DESTROY BY ANY METHOD THAT WILL PREVENT DISCLOSURE OF CONTENTS OR
|
||||
// RECONSTRUCTION OF THE DOCUMENT.
|
||||
// POC: Alex Kravchenko (1118268)
|
||||
//******************************************************************************//
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Shell;
|
||||
|
||||
namespace Raytheon.LogDashboard.Converters
|
||||
{
|
||||
class ProgressStateConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
if (value is bool val)
|
||||
{
|
||||
return val ? TaskbarItemProgressState.Indeterminate : TaskbarItemProgressState.Normal;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
//******************************************************************************//
|
||||
// TreeViewLineConverter.cs
|
||||
// 12/4/2023
|
||||
//
|
||||
// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
|
||||
// PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
|
||||
// AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
|
||||
// UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
|
||||
// RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
|
||||
// CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
|
||||
// OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
|
||||
// COMPANY.
|
||||
//
|
||||
// THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. GOVERNMENT
|
||||
//
|
||||
// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
//
|
||||
// WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE
|
||||
// EXPORT OR DISCLOSURE TO NON-U.S. PERSONS, WHEREVER LOCATED, IS RESTRICTED
|
||||
// BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R. SECTION
|
||||
// 120-130) OR THE EXPORT ADMINISTRATION REGULATIONS (EAR) (15 C.F.R. SECTION
|
||||
// 730-774). THIS DOCUMENT CANNOT BE EXPORTED (E.G., PROVIDED TO A SUPPLIER
|
||||
// OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S. PERSON, WHEREVER
|
||||
// LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS
|
||||
// BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S. GOVERNMENT
|
||||
// APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL
|
||||
// PENALTIES.
|
||||
//
|
||||
// DOD 5220.22-M, INDUSTRIAL SECURITY MANUAL, CHAPTER 5, SECTION 1 THROUGH 9 :
|
||||
// FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN OR DOD 5200.1-R,
|
||||
// INFORMATION SECURITY PROGRAM, CHAPTER 6. FOR UNCLASSIFIED, LIMITED DOCUMENTS
|
||||
// DESTROY BY ANY METHOD THAT WILL PREVENT DISCLOSURE OF CONTENTS OR
|
||||
// RECONSTRUCTION OF THE DOCUMENT.
|
||||
// POC: Alex Kravchenko (1118268)
|
||||
//******************************************************************************//
|
||||
using System;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace Raytheon.LogDashboard.Converters
|
||||
{
|
||||
public class TreeViewLineConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
|
||||
{
|
||||
TreeViewItem item = (TreeViewItem)value;
|
||||
ItemsControl ic = ItemsControl.ItemsControlFromItemContainer(item);
|
||||
return ic.ItemContainerGenerator.IndexFromContainer(item) == ic.Items.Count - 1;
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
|
||||
{
|
||||
throw new Exception("The method or operation is not implemented.");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
//******************************************************************************//
|
||||
// AsyncObservableCollection.cs
|
||||
// 12/4/2023
|
||||
//
|
||||
// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
|
||||
// PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
|
||||
// AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
|
||||
// UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
|
||||
// RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
|
||||
// CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
|
||||
// OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
|
||||
// COMPANY.
|
||||
//
|
||||
// THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. GOVERNMENT
|
||||
//
|
||||
// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
//
|
||||
// WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE
|
||||
// EXPORT OR DISCLOSURE TO NON-U.S. PERSONS, WHEREVER LOCATED, IS RESTRICTED
|
||||
// BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R. SECTION
|
||||
// 120-130) OR THE EXPORT ADMINISTRATION REGULATIONS (EAR) (15 C.F.R. SECTION
|
||||
// 730-774). THIS DOCUMENT CANNOT BE EXPORTED (E.G., PROVIDED TO A SUPPLIER
|
||||
// OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S. PERSON, WHEREVER
|
||||
// LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS
|
||||
// BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S. GOVERNMENT
|
||||
// APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL
|
||||
// PENALTIES.
|
||||
//
|
||||
// DOD 5220.22-M, INDUSTRIAL SECURITY MANUAL, CHAPTER 5, SECTION 1 THROUGH 9 :
|
||||
// FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN OR DOD 5200.1-R,
|
||||
// INFORMATION SECURITY PROGRAM, CHAPTER 6. FOR UNCLASSIFIED, LIMITED DOCUMENTS
|
||||
// DESTROY BY ANY METHOD THAT WILL PREVENT DISCLOSURE OF CONTENTS OR
|
||||
// RECONSTRUCTION OF THE DOCUMENT.
|
||||
// POC: Alex Kravchenko (1118268)
|
||||
//******************************************************************************//
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Collections.Specialized;
|
||||
using System.ComponentModel;
|
||||
using System.Threading;
|
||||
|
||||
namespace Raytheon.LogDashboard.Helpers
|
||||
{
|
||||
public class AsyncObservableCollection<T> : ObservableCollection<T>
|
||||
{
|
||||
private readonly SynchronizationContext synchronizationContext = SynchronizationContext.Current;
|
||||
|
||||
public AsyncObservableCollection()
|
||||
{
|
||||
}
|
||||
|
||||
public AsyncObservableCollection(IEnumerable<T> list)
|
||||
: base(list)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void OnCollectionChanged(NotifyCollectionChangedEventArgs e)
|
||||
{
|
||||
if(SynchronizationContext.Current == synchronizationContext)
|
||||
{
|
||||
// Execute the CollectionChanged event on the current thread
|
||||
RaiseCollectionChanged(e);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Raises the CollectionChanged event on the creator thread
|
||||
synchronizationContext.Send(RaiseCollectionChanged, e);
|
||||
}
|
||||
}
|
||||
|
||||
private void RaiseCollectionChanged(object param)
|
||||
{
|
||||
// We are in the creator thread, call the base implementation directly
|
||||
base.OnCollectionChanged((NotifyCollectionChangedEventArgs)param);
|
||||
}
|
||||
|
||||
protected override void OnPropertyChanged(PropertyChangedEventArgs e)
|
||||
{
|
||||
if(SynchronizationContext.Current == synchronizationContext)
|
||||
{
|
||||
// Execute the PropertyChanged event on the current thread
|
||||
RaisePropertyChanged(e);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Raises the PropertyChanged event on the creator thread
|
||||
synchronizationContext.Send(RaisePropertyChanged, e);
|
||||
}
|
||||
}
|
||||
|
||||
private void RaisePropertyChanged(object param)
|
||||
{
|
||||
// We are in the creator thread, call the base implementation directly
|
||||
base.OnPropertyChanged((PropertyChangedEventArgs)param);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
//******************************************************************************//
|
||||
// BindableSelectedItemBehavior.cs
|
||||
// 12/4/2023
|
||||
//
|
||||
// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
|
||||
// PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
|
||||
// AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
|
||||
// UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
|
||||
// RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
|
||||
// CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
|
||||
// OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
|
||||
// COMPANY.
|
||||
//
|
||||
// THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. GOVERNMENT
|
||||
//
|
||||
// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
//
|
||||
// WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE
|
||||
// EXPORT OR DISCLOSURE TO NON-U.S. PERSONS, WHEREVER LOCATED, IS RESTRICTED
|
||||
// BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R. SECTION
|
||||
// 120-130) OR THE EXPORT ADMINISTRATION REGULATIONS (EAR) (15 C.F.R. SECTION
|
||||
// 730-774). THIS DOCUMENT CANNOT BE EXPORTED (E.G., PROVIDED TO A SUPPLIER
|
||||
// OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S. PERSON, WHEREVER
|
||||
// LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS
|
||||
// BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S. GOVERNMENT
|
||||
// APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL
|
||||
// PENALTIES.
|
||||
//
|
||||
// DOD 5220.22-M, INDUSTRIAL SECURITY MANUAL, CHAPTER 5, SECTION 1 THROUGH 9 :
|
||||
// FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN OR DOD 5200.1-R,
|
||||
// INFORMATION SECURITY PROGRAM, CHAPTER 6. FOR UNCLASSIFIED, LIMITED DOCUMENTS
|
||||
// DESTROY BY ANY METHOD THAT WILL PREVENT DISCLOSURE OF CONTENTS OR
|
||||
// RECONSTRUCTION OF THE DOCUMENT.
|
||||
// POC: Alex Kravchenko (1118268)
|
||||
//******************************************************************************//
|
||||
using System.Windows.Controls;
|
||||
using System.Windows;
|
||||
using System.Windows.Interactivity;
|
||||
|
||||
namespace Raytheon.LogDashboard.Helpers
|
||||
{
|
||||
/// <summary>
|
||||
/// Behavior that makes the
|
||||
/// <see>
|
||||
/// <cref>System.Windows.Controls.TreeView.SelectedItem</cref>
|
||||
/// </see>
|
||||
/// bindable.
|
||||
/// </summary>
|
||||
public class BindableSelectedItemBehavior : Behavior<TreeView>
|
||||
{
|
||||
#region SelectedItem Property
|
||||
|
||||
public object SelectedItem
|
||||
{
|
||||
get => GetValue(SelectedItemProperty);
|
||||
set => SetValue(SelectedItemProperty, value);
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty SelectedItemProperty =
|
||||
DependencyProperty.Register("SelectedItem", typeof(object), typeof(BindableSelectedItemBehavior), new UIPropertyMetadata(null, OnSelectedItemChanged));
|
||||
|
||||
private static void OnSelectedItemChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
TreeViewItem item = e.NewValue as TreeViewItem;
|
||||
item?.SetValue(TreeViewItem.IsSelectedProperty, true);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
protected override void OnAttached()
|
||||
{
|
||||
base.OnAttached();
|
||||
|
||||
AssociatedObject.SelectedItemChanged += OnTreeViewSelectedItemChanged;
|
||||
}
|
||||
|
||||
protected override void OnDetaching()
|
||||
{
|
||||
base.OnDetaching();
|
||||
|
||||
if(AssociatedObject != null)
|
||||
{
|
||||
AssociatedObject.SelectedItemChanged -= OnTreeViewSelectedItemChanged;
|
||||
}
|
||||
}
|
||||
|
||||
private void OnTreeViewSelectedItemChanged(object sender, RoutedPropertyChangedEventArgs<object> e)
|
||||
{
|
||||
SelectedItem = e.NewValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
102
Source/LogDashboard/LogDashboard/Helpers/EnumerationExtension.cs
Normal file
102
Source/LogDashboard/LogDashboard/Helpers/EnumerationExtension.cs
Normal file
@@ -0,0 +1,102 @@
|
||||
//******************************************************************************//
|
||||
// EnumerationExtension.cs
|
||||
// 12/4/2023
|
||||
//
|
||||
// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
|
||||
// PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
|
||||
// AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
|
||||
// UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
|
||||
// RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
|
||||
// CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
|
||||
// OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
|
||||
// COMPANY.
|
||||
//
|
||||
// THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. GOVERNMENT
|
||||
//
|
||||
// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
//
|
||||
// WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE
|
||||
// EXPORT OR DISCLOSURE TO NON-U.S. PERSONS, WHEREVER LOCATED, IS RESTRICTED
|
||||
// BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R. SECTION
|
||||
// 120-130) OR THE EXPORT ADMINISTRATION REGULATIONS (EAR) (15 C.F.R. SECTION
|
||||
// 730-774). THIS DOCUMENT CANNOT BE EXPORTED (E.G., PROVIDED TO A SUPPLIER
|
||||
// OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S. PERSON, WHEREVER
|
||||
// LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS
|
||||
// BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S. GOVERNMENT
|
||||
// APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL
|
||||
// PENALTIES.
|
||||
//
|
||||
// DOD 5220.22-M, INDUSTRIAL SECURITY MANUAL, CHAPTER 5, SECTION 1 THROUGH 9 :
|
||||
// FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN OR DOD 5200.1-R,
|
||||
// INFORMATION SECURITY PROGRAM, CHAPTER 6. FOR UNCLASSIFIED, LIMITED DOCUMENTS
|
||||
// DESTROY BY ANY METHOD THAT WILL PREVENT DISCLOSURE OF CONTENTS OR
|
||||
// RECONSTRUCTION OF THE DOCUMENT.
|
||||
// POC: Alex Kravchenko (1118268)
|
||||
//******************************************************************************//
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Windows.Markup;
|
||||
|
||||
namespace Raytheon.LogDashboard.Helpers
|
||||
{
|
||||
public class EnumerationExtension : MarkupExtension
|
||||
{
|
||||
private Type _enumType;
|
||||
|
||||
|
||||
public EnumerationExtension(Type enumType)
|
||||
{
|
||||
EnumType = enumType ?? throw new ArgumentNullException(nameof(enumType));
|
||||
}
|
||||
|
||||
public Type EnumType
|
||||
{
|
||||
get { return _enumType; }
|
||||
private set
|
||||
{
|
||||
if(_enumType == value)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var enumType = Nullable.GetUnderlyingType(value) ?? value;
|
||||
if(enumType.IsEnum == false)
|
||||
{
|
||||
throw new ArgumentException("Type must be an Enum.");
|
||||
}
|
||||
|
||||
_enumType = value;
|
||||
}
|
||||
}
|
||||
|
||||
public override object ProvideValue(IServiceProvider serviceProvider)
|
||||
{
|
||||
var enumValues = Enum.GetValues(EnumType);
|
||||
|
||||
return (
|
||||
from object enumValue in enumValues
|
||||
select new EnumerationMember
|
||||
{
|
||||
Value = enumValue,
|
||||
Description = GetDescription(enumValue)
|
||||
}).ToArray();
|
||||
}
|
||||
|
||||
private string GetDescription(object enumValue)
|
||||
{
|
||||
return EnumType
|
||||
.GetField(enumValue.ToString())
|
||||
.GetCustomAttributes(typeof(DescriptionAttribute), false)
|
||||
.FirstOrDefault() is DescriptionAttribute descriptionAttribute
|
||||
? descriptionAttribute.Description
|
||||
: enumValue.ToString();
|
||||
}
|
||||
|
||||
public class EnumerationMember
|
||||
{
|
||||
public string Description { get; set; }
|
||||
public object Value { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
280
Source/LogDashboard/LogDashboard/Helpers/ExtensionMethods.cs
Normal file
280
Source/LogDashboard/LogDashboard/Helpers/ExtensionMethods.cs
Normal file
@@ -0,0 +1,280 @@
|
||||
//******************************************************************************//
|
||||
// ExtensionMethods.cs
|
||||
// 12/4/2023
|
||||
//
|
||||
// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
|
||||
// PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
|
||||
// AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
|
||||
// UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
|
||||
// RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
|
||||
// CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
|
||||
// OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
|
||||
// COMPANY.
|
||||
//
|
||||
// THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. GOVERNMENT
|
||||
//
|
||||
// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
//
|
||||
// WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE
|
||||
// EXPORT OR DISCLOSURE TO NON-U.S. PERSONS, WHEREVER LOCATED, IS RESTRICTED
|
||||
// BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R. SECTION
|
||||
// 120-130) OR THE EXPORT ADMINISTRATION REGULATIONS (EAR) (15 C.F.R. SECTION
|
||||
// 730-774). THIS DOCUMENT CANNOT BE EXPORTED (E.G., PROVIDED TO A SUPPLIER
|
||||
// OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S. PERSON, WHEREVER
|
||||
// LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS
|
||||
// BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S. GOVERNMENT
|
||||
// APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL
|
||||
// PENALTIES.
|
||||
//
|
||||
// DOD 5220.22-M, INDUSTRIAL SECURITY MANUAL, CHAPTER 5, SECTION 1 THROUGH 9 :
|
||||
// FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN OR DOD 5200.1-R,
|
||||
// INFORMATION SECURITY PROGRAM, CHAPTER 6. FOR UNCLASSIFIED, LIMITED DOCUMENTS
|
||||
// DESTROY BY ANY METHOD THAT WILL PREVENT DISCLOSURE OF CONTENTS OR
|
||||
// RECONSTRUCTION OF THE DOCUMENT.
|
||||
// POC: Alex Kravchenko (1118268)
|
||||
//******************************************************************************//
|
||||
using Raytheon.LogDashboard.Model;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace Raytheon.LogDashboard.Helpers
|
||||
{
|
||||
public static class ExtensionMethods
|
||||
{
|
||||
/// <summary>
|
||||
/// Checks whether a FileInfo or DirectoryInfo object is a directory, or intended to be a directory.
|
||||
/// </summary>
|
||||
/// <param name="fileSystemInfo"></param>
|
||||
/// <returns></returns>
|
||||
public static bool IsDirectory(this FileSystemInfo fileSystemInfo)
|
||||
{
|
||||
if(fileSystemInfo == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if((int)fileSystemInfo.Attributes != -1)
|
||||
{
|
||||
// if attributes are initialized check the directory flag
|
||||
return fileSystemInfo.Attributes.HasFlag(FileAttributes.Directory);
|
||||
}
|
||||
|
||||
// If we get here the file probably doesn't exist yet. The best we can do is
|
||||
// try to judge intent. Because directories can have extensions and files
|
||||
// can lack them, we can't rely on filename.
|
||||
//
|
||||
// We can reasonably assume that if the path doesn't exist yet and
|
||||
// FileSystemInfo is a DirectoryInfo, a directory is intended. FileInfo can
|
||||
// make a directory, but it would be a bizarre code path.
|
||||
|
||||
return fileSystemInfo is DirectoryInfo;
|
||||
}
|
||||
|
||||
public static string FirstCharToUpper(this string input)
|
||||
{
|
||||
switch(input)
|
||||
{
|
||||
case null:
|
||||
throw new ArgumentNullException(nameof(input));
|
||||
case "":
|
||||
throw new ArgumentException($"{nameof(input)} cannot be empty", nameof(input));
|
||||
default:
|
||||
return input.First().ToString().ToUpper() + input.Substring(1);
|
||||
}
|
||||
}
|
||||
|
||||
public static bool Contains(this string source, string toCheck, StringComparison comp)
|
||||
{
|
||||
return source?.IndexOf(toCheck, comp) >= 0;
|
||||
}
|
||||
|
||||
public static IEnumerable<T> TakeLast<T>(this IEnumerable<T> source, int N)
|
||||
{
|
||||
return source.Skip(Math.Max(0, source.Count() - N));
|
||||
}
|
||||
|
||||
public static IEnumerable<TSource> DistinctBy<TSource, TKey>
|
||||
(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector)
|
||||
{
|
||||
HashSet<TKey> seenKeys = new HashSet<TKey>();
|
||||
foreach(TSource element in source)
|
||||
{
|
||||
if(seenKeys.Add(keySelector(element)))
|
||||
{
|
||||
yield return element;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Convert the Brush to a ARGB - Color.
|
||||
/// </summary>
|
||||
/// <param name="brush">your object</param>
|
||||
/// <returns>
|
||||
/// White = #ffffffff
|
||||
/// Green = #ff00ff00
|
||||
/// </returns>
|
||||
public static string ToARGB(this SolidColorBrush brush)
|
||||
{
|
||||
if(brush == null)
|
||||
{
|
||||
throw new ArgumentNullException();
|
||||
}
|
||||
|
||||
var c = brush.Color;
|
||||
return $"#{c.A:X2}{c.R:X2}{c.G:X2}{c.B:X2}";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// set the current brush to a new color based on the #argb string
|
||||
/// </summary>
|
||||
/// <param name="brush">your object</param>
|
||||
/// <param name="argb">The #ARGB Color</param>
|
||||
/// <returns>the same object as you run the function</returns>
|
||||
public static SolidColorBrush FromARGB(this SolidColorBrush brush, string argb)
|
||||
{
|
||||
if(argb.Length != 9)
|
||||
{
|
||||
throw new FormatException("we need #aarrggbb as color");
|
||||
}
|
||||
|
||||
byte a = Convert.ToByte(int.Parse(argb.Substring(1, 2), NumberStyles.HexNumber));
|
||||
byte r = Convert.ToByte(int.Parse(argb.Substring(3, 2), NumberStyles.HexNumber));
|
||||
byte g = Convert.ToByte(int.Parse(argb.Substring(5, 2), NumberStyles.HexNumber));
|
||||
byte b = Convert.ToByte(int.Parse(argb.Substring(7, 2), NumberStyles.HexNumber));
|
||||
Color c = Color.FromArgb(a, r, g, b);
|
||||
brush.Color = c;
|
||||
return brush;
|
||||
}
|
||||
|
||||
public static HashSet<T> ToHashSet<T>(this IEnumerable<T> source, IEqualityComparer<T> comparer = null)
|
||||
{
|
||||
return new HashSet<T>(source.ToList(), comparer);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// returns true if string contains any of the members in search array
|
||||
/// </summary>
|
||||
/// <param name="line"></param>
|
||||
/// <param name="search"></param>
|
||||
/// <param name="ignoreCase"></param>
|
||||
/// <returns></returns>
|
||||
public static bool ContainsAnyOf(this String line, string[] search, bool ignoreCase = false)
|
||||
{
|
||||
return search.Any(x => ignoreCase ? line.ToUpper().Contains(x.ToUpper()) : line.Contains(x));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// returns true if string contains any of the members in search list patterns
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <param name="patterns"></param>
|
||||
/// <param name="ignoreCase"></param>
|
||||
/// <returns></returns>
|
||||
public static bool ContainsAnyOfPattern(this string input, string[] patterns, bool ignoreCase = false)
|
||||
{
|
||||
foreach(string pattern in patterns)
|
||||
{
|
||||
if(Regex.IsMatch(input, pattern, ignoreCase ? RegexOptions.IgnoreCase : RegexOptions.None))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// does the string begins with regex pattern?
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <param name="pattern"></param>
|
||||
/// <returns></returns>
|
||||
public static bool StartsWithPattern(this string input, string pattern)
|
||||
{
|
||||
if(string.IsNullOrEmpty(input))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return Regex.IsMatch(input, $"^{pattern}");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// truncates DateTime
|
||||
/// </summary>
|
||||
/// <param name="dateTime"></param>
|
||||
/// <param name="timeSpan"></param>
|
||||
/// <returns></returns>
|
||||
public static DateTime Truncate(this DateTime dateTime, TimeSpan timeSpan)
|
||||
{
|
||||
if(timeSpan == TimeSpan.Zero)
|
||||
{
|
||||
return dateTime; // Or could throw an ArgumentException
|
||||
}
|
||||
|
||||
if(dateTime == DateTime.MinValue || dateTime == DateTime.MaxValue)
|
||||
{
|
||||
return dateTime; // do not modify "guard" values
|
||||
}
|
||||
|
||||
return dateTime.AddTicks(-(dateTime.Ticks % timeSpan.Ticks));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// filters log messages from the main list
|
||||
/// </summary>
|
||||
/// <param name="messages"></param>
|
||||
/// <param name="text"></param>
|
||||
/// <param name="matchCase"></param>
|
||||
/// <param name="matchWholeWord"></param>
|
||||
/// <param name="useRegularExp"></param>
|
||||
/// <param name="level"></param>
|
||||
/// <returns></returns>
|
||||
public static IEnumerable<LogMessage> Filter(this IEnumerable<LogMessage> messages,
|
||||
string text,
|
||||
bool matchCase,
|
||||
bool matchWholeWord,
|
||||
bool useRegularExp,
|
||||
DashboardLogLevel level = DashboardLogLevel.Trace)
|
||||
{
|
||||
IEnumerable<LogMessage> searchResult = messages.ToList();
|
||||
|
||||
if(!matchCase && !matchWholeWord)
|
||||
{
|
||||
return searchResult.Where(x => level.HasFlag(x.Level) &&
|
||||
(x.Message.ToUpper().Contains(text, StringComparison.OrdinalIgnoreCase) ||
|
||||
(useRegularExp && Regex.IsMatch(x.Message.ToUpper(), text, RegexOptions.IgnoreCase))));
|
||||
}
|
||||
|
||||
if(matchCase && !matchWholeWord)
|
||||
{
|
||||
return searchResult.Where(x => level.HasFlag(x.Level) && (x.Message.Contains(text) || (useRegularExp && Regex.IsMatch(x.Message, text))));
|
||||
}
|
||||
|
||||
if(matchCase && matchWholeWord)
|
||||
{
|
||||
return searchResult.Where(x => level.HasFlag(x.Level) && (x.Message.Contains($" {text} ") ||
|
||||
x.Message.StartsWith($"{text} ") ||
|
||||
x.Message.EndsWith($" {text}") ||
|
||||
(x.Message.StartsWith(text) && x.Message.EndsWith(text)) ||
|
||||
(useRegularExp && Regex.IsMatch(x.Message, text))));
|
||||
}
|
||||
|
||||
if(!matchCase && matchWholeWord)
|
||||
{
|
||||
return searchResult.Where(x => (level.HasFlag(x.Level) && (x.Message.Contains($" {text} ", StringComparison.OrdinalIgnoreCase) ||
|
||||
x.Message.StartsWith($"{text} ", StringComparison.OrdinalIgnoreCase) ||
|
||||
x.Message.EndsWith($" {text}", StringComparison.OrdinalIgnoreCase) ||
|
||||
(x.Message.StartsWith(text, StringComparison.OrdinalIgnoreCase) &&
|
||||
x.Message.EndsWith(text, StringComparison.OrdinalIgnoreCase)))) ||
|
||||
(useRegularExp && Regex.IsMatch(x.Message.ToUpper(), text, RegexOptions.IgnoreCase)));
|
||||
}
|
||||
|
||||
return searchResult;
|
||||
}
|
||||
}
|
||||
}
|
||||
101
Source/LogDashboard/LogDashboard/Helpers/FileWatcher.cs
Normal file
101
Source/LogDashboard/LogDashboard/Helpers/FileWatcher.cs
Normal file
@@ -0,0 +1,101 @@
|
||||
//******************************************************************************//
|
||||
// FileWatcher.cs
|
||||
// 12/4/2023
|
||||
//
|
||||
// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
|
||||
// PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
|
||||
// AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
|
||||
// UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
|
||||
// RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
|
||||
// CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
|
||||
// OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
|
||||
// COMPANY.
|
||||
//
|
||||
// THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. GOVERNMENT
|
||||
//
|
||||
// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
//
|
||||
// WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE
|
||||
// EXPORT OR DISCLOSURE TO NON-U.S. PERSONS, WHEREVER LOCATED, IS RESTRICTED
|
||||
// BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R. SECTION
|
||||
// 120-130) OR THE EXPORT ADMINISTRATION REGULATIONS (EAR) (15 C.F.R. SECTION
|
||||
// 730-774). THIS DOCUMENT CANNOT BE EXPORTED (E.G., PROVIDED TO A SUPPLIER
|
||||
// OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S. PERSON, WHEREVER
|
||||
// LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS
|
||||
// BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S. GOVERNMENT
|
||||
// APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL
|
||||
// PENALTIES.
|
||||
//
|
||||
// DOD 5220.22-M, INDUSTRIAL SECURITY MANUAL, CHAPTER 5, SECTION 1 THROUGH 9 :
|
||||
// FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN OR DOD 5200.1-R,
|
||||
// INFORMATION SECURITY PROGRAM, CHAPTER 6. FOR UNCLASSIFIED, LIMITED DOCUMENTS
|
||||
// DESTROY BY ANY METHOD THAT WILL PREVENT DISCLOSURE OF CONTENTS OR
|
||||
// RECONSTRUCTION OF THE DOCUMENT.
|
||||
// POC: Alex Kravchenko (1118268)
|
||||
//******************************************************************************//
|
||||
using Raytheon.LogDashboard.Model;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Raytheon.LogDashboard.Helpers
|
||||
{
|
||||
public class FileWatcher
|
||||
{
|
||||
private CancellationTokenSource cancellationToken;
|
||||
|
||||
public string FilePath { get; set; }
|
||||
|
||||
public long Position { get; set; }
|
||||
|
||||
public LogTemplate Template { get; set; }
|
||||
|
||||
public ImportLogFile ImportLogFile { get; set; }
|
||||
|
||||
public event EventHandler<FileWatcher> FileChanged;
|
||||
|
||||
/// <summary>
|
||||
/// starts watching the file for changes with hard-coded one sec interval
|
||||
/// </summary>
|
||||
public void StartWatch()
|
||||
{
|
||||
cancellationToken = new CancellationTokenSource();
|
||||
|
||||
Task.Run(() =>
|
||||
{
|
||||
while(true)
|
||||
{
|
||||
if(cancellationToken.Token.IsCancellationRequested)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
long currentLength;
|
||||
using(FileStream stream = File.Open(FilePath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
|
||||
{
|
||||
currentLength = stream.Length;
|
||||
}
|
||||
|
||||
if(currentLength > Position)
|
||||
{
|
||||
OnFileChanged(this);
|
||||
}
|
||||
|
||||
Position = currentLength;
|
||||
Thread.Sleep(1000);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void StopWatch()
|
||||
{
|
||||
cancellationToken.Cancel();
|
||||
}
|
||||
|
||||
protected virtual void OnFileChanged(FileWatcher fileWatcher)
|
||||
{
|
||||
FileChanged?.Invoke(this, fileWatcher);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,255 @@
|
||||
//******************************************************************************//
|
||||
// SearchableTextControl.cs
|
||||
// 12/4/2023
|
||||
//
|
||||
// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
|
||||
// PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
|
||||
// AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
|
||||
// UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
|
||||
// RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
|
||||
// CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
|
||||
// OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
|
||||
// COMPANY.
|
||||
//
|
||||
// THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. GOVERNMENT
|
||||
//
|
||||
// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
//
|
||||
// WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE
|
||||
// EXPORT OR DISCLOSURE TO NON-U.S. PERSONS, WHEREVER LOCATED, IS RESTRICTED
|
||||
// BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R. SECTION
|
||||
// 120-130) OR THE EXPORT ADMINISTRATION REGULATIONS (EAR) (15 C.F.R. SECTION
|
||||
// 730-774). THIS DOCUMENT CANNOT BE EXPORTED (E.G., PROVIDED TO A SUPPLIER
|
||||
// OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S. PERSON, WHEREVER
|
||||
// LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS
|
||||
// BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S. GOVERNMENT
|
||||
// APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL
|
||||
// PENALTIES.
|
||||
//
|
||||
// DOD 5220.22-M, INDUSTRIAL SECURITY MANUAL, CHAPTER 5, SECTION 1 THROUGH 9 :
|
||||
// FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN OR DOD 5200.1-R,
|
||||
// INFORMATION SECURITY PROGRAM, CHAPTER 6. FOR UNCLASSIFIED, LIMITED DOCUMENTS
|
||||
// DESTROY BY ANY METHOD THAT WILL PREVENT DISCLOSURE OF CONTENTS OR
|
||||
// RECONSTRUCTION OF THE DOCUMENT.
|
||||
// POC: Alex Kravchenko (1118268)
|
||||
//******************************************************************************//
|
||||
|
||||
// Ignore Spelling: Searchable
|
||||
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Media;
|
||||
using System.Windows;
|
||||
|
||||
namespace Raytheon.LogDashboard.Helpers
|
||||
{
|
||||
public class SearchableTextControl : Control
|
||||
{
|
||||
static SearchableTextControl()
|
||||
{
|
||||
DefaultStyleKeyProperty.OverrideMetadata(typeof(SearchableTextControl),
|
||||
new FrameworkPropertyMetadata(typeof(SearchableTextControl)));
|
||||
}
|
||||
|
||||
#region DependencyProperties
|
||||
|
||||
/// <summary>
|
||||
/// Text sandbox which is used to get or set the value from a dependency property.
|
||||
/// </summary>
|
||||
public string Text
|
||||
{
|
||||
get => (string)GetValue(TextProperty);
|
||||
set => SetValue(TextProperty, value);
|
||||
}
|
||||
|
||||
|
||||
// Real implementation about TextProperty which registers a dependency property with
|
||||
// the specified property name, property type, owner type, and property metadata.
|
||||
public static readonly DependencyProperty TextProperty =
|
||||
DependencyProperty.Register("Text", typeof(string), typeof(SearchableTextControl),
|
||||
new UIPropertyMetadata(string.Empty,
|
||||
UpdateControlCallBack));
|
||||
|
||||
/// <summary>
|
||||
/// HighlightBackground sandbox which is used to get or set the value from a dependency property,
|
||||
/// if it gets a value,it should be forced to bind to a Brushes type.
|
||||
/// </summary>
|
||||
public Brush HighlightBackground
|
||||
{
|
||||
get => (Brush)GetValue(HighlightBackgroundProperty);
|
||||
set => SetValue(HighlightBackgroundProperty, value);
|
||||
}
|
||||
|
||||
|
||||
// Real implementation about HighlightBackgroundProperty which registers a dependency property
|
||||
// with the specified property name, property type, owner type, and property metadata.
|
||||
public static readonly DependencyProperty HighlightBackgroundProperty =
|
||||
DependencyProperty.Register("HighlightBackground", typeof(Brush), typeof(SearchableTextControl),
|
||||
new UIPropertyMetadata(Brushes.Yellow, UpdateControlCallBack));
|
||||
|
||||
/// <summary>
|
||||
/// HighlightForeground sandbox which is used to get or set the value from a dependency property,
|
||||
/// if it gets a value,it should be forced to bind to a Brushes type.
|
||||
/// </summary>
|
||||
public Brush HighlightForeground
|
||||
{
|
||||
get => (Brush)GetValue(HighlightForegroundProperty);
|
||||
set => SetValue(HighlightForegroundProperty, value);
|
||||
}
|
||||
|
||||
|
||||
// Real implementation about HighlightForegroundProperty which registers a dependency property with
|
||||
// the specified property name, property type, owner type, and property metadata.
|
||||
public static readonly DependencyProperty HighlightForegroundProperty =
|
||||
DependencyProperty.Register("HighlightForeground", typeof(Brush), typeof(SearchableTextControl),
|
||||
new UIPropertyMetadata(Brushes.Black, UpdateControlCallBack));
|
||||
|
||||
/// <summary>
|
||||
/// IsMatchCase sandbox which is used to get or set the value from a dependency property,
|
||||
/// if it gets a value,it should be forced to bind to a bool type.
|
||||
/// </summary>
|
||||
public bool IsMatchCase
|
||||
{
|
||||
get => (bool)GetValue(IsMatchCaseProperty);
|
||||
set => SetValue(IsMatchCaseProperty, value);
|
||||
}
|
||||
|
||||
// Real implementation about IsMatchCaseProperty which registers a dependency property with
|
||||
// the specified property name, property type, owner type, and property metadata.
|
||||
public static readonly DependencyProperty IsMatchCaseProperty =
|
||||
DependencyProperty.Register("IsMatchCase", typeof(bool), typeof(SearchableTextControl),
|
||||
new UIPropertyMetadata(true, UpdateControlCallBack));
|
||||
|
||||
/// <summary>
|
||||
/// IsHighlight sandbox which is used to get or set the value from a dependency property,
|
||||
/// if it gets a value,it should be forced to bind to a bool type.
|
||||
/// </summary>
|
||||
public bool IsHighlight
|
||||
{
|
||||
get => (bool)GetValue(IsHighlightProperty);
|
||||
set => SetValue(IsHighlightProperty, value);
|
||||
}
|
||||
|
||||
// Real implementation about IsHighlightProperty which registers a dependency property with
|
||||
// the specified property name, property type, owner type, and property metadata.
|
||||
public static readonly DependencyProperty IsHighlightProperty =
|
||||
DependencyProperty.Register("IsHighlight", typeof(bool), typeof(SearchableTextControl),
|
||||
new UIPropertyMetadata(false, UpdateControlCallBack));
|
||||
|
||||
/// <summary>
|
||||
/// SearchText sandbox which is used to get or set the value from a dependency property,
|
||||
/// if it gets a value,it should be forced to bind to a string type.
|
||||
/// </summary>
|
||||
public string SearchText
|
||||
{
|
||||
get => (string)GetValue(SearchTextProperty);
|
||||
set => SetValue(SearchTextProperty, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Real implementation about SearchTextProperty which registers a dependency property with
|
||||
/// the specified property name, property type, owner type, and property metadata.
|
||||
/// </summary>
|
||||
public static readonly DependencyProperty SearchTextProperty =
|
||||
DependencyProperty.Register("SearchText", typeof(string), typeof(SearchableTextControl),
|
||||
new UIPropertyMetadata(string.Empty, UpdateControlCallBack));
|
||||
|
||||
/// <summary>
|
||||
/// Create a call back function which is used to invalidate the rendering of the element,
|
||||
/// and force a complete new layout pass.
|
||||
/// One such advanced scenario is if you are creating a PropertyChangedCallback for a
|
||||
/// dependency property that is not on a Freezable or FrameworkElement derived class that
|
||||
/// still influences the layout when it changes.
|
||||
/// </summary>
|
||||
private static void UpdateControlCallBack(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
SearchableTextControl obj = d as SearchableTextControl;
|
||||
obj.InvalidateVisual();
|
||||
}
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// override the OnRender method which is used to search for the keyword and highlight
|
||||
/// it when the operation gets the result.
|
||||
/// </summary>
|
||||
protected override void OnRender(DrawingContext drawingContext)
|
||||
{
|
||||
// Define a TextBlock to hold the search result.
|
||||
TextBlock displayTextBlock = Template.FindName("PART_TEXT", this) as TextBlock;
|
||||
|
||||
displayTextBlock.TextWrapping = TextWrapping.NoWrap;
|
||||
|
||||
if(string.IsNullOrEmpty(Text))
|
||||
{
|
||||
base.OnRender(drawingContext);
|
||||
|
||||
return;
|
||||
}
|
||||
if(!IsHighlight)
|
||||
{
|
||||
displayTextBlock.Text = Text;
|
||||
base.OnRender(drawingContext);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
displayTextBlock.Inlines.Clear();
|
||||
string searchstring = IsMatchCase ? SearchText : SearchText.ToUpper();
|
||||
|
||||
string compareText = IsMatchCase ? Text : Text.ToUpper();
|
||||
string displayText = Text;
|
||||
|
||||
Run run;
|
||||
while(!string.IsNullOrEmpty(searchstring) && compareText.IndexOf(searchstring) >= 0)
|
||||
{
|
||||
int position = compareText.IndexOf(searchstring);
|
||||
run = GenerateRun(displayText.Substring(0, position), false);
|
||||
|
||||
if(run != null)
|
||||
{
|
||||
displayTextBlock.Inlines.Add(run);
|
||||
}
|
||||
|
||||
run = GenerateRun(displayText.Substring(position, searchstring.Length), true);
|
||||
|
||||
if(run != null)
|
||||
{
|
||||
displayTextBlock.Inlines.Add(run);
|
||||
}
|
||||
|
||||
compareText = compareText.Substring(position + searchstring.Length);
|
||||
displayText = displayText.Substring(position + searchstring.Length);
|
||||
}
|
||||
|
||||
run = GenerateRun(displayText, false);
|
||||
|
||||
if(run != null)
|
||||
{
|
||||
displayTextBlock.Inlines.Add(run);
|
||||
}
|
||||
|
||||
base.OnRender(drawingContext);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set inline-level flow content element intended to contain a run of formatted or unformatted
|
||||
/// text into your background and foreground setting.
|
||||
/// </summary>
|
||||
private Run GenerateRun(string searchedString, bool isHighlight)
|
||||
{
|
||||
if(!string.IsNullOrEmpty(searchedString))
|
||||
{
|
||||
Run run = new Run(searchedString)
|
||||
{
|
||||
Background = isHighlight ? HighlightBackground : Background,
|
||||
Foreground = isHighlight ? HighlightForeground : Foreground,
|
||||
|
||||
// Set the source text with the style which is Bold.
|
||||
FontWeight = isHighlight ? FontWeights.Bold : FontWeights.Normal,
|
||||
};
|
||||
return run;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
298
Source/LogDashboard/LogDashboard/Helpers/StringExtensions.cs
Normal file
298
Source/LogDashboard/LogDashboard/Helpers/StringExtensions.cs
Normal file
@@ -0,0 +1,298 @@
|
||||
//******************************************************************************//
|
||||
// StringExtensions.cs
|
||||
// 12/4/2023
|
||||
//
|
||||
// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
|
||||
// PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
|
||||
// AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
|
||||
// UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
|
||||
// RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
|
||||
// CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
|
||||
// OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
|
||||
// COMPANY.
|
||||
//
|
||||
// THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. GOVERNMENT
|
||||
//
|
||||
// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
//
|
||||
// WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE
|
||||
// EXPORT OR DISCLOSURE TO NON-U.S. PERSONS, WHEREVER LOCATED, IS RESTRICTED
|
||||
// BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R. SECTION
|
||||
// 120-130) OR THE EXPORT ADMINISTRATION REGULATIONS (EAR) (15 C.F.R. SECTION
|
||||
// 730-774). THIS DOCUMENT CANNOT BE EXPORTED (E.G., PROVIDED TO A SUPPLIER
|
||||
// OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S. PERSON, WHEREVER
|
||||
// LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS
|
||||
// BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S. GOVERNMENT
|
||||
// APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL
|
||||
// PENALTIES.
|
||||
//
|
||||
// DOD 5220.22-M, INDUSTRIAL SECURITY MANUAL, CHAPTER 5, SECTION 1 THROUGH 9 :
|
||||
// FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN OR DOD 5200.1-R,
|
||||
// INFORMATION SECURITY PROGRAM, CHAPTER 6. FOR UNCLASSIFIED, LIMITED DOCUMENTS
|
||||
// DESTROY BY ANY METHOD THAT WILL PREVENT DISCLOSURE OF CONTENTS OR
|
||||
// RECONSTRUCTION OF THE DOCUMENT.
|
||||
// POC: Alex Kravchenko (1118268)
|
||||
//******************************************************************************//
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace Raytheon.LogDashboard.Helpers
|
||||
{
|
||||
|
||||
public static class StringExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// takes the left of the string from given index
|
||||
/// </summary>
|
||||
/// <param name="value"></param>
|
||||
/// <param name="maxLength"></param>
|
||||
/// <returns></returns>
|
||||
public static string Left(this string value, int maxLength)
|
||||
{
|
||||
if(string.IsNullOrEmpty(value))
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
maxLength = Math.Abs(maxLength);
|
||||
|
||||
return (value.Length <= maxLength ? value : value.Substring(0, maxLength));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// takes a left of a string from given character
|
||||
/// </summary>
|
||||
/// <param name="value"></param>
|
||||
/// <param name="character"></param>
|
||||
/// <returns></returns>
|
||||
public static string LeftFrom(this string value, char character)
|
||||
{
|
||||
if(string.IsNullOrEmpty(value))
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
int index = value.IndexOf(character);
|
||||
|
||||
if(index == -1)
|
||||
{
|
||||
return value;
|
||||
}
|
||||
|
||||
return value.Substring(0, index);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// takes a left of a string from given string
|
||||
/// </summary>
|
||||
/// <param name="value"></param>
|
||||
/// <param name="characters"></param>
|
||||
/// <returns></returns>
|
||||
public static string LeftFrom(this string value, string characters)
|
||||
{
|
||||
if(string.IsNullOrEmpty(value))
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
int index = value.IndexOf(characters);
|
||||
|
||||
if(index == -1)
|
||||
{
|
||||
return value;
|
||||
}
|
||||
|
||||
return value.Substring(0, index);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// takes a left of a string from given regular expression
|
||||
/// </summary>
|
||||
/// <param name="value"></param>
|
||||
/// <param name="regex"></param>
|
||||
/// <returns></returns>
|
||||
public static string LeftFromRegex(this string value, string regex)
|
||||
{
|
||||
if(string.IsNullOrEmpty(value))
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
Match match = Regex.Match(value, regex);
|
||||
|
||||
if(!match.Success)
|
||||
{
|
||||
return value;
|
||||
}
|
||||
|
||||
return value.Substring(0, match.Index);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// takes a right of a string from given length
|
||||
/// </summary>
|
||||
/// <param name="value"></param>
|
||||
/// <param name="length"></param>
|
||||
/// <returns></returns>
|
||||
public static string Right(this string value, int length)
|
||||
{
|
||||
if(string.IsNullOrEmpty(value))
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
return value.Length <= length ? value : value.Substring(value.Length - length);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// takes a right of a string from given character
|
||||
/// </summary>
|
||||
/// <param name="value"></param>
|
||||
/// <param name="character"></param>
|
||||
/// <returns></returns>
|
||||
public static string RightFrom(this string value, char character)
|
||||
{
|
||||
if(string.IsNullOrEmpty(value))
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
int index = value.LastIndexOf(character);
|
||||
|
||||
if(index == -1)
|
||||
{
|
||||
return value;
|
||||
}
|
||||
|
||||
return value.Substring(index + 1);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// takes a right of a string from given string including that string
|
||||
/// </summary>
|
||||
/// <param name="value"></param>
|
||||
/// <param name="characters"></param>
|
||||
/// <returns></returns>
|
||||
public static string RightFrom(this string value, string characters)
|
||||
{
|
||||
if(string.IsNullOrEmpty(value))
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
int index = value.LastIndexOf(characters);
|
||||
|
||||
if(index == -1)
|
||||
{
|
||||
return value;
|
||||
}
|
||||
|
||||
return value.Substring(index);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// takes a right of a string from given string not including the string
|
||||
/// </summary>
|
||||
/// <param name="value"></param>
|
||||
/// <param name="characters"></param>
|
||||
/// <returns></returns>
|
||||
public static string RightAfter(this string value, string characters)
|
||||
{
|
||||
if(string.IsNullOrEmpty(value))
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
int index = value.LastIndexOf(characters);
|
||||
|
||||
if(index == -1)
|
||||
{
|
||||
return value;
|
||||
}
|
||||
|
||||
if(value.Length > index + characters.Length)
|
||||
{
|
||||
return value.Substring(index + characters.Length);
|
||||
}
|
||||
else
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// takes a right of a string form given regular expression
|
||||
/// </summary>
|
||||
/// <param name="value"></param>
|
||||
/// <param name="regex"></param>
|
||||
/// <returns></returns>
|
||||
public static string RightFromRegex(this string value, string regex)
|
||||
{
|
||||
if(string.IsNullOrEmpty(value))
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
Match match = Regex.Match(value, regex);
|
||||
|
||||
if(!match.Success)
|
||||
{
|
||||
return value;
|
||||
}
|
||||
|
||||
return value.Substring(match.Index + match.Length);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// returns the first match of the regular expression
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <param name="pattern"></param>
|
||||
/// <returns></returns>
|
||||
public static string GetFirstMatch(this string input, string pattern)
|
||||
{
|
||||
var match = Regex.Match(input, pattern);
|
||||
return match.Groups[0].Value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// reads the next value after provided identifier
|
||||
/// for example:
|
||||
/// in the string RESULT=123 and identifier = RESULT this function returns 123
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <param name="identifier"></param>
|
||||
/// <returns></returns>
|
||||
public static T GetValueAfterIdentifier<T>(this string input, string identifier) => TypeConverter.ChangeType<T>(GetFirstMatch(input, $"(?<={identifier}=)[^ ]+|$"));
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// checks for numeric value
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
public static bool IsNumeric(this string input)
|
||||
{
|
||||
if(string.IsNullOrEmpty(input))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return Regex.IsMatch(input.Trim(), @"^[\d.-]+$");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// converts string to Pascal Case
|
||||
/// </summary>
|
||||
/// <param name="text"></param>
|
||||
/// <returns></returns>
|
||||
public static string ToPascalCase(this string text)
|
||||
{
|
||||
string yourString = text.ToLower().Replace("_", " ");
|
||||
TextInfo info = CultureInfo.CurrentCulture.TextInfo;
|
||||
return info.ToTitleCase(yourString).Replace(" ", string.Empty);
|
||||
}
|
||||
}
|
||||
}
|
||||
136
Source/LogDashboard/LogDashboard/Helpers/TVIExtender.cs
Normal file
136
Source/LogDashboard/LogDashboard/Helpers/TVIExtender.cs
Normal file
@@ -0,0 +1,136 @@
|
||||
//******************************************************************************//
|
||||
// TVIExtender.cs
|
||||
// 12/4/2023
|
||||
//
|
||||
// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
|
||||
// PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
|
||||
// AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
|
||||
// UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
|
||||
// RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
|
||||
// CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
|
||||
// OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
|
||||
// COMPANY.
|
||||
//
|
||||
// THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. GOVERNMENT
|
||||
//
|
||||
// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
//
|
||||
// WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE
|
||||
// EXPORT OR DISCLOSURE TO NON-U.S. PERSONS, WHEREVER LOCATED, IS RESTRICTED
|
||||
// BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R. SECTION
|
||||
// 120-130) OR THE EXPORT ADMINISTRATION REGULATIONS (EAR) (15 C.F.R. SECTION
|
||||
// 730-774). THIS DOCUMENT CANNOT BE EXPORTED (E.G., PROVIDED TO A SUPPLIER
|
||||
// OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S. PERSON, WHEREVER
|
||||
// LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS
|
||||
// BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S. GOVERNMENT
|
||||
// APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL
|
||||
// PENALTIES.
|
||||
//
|
||||
// DOD 5220.22-M, INDUSTRIAL SECURITY MANUAL, CHAPTER 5, SECTION 1 THROUGH 9 :
|
||||
// FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN OR DOD 5200.1-R,
|
||||
// INFORMATION SECURITY PROGRAM, CHAPTER 6. FOR UNCLASSIFIED, LIMITED DOCUMENTS
|
||||
// DESTROY BY ANY METHOD THAT WILL PREVENT DISCLOSURE OF CONTENTS OR
|
||||
// RECONSTRUCTION OF THE DOCUMENT.
|
||||
// POC: Alex Kravchenko (1118268)
|
||||
//******************************************************************************//
|
||||
using System.Windows.Controls.Primitives;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows;
|
||||
|
||||
namespace Raytheon.LogDashboard.Helpers
|
||||
{
|
||||
public class TVIExtender
|
||||
{
|
||||
private TreeViewItem item;
|
||||
|
||||
public static DependencyProperty UseExtenderProperty =
|
||||
DependencyProperty.RegisterAttached("UseExtender", typeof(bool), typeof(TVIExtender),
|
||||
new PropertyMetadata(false, OnChangedUseExtender));
|
||||
|
||||
public static bool GetUseExtender(DependencyObject sender)
|
||||
{
|
||||
return (bool)sender.GetValue(UseExtenderProperty);
|
||||
}
|
||||
|
||||
public static void SetUseExtender(DependencyObject sender, bool useExtender)
|
||||
{
|
||||
sender.SetValue(UseExtenderProperty, useExtender);
|
||||
}
|
||||
|
||||
private static void OnChangedUseExtender(DependencyObject sender, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
if(sender is TreeViewItem item)
|
||||
{
|
||||
if((bool)e.NewValue)
|
||||
{
|
||||
if(item.ReadLocalValue(ItemExtenderProperty) == DependencyProperty.UnsetValue)
|
||||
{
|
||||
TVIExtender extender = new TVIExtender(item);
|
||||
item.SetValue(ItemExtenderProperty, extender);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(item.ReadLocalValue(ItemExtenderProperty) != DependencyProperty.UnsetValue)
|
||||
{
|
||||
TVIExtender extender = (TVIExtender)item.ReadLocalValue(ItemExtenderProperty);
|
||||
extender.Detach();
|
||||
item.SetValue(ItemExtenderProperty, DependencyProperty.UnsetValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static DependencyProperty ItemExtenderProperty =
|
||||
DependencyProperty.RegisterAttached("ItemExtender", typeof(TVIExtender), typeof(TVIExtender));
|
||||
|
||||
public static DependencyProperty IsLastOneProperty =
|
||||
DependencyProperty.RegisterAttached("IsLastOne", typeof(bool), typeof(TVIExtender));
|
||||
|
||||
public static bool GetIsLastOne(DependencyObject sender)
|
||||
{
|
||||
return (bool)sender.GetValue(IsLastOneProperty);
|
||||
}
|
||||
|
||||
public static void SetIsLastOne(DependencyObject sender, bool isLastOne)
|
||||
{
|
||||
sender.SetValue(IsLastOneProperty, isLastOne);
|
||||
}
|
||||
|
||||
public TVIExtender(TreeViewItem item)
|
||||
{
|
||||
this.item = item;
|
||||
|
||||
ItemsControl ic = ItemsControl.ItemsControlFromItemContainer(this.item);
|
||||
ic.ItemContainerGenerator.ItemsChanged += OnItemsChangedItemContainerGenerator;
|
||||
|
||||
item.SetValue(IsLastOneProperty, ic.ItemContainerGenerator.IndexFromContainer(this.item) == ic.Items.Count - 1);
|
||||
}
|
||||
|
||||
private void OnItemsChangedItemContainerGenerator(object sender, ItemsChangedEventArgs e)
|
||||
{
|
||||
ItemsControl ic = ItemsControl.ItemsControlFromItemContainer(item);
|
||||
|
||||
if(null != ic)
|
||||
{
|
||||
item.SetValue(IsLastOneProperty, ic.ItemContainerGenerator.IndexFromContainer(item) == ic.Items.Count - 1);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void Detach()
|
||||
{
|
||||
if(item != null)
|
||||
{
|
||||
ItemsControl ic = ItemsControl.ItemsControlFromItemContainer(item);
|
||||
if(ic == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ic.ItemContainerGenerator.ItemsChanged -= OnItemsChangedItemContainerGenerator;
|
||||
item = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
91
Source/LogDashboard/LogDashboard/Helpers/TypeConverter.cs
Normal file
91
Source/LogDashboard/LogDashboard/Helpers/TypeConverter.cs
Normal file
@@ -0,0 +1,91 @@
|
||||
//******************************************************************************//
|
||||
// TypeConverter.cs
|
||||
// 12/4/2023
|
||||
//
|
||||
// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
|
||||
// PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
|
||||
// AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
|
||||
// UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
|
||||
// RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
|
||||
// CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
|
||||
// OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
|
||||
// COMPANY.
|
||||
//
|
||||
// THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. GOVERNMENT
|
||||
//
|
||||
// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
//
|
||||
// WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE
|
||||
// EXPORT OR DISCLOSURE TO NON-U.S. PERSONS, WHEREVER LOCATED, IS RESTRICTED
|
||||
// BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R. SECTION
|
||||
// 120-130) OR THE EXPORT ADMINISTRATION REGULATIONS (EAR) (15 C.F.R. SECTION
|
||||
// 730-774). THIS DOCUMENT CANNOT BE EXPORTED (E.G., PROVIDED TO A SUPPLIER
|
||||
// OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S. PERSON, WHEREVER
|
||||
// LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS
|
||||
// BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S. GOVERNMENT
|
||||
// APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL
|
||||
// PENALTIES.
|
||||
//
|
||||
// DOD 5220.22-M, INDUSTRIAL SECURITY MANUAL, CHAPTER 5, SECTION 1 THROUGH 9 :
|
||||
// FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN OR DOD 5200.1-R,
|
||||
// INFORMATION SECURITY PROGRAM, CHAPTER 6. FOR UNCLASSIFIED, LIMITED DOCUMENTS
|
||||
// DESTROY BY ANY METHOD THAT WILL PREVENT DISCLOSURE OF CONTENTS OR
|
||||
// RECONSTRUCTION OF THE DOCUMENT.
|
||||
// POC: Alex Kravchenko (1118268)
|
||||
//******************************************************************************//
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace Raytheon.LogDashboard.Helpers
|
||||
{
|
||||
//
|
||||
// Summary:
|
||||
// type conversion utility with a special case for enums
|
||||
public static class TypeConverter
|
||||
{
|
||||
//
|
||||
// Summary:
|
||||
// special rule for enumeration when converting a type
|
||||
//
|
||||
// Parameters:
|
||||
// value:
|
||||
//
|
||||
// Type parameters:
|
||||
// T:
|
||||
public static T ChangeType<T>(object value)
|
||||
{
|
||||
if(!typeof(T).IsEnum)
|
||||
{
|
||||
return (T)ChangeType(typeof(T), value);
|
||||
}
|
||||
|
||||
return (T)Enum.Parse(typeof(T), value.ToString());
|
||||
}
|
||||
|
||||
//
|
||||
// Summary:
|
||||
// convert type with TypeDescriptor
|
||||
//
|
||||
// Parameters:
|
||||
// t:
|
||||
//
|
||||
// value:
|
||||
public static object ChangeType(Type t, object value)
|
||||
{
|
||||
return TypeDescriptor.GetConverter(t).ConvertFrom(value);
|
||||
}
|
||||
|
||||
//
|
||||
// Summary:
|
||||
// register type with the type descriptor for later conversion
|
||||
//
|
||||
// Type parameters:
|
||||
// T:
|
||||
//
|
||||
// TC:
|
||||
public static void RegisterTypeConverter<T, TC>() where TC : System.ComponentModel.TypeConverter
|
||||
{
|
||||
TypeDescriptor.AddAttributes(typeof(T), new TypeConverterAttribute(typeof(TC)));
|
||||
}
|
||||
}
|
||||
}
|
||||
100
Source/LogDashboard/LogDashboard/Helpers/UnsafeNative.cs
Normal file
100
Source/LogDashboard/LogDashboard/Helpers/UnsafeNative.cs
Normal file
@@ -0,0 +1,100 @@
|
||||
//******************************************************************************//
|
||||
// UnsafeNative.cs
|
||||
// 12/4/2023
|
||||
//
|
||||
// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
|
||||
// PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
|
||||
// AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
|
||||
// UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
|
||||
// RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
|
||||
// CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
|
||||
// OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
|
||||
// COMPANY.
|
||||
//
|
||||
// THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. GOVERNMENT
|
||||
//
|
||||
// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
//
|
||||
// WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE
|
||||
// EXPORT OR DISCLOSURE TO NON-U.S. PERSONS, WHEREVER LOCATED, IS RESTRICTED
|
||||
// BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R. SECTION
|
||||
// 120-130) OR THE EXPORT ADMINISTRATION REGULATIONS (EAR) (15 C.F.R. SECTION
|
||||
// 730-774). THIS DOCUMENT CANNOT BE EXPORTED (E.G., PROVIDED TO A SUPPLIER
|
||||
// OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S. PERSON, WHEREVER
|
||||
// LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS
|
||||
// BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S. GOVERNMENT
|
||||
// APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL
|
||||
// PENALTIES.
|
||||
//
|
||||
// DOD 5220.22-M, INDUSTRIAL SECURITY MANUAL, CHAPTER 5, SECTION 1 THROUGH 9 :
|
||||
// FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN OR DOD 5200.1-R,
|
||||
// INFORMATION SECURITY PROGRAM, CHAPTER 6. FOR UNCLASSIFIED, LIMITED DOCUMENTS
|
||||
// DESTROY BY ANY METHOD THAT WILL PREVENT DISCLOSURE OF CONTENTS OR
|
||||
// RECONSTRUCTION OF THE DOCUMENT.
|
||||
// POC: Alex Kravchenko (1118268)
|
||||
//******************************************************************************//
|
||||
|
||||
// Ignore Spelling: COPYDATA
|
||||
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
|
||||
namespace Raytheon.LogDashboard.Helpers
|
||||
{
|
||||
internal static class UnsafeNative
|
||||
{
|
||||
public const int WM_COPYDATA = 0x004A;
|
||||
|
||||
public static string GetMessage(int message, IntPtr lParam)
|
||||
{
|
||||
if(message == WM_COPYDATA)
|
||||
{
|
||||
try
|
||||
{
|
||||
var data = Marshal.PtrToStructure<CopyDataStruct>(lParam);
|
||||
string result = string.Copy(data.LpData);
|
||||
return result;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void SendMessage(IntPtr hwnd, string message)
|
||||
{
|
||||
byte[] messageBytes = Encoding.Unicode.GetBytes(message); /* ANSII encoding */
|
||||
CopyDataStruct data = new CopyDataStruct
|
||||
{
|
||||
DwData = IntPtr.Zero,
|
||||
LpData = message,
|
||||
CbData = messageBytes.Length + 1 /* +1 because of \0 string termination */
|
||||
};
|
||||
|
||||
if(SendMessage(hwnd, WM_COPYDATA, IntPtr.Zero, ref data) != 0)
|
||||
{
|
||||
throw new Win32Exception(Marshal.GetLastWin32Error());
|
||||
}
|
||||
}
|
||||
|
||||
[DllImport("user32.dll")]
|
||||
public static extern bool SetForegroundWindow(IntPtr hWnd);
|
||||
|
||||
[DllImport("User32.dll", EntryPoint = "SendMessage")]
|
||||
private static extern int SendMessage(IntPtr hWnd, int Msg, IntPtr wParam, ref CopyDataStruct lParam);
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
private struct CopyDataStruct
|
||||
{
|
||||
public IntPtr DwData;
|
||||
public int CbData;
|
||||
[MarshalAs(UnmanagedType.LPWStr)]
|
||||
public string LpData;
|
||||
}
|
||||
}
|
||||
}
|
||||
84
Source/LogDashboard/LogDashboard/LogDashboard.csproj
Normal file
84
Source/LogDashboard/LogDashboard/LogDashboard.csproj
Normal file
@@ -0,0 +1,84 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>net472;net48</TargetFrameworks>
|
||||
<AssemblyName>Raytheon.LogDashboardLib</AssemblyName>
|
||||
<RootNamespace>Raytheon.LogDashboard</RootNamespace>
|
||||
<Company>Raytheon Technologies</Company>
|
||||
<Product>Logging Dashboard Application</Product>
|
||||
<Authors>Specialty Engineering</Authors>
|
||||
<Copyright>Raytheon Technologies</Copyright>
|
||||
<GenerateResourceUsePreserializedResources>true</GenerateResourceUsePreserializedResources>
|
||||
<Version>1.3.10</Version>
|
||||
<AssemblyVersion>$(Version)</AssemblyVersion>
|
||||
<FileVersion>$(Version)</FileVersion>
|
||||
<UseWPF>true</UseWPF>
|
||||
<ApplicationIcon>Resources\LogDashboard.ico</ApplicationIcon>
|
||||
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Remove="Resources\Settings.png" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Page Remove="Styles\DrawingImages.xaml" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Include="Resources\LogDashboard.ico" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Resource Include="Styles\DrawingImages.xaml" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="MahApps.Metro" Version="2.4.10" />
|
||||
<PackageReference Include="MahApps.Metro.Resources" Version="0.6.1" />
|
||||
<PackageReference Include="MvvmLight" Version="5.4.1.1" />
|
||||
<PackageReference Include="NLog" Version="5.0.0" />
|
||||
<PackageReference Include="Raytheon.Configuration" Version="2.6.1" />
|
||||
<PackageReference Include="System.Resources.Extensions" Version="8.0.0" />
|
||||
<PackageReference Include="WindowsAPICodePack-Shell" Version="1.1.1" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Reference Include="PresentationCore" />
|
||||
<Reference Include="PresentationFramework" />
|
||||
<Reference Include="System.Deployment" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Windows.Interactivity" />
|
||||
<Reference Include="System.ServiceModel" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Update="Resources\Resource1.Designer.cs">
|
||||
<DesignTime>True</DesignTime>
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Resource1.resx</DependentUpon>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Resource Include="Resources\Settings.png" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Update="Resources\Resource1.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resource1.Designer.cs</LastGenOutput>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Update="ReleaseNotes.xml">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
|
||||
</Project>
|
||||
44
Source/LogDashboard/LogDashboard/Model/CheckBoxId.cs
Normal file
44
Source/LogDashboard/LogDashboard/Model/CheckBoxId.cs
Normal file
@@ -0,0 +1,44 @@
|
||||
//******************************************************************************//
|
||||
// CheckBoxId.cs
|
||||
// 12/4/2023
|
||||
//
|
||||
// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
|
||||
// PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
|
||||
// AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
|
||||
// UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
|
||||
// RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
|
||||
// CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
|
||||
// OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
|
||||
// COMPANY.
|
||||
//
|
||||
// THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. GOVERNMENT
|
||||
//
|
||||
// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
//
|
||||
// WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE
|
||||
// EXPORT OR DISCLOSURE TO NON-U.S. PERSONS, WHEREVER LOCATED, IS RESTRICTED
|
||||
// BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R. SECTION
|
||||
// 120-130) OR THE EXPORT ADMINISTRATION REGULATIONS (EAR) (15 C.F.R. SECTION
|
||||
// 730-774). THIS DOCUMENT CANNOT BE EXPORTED (E.G., PROVIDED TO A SUPPLIER
|
||||
// OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S. PERSON, WHEREVER
|
||||
// LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS
|
||||
// BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S. GOVERNMENT
|
||||
// APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL
|
||||
// PENALTIES.
|
||||
//
|
||||
// DOD 5220.22-M, INDUSTRIAL SECURITY MANUAL, CHAPTER 5, SECTION 1 THROUGH 9 :
|
||||
// FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN OR DOD 5200.1-R,
|
||||
// INFORMATION SECURITY PROGRAM, CHAPTER 6. FOR UNCLASSIFIED, LIMITED DOCUMENTS
|
||||
// DESTROY BY ANY METHOD THAT WILL PREVENT DISCLOSURE OF CONTENTS OR
|
||||
// RECONSTRUCTION OF THE DOCUMENT.
|
||||
// POC: Alex Kravchenko (1118268)
|
||||
//******************************************************************************//
|
||||
// Ignore Spelling: Сheck
|
||||
|
||||
namespace Raytheon.LogDashboard.Model
|
||||
{
|
||||
public struct CheckBoxId
|
||||
{
|
||||
public static string CurrentСheckBoxId { get; set; }
|
||||
}
|
||||
}
|
||||
50
Source/LogDashboard/LogDashboard/Model/DashboardLogLevel.cs
Normal file
50
Source/LogDashboard/LogDashboard/Model/DashboardLogLevel.cs
Normal file
@@ -0,0 +1,50 @@
|
||||
//******************************************************************************//
|
||||
// DashboardLogLevel.cs
|
||||
// 12/4/2023
|
||||
//
|
||||
// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
|
||||
// PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
|
||||
// AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
|
||||
// UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
|
||||
// RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
|
||||
// CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
|
||||
// OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
|
||||
// COMPANY.
|
||||
//
|
||||
// THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. GOVERNMENT
|
||||
//
|
||||
// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
//
|
||||
// WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE
|
||||
// EXPORT OR DISCLOSURE TO NON-U.S. PERSONS, WHEREVER LOCATED, IS RESTRICTED
|
||||
// BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R. SECTION
|
||||
// 120-130) OR THE EXPORT ADMINISTRATION REGULATIONS (EAR) (15 C.F.R. SECTION
|
||||
// 730-774). THIS DOCUMENT CANNOT BE EXPORTED (E.G., PROVIDED TO A SUPPLIER
|
||||
// OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S. PERSON, WHEREVER
|
||||
// LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS
|
||||
// BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S. GOVERNMENT
|
||||
// APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL
|
||||
// PENALTIES.
|
||||
//
|
||||
// DOD 5220.22-M, INDUSTRIAL SECURITY MANUAL, CHAPTER 5, SECTION 1 THROUGH 9 :
|
||||
// FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN OR DOD 5200.1-R,
|
||||
// INFORMATION SECURITY PROGRAM, CHAPTER 6. FOR UNCLASSIFIED, LIMITED DOCUMENTS
|
||||
// DESTROY BY ANY METHOD THAT WILL PREVENT DISCLOSURE OF CONTENTS OR
|
||||
// RECONSTRUCTION OF THE DOCUMENT.
|
||||
// POC: Alex Kravchenko (1118268)
|
||||
//******************************************************************************//
|
||||
using System;
|
||||
|
||||
namespace Raytheon.LogDashboard.Model
|
||||
{
|
||||
[Flags]
|
||||
public enum DashboardLogLevel
|
||||
{
|
||||
Trace = 1 | Debug | Info | Warn | Error | Fatal,
|
||||
Debug = 2 | Info | Warn | Error | Fatal,
|
||||
Info = 4 | Warn | Error | Fatal,
|
||||
Warn = 8 | Error | Fatal,
|
||||
Error = 16 | Fatal,
|
||||
Fatal = 32,
|
||||
}
|
||||
}
|
||||
56
Source/LogDashboard/LogDashboard/Model/IgnoredIPAddress.cs
Normal file
56
Source/LogDashboard/LogDashboard/Model/IgnoredIPAddress.cs
Normal file
@@ -0,0 +1,56 @@
|
||||
//******************************************************************************//
|
||||
// IgnoredIPAddress.cs
|
||||
// 12/4/2023
|
||||
//
|
||||
// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
|
||||
// PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
|
||||
// AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
|
||||
// UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
|
||||
// RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
|
||||
// CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
|
||||
// OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
|
||||
// COMPANY.
|
||||
//
|
||||
// THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. GOVERNMENT
|
||||
//
|
||||
// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
//
|
||||
// WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE
|
||||
// EXPORT OR DISCLOSURE TO NON-U.S. PERSONS, WHEREVER LOCATED, IS RESTRICTED
|
||||
// BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R. SECTION
|
||||
// 120-130) OR THE EXPORT ADMINISTRATION REGULATIONS (EAR) (15 C.F.R. SECTION
|
||||
// 730-774). THIS DOCUMENT CANNOT BE EXPORTED (E.G., PROVIDED TO A SUPPLIER
|
||||
// OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S. PERSON, WHEREVER
|
||||
// LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS
|
||||
// BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S. GOVERNMENT
|
||||
// APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL
|
||||
// PENALTIES.
|
||||
//
|
||||
// DOD 5220.22-M, INDUSTRIAL SECURITY MANUAL, CHAPTER 5, SECTION 1 THROUGH 9 :
|
||||
// FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN OR DOD 5200.1-R,
|
||||
// INFORMATION SECURITY PROGRAM, CHAPTER 6. FOR UNCLASSIFIED, LIMITED DOCUMENTS
|
||||
// DESTROY BY ANY METHOD THAT WILL PREVENT DISCLOSURE OF CONTENTS OR
|
||||
// RECONSTRUCTION OF THE DOCUMENT.
|
||||
// POC: Alex Kravchenko (1118268)
|
||||
//******************************************************************************//
|
||||
using GalaSoft.MvvmLight;
|
||||
|
||||
namespace Raytheon.LogDashboard.Model
|
||||
{
|
||||
public class IgnoredIPAddr : ObservableObject
|
||||
{
|
||||
private string ip;
|
||||
public string IP
|
||||
{
|
||||
get => ip;
|
||||
set { Set(() => IP, ref ip, value); }
|
||||
}
|
||||
|
||||
private bool isActive = true;
|
||||
public bool IsActive
|
||||
{
|
||||
get => isActive;
|
||||
set { Set(() => IsActive, ref isActive, value); }
|
||||
}
|
||||
}
|
||||
}
|
||||
52
Source/LogDashboard/LogDashboard/Model/ImportLogFile.cs
Normal file
52
Source/LogDashboard/LogDashboard/Model/ImportLogFile.cs
Normal file
@@ -0,0 +1,52 @@
|
||||
//******************************************************************************//
|
||||
// ImportLogFile.cs
|
||||
// 12/4/2023
|
||||
//
|
||||
// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
|
||||
// PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
|
||||
// AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
|
||||
// UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
|
||||
// RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
|
||||
// CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
|
||||
// OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
|
||||
// COMPANY.
|
||||
//
|
||||
// THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. GOVERNMENT
|
||||
//
|
||||
// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
//
|
||||
// WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE
|
||||
// EXPORT OR DISCLOSURE TO NON-U.S. PERSONS, WHEREVER LOCATED, IS RESTRICTED
|
||||
// BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R. SECTION
|
||||
// 120-130) OR THE EXPORT ADMINISTRATION REGULATIONS (EAR) (15 C.F.R. SECTION
|
||||
// 730-774). THIS DOCUMENT CANNOT BE EXPORTED (E.G., PROVIDED TO A SUPPLIER
|
||||
// OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S. PERSON, WHEREVER
|
||||
// LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS
|
||||
// BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S. GOVERNMENT
|
||||
// APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL
|
||||
// PENALTIES.
|
||||
//
|
||||
// DOD 5220.22-M, INDUSTRIAL SECURITY MANUAL, CHAPTER 5, SECTION 1 THROUGH 9 :
|
||||
// FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN OR DOD 5200.1-R,
|
||||
// INFORMATION SECURITY PROGRAM, CHAPTER 6. FOR UNCLASSIFIED, LIMITED DOCUMENTS
|
||||
// DESTROY BY ANY METHOD THAT WILL PREVENT DISCLOSURE OF CONTENTS OR
|
||||
// RECONSTRUCTION OF THE DOCUMENT.
|
||||
// POC: Alex Kravchenko (1118268)
|
||||
//******************************************************************************//
|
||||
using GalaSoft.MvvmLight;
|
||||
|
||||
namespace Raytheon.LogDashboard.Model
|
||||
{
|
||||
public class ImportLogFile : ObservableObject
|
||||
{
|
||||
public string FileName { get; set; }
|
||||
public string FilePath { get; set; }
|
||||
|
||||
private double process = 0;
|
||||
public double Process
|
||||
{
|
||||
get => process;
|
||||
set { Set(() => Process, ref process, value); }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
//******************************************************************************//
|
||||
// ImportTemplateParameters.cs
|
||||
// 12/4/2023
|
||||
//
|
||||
// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
|
||||
// PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
|
||||
// AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
|
||||
// UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
|
||||
// RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
|
||||
// CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
|
||||
// OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
|
||||
// COMPANY.
|
||||
//
|
||||
// THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. GOVERNMENT
|
||||
//
|
||||
// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
//
|
||||
// WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE
|
||||
// EXPORT OR DISCLOSURE TO NON-U.S. PERSONS, WHEREVER LOCATED, IS RESTRICTED
|
||||
// BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R. SECTION
|
||||
// 120-130) OR THE EXPORT ADMINISTRATION REGULATIONS (EAR) (15 C.F.R. SECTION
|
||||
// 730-774). THIS DOCUMENT CANNOT BE EXPORTED (E.G., PROVIDED TO A SUPPLIER
|
||||
// OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S. PERSON, WHEREVER
|
||||
// LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS
|
||||
// BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S. GOVERNMENT
|
||||
// APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL
|
||||
// PENALTIES.
|
||||
//
|
||||
// DOD 5220.22-M, INDUSTRIAL SECURITY MANUAL, CHAPTER 5, SECTION 1 THROUGH 9 :
|
||||
// FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN OR DOD 5200.1-R,
|
||||
// INFORMATION SECURITY PROGRAM, CHAPTER 6. FOR UNCLASSIFIED, LIMITED DOCUMENTS
|
||||
// DESTROY BY ANY METHOD THAT WILL PREVENT DISCLOSURE OF CONTENTS OR
|
||||
// RECONSTRUCTION OF THE DOCUMENT.
|
||||
// POC: Alex Kravchenko (1118268)
|
||||
//******************************************************************************//
|
||||
namespace Raytheon.LogDashboard.Model
|
||||
{
|
||||
public enum ImportTemplateParameters
|
||||
{
|
||||
// main
|
||||
level,
|
||||
logger,
|
||||
message,
|
||||
exception,
|
||||
newline,
|
||||
oneexception,
|
||||
var,
|
||||
|
||||
// date and time
|
||||
date,
|
||||
longdate,
|
||||
shortdate,
|
||||
ticks,
|
||||
time,
|
||||
eptstime,
|
||||
errorloggertime,
|
||||
|
||||
//Call site and stack traces
|
||||
сallsite,
|
||||
callsitelinenumber,
|
||||
stacktrace,
|
||||
|
||||
//Processes, threads and assemblies
|
||||
threadid,
|
||||
threadname,
|
||||
processid,
|
||||
processinfo,
|
||||
processname,
|
||||
processtime,
|
||||
appdomain,
|
||||
hostname,
|
||||
machinename,
|
||||
|
||||
other,
|
||||
}
|
||||
}
|
||||
119
Source/LogDashboard/LogDashboard/Model/LogMessage.cs
Normal file
119
Source/LogDashboard/LogDashboard/Model/LogMessage.cs
Normal file
@@ -0,0 +1,119 @@
|
||||
//******************************************************************************//
|
||||
// LogMessage.cs
|
||||
// 12/4/2023
|
||||
//
|
||||
// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
|
||||
// PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
|
||||
// AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
|
||||
// UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
|
||||
// RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
|
||||
// CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
|
||||
// OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
|
||||
// COMPANY.
|
||||
//
|
||||
// THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. GOVERNMENT
|
||||
//
|
||||
// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
//
|
||||
// WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE
|
||||
// EXPORT OR DISCLOSURE TO NON-U.S. PERSONS, WHEREVER LOCATED, IS RESTRICTED
|
||||
// BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R. SECTION
|
||||
// 120-130) OR THE EXPORT ADMINISTRATION REGULATIONS (EAR) (15 C.F.R. SECTION
|
||||
// 730-774). THIS DOCUMENT CANNOT BE EXPORTED (E.G., PROVIDED TO A SUPPLIER
|
||||
// OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S. PERSON, WHEREVER
|
||||
// LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS
|
||||
// BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S. GOVERNMENT
|
||||
// APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL
|
||||
// PENALTIES.
|
||||
//
|
||||
// DOD 5220.22-M, INDUSTRIAL SECURITY MANUAL, CHAPTER 5, SECTION 1 THROUGH 9 :
|
||||
// FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN OR DOD 5200.1-R,
|
||||
// INFORMATION SECURITY PROGRAM, CHAPTER 6. FOR UNCLASSIFIED, LIMITED DOCUMENTS
|
||||
// DESTROY BY ANY METHOD THAT WILL PREVENT DISCLOSURE OF CONTENTS OR
|
||||
// RECONSTRUCTION OF THE DOCUMENT.
|
||||
// POC: Alex Kravchenko (1118268)
|
||||
//******************************************************************************//
|
||||
using GalaSoft.MvvmLight;
|
||||
using System;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace Raytheon.LogDashboard.Model
|
||||
{
|
||||
public class LogMessage : ViewModelBase, ICloneable
|
||||
{
|
||||
public LogMessage()
|
||||
{
|
||||
toggleMark.Freeze();
|
||||
}
|
||||
|
||||
public ulong SequenceNumber { get; set; }
|
||||
|
||||
public DateTime Time { get; set; }
|
||||
|
||||
public DashboardLogLevel Level { get; set; }
|
||||
|
||||
public string Logger { get; set; } = string.Empty;
|
||||
|
||||
public int Thread { get; set; }
|
||||
|
||||
public string ThreadName { get; set; }
|
||||
|
||||
public string Message { get; set; }
|
||||
|
||||
public string ExecutableName { get; set; }
|
||||
|
||||
public string Address { get; set; }
|
||||
|
||||
public int Port { get; set; }
|
||||
|
||||
public string ExceptionString { get; set; }
|
||||
|
||||
public int? ProcessID { get; set; }
|
||||
|
||||
public SolidColorBrush Color { get; set; }
|
||||
|
||||
public string FullPath
|
||||
{
|
||||
get
|
||||
{
|
||||
if(string.IsNullOrEmpty(ExecutableName))
|
||||
{
|
||||
return Address + "." + Logger;
|
||||
}
|
||||
|
||||
return Address + "." + ExecutableName + "." + Logger;
|
||||
}
|
||||
}
|
||||
|
||||
private SolidColorBrush toggleMark = new SolidColorBrush(Colors.Transparent);
|
||||
public SolidColorBrush ToggleMark
|
||||
{
|
||||
get => toggleMark;
|
||||
set
|
||||
{
|
||||
Set(() => ToggleMark, ref toggleMark, value);
|
||||
toggleMark.Freeze();
|
||||
}
|
||||
}
|
||||
|
||||
public object Clone()
|
||||
{
|
||||
return new LogMessage
|
||||
{
|
||||
SequenceNumber = SequenceNumber,
|
||||
Address = Address,
|
||||
Port = Port,
|
||||
ExecutableName = ExecutableName,
|
||||
Level = Level,
|
||||
Logger = Logger,
|
||||
Message = Message,
|
||||
Thread = Thread,
|
||||
ThreadName = ThreadName,
|
||||
Time = Time,
|
||||
ExceptionString = ExceptionString,
|
||||
Color = Color,
|
||||
ProcessID = ProcessID,
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
237
Source/LogDashboard/LogDashboard/Model/LogTemplate.cs
Normal file
237
Source/LogDashboard/LogDashboard/Model/LogTemplate.cs
Normal file
@@ -0,0 +1,237 @@
|
||||
//******************************************************************************//
|
||||
// LogTemplate.cs
|
||||
// 12/4/2023
|
||||
//
|
||||
// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
|
||||
// PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
|
||||
// AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
|
||||
// UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
|
||||
// RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
|
||||
// CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
|
||||
// OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
|
||||
// COMPANY.
|
||||
//
|
||||
// THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. GOVERNMENT
|
||||
//
|
||||
// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
//
|
||||
// WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE
|
||||
// EXPORT OR DISCLOSURE TO NON-U.S. PERSONS, WHEREVER LOCATED, IS RESTRICTED
|
||||
// BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R. SECTION
|
||||
// 120-130) OR THE EXPORT ADMINISTRATION REGULATIONS (EAR) (15 C.F.R. SECTION
|
||||
// 730-774). THIS DOCUMENT CANNOT BE EXPORTED (E.G., PROVIDED TO A SUPPLIER
|
||||
// OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S. PERSON, WHEREVER
|
||||
// LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS
|
||||
// BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S. GOVERNMENT
|
||||
// APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL
|
||||
// PENALTIES.
|
||||
//
|
||||
// DOD 5220.22-M, INDUSTRIAL SECURITY MANUAL, CHAPTER 5, SECTION 1 THROUGH 9 :
|
||||
// FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN OR DOD 5200.1-R,
|
||||
// INFORMATION SECURITY PROGRAM, CHAPTER 6. FOR UNCLASSIFIED, LIMITED DOCUMENTS
|
||||
// DESTROY BY ANY METHOD THAT WILL PREVENT DISCLOSURE OF CONTENTS OR
|
||||
// RECONSTRUCTION OF THE DOCUMENT.
|
||||
// POC: Alex Kravchenko (1118268)
|
||||
//******************************************************************************//
|
||||
using GalaSoft.MvvmLight.Messaging;
|
||||
using Raytheon.LogDashboard.Helpers;
|
||||
using Raytheon.LogDashboard.ViewModel;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
|
||||
namespace Raytheon.LogDashboard.Model
|
||||
{
|
||||
public enum LogFileType
|
||||
{
|
||||
Undefined,
|
||||
Log4j,
|
||||
CSV,
|
||||
EPTS,
|
||||
ErrorLogger
|
||||
}
|
||||
|
||||
public class LogTemplate
|
||||
{
|
||||
public Dictionary<ImportTemplateParameters, int> TemplateParameters { get; } = new Dictionary<ImportTemplateParameters, int>();
|
||||
|
||||
public string Separator { get; set; } = ";";
|
||||
|
||||
public string Encoding { get; set; } = "UTF-8";
|
||||
|
||||
public LogFileType LogFileType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// trying to detect template
|
||||
/// </summary>
|
||||
/// <param name="firstMessage"></param>
|
||||
/// <returns></returns>
|
||||
public bool TryGetLogTemplateByAutoDetect(string firstMessage)
|
||||
{
|
||||
if(string.IsNullOrWhiteSpace(firstMessage))
|
||||
{
|
||||
Messenger.Default.Send("An error occurred while trying to automatically match the message template.\nFirst Message is Empty", "DisplayCustomMessage");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(TryDetectTemplate(firstMessage) == LogFileType.Undefined)
|
||||
{
|
||||
Messenger.Default.Send("An error occurred while trying to automatically match the message template.\nLog file type is undefined", "DisplayCustomMessage");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// trying to detect template
|
||||
/// </summary>
|
||||
/// <param name="log"></param>
|
||||
/// <returns></returns>
|
||||
public LogFileType TryDetectTemplate(string log)
|
||||
{
|
||||
LogFileType = LogFileType.Undefined;
|
||||
|
||||
if(log.StartsWith("<log4j"))
|
||||
{
|
||||
LogFileType = LogFileType.Log4j;
|
||||
}
|
||||
else if(log.ContainsAnyOfPattern(new string[] { "^-----", "^\\d{4}-\\d{2}-\\d{2}\\s\\d{2}:\\d{2}:\\d{2},\\d{3}" }))
|
||||
{
|
||||
LogFileType = LogFileType.EPTS;
|
||||
}
|
||||
else if(log.ContainsAnyOfPattern(new string[] {"^\\d{10}\\.\\d{3}"}))
|
||||
{
|
||||
LogFileType = LogFileType.ErrorLogger;
|
||||
}
|
||||
else
|
||||
{
|
||||
string[] logSplit = log.Split(';');
|
||||
if(logSplit.Length < 4)
|
||||
{
|
||||
logSplit = log.Split('|');
|
||||
Separator = "|";
|
||||
if(logSplit.Length < 3)
|
||||
{
|
||||
logSplit = log.Split(',');
|
||||
Separator = ",";
|
||||
}
|
||||
}
|
||||
|
||||
ImportTemplateParameters dataParameter = ImportTemplateParameters.date;
|
||||
|
||||
int dateTimeIndex = GetDateTimeIndex(logSplit, ref dataParameter);
|
||||
if(dateTimeIndex == -1)
|
||||
{
|
||||
return LogFileType.Undefined;
|
||||
}
|
||||
|
||||
var intIndexes = GetIntIndexes(logSplit);
|
||||
int logLevelIndex = GetLogLevelIndex(logSplit);
|
||||
if(dateTimeIndex == -1)
|
||||
{
|
||||
return LogFileType.Undefined;
|
||||
}
|
||||
|
||||
List<int> otherIndexes = new List<int>();
|
||||
|
||||
for(int i = 0; i < logSplit.Length; i++)
|
||||
{
|
||||
|
||||
if(i == dateTimeIndex || i == logLevelIndex || intIndexes.Contains(i))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if(!string.IsNullOrEmpty(logSplit[i]))
|
||||
{
|
||||
otherIndexes.Add(i);
|
||||
}
|
||||
}
|
||||
|
||||
if(otherIndexes.Count > 1)
|
||||
{
|
||||
TemplateParameters.Add(ImportTemplateParameters.logger, otherIndexes.First());
|
||||
}
|
||||
|
||||
TemplateParameters.Add(dataParameter, dateTimeIndex);
|
||||
TemplateParameters.Add(ImportTemplateParameters.level, logLevelIndex);
|
||||
|
||||
TemplateParameters.Add(ImportTemplateParameters.message, otherIndexes.Last());
|
||||
|
||||
if(intIndexes.Count > 0)
|
||||
{
|
||||
TemplateParameters.Add(ImportTemplateParameters.threadid, intIndexes.Last());
|
||||
}
|
||||
|
||||
LogFileType = LogFileType.CSV;
|
||||
|
||||
}
|
||||
|
||||
return LogFileType;
|
||||
}
|
||||
|
||||
private int GetDateTimeIndex(string[] logSplit, ref ImportTemplateParameters dateTemplateParameter)
|
||||
{
|
||||
int index = -1;
|
||||
for(int i = 0; i < logSplit.Length; i++)
|
||||
{
|
||||
string columnString = logSplit[i].Trim();
|
||||
|
||||
if(DateTime.TryParse(columnString, out DateTime date))
|
||||
{
|
||||
return i;
|
||||
}
|
||||
|
||||
if(DateTime.TryParseExact(columnString, "MM-dd-y HH:mm:ss.ffff", CultureInfo.InvariantCulture, DateTimeStyles.None, out DateTime dt))
|
||||
{
|
||||
dateTemplateParameter = ImportTemplateParameters.eptstime;
|
||||
return i;
|
||||
}
|
||||
// legacy Error Logger format
|
||||
if(DateTime.TryParseExact(columnString, "ddd MMM dd HH:mm:ss yyyy fff\\m\\s", null, DateTimeStyles.None, out dt))
|
||||
{
|
||||
dateTemplateParameter = ImportTemplateParameters.errorloggertime;
|
||||
return i;
|
||||
}
|
||||
|
||||
// TODO AK
|
||||
if(long.TryParse(columnString, out long tickDateTime))
|
||||
{
|
||||
DateTime dateFromTicks = new DateTime(tickDateTime);
|
||||
dateTemplateParameter = ImportTemplateParameters.ticks;
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return index;
|
||||
}
|
||||
|
||||
private List<int> GetIntIndexes(string[] logSplit)
|
||||
{
|
||||
List<int> indexes = new List<int>();
|
||||
for(int i = 0; i < logSplit.Length; i++)
|
||||
{
|
||||
if(logSplit[i].IsNumeric())
|
||||
{
|
||||
indexes.Add(i);
|
||||
}
|
||||
}
|
||||
return indexes;
|
||||
}
|
||||
|
||||
private int GetLogLevelIndex(string[] logSplit)
|
||||
{
|
||||
int index = -1;
|
||||
for(int i = 0; i < logSplit.Length; i++)
|
||||
{
|
||||
string line = logSplit[i]?.Trim();
|
||||
if(LogDashboardViewModel.LogTypeArray.Contains(line))
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return index;
|
||||
}
|
||||
}
|
||||
}
|
||||
92
Source/LogDashboard/LogDashboard/Model/LogTemplateItem.cs
Normal file
92
Source/LogDashboard/LogDashboard/Model/LogTemplateItem.cs
Normal file
@@ -0,0 +1,92 @@
|
||||
//******************************************************************************//
|
||||
// LogTemplateItem.cs
|
||||
// 12/4/2023
|
||||
//
|
||||
// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
|
||||
// PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
|
||||
// AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
|
||||
// UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
|
||||
// RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
|
||||
// CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
|
||||
// OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
|
||||
// COMPANY.
|
||||
//
|
||||
// THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. GOVERNMENT
|
||||
//
|
||||
// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
//
|
||||
// WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE
|
||||
// EXPORT OR DISCLOSURE TO NON-U.S. PERSONS, WHEREVER LOCATED, IS RESTRICTED
|
||||
// BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R. SECTION
|
||||
// 120-130) OR THE EXPORT ADMINISTRATION REGULATIONS (EAR) (15 C.F.R. SECTION
|
||||
// 730-774). THIS DOCUMENT CANNOT BE EXPORTED (E.G., PROVIDED TO A SUPPLIER
|
||||
// OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S. PERSON, WHEREVER
|
||||
// LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS
|
||||
// BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S. GOVERNMENT
|
||||
// APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL
|
||||
// PENALTIES.
|
||||
//
|
||||
// DOD 5220.22-M, INDUSTRIAL SECURITY MANUAL, CHAPTER 5, SECTION 1 THROUGH 9 :
|
||||
// FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN OR DOD 5200.1-R,
|
||||
// INFORMATION SECURITY PROGRAM, CHAPTER 6. FOR UNCLASSIFIED, LIMITED DOCUMENTS
|
||||
// DESTROY BY ANY METHOD THAT WILL PREVENT DISCLOSURE OF CONTENTS OR
|
||||
// RECONSTRUCTION OF THE DOCUMENT.
|
||||
// POC: Alex Kravchenko (1118268)
|
||||
//******************************************************************************//
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Windows.Data;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace Raytheon.LogDashboard.Model
|
||||
{
|
||||
[Serializable]
|
||||
[DataContract]
|
||||
public class LogTemplateItem
|
||||
{
|
||||
public LogTemplateItemInfo SelectedTemplateParameter { get; set; }
|
||||
|
||||
public LogTemplateItem()
|
||||
{
|
||||
List<LogTemplateItemInfo> test = new List<LogTemplateItemInfo>
|
||||
{
|
||||
new LogTemplateItemInfo {Group = "Main", Parameter = ImportTemplateParameters.level},
|
||||
new LogTemplateItemInfo {Group = "Main", Parameter = ImportTemplateParameters.logger},
|
||||
new LogTemplateItemInfo {Group = "Main", Parameter = ImportTemplateParameters.message},
|
||||
new LogTemplateItemInfo {Group = "Main", Parameter = ImportTemplateParameters.exception},
|
||||
new LogTemplateItemInfo {Group = "Main", Parameter = ImportTemplateParameters.newline},
|
||||
new LogTemplateItemInfo {Group = "Main", Parameter = ImportTemplateParameters.oneexception},
|
||||
new LogTemplateItemInfo {Group = "Main", Parameter = ImportTemplateParameters.var},
|
||||
|
||||
new LogTemplateItemInfo {Group = "Date and Time", Parameter = ImportTemplateParameters.date},
|
||||
new LogTemplateItemInfo {Group = "Date and Time", Parameter = ImportTemplateParameters.longdate},
|
||||
new LogTemplateItemInfo {Group = "Date and Time", Parameter = ImportTemplateParameters.shortdate},
|
||||
new LogTemplateItemInfo {Group = "Date and Time", Parameter = ImportTemplateParameters.ticks},
|
||||
new LogTemplateItemInfo {Group = "Date and Time", Parameter = ImportTemplateParameters.time},
|
||||
|
||||
new LogTemplateItemInfo {Group = "Call Site and Stack Traces", Parameter = ImportTemplateParameters.сallsite},
|
||||
new LogTemplateItemInfo {Group = "Call Site and Stack Traces", Parameter = ImportTemplateParameters.callsitelinenumber},
|
||||
new LogTemplateItemInfo {Group = "Call Site and Stack Traces", Parameter = ImportTemplateParameters.stacktrace},
|
||||
|
||||
new LogTemplateItemInfo {Group = "Processes, Threads and Assemblies", Parameter = ImportTemplateParameters.threadid},
|
||||
new LogTemplateItemInfo {Group = "Processes, Threads and Assemblies", Parameter = ImportTemplateParameters.threadname},
|
||||
new LogTemplateItemInfo {Group = "Processes, Threads and Assemblies", Parameter = ImportTemplateParameters.processid},
|
||||
new LogTemplateItemInfo {Group = "Processes, Threads and Assemblies", Parameter = ImportTemplateParameters.processinfo},
|
||||
new LogTemplateItemInfo {Group = "Processes, Threads and Assemblies", Parameter = ImportTemplateParameters.processname},
|
||||
new LogTemplateItemInfo {Group = "Processes, Threads and Assemblies", Parameter = ImportTemplateParameters.processtime},
|
||||
new LogTemplateItemInfo {Group = "Processes, Threads and Assemblies", Parameter = ImportTemplateParameters.appdomain},
|
||||
new LogTemplateItemInfo {Group = "Processes, Threads and Assemblies", Parameter = ImportTemplateParameters.hostname},
|
||||
new LogTemplateItemInfo {Group = "Processes, Threads and Assemblies", Parameter = ImportTemplateParameters.machinename},
|
||||
|
||||
new LogTemplateItemInfo {Group = "Other", Parameter = ImportTemplateParameters.other},
|
||||
};
|
||||
|
||||
TemplateItems = new ListCollectionView(test);
|
||||
TemplateItems.GroupDescriptions.Add(new PropertyGroupDescription("Group"));
|
||||
}
|
||||
|
||||
[XmlIgnore]
|
||||
public ListCollectionView TemplateItems { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
//******************************************************************************//
|
||||
// LogTemplateItemInfo.cs
|
||||
// 12/4/2023
|
||||
//
|
||||
// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
|
||||
// PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
|
||||
// AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
|
||||
// UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
|
||||
// RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
|
||||
// CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
|
||||
// OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
|
||||
// COMPANY.
|
||||
//
|
||||
// THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. GOVERNMENT
|
||||
//
|
||||
// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
//
|
||||
// WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE
|
||||
// EXPORT OR DISCLOSURE TO NON-U.S. PERSONS, WHEREVER LOCATED, IS RESTRICTED
|
||||
// BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R. SECTION
|
||||
// 120-130) OR THE EXPORT ADMINISTRATION REGULATIONS (EAR) (15 C.F.R. SECTION
|
||||
// 730-774). THIS DOCUMENT CANNOT BE EXPORTED (E.G., PROVIDED TO A SUPPLIER
|
||||
// OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S. PERSON, WHEREVER
|
||||
// LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS
|
||||
// BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S. GOVERNMENT
|
||||
// APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL
|
||||
// PENALTIES.
|
||||
//
|
||||
// DOD 5220.22-M, INDUSTRIAL SECURITY MANUAL, CHAPTER 5, SECTION 1 THROUGH 9 :
|
||||
// FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN OR DOD 5200.1-R,
|
||||
// INFORMATION SECURITY PROGRAM, CHAPTER 6. FOR UNCLASSIFIED, LIMITED DOCUMENTS
|
||||
// DESTROY BY ANY METHOD THAT WILL PREVENT DISCLOSURE OF CONTENTS OR
|
||||
// RECONSTRUCTION OF THE DOCUMENT.
|
||||
// POC: Alex Kravchenko (1118268)
|
||||
//******************************************************************************//
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace Raytheon.LogDashboard.Model
|
||||
{
|
||||
[Serializable]
|
||||
[DataContract]
|
||||
public class LogTemplateItemInfo
|
||||
{
|
||||
public ImportTemplateParameters Parameter { get; set; }
|
||||
|
||||
public string Group { get; set; }
|
||||
}
|
||||
}
|
||||
151
Source/LogDashboard/LogDashboard/Model/Node.cs
Normal file
151
Source/LogDashboard/LogDashboard/Model/Node.cs
Normal file
@@ -0,0 +1,151 @@
|
||||
//******************************************************************************//
|
||||
// Node.cs
|
||||
// 12/4/2023
|
||||
//
|
||||
// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
|
||||
// PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
|
||||
// AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
|
||||
// UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
|
||||
// RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
|
||||
// CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
|
||||
// OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
|
||||
// COMPANY.
|
||||
//
|
||||
// THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. GOVERNMENT
|
||||
//
|
||||
// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
//
|
||||
// WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE
|
||||
// EXPORT OR DISCLOSURE TO NON-U.S. PERSONS, WHEREVER LOCATED, IS RESTRICTED
|
||||
// BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R. SECTION
|
||||
// 120-130) OR THE EXPORT ADMINISTRATION REGULATIONS (EAR) (15 C.F.R. SECTION
|
||||
// 730-774). THIS DOCUMENT CANNOT BE EXPORTED (E.G., PROVIDED TO A SUPPLIER
|
||||
// OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S. PERSON, WHEREVER
|
||||
// LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS
|
||||
// BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S. GOVERNMENT
|
||||
// APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL
|
||||
// PENALTIES.
|
||||
//
|
||||
// DOD 5220.22-M, INDUSTRIAL SECURITY MANUAL, CHAPTER 5, SECTION 1 THROUGH 9 :
|
||||
// FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN OR DOD 5200.1-R,
|
||||
// INFORMATION SECURITY PROGRAM, CHAPTER 6. FOR UNCLASSIFIED, LIMITED DOCUMENTS
|
||||
// DESTROY BY ANY METHOD THAT WILL PREVENT DISCLOSURE OF CONTENTS OR
|
||||
// RECONSTRUCTION OF THE DOCUMENT.
|
||||
// POC: Alex Kravchenko (1118268)
|
||||
//******************************************************************************//
|
||||
using GalaSoft.MvvmLight;
|
||||
using System;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace Raytheon.LogDashboard.Model
|
||||
{
|
||||
public class Node : ObservableObject
|
||||
{
|
||||
private string text;
|
||||
private bool? isChecked = true;
|
||||
private bool isExpanded;
|
||||
private bool isSelected = false;
|
||||
private string source = string.Empty;
|
||||
|
||||
public Node()
|
||||
{
|
||||
Id = Guid.NewGuid().ToString();
|
||||
toggleMark.Freeze();
|
||||
}
|
||||
|
||||
public Node(Node parent, string txt)
|
||||
{
|
||||
toggleMark.Freeze();
|
||||
Id = Guid.NewGuid().ToString();
|
||||
Parent = parent;
|
||||
Text = txt;
|
||||
|
||||
if(Parent != null && parent.Text != "Root")
|
||||
{
|
||||
IsExpanded = Parent.IsExpanded;
|
||||
|
||||
Logger = Parent.Logger + "." + Text;
|
||||
|
||||
if(!string.IsNullOrEmpty(Parent.Source))
|
||||
{
|
||||
Source = Parent.Source;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Logger = Text;
|
||||
}
|
||||
}
|
||||
|
||||
public ObservableCollection<Node> Children { get; } = new ObservableCollection<Node>();
|
||||
|
||||
public Node Parent { get; }
|
||||
|
||||
public bool? IsChecked
|
||||
{
|
||||
get => isChecked;
|
||||
set { Set(() => IsChecked, ref isChecked, value); }
|
||||
}
|
||||
|
||||
public string Text
|
||||
{
|
||||
get => text;
|
||||
set { Set(() => Text, ref text, value); }
|
||||
}
|
||||
|
||||
public string Logger { get; set; }
|
||||
public bool IsRoot { get; set; }
|
||||
|
||||
public bool IsExpanded
|
||||
{
|
||||
get => isExpanded;
|
||||
set { Set(() => IsExpanded, ref isExpanded, value); }
|
||||
}
|
||||
|
||||
private bool isVisible = true;
|
||||
public bool IsVisible
|
||||
{
|
||||
get => isVisible;
|
||||
set { Set(() => IsVisible, ref isVisible, value); }
|
||||
}
|
||||
|
||||
public string Source
|
||||
{
|
||||
get => source;
|
||||
set { Set(() => Source, ref source, value); }
|
||||
}
|
||||
|
||||
private SolidColorBrush toggleMark = new SolidColorBrush(Colors.Transparent);
|
||||
|
||||
public SolidColorBrush ToggleMark
|
||||
{
|
||||
get => toggleMark;
|
||||
set
|
||||
{
|
||||
Set(() => ToggleMark, ref toggleMark, value);
|
||||
toggleMark.Freeze();
|
||||
}
|
||||
}
|
||||
|
||||
public string Id { get; set; }
|
||||
|
||||
private void CheckChildNodes(ObservableCollection<Node> itemsChild, bool? isChecked)
|
||||
{
|
||||
foreach(Node item in itemsChild)
|
||||
{
|
||||
item.IsChecked = isChecked;
|
||||
if(item.Children.Count != 0)
|
||||
{
|
||||
CheckChildNodes(item.Children, isChecked);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsSelected
|
||||
{
|
||||
get => isSelected;
|
||||
set { Set(() => IsSelected, ref isSelected, value); }
|
||||
}
|
||||
}
|
||||
}
|
||||
365
Source/LogDashboard/LogDashboard/Model/Receiver.cs
Normal file
365
Source/LogDashboard/LogDashboard/Model/Receiver.cs
Normal file
@@ -0,0 +1,365 @@
|
||||
//******************************************************************************//
|
||||
// Receiver.cs
|
||||
// 12/4/2023
|
||||
//
|
||||
// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
|
||||
// PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
|
||||
// AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
|
||||
// UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
|
||||
// RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
|
||||
// CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
|
||||
// OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
|
||||
// COMPANY.
|
||||
//
|
||||
// THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. GOVERNMENT
|
||||
//
|
||||
// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
//
|
||||
// WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE
|
||||
// EXPORT OR DISCLOSURE TO NON-U.S. PERSONS, WHEREVER LOCATED, IS RESTRICTED
|
||||
// BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R. SECTION
|
||||
// 120-130) OR THE EXPORT ADMINISTRATION REGULATIONS (EAR) (15 C.F.R. SECTION
|
||||
// 730-774). THIS DOCUMENT CANNOT BE EXPORTED (E.G., PROVIDED TO A SUPPLIER
|
||||
// OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S. PERSON, WHEREVER
|
||||
// LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS
|
||||
// BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S. GOVERNMENT
|
||||
// APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL
|
||||
// PENALTIES.
|
||||
//
|
||||
// DOD 5220.22-M, INDUSTRIAL SECURITY MANUAL, CHAPTER 5, SECTION 1 THROUGH 9 :
|
||||
// FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN OR DOD 5200.1-R,
|
||||
// INFORMATION SECURITY PROGRAM, CHAPTER 6. FOR UNCLASSIFIED, LIMITED DOCUMENTS
|
||||
// DESTROY BY ANY METHOD THAT WILL PREVENT DISCLOSURE OF CONTENTS OR
|
||||
// RECONSTRUCTION OF THE DOCUMENT.
|
||||
// POC: Alex Kravchenko (1118268)
|
||||
//******************************************************************************//
|
||||
using GalaSoft.MvvmLight;
|
||||
using Raytheon.LogDashboard.Helpers;
|
||||
using Raytheon.LogDashboard.Parsers;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Windows.Media;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace Raytheon.LogDashboard.Model
|
||||
{
|
||||
public enum ReceiverType
|
||||
{
|
||||
[Description("UDP")]
|
||||
UDP,
|
||||
[Description("WCF Named Pipes")]
|
||||
WCF,
|
||||
[Description("Error Logger")]
|
||||
ErrorLogger,
|
||||
[Description("Windows Debug")]
|
||||
WinDebug
|
||||
}
|
||||
|
||||
public enum ErrorLoggerType
|
||||
{
|
||||
[Description("32 Bit Logger")]
|
||||
BIT_32,
|
||||
[Description("64 Bit Logger")]
|
||||
BIT_64
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
[DataContract]
|
||||
public class Receiver : ViewModelBase, ICloneable, IDisposable
|
||||
{
|
||||
[NonSerialized]
|
||||
private SolidColorBrush color = new SolidColorBrush(Colors.White);
|
||||
[DataMember(Name = "ColorString")]
|
||||
private string colorString;
|
||||
private int port = 0;
|
||||
private bool isActive = true;
|
||||
private string encoding = "UTF-8";
|
||||
private IEnumerable<string> receiverNames { get; set; }
|
||||
|
||||
public PacketsParser Parser { get; set; }
|
||||
|
||||
public Receiver(string name, string address, ReceiverType type, IEnumerable<string> receiverNames)
|
||||
{
|
||||
Parser = null;
|
||||
this.receiverNames = receiverNames;
|
||||
Name = GetUniqueName(name, 0);
|
||||
Address = address;
|
||||
ReceiverType = type;
|
||||
ColorString = "#FFFFFFFF";
|
||||
}
|
||||
|
||||
public Receiver(ReceiverSetting receiverSetting)
|
||||
{
|
||||
Name = receiverSetting.Name;
|
||||
ReceiverType = receiverSetting.ReceiverType;
|
||||
Address = receiverSetting.Address;
|
||||
Parser = null;
|
||||
Port = receiverSetting.Port;
|
||||
IsActive = receiverSetting.IsActive;
|
||||
Encoding = receiverSetting.Encoding;
|
||||
ColorString = receiverSetting.ColorString;
|
||||
IsAddressVisible = receiverSetting.IsAddressVisible;
|
||||
IsPortVisible = receiverSetting.IsPortVisible;
|
||||
IsHidden = receiverSetting.IsHidden;
|
||||
IsAutoSave = receiverSetting.IsAutoSave;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// sets the parser type plus sets port number for UDP parser
|
||||
/// </summary>
|
||||
/// <param name="parser"></param>
|
||||
/// <returns></returns>
|
||||
private ReceiverType DeriveTypeFromParser(PacketsParser parser)
|
||||
{
|
||||
switch(parser)
|
||||
{
|
||||
case UDPPacketsParser udp:
|
||||
Port = udp.Port;
|
||||
return ReceiverType.UDP;
|
||||
case WCFPacketsParser _:
|
||||
return ReceiverType.WCF;
|
||||
case ErrorLoggerPacketsParser _:
|
||||
return ReceiverType.ErrorLogger;
|
||||
case DebugMonitorParser _:
|
||||
return ReceiverType.WinDebug;
|
||||
default:
|
||||
return ReceiverType.UDP;
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsHidden { get; set; }
|
||||
|
||||
private string name;
|
||||
public string Name
|
||||
{
|
||||
get => name;
|
||||
set { Set(() => Name, ref name, value); }
|
||||
}
|
||||
|
||||
private ErrorLoggerType errorLoggerType;
|
||||
public ErrorLoggerType ErrorLoggerType
|
||||
{
|
||||
get => errorLoggerType;
|
||||
set
|
||||
{
|
||||
Set(() => ErrorLoggerType, ref errorLoggerType, value);
|
||||
if(ReceiverType == ReceiverType.ErrorLogger)
|
||||
{
|
||||
if(errorLoggerType == ErrorLoggerType.BIT_64)
|
||||
{
|
||||
Address = "TsdcSystemSwErrorMailSlot64";
|
||||
}
|
||||
else
|
||||
{
|
||||
Address = "TsdcSystemSwErrorMailSlot";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private ReceiverType receiverType;
|
||||
public ReceiverType ReceiverType
|
||||
{
|
||||
get => receiverType;
|
||||
set
|
||||
{
|
||||
Set(() => ReceiverType, ref receiverType, value);
|
||||
IsAddressVisible = ReceiverType == ReceiverType.WCF || ReceiverType == ReceiverType.ErrorLogger;
|
||||
|
||||
if(ReceiverType == ReceiverType.WinDebug)
|
||||
{
|
||||
if(string.IsNullOrEmpty(Name))
|
||||
{
|
||||
Name = GetUniqueName("Windows Debug", 0);
|
||||
}
|
||||
Address = string.Empty;
|
||||
Port = 0;
|
||||
IsPortVisible = false;
|
||||
IsAddressVisible = false;
|
||||
IsErrorLogger = false;
|
||||
IsAutoSave = false;
|
||||
}
|
||||
else if(ReceiverType == ReceiverType.UDP)
|
||||
{
|
||||
if(string.IsNullOrEmpty(Name))
|
||||
{
|
||||
Name = GetUniqueName("UDP", 0);
|
||||
}
|
||||
Address = string.Empty;
|
||||
IsPortVisible = true;
|
||||
IsAddressVisible = false;
|
||||
IsErrorLogger = false;
|
||||
IsAutoSave = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
Port = 0;
|
||||
IsPortVisible = false;
|
||||
IsAddressVisible = true;
|
||||
IsErrorLogger = false;
|
||||
IsAutoSave = false;
|
||||
}
|
||||
|
||||
if(ReceiverType == ReceiverType.WCF)
|
||||
{
|
||||
if(string.IsNullOrEmpty(Name))
|
||||
{
|
||||
Name = GetUniqueName("EPTS", 0);
|
||||
}
|
||||
IsErrorLogger = false;
|
||||
Address = "net.pipe://localhost/EPServer";
|
||||
IsAutoSave = false;
|
||||
}
|
||||
|
||||
if(ReceiverType == ReceiverType.ErrorLogger)
|
||||
{
|
||||
if(string.IsNullOrEmpty(Name))
|
||||
{
|
||||
Name = GetUniqueName("Error Logger", 0);
|
||||
}
|
||||
IsErrorLogger = true;
|
||||
Address = "TsdcSystemSwErrorMailSlot";
|
||||
IsAutoSave = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// returns a unique suggestion for the receiver name
|
||||
/// </summary>
|
||||
/// <param name="baseName"></param>
|
||||
/// <param name="index"></param>
|
||||
/// <returns></returns>
|
||||
private string GetUniqueName(string baseName, int index)
|
||||
{
|
||||
if(receiverNames == null)
|
||||
{
|
||||
return baseName;
|
||||
}
|
||||
string rollingName = index > 1 ? $"{baseName} {index}" : baseName;
|
||||
while(receiverNames.ToList().Contains(rollingName))
|
||||
{
|
||||
return GetUniqueName(baseName, ++index);
|
||||
}
|
||||
return rollingName;
|
||||
}
|
||||
|
||||
private bool isPortVisible;
|
||||
public bool IsPortVisible
|
||||
{
|
||||
get => isPortVisible;
|
||||
set { Set(() => IsPortVisible, ref isPortVisible, value); }
|
||||
}
|
||||
private bool isErrorLogger;
|
||||
public bool IsErrorLogger
|
||||
{
|
||||
get => isErrorLogger;
|
||||
set { Set(() => IsErrorLogger, ref isErrorLogger, value); }
|
||||
}
|
||||
|
||||
public int Port
|
||||
{
|
||||
get => port;
|
||||
set { Set(() => Port, ref port, value); }
|
||||
}
|
||||
|
||||
[XmlIgnore]
|
||||
public SolidColorBrush Color
|
||||
{
|
||||
get => color;
|
||||
set
|
||||
{
|
||||
colorString = value.ToARGB();
|
||||
Set(() => Color, ref color, value);
|
||||
}
|
||||
}
|
||||
|
||||
public string ColorString
|
||||
{
|
||||
get => colorString;
|
||||
set
|
||||
{
|
||||
if(string.IsNullOrEmpty(value))
|
||||
{
|
||||
value = "#FFFFFFFF";
|
||||
}
|
||||
|
||||
color = color.FromARGB(value);
|
||||
Set(() => ColorString, ref colorString, value);
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsActive
|
||||
{
|
||||
get => isActive;
|
||||
set { Set(() => IsActive, ref isActive, value); }
|
||||
}
|
||||
|
||||
public string Encoding
|
||||
{
|
||||
get => encoding;
|
||||
set { Set(() => Encoding, ref encoding, value); }
|
||||
}
|
||||
|
||||
private string address;
|
||||
public string Address
|
||||
{
|
||||
get => address;
|
||||
set { Set(() => Address, ref address, value); }
|
||||
}
|
||||
|
||||
private bool isAddressVisible;
|
||||
public bool IsAddressVisible
|
||||
{
|
||||
get => isAddressVisible;
|
||||
set { Set(() => IsAddressVisible, ref isAddressVisible, value); }
|
||||
}
|
||||
|
||||
private bool isAutoSave;
|
||||
public bool IsAutoSave
|
||||
{
|
||||
get => isAutoSave && Settings.Instance.IsAutoSave;
|
||||
set
|
||||
{
|
||||
Set(() => IsAutoSave, ref isAutoSave, value);
|
||||
|
||||
if(Parser != null)
|
||||
{
|
||||
Parser.IsAutoSave = isAutoSave;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[OnDeserialized]
|
||||
private void SetValuesOnDeserialized(StreamingContext context)
|
||||
{
|
||||
color = color.FromARGB(colorString);
|
||||
}
|
||||
|
||||
public object Clone()
|
||||
{
|
||||
return new Receiver(Name, Address, ReceiverType, receiverNames)
|
||||
{
|
||||
ColorString = ColorString,
|
||||
IsActive = IsActive,
|
||||
Color = Color,
|
||||
Port = Port,
|
||||
Encoding = Encoding,
|
||||
IsAddressVisible = IsAddressVisible,
|
||||
IsAutoSave = IsAutoSave,
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// clear the parser
|
||||
/// </summary>
|
||||
public void Dispose()
|
||||
{
|
||||
Parser?.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
94
Source/LogDashboard/LogDashboard/Model/ReceiverSetting.cs
Normal file
94
Source/LogDashboard/LogDashboard/Model/ReceiverSetting.cs
Normal file
@@ -0,0 +1,94 @@
|
||||
//******************************************************************************//
|
||||
// ReceiverSetting.cs
|
||||
// 12/4/2023
|
||||
//
|
||||
// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
|
||||
// PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
|
||||
// AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
|
||||
// UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
|
||||
// RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
|
||||
// CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
|
||||
// OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
|
||||
// COMPANY.
|
||||
//
|
||||
// THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. GOVERNMENT
|
||||
//
|
||||
// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
//
|
||||
// WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE
|
||||
// EXPORT OR DISCLOSURE TO NON-U.S. PERSONS, WHEREVER LOCATED, IS RESTRICTED
|
||||
// BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R. SECTION
|
||||
// 120-130) OR THE EXPORT ADMINISTRATION REGULATIONS (EAR) (15 C.F.R. SECTION
|
||||
// 730-774). THIS DOCUMENT CANNOT BE EXPORTED (E.G., PROVIDED TO A SUPPLIER
|
||||
// OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S. PERSON, WHEREVER
|
||||
// LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS
|
||||
// BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S. GOVERNMENT
|
||||
// APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL
|
||||
// PENALTIES.
|
||||
//
|
||||
// DOD 5220.22-M, INDUSTRIAL SECURITY MANUAL, CHAPTER 5, SECTION 1 THROUGH 9 :
|
||||
// FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN OR DOD 5200.1-R,
|
||||
// INFORMATION SECURITY PROGRAM, CHAPTER 6. FOR UNCLASSIFIED, LIMITED DOCUMENTS
|
||||
// DESTROY BY ANY METHOD THAT WILL PREVENT DISCLOSURE OF CONTENTS OR
|
||||
// RECONSTRUCTION OF THE DOCUMENT.
|
||||
// POC: Alex Kravchenko (1118268)
|
||||
//******************************************************************************//
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace Raytheon.LogDashboard.Model
|
||||
{
|
||||
public class ReceiverSetting
|
||||
{
|
||||
public ReceiverSetting()
|
||||
{
|
||||
}
|
||||
|
||||
public ReceiverSetting(Receiver receiver)
|
||||
{
|
||||
Name = receiver.Name;
|
||||
IsHidden = receiver.IsHidden;
|
||||
ReceiverType = receiver.ReceiverType;
|
||||
IsPortVisible = receiver.IsPortVisible;
|
||||
Port = receiver.Port;
|
||||
IsAddressVisible = receiver.IsAddressVisible;
|
||||
Address = receiver.Address;
|
||||
IsActive = receiver.IsActive;
|
||||
Encoding = receiver.Encoding;
|
||||
ColorString = receiver.ColorString;
|
||||
IsAutoSave = receiver.IsAutoSave;
|
||||
}
|
||||
|
||||
[XmlElement]
|
||||
public bool IsHidden { get; set; }
|
||||
|
||||
[XmlElement]
|
||||
public string Name { get; set; }
|
||||
|
||||
[XmlElement]
|
||||
public ReceiverType ReceiverType { get; set; }
|
||||
|
||||
[XmlElement]
|
||||
public bool IsPortVisible { get; set; }
|
||||
|
||||
[XmlElement]
|
||||
public bool IsAutoSave { get; set; }
|
||||
|
||||
[XmlElement]
|
||||
public int Port { get; set; }
|
||||
|
||||
[XmlElement]
|
||||
public bool IsAddressVisible { get; set; }
|
||||
|
||||
[XmlElement]
|
||||
public string Address { get; set; }
|
||||
|
||||
[XmlElement]
|
||||
public bool IsActive { get; set; }
|
||||
|
||||
[XmlElement]
|
||||
public string Encoding { get; set; }
|
||||
|
||||
[XmlElement]
|
||||
public string ColorString { get; set; }
|
||||
}
|
||||
}
|
||||
58
Source/LogDashboard/LogDashboard/Model/ReleaseNotes.cs
Normal file
58
Source/LogDashboard/LogDashboard/Model/ReleaseNotes.cs
Normal file
@@ -0,0 +1,58 @@
|
||||
//******************************************************************************//
|
||||
// ReleaseNotes.cs
|
||||
// 12/4/2023
|
||||
//
|
||||
// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
|
||||
// PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
|
||||
// AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
|
||||
// UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
|
||||
// RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
|
||||
// CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
|
||||
// OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
|
||||
// COMPANY.
|
||||
//
|
||||
// THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. GOVERNMENT
|
||||
//
|
||||
// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
//
|
||||
// WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE
|
||||
// EXPORT OR DISCLOSURE TO NON-U.S. PERSONS, WHEREVER LOCATED, IS RESTRICTED
|
||||
// BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R. SECTION
|
||||
// 120-130) OR THE EXPORT ADMINISTRATION REGULATIONS (EAR) (15 C.F.R. SECTION
|
||||
// 730-774). THIS DOCUMENT CANNOT BE EXPORTED (E.G., PROVIDED TO A SUPPLIER
|
||||
// OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S. PERSON, WHEREVER
|
||||
// LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS
|
||||
// BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S. GOVERNMENT
|
||||
// APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL
|
||||
// PENALTIES.
|
||||
//
|
||||
// DOD 5220.22-M, INDUSTRIAL SECURITY MANUAL, CHAPTER 5, SECTION 1 THROUGH 9 :
|
||||
// FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN OR DOD 5200.1-R,
|
||||
// INFORMATION SECURITY PROGRAM, CHAPTER 6. FOR UNCLASSIFIED, LIMITED DOCUMENTS
|
||||
// DESTROY BY ANY METHOD THAT WILL PREVENT DISCLOSURE OF CONTENTS OR
|
||||
// RECONSTRUCTION OF THE DOCUMENT.
|
||||
// POC: Alex Kravchenko (1118268)
|
||||
//******************************************************************************//
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace Raytheon.LogDashboard.Model
|
||||
{
|
||||
[Serializable]
|
||||
[DataContract]
|
||||
public class ReleaseNotes
|
||||
{
|
||||
public string Version { get; set; }
|
||||
|
||||
public List<string> NewFeatures { get; set; } = new List<string>();
|
||||
|
||||
public List<string> ChangedFeatures { get; set; } = new List<string>();
|
||||
|
||||
public List<string> FixedBugs { get; set; } = new List<string>();
|
||||
|
||||
[XmlIgnore]
|
||||
public bool IsExpanded { get; set; } = false;
|
||||
}
|
||||
}
|
||||
250
Source/LogDashboard/LogDashboard/Model/Settings.cs
Normal file
250
Source/LogDashboard/LogDashboard/Model/Settings.cs
Normal file
@@ -0,0 +1,250 @@
|
||||
//******************************************************************************//
|
||||
// Settings.cs
|
||||
// 12/4/2023
|
||||
//
|
||||
// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
|
||||
// PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
|
||||
// AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
|
||||
// UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
|
||||
// RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
|
||||
// CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
|
||||
// OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
|
||||
// COMPANY.
|
||||
//
|
||||
// THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. GOVERNMENT
|
||||
//
|
||||
// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
//
|
||||
// WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE
|
||||
// EXPORT OR DISCLOSURE TO NON-U.S. PERSONS, WHEREVER LOCATED, IS RESTRICTED
|
||||
// BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R. SECTION
|
||||
// 120-130) OR THE EXPORT ADMINISTRATION REGULATIONS (EAR) (15 C.F.R. SECTION
|
||||
// 730-774). THIS DOCUMENT CANNOT BE EXPORTED (E.G., PROVIDED TO A SUPPLIER
|
||||
// OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S. PERSON, WHEREVER
|
||||
// LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS
|
||||
// BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S. GOVERNMENT
|
||||
// APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL
|
||||
// PENALTIES.
|
||||
//
|
||||
// DOD 5220.22-M, INDUSTRIAL SECURITY MANUAL, CHAPTER 5, SECTION 1 THROUGH 9 :
|
||||
// FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN OR DOD 5200.1-R,
|
||||
// INFORMATION SECURITY PROGRAM, CHAPTER 6. FOR UNCLASSIFIED, LIMITED DOCUMENTS
|
||||
// DESTROY BY ANY METHOD THAT WILL PREVENT DISCLOSURE OF CONTENTS OR
|
||||
// RECONSTRUCTION OF THE DOCUMENT.
|
||||
// POC: Alex Kravchenko (1118268)
|
||||
//******************************************************************************//
|
||||
|
||||
// Ignore Spelling: Taskbar
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Security.Permissions;
|
||||
using System.Web;
|
||||
using System.Windows.Media;
|
||||
using System.Windows;
|
||||
using NLog;
|
||||
using Raytheon.Common;
|
||||
using Raytheon.LogDashboard.ViewModel;
|
||||
using System.Linq;
|
||||
|
||||
namespace Raytheon.LogDashboard.Model
|
||||
{
|
||||
[Serializable]
|
||||
[PermissionSet(SecurityAction.Demand, Name = "FullTrust")]
|
||||
[AspNetHostingPermission(SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
|
||||
public sealed class Settings
|
||||
{
|
||||
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
|
||||
private static Settings instance;
|
||||
private readonly string settingsPath;
|
||||
private static LogDashViewModelLocator locatorInstance => (Application.Current.Resources["LogDashLocator"] as LogDashViewModelLocator);
|
||||
|
||||
public bool AutoStartInStartup { get; set; } = false;
|
||||
public bool MinimizeToTray { get; set; } = false;
|
||||
public bool OnlyOneAppInstance { get; set; } = false;
|
||||
public bool IsEnabledMaxMessageBufferSize { get; set; } = false;
|
||||
public int MaxMessageBufferSize { get; set; } = 1000000;
|
||||
public int DeletedMessagesCount { get; set; } = 100000;
|
||||
public string DataFormat { get; set; } = "MM/dd/yyyy HH:mm:ss.fff";
|
||||
public string FontColor { get; set; } = "#FFFFFFFF";
|
||||
|
||||
private static List<ColorTheme> BuildListOfThemes()
|
||||
{
|
||||
List<KeyValuePair<string, Color>> colors = typeof(Colors)
|
||||
.GetProperties()
|
||||
.Where(prop => typeof(Color).IsAssignableFrom(prop.PropertyType))
|
||||
.Select(prop => new KeyValuePair<string, Color>(prop.Name, (Color)prop.GetValue(null)))
|
||||
.ToList();
|
||||
|
||||
List<ColorTheme> themes = new List<ColorTheme>();
|
||||
|
||||
foreach(var color in colors)
|
||||
{
|
||||
themes.Add(new ColorTheme { Color = new SolidColorBrush(color.Value), Name = color.Key, ThemeColorString = color.Value.ToString() });
|
||||
}
|
||||
|
||||
return themes;
|
||||
}
|
||||
public static List<ColorTheme> ColorThemes { get; } = BuildListOfThemes();
|
||||
|
||||
public static List<string> Themes { get; } = new List<string> { "BaseLight", "BaseDark" };
|
||||
|
||||
public ColorTheme CurrentColorTheme { get; set; }
|
||||
|
||||
public string CurrentTheme { get; set; }
|
||||
|
||||
public List<Receiver> Receivers { get; set; } = new List<Receiver>();
|
||||
public List<IgnoredIPAddr> IgnoredIPs { get; set; } = new List<IgnoredIPAddr>();
|
||||
|
||||
/// <summary>
|
||||
/// show column with source
|
||||
/// </summary>
|
||||
public bool IsShowSourceColumn { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// show thread column
|
||||
/// </summary>
|
||||
public bool IsShowThreadColumn { get; set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// show progress in the taskbar
|
||||
/// </summary>
|
||||
public bool IsShowTaskbarProgress { get; set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// highlight message with receiver color
|
||||
/// </summary>
|
||||
public bool ShowMessageHighlightByReceiverColor { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// separate logs by port number
|
||||
/// </summary>
|
||||
public bool IsSeparateIPLoggersByPort { get; set; } = false;
|
||||
|
||||
public bool IsAutoSave { get; set; }
|
||||
|
||||
public bool IsErrorLogger { get; set; }
|
||||
|
||||
public string AutoSaveLocation { get; set; }
|
||||
|
||||
public long AutoSaveMaxSize { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// indicates if LogDashboard is embedded in another application
|
||||
/// </summary>
|
||||
public bool EmbeddedMode { get; set; }
|
||||
|
||||
private Settings(string path)
|
||||
{
|
||||
settingsPath = !string.IsNullOrEmpty(path)
|
||||
? path
|
||||
: Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "LogDashboard", "LogDashboard.xml");
|
||||
}
|
||||
|
||||
public static Settings Instance => instance ?? SetInstance("");
|
||||
|
||||
public static Settings SetInstance(string path) => instance ?? (instance = new Settings(path));
|
||||
|
||||
/// <summary>
|
||||
/// using theme
|
||||
/// </summary>
|
||||
public void ApplyTheme()
|
||||
{
|
||||
try
|
||||
{
|
||||
Application.Current.Resources.MergedDictionaries[2] = new ResourceDictionary { Source = CurrentColorTheme.ThemeUri };
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
logger.Warn(e, $"An error occurred while ApplyTheme. SelectedTheme - {CurrentColorTheme.Name}");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// save settings
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public bool Save()
|
||||
{
|
||||
try
|
||||
{
|
||||
ConfigurationFile configurationFile = new ConfigurationFile(settingsPath);
|
||||
|
||||
List<ReceiverSetting> receiverSettings = new List<ReceiverSetting>();
|
||||
foreach(Receiver receiver in Instance.Receivers)
|
||||
{
|
||||
receiverSettings.Add(new ReceiverSetting(receiver));
|
||||
}
|
||||
|
||||
configurationFile.WriteValue("Base", "AutoStartInStartup", Instance.AutoStartInStartup);
|
||||
configurationFile.WriteValue("Base", "MinimizeToTray", Instance.MinimizeToTray);
|
||||
configurationFile.WriteValue("CurrentThemes", "CurrentColorTheme", Instance.CurrentColorTheme);
|
||||
configurationFile.WriteValue("CurrentThemes", "CurrentTheme", Instance.CurrentTheme);
|
||||
configurationFile.WriteValue("Base", "DataFormat", Instance.DataFormat);
|
||||
configurationFile.WriteList("IgnoredIP", "IgnoredIP", Instance.IgnoredIPs);
|
||||
configurationFile.WriteList("ReceiverList", "Receiver", receiverSettings);
|
||||
configurationFile.WriteValue("Base", "FontColor", Instance.FontColor);
|
||||
configurationFile.WriteValue("Base", "OnlyOneAppInstance", Instance.OnlyOneAppInstance);
|
||||
configurationFile.WriteValue("Base", "IsEnabledMaxMessageBufferSize", Instance.IsEnabledMaxMessageBufferSize);
|
||||
configurationFile.WriteValue("Base", "MaxMessageBufferSize", Instance.MaxMessageBufferSize);
|
||||
configurationFile.WriteValue("Base", "DeletedMessagesCount", Instance.DeletedMessagesCount);
|
||||
configurationFile.WriteValue("Base", "IsShowSourceColumn", Instance.IsShowSourceColumn);
|
||||
configurationFile.WriteValue("Base", "IsShowThreadColumn", Instance.IsShowThreadColumn);
|
||||
configurationFile.WriteValue("Base", "IsShowTaskbarProgress", Instance.IsShowTaskbarProgress);
|
||||
configurationFile.WriteValue("Base", "ShowMessageHighlightByReceiverColor", Instance.ShowMessageHighlightByReceiverColor);
|
||||
configurationFile.WriteValue("Base", "IsSeparateIPLoggersByPort", Instance.IsSeparateIPLoggersByPort);
|
||||
configurationFile.WriteValue("Base", "EmbeddedMode", Instance.EmbeddedMode);
|
||||
configurationFile.WriteValue("Base", "IsAutoSave", Instance.IsAutoSave);
|
||||
configurationFile.WriteValue("Base", "IsErrorLogger", Instance.IsErrorLogger);
|
||||
configurationFile.WriteValue("Base", "AutoSaveLocation", Instance.AutoSaveLocation ?? "");
|
||||
|
||||
return true;
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
logger.Warn(e, "An error occurred while Save settings.");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public void Load()
|
||||
{
|
||||
IConfigurationFile configurationFile = new ConfigurationFile(settingsPath);
|
||||
Instance.AutoStartInStartup = configurationFile.ReadValue("Base", "AutoStartInStartup", true);
|
||||
Instance.MinimizeToTray = configurationFile.ReadValue("Base", "MinimizeToTray", false);
|
||||
|
||||
Instance.CurrentColorTheme = configurationFile.ReadValue("CurrentThemes", "CurrentColorTheme", new ColorTheme { Color = new SolidColorBrush(), Name = "DodgerBlue", ThemeColorString = "#FF1E90FF" });
|
||||
|
||||
Instance.CurrentTheme = configurationFile.ReadValue("CurrentThemes", "CurrentTheme", "BaseLight");
|
||||
|
||||
Instance.DataFormat = configurationFile.ReadValue("Base", "DataFormat", "MM/dd/yyyy HH:mm:ss.fff");
|
||||
Instance.IgnoredIPs = configurationFile.ReadList("IgnoredIP", "IgnoredIP", new List<IgnoredIPAddr>());
|
||||
var receiverSettins = configurationFile.ReadList("ReceiverList", "Receiver", new List<ReceiverSetting>
|
||||
{
|
||||
new ReceiverSetting { Name = "UDP", ReceiverType = ReceiverType.UDP, Port = 7777, IsActive = true, ColorString = "#00FFFFFF", IsPortVisible = true, Encoding = "UTF-8" }
|
||||
});
|
||||
|
||||
foreach(ReceiverSetting receiverSetting in receiverSettins)
|
||||
{
|
||||
Instance.Receivers.Add(new Receiver(receiverSetting));
|
||||
}
|
||||
|
||||
Instance.FontColor = configurationFile.ReadValue("Base", "FontColor", "#FF1E90FF");
|
||||
Instance.OnlyOneAppInstance = configurationFile.ReadValue("Base", "OnlyOneAppInstance", true);
|
||||
Instance.IsEnabledMaxMessageBufferSize = configurationFile.ReadValue("Base", "IsEnabledMaxMessageBufferSize", false);
|
||||
Instance.MaxMessageBufferSize = configurationFile.ReadValue("Base", "MaxMessageBufferSize", 1000000);
|
||||
Instance.DeletedMessagesCount = configurationFile.ReadValue("Base", "DeletedMessagesCount", 100000);
|
||||
Instance.IsShowSourceColumn = configurationFile.ReadValue("Base", "IsShowSourceColumn", true);
|
||||
Instance.IsShowThreadColumn = configurationFile.ReadValue("Base", "IsShowThreadColumn", true);
|
||||
Instance.IsShowTaskbarProgress = configurationFile.ReadValue("Base", "IsShowTaskbarProgress", true);
|
||||
Instance.ShowMessageHighlightByReceiverColor = configurationFile.ReadValue("Base", "ShowMessageHighlightByReceiverColor", true);
|
||||
Instance.IsSeparateIPLoggersByPort = configurationFile.ReadValue("Base", "IsSeparateIPLoggersByPort", true);
|
||||
Instance.EmbeddedMode = configurationFile.ReadValue("Base", "EmbeddedMode", false);
|
||||
Instance.IsAutoSave = configurationFile.ReadValue("Base", "IsAutoSave", false);
|
||||
Instance.IsErrorLogger = configurationFile.ReadValue("Base", "IsErrorLogger", false);
|
||||
Instance.AutoSaveLocation = configurationFile.ReadValue("Base", "AutoSaveLocation", "");
|
||||
Instance.AutoSaveMaxSize = configurationFile.ReadValue<long>("Base", "AutoSaveMaxSize", 10 * 1048576); // 10 MG
|
||||
}
|
||||
}
|
||||
}
|
||||
83
Source/LogDashboard/LogDashboard/Model/Theme.cs
Normal file
83
Source/LogDashboard/LogDashboard/Model/Theme.cs
Normal file
@@ -0,0 +1,83 @@
|
||||
//******************************************************************************//
|
||||
// Theme.cs
|
||||
// 12/4/2023
|
||||
//
|
||||
// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
|
||||
// PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
|
||||
// AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
|
||||
// UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
|
||||
// RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
|
||||
// CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
|
||||
// OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
|
||||
// COMPANY.
|
||||
//
|
||||
// THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. GOVERNMENT
|
||||
//
|
||||
// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
//
|
||||
// WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE
|
||||
// EXPORT OR DISCLOSURE TO NON-U.S. PERSONS, WHEREVER LOCATED, IS RESTRICTED
|
||||
// BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R. SECTION
|
||||
// 120-130) OR THE EXPORT ADMINISTRATION REGULATIONS (EAR) (15 C.F.R. SECTION
|
||||
// 730-774). THIS DOCUMENT CANNOT BE EXPORTED (E.G., PROVIDED TO A SUPPLIER
|
||||
// OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S. PERSON, WHEREVER
|
||||
// LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS
|
||||
// BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S. GOVERNMENT
|
||||
// APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL
|
||||
// PENALTIES.
|
||||
//
|
||||
// DOD 5220.22-M, INDUSTRIAL SECURITY MANUAL, CHAPTER 5, SECTION 1 THROUGH 9 :
|
||||
// FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN OR DOD 5200.1-R,
|
||||
// INFORMATION SECURITY PROGRAM, CHAPTER 6. FOR UNCLASSIFIED, LIMITED DOCUMENTS
|
||||
// DESTROY BY ANY METHOD THAT WILL PREVENT DISCLOSURE OF CONTENTS OR
|
||||
// RECONSTRUCTION OF THE DOCUMENT.
|
||||
// POC: Alex Kravchenko (1118268)
|
||||
//******************************************************************************//
|
||||
using Raytheon.LogDashboard.Helpers;
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Windows.Media;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace Raytheon.LogDashboard.Model
|
||||
{
|
||||
public class ColorTheme
|
||||
{
|
||||
[NonSerialized]
|
||||
private SolidColorBrush themeColor = (SolidColorBrush)new BrushConverter().ConvertFrom("#3F51B5");
|
||||
|
||||
[DataMember(Name = "ThemeColorString")]
|
||||
private string themeColorString;
|
||||
|
||||
public string Name { get; set; }
|
||||
|
||||
[XmlIgnore]
|
||||
public SolidColorBrush Color
|
||||
{
|
||||
get => themeColor;
|
||||
set
|
||||
{
|
||||
themeColor = value;
|
||||
themeColorString = themeColor.ToARGB();
|
||||
}
|
||||
}
|
||||
|
||||
[XmlIgnore]
|
||||
public Uri ThemeUri => new Uri($"pack://application:,,,/MahApps.Metro;component/Styles/Themes/{Name}.xaml");
|
||||
public string ThemeColorString
|
||||
{
|
||||
get => themeColorString;
|
||||
set
|
||||
{
|
||||
themeColorString = value;
|
||||
themeColor = themeColor.FromARGB(themeColorString);
|
||||
}
|
||||
}
|
||||
|
||||
[OnDeserialized]
|
||||
private void SetValuesOnDeserialized(StreamingContext context)
|
||||
{
|
||||
themeColor = themeColor.FromARGB(themeColorString);
|
||||
}
|
||||
}
|
||||
}
|
||||
428
Source/LogDashboard/LogDashboard/Parsers/DebugMonitor.cs
Normal file
428
Source/LogDashboard/LogDashboard/Parsers/DebugMonitor.cs
Normal file
@@ -0,0 +1,428 @@
|
||||
//******************************************************************************//
|
||||
// DebugMonitor.cs
|
||||
// 12/4/2023
|
||||
//
|
||||
// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
|
||||
// PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
|
||||
// AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
|
||||
// UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
|
||||
// RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
|
||||
// CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
|
||||
// OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
|
||||
// COMPANY.
|
||||
//
|
||||
// THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. GOVERNMENT
|
||||
//
|
||||
// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
//
|
||||
// WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE
|
||||
// EXPORT OR DISCLOSURE TO NON-U.S. PERSONS, WHEREVER LOCATED, IS RESTRICTED
|
||||
// BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R. SECTION
|
||||
// 120-130) OR THE EXPORT ADMINISTRATION REGULATIONS (EAR) (15 C.F.R. SECTION
|
||||
// 730-774). THIS DOCUMENT CANNOT BE EXPORTED (E.G., PROVIDED TO A SUPPLIER
|
||||
// OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S. PERSON, WHEREVER
|
||||
// LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS
|
||||
// BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S. GOVERNMENT
|
||||
// APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL
|
||||
// PENALTIES.
|
||||
//
|
||||
// DOD 5220.22-M, INDUSTRIAL SECURITY MANUAL, CHAPTER 5, SECTION 1 THROUGH 9 :
|
||||
// FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN OR DOD 5200.1-R,
|
||||
// INFORMATION SECURITY PROGRAM, CHAPTER 6. FOR UNCLASSIFIED, LIMITED DOCUMENTS
|
||||
// DESTROY BY ANY METHOD THAT WILL PREVENT DISCLOSURE OF CONTENTS OR
|
||||
// RECONSTRUCTION OF THE DOCUMENT.
|
||||
// POC: Alex Kravchenko (1118268)
|
||||
//******************************************************************************//
|
||||
using System;
|
||||
using System.Threading;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Raytheon.LogDashboard.Parsers
|
||||
{
|
||||
/// <summary>
|
||||
/// Delegate used when firing DebugMonitor.OnOutputDebug event
|
||||
/// </summary>
|
||||
public delegate void OnOutputDebugStringHandler(int pid, string text);
|
||||
|
||||
/// <summary>
|
||||
/// This class captures all strings passed to <c>OutputDebugString</c> when
|
||||
/// the application is not debugged.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This class is a port of Microsoft's Visual Studio's C++ example "dbmon", which
|
||||
/// can be found at <c>http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcsample98/html/vcsmpdbmon.asp</c>.
|
||||
/// </remarks>
|
||||
/// <remarks>
|
||||
/// <code>
|
||||
/// public static void Main(string[] args) {
|
||||
/// DebugMonitor.Start();
|
||||
/// DebugMonitor.OnOutputDebugString += new OnOutputDebugStringHandler(OnOutputDebugString);
|
||||
/// Console.WriteLine("Press 'Enter' to exit.");
|
||||
/// Console.ReadLine();
|
||||
/// DebugMonitor.Stop();
|
||||
/// }
|
||||
///
|
||||
/// private static void OnOutputDebugString(int pid, string text) {
|
||||
/// Console.WriteLine(DateTime.Now + ": " + text);
|
||||
/// }
|
||||
/// </code>
|
||||
/// </remarks>
|
||||
public static class DebugMonitor
|
||||
{
|
||||
#region Win32 API Imports
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
private struct SECURITY_DESCRIPTOR
|
||||
{
|
||||
public byte revision;
|
||||
public byte size;
|
||||
public short control;
|
||||
public IntPtr owner;
|
||||
public IntPtr group;
|
||||
public IntPtr sacl;
|
||||
public IntPtr dacl;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
private struct SECURITY_ATTRIBUTES
|
||||
{
|
||||
public int nLength;
|
||||
public IntPtr lpSecurityDescriptor;
|
||||
public int bInheritHandle;
|
||||
}
|
||||
|
||||
[Flags]
|
||||
private enum PageProtection : uint
|
||||
{
|
||||
NoAccess = 0x01,
|
||||
Readonly = 0x02,
|
||||
ReadWrite = 0x04,
|
||||
WriteCopy = 0x08,
|
||||
Execute = 0x10,
|
||||
ExecuteRead = 0x20,
|
||||
ExecuteReadWrite = 0x40,
|
||||
ExecuteWriteCopy = 0x80,
|
||||
Guard = 0x100,
|
||||
NoCache = 0x200,
|
||||
WriteCombine = 0x400,
|
||||
}
|
||||
|
||||
|
||||
private const int WAIT_OBJECT_0 = 0;
|
||||
private const uint INFINITE = 0xFFFFFFFF;
|
||||
private const int ERROR_ALREADY_EXISTS = 183;
|
||||
|
||||
private const uint SECURITY_DESCRIPTOR_REVISION = 1;
|
||||
|
||||
private const uint SECTION_MAP_READ = 0x0004;
|
||||
|
||||
[DllImport("kernel32.dll", SetLastError = true)]
|
||||
private static extern IntPtr MapViewOfFile(IntPtr hFileMappingObject, uint
|
||||
dwDesiredAccess, uint dwFileOffsetHigh, uint dwFileOffsetLow,
|
||||
uint dwNumberOfBytesToMap);
|
||||
|
||||
[DllImport("kernel32.dll", SetLastError = true)]
|
||||
private static extern bool UnmapViewOfFile(IntPtr lpBaseAddress);
|
||||
|
||||
[DllImport("advapi32.dll", SetLastError = true)]
|
||||
private static extern bool InitializeSecurityDescriptor(ref SECURITY_DESCRIPTOR sd, uint dwRevision);
|
||||
|
||||
[DllImport("advapi32.dll", SetLastError = true)]
|
||||
private static extern bool SetSecurityDescriptorDacl(ref SECURITY_DESCRIPTOR sd, bool daclPresent, IntPtr dacl, bool daclDefaulted);
|
||||
|
||||
[DllImport("kernel32.dll")]
|
||||
private static extern IntPtr CreateEvent(ref SECURITY_ATTRIBUTES sa, bool bManualReset, bool bInitialState, string lpName);
|
||||
|
||||
[DllImport("kernel32.dll")]
|
||||
private static extern bool PulseEvent(IntPtr hEvent);
|
||||
|
||||
[DllImport("kernel32.dll")]
|
||||
private static extern bool SetEvent(IntPtr hEvent);
|
||||
|
||||
[DllImport("kernel32.dll", SetLastError = true)]
|
||||
private static extern IntPtr CreateFileMapping(IntPtr hFile,
|
||||
ref SECURITY_ATTRIBUTES lpFileMappingAttributes, PageProtection flProtect, uint dwMaximumSizeHigh,
|
||||
uint dwMaximumSizeLow, string lpName);
|
||||
|
||||
[DllImport("kernel32.dll", SetLastError = true)]
|
||||
private static extern bool CloseHandle(IntPtr hHandle);
|
||||
|
||||
[DllImport("kernel32", SetLastError = true, ExactSpelling = true)]
|
||||
private static extern Int32 WaitForSingleObject(IntPtr handle, uint milliseconds);
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Fired if an application calls <c>OutputDebugString</c>
|
||||
/// </summary>
|
||||
public static event OnOutputDebugStringHandler OnOutputDebugString;
|
||||
|
||||
/// <summary>
|
||||
/// Event handle for slot 'DBWIN_BUFFER_READY'
|
||||
/// </summary>
|
||||
private static IntPtr m_AckEvent = IntPtr.Zero;
|
||||
|
||||
/// <summary>
|
||||
/// Event handle for slot 'DBWIN_DATA_READY'
|
||||
/// </summary>
|
||||
private static IntPtr m_ReadyEvent = IntPtr.Zero;
|
||||
|
||||
/// <summary>
|
||||
/// Handle for our shared file
|
||||
/// </summary>
|
||||
private static IntPtr m_SharedFile = IntPtr.Zero;
|
||||
|
||||
/// <summary>
|
||||
/// Handle for our shared memory
|
||||
/// </summary>
|
||||
private static IntPtr m_SharedMem = IntPtr.Zero;
|
||||
|
||||
/// <summary>
|
||||
/// Our capturing thread
|
||||
/// </summary>
|
||||
private static Thread m_Capturer = null;
|
||||
|
||||
/// <summary>
|
||||
/// Our synchronization root
|
||||
/// </summary>
|
||||
private static object m_SyncRoot = new object();
|
||||
|
||||
/// <summary>
|
||||
/// Mutex for singleton check
|
||||
/// </summary>
|
||||
private static Mutex m_Mutex = null;
|
||||
|
||||
/// <summary>
|
||||
/// Starts this debug monitor
|
||||
/// </summary>
|
||||
public static void Start()
|
||||
{
|
||||
lock(m_SyncRoot)
|
||||
{
|
||||
if(m_Capturer != null)
|
||||
{
|
||||
throw new ApplicationException("This DebugMonitor is already started.");
|
||||
}
|
||||
|
||||
// Check for supported operating system. Mono (at least with *nix) won't support
|
||||
// our P/Invoke calls.
|
||||
if(Environment.OSVersion.ToString().IndexOf("Microsoft") == -1)
|
||||
{
|
||||
throw new NotSupportedException("This DebugMonitor is only supported on Microsoft operating systems.");
|
||||
}
|
||||
|
||||
// Check for multiple instances. As the README.TXT of the msdn
|
||||
// example notes it is possible to have multiple debug monitors
|
||||
// listen on OutputDebugString, but the message will be randomly
|
||||
// distributed among all running instances so this won't be
|
||||
// such a good idea.
|
||||
m_Mutex = new Mutex(false, typeof(DebugMonitor).Namespace, out bool createdNew);
|
||||
if(!createdNew)
|
||||
{
|
||||
throw new ApplicationException("There is already an instance of 'DbMon.NET' running.");
|
||||
}
|
||||
|
||||
SECURITY_DESCRIPTOR sd = new SECURITY_DESCRIPTOR();
|
||||
|
||||
// Initialize the security descriptor.
|
||||
if(!InitializeSecurityDescriptor(ref sd, SECURITY_DESCRIPTOR_REVISION))
|
||||
{
|
||||
throw CreateApplicationException("Failed to initializes the security descriptor.");
|
||||
}
|
||||
|
||||
// Set information in a discretionary access control list
|
||||
if(!SetSecurityDescriptorDacl(ref sd, true, IntPtr.Zero, false))
|
||||
{
|
||||
throw CreateApplicationException("Failed to initializes the security descriptor");
|
||||
}
|
||||
|
||||
SECURITY_ATTRIBUTES sa = new SECURITY_ATTRIBUTES();
|
||||
|
||||
// Create the event for slot 'DBWIN_BUFFER_READY'
|
||||
m_AckEvent = CreateEvent(ref sa, false, false, "DBWIN_BUFFER_READY");
|
||||
if(m_AckEvent == IntPtr.Zero)
|
||||
{
|
||||
throw CreateApplicationException("Failed to create event 'DBWIN_BUFFER_READY'");
|
||||
}
|
||||
|
||||
// Create the event for slot 'DBWIN_DATA_READY'
|
||||
m_ReadyEvent = CreateEvent(ref sa, false, false, "DBWIN_DATA_READY");
|
||||
if(m_ReadyEvent == IntPtr.Zero)
|
||||
{
|
||||
throw CreateApplicationException("Failed to create event 'DBWIN_DATA_READY'");
|
||||
}
|
||||
|
||||
// Get a handle to the readable shared memory at slot 'DBWIN_BUFFER'.
|
||||
m_SharedFile = CreateFileMapping(new IntPtr(-1), ref sa, PageProtection.ReadWrite, 0, 4096, "DBWIN_BUFFER");
|
||||
if(m_SharedFile == IntPtr.Zero)
|
||||
{
|
||||
throw CreateApplicationException("Failed to create a file mapping to slot 'DBWIN_BUFFER'");
|
||||
}
|
||||
|
||||
// Create a view for this file mapping so we can access it
|
||||
m_SharedMem = MapViewOfFile(m_SharedFile, SECTION_MAP_READ, 0, 0, 512);
|
||||
if(m_SharedMem == IntPtr.Zero)
|
||||
{
|
||||
throw CreateApplicationException("Failed to create a mapping view for slot 'DBWIN_BUFFER'");
|
||||
}
|
||||
|
||||
// Start a new thread where we can capture the output
|
||||
// of OutputDebugString calls so we don't block here.
|
||||
m_Capturer = new Thread(new ThreadStart(Capture));
|
||||
m_Capturer.Start();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Captures
|
||||
/// </summary>
|
||||
private static void Capture()
|
||||
{
|
||||
try
|
||||
{
|
||||
// Everything after the first DWORD is our debugging text
|
||||
IntPtr pString = new IntPtr(m_SharedMem.ToInt64() + Marshal.SizeOf(typeof(long)));
|
||||
|
||||
while(true)
|
||||
{
|
||||
SetEvent(m_AckEvent);
|
||||
|
||||
int ret = WaitForSingleObject(m_ReadyEvent, INFINITE);
|
||||
|
||||
// if we have no capture set it means that someone
|
||||
// called 'Stop()' and is now waiting for us to exit
|
||||
// this endless loop.
|
||||
if(m_Capturer == null)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
if(ret == WAIT_OBJECT_0)
|
||||
{
|
||||
// The first DWORD of the shared memory buffer contains
|
||||
// the process ID of the client that sent the debug string.
|
||||
FireOnOutputDebugString(Marshal.ReadInt32(m_SharedMem), Marshal.PtrToStringAnsi(pString));
|
||||
}
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
// Cleanup
|
||||
}
|
||||
finally
|
||||
{
|
||||
Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
private static void FireOnOutputDebugString(int pid, string text)
|
||||
{
|
||||
// Raise event if we have any listeners
|
||||
if(OnOutputDebugString == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
#if !DEBUG
|
||||
try {
|
||||
#endif
|
||||
OnOutputDebugString(pid, text);
|
||||
#if !DEBUG
|
||||
} catch (Exception ex) {
|
||||
Console.WriteLine("An 'OnOutputDebugString' handler failed to execute: " + ex.ToString());
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Dispose all resources
|
||||
/// </summary>
|
||||
private static void Dispose()
|
||||
{
|
||||
// Close AckEvent
|
||||
if(m_AckEvent != IntPtr.Zero)
|
||||
{
|
||||
if(!CloseHandle(m_AckEvent))
|
||||
{
|
||||
throw CreateApplicationException("Failed to close handle for 'AckEvent'");
|
||||
}
|
||||
m_AckEvent = IntPtr.Zero;
|
||||
}
|
||||
|
||||
// Close ReadyEvent
|
||||
if(m_ReadyEvent != IntPtr.Zero)
|
||||
{
|
||||
if(!CloseHandle(m_ReadyEvent))
|
||||
{
|
||||
throw CreateApplicationException("Failed to close handle for 'ReadyEvent'");
|
||||
}
|
||||
m_ReadyEvent = IntPtr.Zero;
|
||||
}
|
||||
|
||||
// Close SharedFile
|
||||
if(m_SharedFile != IntPtr.Zero)
|
||||
{
|
||||
if(!CloseHandle(m_SharedFile))
|
||||
{
|
||||
throw CreateApplicationException("Failed to close handle for 'SharedFile'");
|
||||
}
|
||||
m_SharedFile = IntPtr.Zero;
|
||||
}
|
||||
|
||||
|
||||
// Unmap SharedMem
|
||||
if(m_SharedMem != IntPtr.Zero)
|
||||
{
|
||||
if(!UnmapViewOfFile(m_SharedMem))
|
||||
{
|
||||
throw CreateApplicationException("Failed to unmap view for slot 'DBWIN_BUFFER'");
|
||||
}
|
||||
m_SharedMem = IntPtr.Zero;
|
||||
}
|
||||
|
||||
// Close our mutex
|
||||
if(m_Mutex != null)
|
||||
{
|
||||
m_Mutex.Close();
|
||||
m_Mutex = null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Stops this debug monitor. This call we block the executing thread
|
||||
/// until this debug monitor is stopped.
|
||||
/// </summary>
|
||||
public static void Stop()
|
||||
{
|
||||
lock(m_SyncRoot)
|
||||
{
|
||||
if(m_Capturer == null)
|
||||
{
|
||||
throw new ObjectDisposedException("DebugMonitor", "This DebugMonitor is not running.");
|
||||
}
|
||||
m_Capturer = null;
|
||||
|
||||
PulseEvent(m_ReadyEvent);
|
||||
while(m_AckEvent != IntPtr.Zero)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Helper to create a new application exception, which has automatically the
|
||||
/// last win 32 error code appended.
|
||||
/// </summary>
|
||||
/// <param name="text">text</param>
|
||||
private static ApplicationException CreateApplicationException(string text)
|
||||
{
|
||||
if(text == null || text.Length < 1)
|
||||
{
|
||||
throw new ArgumentNullException("text", "'text' may not be empty or null.");
|
||||
}
|
||||
|
||||
return new ApplicationException(string.Format("{0}. Last Win32 Error was {1}", text, Marshal.GetLastWin32Error()));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
140
Source/LogDashboard/LogDashboard/Parsers/DebugMonitorParser.cs
Normal file
140
Source/LogDashboard/LogDashboard/Parsers/DebugMonitorParser.cs
Normal file
@@ -0,0 +1,140 @@
|
||||
//******************************************************************************//
|
||||
// DebugMonitorParser.cs
|
||||
// 12/4/2023
|
||||
//
|
||||
// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
|
||||
// PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
|
||||
// AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
|
||||
// UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
|
||||
// RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
|
||||
// CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
|
||||
// OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
|
||||
// COMPANY.
|
||||
//
|
||||
// THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. GOVERNMENT
|
||||
//
|
||||
// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
//
|
||||
// WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE
|
||||
// EXPORT OR DISCLOSURE TO NON-U.S. PERSONS, WHEREVER LOCATED, IS RESTRICTED
|
||||
// BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R. SECTION
|
||||
// 120-130) OR THE EXPORT ADMINISTRATION REGULATIONS (EAR) (15 C.F.R. SECTION
|
||||
// 730-774). THIS DOCUMENT CANNOT BE EXPORTED (E.G., PROVIDED TO A SUPPLIER
|
||||
// OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S. PERSON, WHEREVER
|
||||
// LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS
|
||||
// BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S. GOVERNMENT
|
||||
// APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL
|
||||
// PENALTIES.
|
||||
//
|
||||
// DOD 5220.22-M, INDUSTRIAL SECURITY MANUAL, CHAPTER 5, SECTION 1 THROUGH 9 :
|
||||
// FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN OR DOD 5200.1-R,
|
||||
// INFORMATION SECURITY PROGRAM, CHAPTER 6. FOR UNCLASSIFIED, LIMITED DOCUMENTS
|
||||
// DESTROY BY ANY METHOD THAT WILL PREVENT DISCLOSURE OF CONTENTS OR
|
||||
// RECONSTRUCTION OF THE DOCUMENT.
|
||||
// POC: Alex Kravchenko (1118268)
|
||||
//******************************************************************************//
|
||||
using GalaSoft.MvvmLight.Messaging;
|
||||
using Raytheon.LogDashboard.Model;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net.Sockets;
|
||||
|
||||
namespace Raytheon.LogDashboard.Parsers
|
||||
{
|
||||
public class DebugMonitorParser : PacketsParser
|
||||
{
|
||||
private readonly Queue<LogMessage> _messages = new Queue<LogMessage>();
|
||||
|
||||
public DebugMonitorParser(string name, bool isAutoSave)
|
||||
: base(name, isAutoSave)
|
||||
{
|
||||
}
|
||||
|
||||
public DebugMonitorParser(string name, string address, bool isAutoSave)
|
||||
: this(name, isAutoSave)
|
||||
{
|
||||
Address = address;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// initialize WinDebug parser
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public override bool Init()
|
||||
{
|
||||
try
|
||||
{
|
||||
base.Init();
|
||||
|
||||
DebugMonitor.OnOutputDebugString += DebugMonitor_OnOutputDebugString;
|
||||
DebugMonitor.Start();
|
||||
|
||||
IsInitialized = true;
|
||||
return IsInitialized;
|
||||
}
|
||||
catch(SocketException socketException)
|
||||
{
|
||||
Logger.Warn(socketException, "An error occurred in DebugMonitorParser initializer.");
|
||||
IsInitialized = false;
|
||||
return IsInitialized;
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
Logger.Warn(e, "An error occurred in DebugMonitorParser initializer.");
|
||||
IsInitialized = false;
|
||||
return IsInitialized;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// gets single message
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public override LogMessage GetLog()
|
||||
{
|
||||
var log = _messages.Count > 0 ? _messages.Dequeue() : null;
|
||||
|
||||
if(IsAutoSave && log != null)
|
||||
{
|
||||
Messenger.Default.Send(log, "PersistLogMessage");
|
||||
}
|
||||
|
||||
return log;
|
||||
}
|
||||
|
||||
private void DebugMonitor_OnOutputDebugString(int pid, string text)
|
||||
{
|
||||
DashboardLogLevel level;
|
||||
if(text.IndexOf("error", StringComparison.OrdinalIgnoreCase) >= 0)
|
||||
{
|
||||
level = DashboardLogLevel.Error;
|
||||
}
|
||||
else if(text.IndexOf("warning", StringComparison.OrdinalIgnoreCase) >= 0)
|
||||
{
|
||||
level = DashboardLogLevel.Warn;
|
||||
}
|
||||
else
|
||||
{
|
||||
level = DashboardLogLevel.Debug;
|
||||
}
|
||||
|
||||
_messages.Enqueue(new LogMessage
|
||||
{
|
||||
ProcessID = pid,
|
||||
Thread = pid,
|
||||
Logger = Name,
|
||||
Address = Environment.MachineName,
|
||||
Message = text,
|
||||
Level = level,
|
||||
Time = DateTime.Now
|
||||
});
|
||||
}
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
base.Dispose();
|
||||
|
||||
DebugMonitor.Stop();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,209 @@
|
||||
//******************************************************************************//
|
||||
// ErrorLoggerPacketsParser.cs
|
||||
// 12/4/2023
|
||||
//
|
||||
// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
|
||||
// PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
|
||||
// AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
|
||||
// UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
|
||||
// RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
|
||||
// CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
|
||||
// OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
|
||||
// COMPANY.
|
||||
//
|
||||
// THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. GOVERNMENT
|
||||
//
|
||||
// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
//
|
||||
// WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE
|
||||
// EXPORT OR DISCLOSURE TO NON-U.S. PERSONS, WHEREVER LOCATED, IS RESTRICTED
|
||||
// BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R. SECTION
|
||||
// 120-130) OR THE EXPORT ADMINISTRATION REGULATIONS (EAR) (15 C.F.R. SECTION
|
||||
// 730-774). THIS DOCUMENT CANNOT BE EXPORTED (E.G., PROVIDED TO A SUPPLIER
|
||||
// OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S. PERSON, WHEREVER
|
||||
// LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS
|
||||
// BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S. GOVERNMENT
|
||||
// APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL
|
||||
// PENALTIES.
|
||||
//
|
||||
// DOD 5220.22-M, INDUSTRIAL SECURITY MANUAL, CHAPTER 5, SECTION 1 THROUGH 9 :
|
||||
// FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN OR DOD 5200.1-R,
|
||||
// INFORMATION SECURITY PROGRAM, CHAPTER 6. FOR UNCLASSIFIED, LIMITED DOCUMENTS
|
||||
// DESTROY BY ANY METHOD THAT WILL PREVENT DISCLOSURE OF CONTENTS OR
|
||||
// RECONSTRUCTION OF THE DOCUMENT.
|
||||
// POC: Alex Kravchenko (1118268)
|
||||
//******************************************************************************//
|
||||
using GalaSoft.MvvmLight.Messaging;
|
||||
using Raytheon.LogDashboard.Model;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
|
||||
namespace Raytheon.LogDashboard.Parsers
|
||||
{
|
||||
/// <summary>
|
||||
/// \\\\.\\mailslot\\TsdcSystemSwErrorMailSlot
|
||||
/// \\\\.\\mailslot\\TsdcSystemSwErrorMailSlot64
|
||||
/// </summary>
|
||||
public class ErrorLoggerPacketsParser : PacketsParser
|
||||
{
|
||||
private MailslotServer mailslotServer { get; set; }
|
||||
private Mutex _mutex;
|
||||
|
||||
public ErrorLoggerPacketsParser(string name, bool isAutoSave)
|
||||
: base(name, isAutoSave)
|
||||
{ }
|
||||
|
||||
public ErrorLoggerPacketsParser(string name, string address, bool isAutoSave)
|
||||
: this(name, isAutoSave)
|
||||
{
|
||||
Address = address;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public override LogMessage GetLog()
|
||||
{
|
||||
string msg = mailslotServer.GetNextMessage();
|
||||
|
||||
if(msg != null)
|
||||
{
|
||||
return ParseString(msg);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private LogMessage ParseString(string inputString)
|
||||
{
|
||||
int index = 0;
|
||||
string[] fields = new string[4];
|
||||
for(int i = 0; i < 3; i++)
|
||||
{
|
||||
int nextIndex = inputString.IndexOf(',', index);
|
||||
if(nextIndex == -1)
|
||||
{
|
||||
throw new ArgumentException("Input string is not in the correct format.");
|
||||
}
|
||||
fields[i] = inputString.Substring(index, nextIndex - index).Trim();
|
||||
index = nextIndex + 1;
|
||||
}
|
||||
fields[3] = inputString.Substring(index).Trim();
|
||||
|
||||
LogMessage msg = new LogMessage
|
||||
{
|
||||
Logger = Name,
|
||||
Address = Address,
|
||||
Time = ParseDate(fields[1]),
|
||||
Level = GetLevel(fields[2]),
|
||||
Message = fields[3]
|
||||
};
|
||||
|
||||
if(IsAutoSave && msg != null)
|
||||
{
|
||||
Messenger.Default.Send(msg, "PersistLogMessage");
|
||||
}
|
||||
|
||||
return msg;
|
||||
}
|
||||
|
||||
private DateTime ParseDate(string data)
|
||||
{
|
||||
if(DateTime.TryParseExact(data, "ddd MMM dd HH:mm:ss yyyy fff'ms'", null, DateTimeStyles.AssumeLocal, out DateTime dateTime))
|
||||
{
|
||||
return dateTime;
|
||||
}
|
||||
else
|
||||
{
|
||||
return DateTime.Now;
|
||||
}
|
||||
}
|
||||
|
||||
private DashboardLogLevel GetLevel(string level)
|
||||
{
|
||||
switch(level)
|
||||
{
|
||||
case "LOG_INFO_VERBOSE":
|
||||
return DashboardLogLevel.Trace;
|
||||
case "LOG_INFORMATION":
|
||||
return DashboardLogLevel.Info;
|
||||
case "LOG_WARNING":
|
||||
return DashboardLogLevel.Warn;
|
||||
case "LOG_DEBUG":
|
||||
return DashboardLogLevel.Debug;
|
||||
case "LOG_ERROR":
|
||||
return DashboardLogLevel.Error;
|
||||
|
||||
default:
|
||||
return DashboardLogLevel.Error;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public override bool Init()
|
||||
{
|
||||
base.Init();
|
||||
|
||||
string strMutex = !string.IsNullOrEmpty(Address) && Address.Trim().EndsWith("64") ?
|
||||
"ErrorLoggerMutex_F1BB29A5-0AFC-45e9-A725-C302DF7EB3CF_64" :
|
||||
"ErrorLoggerMutex_F1BB29A5-0AFC-45e9-A725-C302DF7EB3CF";
|
||||
|
||||
_mutex = new Mutex(true, strMutex, out bool createdNew);
|
||||
|
||||
if(!createdNew)
|
||||
{
|
||||
Process[] errorLoggerProcesses = Process.GetProcessesByName("ErrorLogger");
|
||||
if(errorLoggerProcesses.Any())
|
||||
{
|
||||
Process er = errorLoggerProcesses.First();
|
||||
|
||||
Messenger.Default.Send("Detected ErrorLogger instance running. Please close ErrorLogger or disable the Error Logger receiver.", "DisplayCustomMessage");
|
||||
|
||||
_mutex = new Mutex(true, strMutex, out createdNew);
|
||||
}
|
||||
}
|
||||
|
||||
if(!createdNew)
|
||||
{
|
||||
Logger.Error($"Error initializing Mailslot {Address}\nOnly one instance of ErrorLogger is allowed");
|
||||
|
||||
IsInitialized = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
mailslotServer = new MailslotServer(Address);
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
Logger.Error($"Error initializing Mailslot {Address}\n{ex.Message}");
|
||||
|
||||
IsInitialized = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
IsInitialized = true;
|
||||
return IsInitialized;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public override void Dispose()
|
||||
{
|
||||
base.Dispose();
|
||||
|
||||
mailslotServer?.Dispose();
|
||||
|
||||
_mutex?.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
148
Source/LogDashboard/LogDashboard/Parsers/Mailslot.cs
Normal file
148
Source/LogDashboard/LogDashboard/Parsers/Mailslot.cs
Normal file
@@ -0,0 +1,148 @@
|
||||
//******************************************************************************//
|
||||
// Mailslot.cs
|
||||
// 12/4/2023
|
||||
//
|
||||
// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
|
||||
// PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
|
||||
// AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
|
||||
// UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
|
||||
// RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
|
||||
// CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
|
||||
// OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
|
||||
// COMPANY.
|
||||
//
|
||||
// THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. GOVERNMENT
|
||||
//
|
||||
// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
//
|
||||
// WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE
|
||||
// EXPORT OR DISCLOSURE TO NON-U.S. PERSONS, WHEREVER LOCATED, IS RESTRICTED
|
||||
// BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R. SECTION
|
||||
// 120-130) OR THE EXPORT ADMINISTRATION REGULATIONS (EAR) (15 C.F.R. SECTION
|
||||
// 730-774). THIS DOCUMENT CANNOT BE EXPORTED (E.G., PROVIDED TO A SUPPLIER
|
||||
// OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S. PERSON, WHEREVER
|
||||
// LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS
|
||||
// BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S. GOVERNMENT
|
||||
// APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL
|
||||
// PENALTIES.
|
||||
//
|
||||
// DOD 5220.22-M, INDUSTRIAL SECURITY MANUAL, CHAPTER 5, SECTION 1 THROUGH 9 :
|
||||
// FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN OR DOD 5200.1-R,
|
||||
// INFORMATION SECURITY PROGRAM, CHAPTER 6. FOR UNCLASSIFIED, LIMITED DOCUMENTS
|
||||
// DESTROY BY ANY METHOD THAT WILL PREVENT DISCLOSURE OF CONTENTS OR
|
||||
// RECONSTRUCTION OF THE DOCUMENT.
|
||||
// POC: Alex Kravchenko (1118268)
|
||||
//******************************************************************************//
|
||||
using Microsoft.Win32.SafeHandles;
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.ConstrainedExecution;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Security.Permissions;
|
||||
using System.Security;
|
||||
using System.Text;
|
||||
|
||||
namespace Raytheon.LogDashboard.Parsers
|
||||
{
|
||||
[SuppressUnmanagedCodeSecurity]
|
||||
public static class Mailslot
|
||||
{
|
||||
public const int MailslotNoMessage = -1;
|
||||
|
||||
[HostProtection(SecurityAction.LinkDemand, MayLeakOnAbort = true)]
|
||||
[SecurityPermission(SecurityAction.LinkDemand, UnmanagedCode = true)]
|
||||
public sealed class SafeMailslotHandle : SafeHandleZeroOrMinusOneIsInvalid
|
||||
{
|
||||
private SafeMailslotHandle()
|
||||
: base(true)
|
||||
{ }
|
||||
|
||||
public SafeMailslotHandle(IntPtr preexistingHandle, bool ownsHandle)
|
||||
: base(ownsHandle)
|
||||
{
|
||||
SetHandle(preexistingHandle);
|
||||
}
|
||||
|
||||
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
|
||||
[DllImport("kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)]
|
||||
[return: MarshalAs(UnmanagedType.Bool)]
|
||||
private static extern bool CloseHandle(IntPtr handle);
|
||||
|
||||
protected override bool ReleaseHandle()
|
||||
{
|
||||
return CloseHandle(base.handle);
|
||||
}
|
||||
}
|
||||
|
||||
[DllImport("kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)]
|
||||
public static extern SafeMailslotHandle CreateMailslot(string mailslotName,
|
||||
uint nMaxMessageSize, int lReadTimeout,
|
||||
IntPtr securityAttributes);
|
||||
|
||||
|
||||
[DllImport("kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)]
|
||||
[return: MarshalAs(UnmanagedType.Bool)]
|
||||
public static extern bool GetMailslotInfo(SafeMailslotHandle hMailslot,
|
||||
IntPtr lpMaxMessageSize,
|
||||
out int lpNextSize, out int lpMessageCount,
|
||||
IntPtr lpReadTimeout);
|
||||
|
||||
|
||||
[DllImport("kernel32.dll", CharSet = CharSet.Ansi, SetLastError = true)]
|
||||
[return: MarshalAs(UnmanagedType.Bool)]
|
||||
public static extern bool ReadFile(SafeMailslotHandle handle,
|
||||
byte[] bytes, int numBytesToRead,
|
||||
out int numBytesRead,
|
||||
IntPtr overlapped);
|
||||
}
|
||||
|
||||
public class MailslotServer : IDisposable
|
||||
{
|
||||
private Mailslot.SafeMailslotHandle _handle;
|
||||
|
||||
public MailslotServer(string name)
|
||||
{
|
||||
_handle = Mailslot.CreateMailslot(@"\\.\mailslot\" + name, 0, 0, IntPtr.Zero);
|
||||
if(_handle.IsInvalid)
|
||||
{
|
||||
throw new Win32Exception();
|
||||
}
|
||||
}
|
||||
|
||||
public string GetNextMessage()
|
||||
{
|
||||
if(_handle == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if(!Mailslot.GetMailslotInfo(_handle, IntPtr.Zero, out int messageBytes, out _, IntPtr.Zero))
|
||||
{
|
||||
throw new Win32Exception();
|
||||
}
|
||||
|
||||
if(messageBytes == Mailslot.MailslotNoMessage)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
byte[] bBuffer = new byte[messageBytes];
|
||||
|
||||
if(!Mailslot.ReadFile(_handle, bBuffer, messageBytes, out int bytesRead, IntPtr.Zero) || bytesRead == 0)
|
||||
{
|
||||
throw new Win32Exception();
|
||||
}
|
||||
|
||||
return Encoding.ASCII.GetString(bBuffer);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
if(_handle != null)
|
||||
{
|
||||
_handle.Close();
|
||||
_handle = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
104
Source/LogDashboard/LogDashboard/Parsers/PacketsParser.cs
Normal file
104
Source/LogDashboard/LogDashboard/Parsers/PacketsParser.cs
Normal file
@@ -0,0 +1,104 @@
|
||||
//******************************************************************************//
|
||||
// PacketsParser.cs
|
||||
// 12/4/2023
|
||||
//
|
||||
// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
|
||||
// PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
|
||||
// AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
|
||||
// UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
|
||||
// RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
|
||||
// CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
|
||||
// OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
|
||||
// COMPANY.
|
||||
//
|
||||
// THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. GOVERNMENT
|
||||
//
|
||||
// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
//
|
||||
// WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE
|
||||
// EXPORT OR DISCLOSURE TO NON-U.S. PERSONS, WHEREVER LOCATED, IS RESTRICTED
|
||||
// BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R. SECTION
|
||||
// 120-130) OR THE EXPORT ADMINISTRATION REGULATIONS (EAR) (15 C.F.R. SECTION
|
||||
// 730-774). THIS DOCUMENT CANNOT BE EXPORTED (E.G., PROVIDED TO A SUPPLIER
|
||||
// OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S. PERSON, WHEREVER
|
||||
// LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS
|
||||
// BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S. GOVERNMENT
|
||||
// APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL
|
||||
// PENALTIES.
|
||||
//
|
||||
// DOD 5220.22-M, INDUSTRIAL SECURITY MANUAL, CHAPTER 5, SECTION 1 THROUGH 9 :
|
||||
// FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN OR DOD 5200.1-R,
|
||||
// INFORMATION SECURITY PROGRAM, CHAPTER 6. FOR UNCLASSIFIED, LIMITED DOCUMENTS
|
||||
// DESTROY BY ANY METHOD THAT WILL PREVENT DISCLOSURE OF CONTENTS OR
|
||||
// RECONSTRUCTION OF THE DOCUMENT.
|
||||
// POC: Alex Kravchenko (1118268)
|
||||
//******************************************************************************//
|
||||
using NLog;
|
||||
using Raytheon.LogDashboard.Model;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Xml;
|
||||
|
||||
namespace Raytheon.LogDashboard.Parsers
|
||||
{
|
||||
[Serializable]
|
||||
[DataContract]
|
||||
public abstract class PacketsParser : IDisposable
|
||||
{
|
||||
protected static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
||||
|
||||
protected readonly XmlParserContext XmlContext;
|
||||
protected readonly Encoding Encoding = Encoding.ASCII;
|
||||
|
||||
public string Address { get; protected set; }
|
||||
|
||||
public bool IsInitialized { get; protected set; }
|
||||
public List<IgnoredIPAddr> IgnoredIPs { get; set; }
|
||||
|
||||
public string Name { get; set; }
|
||||
|
||||
public CancellationTokenSource CancellationToken { get; set; }
|
||||
|
||||
public bool IsAutoSave { get; set; }
|
||||
|
||||
public PacketsParser(string name, bool isAutoSave)
|
||||
{
|
||||
Name = name;
|
||||
|
||||
XmlContext = CreateContext();
|
||||
IgnoredIPs = Settings.Instance.IgnoredIPs;
|
||||
IsAutoSave = isAutoSave;
|
||||
}
|
||||
|
||||
public virtual bool Init()
|
||||
{
|
||||
CancellationToken = new CancellationTokenSource();
|
||||
return true;
|
||||
}
|
||||
|
||||
public abstract LogMessage GetLog();
|
||||
|
||||
protected XmlParserContext CreateContext()
|
||||
{
|
||||
NameTable nt = new NameTable();
|
||||
XmlNamespaceManager nsmanager = new XmlNamespaceManager(nt);
|
||||
nsmanager.AddNamespace("log4j", "http://jakarta.apache.org/log4j/");
|
||||
nsmanager.AddNamespace("nlog", "http://nlog-project.org");
|
||||
return new XmlParserContext(nt, nsmanager, "elem", XmlSpace.None, Encoding.UTF8);
|
||||
}
|
||||
|
||||
protected DateTime UnixTimeStampToDateTime(long unixTimeStamp)
|
||||
{
|
||||
return new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc).AddMilliseconds(unixTimeStamp);
|
||||
}
|
||||
|
||||
public virtual void Dispose()
|
||||
{
|
||||
CancellationToken?.Cancel();
|
||||
IsInitialized = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
236
Source/LogDashboard/LogDashboard/Parsers/UDPPacketsParser.cs
Normal file
236
Source/LogDashboard/LogDashboard/Parsers/UDPPacketsParser.cs
Normal file
@@ -0,0 +1,236 @@
|
||||
//******************************************************************************//
|
||||
// UDPPacketsParser.cs
|
||||
// 12/4/2023
|
||||
//
|
||||
// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
|
||||
// PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
|
||||
// AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
|
||||
// UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
|
||||
// RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
|
||||
// CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
|
||||
// OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
|
||||
// COMPANY.
|
||||
//
|
||||
// THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. GOVERNMENT
|
||||
//
|
||||
// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
//
|
||||
// WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE
|
||||
// EXPORT OR DISCLOSURE TO NON-U.S. PERSONS, WHEREVER LOCATED, IS RESTRICTED
|
||||
// BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R. SECTION
|
||||
// 120-130) OR THE EXPORT ADMINISTRATION REGULATIONS (EAR) (15 C.F.R. SECTION
|
||||
// 730-774). THIS DOCUMENT CANNOT BE EXPORTED (E.G., PROVIDED TO A SUPPLIER
|
||||
// OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S. PERSON, WHEREVER
|
||||
// LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS
|
||||
// BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S. GOVERNMENT
|
||||
// APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL
|
||||
// PENALTIES.
|
||||
//
|
||||
// DOD 5220.22-M, INDUSTRIAL SECURITY MANUAL, CHAPTER 5, SECTION 1 THROUGH 9 :
|
||||
// FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN OR DOD 5200.1-R,
|
||||
// INFORMATION SECURITY PROGRAM, CHAPTER 6. FOR UNCLASSIFIED, LIMITED DOCUMENTS
|
||||
// DESTROY BY ANY METHOD THAT WILL PREVENT DISCLOSURE OF CONTENTS OR
|
||||
// RECONSTRUCTION OF THE DOCUMENT.
|
||||
// POC: Alex Kravchenko (1118268)
|
||||
//******************************************************************************//
|
||||
using Raytheon.LogDashboard.Model;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Net.Sockets;
|
||||
using System.Net;
|
||||
using System.Xml;
|
||||
using Raytheon.LogDashboard.Helpers;
|
||||
using Settings = Raytheon.LogDashboard.Model.Settings;
|
||||
using GalaSoft.MvvmLight.Messaging;
|
||||
|
||||
namespace Raytheon.LogDashboard.Parsers
|
||||
{
|
||||
public class UDPPacketsParser : PacketsParser
|
||||
{
|
||||
private UdpClient udpClient;
|
||||
private IPEndPoint remoteIpEndPoint;
|
||||
|
||||
public int Port { get; set; }
|
||||
|
||||
public UDPPacketsParser(string name, bool isAutoSave)
|
||||
: base(name, isAutoSave)
|
||||
{
|
||||
}
|
||||
|
||||
public UDPPacketsParser(string name, string address, int port, bool isAutoSave)
|
||||
: this(name, isAutoSave)
|
||||
{
|
||||
Address = address;
|
||||
Port = port;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// initialize UDP parser
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public override bool Init()
|
||||
{
|
||||
try
|
||||
{
|
||||
base.Init();
|
||||
udpClient = new UdpClient(Port);
|
||||
remoteIpEndPoint = new IPEndPoint(IPAddress.Any, Port);
|
||||
IsInitialized = true;
|
||||
return IsInitialized;
|
||||
}
|
||||
catch(SocketException socketException)
|
||||
{
|
||||
Logger.Warn(socketException, "An error occurred in UDPPacketsParser ctor.");
|
||||
Messenger.Default.Send($"Port {Port} is busy!", "DisplayCustomMessage");
|
||||
|
||||
IsInitialized = false;
|
||||
return IsInitialized;
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
Logger.Warn(e, "An error occurred in UDPPacketsParser ctor.");
|
||||
Messenger.Default.Send($"An error occurred while connect to port {Port}.\n{e.Message}", "DisplayCustomMessage");
|
||||
IsInitialized = false;
|
||||
return IsInitialized;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// read individual message
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public override LogMessage GetLog()
|
||||
{
|
||||
LogMessage log = null;
|
||||
string incomingLog = string.Empty;
|
||||
|
||||
if(udpClient == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
// getting bytes
|
||||
byte[] receiveBytes = udpClient.Receive(ref remoteIpEndPoint);
|
||||
if(IgnoredIPs.Any(x => x.IsActive && x.IP.Contains(remoteIpEndPoint.Address.ToString())))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
// converting bytes to string
|
||||
incomingLog = Encoding.GetString(receiveBytes);
|
||||
|
||||
log = ReadXmlLog(incomingLog);
|
||||
log.Address = Settings.Instance.IsSeparateIPLoggersByPort ? $"{remoteIpEndPoint.Address}:{Port}" : remoteIpEndPoint.Address.ToString();
|
||||
log.Port = Port;
|
||||
}
|
||||
catch(SocketException)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
log = new LogMessage
|
||||
{
|
||||
Logger = "UDP Logger",
|
||||
Address = Settings.Instance.IsSeparateIPLoggersByPort ? $"{remoteIpEndPoint.Address}:{Port}" : remoteIpEndPoint.Address.ToString(),
|
||||
Thread = -1,
|
||||
Message = $"An error occurred while parsing log: {incomingLog}. {Environment.NewLine} Exception: {e}",
|
||||
Time = DateTime.Now,
|
||||
Level = DashboardLogLevel.Error,
|
||||
ExecutableName = "LogDashboard"
|
||||
};
|
||||
|
||||
Logger.Warn(e, "An error occurred while parsing log.");
|
||||
}
|
||||
|
||||
if(IsAutoSave)
|
||||
{
|
||||
Messenger.Default.Send(log, "PersistLogMessage");
|
||||
}
|
||||
return log;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// reads XML log in log4j format
|
||||
/// </summary>
|
||||
/// <param name="xmlFragment"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="Exception"></exception>
|
||||
private LogMessage ReadXmlLog(string xmlFragment)
|
||||
{
|
||||
LogMessage log = new LogMessage();
|
||||
|
||||
using(XmlReader reader = new XmlTextReader(xmlFragment, XmlNodeType.Element, XmlContext) { WhitespaceHandling = WhitespaceHandling.Significant })
|
||||
{
|
||||
reader.Read();
|
||||
if(reader.MoveToContent() != XmlNodeType.Element || reader.Name != "log4j:event")
|
||||
{
|
||||
throw new Exception("The Log Event is not a valid log4j Xml block.");
|
||||
}
|
||||
|
||||
log.Logger = reader.GetAttribute("logger");
|
||||
log.Level = (DashboardLogLevel)Enum.Parse(typeof(DashboardLogLevel), reader.GetAttribute("level").ToLower().FirstCharToUpper());
|
||||
log.Thread = int.Parse(reader.GetAttribute("thread"));
|
||||
|
||||
if(long.TryParse(reader.GetAttribute("timestamp"), out long timeStamp))
|
||||
{
|
||||
log.Time = UnixTimeStampToDateTime(timeStamp).ToLocalTime();
|
||||
}
|
||||
|
||||
int eventDepth = reader.Depth;
|
||||
reader.Read();
|
||||
while(reader.Depth > eventDepth)
|
||||
{
|
||||
if(reader.MoveToContent() == XmlNodeType.Element)
|
||||
{
|
||||
switch(reader.Name)
|
||||
{
|
||||
case "log4j:message":
|
||||
log.Message = reader.ReadString();
|
||||
break;
|
||||
|
||||
case "log4j:throwable":
|
||||
log.Message += Environment.NewLine + reader.ReadString();
|
||||
break;
|
||||
case "log4j:properties":
|
||||
reader.Read();
|
||||
while(reader.MoveToContent() == XmlNodeType.Element
|
||||
&& reader.Name == "log4j:data")
|
||||
{
|
||||
string name = reader.GetAttribute("name");
|
||||
string value = reader.GetAttribute("value");
|
||||
if(!string.IsNullOrEmpty(name) && name == "log4japp" && !string.IsNullOrEmpty(value) && value.Contains(".exe"))
|
||||
{
|
||||
log.ExecutableName = value.Substring(0, value.IndexOf(".exe", StringComparison.Ordinal));
|
||||
}
|
||||
|
||||
reader.Read();
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
reader.Read();
|
||||
}
|
||||
}
|
||||
return log;
|
||||
}
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
base.Dispose();
|
||||
try
|
||||
{
|
||||
udpClient?.Close();
|
||||
udpClient?.Dispose();
|
||||
udpClient = null;
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
Logger.Warn(e, "Dispose error");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
174
Source/LogDashboard/LogDashboard/Parsers/WCFPacketsParser.cs
Normal file
174
Source/LogDashboard/LogDashboard/Parsers/WCFPacketsParser.cs
Normal file
@@ -0,0 +1,174 @@
|
||||
//******************************************************************************//
|
||||
// WCFPacketsParser.cs
|
||||
// 12/4/2023
|
||||
//
|
||||
// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
|
||||
// PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
|
||||
// AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
|
||||
// UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
|
||||
// RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
|
||||
// CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
|
||||
// OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
|
||||
// COMPANY.
|
||||
//
|
||||
// THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. GOVERNMENT
|
||||
//
|
||||
// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
//
|
||||
// WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE
|
||||
// EXPORT OR DISCLOSURE TO NON-U.S. PERSONS, WHEREVER LOCATED, IS RESTRICTED
|
||||
// BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R. SECTION
|
||||
// 120-130) OR THE EXPORT ADMINISTRATION REGULATIONS (EAR) (15 C.F.R. SECTION
|
||||
// 730-774). THIS DOCUMENT CANNOT BE EXPORTED (E.G., PROVIDED TO A SUPPLIER
|
||||
// OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S. PERSON, WHEREVER
|
||||
// LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS
|
||||
// BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S. GOVERNMENT
|
||||
// APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL
|
||||
// PENALTIES.
|
||||
//
|
||||
// DOD 5220.22-M, INDUSTRIAL SECURITY MANUAL, CHAPTER 5, SECTION 1 THROUGH 9 :
|
||||
// FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN OR DOD 5200.1-R,
|
||||
// INFORMATION SECURITY PROGRAM, CHAPTER 6. FOR UNCLASSIFIED, LIMITED DOCUMENTS
|
||||
// DESTROY BY ANY METHOD THAT WILL PREVENT DISCLOSURE OF CONTENTS OR
|
||||
// RECONSTRUCTION OF THE DOCUMENT.
|
||||
// POC: Alex Kravchenko (1118268)
|
||||
//******************************************************************************//
|
||||
using Raytheon.LogDashboard.Model;
|
||||
using System;
|
||||
using System.Net.Sockets;
|
||||
using Raytheon.LogDashboard.Service;
|
||||
using GalaSoft.MvvmLight.Messaging;
|
||||
using System.Collections.Generic;
|
||||
using NLog;
|
||||
using System.Linq;
|
||||
|
||||
namespace Raytheon.LogDashboard.Parsers
|
||||
{
|
||||
public class WCFPacketsParser : PacketsParser
|
||||
{
|
||||
private ITRSInfoServiceHost _serviceHost;
|
||||
private readonly Queue<LogMessage> _messages = new Queue<LogMessage>();
|
||||
|
||||
public WCFPacketsParser(string name, bool isAutoSave)
|
||||
: base(name, isAutoSave)
|
||||
{
|
||||
}
|
||||
public WCFPacketsParser(string name, string address, bool isAutoSave)
|
||||
: this(name, isAutoSave)
|
||||
{
|
||||
Address = address;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// initialize WCF packet receiver / parser
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public override bool Init()
|
||||
{
|
||||
try
|
||||
{
|
||||
base.Init();
|
||||
|
||||
if(!string.IsNullOrEmpty(Address))
|
||||
{
|
||||
_serviceHost = new TRSInfoServiceHost();
|
||||
_serviceHost.StartHost(Address);
|
||||
}
|
||||
|
||||
Messenger.Default.Register<NotificationMessage<LogMessage>>(this, "WCFMessage", MessageReceivedHandler);
|
||||
Messenger.Default.Register<LogEventInfo>(this, "AddProcessingText", AddProcessingTextHandler);
|
||||
|
||||
IsInitialized = true;
|
||||
return IsInitialized;
|
||||
}
|
||||
catch(SocketException socketException)
|
||||
{
|
||||
Logger.Warn(socketException, "An error occurred in WCFPacketsParser initializer.");
|
||||
IsInitialized = false;
|
||||
return IsInitialized;
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
Logger.Warn(e, "An error occurred in WCFPacketsParser initializer.");
|
||||
IsInitialized = false;
|
||||
return IsInitialized;
|
||||
}
|
||||
}
|
||||
|
||||
private void AddProcessingTextHandler(LogEventInfo info)
|
||||
{
|
||||
var threadIdProperty = info.Properties.FirstOrDefault(p => p.Key.ToString() == "ThreadId");
|
||||
int threadId = threadIdProperty.Key != null ? (int)threadIdProperty.Value : 0;
|
||||
|
||||
LogMessage logMessage = new LogMessage
|
||||
{
|
||||
Logger = info.LoggerName,
|
||||
ThreadName = info.LoggerName,
|
||||
Address = string.IsNullOrEmpty(Address) ? Environment.MachineName : Address,
|
||||
Message = info.Message,
|
||||
Time = info.TimeStamp,
|
||||
Thread = threadId,
|
||||
Level = FromNLogLevelToDashboardLevel(info.Level.ToString()),
|
||||
ExecutableName = "LogDashboard"
|
||||
};
|
||||
_messages.Enqueue(logMessage);
|
||||
}
|
||||
|
||||
public static DashboardLogLevel FromNLogLevelToDashboardLevel(string level)
|
||||
{
|
||||
switch(level.ToUpper())
|
||||
{
|
||||
case "INFOPOPUP":
|
||||
case "INFO":
|
||||
return Model.DashboardLogLevel.Info;
|
||||
case "DEBUGPOPUP":
|
||||
case "DEBUG":
|
||||
return Model.DashboardLogLevel.Debug;
|
||||
case "TRACE":
|
||||
return Model.DashboardLogLevel.Trace;
|
||||
case "ERROR":
|
||||
return Model.DashboardLogLevel.Error;
|
||||
case "WARN":
|
||||
return Model.DashboardLogLevel.Warn;
|
||||
case "FATAL":
|
||||
case "CRITICAL":
|
||||
return Model.DashboardLogLevel.Fatal;
|
||||
default:
|
||||
return Model.DashboardLogLevel.Error;
|
||||
}
|
||||
}
|
||||
|
||||
private void MessageReceivedHandler(NotificationMessage<LogMessage> message)
|
||||
{
|
||||
LogMessage logMessage = message?.Content;
|
||||
if(logMessage == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
logMessage.Address = Address;
|
||||
_messages.Enqueue(logMessage);
|
||||
}
|
||||
|
||||
public override LogMessage GetLog()
|
||||
{
|
||||
var log = _messages.Count > 0 ? _messages.Dequeue() : null;
|
||||
|
||||
if(IsAutoSave && log != null)
|
||||
{
|
||||
Messenger.Default.Send(log, "PersistLogMessage");
|
||||
}
|
||||
|
||||
return log;
|
||||
}
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
base.Dispose();
|
||||
_serviceHost?.StopHost();
|
||||
|
||||
Messenger.Default.Unregister<NotificationMessage<LogMessage>>(this, "WCFMessage", MessageReceivedHandler);
|
||||
Messenger.Default.Unregister<LogEventInfo>(this, "AddProcessingText", AddProcessingTextHandler);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
110
Source/LogDashboard/LogDashboard/ReleaseNotes.xml
Normal file
110
Source/LogDashboard/LogDashboard/ReleaseNotes.xml
Normal file
@@ -0,0 +1,110 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<ArrayOfReleaseNotes xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
|
||||
|
||||
<ReleaseNotes>
|
||||
<Version>1.4.1</Version>
|
||||
<NewFeatures>
|
||||
<string>Support for dynamically changing file location based on the Error Logger settings</string>
|
||||
<string>New toggle switch for monitoring Error Logger ini file for the current file location</string>
|
||||
</NewFeatures>
|
||||
<ChangedFeatures>
|
||||
<string>Removed the dependency on EP.DataContracts package.</string>
|
||||
<string>When writing log files based on the Error Logger location, use the same methods for naming files, start with the base name first and rename with the date stamp only when file reach maximum file length.</string>
|
||||
</ChangedFeatures>
|
||||
<FixedBugs>
|
||||
<string>Parsing of the log files with 3 columns</string>
|
||||
<string>Fix for the dialog when importing multiple log file of different types</string>
|
||||
</FixedBugs>
|
||||
</ReleaseNotes>
|
||||
|
||||
<ReleaseNotes>
|
||||
<Version>1.3.9</Version>
|
||||
<NewFeatures>
|
||||
<string>Added support for persisting log records into a rolling file based on a file size</string>
|
||||
<string>Added support for parsing Error Logger csv files</string>
|
||||
<string>Added identification for the Error Logger running. If Error Logger detected, display informational message to the user</string>
|
||||
</NewFeatures>
|
||||
<ChangedFeatures>
|
||||
</ChangedFeatures>
|
||||
<FixedBugs>
|
||||
<string>Fixed a bug for displaying error messages as a Metro dialog</string>
|
||||
</FixedBugs>
|
||||
</ReleaseNotes>
|
||||
|
||||
<ReleaseNotes>
|
||||
<Version>1.3.6</Version>
|
||||
<NewFeatures>
|
||||
<string>- Updated the default icon</string>
|
||||
</NewFeatures>
|
||||
<ChangedFeatures>
|
||||
<string>Added drop-down control for selecting 32 bit and 64 bit Error Logger</string>
|
||||
</ChangedFeatures>
|
||||
<FixedBugs>
|
||||
<string>Error Logger initialization with the correct mutex when running 64 bit version</string>
|
||||
</FixedBugs>
|
||||
</ReleaseNotes>
|
||||
|
||||
<ReleaseNotes>
|
||||
<Version>1.3.5</Version>
|
||||
<NewFeatures>
|
||||
<string>- Added support Dark mode</string>
|
||||
<string>- Added full system color support</string>
|
||||
<string>- Added embedded mode so that it can be hosted inside other applications like EPTS</string>
|
||||
</NewFeatures>
|
||||
<ChangedFeatures>
|
||||
<string>Windows Debug parser to display machine name as a source</string>
|
||||
</ChangedFeatures>
|
||||
<FixedBugs>
|
||||
<string>Error Logger parser is checking for null handle avoiding exception when MailSlot failed to initialize</string>
|
||||
</FixedBugs>
|
||||
</ReleaseNotes>
|
||||
|
||||
<ReleaseNotes>
|
||||
<Version>1.3.2</Version>
|
||||
<NewFeatures>
|
||||
<string>- Added support for parsing EPTS log files</string>
|
||||
</NewFeatures>
|
||||
<ChangedFeatures>
|
||||
<string>- removed normalization for the new line character when parsing xml (log4j format)</string>
|
||||
</ChangedFeatures>
|
||||
<FixedBugs>
|
||||
<string>fixed a bug in EPTS log file parser for skipping first and last lines</string>
|
||||
<string>stopping and starting receivers was not picking up the enabled receivers from the list</string>
|
||||
<string>overwriting custom receiver name with the default name after saving in configuration</string>
|
||||
</FixedBugs>
|
||||
</ReleaseNotes>
|
||||
|
||||
<ReleaseNotes>
|
||||
<Version>1.0.2</Version>
|
||||
<NewFeatures>
|
||||
<string>- Added new ErrorLogger receiver capable of reading from Mailslot</string>
|
||||
<string>- Added new WinDebug receiver based on Microsoft's 'dbmon' example </string>
|
||||
</NewFeatures>
|
||||
<ChangedFeatures>
|
||||
<string>- Moved LogDashboard to separate DLL</string>
|
||||
<string>- Packaged LogDashboardCtrl as a package to be reused</string>
|
||||
</ChangedFeatures>
|
||||
<FixedBugs>
|
||||
</FixedBugs>
|
||||
</ReleaseNotes>
|
||||
|
||||
<ReleaseNotes>
|
||||
<Version>1.0.0</Version>
|
||||
<NewFeatures>
|
||||
<string>- Default Receiver is UDP listening on port 7777
|
||||
Define your target in NLog.config as type=Chainsaw and address=udp://127.0.0.1:7777
|
||||
</string>
|
||||
<string>- Ability to import log4j format files</string>
|
||||
<string>- Track file changes after importing the file</string>
|
||||
<string>- Fast sorting and filtering capabilities</string>
|
||||
<string>- Sorting and filtering based on the namespace from tree view</string>
|
||||
<string>- Sorting and filtering based on time stamps</string>
|
||||
</NewFeatures>
|
||||
<ChangedFeatures>
|
||||
<string>- Nothing Yet</string>
|
||||
</ChangedFeatures>
|
||||
<FixedBugs>
|
||||
<string>- Nothing Yet</string>
|
||||
</FixedBugs>
|
||||
</ReleaseNotes>
|
||||
</ArrayOfReleaseNotes>
|
||||
BIN
Source/LogDashboard/LogDashboard/Resources/LogDashboard.ico
Normal file
BIN
Source/LogDashboard/LogDashboard/Resources/LogDashboard.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 41 KiB |
73
Source/LogDashboard/LogDashboard/Resources/Resource1.Designer.cs
generated
Normal file
73
Source/LogDashboard/LogDashboard/Resources/Resource1.Designer.cs
generated
Normal file
@@ -0,0 +1,73 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Raytheon.LogDashboard.Resources {
|
||||
using System;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// A strongly-typed resource class, for looking up localized strings, etc.
|
||||
/// </summary>
|
||||
// This class was auto-generated by the StronglyTypedResourceBuilder
|
||||
// class via a tool like ResGen or Visual Studio.
|
||||
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||
// with the /str option, or rebuild your VS project.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Resource1 {
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal Resource1() {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the cached ResourceManager instance used by this class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||
get {
|
||||
if (object.ReferenceEquals(resourceMan, null)) {
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Raytheon.LogDashboard.Resources.Resource1", typeof(Resource1).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Overrides the current thread's CurrentUICulture property for all
|
||||
/// resource lookups using this strongly typed resource class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture {
|
||||
get {
|
||||
return resourceCulture;
|
||||
}
|
||||
set {
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
|
||||
/// </summary>
|
||||
internal static System.Drawing.Icon LogDashboard {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("LogDashboard", resourceCulture);
|
||||
return ((System.Drawing.Icon)(obj));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
124
Source/LogDashboard/LogDashboard/Resources/Resource1.resx
Normal file
124
Source/LogDashboard/LogDashboard/Resources/Resource1.resx
Normal file
@@ -0,0 +1,124 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<data name="LogDashboard" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>LogDashboard.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
</root>
|
||||
BIN
Source/LogDashboard/LogDashboard/Resources/Settings.png
Normal file
BIN
Source/LogDashboard/LogDashboard/Resources/Settings.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 7.8 KiB |
@@ -0,0 +1,51 @@
|
||||
//******************************************************************************//
|
||||
// ITRSInfoServiceHost.cs
|
||||
// 12/4/2023
|
||||
//
|
||||
// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
|
||||
// PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
|
||||
// AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
|
||||
// UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
|
||||
// RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
|
||||
// CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
|
||||
// OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
|
||||
// COMPANY.
|
||||
//
|
||||
// THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. GOVERNMENT
|
||||
//
|
||||
// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
//
|
||||
// WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE
|
||||
// EXPORT OR DISCLOSURE TO NON-U.S. PERSONS, WHEREVER LOCATED, IS RESTRICTED
|
||||
// BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R. SECTION
|
||||
// 120-130) OR THE EXPORT ADMINISTRATION REGULATIONS (EAR) (15 C.F.R. SECTION
|
||||
// 730-774). THIS DOCUMENT CANNOT BE EXPORTED (E.G., PROVIDED TO A SUPPLIER
|
||||
// OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S. PERSON, WHEREVER
|
||||
// LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS
|
||||
// BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S. GOVERNMENT
|
||||
// APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL
|
||||
// PENALTIES.
|
||||
//
|
||||
// DOD 5220.22-M, INDUSTRIAL SECURITY MANUAL, CHAPTER 5, SECTION 1 THROUGH 9 :
|
||||
// FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN OR DOD 5200.1-R,
|
||||
// INFORMATION SECURITY PROGRAM, CHAPTER 6. FOR UNCLASSIFIED, LIMITED DOCUMENTS
|
||||
// DESTROY BY ANY METHOD THAT WILL PREVENT DISCLOSURE OF CONTENTS OR
|
||||
// RECONSTRUCTION OF THE DOCUMENT.
|
||||
// POC: Alex Kravchenko (1118268)
|
||||
//******************************************************************************//
|
||||
|
||||
namespace Raytheon.LogDashboard.Service
|
||||
{
|
||||
public interface ITRSInfoServiceHost
|
||||
{
|
||||
/// <summary>
|
||||
/// The implementer of this interface will start the service host WCF or Named Pipes
|
||||
/// </summary>
|
||||
void StartHost(string address);
|
||||
|
||||
/// <summary>
|
||||
/// The implementer of this interface will stop the service host WCF or Named Pipes
|
||||
/// </summary>
|
||||
void StopHost();
|
||||
}
|
||||
}
|
||||
101
Source/LogDashboard/LogDashboard/Service/ITestInfoService.cs
Normal file
101
Source/LogDashboard/LogDashboard/Service/ITestInfoService.cs
Normal file
@@ -0,0 +1,101 @@
|
||||
//******************************************************************************//
|
||||
// ITestInfoService.cs
|
||||
// 12/4/2023
|
||||
//
|
||||
// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
|
||||
// PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
|
||||
// AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
|
||||
// UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
|
||||
// RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
|
||||
// CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
|
||||
// OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
|
||||
// COMPANY.
|
||||
//
|
||||
// THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. GOVERNMENT
|
||||
//
|
||||
// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
//
|
||||
// WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE
|
||||
// EXPORT OR DISCLOSURE TO NON-U.S. PERSONS, WHEREVER LOCATED, IS RESTRICTED
|
||||
// BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R. SECTION
|
||||
// 120-130) OR THE EXPORT ADMINISTRATION REGULATIONS (EAR) (15 C.F.R. SECTION
|
||||
// 730-774). THIS DOCUMENT CANNOT BE EXPORTED (E.G., PROVIDED TO A SUPPLIER
|
||||
// OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S. PERSON, WHEREVER
|
||||
// LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS
|
||||
// BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S. GOVERNMENT
|
||||
// APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL
|
||||
// PENALTIES.
|
||||
//
|
||||
// DOD 5220.22-M, INDUSTRIAL SECURITY MANUAL, CHAPTER 5, SECTION 1 THROUGH 9 :
|
||||
// FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN OR DOD 5200.1-R,
|
||||
// INFORMATION SECURITY PROGRAM, CHAPTER 6. FOR UNCLASSIFIED, LIMITED DOCUMENTS
|
||||
// DESTROY BY ANY METHOD THAT WILL PREVENT DISCLOSURE OF CONTENTS OR
|
||||
// RECONSTRUCTION OF THE DOCUMENT.
|
||||
// POC: Alex Kravchenko (1118268)
|
||||
//******************************************************************************//
|
||||
using System.Collections.Generic;
|
||||
using System.ServiceModel;
|
||||
|
||||
namespace Raytheon.LogDashboard.Service
|
||||
{
|
||||
[ServiceContract(CallbackContract = typeof(ISubscriptionCallback))]
|
||||
public interface ITestInfoService
|
||||
{
|
||||
[OperationContract]
|
||||
void ProcessScannedData(string barcodeData);
|
||||
|
||||
[OperationContract(IsOneWay = true)]
|
||||
void SubscribeToDataEntry(string keyName);
|
||||
|
||||
[OperationContract(IsOneWay = true)]
|
||||
void UnsubscribeFromDataEntry(string keyName);
|
||||
|
||||
[OperationContract]
|
||||
void SetParseProfile(string parseProfilePath);
|
||||
|
||||
[OperationContract]
|
||||
IDictionary<string, string> GetStoredScanData();
|
||||
|
||||
[OperationContract]
|
||||
bool IsAlive();
|
||||
|
||||
[OperationContract]
|
||||
void MoveWindowToFront();
|
||||
|
||||
[OperationContract(IsOneWay = true)]
|
||||
void ReportMessage(string message);
|
||||
|
||||
[OperationContract(IsOneWay = true)]
|
||||
void LogMessage(string level, string message);
|
||||
}
|
||||
|
||||
[ServiceContract(CallbackContract = typeof(IOperatorInterfaceCallback))]
|
||||
public interface IOperatorInterface
|
||||
{
|
||||
[OperationContract(IsOneWay = true)]
|
||||
void Handshake(string caller);
|
||||
|
||||
[OperationContract(IsOneWay = true)]
|
||||
void MenuCommand(string command);
|
||||
}
|
||||
|
||||
[ServiceContract]
|
||||
public interface ISubscriptionCallback
|
||||
{
|
||||
[OperationContract(IsOneWay = true)]
|
||||
void Notify();
|
||||
|
||||
[OperationContract(IsOneWay = true)]
|
||||
void NotifyScan(Dictionary<string, string> data);
|
||||
}
|
||||
|
||||
[ServiceContract]
|
||||
public interface IOperatorInterfaceCallback
|
||||
{
|
||||
[OperationContract(IsOneWay = true)]
|
||||
void CallMethod(string methodName, string parameter);
|
||||
|
||||
[OperationContract]
|
||||
bool IsSequenceRunning();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
//******************************************************************************//
|
||||
// TRSInfoServiceHost.cs
|
||||
// 12/4/2023
|
||||
//
|
||||
// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
|
||||
// PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
|
||||
// AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
|
||||
// UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
|
||||
// RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
|
||||
// CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
|
||||
// OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
|
||||
// COMPANY.
|
||||
//
|
||||
// THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. GOVERNMENT
|
||||
//
|
||||
// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
//
|
||||
// WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE
|
||||
// EXPORT OR DISCLOSURE TO NON-U.S. PERSONS, WHEREVER LOCATED, IS RESTRICTED
|
||||
// BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R. SECTION
|
||||
// 120-130) OR THE EXPORT ADMINISTRATION REGULATIONS (EAR) (15 C.F.R. SECTION
|
||||
// 730-774). THIS DOCUMENT CANNOT BE EXPORTED (E.G., PROVIDED TO A SUPPLIER
|
||||
// OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S. PERSON, WHEREVER
|
||||
// LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS
|
||||
// BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S. GOVERNMENT
|
||||
// APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL
|
||||
// PENALTIES.
|
||||
//
|
||||
// DOD 5220.22-M, INDUSTRIAL SECURITY MANUAL, CHAPTER 5, SECTION 1 THROUGH 9 :
|
||||
// FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN OR DOD 5200.1-R,
|
||||
// INFORMATION SECURITY PROGRAM, CHAPTER 6. FOR UNCLASSIFIED, LIMITED DOCUMENTS
|
||||
// DESTROY BY ANY METHOD THAT WILL PREVENT DISCLOSURE OF CONTENTS OR
|
||||
// RECONSTRUCTION OF THE DOCUMENT.
|
||||
// POC: Alex Kravchenko (1118268)
|
||||
//******************************************************************************//
|
||||
using NLog;
|
||||
using System;
|
||||
using System.ServiceModel;
|
||||
|
||||
namespace Raytheon.LogDashboard.Service
|
||||
{
|
||||
public class TRSInfoServiceHost : ITRSInfoServiceHost
|
||||
{
|
||||
static ServiceHost _host;
|
||||
readonly ILogger _log = LogManager.GetCurrentClassLogger();
|
||||
|
||||
public void StartHost(string address)
|
||||
{
|
||||
_log.Info("Starting TRS Info Service");
|
||||
try
|
||||
{
|
||||
_host = new ServiceHost(typeof(TestInfoService), new Uri[] { new Uri(address) });
|
||||
_host.AddServiceEndpoint(typeof(ITestInfoService), new NetNamedPipeBinding(), address);
|
||||
_host.Open();
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
_log.Error(ex, "Unable to start service host TRS Service, please check configuration");
|
||||
}
|
||||
}
|
||||
|
||||
public void StopHost()
|
||||
{
|
||||
_log.Info("Stopping TRS Info Service");
|
||||
_host.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
180
Source/LogDashboard/LogDashboard/Service/TestInfoService.cs
Normal file
180
Source/LogDashboard/LogDashboard/Service/TestInfoService.cs
Normal file
@@ -0,0 +1,180 @@
|
||||
//******************************************************************************//
|
||||
// TestInfoService.cs
|
||||
// 12/4/2023
|
||||
//
|
||||
// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
|
||||
// PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
|
||||
// AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
|
||||
// UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
|
||||
// RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
|
||||
// CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
|
||||
// OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
|
||||
// COMPANY.
|
||||
//
|
||||
// THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. GOVERNMENT
|
||||
//
|
||||
// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
//
|
||||
// WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE
|
||||
// EXPORT OR DISCLOSURE TO NON-U.S. PERSONS, WHEREVER LOCATED, IS RESTRICTED
|
||||
// BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R. SECTION
|
||||
// 120-130) OR THE EXPORT ADMINISTRATION REGULATIONS (EAR) (15 C.F.R. SECTION
|
||||
// 730-774). THIS DOCUMENT CANNOT BE EXPORTED (E.G., PROVIDED TO A SUPPLIER
|
||||
// OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S. PERSON, WHEREVER
|
||||
// LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS
|
||||
// BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S. GOVERNMENT
|
||||
// APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL
|
||||
// PENALTIES.
|
||||
//
|
||||
// DOD 5220.22-M, INDUSTRIAL SECURITY MANUAL, CHAPTER 5, SECTION 1 THROUGH 9 :
|
||||
// FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN OR DOD 5200.1-R,
|
||||
// INFORMATION SECURITY PROGRAM, CHAPTER 6. FOR UNCLASSIFIED, LIMITED DOCUMENTS
|
||||
// DESTROY BY ANY METHOD THAT WILL PREVENT DISCLOSURE OF CONTENTS OR
|
||||
// RECONSTRUCTION OF THE DOCUMENT.
|
||||
// POC: Alex Kravchenko (1118268)
|
||||
//******************************************************************************//
|
||||
|
||||
// Ignore Spelling: Unsubscribe
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ServiceModel;
|
||||
using GalaSoft.MvvmLight.Messaging;
|
||||
using NLog;
|
||||
using Raytheon.LogDashboard.Parsers;
|
||||
|
||||
namespace Raytheon.LogDashboard.Service
|
||||
{
|
||||
[ServiceBehavior(Name = "TestInfoService",
|
||||
Namespace = "http://epts.data.us.ray.com/EPTS/TRS",
|
||||
InstanceContextMode = InstanceContextMode.PerSession,
|
||||
ConcurrencyMode = ConcurrencyMode.Multiple)]
|
||||
public class TestInfoService : ITestInfoService
|
||||
{
|
||||
/// <summary>
|
||||
/// Logger
|
||||
/// </summary>
|
||||
private readonly ILogger _log = LogManager.GetCurrentClassLogger();
|
||||
|
||||
/// <summary>
|
||||
/// Used to set the parse profile path to be used when parsing scan data
|
||||
/// </summary>
|
||||
/// <param name="parseProfilePath"></param>
|
||||
public void SetParseProfile(string parseProfilePath)
|
||||
{
|
||||
_log.Debug($"Setting Parse Profile for path: {parseProfilePath}");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Used to subscribe to the Data Entry Accept event
|
||||
/// The name of the client's pipeServer is provided for Data Entry to be able to call out to it
|
||||
/// </summary>
|
||||
/// <param name="keyName"></param>
|
||||
public void SubscribeToDataEntry(string keyName)
|
||||
{
|
||||
_log.Debug($"Subscribing to Data Entry with key: {keyName}");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Unsubscripted from data entry.
|
||||
/// </summary>
|
||||
/// <param name="keyName">Name of the key.</param>
|
||||
/// <exception cref="System.NotImplementedException"></exception>
|
||||
public void UnsubscribeFromDataEntry(string keyName)
|
||||
{
|
||||
_log.Debug($"Unsubscribing from Data Entry with key: {keyName}");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Used to retrieve accepted data
|
||||
/// This will continue to return the previous scan entry until a new scan is accepted in the UI
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public IDictionary<string, string> GetStoredScanData()
|
||||
{
|
||||
_log.Debug("Getting Stored Scan Data");
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// BCCapture will call this method via WCF
|
||||
/// //
|
||||
/// Parse the string that BCCapture passes.
|
||||
/// Determine if it is DES data scan or RSS scan
|
||||
/// If DES data scan
|
||||
/// Call Message.Send.Default
|
||||
/// Else (RSS scan)
|
||||
/// Create a new Test Session
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public void ProcessScannedData(string scannedData)
|
||||
{
|
||||
_log.Debug($"Received Scan Data {scannedData}");
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// A call that lets the client end check to see if the endpoint is available.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public bool IsAlive()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Used to move the TRS window to active/ to front
|
||||
/// </summary>
|
||||
public void MoveWindowToFront()
|
||||
{
|
||||
_log.Debug("Move Window to the Front call");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// will process messages submitted by texPrint
|
||||
/// </summary>
|
||||
/// <param name="message"></param>
|
||||
public void ReportMessage(string message)
|
||||
{
|
||||
_log.Debug("Report Message call");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Logs the message via local log4net.
|
||||
/// </summary>
|
||||
/// <param name="level">The level.</param>
|
||||
/// <param name="message">The message.</param>
|
||||
public void LogMessage(string level, string message)
|
||||
{
|
||||
Messenger.Default.Send(new NotificationMessage<Model.LogMessage>(new Model.LogMessage
|
||||
{
|
||||
Level = WCFPacketsParser.FromNLogLevelToDashboardLevel(level),
|
||||
Address = "EPTS",
|
||||
Logger = "EPTS",
|
||||
Message = message,
|
||||
Time = DateTime.Now,
|
||||
},
|
||||
level), "WCFMessage");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handshake with Common Operator Interface.
|
||||
/// </summary>
|
||||
/// <param name="caller">The caller.</param>
|
||||
/// <exception cref="NotImplementedException"></exception>
|
||||
public void Handshake(string caller)
|
||||
{
|
||||
_log.Debug($"Handshake Message Received from caller: {caller}");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Menus the command.
|
||||
/// </summary>
|
||||
/// <param name="command">The command.</param>
|
||||
/// <exception cref="NotImplementedException"></exception>
|
||||
public void MenuCommand(string command)
|
||||
{
|
||||
_log.Debug($"Menu Command Received command: {command}");
|
||||
}
|
||||
}
|
||||
}
|
||||
644
Source/LogDashboard/LogDashboard/Styles/DrawingImages.xaml
Normal file
644
Source/LogDashboard/LogDashboard/Styles/DrawingImages.xaml
Normal file
File diff suppressed because one or more lines are too long
1325
Source/LogDashboard/LogDashboard/Styles/Styles.xaml
Normal file
1325
Source/LogDashboard/LogDashboard/Styles/Styles.xaml
Normal file
File diff suppressed because it is too large
Load Diff
67
Source/LogDashboard/LogDashboard/Validators/IPValidation.cs
Normal file
67
Source/LogDashboard/LogDashboard/Validators/IPValidation.cs
Normal file
@@ -0,0 +1,67 @@
|
||||
//******************************************************************************//
|
||||
// IPValidation.cs
|
||||
// 12/4/2023
|
||||
//
|
||||
// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
|
||||
// PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
|
||||
// AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
|
||||
// UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
|
||||
// RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
|
||||
// CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
|
||||
// OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
|
||||
// COMPANY.
|
||||
//
|
||||
// THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. GOVERNMENT
|
||||
//
|
||||
// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
//
|
||||
// WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE
|
||||
// EXPORT OR DISCLOSURE TO NON-U.S. PERSONS, WHEREVER LOCATED, IS RESTRICTED
|
||||
// BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R. SECTION
|
||||
// 120-130) OR THE EXPORT ADMINISTRATION REGULATIONS (EAR) (15 C.F.R. SECTION
|
||||
// 730-774). THIS DOCUMENT CANNOT BE EXPORTED (E.G., PROVIDED TO A SUPPLIER
|
||||
// OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S. PERSON, WHEREVER
|
||||
// LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS
|
||||
// BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S. GOVERNMENT
|
||||
// APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL
|
||||
// PENALTIES.
|
||||
//
|
||||
// DOD 5220.22-M, INDUSTRIAL SECURITY MANUAL, CHAPTER 5, SECTION 1 THROUGH 9 :
|
||||
// FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN OR DOD 5200.1-R,
|
||||
// INFORMATION SECURITY PROGRAM, CHAPTER 6. FOR UNCLASSIFIED, LIMITED DOCUMENTS
|
||||
// DESTROY BY ANY METHOD THAT WILL PREVENT DISCLOSURE OF CONTENTS OR
|
||||
// RECONSTRUCTION OF THE DOCUMENT.
|
||||
// POC: Alex Kravchenko (1118268)
|
||||
//******************************************************************************//
|
||||
|
||||
// Ignore Spelling: Validators
|
||||
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace Raytheon.LogDashboard.Validators
|
||||
{
|
||||
public class IPValidation : ValidationRule
|
||||
{
|
||||
public override ValidationResult Validate(object value, CultureInfo cultureInfo)
|
||||
{
|
||||
if(value is string str && ValidateIPv4(str))
|
||||
{
|
||||
return new ValidationResult(true, null);
|
||||
}
|
||||
return new ValidationResult(false, "Invalid IP Address!");
|
||||
}
|
||||
|
||||
private bool ValidateIPv4(string ipString)
|
||||
{
|
||||
if(ipString.Count(c => c == '.') != 3)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return IPAddress.TryParse(ipString, out IPAddress address);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
//******************************************************************************//
|
||||
// PortNumberValidation.cs
|
||||
// 12/4/2023
|
||||
//
|
||||
// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
|
||||
// PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
|
||||
// AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
|
||||
// UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
|
||||
// RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
|
||||
// CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
|
||||
// OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
|
||||
// COMPANY.
|
||||
//
|
||||
// THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. GOVERNMENT
|
||||
//
|
||||
// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
//
|
||||
// WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE
|
||||
// EXPORT OR DISCLOSURE TO NON-U.S. PERSONS, WHEREVER LOCATED, IS RESTRICTED
|
||||
// BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R. SECTION
|
||||
// 120-130) OR THE EXPORT ADMINISTRATION REGULATIONS (EAR) (15 C.F.R. SECTION
|
||||
// 730-774). THIS DOCUMENT CANNOT BE EXPORTED (E.G., PROVIDED TO A SUPPLIER
|
||||
// OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S. PERSON, WHEREVER
|
||||
// LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS
|
||||
// BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S. GOVERNMENT
|
||||
// APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL
|
||||
// PENALTIES.
|
||||
//
|
||||
// DOD 5220.22-M, INDUSTRIAL SECURITY MANUAL, CHAPTER 5, SECTION 1 THROUGH 9 :
|
||||
// FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN OR DOD 5200.1-R,
|
||||
// INFORMATION SECURITY PROGRAM, CHAPTER 6. FOR UNCLASSIFIED, LIMITED DOCUMENTS
|
||||
// DESTROY BY ANY METHOD THAT WILL PREVENT DISCLOSURE OF CONTENTS OR
|
||||
// RECONSTRUCTION OF THE DOCUMENT.
|
||||
// POC: Alex Kravchenko (1118268)
|
||||
//******************************************************************************//
|
||||
|
||||
// Ignore Spelling: Validators
|
||||
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace Raytheon.LogDashboard.Validators
|
||||
{
|
||||
public class PortNumberValidation : ValidationRule
|
||||
{
|
||||
public override ValidationResult Validate(object value, CultureInfo cultureInfo)
|
||||
{
|
||||
if(value is string str && IsPort(str))
|
||||
{
|
||||
return new ValidationResult(true, null);
|
||||
}
|
||||
return new ValidationResult(false, "Invalid port number!");
|
||||
}
|
||||
|
||||
private bool IsPort(string value)
|
||||
{
|
||||
if(string.IsNullOrEmpty(value))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
Regex numeric = new Regex(@"^[0-9]+$", RegexOptions.Compiled | RegexOptions.IgnoreCase);
|
||||
|
||||
if(numeric.IsMatch(value))
|
||||
{
|
||||
try
|
||||
{
|
||||
if(Convert.ToInt32(value) < 65536)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
catch(OverflowException)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,101 @@
|
||||
<!--
|
||||
ImportLogsProcessDialog.xaml
|
||||
12/4/2023
|
||||
|
||||
RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
|
||||
PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
|
||||
AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
|
||||
UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
|
||||
RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
|
||||
CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
|
||||
OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
|
||||
COMPANY.
|
||||
|
||||
THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. GOVERNMENT
|
||||
|
||||
UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
|
||||
WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE
|
||||
EXPORT OR DISCLOSURE TO NON-U.S. PERSONS, WHEREVER LOCATED, IS RESTRICTED
|
||||
BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R. SECTION
|
||||
120-130) OR THE EXPORT ADMINISTRATION REGULATIONS (EAR) (15 C.F.R. SECTION
|
||||
730-774). THIS DOCUMENT CANNOT BE EXPORTED (E.G., PROVIDED TO A SUPPLIER
|
||||
OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S. PERSON, WHEREVER
|
||||
LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS
|
||||
BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S. GOVERNMENT
|
||||
APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL
|
||||
PENALTIES.
|
||||
|
||||
DOD 5220.22-M, INDUSTRIAL SECURITY MANUAL, CHAPTER 5, SECTION 1 THROUGH 9 :
|
||||
FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN OR DOD 5200.1-R,
|
||||
INFORMATION SECURITY PROGRAM, CHAPTER 6. FOR UNCLASSIFIED, LIMITED DOCUMENTS
|
||||
DESTROY BY ANY METHOD THAT WILL PREVENT DISCLOSURE OF CONTENTS OR
|
||||
RECONSTRUCTION OF THE DOCUMENT.
|
||||
POC: Alex Kravchenko (1118268)
|
||||
-->
|
||||
<mah:MetroWindow x:Class="Raytheon.LogDashboard.View.ImportLogsProcessDialog"
|
||||
xmlns:mah="http://metro.mahapps.com/winfx/xaml/controls"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
DataContext="{Binding ImportLogsProcess, Source={StaticResource LogDashLocator}}"
|
||||
mc:Ignorable="d"
|
||||
Title="Import logs process"
|
||||
Height="320" Width="500"
|
||||
>
|
||||
|
||||
<mah:MetroWindow.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="../Styles/Styles.xaml"/>
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
</mah:MetroWindow.Resources>
|
||||
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled">
|
||||
<ItemsControl Margin="10" ItemsSource="{Binding ImportFiles, UpdateSourceTrigger=PropertyChanged}">
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<StackPanel Orientation="Vertical">
|
||||
<TextBlock Text="{Binding Path=FilePath}" Margin="0,10,0,5"/>
|
||||
<Grid>
|
||||
<ProgressBar Value="{Binding Path=Process, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
|
||||
Background="{Binding LogDashboard.SelectedColorTheme.Color, Source={StaticResource LogDashLocator}}"
|
||||
Height="20" />
|
||||
<TextBlock Text="{Binding Path=Process, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, StringFormat={}{0}%}"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"/>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
</ScrollViewer>
|
||||
|
||||
<StackPanel Grid.Row="1"
|
||||
Orientation="Horizontal"
|
||||
HorizontalAlignment="Right">
|
||||
|
||||
<Button Content="Ok"
|
||||
Command="{Binding CloseCommand}"
|
||||
CommandParameter="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type mah:MetroWindow}}}"
|
||||
IsDefault="True"
|
||||
Height="30"
|
||||
Background="{Binding LogDashboard.SelectedColorTheme.Color, Source={StaticResource LogDashLocator}}"
|
||||
Margin="0,0,10,0" />
|
||||
|
||||
<Button Content="Cancel"
|
||||
Command="{Binding CancelCommand}"
|
||||
CommandParameter="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type mah:MetroWindow}}}"
|
||||
Background="{Binding LogDashboard.SelectedColorTheme.Color, Source={StaticResource LogDashLocator}}"
|
||||
/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</mah:MetroWindow>
|
||||
@@ -0,0 +1,51 @@
|
||||
//******************************************************************************//
|
||||
// ImportLogsProcessDialog.xaml.cs
|
||||
// 12/4/2023
|
||||
//
|
||||
// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
|
||||
// PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
|
||||
// AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
|
||||
// UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
|
||||
// RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
|
||||
// CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
|
||||
// OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
|
||||
// COMPANY.
|
||||
//
|
||||
// THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. GOVERNMENT
|
||||
//
|
||||
// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
//
|
||||
// WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE
|
||||
// EXPORT OR DISCLOSURE TO NON-U.S. PERSONS, WHEREVER LOCATED, IS RESTRICTED
|
||||
// BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R. SECTION
|
||||
// 120-130) OR THE EXPORT ADMINISTRATION REGULATIONS (EAR) (15 C.F.R. SECTION
|
||||
// 730-774). THIS DOCUMENT CANNOT BE EXPORTED (E.G., PROVIDED TO A SUPPLIER
|
||||
// OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S. PERSON, WHEREVER
|
||||
// LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS
|
||||
// BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S. GOVERNMENT
|
||||
// APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL
|
||||
// PENALTIES.
|
||||
//
|
||||
// DOD 5220.22-M, INDUSTRIAL SECURITY MANUAL, CHAPTER 5, SECTION 1 THROUGH 9 :
|
||||
// FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN OR DOD 5200.1-R,
|
||||
// INFORMATION SECURITY PROGRAM, CHAPTER 6. FOR UNCLASSIFIED, LIMITED DOCUMENTS
|
||||
// DESTROY BY ANY METHOD THAT WILL PREVENT DISCLOSURE OF CONTENTS OR
|
||||
// RECONSTRUCTION OF THE DOCUMENT.
|
||||
// POC: Alex Kravchenko (1118268)
|
||||
//******************************************************************************//
|
||||
|
||||
using Raytheon.LogDashboard.ViewModel;
|
||||
|
||||
namespace Raytheon.LogDashboard.View
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for ImportFilesProcessDialog.xaml
|
||||
/// </summary>
|
||||
public partial class ImportLogsProcessDialog
|
||||
{
|
||||
public ImportLogsProcessDialog()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
317
Source/LogDashboard/LogDashboard/View/LogDashboardCtrl.xaml
Normal file
317
Source/LogDashboard/LogDashboard/View/LogDashboardCtrl.xaml
Normal file
@@ -0,0 +1,317 @@
|
||||
<!--
|
||||
LogDashboardCtrl.xaml
|
||||
12/4/2023
|
||||
|
||||
RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
|
||||
PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
|
||||
AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
|
||||
UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
|
||||
RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
|
||||
CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
|
||||
OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
|
||||
COMPANY.
|
||||
|
||||
THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. GOVERNMENT
|
||||
|
||||
UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
|
||||
WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE
|
||||
EXPORT OR DISCLOSURE TO NON-U.S. PERSONS, WHEREVER LOCATED, IS RESTRICTED
|
||||
BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R. SECTION
|
||||
120-130) OR THE EXPORT ADMINISTRATION REGULATIONS (EAR) (15 C.F.R. SECTION
|
||||
730-774). THIS DOCUMENT CANNOT BE EXPORTED (E.G., PROVIDED TO A SUPPLIER
|
||||
OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S. PERSON, WHEREVER
|
||||
LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS
|
||||
BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S. GOVERNMENT
|
||||
APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL
|
||||
PENALTIES.
|
||||
|
||||
DOD 5220.22-M, INDUSTRIAL SECURITY MANUAL, CHAPTER 5, SECTION 1 THROUGH 9 :
|
||||
FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN OR DOD 5200.1-R,
|
||||
INFORMATION SECURITY PROGRAM, CHAPTER 6. FOR UNCLASSIFIED, LIMITED DOCUMENTS
|
||||
DESTROY BY ANY METHOD THAT WILL PREVENT DISCLOSURE OF CONTENTS OR
|
||||
RECONSTRUCTION OF THE DOCUMENT.
|
||||
POC: Alex Kravchenko (1118268)
|
||||
-->
|
||||
<mah:MetroContentControl x:Class="Raytheon.LogDashboard.View.LogDashboardCtrl"
|
||||
xmlns:mah="http://metro.mahapps.com/winfx/xaml/controls"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
DataContext="{Binding LogDashboard, Source={StaticResource LogDashLocator}}"
|
||||
mc:Ignorable="d"
|
||||
Loaded="MetroContentControl_Loaded"
|
||||
>
|
||||
|
||||
<mah:MetroContentControl.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="../Styles/Styles.xaml"/>
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
</mah:MetroContentControl.Resources>
|
||||
|
||||
<mah:MetroContentControl.InputBindings>
|
||||
<KeyBinding Command="{Binding Path=SearchLogCommand}" CommandParameter="{StaticResource False}" Modifiers="Control" Key="F"/>
|
||||
<KeyBinding Command="{Binding Path=SearchLogCommand}" CommandParameter="{StaticResource True}" Modifiers="Control+Shift" Key="F"/>
|
||||
<KeyBinding Command="{Binding Path=FindNextCommand}" Modifiers="Control" Key="N"/>
|
||||
<KeyBinding Command="{Binding Path=FindPreviousCommand}" Modifiers="Control" Key="P"/>
|
||||
<KeyBinding Command="{Binding Path=ClearSearchResultCommand}" Modifiers="Control" Key="C"/>
|
||||
<KeyBinding Command="{Binding Path=ExportCommand}" Modifiers="Control" Key="S"/>
|
||||
<KeyBinding Command="{Binding Path=CleanCommand}" Modifiers="Control" Key="R"/>
|
||||
<KeyBinding Command="{Binding Path=GoToTimestampCommand}" Modifiers="Control" Key="T"/>
|
||||
<KeyBinding Command="{Binding Path=SetTimeIntervalCommand}" Modifiers="Control+Shift" Key="T"/>
|
||||
</mah:MetroContentControl.InputBindings>
|
||||
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="0.8*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="40"/>
|
||||
<RowDefinition Height="0.85*"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="225"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Grid Grid.ColumnSpan="3" Margin="5">
|
||||
<StackPanel Orientation="Horizontal" Grid.ColumnSpan="3" HorizontalAlignment="Left">
|
||||
<Button Style="{StaticResource ImportButtonStyleCircle}" Command="{Binding Path=ImportCommand}"/>
|
||||
<Button Style="{StaticResource ExportButtonStyleCircle}" Command="{Binding Path=ExportCommand}"/>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Orientation="Horizontal" Grid.ColumnSpan="3" HorizontalAlignment="Center">
|
||||
<Button Style="{StaticResource StartPauseNetworkReceiverButtonStyle}"/>
|
||||
<Button Style="{StaticResource StartPauseFileReceiverButtonStyle}" Visibility="{Binding Path=FileWatchers.Count, Converter={StaticResource CountToVisibilityConverter}}"/>
|
||||
<Button Style="{StaticResource ScrollToTop}" Click="OnScrollToTopButtonClick"/>
|
||||
<Button Style="{StaticResource AutoScrollToBottom}" Click="OnAutoScrollToBottomButtonClick" x:Name="AutoScrollButton"/>
|
||||
<Button Style="{StaticResource ScrollToBottom}" Click="OnScrollToBottomButtonClick"/>
|
||||
|
||||
<Button Padding="2" HorizontalAlignment="Right"
|
||||
Style="{StaticResource CircleImageButtonStyle}"
|
||||
ToolTip="Clear / Reset All (Ctrl+R)"
|
||||
Command="{Binding ElementName=LogsListView, Path=DataContext.CleanCommand}"
|
||||
IsEnabled="{Binding ElementName=LogsListView, Path= DataContext.CleanIsEnabled}"
|
||||
Margin="10,0">
|
||||
<Image Source="{StaticResource CleanWhiteImage}"/>
|
||||
</Button>
|
||||
|
||||
|
||||
</StackPanel>
|
||||
|
||||
<Button Style="{StaticResource SettingsButtonStyle}" Command="{Binding Path=OpenSettingsCommand}"/>
|
||||
</Grid>
|
||||
|
||||
|
||||
<Separator Grid.Row="0" Grid.ColumnSpan="3" Grid.Column="0" VerticalAlignment="Bottom" Margin="0"/>
|
||||
|
||||
<Grid Grid.Row="1" Grid.Column="2" Grid.RowSpan="3">
|
||||
<Button Style="{StaticResource TreeButtonStyle}" Command="{Binding Path=OpenTreeCommand}" />
|
||||
</Grid>
|
||||
|
||||
<GridSplitter Grid.Column="1" Width="2" Grid.Row="1" Grid.RowSpan="3"
|
||||
ResizeBehavior="PreviousAndNext"
|
||||
ResizeDirection="Columns"
|
||||
Background="Gray"
|
||||
VerticalAlignment="Stretch"
|
||||
HorizontalAlignment="Center"/>
|
||||
|
||||
<GridSplitter Grid.Column="0" Grid.ColumnSpan="2" Height="3" Grid.Row="2"
|
||||
ResizeBehavior="PreviousAndNext"
|
||||
ResizeDirection="Rows"
|
||||
Background="Gray"
|
||||
HorizontalAlignment="Stretch"/>
|
||||
|
||||
<ListView Grid.Column="0" Grid.Row="1"
|
||||
ItemsSource="{Binding Path=Logs, IsAsync=True}"
|
||||
SelectedValue="{Binding Path=SelectedLog}"
|
||||
x:Name="LogsListView"
|
||||
ScrollViewer.CanContentScroll="True"
|
||||
ScrollViewer.VerticalScrollBarVisibility="Auto"
|
||||
DragOver="LogsListView_OnDragOver"
|
||||
Drop="LogsListView_OnDrop"
|
||||
AllowDrop="True"
|
||||
ScrollViewer.HorizontalScrollBarVisibility="Disabled"
|
||||
ScrollViewer.ScrollChanged="LogsListView_OnScrollChanged"
|
||||
ItemContainerStyle="{StaticResource LogItemStyle}"
|
||||
SelectionChanged="OnSelectionChanged"
|
||||
VirtualizingStackPanel.IsVirtualizing="True"
|
||||
VirtualizingStackPanel.VirtualizationMode="Recycling"
|
||||
IsEnabled="{Binding Path=IsEnableLogList}"
|
||||
GridViewColumnHeader.Click="GridViewColumnHeaderClickedHandler">
|
||||
<ListView.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<VirtualizingStackPanel Orientation="Vertical"/>
|
||||
</ItemsPanelTemplate>
|
||||
</ListView.ItemsPanel>
|
||||
<ListView.View>
|
||||
<GridView>
|
||||
|
||||
<GridViewColumn Width="{Binding Path=ColorReceiverColumnWidth}"
|
||||
HeaderContainerStyle="{StaticResource FixedWithHeaderContainerStyle}"
|
||||
CellTemplate="{StaticResource ReceiverColorColumnDataTemplate}" />
|
||||
|
||||
<GridViewColumn CellTemplate="{StaticResource LogLevelImagesDataTemplate}"
|
||||
Width="90"
|
||||
HeaderContainerStyle="{StaticResource LogLevelHeaderTemplate}"/>
|
||||
|
||||
<GridViewColumn Header="Time"
|
||||
Width="Auto"
|
||||
DisplayMemberBinding="{Binding Time, Converter={StaticResource DataConverter}}"
|
||||
HeaderContainerStyle="{StaticResource BaseGridViewColumnHeaderStyle}"/>
|
||||
|
||||
<GridViewColumn Header="Thread"
|
||||
Width="{Binding Path=ThreadColumnWidth}"
|
||||
DisplayMemberBinding="{Binding Thread}"
|
||||
HeaderContainerStyle="{StaticResource BaseGridViewColumnHeaderStyle}">
|
||||
</GridViewColumn>
|
||||
|
||||
<GridViewColumn Header="Source"
|
||||
Width="{Binding SourceColumnWidth}"
|
||||
DisplayMemberBinding="{Binding Address}"
|
||||
HeaderContainerStyle="{StaticResource IpGridViewColumnHeaderStyle}"/>
|
||||
|
||||
<GridViewColumn Header="Logger"
|
||||
Width="Auto"
|
||||
DisplayMemberBinding="{Binding Logger, Converter={StaticResource LoggerDisplayConverter}}"
|
||||
HeaderContainerStyle="{StaticResource BaseGridViewColumnHeaderStyle}"/>
|
||||
|
||||
<GridViewColumn Header="Message"
|
||||
CellTemplate="{StaticResource LogMessageDataTemplate}"
|
||||
Width="1200"
|
||||
HeaderContainerStyle="{StaticResource MessageHeaderTemplate}"/>
|
||||
</GridView>
|
||||
</ListView.View>
|
||||
<ListView.InputBindings>
|
||||
<KeyBinding Key="W" Modifiers="Control" Command="{Binding Path=FindNextWarningCommand}"/>
|
||||
<KeyBinding Key="E" Modifiers="Control" Command="{Binding Path=FindNextErrorCommand}"/>
|
||||
</ListView.InputBindings>
|
||||
</ListView>
|
||||
|
||||
<mah:ProgressRing Grid.Column="0" Grid.Row="1" Height="50" Width="50"
|
||||
VerticalAlignment="Center" HorizontalAlignment="Center"
|
||||
Visibility="{Binding Path=IsVisibleLoader, Converter={StaticResource BooleanToVisibility}}"/>
|
||||
|
||||
<ProgressBar Grid.Column="0" Grid.Row="1" Height="10"
|
||||
VerticalAlignment="Bottom" Value="{Binding ProcessBarValue}"
|
||||
Background="{Binding SelectedColorTheme.Color}"
|
||||
Foreground="{Binding SelectedColorTheme.Color}"
|
||||
Visibility="{Binding IsVisibleProcessBar, Converter={StaticResource BooleanToVisibility}}" Maximum="100"/>
|
||||
|
||||
|
||||
<GroupBox Grid.Row="3" Padding="0,5" BorderThickness="0" mah:HeaderedControlHelper.HeaderBackground="{Binding Path=IconColor}">
|
||||
<GroupBox.HeaderTemplate>
|
||||
<DataTemplate>
|
||||
<Grid Height="25" Margin="0">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Text="Message Details" FontSize="16" Margin="10,0" />
|
||||
<TextBlock Grid.Column="1" Text="Logs Count" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,5,0" />
|
||||
<TextBlock Grid.Column="2" Text="{Binding Path=DataContext.Logs.Count, RelativeSource={RelativeSource AncestorType=mah:MetroContentControl}}"
|
||||
HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,15,0" />
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</GroupBox.HeaderTemplate>
|
||||
|
||||
<Grid Margin="10,10,0,0">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="60"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="80"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<StackPanel VerticalAlignment="Center">
|
||||
<TextBlock Text="Message" />
|
||||
|
||||
<Button Grid.Row="0" Grid.Column="0"
|
||||
ToolTip="Copy"
|
||||
Command="{Binding Path=CopyMessageCommand}"
|
||||
Style="{StaticResource CircleImageButtonStyle}">
|
||||
<Image Source="{StaticResource CopyDrawingImage}"/>
|
||||
|
||||
</Button>
|
||||
</StackPanel>
|
||||
|
||||
<TextBox x:Name="LoggerTextBox" Grid.Row="0"
|
||||
Text="{Binding Path=SelectedLog.Message}"
|
||||
Grid.Column="1"
|
||||
VerticalAlignment="Stretch" TextWrapping="Wrap" Margin="10,0,20,0"
|
||||
VerticalContentAlignment="Top"
|
||||
HorizontalAlignment="Stretch"
|
||||
Padding="5,0"
|
||||
Height="Auto"
|
||||
IsReadOnly="True"
|
||||
VerticalScrollBarVisibility="Auto"/>
|
||||
|
||||
<Grid Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" Margin="20,10,10,0">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<TextBlock Text="Logger" />
|
||||
<TextBox Grid.Column="1"
|
||||
Text="{Binding Path=SelectedLog.Logger}"
|
||||
Height="35"
|
||||
Margin="6,0,10,0"
|
||||
BorderThickness="1"
|
||||
VerticalContentAlignment="Center"
|
||||
HorizontalAlignment="Stretch"
|
||||
Padding="5,0"
|
||||
IsReadOnly="True"/>
|
||||
|
||||
<TextBlock Grid.Column="2" Text="Time" HorizontalAlignment="Left"/>
|
||||
<TextBox Text="{Binding Path=SelectedLog.Time, StringFormat={}{0:MM/dd/yyyy HH:mm:ss.fff}}"
|
||||
Grid.Column="3"
|
||||
Height="35"
|
||||
Margin="10,0"
|
||||
Width="180"
|
||||
BorderThickness="1"
|
||||
VerticalContentAlignment="Center"
|
||||
HorizontalAlignment="Left"
|
||||
Padding="5,0"
|
||||
IsReadOnly="True"/>
|
||||
|
||||
<TextBlock Grid.Column="4" Text="Thread" HorizontalAlignment="Right"/>
|
||||
<TextBox Text="{Binding Path=SelectedLog.Thread}"
|
||||
Grid.Column="5"
|
||||
Height="35"
|
||||
Margin="10,0"
|
||||
Width="80"
|
||||
BorderThickness="1"
|
||||
VerticalContentAlignment="Center"
|
||||
HorizontalAlignment="Left" Padding="5,0" IsReadOnly="True"/>
|
||||
|
||||
<TextBlock Grid.Column="6"
|
||||
Text="Port" HorizontalAlignment="Right"/>
|
||||
<TextBox Text="{Binding Path=SelectedLog.Port}"
|
||||
Grid.Column="7"
|
||||
Height="35"
|
||||
Margin="10,0"
|
||||
Width="80"
|
||||
BorderThickness="1"
|
||||
VerticalContentAlignment="Center"
|
||||
HorizontalAlignment="Right"
|
||||
Padding="5,0"
|
||||
IsReadOnly="True"/>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</GroupBox>
|
||||
</Grid>
|
||||
|
||||
</mah:MetroContentControl>
|
||||
292
Source/LogDashboard/LogDashboard/View/LogDashboardCtrl.xaml.cs
Normal file
292
Source/LogDashboard/LogDashboard/View/LogDashboardCtrl.xaml.cs
Normal file
@@ -0,0 +1,292 @@
|
||||
//******************************************************************************//
|
||||
// LogDashboardCtrl.xaml.cs
|
||||
// 12/4/2023
|
||||
//
|
||||
// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
|
||||
// PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
|
||||
// AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
|
||||
// UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
|
||||
// RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
|
||||
// CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
|
||||
// OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
|
||||
// COMPANY.
|
||||
//
|
||||
// THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. GOVERNMENT
|
||||
//
|
||||
// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
//
|
||||
// WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE
|
||||
// EXPORT OR DISCLOSURE TO NON-U.S. PERSONS, WHEREVER LOCATED, IS RESTRICTED
|
||||
// BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R. SECTION
|
||||
// 120-130) OR THE EXPORT ADMINISTRATION REGULATIONS (EAR) (15 C.F.R. SECTION
|
||||
// 730-774). THIS DOCUMENT CANNOT BE EXPORTED (E.G., PROVIDED TO A SUPPLIER
|
||||
// OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S. PERSON, WHEREVER
|
||||
// LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS
|
||||
// BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S. GOVERNMENT
|
||||
// APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL
|
||||
// PENALTIES.
|
||||
//
|
||||
// DOD 5220.22-M, INDUSTRIAL SECURITY MANUAL, CHAPTER 5, SECTION 1 THROUGH 9 :
|
||||
// FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN OR DOD 5200.1-R,
|
||||
// INFORMATION SECURITY PROGRAM, CHAPTER 6. FOR UNCLASSIFIED, LIMITED DOCUMENTS
|
||||
// DESTROY BY ANY METHOD THAT WILL PREVENT DISCLOSURE OF CONTENTS OR
|
||||
// RECONSTRUCTION OF THE DOCUMENT.
|
||||
// POC: Alex Kravchenko (1118268)
|
||||
//******************************************************************************//
|
||||
using Raytheon.LogDashboard.ViewModel;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Deployment.Application;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace Raytheon.LogDashboard.View
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for LogDashboardCtrl.xaml
|
||||
/// </summary>
|
||||
public partial class LogDashboardCtrl
|
||||
{
|
||||
public static IntPtr WindowHandle { get; private set; }
|
||||
|
||||
public LogDashboardCtrl()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
AutoScrollButton.ToolTip = "Enable Auto Scroll";
|
||||
}
|
||||
|
||||
private void MetroContentControl_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (AppDomain.CurrentDomain.SetupInformation.ActivationArguments?.ActivationData != null)
|
||||
{
|
||||
string[] activationData = AppDomain.CurrentDomain.SetupInformation.ActivationArguments.ActivationData;
|
||||
foreach (var arg in activationData.Where(x => x.EndsWith(".txt") || x.EndsWith(".log")))
|
||||
{
|
||||
((LogDashboardViewModel)DataContext).ImportLogs(arg);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
List<string> args = Environment.GetCommandLineArgs().Where(x => x.EndsWith(".txt") || x.EndsWith(".log")).ToList();
|
||||
|
||||
if (args.Any())
|
||||
{
|
||||
((LogDashboardViewModel)DataContext).ImportLogs(args.Where(x => x.EndsWith(".txt") || x.EndsWith(".log")));
|
||||
return;
|
||||
}
|
||||
|
||||
DisplayChangeLog();
|
||||
|
||||
}
|
||||
|
||||
private void OnSelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
if(AutoScrollEnabled && LogsListView.Items.Count > 0)
|
||||
{
|
||||
AutoScrollEnabled = false;
|
||||
}
|
||||
|
||||
Task.Run(() =>
|
||||
{
|
||||
Application.Current.Dispatcher.Invoke(() =>
|
||||
{
|
||||
LogsListView.ScrollIntoView(LogsListView.SelectedItem);
|
||||
//TODO
|
||||
//LoggersTreeView.BringIntoView();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
#region Logging scroll
|
||||
|
||||
private bool autoScrollEnabled = true;
|
||||
protected bool AutoScrollEnabled
|
||||
{
|
||||
get => autoScrollEnabled;
|
||||
set
|
||||
{
|
||||
autoScrollEnabled = value;
|
||||
if (autoScrollEnabled)
|
||||
{
|
||||
AutoScrollButton.Opacity = 0.5;
|
||||
AutoScrollButton.ToolTip = "Disable Auto Scroll";
|
||||
}
|
||||
else
|
||||
{
|
||||
AutoScrollButton.ToolTip = "Enable Auto Scroll";
|
||||
AutoScrollButton.Opacity = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void OnScrollToTopButtonClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (LogsListView.Items.Count > 0)
|
||||
{
|
||||
LogsListView.ScrollIntoView(LogsListView.Items[0]);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnAutoScrollToBottomButtonClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (AutoScrollEnabled)
|
||||
{
|
||||
AutoScrollEnabled = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (LogsListView.Items.Count > 0)
|
||||
{
|
||||
LogsListView.ScrollIntoView(LogsListView.Items[LogsListView.Items.Count - 1]);
|
||||
}
|
||||
|
||||
AutoScrollEnabled = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void OnScrollToBottomButtonClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (LogsListView.Items.Count > 0)
|
||||
{
|
||||
LogsListView.ScrollIntoView(LogsListView.Items[LogsListView.Items.Count - 1]);
|
||||
}
|
||||
}
|
||||
|
||||
private void LogsListView_OnScrollChanged(object sender, ScrollChangedEventArgs e)
|
||||
{
|
||||
if (AutoScrollEnabled && LogsListView.Items.Count > 0 && e.VerticalChange < 0)
|
||||
{
|
||||
AutoScrollEnabled = false;
|
||||
}
|
||||
|
||||
if (AutoScrollEnabled && LogsListView.Items.Count > 0)
|
||||
{
|
||||
LogsListView.ScrollIntoView(LogsListView.Items[LogsListView.Items.Count - 1]);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region table sorting
|
||||
|
||||
GridViewColumnHeader lastHeaderClicked = null;
|
||||
ListSortDirection lastDirection = ListSortDirection.Ascending;
|
||||
|
||||
private void GridViewColumnHeaderClickedHandler(object sender, RoutedEventArgs e)
|
||||
{
|
||||
GridViewColumnHeader headerClicked = e.OriginalSource as GridViewColumnHeader;
|
||||
|
||||
if (headerClicked != null && (string)headerClicked.Content == "Message")
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (headerClicked != null)
|
||||
{
|
||||
if (headerClicked.Role != GridViewColumnHeaderRole.Padding)
|
||||
{
|
||||
ListSortDirection direction;
|
||||
if (headerClicked != lastHeaderClicked)
|
||||
{
|
||||
direction = ListSortDirection.Ascending;
|
||||
}
|
||||
else
|
||||
{
|
||||
direction = lastDirection == ListSortDirection.Ascending
|
||||
? ListSortDirection.Descending
|
||||
: ListSortDirection.Ascending;
|
||||
}
|
||||
|
||||
Binding columnBinding = headerClicked.Column.DisplayMemberBinding as Binding;
|
||||
string sortBy = columnBinding?.Path.Path ?? headerClicked.Column.Header as string;
|
||||
|
||||
Sort(sortBy, direction);
|
||||
|
||||
if (direction == ListSortDirection.Ascending)
|
||||
{
|
||||
headerClicked.Column.HeaderTemplate = Resources["HeaderTemplateArrowUp"] as DataTemplate;
|
||||
}
|
||||
else
|
||||
{
|
||||
headerClicked.Column.HeaderTemplate = Resources["HeaderTemplateArrowDown"] as DataTemplate;
|
||||
}
|
||||
|
||||
// Remove arrow from previously sorted header
|
||||
if (lastHeaderClicked != null && lastHeaderClicked != headerClicked)
|
||||
{
|
||||
lastHeaderClicked.Column.HeaderTemplate = null;
|
||||
}
|
||||
|
||||
lastHeaderClicked = headerClicked;
|
||||
lastDirection = direction;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void Sort(string sortBy, ListSortDirection direction)
|
||||
{
|
||||
ICollectionView dataView = CollectionViewSource.GetDefaultView(LogsListView.ItemsSource);
|
||||
|
||||
dataView.SortDescriptions.Clear();
|
||||
SortDescription sd = new SortDescription(sortBy, direction);
|
||||
dataView.SortDescriptions.Add(sd);
|
||||
dataView.Refresh();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Drag and Drop
|
||||
|
||||
private void LogsListView_OnDragOver(object sender, DragEventArgs e)
|
||||
{
|
||||
string file = ((string[])e.Data.GetData(DataFormats.FileDrop))?.FirstOrDefault(
|
||||
x => Path.GetExtension(x) == ".txt" ||
|
||||
Path.GetExtension(x) == ".log" ||
|
||||
Path.GetExtension(x) == ".csv");
|
||||
|
||||
e.Effects = file != null ? DragDropEffects.Copy : DragDropEffects.None;
|
||||
e.Handled = true;
|
||||
}
|
||||
|
||||
private void LogsListView_OnDrop(object sender, DragEventArgs e)
|
||||
{
|
||||
e.Effects = DragDropEffects.Copy;
|
||||
if (e.Data.GetDataPresent(DataFormats.FileDrop))
|
||||
{
|
||||
string[] files = (string[])e.Data.GetData(DataFormats.FileDrop);
|
||||
if (files != null && files.Any())
|
||||
{
|
||||
var logFiles = files.Where(x => Path.GetExtension(x) == ".txt" ||
|
||||
Path.GetExtension(x) == ".log" ||
|
||||
Path.GetExtension(x) == ".csv");
|
||||
if (logFiles.Any())
|
||||
{
|
||||
((LogDashboardViewModel)DataContext).ImportLogs(logFiles);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private void DisplayChangeLog()
|
||||
{
|
||||
if (!ApplicationDeployment.IsNetworkDeployed || !ApplicationDeployment.CurrentDeployment.IsFirstRun)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ReleaseNotesDialog releaseNotesDialog = new ReleaseNotesDialog
|
||||
{
|
||||
WindowStartupLocation = WindowStartupLocation.CenterOwner
|
||||
};
|
||||
releaseNotesDialog.ShowDialog();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,170 @@
|
||||
<!--
|
||||
LogImportTemplateDialog.xaml
|
||||
12/4/2023
|
||||
|
||||
RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
|
||||
PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
|
||||
AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
|
||||
UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
|
||||
RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
|
||||
CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
|
||||
OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
|
||||
COMPANY.
|
||||
|
||||
THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. GOVERNMENT
|
||||
|
||||
UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
|
||||
WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE
|
||||
EXPORT OR DISCLOSURE TO NON-U.S. PERSONS, WHEREVER LOCATED, IS RESTRICTED
|
||||
BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R. SECTION
|
||||
120-130) OR THE EXPORT ADMINISTRATION REGULATIONS (EAR) (15 C.F.R. SECTION
|
||||
730-774). THIS DOCUMENT CANNOT BE EXPORTED (E.G., PROVIDED TO A SUPPLIER
|
||||
OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S. PERSON, WHEREVER
|
||||
LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS
|
||||
BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S. GOVERNMENT
|
||||
APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL
|
||||
PENALTIES.
|
||||
|
||||
DOD 5220.22-M, INDUSTRIAL SECURITY MANUAL, CHAPTER 5, SECTION 1 THROUGH 9 :
|
||||
FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN OR DOD 5200.1-R,
|
||||
INFORMATION SECURITY PROGRAM, CHAPTER 6. FOR UNCLASSIFIED, LIMITED DOCUMENTS
|
||||
DESTROY BY ANY METHOD THAT WILL PREVENT DISCLOSURE OF CONTENTS OR
|
||||
RECONSTRUCTION OF THE DOCUMENT.
|
||||
POC: Alex Kravchenko (1118268)
|
||||
-->
|
||||
<mah:MetroWindow x:Class="Raytheon.LogDashboard.View.LogImportTemplateDialog"
|
||||
xmlns:mah="http://metro.mahapps.com/winfx/xaml/controls"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
DataContext="{Binding LogImportTemplate, Source={StaticResource LogDashLocator}}"
|
||||
Title="Log Import Template"
|
||||
Topmost="True"
|
||||
mc:Ignorable="d"
|
||||
Height="430"
|
||||
Width="700"
|
||||
Closing="LogImportTemplateDialog_OnClosing">
|
||||
|
||||
<mah:MetroWindow.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="../Styles/Styles.xaml"/>
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
</mah:MetroWindow.Resources>
|
||||
|
||||
<Grid Margin="15,10,15,0">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<RadioButton Margin="10,10"
|
||||
ToolTip="Try to detect a template for parsing the log file automatically. 100% result is not guaranteed."
|
||||
Content="Automatically"
|
||||
IsChecked="{Binding Path=IsAutomaticDetectTemplateSelected}"/>
|
||||
|
||||
<RadioButton Grid.Row="1" Margin="10,0"
|
||||
Content="Select from existing templates"
|
||||
IsChecked="{Binding Path=IsPopularTemplateSelected}"/>
|
||||
|
||||
<ComboBox Grid.Row="2" Margin="10,0,10,5"
|
||||
Grid.ColumnSpan="2"
|
||||
ItemsSource="{Binding Path=PopularTemplates}"
|
||||
SelectedValue="{Binding Path=SelectedPopularTemplate}"
|
||||
SelectedValuePath="Value"
|
||||
DisplayMemberPath="Key"/>
|
||||
|
||||
<RadioButton Grid.Row="3"
|
||||
Margin="10,0"
|
||||
Content="From layout string"
|
||||
IsChecked="{Binding Path=IsLayoutStringTemplateSelected}"
|
||||
VerticalAlignment="Center" />
|
||||
|
||||
<TextBox Grid.Row="4" Grid.ColumnSpan="2" Margin="10,0,10,5" HorizontalAlignment="Stretch"
|
||||
Text="{Binding TemplateString, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
|
||||
|
||||
<RadioButton Grid.Row="5" Margin="10,0" Content="Or create your own template"
|
||||
IsChecked="{Binding Path=IsUserTemplateSelected}"
|
||||
VerticalAlignment="Center" />
|
||||
|
||||
<Button Grid.Row="6"
|
||||
Width="Auto"
|
||||
Content="Add" Visibility="{Binding Path=ClearContainsIsVisible, Converter={StaticResource BooleanToVisibility}}"
|
||||
Command="{Binding Path=AddTemplateItemCommand}" Margin="10,5,0,0"
|
||||
HorizontalAlignment="Left"/>
|
||||
|
||||
<StackPanel Orientation="Horizontal" Grid.Row="6" Grid.Column="1">
|
||||
<Label Content="{Binding Separator, StringFormat={}{0}:}" VerticalAlignment="Center"/>
|
||||
<TextBox Text="{Binding Path=TemplateSeparator, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" HorizontalContentAlignment="Center" Width="30" VerticalContentAlignment="Center"/>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Grid.Row="7" Grid.ColumnSpan="2" Orientation="Horizontal" Margin="10,0,10,5" Height="80">
|
||||
<ItemsControl x:Name="TemplateLogItemsIC" ItemsSource="{Binding Path=TemplateLogItems, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" VerticalAlignment="Center" >
|
||||
<ItemsControl.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<WrapPanel Orientation="Horizontal" />
|
||||
</ItemsPanelTemplate>
|
||||
</ItemsControl.ItemsPanel>
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<StackPanel Orientation="Vertical">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Label Content="${" VerticalContentAlignment="Center" Padding="0"/>
|
||||
<ComboBox x:Name="ComboBox" Margin="5" ItemsSource="{Binding Path=TemplateItems}" SelectedItem="{Binding Path=SelectedTemplateParameter, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Height="30" VerticalContentAlignment="Center">
|
||||
<ComboBox.GroupStyle>
|
||||
<GroupStyle>
|
||||
<GroupStyle.HeaderTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding Name}" Margin="10,0,0,0"/>
|
||||
</DataTemplate>
|
||||
</GroupStyle.HeaderTemplate>
|
||||
</GroupStyle>
|
||||
</ComboBox.GroupStyle>
|
||||
<ComboBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding Parameter}"/>
|
||||
</DataTemplate>
|
||||
</ComboBox.ItemTemplate>
|
||||
</ComboBox>
|
||||
<Label Content="}" VerticalContentAlignment="Center" Padding="0"/>
|
||||
<Label Padding="0" FontStyle="Normal" FontSize="18" VerticalContentAlignment="Center" Content="{Binding ElementName=TemplateLogItemsIC, Path=DataContext.TemplateSeparator, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
|
||||
</StackPanel>
|
||||
|
||||
<Button Padding="0"
|
||||
Width="60" Content="Remove"
|
||||
Margin="1" Height="30"
|
||||
ToolTip="Remove Template Item"
|
||||
Command="{Binding ElementName=TemplateLogItemsIC, Path=DataContext.RemoveTemplateItemCommand}" CommandParameter="{Binding}"/>
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
</StackPanel>
|
||||
|
||||
<CheckBox Grid.Row="9" Grid.ColumnSpan="2" Margin="10,0,10,10" Content="Add New Logs When Changing File" IsChecked="{Binding Path=NeedUpdateFile}"/>
|
||||
|
||||
<Button Grid.Row="10" Grid.Column="0" HorizontalAlignment="Left" Margin="10,0" Width="180"
|
||||
Content="Save" Command="{Binding Path=SaveTemplateSettingsCommand}"/>
|
||||
|
||||
<WrapPanel Grid.Row="10" Grid.ColumnSpan="2" HorizontalAlignment="Right" Margin="10,0">
|
||||
<Button Command="{Binding OkCommand}" MinWidth="100" Height="30" Margin="0,0,10,0" Content="OK"/>
|
||||
<Button IsCancel="True" MinWidth="100" Content="Cancel"/>
|
||||
</WrapPanel>
|
||||
</Grid>
|
||||
</mah:MetroWindow>
|
||||
@@ -0,0 +1,66 @@
|
||||
//******************************************************************************//
|
||||
// LogImportTemplateDialog.xaml.cs
|
||||
// 12/4/2023
|
||||
//
|
||||
// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
|
||||
// PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
|
||||
// AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
|
||||
// UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
|
||||
// RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
|
||||
// CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
|
||||
// OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
|
||||
// COMPANY.
|
||||
//
|
||||
// THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. GOVERNMENT
|
||||
//
|
||||
// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
//
|
||||
// WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE
|
||||
// EXPORT OR DISCLOSURE TO NON-U.S. PERSONS, WHEREVER LOCATED, IS RESTRICTED
|
||||
// BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R. SECTION
|
||||
// 120-130) OR THE EXPORT ADMINISTRATION REGULATIONS (EAR) (15 C.F.R. SECTION
|
||||
// 730-774). THIS DOCUMENT CANNOT BE EXPORTED (E.G., PROVIDED TO A SUPPLIER
|
||||
// OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S. PERSON, WHEREVER
|
||||
// LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS
|
||||
// BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S. GOVERNMENT
|
||||
// APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL
|
||||
// PENALTIES.
|
||||
//
|
||||
// DOD 5220.22-M, INDUSTRIAL SECURITY MANUAL, CHAPTER 5, SECTION 1 THROUGH 9 :
|
||||
// FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN OR DOD 5200.1-R,
|
||||
// INFORMATION SECURITY PROGRAM, CHAPTER 6. FOR UNCLASSIFIED, LIMITED DOCUMENTS
|
||||
// DESTROY BY ANY METHOD THAT WILL PREVENT DISCLOSURE OF CONTENTS OR
|
||||
// RECONSTRUCTION OF THE DOCUMENT.
|
||||
// POC: Alex Kravchenko (1118268)
|
||||
//******************************************************************************//
|
||||
using System.ComponentModel;
|
||||
using Raytheon.LogDashboard.Model;
|
||||
using Raytheon.LogDashboard.ViewModel;
|
||||
|
||||
namespace Raytheon.LogDashboard.View
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for LogImportTemplate.xaml
|
||||
/// </summary>
|
||||
public partial class LogImportTemplateDialog
|
||||
{
|
||||
public LogTemplate LogTemplate { get; private set; }
|
||||
public bool NeedUpdateFile { get; private set; } = false;
|
||||
|
||||
public LogImportTemplateDialog()
|
||||
{
|
||||
InitializeComponent();
|
||||
DataContext = new LogImportTemplateViewModel();
|
||||
}
|
||||
|
||||
private void LogImportTemplateDialog_OnClosing(object sender, CancelEventArgs e)
|
||||
{
|
||||
var logImportTemplateViewModel = DataContext as LogImportTemplateViewModel;
|
||||
if (logImportTemplateViewModel != null)
|
||||
{
|
||||
LogTemplate = logImportTemplateViewModel.LogTemplate;
|
||||
NeedUpdateFile = logImportTemplateViewModel.NeedUpdateFile;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
119
Source/LogDashboard/LogDashboard/View/ReleaseNotesDialog.xaml
Normal file
119
Source/LogDashboard/LogDashboard/View/ReleaseNotesDialog.xaml
Normal file
@@ -0,0 +1,119 @@
|
||||
<!--
|
||||
ReleaseNotesDialog.xaml
|
||||
12/4/2023
|
||||
|
||||
RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
|
||||
PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
|
||||
AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
|
||||
UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
|
||||
RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
|
||||
CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
|
||||
OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
|
||||
COMPANY.
|
||||
|
||||
THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. GOVERNMENT
|
||||
|
||||
UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
|
||||
WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE
|
||||
EXPORT OR DISCLOSURE TO NON-U.S. PERSONS, WHEREVER LOCATED, IS RESTRICTED
|
||||
BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R. SECTION
|
||||
120-130) OR THE EXPORT ADMINISTRATION REGULATIONS (EAR) (15 C.F.R. SECTION
|
||||
730-774). THIS DOCUMENT CANNOT BE EXPORTED (E.G., PROVIDED TO A SUPPLIER
|
||||
OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S. PERSON, WHEREVER
|
||||
LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS
|
||||
BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S. GOVERNMENT
|
||||
APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL
|
||||
PENALTIES.
|
||||
|
||||
DOD 5220.22-M, INDUSTRIAL SECURITY MANUAL, CHAPTER 5, SECTION 1 THROUGH 9 :
|
||||
FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN OR DOD 5200.1-R,
|
||||
INFORMATION SECURITY PROGRAM, CHAPTER 6. FOR UNCLASSIFIED, LIMITED DOCUMENTS
|
||||
DESTROY BY ANY METHOD THAT WILL PREVENT DISCLOSURE OF CONTENTS OR
|
||||
RECONSTRUCTION OF THE DOCUMENT.
|
||||
POC: Alex Kravchenko (1118268)
|
||||
-->
|
||||
<mah:MetroWindow x:Class="Raytheon.LogDashboard.View.ReleaseNotesDialog"
|
||||
xmlns:mah="http://metro.mahapps.com/winfx/xaml/controls"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
DataContext="{Binding ReleaseNotes, Source={StaticResource LogDashLocator}}"
|
||||
WindowTitleBrush="{Binding LogDashboard.SelectedColorTheme.Color, Source={StaticResource LogDashLocator}}"
|
||||
mc:Ignorable="d"
|
||||
Title="Release Notes"
|
||||
Height="600" Width="680">
|
||||
|
||||
<mah:MetroWindow.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="../Styles/Styles.xaml"/>
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
</mah:MetroWindow.Resources>
|
||||
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
<ScrollViewer VerticalScrollBarVisibility="Auto">
|
||||
<ItemsControl ItemsSource="{Binding ReleaseNotesList}">
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<GroupBox Margin="20"
|
||||
mah:HeaderedControlHelper.HeaderBackground="{Binding LogDashboard.SelectedColorTheme.Color, Source={StaticResource LogDashLocator}}">
|
||||
<StackPanel>
|
||||
<StackPanel Orientation="Horizontal" Margin="20" HorizontalAlignment="Center">
|
||||
<TextBlock Text="Version: " FontWeight="Black"/>
|
||||
<TextBlock Text="{Binding Version}" FontWeight="Black"/>
|
||||
</StackPanel>
|
||||
|
||||
<TextBlock Text="New Features" Margin="10" FontWeight="Black" HorizontalAlignment="Center"/>
|
||||
|
||||
<ItemsControl ItemsSource="{Binding NewFeatures}" Margin="20">
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding}" />
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
|
||||
<TextBlock Text="Changed Features" Margin="10" FontWeight="Black" HorizontalAlignment="Center"/>
|
||||
|
||||
<ItemsControl ItemsSource="{Binding ChangedFeatures}" Margin="20">
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding}"/>
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
|
||||
<TextBlock Text="Fixed Bugs" Margin="10" FontWeight="Black" HorizontalAlignment="Center"/>
|
||||
|
||||
<ItemsControl ItemsSource="{Binding FixedBugs}" Margin="20">
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding}"/>
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
</StackPanel>
|
||||
</GroupBox>
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
</ScrollViewer>
|
||||
<Button Grid.Row="1"
|
||||
Content="OK"
|
||||
IsCancel="True"
|
||||
Height="28"
|
||||
Width="100"
|
||||
Margin="10"
|
||||
HorizontalAlignment="Right"
|
||||
Background="{Binding LogDashboard.SelectedColorTheme.Color, Source={StaticResource LogDashLocator}}"
|
||||
/>
|
||||
</Grid>
|
||||
</mah:MetroWindow>
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
//******************************************************************************//
|
||||
// ReleaseNotesDialog.xaml.cs
|
||||
// 12/4/2023
|
||||
//
|
||||
// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
|
||||
// PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
|
||||
// AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
|
||||
// UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
|
||||
// RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
|
||||
// CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
|
||||
// OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
|
||||
// COMPANY.
|
||||
//
|
||||
// THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. GOVERNMENT
|
||||
//
|
||||
// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
//
|
||||
// WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE
|
||||
// EXPORT OR DISCLOSURE TO NON-U.S. PERSONS, WHEREVER LOCATED, IS RESTRICTED
|
||||
// BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R. SECTION
|
||||
// 120-130) OR THE EXPORT ADMINISTRATION REGULATIONS (EAR) (15 C.F.R. SECTION
|
||||
// 730-774). THIS DOCUMENT CANNOT BE EXPORTED (E.G., PROVIDED TO A SUPPLIER
|
||||
// OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S. PERSON, WHEREVER
|
||||
// LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS
|
||||
// BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S. GOVERNMENT
|
||||
// APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL
|
||||
// PENALTIES.
|
||||
//
|
||||
// DOD 5220.22-M, INDUSTRIAL SECURITY MANUAL, CHAPTER 5, SECTION 1 THROUGH 9 :
|
||||
// FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN OR DOD 5200.1-R,
|
||||
// INFORMATION SECURITY PROGRAM, CHAPTER 6. FOR UNCLASSIFIED, LIMITED DOCUMENTS
|
||||
// DESTROY BY ANY METHOD THAT WILL PREVENT DISCLOSURE OF CONTENTS OR
|
||||
// RECONSTRUCTION OF THE DOCUMENT.
|
||||
// POC: Alex Kravchenko (1118268)
|
||||
//******************************************************************************//
|
||||
using Raytheon.LogDashboard.ViewModel;
|
||||
using System.Windows;
|
||||
|
||||
namespace Raytheon.LogDashboard.View
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for ReleaseNotesDialog.xaml
|
||||
/// </summary>
|
||||
public partial class ReleaseNotesDialog
|
||||
{
|
||||
public ReleaseNotesDialog()
|
||||
{
|
||||
InitializeComponent();
|
||||
DataContext = new ReleaseNotesViewModel();
|
||||
}
|
||||
}
|
||||
}
|
||||
213
Source/LogDashboard/LogDashboard/View/SearchResult.xaml
Normal file
213
Source/LogDashboard/LogDashboard/View/SearchResult.xaml
Normal file
@@ -0,0 +1,213 @@
|
||||
<!--
|
||||
SearchResult.xaml
|
||||
12/4/2023
|
||||
|
||||
RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
|
||||
PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
|
||||
AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
|
||||
UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
|
||||
RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
|
||||
CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
|
||||
OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
|
||||
COMPANY.
|
||||
|
||||
THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. GOVERNMENT
|
||||
|
||||
UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
|
||||
WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE
|
||||
EXPORT OR DISCLOSURE TO NON-U.S. PERSONS, WHEREVER LOCATED, IS RESTRICTED
|
||||
BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R. SECTION
|
||||
120-130) OR THE EXPORT ADMINISTRATION REGULATIONS (EAR) (15 C.F.R. SECTION
|
||||
730-774). THIS DOCUMENT CANNOT BE EXPORTED (E.G., PROVIDED TO A SUPPLIER
|
||||
OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S. PERSON, WHEREVER
|
||||
LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS
|
||||
BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S. GOVERNMENT
|
||||
APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL
|
||||
PENALTIES.
|
||||
|
||||
DOD 5220.22-M, INDUSTRIAL SECURITY MANUAL, CHAPTER 5, SECTION 1 THROUGH 9 :
|
||||
FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN OR DOD 5200.1-R,
|
||||
INFORMATION SECURITY PROGRAM, CHAPTER 6. FOR UNCLASSIFIED, LIMITED DOCUMENTS
|
||||
DESTROY BY ANY METHOD THAT WILL PREVENT DISCLOSURE OF CONTENTS OR
|
||||
RECONSTRUCTION OF THE DOCUMENT.
|
||||
POC: Alex Kravchenko (1118268)
|
||||
-->
|
||||
<mah:MetroWindow x:Class="Raytheon.LogDashboard.View.SearchResult"
|
||||
xmlns:mah="http://metro.mahapps.com/winfx/xaml/controls"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
DataContext="{Binding SearchResult, Source={StaticResource LogDashLocator}}"
|
||||
mc:Ignorable="d"
|
||||
Title="Log Dashboard Search Result"
|
||||
Height="600"
|
||||
Width="1024">
|
||||
|
||||
<mah:MetroWindow.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="../Styles/Styles.xaml"/>
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
</mah:MetroWindow.Resources>
|
||||
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="0.65*"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="0.35*"/>
|
||||
</Grid.RowDefinitions>
|
||||
<ListView x:Name="FoundResultListView" ItemsSource="{Binding Path=SearchResult, IsAsync=True}"
|
||||
ScrollViewer.CanContentScroll="True" ScrollViewer.VerticalScrollBarVisibility="Auto" SelectedValue="{Binding Path=SelectedLog}"
|
||||
ScrollViewer.HorizontalScrollBarVisibility="Disabled" VirtualizingStackPanel.IsVirtualizing="True"
|
||||
VirtualizingStackPanel.VirtualizationMode="Recycling" GridViewColumnHeader.Click="GridViewColumnHeaderClickedHandler" >
|
||||
<ListView.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<VirtualizingStackPanel/>
|
||||
</ItemsPanelTemplate>
|
||||
</ListView.ItemsPanel>
|
||||
<ListView.View>
|
||||
<GridView>
|
||||
<GridViewColumn Header="Level" Width="Auto"
|
||||
CellTemplate="{StaticResource LogLevelImagesDataTemplate}"
|
||||
HeaderContainerStyle="{StaticResource SearchGridViewColumnHeaderStyle}"/>
|
||||
|
||||
<GridViewColumn Header="Time" Width="Auto"
|
||||
DisplayMemberBinding="{Binding Time, StringFormat={}{0:MM/dd/yyyy HH:mm:ss.fff}}"
|
||||
HeaderContainerStyle="{StaticResource SearchGridViewColumnHeaderStyle}"/>
|
||||
|
||||
<GridViewColumn Header="Thread"
|
||||
Width="Auto"
|
||||
DisplayMemberBinding="{Binding Thread}"
|
||||
HeaderContainerStyle="{StaticResource SearchGridViewColumnHeaderStyle}"/>
|
||||
|
||||
<GridViewColumn Header="IP"
|
||||
Width="115"
|
||||
DisplayMemberBinding="{Binding Address}"
|
||||
HeaderContainerStyle="{StaticResource SearchGridViewColumnHeaderStyle}"/>
|
||||
|
||||
<GridViewColumn Header="Logger"
|
||||
Width="120"
|
||||
DisplayMemberBinding="{Binding Logger, Converter={StaticResource LoggerDisplayConverter}}"
|
||||
HeaderContainerStyle="{StaticResource SearchGridViewColumnHeaderStyle}"/>
|
||||
|
||||
<GridViewColumn Header="Message"
|
||||
Width="1500"
|
||||
CellTemplate="{StaticResource LogMessageDataTemplate}"
|
||||
HeaderContainerStyle="{StaticResource SearchGridViewColumnHeaderStyle}"/>
|
||||
</GridView>
|
||||
</ListView.View>
|
||||
<ListView.ContextMenu>
|
||||
<ContextMenu Style="{StaticResource BaseContextMenu}">
|
||||
<MenuItem Header="Go to this log message" ToolTip="Go to this log message in main Log Viewer window" Margin="0" Click="ShowMessageInMainWindowClick"/>
|
||||
</ContextMenu>
|
||||
</ListView.ContextMenu>
|
||||
<ListView.ItemContainerStyle>
|
||||
<Style TargetType="{x:Type ListViewItem}">
|
||||
<EventSetter Event="MouseDoubleClick" Handler="ListViewItem_MouseDoubleClick"/>
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding Level}" Value="Warn">
|
||||
<Setter Property="Foreground" Value="Orange"></Setter>
|
||||
</DataTrigger>
|
||||
<DataTrigger Binding="{Binding Level}" Value="Error">
|
||||
<Setter Property="Foreground" Value="Red"></Setter>
|
||||
</DataTrigger>
|
||||
<DataTrigger Binding="{Binding Level}" Value="Fatal">
|
||||
<Setter Property="Foreground" Value="DarkRed"></Setter>
|
||||
</DataTrigger>
|
||||
<DataTrigger Binding="{Binding Level}" Value="Info">
|
||||
<Setter Property="Foreground" Value="Green"></Setter>
|
||||
</DataTrigger>
|
||||
<DataTrigger Binding="{Binding Level}" Value="Debug">
|
||||
<Setter Property="Foreground" Value="Black"></Setter>
|
||||
</DataTrigger>
|
||||
<DataTrigger Binding="{Binding Level}" Value="Trace">
|
||||
<Setter Property="Foreground" Value="Gray"></Setter>
|
||||
</DataTrigger>
|
||||
<Trigger Property="IsEnabled" Value="False">
|
||||
<Setter Property="Opacity" Value="0.5"/>
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</ListView.ItemContainerStyle>
|
||||
</ListView>
|
||||
<GridSplitter Grid.Column="0" Height="3" Grid.Row="1" ResizeDirection="Rows" Background="Gray"
|
||||
HorizontalAlignment="Stretch"/>
|
||||
|
||||
<GroupBox Grid.Row="2" Padding="0,5">
|
||||
<GroupBox.HeaderTemplate>
|
||||
<DataTemplate>
|
||||
<Grid Height="25" Margin="10,0">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Text="Message Details" FontSize="16" Foreground="LightGray"/>
|
||||
<TextBlock Grid.Column="1" Text="Fount Logs:" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,5,0" Foreground="LightGray"/>
|
||||
<TextBlock Grid.Column="2" Text="{Binding Path=DataContext.SearchResult.Count, RelativeSource={RelativeSource AncestorType=mah:MetroWindow}}"
|
||||
HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,15,0" Foreground="LightGray"/>
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</GroupBox.HeaderTemplate>
|
||||
|
||||
<Grid Margin="10">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="60"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="80"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<TextBlock Text="{Binding Message, StringFormat={}{0}:}" FontSize="14" VerticalAlignment="Top" Margin="0,5,0,0"/>
|
||||
<Button Grid.Row="0" Grid.Column="0" VerticalAlignment="Bottom" ToolTip="Copy" Command="{Binding Path=CopyMessageCommand}" Margin="0,5">
|
||||
<Image Source="{StaticResource CopyDrawingImage}"/>
|
||||
</Button>
|
||||
<TextBox x:Name="LoggerTextBox"
|
||||
Grid.Row="0"
|
||||
Text="{Binding Path=SelectedLog.Message}"
|
||||
FontSize="14" Grid.Column="1"
|
||||
VerticalAlignment="Stretch"
|
||||
TextWrapping="Wrap" Margin="10,0"
|
||||
BorderThickness="1"
|
||||
VerticalContentAlignment="Top"
|
||||
HorizontalAlignment="Stretch" Padding="5,0" Height="Auto" IsReadOnly="True" VerticalScrollBarVisibility="Auto"/>
|
||||
|
||||
|
||||
<Grid Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" Margin="20,10,10,10">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<TextBlock Text="{Binding Logger, StringFormat={}{0}:}" FontSize="14" VerticalAlignment="Center"/>
|
||||
<TextBox Text="{Binding Path=SelectedLog.Logger}" FontSize="14" Grid.Column="1" Height="35" Margin="23,0,10,0"
|
||||
BorderThickness="1" VerticalContentAlignment="Center" HorizontalAlignment="Stretch" Padding="5,0" IsReadOnly="True"/>
|
||||
|
||||
<TextBlock Grid.Column="2" Text="{Binding Time, StringFormat={}{0}:}" FontSize="14" VerticalAlignment="Center" HorizontalAlignment="Left"/>
|
||||
<TextBox Text="{Binding Path=SelectedLog.Time, StringFormat={}{0:MM/dd/yyyy HH:mm:ss.fff}}" FontSize="14" Grid.Column="3" Height="35" Margin="10,0" Width="180"
|
||||
BorderThickness="1" VerticalContentAlignment="Center" HorizontalAlignment="Left" Padding="5,0" IsReadOnly="True"/>
|
||||
|
||||
<TextBlock Grid.Column="4" Text="{Binding Thread, StringFormat={}{0}:}" FontSize="14" VerticalAlignment="Center" HorizontalAlignment="Right"/>
|
||||
<TextBox Text="{Binding Path=SelectedLog.Thread}" FontSize="14" Grid.Column="5" Height="35" Margin="10,0" Width="80"
|
||||
BorderThickness="1" VerticalContentAlignment="Center" HorizontalAlignment="Left" Padding="5,0" IsReadOnly="True"/>
|
||||
|
||||
<TextBlock Grid.Column="6" Text="{Binding Port, StringFormat={}{0}:}" FontSize="14" VerticalAlignment="Center" HorizontalAlignment="Right"/>
|
||||
<TextBox Text="{Binding Path=SelectedLog.Port}" FontSize="14" Grid.Column="7" Height="35" Margin="10,0,0,0" Width="80"
|
||||
BorderThickness="1" VerticalContentAlignment="Center" HorizontalAlignment="Right" Padding="5,0" IsReadOnly="True"/>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</GroupBox>
|
||||
</Grid>
|
||||
</mah:MetroWindow>
|
||||
|
||||
150
Source/LogDashboard/LogDashboard/View/SearchResult.xaml.cs
Normal file
150
Source/LogDashboard/LogDashboard/View/SearchResult.xaml.cs
Normal file
@@ -0,0 +1,150 @@
|
||||
//******************************************************************************//
|
||||
// SearchResult.xaml.cs
|
||||
// 12/4/2023
|
||||
//
|
||||
// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
|
||||
// PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
|
||||
// AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
|
||||
// UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
|
||||
// RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
|
||||
// CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
|
||||
// OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
|
||||
// COMPANY.
|
||||
//
|
||||
// THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. GOVERNMENT
|
||||
//
|
||||
// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
//
|
||||
// WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE
|
||||
// EXPORT OR DISCLOSURE TO NON-U.S. PERSONS, WHEREVER LOCATED, IS RESTRICTED
|
||||
// BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R. SECTION
|
||||
// 120-130) OR THE EXPORT ADMINISTRATION REGULATIONS (EAR) (15 C.F.R. SECTION
|
||||
// 730-774). THIS DOCUMENT CANNOT BE EXPORTED (E.G., PROVIDED TO A SUPPLIER
|
||||
// OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S. PERSON, WHEREVER
|
||||
// LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS
|
||||
// BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S. GOVERNMENT
|
||||
// APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL
|
||||
// PENALTIES.
|
||||
//
|
||||
// DOD 5220.22-M, INDUSTRIAL SECURITY MANUAL, CHAPTER 5, SECTION 1 THROUGH 9 :
|
||||
// FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN OR DOD 5200.1-R,
|
||||
// INFORMATION SECURITY PROGRAM, CHAPTER 6. FOR UNCLASSIFIED, LIMITED DOCUMENTS
|
||||
// DESTROY BY ANY METHOD THAT WILL PREVENT DISCLOSURE OF CONTENTS OR
|
||||
// RECONSTRUCTION OF THE DOCUMENT.
|
||||
// POC: Alex Kravchenko (1118268)
|
||||
//******************************************************************************//
|
||||
using Raytheon.LogDashboard.Model;
|
||||
using Raytheon.LogDashboard.ViewModel;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.ComponentModel;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace Raytheon.LogDashboard.View
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for SearchResult.xaml
|
||||
/// </summary>
|
||||
public partial class SearchResult
|
||||
{
|
||||
public event EventHandler<LogMessage> ShowLogEvent;
|
||||
|
||||
public SearchResult(List<LogMessage> searchResult, string searchText, bool isMatchCase)
|
||||
{
|
||||
InitializeComponent();
|
||||
var dataContext = new SearchResultViewModel
|
||||
{
|
||||
SearchResult = new ObservableCollection<LogMessage>(searchResult),
|
||||
HighlightSearchText = searchText,
|
||||
IsMatchCase = isMatchCase
|
||||
};
|
||||
DataContext = dataContext;
|
||||
}
|
||||
|
||||
#region Sorting
|
||||
|
||||
GridViewColumnHeader lastHeaderClicked = null;
|
||||
ListSortDirection lastDirection = ListSortDirection.Ascending;
|
||||
|
||||
private void GridViewColumnHeaderClickedHandler(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var headerClicked = e.OriginalSource as GridViewColumnHeader;
|
||||
|
||||
if (headerClicked != null)
|
||||
{
|
||||
if (headerClicked.Role != GridViewColumnHeaderRole.Padding)
|
||||
{
|
||||
ListSortDirection direction;
|
||||
if (headerClicked != lastHeaderClicked)
|
||||
{
|
||||
direction = ListSortDirection.Ascending;
|
||||
}
|
||||
else
|
||||
{
|
||||
direction = lastDirection == ListSortDirection.Ascending ? ListSortDirection.Descending : ListSortDirection.Ascending;
|
||||
}
|
||||
|
||||
var columnBinding = headerClicked.Column.DisplayMemberBinding as Binding;
|
||||
var sortBy = columnBinding?.Path.Path ?? headerClicked.Column.Header as string;
|
||||
|
||||
Sort(sortBy, direction);
|
||||
|
||||
if (direction == ListSortDirection.Ascending)
|
||||
{
|
||||
headerClicked.Column.HeaderTemplate =
|
||||
Resources["HeaderTemplateArrowUp"] as DataTemplate;
|
||||
}
|
||||
else
|
||||
{
|
||||
headerClicked.Column.HeaderTemplate =
|
||||
Resources["HeaderTemplateArrowDown"] as DataTemplate;
|
||||
}
|
||||
|
||||
// Remove arrow from previously sorted header
|
||||
if (lastHeaderClicked != null && lastHeaderClicked != headerClicked)
|
||||
{
|
||||
lastHeaderClicked.Column.HeaderTemplate = null;
|
||||
}
|
||||
|
||||
lastHeaderClicked = headerClicked;
|
||||
lastDirection = direction;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void Sort(string sortBy, ListSortDirection direction)
|
||||
{
|
||||
ICollectionView dataView = CollectionViewSource.GetDefaultView(FoundResultListView.ItemsSource);
|
||||
|
||||
dataView.SortDescriptions.Clear();
|
||||
SortDescription sd = new SortDescription(sortBy, direction);
|
||||
dataView.SortDescriptions.Add(sd);
|
||||
dataView.Refresh();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
protected virtual void OnShowLogEvent(LogMessage e)
|
||||
{
|
||||
ShowLogEvent?.Invoke(this, e);
|
||||
}
|
||||
|
||||
private void ShowMessageInMainWindowClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
OnShowLogEvent((LogMessage)FoundResultListView.SelectedItem);
|
||||
}
|
||||
|
||||
private void ListViewItem_MouseDoubleClick(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
if (sender is ListViewItem item && item.Content is LogMessage logMessage)
|
||||
{
|
||||
OnShowLogEvent(logMessage);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,111 @@
|
||||
<!--
|
||||
SelectTimeIntervalDialog.xaml
|
||||
12/4/2023
|
||||
|
||||
RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
|
||||
PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
|
||||
AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
|
||||
UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
|
||||
RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
|
||||
CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
|
||||
OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
|
||||
COMPANY.
|
||||
|
||||
THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. GOVERNMENT
|
||||
|
||||
UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
|
||||
WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE
|
||||
EXPORT OR DISCLOSURE TO NON-U.S. PERSONS, WHEREVER LOCATED, IS RESTRICTED
|
||||
BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R. SECTION
|
||||
120-130) OR THE EXPORT ADMINISTRATION REGULATIONS (EAR) (15 C.F.R. SECTION
|
||||
730-774). THIS DOCUMENT CANNOT BE EXPORTED (E.G., PROVIDED TO A SUPPLIER
|
||||
OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S. PERSON, WHEREVER
|
||||
LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS
|
||||
BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S. GOVERNMENT
|
||||
APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL
|
||||
PENALTIES.
|
||||
|
||||
DOD 5220.22-M, INDUSTRIAL SECURITY MANUAL, CHAPTER 5, SECTION 1 THROUGH 9 :
|
||||
FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN OR DOD 5200.1-R,
|
||||
INFORMATION SECURITY PROGRAM, CHAPTER 6. FOR UNCLASSIFIED, LIMITED DOCUMENTS
|
||||
DESTROY BY ANY METHOD THAT WILL PREVENT DISCLOSURE OF CONTENTS OR
|
||||
RECONSTRUCTION OF THE DOCUMENT.
|
||||
POC: Alex Kravchenko (1118268)
|
||||
-->
|
||||
<mah:MetroWindow x:Class="Raytheon.LogDashboard.View.SelectTimeIntervalDialog"
|
||||
xmlns:mah="http://metro.mahapps.com/winfx/xaml/controls"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
mc:Ignorable="d"
|
||||
Title="Select Time Interval"
|
||||
DataContext="{Binding SelectTimeInterval, Source={StaticResource LogDashLocator}}"
|
||||
WindowTitleBrush="{Binding LogDashboard.SelectedColorTheme.Color, Source={StaticResource LogDashLocator}}"
|
||||
MinHeight="350"
|
||||
Height="350"
|
||||
Width="500">
|
||||
|
||||
<mah:MetroWindow.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="../Styles/Styles.xaml"/>
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
</mah:MetroWindow.Resources>
|
||||
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<TextBlock HorizontalAlignment="Center"
|
||||
FontWeight="Bold"
|
||||
Text="Pick Date and Time From:"/>
|
||||
|
||||
<mah:TimePicker Grid.Column="1"
|
||||
Margin="20"
|
||||
FontSize="14"
|
||||
Height="40"
|
||||
Width="160"
|
||||
FontWeight="Bold"
|
||||
SelectedDateTime="{Binding SelectedDateTimeFrom}" />
|
||||
|
||||
<TextBlock Grid.Row="1"
|
||||
HorizontalAlignment="Center"
|
||||
FontWeight="Bold"
|
||||
Text="Pick Date and Time To:"/>
|
||||
|
||||
<mah:TimePicker Grid.Row="1" Grid.Column="2"
|
||||
Margin="20"
|
||||
Height="40"
|
||||
Width="160"
|
||||
FontSize="14"
|
||||
FontWeight="Bold"
|
||||
SelectedDateTime="{Binding SelectedDateTimeTo}" />
|
||||
|
||||
<WrapPanel Grid.Row="3" Grid.ColumnSpan="2" HorizontalAlignment="Right" Margin="10">
|
||||
<Button Click="OkButtonClick"
|
||||
IsDefault="True"
|
||||
MinWidth="100"
|
||||
Height="30"
|
||||
Margin="10"
|
||||
Content="OK"
|
||||
Background="{Binding LogDashboard.SelectedColorTheme.Color, Source={StaticResource LogDashLocator}}"
|
||||
/>
|
||||
<Button IsCancel="True"
|
||||
MinWidth="100"
|
||||
Margin="10"
|
||||
Content="Cancel"
|
||||
Background="{Binding LogDashboard.SelectedColorTheme.Color, Source={StaticResource LogDashLocator}}"
|
||||
/>
|
||||
</WrapPanel>
|
||||
</Grid>
|
||||
</mah:MetroWindow>
|
||||
@@ -0,0 +1,66 @@
|
||||
//******************************************************************************//
|
||||
// SelectTimeIntervalDialog.xaml.cs
|
||||
// 12/4/2023
|
||||
//
|
||||
// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
|
||||
// PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
|
||||
// AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
|
||||
// UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
|
||||
// RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
|
||||
// CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
|
||||
// OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
|
||||
// COMPANY.
|
||||
//
|
||||
// THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. GOVERNMENT
|
||||
//
|
||||
// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
//
|
||||
// WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE
|
||||
// EXPORT OR DISCLOSURE TO NON-U.S. PERSONS, WHEREVER LOCATED, IS RESTRICTED
|
||||
// BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R. SECTION
|
||||
// 120-130) OR THE EXPORT ADMINISTRATION REGULATIONS (EAR) (15 C.F.R. SECTION
|
||||
// 730-774). THIS DOCUMENT CANNOT BE EXPORTED (E.G., PROVIDED TO A SUPPLIER
|
||||
// OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S. PERSON, WHEREVER
|
||||
// LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS
|
||||
// BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S. GOVERNMENT
|
||||
// APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL
|
||||
// PENALTIES.
|
||||
//
|
||||
// DOD 5220.22-M, INDUSTRIAL SECURITY MANUAL, CHAPTER 5, SECTION 1 THROUGH 9 :
|
||||
// FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN OR DOD 5200.1-R,
|
||||
// INFORMATION SECURITY PROGRAM, CHAPTER 6. FOR UNCLASSIFIED, LIMITED DOCUMENTS
|
||||
// DESTROY BY ANY METHOD THAT WILL PREVENT DISCLOSURE OF CONTENTS OR
|
||||
// RECONSTRUCTION OF THE DOCUMENT.
|
||||
// POC: Alex Kravchenko (1118268)
|
||||
//******************************************************************************//
|
||||
using System;
|
||||
using System.Windows;
|
||||
using Raytheon.LogDashboard.ViewModel;
|
||||
|
||||
namespace Raytheon.LogDashboard.View
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for SelectTimeIntervalDialog.xaml
|
||||
/// </summary>
|
||||
public partial class SelectTimeIntervalDialog
|
||||
{
|
||||
public SelectTimeIntervalDialog(DateTime? currentLogDateTime)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
var dataContext = new SelectTimeIntervalViewModel();
|
||||
if (currentLogDateTime.HasValue)
|
||||
{
|
||||
dataContext.SetSelectTimeInterval(currentLogDateTime.Value);
|
||||
}
|
||||
|
||||
DataContext = dataContext;
|
||||
|
||||
}
|
||||
|
||||
private void OkButtonClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
DialogResult = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
<!--
|
||||
SelectTimestampDialog.xaml
|
||||
12/4/2023
|
||||
|
||||
RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
|
||||
PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
|
||||
AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
|
||||
UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
|
||||
RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
|
||||
CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
|
||||
OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
|
||||
COMPANY.
|
||||
|
||||
THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. GOVERNMENT
|
||||
|
||||
UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
|
||||
WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE
|
||||
EXPORT OR DISCLOSURE TO NON-U.S. PERSONS, WHEREVER LOCATED, IS RESTRICTED
|
||||
BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R. SECTION
|
||||
120-130) OR THE EXPORT ADMINISTRATION REGULATIONS (EAR) (15 C.F.R. SECTION
|
||||
730-774). THIS DOCUMENT CANNOT BE EXPORTED (E.G., PROVIDED TO A SUPPLIER
|
||||
OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S. PERSON, WHEREVER
|
||||
LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS
|
||||
BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S. GOVERNMENT
|
||||
APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL
|
||||
PENALTIES.
|
||||
|
||||
DOD 5220.22-M, INDUSTRIAL SECURITY MANUAL, CHAPTER 5, SECTION 1 THROUGH 9 :
|
||||
FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN OR DOD 5200.1-R,
|
||||
INFORMATION SECURITY PROGRAM, CHAPTER 6. FOR UNCLASSIFIED, LIMITED DOCUMENTS
|
||||
DESTROY BY ANY METHOD THAT WILL PREVENT DISCLOSURE OF CONTENTS OR
|
||||
RECONSTRUCTION OF THE DOCUMENT.
|
||||
POC: Alex Kravchenko (1118268)
|
||||
-->
|
||||
<mah:MetroWindow x:Class="Raytheon.LogDashboard.View.SelectTimestampDialog"
|
||||
xmlns:mah="http://metro.mahapps.com/winfx/xaml/controls"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
mc:Ignorable="d"
|
||||
Title="Go to Timestamp"
|
||||
DataContext="{Binding SelectTimeInterval, Source={StaticResource LogDashLocator}}"
|
||||
WindowTitleBrush="{Binding LogDashboard.SelectedColorTheme.Color, Source={StaticResource LogDashLocator}}"
|
||||
MinHeight="350"
|
||||
Height="350"
|
||||
Width="500">
|
||||
|
||||
<mah:MetroWindow.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="../Styles/Styles.xaml"/>
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
</mah:MetroWindow.Resources>
|
||||
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<TextBlock FontWeight="Bold"
|
||||
Text="Pick Date and Time:"></TextBlock>
|
||||
|
||||
<mah:TimePicker Grid.Column="1"
|
||||
Margin="10"
|
||||
Height="40"
|
||||
Width="160"
|
||||
FontSize="14"
|
||||
FontWeight="Bold"
|
||||
SelectedDateTime="{Binding SelectedDateTimeFrom}" />
|
||||
|
||||
<WrapPanel Grid.Row="2" Grid.ColumnSpan="2" HorizontalAlignment="Right" Margin="10">
|
||||
<Button Click="OkButtonClick"
|
||||
IsDefault="True"
|
||||
MinWidth="100"
|
||||
Height="30"
|
||||
Margin="0,0,10,0"
|
||||
Content="OK"
|
||||
Background="{Binding LogDashboard.SelectedColorTheme.Color, Source={StaticResource LogDashLocator}}"/>
|
||||
|
||||
<Button IsCancel="True"
|
||||
MinWidth="100"
|
||||
Content="Cancel"
|
||||
Background="{Binding LogDashboard.SelectedColorTheme.Color, Source={StaticResource LogDashLocator}}"/>
|
||||
</WrapPanel>
|
||||
</Grid>
|
||||
</mah:MetroWindow>
|
||||
@@ -0,0 +1,63 @@
|
||||
//******************************************************************************//
|
||||
// SelectTimestampDialog.xaml.cs
|
||||
// 12/4/2023
|
||||
//
|
||||
// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
|
||||
// PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
|
||||
// AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
|
||||
// UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
|
||||
// RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
|
||||
// CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
|
||||
// OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
|
||||
// COMPANY.
|
||||
//
|
||||
// THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. GOVERNMENT
|
||||
//
|
||||
// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
//
|
||||
// WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE
|
||||
// EXPORT OR DISCLOSURE TO NON-U.S. PERSONS, WHEREVER LOCATED, IS RESTRICTED
|
||||
// BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R. SECTION
|
||||
// 120-130) OR THE EXPORT ADMINISTRATION REGULATIONS (EAR) (15 C.F.R. SECTION
|
||||
// 730-774). THIS DOCUMENT CANNOT BE EXPORTED (E.G., PROVIDED TO A SUPPLIER
|
||||
// OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S. PERSON, WHEREVER
|
||||
// LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS
|
||||
// BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S. GOVERNMENT
|
||||
// APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL
|
||||
// PENALTIES.
|
||||
//
|
||||
// DOD 5220.22-M, INDUSTRIAL SECURITY MANUAL, CHAPTER 5, SECTION 1 THROUGH 9 :
|
||||
// FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN OR DOD 5200.1-R,
|
||||
// INFORMATION SECURITY PROGRAM, CHAPTER 6. FOR UNCLASSIFIED, LIMITED DOCUMENTS
|
||||
// DESTROY BY ANY METHOD THAT WILL PREVENT DISCLOSURE OF CONTENTS OR
|
||||
// RECONSTRUCTION OF THE DOCUMENT.
|
||||
// POC: Alex Kravchenko (1118268)
|
||||
//******************************************************************************//
|
||||
using System;
|
||||
using System.Windows;
|
||||
using Raytheon.LogDashboard.ViewModel;
|
||||
|
||||
namespace Raytheon.LogDashboard.View
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for SelectTimestampDialog.xaml
|
||||
/// </summary>
|
||||
public partial class SelectTimestampDialog
|
||||
{
|
||||
public SelectTimestampDialog(DateTime? currentLogDateTime)
|
||||
{
|
||||
InitializeComponent();
|
||||
var dataContext = new SelectTimeIntervalViewModel();
|
||||
if (currentLogDateTime.HasValue)
|
||||
{
|
||||
dataContext.SetSelectTimeInterval(currentLogDateTime.Value);
|
||||
}
|
||||
|
||||
DataContext = dataContext;
|
||||
}
|
||||
private void OkButtonClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
DialogResult = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
505
Source/LogDashboard/LogDashboard/View/SettingsCtrl.xaml
Normal file
505
Source/LogDashboard/LogDashboard/View/SettingsCtrl.xaml
Normal file
@@ -0,0 +1,505 @@
|
||||
<!--
|
||||
SettingsCtrl.xaml
|
||||
12/4/2023
|
||||
|
||||
RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
|
||||
PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
|
||||
AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
|
||||
UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
|
||||
RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
|
||||
CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
|
||||
OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
|
||||
COMPANY.
|
||||
|
||||
THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. GOVERNMENT
|
||||
|
||||
UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
|
||||
WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE
|
||||
EXPORT OR DISCLOSURE TO NON-U.S. PERSONS, WHEREVER LOCATED, IS RESTRICTED
|
||||
BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R. SECTION
|
||||
120-130) OR THE EXPORT ADMINISTRATION REGULATIONS (EAR) (15 C.F.R. SECTION
|
||||
730-774). THIS DOCUMENT CANNOT BE EXPORTED (E.G., PROVIDED TO A SUPPLIER
|
||||
OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S. PERSON, WHEREVER
|
||||
LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS
|
||||
BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S. GOVERNMENT
|
||||
APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL
|
||||
PENALTIES.
|
||||
|
||||
DOD 5220.22-M, INDUSTRIAL SECURITY MANUAL, CHAPTER 5, SECTION 1 THROUGH 9 :
|
||||
FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN OR DOD 5200.1-R,
|
||||
INFORMATION SECURITY PROGRAM, CHAPTER 6. FOR UNCLASSIFIED, LIMITED DOCUMENTS
|
||||
DESTROY BY ANY METHOD THAT WILL PREVENT DISCLOSURE OF CONTENTS OR
|
||||
RECONSTRUCTION OF THE DOCUMENT.
|
||||
POC: Alex Kravchenko (1118268)
|
||||
-->
|
||||
<mah:MetroContentControl x:Class="Raytheon.LogDashboard.View.SettingsCtrl"
|
||||
xmlns:mah="http://metro.mahapps.com/winfx/xaml/controls"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:val="clr-namespace:Raytheon.LogDashboard.Validators"
|
||||
xmlns:ext="clr-namespace:Raytheon.LogDashboard.Helpers"
|
||||
xmlns:mod="clr-namespace:Raytheon.LogDashboard.Model"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="800" d:DesignWidth="800">
|
||||
|
||||
|
||||
<mah:MetroContentControl.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="../Styles/Styles.xaml"/>
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
</mah:MetroContentControl.Resources>
|
||||
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition/>
|
||||
<RowDefinition Height="50"/>
|
||||
</Grid.RowDefinitions>
|
||||
<TabControl BorderThickness="0">
|
||||
<TabItem Header="General" Height="45" Width="120">
|
||||
<GroupBox FontSize="16">
|
||||
<GroupBox.HeaderTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="General Settings" FontSize="16" />
|
||||
</DataTemplate>
|
||||
</GroupBox.HeaderTemplate>
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="265"/>
|
||||
<ColumnDefinition/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<TextBlock Text="Auto start reading logs at startup:"
|
||||
ToolTip="Start read logs immediately when application startup" VerticalAlignment="Center"
|
||||
Visibility="{Binding Path=EmbeddedMode, Converter={StaticResource BooleanToVisibilityConverter}}"
|
||||
/>
|
||||
<mah:ToggleSwitch Grid.Row="0" Grid.Column="1" IsOn="{Binding Path=IsAutoStartReadAtStartup}"
|
||||
Style="{DynamicResource MetroCircleToggleButtonStyle}"
|
||||
Visibility="{Binding Path=EmbeddedMode, Converter={StaticResource BooleanToVisibilityConverter}}"
|
||||
VerticalAlignment="Center" HorizontalAlignment="Left" Margin="0,5,0,0"/>
|
||||
|
||||
<TextBlock Text="Minimize to Tray Icon:"
|
||||
Visibility="{Binding Path=EmbeddedMode, Converter={StaticResource BooleanToVisibilityConverter}}"
|
||||
ToolTip="Shows a tray icon when LogDashboard is minimized" VerticalAlignment="Center"
|
||||
Grid.Row="1"/>
|
||||
<mah:ToggleSwitch Grid.Row="1" Grid.Column="1"
|
||||
Visibility="{Binding Path=EmbeddedMode, Converter={StaticResource BooleanToVisibilityConverter}}"
|
||||
IsOn="{Binding Path=MinimizeToTray}"
|
||||
VerticalAlignment="Center"
|
||||
HorizontalAlignment="Left" Margin="0,5,0,0"/>
|
||||
|
||||
<TextBlock Text="Only one instance of application:" ToolTip="Only one instance of LogDashboard running in the system"
|
||||
VerticalAlignment="Center" Grid.Row="2"/>
|
||||
<mah:ToggleSwitch Grid.Row="2" Grid.Column="1" IsOn="{Binding Path=OnlyOneAppInstance}" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="0,5,0,0"/>
|
||||
|
||||
<TextBlock Text="Show data source column:" ToolTip="Show data source column in log table. Displays where this message came from (file or IP)" VerticalAlignment="Center" Grid.Row="3"/>
|
||||
|
||||
<mah:ToggleSwitch
|
||||
Grid.Row="3"
|
||||
Grid.Column="1"
|
||||
IsOn="{Binding Path=IsShowSourceColumn}"
|
||||
VerticalAlignment="Center" HorizontalAlignment="Left" Margin="0,5,0,0"/>
|
||||
|
||||
<TextBlock Text="Show thread # column:" ToolTip="Show thread number column in log table" VerticalAlignment="Center" Grid.Row="4"/>
|
||||
<mah:ToggleSwitch
|
||||
Grid.Row="4" Grid.Column="1"
|
||||
IsOn="{Binding Path=IsShowThreadColumn}"
|
||||
VerticalAlignment="Center"
|
||||
HorizontalAlignment="Left" Margin="0,5,0,0"/>
|
||||
|
||||
<TextBlock Grid.Row="6" Text="Max message buffer size:" VerticalAlignment="Center" ToolTip="Maximum count of log messages that can be stored in buffer"/>
|
||||
<StackPanel Orientation="Horizontal" Grid.Row="6" Grid.Column="1">
|
||||
<TextBox Width="100" Margin="0,0,10,0"
|
||||
FontSize="14"
|
||||
HorizontalContentAlignment="Left"
|
||||
Text="{Binding Path=MaxMessageBufferSize, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" IsEnabled="{Binding Path=IsEnableMaxMessageBufferSize}"/>
|
||||
<mah:ToggleSwitch IsOn="{Binding Path=IsEnableMaxMessageBufferSize}" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="0,5,0,0"/>
|
||||
</StackPanel>
|
||||
|
||||
<TextBlock Grid.Row="7" Text="Count of Deleted Messages" VerticalAlignment="Center"
|
||||
ToolTip="Count of messages to be deleted if buffer is overflow"
|
||||
IsEnabled="{Binding Path=IsEnableMaxMessageBufferSize}"/>
|
||||
<TextBox Grid.Row="7"
|
||||
Grid.Column="1" Width="100"
|
||||
FontSize="14"
|
||||
HorizontalAlignment="Left"
|
||||
HorizontalContentAlignment="Left"
|
||||
Text="{Binding Path=DeletedMessagesCount, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
|
||||
IsEnabled="{Binding Path=IsEnableMaxMessageBufferSize}"/>
|
||||
|
||||
<TextBlock Grid.Row="8" Text="Displayed date format:" ToolTip="Displayed date format" VerticalAlignment="Center"/>
|
||||
<ComboBox Grid.Row="8" Grid.Column="1"
|
||||
Margin="0,5"
|
||||
FontSize="14"
|
||||
ItemsSource="{Binding Path=DataFormats}"
|
||||
SelectedItem="{Binding Path=SelectedDataFormat}"
|
||||
Width="210"
|
||||
HorizontalAlignment="Left"
|
||||
ToolTip="{Binding Path=ExampleDateTime}"/>
|
||||
|
||||
<TextBlock Grid.Row="9" Text="Color Theme:" ToolTip="Application Color" VerticalAlignment="Center"
|
||||
Visibility="{Binding Path=EmbeddedMode, Converter={StaticResource BooleanToVisibilityConverter}}"/>
|
||||
<ComboBox Grid.Row="9" Grid.Column="1"
|
||||
Visibility="{Binding Path=EmbeddedMode, Converter={StaticResource BooleanToVisibilityConverter}}"
|
||||
FontSize="14"
|
||||
Margin="0,5"
|
||||
Height="28"
|
||||
ItemsSource="{Binding Path=ColorThemes}"
|
||||
SelectedIndex="{Binding Path=SelectedColorIndex}"
|
||||
Width="210"
|
||||
HorizontalAlignment="Left">
|
||||
|
||||
<ComboBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Viewbox>
|
||||
<TextBlock Text="{Binding Name}"
|
||||
Width="210"
|
||||
Background="{Binding Color}"
|
||||
Height="20"
|
||||
HorizontalAlignment="Stretch" />
|
||||
</Viewbox>
|
||||
</DataTemplate>
|
||||
</ComboBox.ItemTemplate>
|
||||
</ComboBox>
|
||||
<TextBlock Grid.Row="10" Text="Theme:" ToolTip="Application Theme" VerticalAlignment="Center"
|
||||
Visibility="{Binding Path=EmbeddedMode, Converter={StaticResource BooleanToVisibilityConverter}}"/>
|
||||
<ComboBox Grid.Row="10" Grid.Column="1"
|
||||
Visibility="{Binding Path=EmbeddedMode, Converter={StaticResource BooleanToVisibilityConverter}}"
|
||||
FontSize="14"
|
||||
Margin="0,5"
|
||||
ItemsSource="{Binding Path=Themes}"
|
||||
SelectedItem="{Binding Path=SelectedTheme}"
|
||||
Width="210"
|
||||
HorizontalAlignment="Left">
|
||||
</ComboBox>
|
||||
|
||||
<TextBlock Grid.Row="12" Text="Highlight messages by receiver color:" ToolTip="Highlight messages by receiver color" VerticalAlignment="Center" />
|
||||
<mah:ToggleSwitch Grid.Row="12" Grid.Column="1" IsOn="{Binding Path=ShowMessageHighlightByReceiverColor}" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="0,5,0,0"/>
|
||||
|
||||
<TextBlock Grid.Row="13" Text="Separate UDP Loggers by ports:" ToolTip="Separate UDP loggers by ports" VerticalAlignment="Center" />
|
||||
<mah:ToggleSwitch Grid.Row="13" Grid.Column="1" IsOn="{Binding Path=IsSeparateIPLoggersByPort}" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="0,5,0,0"/>
|
||||
|
||||
<TextBlock Grid.Row="14" Text="AutoSave participating receivers:" VerticalAlignment="Center" />
|
||||
<mah:ToggleSwitch Grid.Row="14" Grid.Column="1"
|
||||
Margin="0,5,0,0"
|
||||
IsOn="{Binding Path=IsAutoSave}"
|
||||
Style="{DynamicResource MetroCircleToggleButtonStyle}"
|
||||
VerticalAlignment="Center"
|
||||
HorizontalAlignment="Left"/>
|
||||
|
||||
<TextBlock Grid.Row="15"
|
||||
Visibility="{Binding Path=IsAutoSave, Converter={StaticResource BooleanToVisibilityConverter}}"
|
||||
Text="Use ErrorLogger Location"
|
||||
ToolTip="Track location from the ErrorLogger configuration default location."
|
||||
VerticalAlignment="Center" />
|
||||
<mah:ToggleSwitch Grid.Row="15" Grid.Column="1"
|
||||
Visibility="{Binding Path=IsAutoSave, Converter={StaticResource BooleanToVisibilityConverter}}"
|
||||
IsOn="{Binding Path=IsErrorLogger}"
|
||||
VerticalAlignment="Center"
|
||||
HorizontalAlignment="Left" Margin="0,5,0,0"/>
|
||||
|
||||
<TextBlock Grid.Row="16" Text="Custom AutoSave Location"
|
||||
Visibility="{Binding Path=IsAutoSaveEnabled, Converter={StaticResource BooleanToVisibilityConverter}}"
|
||||
VerticalAlignment="Center" />
|
||||
|
||||
<StackPanel Grid.Row="16" Grid.Column="1"
|
||||
Orientation="Horizontal"
|
||||
Visibility="{Binding Path=IsAutoSaveEnabled, Converter={StaticResource BooleanToVisibilityConverter}}"
|
||||
>
|
||||
<TextBox
|
||||
Margin="0,10"
|
||||
MinWidth="200"
|
||||
Text="{Binding Path=AutoSaveLocation, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
|
||||
ToolTip="Please populate with the destination folder or destination folder with the base file name. Use yyyy-mm-dd or yyyy-mm in the path for separating log files by date." />
|
||||
|
||||
<Button Content="Browse"
|
||||
Margin="5"
|
||||
HorizontalAlignment="Right"
|
||||
Background="{Binding DataContext.IconColor, RelativeSource={RelativeSource AncestorType=mah:MetroWindow}}"
|
||||
Command="{Binding Path=BrowseLocationCommand}"
|
||||
/>
|
||||
|
||||
</StackPanel>
|
||||
|
||||
|
||||
</Grid>
|
||||
</GroupBox>
|
||||
</TabItem>
|
||||
<TabItem Header="Receivers"
|
||||
Height="45"
|
||||
Width="120">
|
||||
<GroupBox FontSize="16">
|
||||
<GroupBox.HeaderTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="List of Receivers" FontSize="16"/>
|
||||
</DataTemplate>
|
||||
</GroupBox.HeaderTemplate>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="45"/>
|
||||
<RowDefinition/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="220"/>
|
||||
<ColumnDefinition/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<Border Grid.RowSpan="2"/>
|
||||
|
||||
<Button Background="{Binding IconColor}"
|
||||
Width="100"
|
||||
HorizontalAlignment="Left"
|
||||
BorderThickness="1"
|
||||
Content="Add" Margin="5"
|
||||
Command="{Binding Path=AddReceiverCommand}"
|
||||
Style="{StaticResource AddButtonStyle}"/>
|
||||
|
||||
<Button Background="{Binding IconColor}"
|
||||
x:Name="RemoveButton" Width="100"
|
||||
HorizontalAlignment="Right"
|
||||
BorderThickness="1"
|
||||
Content="Remove"
|
||||
Margin="5"
|
||||
Command="{Binding Path=RemoveReceiverCommand}"
|
||||
Style="{StaticResource RemoveButtonStyle}"/>
|
||||
|
||||
<ListBox HorizontalContentAlignment="Stretch"
|
||||
Grid.Row="1" Grid.Column="0" Margin="5"
|
||||
ItemsSource="{Binding Path=Receivers}"
|
||||
SelectedItem="{Binding Path=SelectedReceiver}">
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Grid x:Name="ListItemGrid">
|
||||
<TextBlock Text="{Binding Path=Name, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Width="Auto"/>
|
||||
<CheckBox IsChecked="{Binding Path=IsActive, Mode=TwoWay}" ToolTip="Is Active" HorizontalAlignment="Right"/>
|
||||
</Grid>
|
||||
<DataTemplate.Triggers>
|
||||
<DataTrigger Binding="{Binding Path=IsActive}" Value="False">
|
||||
<Setter Property="ListBoxItem.Opacity" Value=".5"/>
|
||||
</DataTrigger>
|
||||
</DataTemplate.Triggers>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
|
||||
<Border Grid.Column="1" Grid.RowSpan="2" Margin="5,0,0,0"/>
|
||||
|
||||
<StackPanel Orientation="Vertical"
|
||||
Grid.RowSpan="2"
|
||||
Grid.Column="1" Margin="10,5,10,5"
|
||||
Visibility="{Binding Path=IsConfigurationVisible, Converter={StaticResource BooleanToVisibilityConverter}}">
|
||||
<TextBlock Text="" FontWeight="Bold"/>
|
||||
<Grid Margin="0,5,0,0">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="120"/>
|
||||
<ColumnDefinition/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<TextBlock Grid.Row="0" Text="Receiver Type" VerticalAlignment="Center" />
|
||||
<ComboBox Grid.Column="1"
|
||||
Margin="0,10"
|
||||
ItemsSource="{Binding Source={ext:Enumeration {x:Type mod:ReceiverType}}}"
|
||||
DisplayMemberPath="Description"
|
||||
SelectedValue="{Binding SelectedReceiver.ReceiverType}"
|
||||
SelectedValuePath="Value"
|
||||
/>
|
||||
|
||||
<TextBlock Grid.Row="1" Text="Receiver Type" VerticalAlignment="Center"
|
||||
Visibility="{Binding Path=SelectedReceiver.IsErrorLogger, Converter={StaticResource BooleanToVisibilityConverter}}"
|
||||
/>
|
||||
<ComboBox Grid.Row="1" Grid.Column="1"
|
||||
Visibility="{Binding Path=SelectedReceiver.IsErrorLogger, Converter={StaticResource BooleanToVisibilityConverter}}"
|
||||
Margin="0,10"
|
||||
ItemsSource="{Binding Source={ext:Enumeration {x:Type mod:ErrorLoggerType}}}"
|
||||
DisplayMemberPath="Description"
|
||||
SelectedValue="{Binding SelectedReceiver.ErrorLoggerType}"
|
||||
SelectedValuePath="Value"
|
||||
/>
|
||||
|
||||
<TextBlock Grid.Row="2" Text="Receiver Name" VerticalAlignment="Center" />
|
||||
<TextBox Grid.Row="2" Grid.Column="1" Margin="0,10"
|
||||
Text="{Binding Path=SelectedReceiver.Name, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
|
||||
|
||||
<TextBlock Grid.Row="3"
|
||||
Text="Port Number" VerticalAlignment="Center"
|
||||
Visibility="{Binding Path=SelectedReceiver.IsPortVisible, Converter={StaticResource BooleanToVisibilityConverter}}"/>
|
||||
<TextBox Grid.Row="3" Grid.Column="1"
|
||||
Margin="0,10"
|
||||
Visibility="{Binding Path=SelectedReceiver.IsPortVisible, Converter={StaticResource BooleanToVisibilityConverter}}" >
|
||||
<TextBox.Text>
|
||||
<Binding Path="SelectedReceiver.Port" Mode="TwoWay" UpdateSourceTrigger="PropertyChanged">
|
||||
<Binding.ValidationRules>
|
||||
<val:PortNumberValidation ValidatesOnTargetUpdated="True"/>
|
||||
</Binding.ValidationRules>
|
||||
</Binding>
|
||||
</TextBox.Text>
|
||||
</TextBox>
|
||||
|
||||
<TextBlock Grid.Row="4" Text="Address" VerticalAlignment="Center"
|
||||
Visibility="{Binding Path=SelectedReceiver.IsAddressVisible, Converter={StaticResource BooleanToVisibilityConverter}}"/>
|
||||
<TextBox Grid.Row="4" Grid.Column="1"
|
||||
Margin="0,10"
|
||||
Visibility="{Binding Path=SelectedReceiver.IsAddressVisible, Converter={StaticResource BooleanToVisibilityConverter}}"
|
||||
Text="{Binding Path=SelectedReceiver.Address, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
|
||||
|
||||
<TextBlock Grid.Row="5" Text="AutoSave Mode" VerticalAlignment="Center" />
|
||||
<mah:ToggleSwitch Grid.Row="5" Grid.Column="1"
|
||||
Margin="0,10"
|
||||
IsEnabled="{Binding IsAutoSave}"
|
||||
IsOn="{Binding Path=SelectedReceiver.IsAutoSave, Mode=TwoWay}"
|
||||
Style="{DynamicResource MetroCircleToggleButtonStyle}"
|
||||
VerticalAlignment="Center" HorizontalAlignment="Left"/>
|
||||
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</GroupBox>
|
||||
</TabItem>
|
||||
<TabItem Header="Ignored" Height="45" Width="120">
|
||||
<GroupBox FontSize="16">
|
||||
<GroupBox.HeaderTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="Ignored IP Addresses" FontSize="16" />
|
||||
</DataTemplate>
|
||||
</GroupBox.HeaderTemplate>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="45"/>
|
||||
<RowDefinition Height="45"/>
|
||||
<RowDefinition/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Button Grid.Row="0"
|
||||
Background="{Binding DataContext.IconColor, RelativeSource={RelativeSource AncestorType=mah:MetroWindow}}"
|
||||
Style="{StaticResource AddIgnoreIpButtonStyle}"/>
|
||||
<Button Grid.Row="0"
|
||||
Background="{Binding DataContext.IconColor, RelativeSource={RelativeSource AncestorType=mah:MetroWindow}}"
|
||||
Style="{StaticResource RemoveIgnoreIpButtonStyle}"/>
|
||||
|
||||
<TextBox Grid.Row="1" Style="{StaticResource IPTextBoxStyle}" x:Name="IPAddress">
|
||||
<TextBox.Text>
|
||||
<Binding NotifyOnValidationError="True" Path="TypedIP" Mode="TwoWay" UpdateSourceTrigger="PropertyChanged">
|
||||
<Binding.ValidationRules>
|
||||
<val:IPValidation ValidatesOnTargetUpdated="True"/>
|
||||
</Binding.ValidationRules>
|
||||
</Binding>
|
||||
</TextBox.Text>
|
||||
</TextBox>
|
||||
<Border Grid.RowSpan="3"/>
|
||||
|
||||
<ListBox Grid.Row="2" Grid.Column="0" Margin="5,20,5,5"
|
||||
ItemsSource="{Binding Path=IgnoredIPAddresses}"
|
||||
SelectedItem="{Binding Path=SelectedIP}">
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Grid x:Name="ListItemGrid">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="115"/>
|
||||
<ColumnDefinition/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Grid.Column="0" Text="{Binding Path=IP, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Width="Auto"/>
|
||||
<CheckBox VerticalAlignment="Bottom" Grid.Column="1"
|
||||
IsChecked="{Binding Path=IsActive, Mode=TwoWay}"
|
||||
ToolTip="Is Active" HorizontalAlignment="Right"/>
|
||||
</Grid>
|
||||
<DataTemplate.Triggers>
|
||||
<DataTrigger Binding="{Binding Path=IsActive}" Value="False">
|
||||
<Setter Property="ListBoxItem.Opacity" Value="0.5"/>
|
||||
</DataTrigger>
|
||||
</DataTemplate.Triggers>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
</Grid>
|
||||
</GroupBox>
|
||||
</TabItem>
|
||||
<TabItem Header="About" Width="100" Height="45">
|
||||
<GroupBox FontSize="16">
|
||||
<GroupBox.HeaderTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="About" FontSize="16"/>
|
||||
</DataTemplate>
|
||||
</GroupBox.HeaderTemplate>
|
||||
|
||||
<StackPanel Orientation="Vertical">
|
||||
<TextBlock HorizontalAlignment="Center" Text="Log Dashboard"/>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="Version: " FontWeight="Bold"/>
|
||||
<TextBlock Text="{Binding Path=Version}"/>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock VerticalAlignment="Center" Text="Author: " FontWeight="Bold"/>
|
||||
<TextBlock VerticalAlignment="Center" Text="Alex Kravchenko (Common Platforms)"/>
|
||||
</StackPanel>
|
||||
<TextBlock Text="LogDashboard Features" HorizontalAlignment="Left"/>
|
||||
<Border BorderThickness="1" Margin="0,5" Padding="10">
|
||||
<StackPanel Orientation="Vertical">
|
||||
<TextBlock Text="- Reads log files via log4j template, standard NLog format" HorizontalAlignment="Left"/>
|
||||
<TextBlock Text="- Reads Error Logger messages via Mail Slots" HorizontalAlignment="Left"/>
|
||||
<TextBlock Text="- Reads Windows Debug messages" HorizontalAlignment="Left"/>
|
||||
<TextBlock Text="- Export and import log files" HorizontalAlignment="Left"/>
|
||||
<TextBlock Text="- Sorting and filtering received logs" HorizontalAlignment="Left"/>
|
||||
<TextBlock Text="- Other features (for details see ReleaseNotes)." HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
<Button Content="Show Release Notes"
|
||||
Background="{Binding DataContext.IconColor, RelativeSource={RelativeSource AncestorType=mah:MetroWindow}}"
|
||||
Command="{Binding Path=ShowReleaseNotesCommand}" Height="35" Width="200"/>
|
||||
</StackPanel>
|
||||
</GroupBox>
|
||||
</TabItem>
|
||||
</TabControl>
|
||||
|
||||
<Button Grid.Row="1" Grid.ColumnSpan="2"
|
||||
Width="105"
|
||||
HorizontalAlignment="Right"
|
||||
Margin="0,0,140,0"
|
||||
Background="{Binding IconColor}"
|
||||
Content="Save"
|
||||
Command="{Binding Path=SaveCommand}"
|
||||
CommandParameter="{Binding RelativeSource={RelativeSource AncestorType=mah:MetroWindow}}" />
|
||||
|
||||
<Button Grid.Row="1" Grid.ColumnSpan="2"
|
||||
Width="105"
|
||||
HorizontalAlignment="Right"
|
||||
Margin="120,0,20,0"
|
||||
Background="{Binding IconColor}"
|
||||
Content="Cancel"
|
||||
Command="{Binding Path=CancelCommand}"
|
||||
CommandParameter="{Binding RelativeSource={RelativeSource AncestorType=mah:MetroWindow}}"/>
|
||||
</Grid>
|
||||
</mah:MetroContentControl>
|
||||
63
Source/LogDashboard/LogDashboard/View/SettingsCtrl.xaml.cs
Normal file
63
Source/LogDashboard/LogDashboard/View/SettingsCtrl.xaml.cs
Normal file
@@ -0,0 +1,63 @@
|
||||
//******************************************************************************//
|
||||
// SettingsCtrl.xaml.cs
|
||||
// 12/4/2023
|
||||
//
|
||||
// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
|
||||
// PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
|
||||
// AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
|
||||
// UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
|
||||
// RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
|
||||
// CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
|
||||
// OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
|
||||
// COMPANY.
|
||||
//
|
||||
// THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. GOVERNMENT
|
||||
//
|
||||
// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
//
|
||||
// WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE
|
||||
// EXPORT OR DISCLOSURE TO NON-U.S. PERSONS, WHEREVER LOCATED, IS RESTRICTED
|
||||
// BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R. SECTION
|
||||
// 120-130) OR THE EXPORT ADMINISTRATION REGULATIONS (EAR) (15 C.F.R. SECTION
|
||||
// 730-774). THIS DOCUMENT CANNOT BE EXPORTED (E.G., PROVIDED TO A SUPPLIER
|
||||
// OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S. PERSON, WHEREVER
|
||||
// LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS
|
||||
// BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S. GOVERNMENT
|
||||
// APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL
|
||||
// PENALTIES.
|
||||
//
|
||||
// DOD 5220.22-M, INDUSTRIAL SECURITY MANUAL, CHAPTER 5, SECTION 1 THROUGH 9 :
|
||||
// FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN OR DOD 5200.1-R,
|
||||
// INFORMATION SECURITY PROGRAM, CHAPTER 6. FOR UNCLASSIFIED, LIMITED DOCUMENTS
|
||||
// DESTROY BY ANY METHOD THAT WILL PREVENT DISCLOSURE OF CONTENTS OR
|
||||
// RECONSTRUCTION OF THE DOCUMENT.
|
||||
// POC: Alex Kravchenko (1118268)
|
||||
//******************************************************************************//
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace Raytheon.LogDashboard.View
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for SettingsCtrl.xaml
|
||||
/// </summary>
|
||||
public partial class SettingsCtrl
|
||||
{
|
||||
public SettingsCtrl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
57
Source/LogDashboard/LogDashboard/View/SettingsWindow.xaml
Normal file
57
Source/LogDashboard/LogDashboard/View/SettingsWindow.xaml
Normal file
@@ -0,0 +1,57 @@
|
||||
<!--
|
||||
SettingsWindow.xaml
|
||||
12/4/2023
|
||||
|
||||
RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
|
||||
PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
|
||||
AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
|
||||
UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
|
||||
RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
|
||||
CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
|
||||
OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
|
||||
COMPANY.
|
||||
|
||||
THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. GOVERNMENT
|
||||
|
||||
UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
|
||||
WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE
|
||||
EXPORT OR DISCLOSURE TO NON-U.S. PERSONS, WHEREVER LOCATED, IS RESTRICTED
|
||||
BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R. SECTION
|
||||
120-130) OR THE EXPORT ADMINISTRATION REGULATIONS (EAR) (15 C.F.R. SECTION
|
||||
730-774). THIS DOCUMENT CANNOT BE EXPORTED (E.G., PROVIDED TO A SUPPLIER
|
||||
OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S. PERSON, WHEREVER
|
||||
LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS
|
||||
BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S. GOVERNMENT
|
||||
APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL
|
||||
PENALTIES.
|
||||
|
||||
DOD 5220.22-M, INDUSTRIAL SECURITY MANUAL, CHAPTER 5, SECTION 1 THROUGH 9 :
|
||||
FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN OR DOD 5200.1-R,
|
||||
INFORMATION SECURITY PROGRAM, CHAPTER 6. FOR UNCLASSIFIED, LIMITED DOCUMENTS
|
||||
DESTROY BY ANY METHOD THAT WILL PREVENT DISCLOSURE OF CONTENTS OR
|
||||
RECONSTRUCTION OF THE DOCUMENT.
|
||||
POC: Alex Kravchenko (1118268)
|
||||
-->
|
||||
<mah:MetroWindow x:Class="Raytheon.LogDashboard.View.SettingsWindow"
|
||||
xmlns:mah="http://metro.mahapps.com/winfx/xaml/controls"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:ctrl="clr-namespace:Raytheon.LogDashboard.View"
|
||||
DataContext="{Binding Settings, Source={StaticResource LogDashLocator}}"
|
||||
WindowTitleBrush="{Binding IconColor}"
|
||||
mc:Ignorable="d"
|
||||
Title="Settings"
|
||||
Height="630"
|
||||
Width="600"
|
||||
MinHeight="505"
|
||||
>
|
||||
|
||||
<mah:MetroContentControl>
|
||||
<ctrl:SettingsCtrl DataContext="{Binding Settings, Source={StaticResource LogDashLocator}}" />
|
||||
</mah:MetroContentControl>
|
||||
|
||||
|
||||
</mah:MetroWindow>
|
||||
48
Source/LogDashboard/LogDashboard/View/SettingsWindow.xaml.cs
Normal file
48
Source/LogDashboard/LogDashboard/View/SettingsWindow.xaml.cs
Normal file
@@ -0,0 +1,48 @@
|
||||
//******************************************************************************//
|
||||
// SettingsWindow.xaml.cs
|
||||
// 12/4/2023
|
||||
//
|
||||
// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
|
||||
// PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
|
||||
// AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
|
||||
// UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
|
||||
// RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
|
||||
// CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
|
||||
// OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
|
||||
// COMPANY.
|
||||
//
|
||||
// THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. GOVERNMENT
|
||||
//
|
||||
// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
//
|
||||
// WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE
|
||||
// EXPORT OR DISCLOSURE TO NON-U.S. PERSONS, WHEREVER LOCATED, IS RESTRICTED
|
||||
// BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R. SECTION
|
||||
// 120-130) OR THE EXPORT ADMINISTRATION REGULATIONS (EAR) (15 C.F.R. SECTION
|
||||
// 730-774). THIS DOCUMENT CANNOT BE EXPORTED (E.G., PROVIDED TO A SUPPLIER
|
||||
// OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S. PERSON, WHEREVER
|
||||
// LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS
|
||||
// BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S. GOVERNMENT
|
||||
// APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL
|
||||
// PENALTIES.
|
||||
//
|
||||
// DOD 5220.22-M, INDUSTRIAL SECURITY MANUAL, CHAPTER 5, SECTION 1 THROUGH 9 :
|
||||
// FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN OR DOD 5200.1-R,
|
||||
// INFORMATION SECURITY PROGRAM, CHAPTER 6. FOR UNCLASSIFIED, LIMITED DOCUMENTS
|
||||
// DESTROY BY ANY METHOD THAT WILL PREVENT DISCLOSURE OF CONTENTS OR
|
||||
// RECONSTRUCTION OF THE DOCUMENT.
|
||||
// POC: Alex Kravchenko (1118268)
|
||||
//******************************************************************************//
|
||||
namespace Raytheon.LogDashboard.View
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for SettingsWindow.xaml
|
||||
/// </summary>
|
||||
public partial class SettingsWindow
|
||||
{
|
||||
public SettingsWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
301
Source/LogDashboard/LogDashboard/View/SidebarTreeView.xaml
Normal file
301
Source/LogDashboard/LogDashboard/View/SidebarTreeView.xaml
Normal file
@@ -0,0 +1,301 @@
|
||||
<!--
|
||||
SidebarTreeView.xaml
|
||||
12/4/2023
|
||||
|
||||
RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
|
||||
PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
|
||||
AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
|
||||
UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
|
||||
RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
|
||||
CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
|
||||
OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
|
||||
COMPANY.
|
||||
|
||||
THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. GOVERNMENT
|
||||
|
||||
UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
|
||||
WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE
|
||||
EXPORT OR DISCLOSURE TO NON-U.S. PERSONS, WHEREVER LOCATED, IS RESTRICTED
|
||||
BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R. SECTION
|
||||
120-130) OR THE EXPORT ADMINISTRATION REGULATIONS (EAR) (15 C.F.R. SECTION
|
||||
730-774). THIS DOCUMENT CANNOT BE EXPORTED (E.G., PROVIDED TO A SUPPLIER
|
||||
OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S. PERSON, WHEREVER
|
||||
LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS
|
||||
BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S. GOVERNMENT
|
||||
APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL
|
||||
PENALTIES.
|
||||
|
||||
DOD 5220.22-M, INDUSTRIAL SECURITY MANUAL, CHAPTER 5, SECTION 1 THROUGH 9 :
|
||||
FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN OR DOD 5200.1-R,
|
||||
INFORMATION SECURITY PROGRAM, CHAPTER 6. FOR UNCLASSIFIED, LIMITED DOCUMENTS
|
||||
DESTROY BY ANY METHOD THAT WILL PREVENT DISCLOSURE OF CONTENTS OR
|
||||
RECONSTRUCTION OF THE DOCUMENT.
|
||||
POC: Alex Kravchenko (1118268)
|
||||
-->
|
||||
<mah:MetroContentControl x:Class="Raytheon.LogDashboard.View.SidebarTreeView"
|
||||
xmlns:mah="http://metro.mahapps.com/winfx/xaml/controls"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:helpers="clr-namespace:Raytheon.LogDashboard.Helpers"
|
||||
xmlns:threeView="clr-namespace:Raytheon.LogDashboard.Model"
|
||||
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
|
||||
DataContext="{Binding LogDashboard, Source={StaticResource LogDashLocator}}"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="450" d:DesignWidth="800">
|
||||
|
||||
<mah:MetroContentControl.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="../Styles/Styles.xaml"/>
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
|
||||
<HierarchicalDataTemplate DataType="{x:Type threeView:Node}" ItemsSource="{Binding Children}">
|
||||
|
||||
<StackPanel Orientation="Horizontal" Tag="{Binding DataContext, RelativeSource={RelativeSource AncestorType=mah:MetroContentControl}}">
|
||||
|
||||
<CheckBox IsChecked="{Binding IsChecked}" Uid="{Binding Id}"
|
||||
Command="{Binding Path=DataContext.TreeViewElementCheckCommand, RelativeSource={RelativeSource AncestorType=mah:MetroContentControl}}"
|
||||
x:Name="TreeViewCheckBox"
|
||||
CommandParameter="{Binding RelativeSource={RelativeSource Self}}"
|
||||
PreviewMouseLeftButtonDown="TreeViewCheckBox_OnPreviewMouseLeftButtonDown"
|
||||
PreviewKeyDown="TreeViewCheckBox_OnPreviewKeyDown">
|
||||
</CheckBox>
|
||||
|
||||
<helpers:SearchableTextControl Text="{Binding Text}"
|
||||
SearchText="{Binding DataContext.LoggerHighlightText, RelativeSource={RelativeSource AncestorType=mah:MetroContentControl}}"
|
||||
IsHighlight="True" IsMatchCase="False"
|
||||
Background="{Binding ToggleMark}">
|
||||
<helpers:SearchableTextControl.ToolTip>
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="65"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="30"/>
|
||||
<RowDefinition/>
|
||||
</Grid.RowDefinitions>
|
||||
<TextBlock Grid.Row="0" Text="{Binding Name, StringFormat={}{0}:}" FontWeight="Bold" VerticalAlignment="Top"/>
|
||||
<TextBlock Grid.Row="1" Text="{Binding Source, StringFormat={}{0}:}" FontWeight="Bold"/>
|
||||
|
||||
<TextBlock Grid.Column="1" Grid.Row="0" Text="{Binding Text}" VerticalAlignment="Top"/>
|
||||
<TextBlock Grid.Column="1" Grid.Row="1" Text="{Binding Source}"/>
|
||||
</Grid>
|
||||
</helpers:SearchableTextControl.ToolTip>
|
||||
</helpers:SearchableTextControl>
|
||||
|
||||
<StackPanel.ContextMenu>
|
||||
<ContextMenu Style="{StaticResource BaseContextMenu}">
|
||||
<MenuItem Header="Collapse All"
|
||||
Margin="0"
|
||||
Command="{Binding PlacementTarget.Tag.CollapseChildrenCommand, RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=ContextMenu}}"
|
||||
CommandParameter="{Binding}">
|
||||
<MenuItem.Icon>
|
||||
<Image Source="{StaticResource CollapseImage}" Width="24" Height="24" Margin="4"/>
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
|
||||
<MenuItem Header="Expand All"
|
||||
Margin="0"
|
||||
Command="{Binding PlacementTarget.Tag.ExpandChildrenCommand, RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=ContextMenu}}"
|
||||
CommandParameter="{Binding}">
|
||||
<MenuItem.Icon>
|
||||
<Image Source="{StaticResource ExpandImage}" Width="24" Height="24" Margin="4"/>
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
|
||||
<Separator />
|
||||
|
||||
<MenuItem Header="Show only this Logger"
|
||||
Command="{Binding PlacementTarget.Tag.ShowOnlyThisLoggerCommand, RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=ContextMenu}}"
|
||||
CommandParameter="{Binding}">
|
||||
<MenuItem.Icon>
|
||||
<Image Source="{StaticResource EyeImage}" Width="24" Height="24" Margin="4"/>
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
|
||||
<MenuItem Header="Don't Receive this Logger"
|
||||
ToolTip="Don't add new messages to buffer from this Logger"
|
||||
Command="{Binding PlacementTarget.Tag.DontReceiveThisLoggerCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ContextMenu}}"
|
||||
CommandParameter="{Binding}">
|
||||
<MenuItem.Icon>
|
||||
<Image Source="{StaticResource StopImage}" Width="24" Height="24" Margin="4"/>
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
|
||||
<MenuItem Header="Add current IP to Ignore List" ToolTip="Don't receive new messages from this IP address"
|
||||
Command="{Binding PlacementTarget.Tag.IgnoreThisIPCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ContextMenu}}"
|
||||
CommandParameter="{Binding}">
|
||||
<MenuItem.Icon>
|
||||
<Image Source="{StaticResource IgnoreIPStopImage}" Width="24" Height="24" Margin="4"/>
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
|
||||
<MenuItem Header="Toggle Marking" ToolTip="Mark the messages of this logger in a different color"
|
||||
Command="{Binding PlacementTarget.Tag.ToggleMarkCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ContextMenu}}"
|
||||
CommandParameter="{Binding}">
|
||||
<MenuItem.Icon>
|
||||
<Image Source="{StaticResource MarkDrawingImage}" Width="24" Height="24" Margin="4"/>
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
|
||||
<Separator />
|
||||
|
||||
<MenuItem Header="Clear" Margin="0"
|
||||
Command="{Binding PlacementTarget.Tag.ClearChildrenCommand, RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=ContextMenu}}"
|
||||
CommandParameter="{Binding}">
|
||||
<MenuItem.Icon>
|
||||
<Image Source="{StaticResource CleanImage}" Width="24" Height="24" Margin="4"/>
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
|
||||
<Separator />
|
||||
|
||||
<MenuItem Header="Export Current Logger to File" Margin="0"
|
||||
Command="{Binding PlacementTarget.Tag.ExportCommand, RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=ContextMenu}}"
|
||||
CommandParameter="{Binding}">
|
||||
<MenuItem.Icon>
|
||||
<Image Source="{StaticResource ExportDrawingImage}" Width="24" Height="24" Margin="4"/>
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
</ContextMenu>
|
||||
</StackPanel.ContextMenu>
|
||||
</StackPanel>
|
||||
</HierarchicalDataTemplate>
|
||||
</ResourceDictionary>
|
||||
</mah:MetroContentControl.Resources>
|
||||
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition MinWidth="10"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<TextBlock Text="Loggers" FontSize="14" Margin="10, 5" HorizontalAlignment="Left" Foreground="{Binding IconColor}"/>
|
||||
|
||||
<Grid Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="3" Margin="0,0,10,10">
|
||||
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<Border CornerRadius="2" Margin="10,0,0,0" Height="33" HorizontalAlignment="Stretch">
|
||||
<Border.Style>
|
||||
<Style TargetType="{x:Type Border}">
|
||||
<Setter Property="BorderBrush" Value="{Binding FontColor}"/>
|
||||
<Setter Property="BorderThickness" Value="1"/>
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding IsFocused, ElementName=SearchLoggerTextBox}" Value="True">
|
||||
<Setter Property="BorderBrush" Value="{Binding IconColor}" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</Border.Style>
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBox x:Name="SearchLoggerTextBox"
|
||||
Text="{Binding Path=SearchLoggerText, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
|
||||
Margin="5,0,5,0"
|
||||
BorderThickness="0"
|
||||
HorizontalAlignment="Stretch" VerticalContentAlignment="Center" >
|
||||
<TextBox.InputBindings>
|
||||
<KeyBinding Command="{Binding Path=SearchLoggersCommand}" Key="Return" />
|
||||
</TextBox.InputBindings>
|
||||
</TextBox>
|
||||
|
||||
<Button Grid.Column="1" Margin="0,0,3,0" Padding="0" Height="20" Width="20" ToolTip="Clear search loggers result"
|
||||
Command="{Binding Path=ClearSearchLoggerResultCommand}"
|
||||
Visibility="{Binding Path=IsEnableClearSearchLoggers, Converter={StaticResource BooleanToVisibility}}">
|
||||
<Button.Template>
|
||||
<ControlTemplate TargetType="{x:Type Button}">
|
||||
<Grid x:Name="RootGrid">
|
||||
<Image Source="{StaticResource CancelDrawingImage}" Cursor="Hand"/>
|
||||
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||
</Grid>
|
||||
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property ="IsPressed" Value ="True">
|
||||
<Setter TargetName="RootGrid" Property="RenderTransform">
|
||||
<Setter.Value>
|
||||
<ScaleTransform ScaleX="0.95" ScaleY="0.95"/>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Button.Template>
|
||||
</Button>
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
<Button Grid.Column="1"
|
||||
Height="32"
|
||||
Width="32"
|
||||
Margin="5,0,0,0"
|
||||
Padding="2"
|
||||
ToolTip="Find Loggers"
|
||||
Command="{Binding Path=SearchLoggersCommand}">
|
||||
<Image Source="{StaticResource SearchDrawingImage}"/>
|
||||
<Button.Style>
|
||||
<Style TargetType="{x:Type Button}" BasedOn="{StaticResource CircleImageButtonStyle}">
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding Text.Length, ElementName=SearchLoggerTextBox, UpdateSourceTrigger=PropertyChanged}" Value="0">
|
||||
<Setter Property="IsEnabled" Value="False"/>
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</Button.Style>
|
||||
</Button>
|
||||
</Grid>
|
||||
|
||||
<TreeView Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="3"
|
||||
VerticalAlignment="Top"
|
||||
ItemsSource="{Binding Path=Loggers}"
|
||||
IsEnabled="{Binding Path=IsEnableLogList}"
|
||||
x:Name="LoggersTreeView"
|
||||
VirtualizingStackPanel.IsVirtualizing="True"
|
||||
VirtualizingStackPanel.VirtualizationMode="Recycling" >
|
||||
<i:Interaction.Behaviors>
|
||||
<helpers:BindableSelectedItemBehavior SelectedItem="{Binding SelectedNode, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
|
||||
</i:Interaction.Behaviors>
|
||||
</TreeView>
|
||||
|
||||
<StackPanel Orientation="Horizontal" Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="3">
|
||||
<Button Grid.Row="3" Grid.Column="0"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Bottom"
|
||||
Content="Collapse All"
|
||||
Width="100"
|
||||
Margin="10"
|
||||
Background="{Binding IconColor}"
|
||||
Command="{Binding Path=CollapseLoggersCommand}"/>
|
||||
|
||||
<Button Grid.Row="3" Grid.Column="1"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Bottom"
|
||||
Background="{Binding IconColor}"
|
||||
Content="Clear All"
|
||||
Width="100"
|
||||
Margin="10"
|
||||
Command="{Binding Path=ClearLoggersCommand}"/>
|
||||
|
||||
</StackPanel>
|
||||
|
||||
</Grid>
|
||||
|
||||
</mah:MetroContentControl>
|
||||
@@ -0,0 +1,71 @@
|
||||
//******************************************************************************//
|
||||
// SidebarTreeView.xaml.cs
|
||||
// 12/4/2023
|
||||
//
|
||||
// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
|
||||
// PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
|
||||
// AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
|
||||
// UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
|
||||
// RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
|
||||
// CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
|
||||
// OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
|
||||
// COMPANY.
|
||||
//
|
||||
// THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. GOVERNMENT
|
||||
//
|
||||
// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
//
|
||||
// WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE
|
||||
// EXPORT OR DISCLOSURE TO NON-U.S. PERSONS, WHEREVER LOCATED, IS RESTRICTED
|
||||
// BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R. SECTION
|
||||
// 120-130) OR THE EXPORT ADMINISTRATION REGULATIONS (EAR) (15 C.F.R. SECTION
|
||||
// 730-774). THIS DOCUMENT CANNOT BE EXPORTED (E.G., PROVIDED TO A SUPPLIER
|
||||
// OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S. PERSON, WHEREVER
|
||||
// LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS
|
||||
// BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S. GOVERNMENT
|
||||
// APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL
|
||||
// PENALTIES.
|
||||
//
|
||||
// DOD 5220.22-M, INDUSTRIAL SECURITY MANUAL, CHAPTER 5, SECTION 1 THROUGH 9 :
|
||||
// FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN OR DOD 5200.1-R,
|
||||
// INFORMATION SECURITY PROGRAM, CHAPTER 6. FOR UNCLASSIFIED, LIMITED DOCUMENTS
|
||||
// DESTROY BY ANY METHOD THAT WILL PREVENT DISCLOSURE OF CONTENTS OR
|
||||
// RECONSTRUCTION OF THE DOCUMENT.
|
||||
// POC: Alex Kravchenko (1118268)
|
||||
//******************************************************************************//
|
||||
using Raytheon.LogDashboard.Model;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace Raytheon.LogDashboard.View
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for SideBarTree.xaml
|
||||
/// </summary>
|
||||
public partial class SidebarTreeView
|
||||
{
|
||||
public SidebarTreeView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
#region tree
|
||||
|
||||
private void TreeViewCheckBox_OnPreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
CheckBox currentCheckBox = (CheckBox)sender;
|
||||
CheckBoxId.CurrentСheckBoxId = currentCheckBox.Uid;
|
||||
}
|
||||
|
||||
private void TreeViewCheckBox_OnPreviewKeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.Key == Key.Space)
|
||||
{
|
||||
CheckBox currentCheckBox = (CheckBox)sender;
|
||||
CheckBoxId.CurrentСheckBoxId = currentCheckBox.Uid;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
//******************************************************************************//
|
||||
// ImportLogsProcessViewModel.cs
|
||||
// 12/4/2023
|
||||
//
|
||||
// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
|
||||
// PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
|
||||
// AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
|
||||
// UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
|
||||
// RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
|
||||
// CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
|
||||
// OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
|
||||
// COMPANY.
|
||||
//
|
||||
// THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. GOVERNMENT
|
||||
//
|
||||
// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
//
|
||||
// WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE
|
||||
// EXPORT OR DISCLOSURE TO NON-U.S. PERSONS, WHEREVER LOCATED, IS RESTRICTED
|
||||
// BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R. SECTION
|
||||
// 120-130) OR THE EXPORT ADMINISTRATION REGULATIONS (EAR) (15 C.F.R. SECTION
|
||||
// 730-774). THIS DOCUMENT CANNOT BE EXPORTED (E.G., PROVIDED TO A SUPPLIER
|
||||
// OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S. PERSON, WHEREVER
|
||||
// LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS
|
||||
// BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S. GOVERNMENT
|
||||
// APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL
|
||||
// PENALTIES.
|
||||
//
|
||||
// DOD 5220.22-M, INDUSTRIAL SECURITY MANUAL, CHAPTER 5, SECTION 1 THROUGH 9 :
|
||||
// FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN OR DOD 5200.1-R,
|
||||
// INFORMATION SECURITY PROGRAM, CHAPTER 6. FOR UNCLASSIFIED, LIMITED DOCUMENTS
|
||||
// DESTROY BY ANY METHOD THAT WILL PREVENT DISCLOSURE OF CONTENTS OR
|
||||
// RECONSTRUCTION OF THE DOCUMENT.
|
||||
// POC: Alex Kravchenko (1118268)
|
||||
//******************************************************************************//
|
||||
using GalaSoft.MvvmLight;
|
||||
using Raytheon.LogDashboard.Model;
|
||||
using GalaSoft.MvvmLight.Command;
|
||||
using MahApps.Metro.Controls;
|
||||
using System.Windows.Input;
|
||||
using System;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Windows.Media;
|
||||
using System.Windows;
|
||||
|
||||
namespace Raytheon.LogDashboard.ViewModel
|
||||
{
|
||||
public class ImportLogsProcessViewModel : ViewModelBase
|
||||
{
|
||||
protected static LogDashViewModelLocator LocatorInstance => (Application.Current.Resources["LogDashLocator"] as LogDashViewModelLocator);
|
||||
|
||||
public event EventHandler<bool> ImportProcessDialogResult;
|
||||
|
||||
public ObservableCollection<ImportLogFile> ImportFiles { get; set; }
|
||||
|
||||
private ICommand _closeCommand;
|
||||
public ICommand CloseCommand => _closeCommand ?? (_closeCommand = new RelayCommand<MetroWindow>
|
||||
((w) =>
|
||||
{
|
||||
OnImportProcessDialogResult(true);
|
||||
w.Close();
|
||||
}));
|
||||
|
||||
private ICommand _cancelCommand;
|
||||
public ICommand CancelCommand => _cancelCommand ?? (_cancelCommand = new RelayCommand<MetroWindow>
|
||||
((w) =>
|
||||
{
|
||||
OnImportProcessDialogResult(false);
|
||||
w.Close();
|
||||
}));
|
||||
|
||||
protected virtual void OnImportProcessDialogResult(bool e)
|
||||
{
|
||||
ImportProcessDialogResult?.Invoke(this, e);
|
||||
}
|
||||
|
||||
public SolidColorBrush IconColor
|
||||
{
|
||||
get => SelectedColorTheme.Color;
|
||||
}
|
||||
public ColorTheme SelectedColorTheme
|
||||
{
|
||||
get => LocatorInstance.SelectedColorTheme;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,122 @@
|
||||
//******************************************************************************//
|
||||
// LogDashViewModelLocator.cs
|
||||
// 12/4/2023
|
||||
//
|
||||
// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
|
||||
// PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
|
||||
// AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
|
||||
// UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
|
||||
// RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
|
||||
// CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
|
||||
// OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
|
||||
// COMPANY.
|
||||
//
|
||||
// THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. GOVERNMENT
|
||||
//
|
||||
// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
//
|
||||
// WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE
|
||||
// EXPORT OR DISCLOSURE TO NON-U.S. PERSONS, WHEREVER LOCATED, IS RESTRICTED
|
||||
// BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R. SECTION
|
||||
// 120-130) OR THE EXPORT ADMINISTRATION REGULATIONS (EAR) (15 C.F.R. SECTION
|
||||
// 730-774). THIS DOCUMENT CANNOT BE EXPORTED (E.G., PROVIDED TO A SUPPLIER
|
||||
// OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S. PERSON, WHEREVER
|
||||
// LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS
|
||||
// BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S. GOVERNMENT
|
||||
// APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL
|
||||
// PENALTIES.
|
||||
//
|
||||
// DOD 5220.22-M, INDUSTRIAL SECURITY MANUAL, CHAPTER 5, SECTION 1 THROUGH 9 :
|
||||
// FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN OR DOD 5200.1-R,
|
||||
// INFORMATION SECURITY PROGRAM, CHAPTER 6. FOR UNCLASSIFIED, LIMITED DOCUMENTS
|
||||
// DESTROY BY ANY METHOD THAT WILL PREVENT DISCLOSURE OF CONTENTS OR
|
||||
// RECONSTRUCTION OF THE DOCUMENT.
|
||||
// POC: Alex Kravchenko (1118268)
|
||||
//******************************************************************************//
|
||||
|
||||
// Ignore Spelling: Locator
|
||||
|
||||
using CommonServiceLocator;
|
||||
using GalaSoft.MvvmLight;
|
||||
using GalaSoft.MvvmLight.Ioc;
|
||||
using GalaSoft.MvvmLight.Messaging;
|
||||
using Raytheon.LogDashboard.Model;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Windows;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace Raytheon.LogDashboard.ViewModel
|
||||
{
|
||||
public class LogDashViewModelLocator : ViewModelBase
|
||||
{
|
||||
public LogDashViewModelLocator()
|
||||
{
|
||||
ServiceLocator.SetLocatorProvider(() => SimpleIoc.Default);
|
||||
|
||||
SimpleIoc.Default.Register<LogDashboardViewModel>();
|
||||
SimpleIoc.Default.Register<ImportLogsProcessViewModel>();
|
||||
SimpleIoc.Default.Register<LogImportTemplateViewModel>();
|
||||
SimpleIoc.Default.Register<ReleaseNotesViewModel>();
|
||||
SimpleIoc.Default.Register<SearchResultViewModel>();
|
||||
SimpleIoc.Default.Register<SettingsViewModel>();
|
||||
SimpleIoc.Default.Register<SelectTimeIntervalViewModel>();
|
||||
SimpleIoc.Default.Register<SidebarTreeViewModel>();
|
||||
}
|
||||
public static LogDashboardViewModel LogDashboard => ServiceLocator.Current.GetInstance<LogDashboardViewModel>();
|
||||
|
||||
public static ImportLogsProcessViewModel ImportLogsProcess => ServiceLocator.Current.GetInstance<ImportLogsProcessViewModel>();
|
||||
public static LogImportTemplateViewModel LogImportTemplate => ServiceLocator.Current.GetInstance<LogImportTemplateViewModel>();
|
||||
public static ReleaseNotesViewModel ReleaseNotes => ServiceLocator.Current.GetInstance<ReleaseNotesViewModel>();
|
||||
public static SearchResultViewModel SearchResult => ServiceLocator.Current.GetInstance<SearchResultViewModel>();
|
||||
public static SettingsViewModel Settings => ServiceLocator.Current.GetInstance<SettingsViewModel>();
|
||||
public static SelectTimeIntervalViewModel SelectTimeInterval => ServiceLocator.Current.GetInstance<SelectTimeIntervalViewModel>();
|
||||
public static SidebarTreeViewModel SidebarTree => ServiceLocator.Current.GetInstance<SidebarTreeViewModel>();
|
||||
|
||||
public static ColorTheme AccentColorTheme { get; set; } = new ColorTheme { Name = "BaseLight", Color = new SolidColorBrush(Colors.Black) };
|
||||
public static ColorTheme InvertAccentColorTheme { get; set; } = new ColorTheme { Name = "BaseDark", Color = new SolidColorBrush(Colors.White) };
|
||||
|
||||
private ColorTheme selectedColorTheme;
|
||||
public ColorTheme SelectedColorTheme
|
||||
{
|
||||
get => selectedColorTheme ?? (selectedColorTheme = new ColorTheme { Color = new SolidColorBrush(Colors.Cyan), Name = "Cyan" });
|
||||
set
|
||||
{
|
||||
if(selectedColorTheme?.Name != value?.Name)
|
||||
{
|
||||
Set(() => SelectedColorTheme, ref selectedColorTheme, value);
|
||||
Messenger.Default.Send(value.Name, "ColorChange");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private string selectedTheme;
|
||||
public string SelectedTheme
|
||||
{
|
||||
get => selectedTheme;
|
||||
set
|
||||
{
|
||||
if(selectedTheme != value)
|
||||
{
|
||||
var accentTheme = AccentColorTheme;
|
||||
var invertTheme = InvertAccentColorTheme;
|
||||
SwapReferences(ref accentTheme, ref invertTheme);
|
||||
AccentColorTheme = accentTheme;
|
||||
InvertAccentColorTheme = invertTheme;
|
||||
|
||||
Set(() => SelectedTheme, ref selectedTheme, value);
|
||||
|
||||
Messenger.Default.Send(value, "ThemeChange");
|
||||
}
|
||||
}
|
||||
}
|
||||
private static void SwapReferences(ref ColorTheme theme1, ref ColorTheme theme2)
|
||||
{
|
||||
(theme1, theme2) = (theme2, theme1);
|
||||
}
|
||||
|
||||
public string ErrorLogger32DefaultLocation => Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Raytheon", "ErrorLogger", "ErrorLogger.ini");
|
||||
public string ErrorLogger64DefaultLocation => Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Raytheon", "ErrorLogger64", "ErrorLogger64.ini");
|
||||
|
||||
}
|
||||
}
|
||||
3662
Source/LogDashboard/LogDashboard/ViewModel/LogDashboardViewModel.cs
Normal file
3662
Source/LogDashboard/LogDashboard/ViewModel/LogDashboardViewModel.cs
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,648 @@
|
||||
//******************************************************************************//
|
||||
// LogImportTemplateViewModel.cs
|
||||
// 12/4/2023
|
||||
//
|
||||
// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
|
||||
// PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
|
||||
// AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
|
||||
// UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
|
||||
// RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
|
||||
// CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
|
||||
// OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
|
||||
// COMPANY.
|
||||
//
|
||||
// THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. GOVERNMENT
|
||||
//
|
||||
// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
//
|
||||
// WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE
|
||||
// EXPORT OR DISCLOSURE TO NON-U.S. PERSONS, WHEREVER LOCATED, IS RESTRICTED
|
||||
// BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R. SECTION
|
||||
// 120-130) OR THE EXPORT ADMINISTRATION REGULATIONS (EAR) (15 C.F.R. SECTION
|
||||
// 730-774). THIS DOCUMENT CANNOT BE EXPORTED (E.G., PROVIDED TO A SUPPLIER
|
||||
// OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S. PERSON, WHEREVER
|
||||
// LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS
|
||||
// BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S. GOVERNMENT
|
||||
// APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL
|
||||
// PENALTIES.
|
||||
//
|
||||
// DOD 5220.22-M, INDUSTRIAL SECURITY MANUAL, CHAPTER 5, SECTION 1 THROUGH 9 :
|
||||
// FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN OR DOD 5200.1-R,
|
||||
// INFORMATION SECURITY PROGRAM, CHAPTER 6. FOR UNCLASSIFIED, LIMITED DOCUMENTS
|
||||
// DESTROY BY ANY METHOD THAT WILL PREVENT DISCLOSURE OF CONTENTS OR
|
||||
// RECONSTRUCTION OF THE DOCUMENT.
|
||||
// POC: Alex Kravchenko (1118268)
|
||||
//******************************************************************************//
|
||||
using NLog.LayoutRenderers;
|
||||
using NLog.Layouts;
|
||||
using NLog;
|
||||
using Raytheon.LogDashboard.Helpers;
|
||||
using Raytheon.LogDashboard.Model;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Text;
|
||||
using System.Windows;
|
||||
using System.Xml.Serialization;
|
||||
using GalaSoft.MvvmLight;
|
||||
using GalaSoft.MvvmLight.CommandWpf;
|
||||
using GalaSoft.MvvmLight.Ioc;
|
||||
using GalaSoft.MvvmLight.Messaging;
|
||||
|
||||
namespace Raytheon.LogDashboard.ViewModel
|
||||
{
|
||||
[Serializable]
|
||||
[DataContract]
|
||||
public class LogImportTemplateViewModel : ViewModelBase
|
||||
{
|
||||
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
|
||||
private string settingsPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "LogDashboard", "template_import_settings.xml");
|
||||
|
||||
private string importFilePath = string.Empty;
|
||||
private string templateSeparator = ";";
|
||||
private string selectedEncoding = "UTF-8";
|
||||
private bool? dialogResult;
|
||||
private bool needUpdateFile;
|
||||
private string templateString = "${longdate};${level};${callsite};${logger};${message};${exception:format=tostring}";
|
||||
protected static LogDashViewModelLocator LocatorInstance => (Application.Current.Resources["LogDashLocator"] as LogDashViewModelLocator);
|
||||
|
||||
#region Properties
|
||||
[XmlIgnore]
|
||||
public Dictionary<string, List<ImportTemplateParameters>> PopularTemplates { get; set; } = new Dictionary<string, List<ImportTemplateParameters>>();
|
||||
|
||||
[XmlElement(Order = 7)]
|
||||
public List<ImportTemplateParameters> SelectedPopularTemplate { get; set; }
|
||||
|
||||
[XmlElement(Order = 8)]
|
||||
public ObservableCollection<LogTemplateItem> TemplateLogItems { get; set; } = new ObservableCollection<LogTemplateItem>();
|
||||
|
||||
[XmlElement(Order = 1)]
|
||||
public bool IsAutomaticDetectTemplateSelected { get; set; } = true;
|
||||
[XmlElement(Order = 2)]
|
||||
public bool IsPopularTemplateSelected { get; set; }
|
||||
[XmlElement(Order = 3)]
|
||||
public bool IsUserTemplateSelected { get; set; }
|
||||
[XmlElement(Order = 4)]
|
||||
public bool IsLayoutStringTemplateSelected { get; set; }
|
||||
|
||||
[XmlIgnore]
|
||||
public bool? DialogResult
|
||||
{
|
||||
get => dialogResult;
|
||||
set => Set(() => DialogResult, ref dialogResult, value);
|
||||
}
|
||||
|
||||
[XmlIgnore]
|
||||
public LogTemplate LogTemplate { get; private set; } = new LogTemplate();
|
||||
|
||||
[XmlElement(Order = 5)]
|
||||
public string TemplateString
|
||||
{
|
||||
get => templateString;
|
||||
set => Set(() => TemplateString, ref templateString, value);
|
||||
}
|
||||
|
||||
[XmlElement(Order = 6)]
|
||||
public string TemplateSeparator
|
||||
{
|
||||
get => templateSeparator;
|
||||
set => Set(() => TemplateSeparator, ref templateSeparator, value);
|
||||
}
|
||||
|
||||
[XmlElement(Order = 9)]
|
||||
public bool NeedUpdateFile
|
||||
{
|
||||
get => needUpdateFile;
|
||||
set => Set(() => NeedUpdateFile, ref needUpdateFile, value);
|
||||
}
|
||||
|
||||
[XmlElement(Order = 10)]
|
||||
public string SelectedEncoding
|
||||
{
|
||||
get => selectedEncoding;
|
||||
set => Set(() => SelectedEncoding, ref selectedEncoding, value);
|
||||
}
|
||||
|
||||
[XmlIgnore]
|
||||
public string ImportPath
|
||||
{
|
||||
get => importFilePath;
|
||||
set => SetPath(value);
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region Commands
|
||||
|
||||
public RelayCommand OkCommand { get; set; }
|
||||
public RelayCommand AddTemplateItemCommand { get; set; }
|
||||
public RelayCommand<object> RemoveTemplateItemCommand { get; set; }
|
||||
public RelayCommand SaveTemplateSettingsCommand { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
[PreferredConstructor]
|
||||
public LogImportTemplateViewModel()
|
||||
{
|
||||
OkCommand = new RelayCommand(Confirm);
|
||||
AddTemplateItemCommand = new RelayCommand(AddTemplateItem);
|
||||
RemoveTemplateItemCommand = new RelayCommand<object>(RemoveTemplateItem);
|
||||
SaveTemplateSettingsCommand = new RelayCommand(SaveTemplateSettingsToFile);
|
||||
}
|
||||
|
||||
public void SetPath(string path)
|
||||
{
|
||||
importFilePath = path;
|
||||
|
||||
PopularTemplates.Add("${date};${level};${other};${processid};${threadid};${сallsite};${logger};${message}",
|
||||
new List<ImportTemplateParameters>
|
||||
{
|
||||
ImportTemplateParameters.date,
|
||||
ImportTemplateParameters.level,
|
||||
ImportTemplateParameters.other,
|
||||
ImportTemplateParameters.processid,
|
||||
ImportTemplateParameters.threadid,
|
||||
ImportTemplateParameters.сallsite,
|
||||
ImportTemplateParameters.logger,
|
||||
ImportTemplateParameters.message
|
||||
});
|
||||
|
||||
PopularTemplates.Add("${date};${level};${threadid};${сallsite};${logger};${message}",
|
||||
new List<ImportTemplateParameters>
|
||||
{
|
||||
ImportTemplateParameters.date,
|
||||
ImportTemplateParameters.level,
|
||||
ImportTemplateParameters.threadid,
|
||||
ImportTemplateParameters.сallsite,
|
||||
ImportTemplateParameters.logger,
|
||||
ImportTemplateParameters.message
|
||||
});
|
||||
|
||||
PopularTemplates.Add("${date};${level};${threadid};${logger};${message}",
|
||||
new List<ImportTemplateParameters>
|
||||
{
|
||||
ImportTemplateParameters.date,
|
||||
ImportTemplateParameters.level,
|
||||
ImportTemplateParameters.threadid,
|
||||
ImportTemplateParameters.logger,
|
||||
ImportTemplateParameters.message
|
||||
});
|
||||
|
||||
PopularTemplates.Add("${date};${level};${сallsite};${logger};${message}",
|
||||
new List<ImportTemplateParameters>
|
||||
{
|
||||
ImportTemplateParameters.date,
|
||||
ImportTemplateParameters.level,
|
||||
ImportTemplateParameters.сallsite,
|
||||
ImportTemplateParameters.logger,
|
||||
ImportTemplateParameters.message
|
||||
});
|
||||
|
||||
PopularTemplates.Add("${date};${level};${logger};${message}",
|
||||
new List<ImportTemplateParameters>
|
||||
{
|
||||
ImportTemplateParameters.date,
|
||||
ImportTemplateParameters.level,
|
||||
ImportTemplateParameters.logger,
|
||||
ImportTemplateParameters.message
|
||||
});
|
||||
|
||||
PopularTemplates.Add("${longdate}|${level:uppercase=true}|${logger}|${message}",
|
||||
new List<ImportTemplateParameters>
|
||||
{
|
||||
ImportTemplateParameters.longdate,
|
||||
ImportTemplateParameters.level,
|
||||
ImportTemplateParameters.logger,
|
||||
ImportTemplateParameters.message
|
||||
});
|
||||
|
||||
SelectedPopularTemplate = PopularTemplates.First().Value;
|
||||
|
||||
if(!File.Exists(settingsPath) && File.Exists($"{AppDomain.CurrentDomain.BaseDirectory}template_import_settings.xml"))
|
||||
{
|
||||
settingsPath = $"{AppDomain.CurrentDomain.BaseDirectory}template_import_settings.xml";
|
||||
}
|
||||
|
||||
if(File.Exists(settingsPath))
|
||||
{
|
||||
XmlSerializer ser = new XmlSerializer(GetType());
|
||||
try
|
||||
{
|
||||
using(FileStream fs = new FileStream(settingsPath, FileMode.Open))
|
||||
{
|
||||
LogImportTemplateViewModel litvm = (LogImportTemplateViewModel)ser.Deserialize(fs);
|
||||
IsAutomaticDetectTemplateSelected = litvm.IsAutomaticDetectTemplateSelected;
|
||||
IsLayoutStringTemplateSelected = litvm.IsLayoutStringTemplateSelected;
|
||||
IsPopularTemplateSelected = litvm.IsPopularTemplateSelected;
|
||||
IsUserTemplateSelected = litvm.IsUserTemplateSelected;
|
||||
TemplateSeparator = litvm.TemplateSeparator;
|
||||
TemplateString = litvm.TemplateString;
|
||||
NeedUpdateFile = litvm.NeedUpdateFile;
|
||||
SelectedEncoding = litvm.SelectedEncoding;
|
||||
SelectedPopularTemplate = PopularTemplates.FirstOrDefault(x => x.Value.SequenceEqual(litvm.SelectedPopularTemplate)).Value;
|
||||
TemplateLogItems = new ObservableCollection<LogTemplateItem>(litvm.TemplateLogItems);
|
||||
|
||||
foreach(var templateLogItem in TemplateLogItems)
|
||||
{
|
||||
var ltii = templateLogItem.TemplateItems
|
||||
.Cast<LogTemplateItemInfo>()
|
||||
.FirstOrDefault(x => x.Parameter == templateLogItem.SelectedTemplateParameter.Parameter);
|
||||
templateLogItem.SelectedTemplateParameter = ltii;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
logger.Warn(ex, "An error occurred while read template settings");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#region Command Handlers
|
||||
|
||||
private void Confirm()
|
||||
{
|
||||
LogTemplate.Encoding = SelectedEncoding;
|
||||
|
||||
if(IsAutomaticDetectTemplateSelected)
|
||||
{
|
||||
if(!TryGetLogTemplateByAutodetect())
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if(IsPopularTemplateSelected)
|
||||
{
|
||||
GetLogTemplateByPopularTemplates();
|
||||
}
|
||||
else if(IsLayoutStringTemplateSelected)
|
||||
{
|
||||
GetLogTemplateByParsingLayoutPattern();
|
||||
}
|
||||
else if(IsUserTemplateSelected)
|
||||
{
|
||||
if(TryGetLogTemplateByUserGeneratedPattern())
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
DialogResult = true;
|
||||
}
|
||||
|
||||
private void AddTemplateItem()
|
||||
{
|
||||
TemplateLogItems.Add(new LogTemplateItem());
|
||||
}
|
||||
|
||||
private void RemoveTemplateItem(object obj)
|
||||
{
|
||||
if(obj is LogTemplateItem item)
|
||||
{
|
||||
TemplateLogItems.Remove(item);
|
||||
}
|
||||
}
|
||||
|
||||
private void SaveTemplateSettingsToFile()
|
||||
{
|
||||
try
|
||||
{
|
||||
XmlSerializer ser = new XmlSerializer(this.GetType());
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(settingsPath));
|
||||
using(FileStream fs = new FileStream(settingsPath, FileMode.Create))
|
||||
{
|
||||
ser.Serialize(fs, this);
|
||||
}
|
||||
|
||||
Messenger.Default.Send("Template settings successfully saved.", "DisplayCustomMessage");
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
Messenger.Default.Send($"Unable to Save Template settings.\n{e.Message}", "DisplayCustomMessage");
|
||||
logger.Warn(e, "An error occurred while Save settings.");
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Templates
|
||||
|
||||
private bool TryGetLogTemplateByAutodetect()
|
||||
{
|
||||
string firstMessage = GetFirstLogMessage();
|
||||
|
||||
if(string.IsNullOrWhiteSpace(firstMessage))
|
||||
{
|
||||
Messenger.Default.Send($"An error occurred while trying to automatically match the message template.\nEmpty data file", "DisplayCustomMessage");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!TryDetectTemplate(firstMessage))
|
||||
{
|
||||
Messenger.Default.Send($"An error occurred while trying to automatically match the message template.", "DisplayCustomMessage");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private bool TryGetLogTemplateByUserGeneratedPattern()
|
||||
{
|
||||
LogTemplate.Separator = TemplateSeparator;
|
||||
for(int i = 0; i < TemplateLogItems.Count; i++)
|
||||
{
|
||||
try
|
||||
{
|
||||
LogTemplate.TemplateParameters.Add(TemplateLogItems[i].SelectedTemplateParameter.Parameter, i);
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
LogTemplate.TemplateParameters.Clear();
|
||||
Messenger.Default.Send($"Unable to Add Template\n{ex.Message}", "DisplayCustomMessage");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
private void GetLogTemplateByPopularTemplates()
|
||||
{
|
||||
for(int i = 0; i < SelectedPopularTemplate.Count; i++)
|
||||
{
|
||||
LogTemplate.TemplateParameters.Add(SelectedPopularTemplate[i], i);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
private void GetLogTemplateByParsingLayoutPattern()
|
||||
{
|
||||
SimpleLayout layout = new SimpleLayout(TemplateString);
|
||||
List<LayoutRenderer> elements = layout.Renderers.Where(x => !(x is LiteralLayoutRenderer)).ToList();
|
||||
|
||||
if(elements.Count < 4)
|
||||
{
|
||||
Messenger.Default.Send($"An error occurred while parsing template string", "DisplayCustomMessage");
|
||||
return;
|
||||
}
|
||||
|
||||
var separator = layout.Renderers.FirstOrDefault(x => x is LiteralLayoutRenderer);
|
||||
|
||||
LogTemplate.Separator = separator != null ? separator.Render(LogEventInfo.CreateNullEvent()) : ";";
|
||||
|
||||
List<string> tElements = TemplateString.Split(new[] { LogTemplate.Separator }, StringSplitOptions.None)
|
||||
.Where(x => !string.IsNullOrEmpty(x)).ToList();
|
||||
|
||||
int j = 0;
|
||||
for(int i = 0; i < tElements.Count; i++)
|
||||
{
|
||||
int modifyIndex = tElements[i].IndexOf(":");
|
||||
if(modifyIndex > 0)
|
||||
{
|
||||
tElements[i] = tElements[i].Substring(0, modifyIndex);
|
||||
}
|
||||
|
||||
tElements[i] = tElements[i].Replace("}", "");
|
||||
|
||||
if(j <= elements.Count)
|
||||
{
|
||||
string layoutRender = elements[j].ToString();
|
||||
if(!layoutRender.Contains(tElements[i]))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if(elements[j] is LevelLayoutRenderer)
|
||||
{
|
||||
LogTemplate.TemplateParameters.Add(ImportTemplateParameters.level, i);
|
||||
}
|
||||
|
||||
if(elements[j] is CallSiteLayoutRenderer)
|
||||
{
|
||||
LogTemplate.TemplateParameters.Add(ImportTemplateParameters.сallsite, i);
|
||||
}
|
||||
|
||||
if(elements[j] is MessageLayoutRenderer)
|
||||
{
|
||||
LogTemplate.TemplateParameters.Add(ImportTemplateParameters.message, i);
|
||||
}
|
||||
|
||||
if(elements[j] is ThreadIdLayoutRenderer)
|
||||
{
|
||||
LogTemplate.TemplateParameters.Add(ImportTemplateParameters.threadid, i);
|
||||
}
|
||||
|
||||
if(elements[j] is ProcessIdLayoutRenderer)
|
||||
{
|
||||
LogTemplate.TemplateParameters.Add(ImportTemplateParameters.processid, i);
|
||||
}
|
||||
|
||||
if(elements[j] is LoggerNameLayoutRenderer)
|
||||
{
|
||||
LogTemplate.TemplateParameters.Add(ImportTemplateParameters.logger, i);
|
||||
}
|
||||
|
||||
if(elements[j] is TimeLayoutRenderer || elements[j] is DateLayoutRenderer ||
|
||||
elements[j] is LongDateLayoutRenderer || elements[j] is ShortDateLayoutRenderer)
|
||||
{
|
||||
LogTemplate.TemplateParameters.Add(ImportTemplateParameters.date, i);
|
||||
}
|
||||
|
||||
if(elements[j] is TicksLayoutRenderer)
|
||||
{
|
||||
LogTemplate.TemplateParameters.Add(ImportTemplateParameters.ticks, i);
|
||||
}
|
||||
|
||||
j++;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private string GetFirstLogMessage()
|
||||
{
|
||||
string[] logTypeArraySeparator1 =
|
||||
{
|
||||
";Fatal;", ";Error;", ";Warn;", ";Trace;", ";Debug;", ";Info;",
|
||||
";Fatal", ";Error", ";Warn", ";Trace", ";Debug", ";Info",
|
||||
"Fatal;", "Error;", "Warn;", "Trace;", "Debug;", "Info;"
|
||||
};
|
||||
|
||||
string[] logTypeArraySeparator2 =
|
||||
{
|
||||
"|Fatal|", "|Error|", "|Warn|", "|Trace|", "|Debug|", "|Info|",
|
||||
"|Fatal", "|Error", "|Warn", "|Trace", "|Debug", "|Info",
|
||||
"Fatal|", "Error|", "Warn|", "Trace|", "Debug|", "Info|"
|
||||
};
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
using(StreamReader reader = new StreamReader(importFilePath))
|
||||
{
|
||||
string line;
|
||||
while((line = reader.ReadLine()) != null)
|
||||
{
|
||||
if(line.ContainsAnyOf(logTypeArraySeparator1, true) || line.ContainsAnyOf(logTypeArraySeparator2, true))
|
||||
{
|
||||
if(sb.Length != 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
sb.Append(line);
|
||||
}
|
||||
else
|
||||
{
|
||||
sb.AppendLine(line);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// trying to detect template
|
||||
/// </summary>
|
||||
/// <param name="log"></param>
|
||||
/// <returns></returns>
|
||||
private bool TryDetectTemplate(string log)
|
||||
{
|
||||
if(log.StartsWith("<log4j"))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
string[] logSplit = log.Split(';');
|
||||
if(logSplit.Length < 4)
|
||||
{
|
||||
logSplit = log.Split('|');
|
||||
LogTemplate.Separator = "|";
|
||||
}
|
||||
|
||||
ImportTemplateParameters dataParameter = ImportTemplateParameters.date;
|
||||
|
||||
int dateTimeIndex = GetDateTimeIndex(logSplit, ref dataParameter);
|
||||
if(dateTimeIndex == -1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
var intIndexes = GetIntIndexes(logSplit);
|
||||
int logLevelIndex = GetLogLevelIndex(logSplit);
|
||||
if(dateTimeIndex == -1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
List<int> otherIndexes = new List<int>();
|
||||
|
||||
for(int i = 0; i < logSplit.Length; i++)
|
||||
{
|
||||
|
||||
if(i == dateTimeIndex || i == logLevelIndex || intIndexes.Contains(i))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if(!string.IsNullOrEmpty(logSplit[i]))
|
||||
{
|
||||
otherIndexes.Add(i);
|
||||
}
|
||||
}
|
||||
|
||||
if(otherIndexes.Count < 2)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
LogTemplate.TemplateParameters.Add(dataParameter, dateTimeIndex);
|
||||
LogTemplate.TemplateParameters.Add(ImportTemplateParameters.level, logLevelIndex);
|
||||
LogTemplate.TemplateParameters.Add(ImportTemplateParameters.message, otherIndexes[1]);
|
||||
LogTemplate.TemplateParameters.Add(ImportTemplateParameters.logger, otherIndexes.First());
|
||||
|
||||
if(intIndexes.Count > 0)
|
||||
{
|
||||
LogTemplate.TemplateParameters.Add(ImportTemplateParameters.threadid, intIndexes.Last());
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private int GetDateTimeIndex(string[] logSplit, ref ImportTemplateParameters dateTemplateParameter)
|
||||
{
|
||||
int index = -1;
|
||||
for(int i = 0; i < logSplit.Length; i++)
|
||||
{
|
||||
if(DateTime.TryParse(logSplit[i], out DateTime date))
|
||||
{
|
||||
return i;
|
||||
}
|
||||
|
||||
if(DateTime.TryParseExact(logSplit[i], "MM-dd-y HH:mm:ss.ffff", CultureInfo.InvariantCulture, DateTimeStyles.None, out DateTime dt))
|
||||
{
|
||||
return i;
|
||||
}
|
||||
|
||||
if(long.TryParse(logSplit[i], out long tickDateTime))
|
||||
{
|
||||
try
|
||||
{
|
||||
DateTime dateFromTicks = new DateTime(tickDateTime);
|
||||
dateTemplateParameter = ImportTemplateParameters.ticks;
|
||||
return i;
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
logger.Warn(e, "An error occurred while getting date time index.");
|
||||
}
|
||||
}
|
||||
}
|
||||
return index;
|
||||
}
|
||||
|
||||
private List<int> GetIntIndexes(string[] logSplit)
|
||||
{
|
||||
List<int> indexes = new List<int>();
|
||||
for(int i = 0; i < logSplit.Length; i++)
|
||||
{
|
||||
if(int.TryParse(logSplit[i], out int number))
|
||||
{
|
||||
indexes.Add(i);
|
||||
}
|
||||
}
|
||||
|
||||
return indexes;
|
||||
}
|
||||
|
||||
private int GetLogLevelIndex(string[] logSplit)
|
||||
{
|
||||
int index = -1;
|
||||
for(int i = 0; i < logSplit.Length; i++)
|
||||
{
|
||||
if(Enum.TryParse(logSplit[i].ToPascalCase(), out DashboardLogLevel level))
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return index;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
//******************************************************************************//
|
||||
// ReleaseNotesViewModel.cs
|
||||
// 12/4/2023
|
||||
//
|
||||
// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
|
||||
// PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
|
||||
// AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
|
||||
// UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
|
||||
// RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
|
||||
// CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
|
||||
// OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
|
||||
// COMPANY.
|
||||
//
|
||||
// THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. GOVERNMENT
|
||||
//
|
||||
// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
//
|
||||
// WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE
|
||||
// EXPORT OR DISCLOSURE TO NON-U.S. PERSONS, WHEREVER LOCATED, IS RESTRICTED
|
||||
// BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R. SECTION
|
||||
// 120-130) OR THE EXPORT ADMINISTRATION REGULATIONS (EAR) (15 C.F.R. SECTION
|
||||
// 730-774). THIS DOCUMENT CANNOT BE EXPORTED (E.G., PROVIDED TO A SUPPLIER
|
||||
// OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S. PERSON, WHEREVER
|
||||
// LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS
|
||||
// BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S. GOVERNMENT
|
||||
// APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL
|
||||
// PENALTIES.
|
||||
//
|
||||
// DOD 5220.22-M, INDUSTRIAL SECURITY MANUAL, CHAPTER 5, SECTION 1 THROUGH 9 :
|
||||
// FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN OR DOD 5200.1-R,
|
||||
// INFORMATION SECURITY PROGRAM, CHAPTER 6. FOR UNCLASSIFIED, LIMITED DOCUMENTS
|
||||
// DESTROY BY ANY METHOD THAT WILL PREVENT DISCLOSURE OF CONTENTS OR
|
||||
// RECONSTRUCTION OF THE DOCUMENT.
|
||||
// POC: Alex Kravchenko (1118268)
|
||||
//******************************************************************************//
|
||||
using GalaSoft.MvvmLight;
|
||||
using NLog;
|
||||
using Raytheon.LogDashboard.Model;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
using System.Windows.Media;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace Raytheon.LogDashboard.ViewModel
|
||||
{
|
||||
public class ReleaseNotesViewModel : ViewModelBase
|
||||
{
|
||||
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
|
||||
protected static LogDashViewModelLocator LocatorInstance => (Application.Current.Resources["LogDashLocator"] as LogDashViewModelLocator);
|
||||
|
||||
public List<ReleaseNotes> ReleaseNotesList { get; set; } = new List<ReleaseNotes>();
|
||||
|
||||
public ReleaseNotesViewModel()
|
||||
{
|
||||
string releaseNotesPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "ReleaseNotes.xml");
|
||||
|
||||
if(File.Exists(releaseNotesPath))
|
||||
{
|
||||
try
|
||||
{
|
||||
XmlSerializer ser = new XmlSerializer(ReleaseNotesList.GetType());
|
||||
using(FileStream fs = new FileStream(releaseNotesPath, FileMode.Open, FileAccess.Read))
|
||||
{
|
||||
ReleaseNotesList = (List<ReleaseNotes>)ser.Deserialize(fs);
|
||||
}
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
logger.Warn(e, "An error occurred while read Release Notes file.");
|
||||
}
|
||||
}
|
||||
|
||||
if(ReleaseNotesList.Any())
|
||||
{
|
||||
ReleaseNotesList.First().IsExpanded = true;
|
||||
}
|
||||
}
|
||||
public SolidColorBrush IconColor
|
||||
{
|
||||
get => SelectedColorTheme.Color;
|
||||
}
|
||||
public ColorTheme SelectedColorTheme
|
||||
{
|
||||
get => LocatorInstance.SelectedColorTheme;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
//******************************************************************************//
|
||||
// SearchResultViewModel.cs
|
||||
// 12/4/2023
|
||||
//
|
||||
// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
|
||||
// PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
|
||||
// AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
|
||||
// UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
|
||||
// RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
|
||||
// CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
|
||||
// OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
|
||||
// COMPANY.
|
||||
//
|
||||
// THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. GOVERNMENT
|
||||
//
|
||||
// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
//
|
||||
// WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE
|
||||
// EXPORT OR DISCLOSURE TO NON-U.S. PERSONS, WHEREVER LOCATED, IS RESTRICTED
|
||||
// BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R. SECTION
|
||||
// 120-130) OR THE EXPORT ADMINISTRATION REGULATIONS (EAR) (15 C.F.R. SECTION
|
||||
// 730-774). THIS DOCUMENT CANNOT BE EXPORTED (E.G., PROVIDED TO A SUPPLIER
|
||||
// OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S. PERSON, WHEREVER
|
||||
// LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS
|
||||
// BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S. GOVERNMENT
|
||||
// APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL
|
||||
// PENALTIES.
|
||||
//
|
||||
// DOD 5220.22-M, INDUSTRIAL SECURITY MANUAL, CHAPTER 5, SECTION 1 THROUGH 9 :
|
||||
// FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN OR DOD 5200.1-R,
|
||||
// INFORMATION SECURITY PROGRAM, CHAPTER 6. FOR UNCLASSIFIED, LIMITED DOCUMENTS
|
||||
// DESTROY BY ANY METHOD THAT WILL PREVENT DISCLOSURE OF CONTENTS OR
|
||||
// RECONSTRUCTION OF THE DOCUMENT.
|
||||
// POC: Alex Kravchenko (1118268)
|
||||
//******************************************************************************//
|
||||
using GalaSoft.MvvmLight;
|
||||
using GalaSoft.MvvmLight.CommandWpf;
|
||||
using Raytheon.LogDashboard.Model;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Windows;
|
||||
|
||||
namespace Raytheon.LogDashboard.ViewModel
|
||||
{
|
||||
public class SearchResultViewModel : ViewModelBase
|
||||
{
|
||||
private LogMessage selectedLog;
|
||||
|
||||
public ObservableCollection<LogMessage> SearchResult { get; set; } = new ObservableCollection<LogMessage>();
|
||||
|
||||
public LogMessage SelectedLog
|
||||
{
|
||||
get => selectedLog;
|
||||
set => Set(() => SelectedLog, ref selectedLog, value);
|
||||
}
|
||||
|
||||
public string HighlightSearchText { get; set; }
|
||||
|
||||
public bool IsMatchCase { get; set; }
|
||||
|
||||
private RelayCommand copyMessageCommand;
|
||||
|
||||
public RelayCommand CopyMessageCommand => copyMessageCommand ?? (copyMessageCommand = new RelayCommand(CopyMessage));
|
||||
|
||||
private void CopyMessage()
|
||||
{
|
||||
if(SelectedLog == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Clipboard.SetDataObject(SelectedLog.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
//******************************************************************************//
|
||||
// SelectTimeIntervalViewModel.cs
|
||||
// 12/4/2023
|
||||
//
|
||||
// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
|
||||
// PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
|
||||
// AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
|
||||
// UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
|
||||
// RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
|
||||
// CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
|
||||
// OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
|
||||
// COMPANY.
|
||||
//
|
||||
// THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. GOVERNMENT
|
||||
//
|
||||
// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
//
|
||||
// WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE
|
||||
// EXPORT OR DISCLOSURE TO NON-U.S. PERSONS, WHEREVER LOCATED, IS RESTRICTED
|
||||
// BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R. SECTION
|
||||
// 120-130) OR THE EXPORT ADMINISTRATION REGULATIONS (EAR) (15 C.F.R. SECTION
|
||||
// 730-774). THIS DOCUMENT CANNOT BE EXPORTED (E.G., PROVIDED TO A SUPPLIER
|
||||
// OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S. PERSON, WHEREVER
|
||||
// LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS
|
||||
// BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S. GOVERNMENT
|
||||
// APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL
|
||||
// PENALTIES.
|
||||
//
|
||||
// DOD 5220.22-M, INDUSTRIAL SECURITY MANUAL, CHAPTER 5, SECTION 1 THROUGH 9 :
|
||||
// FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN OR DOD 5200.1-R,
|
||||
// INFORMATION SECURITY PROGRAM, CHAPTER 6. FOR UNCLASSIFIED, LIMITED DOCUMENTS
|
||||
// DESTROY BY ANY METHOD THAT WILL PREVENT DISCLOSURE OF CONTENTS OR
|
||||
// RECONSTRUCTION OF THE DOCUMENT.
|
||||
// POC: Alex Kravchenko (1118268)
|
||||
//******************************************************************************//
|
||||
using GalaSoft.MvvmLight;
|
||||
using System;
|
||||
using System.Windows.Media;
|
||||
using System.Windows;
|
||||
using Raytheon.LogDashboard.Helpers;
|
||||
using Raytheon.LogDashboard.Model;
|
||||
|
||||
namespace Raytheon.LogDashboard.ViewModel
|
||||
{
|
||||
public class SelectTimeIntervalViewModel : ViewModelBase
|
||||
{
|
||||
protected static LogDashViewModelLocator LocatorInstance => (Application.Current.Resources["LogDashLocator"] as LogDashViewModelLocator);
|
||||
|
||||
public void SetSelectTimeInterval(DateTime? currentLogDateTime)
|
||||
{
|
||||
if(currentLogDateTime.HasValue)
|
||||
{
|
||||
_selectedDateTimeFrom = currentLogDateTime.Value;
|
||||
_selectedDateTimeTo = currentLogDateTime.Value;
|
||||
}
|
||||
}
|
||||
|
||||
public ColorTheme SelectedColorTheme
|
||||
{
|
||||
get => LocatorInstance.SelectedColorTheme;
|
||||
}
|
||||
|
||||
private DateTime _selectedDateTimeFrom = DateTime.Now;
|
||||
public DateTime SelectedDateTimeFrom
|
||||
{
|
||||
get => _selectedDateTimeFrom;
|
||||
set => Set(() => SelectedDateTimeFrom, ref _selectedDateTimeFrom, value);
|
||||
}
|
||||
|
||||
private DateTime _selectedDateTimeTo = DateTime.Now;
|
||||
public DateTime SelectedDateTimeTo
|
||||
{
|
||||
get => _selectedDateTimeTo;
|
||||
set => Set(() => SelectedDateTimeTo, ref _selectedDateTimeTo, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
832
Source/LogDashboard/LogDashboard/ViewModel/SettingsViewModel.cs
Normal file
832
Source/LogDashboard/LogDashboard/ViewModel/SettingsViewModel.cs
Normal file
@@ -0,0 +1,832 @@
|
||||
//******************************************************************************//
|
||||
// SettingsViewModel.cs
|
||||
// 12/4/2023
|
||||
//
|
||||
// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
|
||||
// PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
|
||||
// AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
|
||||
// UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
|
||||
// RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
|
||||
// CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
|
||||
// OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
|
||||
// COMPANY.
|
||||
//
|
||||
// THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. GOVERNMENT
|
||||
//
|
||||
// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
//
|
||||
// WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE
|
||||
// EXPORT OR DISCLOSURE TO NON-U.S. PERSONS, WHEREVER LOCATED, IS RESTRICTED
|
||||
// BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R. SECTION
|
||||
// 120-130) OR THE EXPORT ADMINISTRATION REGULATIONS (EAR) (15 C.F.R. SECTION
|
||||
// 730-774). THIS DOCUMENT CANNOT BE EXPORTED (E.G., PROVIDED TO A SUPPLIER
|
||||
// OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S. PERSON, WHEREVER
|
||||
// LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS
|
||||
// BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S. GOVERNMENT
|
||||
// APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL
|
||||
// PENALTIES.
|
||||
//
|
||||
// DOD 5220.22-M, INDUSTRIAL SECURITY MANUAL, CHAPTER 5, SECTION 1 THROUGH 9 :
|
||||
// FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN OR DOD 5200.1-R,
|
||||
// INFORMATION SECURITY PROGRAM, CHAPTER 6. FOR UNCLASSIFIED, LIMITED DOCUMENTS
|
||||
// DESTROY BY ANY METHOD THAT WILL PREVENT DISCLOSURE OF CONTENTS OR
|
||||
// RECONSTRUCTION OF THE DOCUMENT.
|
||||
// POC: Alex Kravchenko (1118268)
|
||||
//******************************************************************************//
|
||||
|
||||
// Ignore Spelling: Taskbar
|
||||
|
||||
using NLog;
|
||||
using Raytheon.LogDashboard.Helpers;
|
||||
using Raytheon.LogDashboard.Model;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Web.UI.WebControls;
|
||||
using System.Windows.Media;
|
||||
using System.Windows;
|
||||
using GalaSoft.MvvmLight;
|
||||
using GalaSoft.MvvmLight.CommandWpf;
|
||||
using Raytheon.LogDashboard.View;
|
||||
using Settings = Raytheon.LogDashboard.Model.Settings;
|
||||
using GalaSoft.MvvmLight.Messaging;
|
||||
using System.Threading.Tasks;
|
||||
using System.IO;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Threading;
|
||||
using System.Text.RegularExpressions;
|
||||
using Raytheon.Common;
|
||||
using Microsoft.WindowsAPICodePack.Dialogs;
|
||||
|
||||
namespace Raytheon.LogDashboard.ViewModel
|
||||
{
|
||||
public class SettingsViewModel : ViewModelBase
|
||||
{
|
||||
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
|
||||
|
||||
private ObservableCollection<Receiver> receivers = new ObservableCollection<Receiver>();
|
||||
private ObservableCollection<IgnoredIPAddr> ignoredIpAdresses = new ObservableCollection<IgnoredIPAddr>();
|
||||
|
||||
private const string ErrorLogger32DefaultLocation = @"%AppData%\Raytheon\ErrorLogger\ErrorLogger.ini";
|
||||
private const string ErrorLogger64DefaultLocation = @"%AppData%\Raytheon\ErrorLogger64\ErrorLogger64.ini";
|
||||
|
||||
protected static LogDashViewModelLocator LocatorInstance => (Application.Current.Resources["LogDashLocator"] as LogDashViewModelLocator);
|
||||
|
||||
private CancellationTokenSource _ctsPersistingLogMessages;
|
||||
private readonly ConcurrentQueue<LogMessage> _persistingLogQueue = new ConcurrentQueue<LogMessage>();
|
||||
private FileSystemWatcher _errorLoggerWatcher;
|
||||
|
||||
private string currentThemeName = string.Empty;
|
||||
|
||||
#region Properties
|
||||
|
||||
public ObservableCollection<Receiver> Receivers
|
||||
{
|
||||
get => new ObservableCollection<Receiver>(receivers.Where(r => !r.IsHidden));
|
||||
set => Set(() => Receivers, ref receivers, value);
|
||||
}
|
||||
public ObservableCollection<IgnoredIPAddr> IgnoredIPAddresses
|
||||
{
|
||||
get => ignoredIpAdresses;
|
||||
set
|
||||
{
|
||||
if(value != null)
|
||||
{
|
||||
ignoredIpAdresses = new ObservableCollection<IgnoredIPAddr>(value.OrderBy(x => x.IP));
|
||||
RaisePropertyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private bool isConfigurationVisible = false;
|
||||
public bool IsConfigurationVisible
|
||||
{
|
||||
get => isConfigurationVisible;
|
||||
set => Set(() => IsConfigurationVisible, ref isConfigurationVisible, value);
|
||||
}
|
||||
|
||||
private bool isAutoStartReadAtStartup = true;
|
||||
public bool IsAutoStartReadAtStartup
|
||||
{
|
||||
get => isAutoStartReadAtStartup;
|
||||
set => Set(() => IsAutoStartReadAtStartup, ref isAutoStartReadAtStartup, value);
|
||||
}
|
||||
|
||||
private bool minimizeToTray = false;
|
||||
public bool MinimizeToTray
|
||||
{
|
||||
get => minimizeToTray;
|
||||
set => Set(() => MinimizeToTray, ref minimizeToTray, value);
|
||||
}
|
||||
|
||||
private bool isEnableMaxMessageBufferSize = false;
|
||||
public bool IsEnableMaxMessageBufferSize
|
||||
{
|
||||
get => isEnableMaxMessageBufferSize;
|
||||
set => Set(() => IsEnableMaxMessageBufferSize, ref isEnableMaxMessageBufferSize, value);
|
||||
}
|
||||
|
||||
private int maxMessageBufferSize;
|
||||
public int MaxMessageBufferSize
|
||||
{
|
||||
get => maxMessageBufferSize;
|
||||
set => Set(() => MaxMessageBufferSize, ref maxMessageBufferSize, value);
|
||||
}
|
||||
|
||||
private int deletedMessagesCount;
|
||||
public int DeletedMessagesCount
|
||||
{
|
||||
get => deletedMessagesCount;
|
||||
set
|
||||
{
|
||||
if(value >= MaxMessageBufferSize)
|
||||
{
|
||||
deletedMessagesCount = MaxMessageBufferSize;
|
||||
}
|
||||
|
||||
if(value <= 0)
|
||||
{
|
||||
deletedMessagesCount = 1;
|
||||
}
|
||||
|
||||
if(value > 0 && value < MaxMessageBufferSize)
|
||||
{
|
||||
deletedMessagesCount = value;
|
||||
}
|
||||
|
||||
RaisePropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
private bool onlyOneAppInstance = true;
|
||||
public bool OnlyOneAppInstance
|
||||
{
|
||||
get => onlyOneAppInstance;
|
||||
set => Set(() => OnlyOneAppInstance, ref onlyOneAppInstance, value);
|
||||
}
|
||||
|
||||
private string displayedDataFormat = "MM/dd/yyyy HH:mm:ss.fff";
|
||||
public string DisplayedDataFormat
|
||||
{
|
||||
get => displayedDataFormat;
|
||||
set => Set(() => DisplayedDataFormat, ref displayedDataFormat, value);
|
||||
}
|
||||
|
||||
private string typedIP;
|
||||
public string TypedIP
|
||||
{
|
||||
get => typedIP;
|
||||
set => Set(() => TypedIP, ref typedIP, value);
|
||||
}
|
||||
|
||||
private IgnoredIPAddr selectedIP;
|
||||
public IgnoredIPAddr SelectedIP
|
||||
{
|
||||
get => selectedIP;
|
||||
set => Set(() => SelectedIP, ref selectedIP, value);
|
||||
}
|
||||
|
||||
private Receiver selectedReceiver;
|
||||
public Receiver SelectedReceiver
|
||||
{
|
||||
get => selectedReceiver;
|
||||
set
|
||||
{
|
||||
selectedReceiver = value;
|
||||
IsConfigurationVisible = selectedReceiver != null;
|
||||
RaisePropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public static List<ColorTheme> ColorThemes => Settings.ColorThemes;
|
||||
public static List<string> Themes => Settings.Themes;
|
||||
|
||||
public string ExampleDateTime { get; set; }
|
||||
|
||||
public List<string> DataFormats { get; set; } = new List<string>
|
||||
{
|
||||
"MM/dd/yyyy HH:mm",
|
||||
"MM/dd/yyyy HH:mm:ss",
|
||||
"MM/dd/yyyy HH:mm:ss.fff",
|
||||
"HH:mm",
|
||||
"HH:mm:ss",
|
||||
"HH:mm:ss.fff",
|
||||
"MM/dd/yyyy"
|
||||
};
|
||||
|
||||
private string selectedDataFormat;
|
||||
public string SelectedDataFormat
|
||||
{
|
||||
get => selectedDataFormat;
|
||||
set
|
||||
{
|
||||
selectedDataFormat = value;
|
||||
ExampleDateTime = DateTime.Now.ToString(selectedDataFormat);
|
||||
RaisePropertyChanged(nameof(ExampleDateTime));
|
||||
RaisePropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public string SelectedTheme
|
||||
{
|
||||
get => LocatorInstance.SelectedTheme;
|
||||
set => LocatorInstance.SelectedTheme = value;
|
||||
}
|
||||
|
||||
public int SelectedColorIndex
|
||||
{
|
||||
get => ColorThemes.FindIndex(c => c.Name == SelectedColorTheme.Name);
|
||||
set => SelectedColorTheme = ColorThemes[value];
|
||||
}
|
||||
|
||||
public ColorTheme SelectedColorTheme
|
||||
{
|
||||
get => LocatorInstance.SelectedColorTheme;
|
||||
set
|
||||
{
|
||||
LocatorInstance.SelectedColorTheme = value;
|
||||
RaisePropertyChanged(() => IconColor);
|
||||
}
|
||||
}
|
||||
public SolidColorBrush IconColor
|
||||
{
|
||||
get => SelectedColorTheme.Color;
|
||||
}
|
||||
|
||||
private bool isShowSourceColumn;
|
||||
public bool IsShowSourceColumn
|
||||
{
|
||||
get => isShowSourceColumn;
|
||||
set => Set(() => IsShowSourceColumn, ref isShowSourceColumn, value);
|
||||
}
|
||||
|
||||
private bool isShowThreadColumn;
|
||||
public bool IsShowThreadColumn
|
||||
{
|
||||
get => isShowThreadColumn;
|
||||
set => Set(() => IsShowThreadColumn, ref isShowThreadColumn, value);
|
||||
}
|
||||
|
||||
private bool isShowTaskbarProgress;
|
||||
public bool IsShowTaskbarProgress
|
||||
{
|
||||
get => isShowTaskbarProgress;
|
||||
set => Set(() => IsShowTaskbarProgress, ref isShowTaskbarProgress, value);
|
||||
}
|
||||
|
||||
private bool showMessageHighlightByReceiverColor;
|
||||
public bool ShowMessageHighlightByReceiverColor
|
||||
{
|
||||
get => showMessageHighlightByReceiverColor;
|
||||
set => Set(() => ShowMessageHighlightByReceiverColor, ref showMessageHighlightByReceiverColor, value);
|
||||
}
|
||||
|
||||
private bool isSeparateIPLoggersByPort;
|
||||
public bool IsSeparateIPLoggersByPort
|
||||
{
|
||||
get => isSeparateIPLoggersByPort;
|
||||
set => Set(() => IsSeparateIPLoggersByPort, ref isSeparateIPLoggersByPort, value);
|
||||
}
|
||||
|
||||
private bool isErrorLogger;
|
||||
public bool IsErrorLogger
|
||||
{
|
||||
get => isErrorLogger;
|
||||
set
|
||||
{
|
||||
Set(() => IsErrorLogger, ref isErrorLogger, value);
|
||||
RaisePropertyChanged(nameof(IsAutoSaveEnabled));
|
||||
}
|
||||
}
|
||||
|
||||
public string Version { get; set; } = Assembly.GetExecutingAssembly().GetName().Version.ToString();
|
||||
|
||||
public bool EmbeddedMode { get => !Settings.Instance.EmbeddedMode; }
|
||||
|
||||
private bool isAutoSave;
|
||||
public bool IsAutoSave
|
||||
{
|
||||
get => isAutoSave;
|
||||
set
|
||||
{
|
||||
Set(() => IsAutoSave, ref isAutoSave, value);
|
||||
RaisePropertyChanged(nameof(IsAutoSaveEnabled));
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsAutoSaveEnabled
|
||||
{
|
||||
get => isAutoSave && !IsErrorLogger;
|
||||
}
|
||||
|
||||
private string autoSaveLocation;
|
||||
public string AutoSaveLocation
|
||||
{
|
||||
get => autoSaveLocation;
|
||||
set => Set(() => AutoSaveLocation, ref autoSaveLocation, value);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public SettingsViewModel()
|
||||
{
|
||||
//ParseTheme();
|
||||
|
||||
Messenger.Default.Register<LogMessage>(this, "PersistLogMessage", PersistLogMessage);
|
||||
|
||||
try
|
||||
{
|
||||
Receivers = new ObservableCollection<Receiver>(Settings.Instance.Receivers);
|
||||
IgnoredIPAddresses = new ObservableCollection<IgnoredIPAddr>(Settings.Instance.IgnoredIPs);
|
||||
IsAutoStartReadAtStartup = Settings.Instance.AutoStartInStartup;
|
||||
MinimizeToTray = Settings.Instance.MinimizeToTray;
|
||||
OnlyOneAppInstance = Settings.Instance.OnlyOneAppInstance;
|
||||
SelectedDataFormat = Settings.Instance.DataFormat;
|
||||
DisplayedDataFormat = Settings.Instance.DataFormat;
|
||||
IsEnableMaxMessageBufferSize = Settings.Instance.IsEnabledMaxMessageBufferSize;
|
||||
MaxMessageBufferSize = Settings.Instance.MaxMessageBufferSize;
|
||||
DeletedMessagesCount = Settings.Instance.DeletedMessagesCount;
|
||||
ExampleDateTime = DateTime.Now.ToString(DisplayedDataFormat);
|
||||
IsShowSourceColumn = Settings.Instance.IsShowSourceColumn;
|
||||
IsShowThreadColumn = Settings.Instance.IsShowThreadColumn;
|
||||
IsShowTaskbarProgress = Settings.Instance.IsShowTaskbarProgress;
|
||||
ShowMessageHighlightByReceiverColor = Settings.Instance.ShowMessageHighlightByReceiverColor;
|
||||
IsSeparateIPLoggersByPort = Settings.Instance.IsSeparateIPLoggersByPort;
|
||||
IsAutoSave = Settings.Instance.IsAutoSave;
|
||||
AutoSaveLocation = Settings.Instance.AutoSaveLocation;
|
||||
IsErrorLogger = Settings.Instance.IsErrorLogger;
|
||||
|
||||
var themeColor = Settings.ColorThemes.FirstOrDefault(x => x.Name == Settings.Instance.CurrentColorTheme.Name);
|
||||
if(themeColor != null)
|
||||
{
|
||||
SelectedColorTheme = themeColor;
|
||||
}
|
||||
|
||||
if(IsAutoSave)
|
||||
{
|
||||
StartPersistingLogMessages();
|
||||
}
|
||||
|
||||
SelectedTheme = Settings.Instance.CurrentTheme;
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
logger.Warn(e, "SettingsViewModel: An error occurred while get receivers settings.");
|
||||
}
|
||||
}
|
||||
|
||||
#region Commands
|
||||
|
||||
private RelayCommand browseLocationCommand;
|
||||
public RelayCommand BrowseLocationCommand => browseLocationCommand ?? (browseLocationCommand = new RelayCommand(BrowseLocation));
|
||||
|
||||
private RelayCommand addReceiverCommand;
|
||||
public RelayCommand AddReceiverCommand => addReceiverCommand ?? (addReceiverCommand = new RelayCommand(AddReceiver));
|
||||
|
||||
private RelayCommand removeReceiverCommand;
|
||||
public RelayCommand RemoveReceiverCommand => removeReceiverCommand ?? (removeReceiverCommand = new RelayCommand(RemoveReceiver));
|
||||
|
||||
private RelayCommand removeIgnoreIPCommand;
|
||||
public RelayCommand RemoveIgnoreIPCommand => removeIgnoreIPCommand ?? (removeIgnoreIPCommand = new RelayCommand(RemoveIgnoreIP));
|
||||
|
||||
private RelayCommand addIgnoreIPCommand;
|
||||
public RelayCommand AddIgnoreIPCommand => addIgnoreIPCommand ?? (addIgnoreIPCommand = new RelayCommand(AddIgnoreIP));
|
||||
|
||||
private RelayCommand saveCommand;
|
||||
public RelayCommand SaveCommand => saveCommand ?? (saveCommand = new RelayCommand(Save));
|
||||
|
||||
private RelayCommand сancelCommand;
|
||||
public RelayCommand CancelCommand => сancelCommand ?? (сancelCommand = new RelayCommand(Cancel));
|
||||
|
||||
private RelayCommand showReleaseNotesCommand;
|
||||
public RelayCommand ShowReleaseNotesCommand => showReleaseNotesCommand ?? (showReleaseNotesCommand = new RelayCommand(ShowReleaseNotes));
|
||||
|
||||
#endregion
|
||||
|
||||
private void BrowseLocation()
|
||||
{
|
||||
string loc = SelectErrorLoggerLocation();
|
||||
|
||||
if(string.IsNullOrEmpty(loc))
|
||||
{
|
||||
if(receivers.Any(r => r.ReceiverType == ReceiverType.ErrorLogger && r.ErrorLoggerType == ErrorLoggerType.BIT_64))
|
||||
{
|
||||
loc = ErrorLogger64DefaultLocation;
|
||||
}
|
||||
else
|
||||
{
|
||||
loc = ErrorLogger32DefaultLocation;
|
||||
}
|
||||
}
|
||||
|
||||
AutoSaveLocation = loc;
|
||||
}
|
||||
|
||||
private string SelectErrorLoggerLocation()
|
||||
{
|
||||
using(CommonOpenFileDialog folderDialog = new CommonOpenFileDialog())
|
||||
{
|
||||
folderDialog.IsFolderPicker = true;
|
||||
folderDialog.Title = "Select folder for Logging or Navigate to the ErrorLogger.ini file";
|
||||
|
||||
if(folderDialog.ShowDialog() == CommonFileDialogResult.Ok)
|
||||
{
|
||||
return folderDialog.FileName;
|
||||
}
|
||||
else
|
||||
{
|
||||
// User canceled the dialog
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void AddReceiver()
|
||||
{
|
||||
receivers.Add(new Receiver("UDP", "", ReceiverType.UDP, receivers.Select(r => r.Name)));
|
||||
RaisePropertyChanged(() => Receivers);
|
||||
}
|
||||
|
||||
private void RemoveReceiver()
|
||||
{
|
||||
if(!receivers.Any())
|
||||
{
|
||||
IsConfigurationVisible = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
receivers.Remove(SelectedReceiver);
|
||||
}
|
||||
RaisePropertyChanged(() => Receivers);
|
||||
}
|
||||
|
||||
private void AddIgnoreIP()
|
||||
{
|
||||
if(IgnoredIPAddresses.All(x => !x.IP.Contains(TypedIP)))
|
||||
{
|
||||
IgnoredIPAddresses.Add(new IgnoredIPAddr { IP = TypedIP });
|
||||
}
|
||||
}
|
||||
|
||||
private void RemoveIgnoreIP()
|
||||
{
|
||||
IgnoredIPAddresses.Remove(SelectedIP);
|
||||
}
|
||||
|
||||
private void Save()
|
||||
{
|
||||
if(receivers.Where(r => r.ReceiverType == ReceiverType.UDP).DistinctBy(x => x.Port).Count() !=
|
||||
receivers.Count(r => r.ReceiverType == ReceiverType.UDP))
|
||||
{
|
||||
Messenger.Default.Send("Please Select Unique Port Numbers for UDP Receivers", "DisplayCustomMessage");
|
||||
return;
|
||||
}
|
||||
|
||||
Settings.Instance.MinimizeToTray = MinimizeToTray;
|
||||
Settings.Instance.AutoStartInStartup = IsAutoStartReadAtStartup;
|
||||
Settings.Instance.IsShowSourceColumn = IsShowSourceColumn;
|
||||
Settings.Instance.IsShowThreadColumn = IsShowThreadColumn;
|
||||
Settings.Instance.IsShowTaskbarProgress = IsShowTaskbarProgress;
|
||||
Settings.Instance.ShowMessageHighlightByReceiverColor = ShowMessageHighlightByReceiverColor;
|
||||
Settings.Instance.CurrentColorTheme = SelectedColorTheme;
|
||||
Settings.Instance.DataFormat = SelectedDataFormat;
|
||||
Settings.Instance.IgnoredIPs = IgnoredIPAddresses.ToList();
|
||||
Settings.Instance.Receivers = receivers.ToList();
|
||||
Settings.Instance.FontColor = SelectedColorTheme.Color.ToARGB();
|
||||
Settings.Instance.IsEnabledMaxMessageBufferSize = IsEnableMaxMessageBufferSize;
|
||||
Settings.Instance.MaxMessageBufferSize = MaxMessageBufferSize;
|
||||
Settings.Instance.DeletedMessagesCount = DeletedMessagesCount;
|
||||
Settings.Instance.OnlyOneAppInstance = OnlyOneAppInstance;
|
||||
Settings.Instance.IsSeparateIPLoggersByPort = IsSeparateIPLoggersByPort;
|
||||
Settings.Instance.IsAutoSave = IsAutoSave;
|
||||
Settings.Instance.AutoSaveLocation = AutoSaveLocation;
|
||||
Settings.Instance.IsErrorLogger = IsErrorLogger;
|
||||
|
||||
if(!string.IsNullOrEmpty(currentThemeName) && SelectedColorTheme.Name != currentThemeName)
|
||||
{
|
||||
Settings.Instance.ApplyTheme();
|
||||
}
|
||||
Settings.Instance.CurrentTheme = SelectedTheme;
|
||||
|
||||
Settings.Instance.Save();
|
||||
|
||||
Messenger.Default.Send(true, "SaveSettings");
|
||||
|
||||
if(IsAutoSave)
|
||||
{
|
||||
StopMonitoringErrorLogger();
|
||||
StopPersistingLogMessages();
|
||||
Thread.Sleep(200);
|
||||
StartPersistingLogMessages();
|
||||
}
|
||||
else
|
||||
{
|
||||
StopMonitoringErrorLogger();
|
||||
StopPersistingLogMessages();
|
||||
}
|
||||
}
|
||||
|
||||
private void Cancel()
|
||||
{
|
||||
Messenger.Default.Send(false, "SaveSettings");
|
||||
}
|
||||
|
||||
private void ShowReleaseNotes()
|
||||
{
|
||||
ReleaseNotesDialog releaseNotesDialog = new ReleaseNotesDialog
|
||||
{
|
||||
DataContext = new ReleaseNotesViewModel()
|
||||
};
|
||||
releaseNotesDialog.ShowDialog();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// identifies the log file location first and then starts writing messages to that file
|
||||
/// </summary>
|
||||
private void StartPersistingLogMessages()
|
||||
{
|
||||
if(!IsAutoSave)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
string baseFileName = string.Empty;
|
||||
|
||||
// if error logger was selected by the user use the location from the ini file
|
||||
if(IsErrorLogger)
|
||||
{
|
||||
string errorLoggerLocation = LogDashViewModelLocator.LogDashboard.GetErrorLoggerLocation();
|
||||
|
||||
FileInfo fileInfo = new FileInfo(errorLoggerLocation);
|
||||
|
||||
// special case for error logger.
|
||||
if(fileInfo.Exists)
|
||||
{
|
||||
IConfigurationFile configurationFile = new ConfigurationFile(errorLoggerLocation);
|
||||
string location = configurationFile.ReadValue("ErrorLogger", "LogPath", "");
|
||||
if(!string.IsNullOrEmpty(location))
|
||||
{
|
||||
baseFileName = location;
|
||||
|
||||
StopMonitoringErrorLogger();
|
||||
|
||||
string directory = Path.GetDirectoryName(errorLoggerLocation);
|
||||
string fileName = Path.GetFileName(errorLoggerLocation);
|
||||
|
||||
_errorLoggerWatcher = new FileSystemWatcher
|
||||
{
|
||||
Path = directory,
|
||||
Filter = fileName,
|
||||
NotifyFilter = NotifyFilters.LastWrite
|
||||
};
|
||||
_errorLoggerWatcher.Changed += ErrorLoggerChanged;
|
||||
_errorLoggerWatcher.EnableRaisingEvents = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(string.IsNullOrEmpty(AutoSaveLocation))
|
||||
{
|
||||
AutoSaveLocation = PopulateDefaultAutoSaveLocation();
|
||||
}
|
||||
|
||||
string autoSaveLocation = ReplaceDatePatterns(AutoSaveLocation);
|
||||
|
||||
// get the file attributes for file or directory
|
||||
DirectoryInfo directoryInfo = new DirectoryInfo(autoSaveLocation);
|
||||
if(directoryInfo.IsDirectory())
|
||||
{
|
||||
if(!Directory.Exists(autoSaveLocation))
|
||||
{
|
||||
// The directory does not exist, so create it
|
||||
Directory.CreateDirectory(autoSaveLocation);
|
||||
}
|
||||
baseFileName = Path.Combine(autoSaveLocation, "LogDashboard.log");
|
||||
}
|
||||
}
|
||||
|
||||
StartPersistingLogMessagesNow(baseFileName);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// starts a thread for writing log messages to the designated location
|
||||
/// </summary>
|
||||
/// <param name="baseFileName"></param>
|
||||
private void StartPersistingLogMessagesNow(string baseFileName)
|
||||
{
|
||||
if(string.IsNullOrEmpty(baseFileName))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
StopPersistingLogMessages();
|
||||
_ctsPersistingLogMessages = new CancellationTokenSource();
|
||||
Task.Run(() => MonitorPersistingLogQueue(_persistingLogQueue, _ctsPersistingLogMessages.Token, baseFileName, Settings.Instance.AutoSaveMaxSize));
|
||||
}
|
||||
|
||||
private void ErrorLoggerChanged(object sender, FileSystemEventArgs e)
|
||||
{
|
||||
IConfigurationFile configurationFile = new ConfigurationFile(e.FullPath);
|
||||
string location = configurationFile.ReadValue("ErrorLogger", "LogPath", "");
|
||||
if(!string.IsNullOrEmpty(location))
|
||||
{
|
||||
StartPersistingLogMessagesNow(location);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// if error logger was selected for monitoring changes for the file location
|
||||
/// stops monitoring the file.
|
||||
/// </summary>
|
||||
public void StopMonitoringErrorLogger()
|
||||
{
|
||||
if(_errorLoggerWatcher == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_errorLoggerWatcher.EnableRaisingEvents = false;
|
||||
_errorLoggerWatcher.Dispose();
|
||||
_errorLoggerWatcher = null;
|
||||
}
|
||||
|
||||
private string PopulateDefaultAutoSaveLocation()
|
||||
{
|
||||
string configPath = LocatorInstance.ErrorLogger32DefaultLocation;
|
||||
if(File.Exists(configPath))
|
||||
{
|
||||
IConfigurationFile config = new ConfigurationFile(configPath);
|
||||
if(config.ValueExists("ErrorLogger", "LogPath"))
|
||||
{
|
||||
return config.ReadValue("ErrorLogger", "LogPath", "");
|
||||
}
|
||||
}
|
||||
string configPath64 = LocatorInstance.ErrorLogger64DefaultLocation;
|
||||
if(File.Exists(configPath64))
|
||||
{
|
||||
IConfigurationFile config = new ConfigurationFile(configPath);
|
||||
if(config.ValueExists("ErrorLogger64", "LogPath"))
|
||||
{
|
||||
return config.ReadValue("ErrorLogger64", "LogPath", "");
|
||||
}
|
||||
}
|
||||
return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "LogDashboard");
|
||||
}
|
||||
|
||||
public static string ReplaceDatePatterns(string input)
|
||||
{
|
||||
// Define the regex pattern for yyyy-mm-dd or yyyy-mm
|
||||
string pattern = @"(yyyy)-((mm)|(MM))(-dd)?";
|
||||
|
||||
// Replace the matched patterns with actual date components
|
||||
string result = Regex.Replace(input, pattern, match =>
|
||||
{
|
||||
bool year = match.Groups[1].Success;
|
||||
bool month = match.Groups[3].Success || match.Groups[4].Success;
|
||||
bool day = match.Groups[5].Success;
|
||||
|
||||
return year ? DateTime.Now.ToString($"yyyy{(month ? "-MM" : "")}{(day ? "-dd" : "")}") : "";
|
||||
});
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// generates unique file name
|
||||
/// </summary>
|
||||
/// <param name="existingFilePath"></param>
|
||||
/// <returns></returns>
|
||||
private static string GenerateUniqueFileNameDyDateTime(string existingFilePath)
|
||||
{
|
||||
string directory = Path.GetDirectoryName(existingFilePath);
|
||||
string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(existingFilePath);
|
||||
string extension = Path.GetExtension(existingFilePath);
|
||||
|
||||
// Append a timestamp to the original filename
|
||||
string uniqueFileName = $"{fileNameWithoutExtension}_{DateTime.Now:MMddHHmmss}{extension}";
|
||||
|
||||
// Combine with the directory path
|
||||
return Path.Combine(directory, uniqueFileName);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Stops recording messages into a rolling file
|
||||
/// </summary>
|
||||
public void StopPersistingLogMessages()
|
||||
{
|
||||
_ctsPersistingLogMessages?.Cancel();
|
||||
Thread.Sleep(400);
|
||||
_ctsPersistingLogMessages?.Dispose();
|
||||
_ctsPersistingLogMessages = null;
|
||||
ClearQueue(_persistingLogQueue);
|
||||
}
|
||||
|
||||
private void PersistLogMessage(LogMessage logMessage)
|
||||
{
|
||||
_persistingLogQueue.Enqueue(logMessage);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// open log file and write LogMessage to it, until reaches the max size limit
|
||||
/// then it rolls over to the next file
|
||||
/// </summary>
|
||||
/// <param name="queue"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <param name="fileName"></param>
|
||||
private static void MonitorPersistingLogQueue(ConcurrentQueue<LogMessage> queue, CancellationToken cancellationToken, string baseFileName, long maxFileSize)
|
||||
{
|
||||
FileStream fileStream = null;
|
||||
StreamWriter writer = null;
|
||||
bool rollOver = false;
|
||||
|
||||
try
|
||||
{
|
||||
while(!cancellationToken.IsCancellationRequested)
|
||||
{
|
||||
// Open the base file for writing
|
||||
fileStream = new FileStream(baseFileName, FileMode.OpenOrCreate, FileAccess.Write);
|
||||
writer = new StreamWriter(fileStream)
|
||||
{
|
||||
AutoFlush = true
|
||||
};
|
||||
|
||||
// Move the stream position to the end of the file
|
||||
fileStream.Seek(0, SeekOrigin.End);
|
||||
|
||||
while(fileStream.Length < maxFileSize && !cancellationToken.IsCancellationRequested)
|
||||
{
|
||||
if(queue.TryDequeue(out var logMessage))
|
||||
{
|
||||
string message = $"{logMessage.Time:MM-dd-yy HH:mm:ss.ffff};{logMessage.Level};{logMessage.ProcessID ?? 0};{logMessage.Thread};{logMessage.Logger};{logMessage.Address};{logMessage.Message}";
|
||||
writer.WriteLine(message);
|
||||
}
|
||||
else
|
||||
{
|
||||
// No message in the queue, wait for a short time
|
||||
Thread.Sleep(100);
|
||||
}
|
||||
}
|
||||
|
||||
if(fileStream.Length >= maxFileSize)
|
||||
{
|
||||
rollOver = true;
|
||||
}
|
||||
|
||||
writer?.Close();
|
||||
fileStream?.Close();
|
||||
|
||||
if(rollOver)
|
||||
{
|
||||
rollOver = false;
|
||||
// Generate a unique file name for the current log file
|
||||
string uniqueFileName = GenerateUniqueFileNameDyDateTime(baseFileName);
|
||||
File.Move(baseFileName, uniqueFileName); // Save a copy of the file
|
||||
|
||||
// Delete the old base file
|
||||
File.Delete(baseFileName);
|
||||
}
|
||||
Thread.Sleep(100);
|
||||
}
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
Messenger.Default.Send($"An error occurred while trying to log messages to {baseFileName}.\n{ex.Message}", "DisplayCustomMessage");
|
||||
}
|
||||
finally
|
||||
{
|
||||
writer?.Close();
|
||||
fileStream?.Close();
|
||||
}
|
||||
}
|
||||
|
||||
private static void ClearQueue<T>(ConcurrentQueue<T> queue)
|
||||
{
|
||||
while(!queue.IsEmpty)
|
||||
{
|
||||
queue.TryDequeue(out _);
|
||||
}
|
||||
}
|
||||
|
||||
private void ParseTheme()
|
||||
{
|
||||
try
|
||||
{
|
||||
string source = Application.Current.Resources.MergedDictionaries[2].Source.ToString().Replace(".xaml", string.Empty);
|
||||
string themeName = source.Substring(source.LastIndexOf(".") + 1);
|
||||
currentThemeName = themeName;
|
||||
var theme = Settings.ColorThemes.FirstOrDefault(x => x.Name == themeName);
|
||||
if(theme != null)
|
||||
{
|
||||
SelectedColorTheme = theme;
|
||||
}
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
logger.Warn(e, "An error occurred while ParseTheme");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
//******************************************************************************//
|
||||
// SidebarTreeViewModel.cs
|
||||
// 12/4/2023
|
||||
//
|
||||
// RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
|
||||
// PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
|
||||
// AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
|
||||
// UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
|
||||
// RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
|
||||
// CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
|
||||
// OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
|
||||
// COMPANY.
|
||||
//
|
||||
// THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. GOVERNMENT
|
||||
//
|
||||
// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
//
|
||||
// WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE
|
||||
// EXPORT OR DISCLOSURE TO NON-U.S. PERSONS, WHEREVER LOCATED, IS RESTRICTED
|
||||
// BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R. SECTION
|
||||
// 120-130) OR THE EXPORT ADMINISTRATION REGULATIONS (EAR) (15 C.F.R. SECTION
|
||||
// 730-774). THIS DOCUMENT CANNOT BE EXPORTED (E.G., PROVIDED TO A SUPPLIER
|
||||
// OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S. PERSON, WHEREVER
|
||||
// LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS
|
||||
// BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S. GOVERNMENT
|
||||
// APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL
|
||||
// PENALTIES.
|
||||
//
|
||||
// DOD 5220.22-M, INDUSTRIAL SECURITY MANUAL, CHAPTER 5, SECTION 1 THROUGH 9 :
|
||||
// FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN OR DOD 5200.1-R,
|
||||
// INFORMATION SECURITY PROGRAM, CHAPTER 6. FOR UNCLASSIFIED, LIMITED DOCUMENTS
|
||||
// DESTROY BY ANY METHOD THAT WILL PREVENT DISCLOSURE OF CONTENTS OR
|
||||
// RECONSTRUCTION OF THE DOCUMENT.
|
||||
// POC: Alex Kravchenko (1118268)
|
||||
//******************************************************************************//
|
||||
using GalaSoft.MvvmLight;
|
||||
|
||||
namespace Raytheon.LogDashboard.ViewModel
|
||||
{
|
||||
public class SidebarTreeViewModel : ViewModelBase
|
||||
{
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user