diff --git a/FocusLogger/Controls/DataListControl.xaml b/FocusLogger/Controls/DataListControl.xaml
index c0eff5a..2f7193a 100644
--- a/FocusLogger/Controls/DataListControl.xaml
+++ b/FocusLogger/Controls/DataListControl.xaml
@@ -21,19 +21,22 @@
-
-
-
-
+
+
+
-
+
+ Height="12">
@@ -125,15 +130,17 @@
CanUserResize="False"
IsReadOnly="True">
-
+
+ Height="12">
@@ -172,8 +179,7 @@
+ Height="12">
@@ -205,15 +211,17 @@
CanUserResize="False"
IsReadOnly="True">
-
+
+ Height="12">
diff --git a/FocusLogger/Documents/Step2_app_sign.bat b/FocusLogger/Documents/Step2_app_sign.bat
deleted file mode 100644
index e4d3775..0000000
--- a/FocusLogger/Documents/Step2_app_sign.bat
+++ /dev/null
@@ -1,39 +0,0 @@
-@ECHO OFF
-COPY /Y "..\bin\Release\publish\JocysCom.FocusLogger.exe" "JocysCom.FocusLogger.exe"
-CALL:SIG "JocysCom.FocusLogger.exe"
-echo.
-pause
-
-GOTO:EOF
-::=============================================================
-:SIG :: Sign and Timestamp Code
-::-------------------------------------------------------------
-:: SIGNTOOL.EXE Note:
-:: Use the Windows 7 Platform SDK web installer that lets you
-:: download just the components you need - so just choose the
-:: ".NET developer \ Tools" and deselect everything else.
-echo.
-IF NOT EXIST "%~1" (
- ECHO "%~1" not exist. Skipping.
- GOTO:EOF
-)
-SET sgt=Tools\signtool.exe
-IF NOT EXIST "%sgt%" SET sgt=%ProgramFiles(x86)%\Windows Kits\10\App Certification Kit\signtool.exe
-IF NOT EXIST "%sgt%" SET sgt=%ProgramFiles(x86)%\Windows Kits\10\bin\x86\signtool.exe
-IF NOT EXIST "%sgt%" SET sgt=%ProgramFiles%\Windows Kits\10\bin\x86\signtool.exe
-echo %sgt%
-echo.
-:: Other options.
-set pfx=D:\_Backup\Configuration\SSL\Code Sign - Evaldas Jocys\2020\Evaldas_Jocys.pfx
-set d=Jocys.com Focus Logger
-set du=https://www.jocys.com
-set vsg=http://timestamp.comodoca.com
-if not exist "%sgt%" CALL:Error "%sgt%"
-if not exist "%~1" CALL:Error "%~1"
-if not exist "%pfx%" CALL:Error "%pfx%"
-"%sgt%" sign /f "%pfx%" /d "%d%" /du "%du%" /fd sha256 /td sha256 /tr "%vsg%" /v "%~1"
-GOTO:EOF
-
-:Error
-echo File doesn't Exist: "%~1"
-pause
diff --git a/FocusLogger/Documents/app_sign.ps1 b/FocusLogger/Documents/app_sign.ps1
new file mode 100644
index 0000000..fc67fff
--- /dev/null
+++ b/FocusLogger/Documents/app_sign.ps1
@@ -0,0 +1,10 @@
+Import-Module "d:\_Backup\Configuration\SSL\Tools\app_signModule.ps1" -Force
+
+[string[]]$appFiles = @(
+ "..\bin\Release\publish\JocysCom.FocusLogger.exe",
+)
+[string]$appName = "Jocys.com Focus Logger"
+[string]$appLink = "https://www.jocys.com"
+
+ProcessFiles $appName $appLink $appFiles
+pause
\ No newline at end of file
diff --git a/FocusLogger/Documents/app_zip.bat b/FocusLogger/Documents/app_zip.bat
new file mode 100644
index 0000000..f4bb3b3
--- /dev/null
+++ b/FocusLogger/Documents/app_zip.bat
@@ -0,0 +1,30 @@
+@ECHO off
+SET wra="%ProgramFiles%\WinRAR\winrar.exe"
+IF NOT EXIST %wra% SET wra="%ProgramFiles(x86)%\WinRAR\winrar.exe"
+IF NOT EXIST %wra% SET wra="%ProgramW6432%\WinRAR\winrar.exe"
+IF NOT EXIST %wra% SET wra="D:\Program Files\WinRAR\winrar.exe"
+SET zip=%wra% a -ep
+:: ---------------------------------------------------------------------------
+IF NOT EXIST Files\nul MKDIR Files
+::-------------------------------------------------------------
+:: Archive Files
+CALL:CRE Files JocysCom.FocusLogger.exe .exe
+ECHO.
+pause
+GOTO:EOF
+
+::-------------------------------------------------------------
+:CRE :: Archive
+::-------------------------------------------------------------
+SET src=%~1
+SET arc=Files\%~2.zip
+ECHO.
+IF NOT EXIST "%src%\%~2%~3" (
+ ECHO "%src%\%~2%~3" not exist. Skipping.
+ GOTO:EOF
+)
+ECHO Creating: %arc%
+:: Create Archive.
+IF EXIST %arc% DEL %arc%
+%zip% %arc% %src%\%~2%~3
+GOTO:EOF
\ No newline at end of file
diff --git a/FocusLogger/JocysCom/Collections/CollectionsHelper.cs b/FocusLogger/JocysCom/Collections/CollectionsHelper.cs
new file mode 100644
index 0000000..9d86e06
--- /dev/null
+++ b/FocusLogger/JocysCom/Collections/CollectionsHelper.cs
@@ -0,0 +1,57 @@
+using System.Collections.Generic;
+using System.Linq;
+
+namespace JocysCom.ClassLibrary.Collections
+{
+ public static partial class CollectionsHelper
+ {
+
+ ///
+ /// Synchronize source collection to destination.
+ ///
+ public static void Synchronize(IList source, IList target, IEqualityComparer comparer = null)
+ {
+ comparer = comparer ?? EqualityComparer.Default;
+ // Create a dictionary for fast lookup in source list
+ var sourceSet = new Dictionary();
+ for (int i = 0; i < source.Count; i++)
+ sourceSet[source[i]] = i;
+ // Iterate over the target, remove items not in source
+ for (int i = target.Count - 1; i >= 0; i--)
+ if (!sourceSet.Keys.Contains(target[i], comparer))
+ target.RemoveAt(i);
+ // Iterate over source
+ for (int si = 0; si < source.Count; si++)
+ {
+ // If item is not present in target, insert it.
+ // Note: Only check items that have not been synchornized in the target.
+ if (!target.Skip(si).Contains(source[si], comparer))
+ {
+ target.Insert(si, source[si]);
+ continue;
+ }
+ // If item is present in target but not at the right position, move it.
+ int ti = -1;
+ // Note: Only check items that have not been synchornized in the target.
+ for (int i = si; i < target.Count; i++)
+ {
+ if (comparer.Equals(target[i], source[si]))
+ {
+ ti = i;
+ break;
+ }
+ }
+ if (ti != si)
+ {
+ T temp = target[si];
+ target[si] = target[ti];
+ target[ti] = temp;
+ }
+ }
+ // Remove items at the end of target that exceed source's length
+ while (target.Count > source.Count)
+ target.RemoveAt(target.Count - 1);
+ }
+
+ }
+}
diff --git a/FocusLogger/JocysCom/ComponentModel/BindingListInvoked.cs b/FocusLogger/JocysCom/ComponentModel/BindingListInvoked.cs
index 7261e09..1ca7684 100644
--- a/FocusLogger/JocysCom/ComponentModel/BindingListInvoked.cs
+++ b/FocusLogger/JocysCom/ComponentModel/BindingListInvoked.cs
@@ -34,7 +34,7 @@ public void AddRange(IEnumerable list)
void Invoke(Delegate method, params object[] args)
{
var so = SynchronizingObject;
- if (so == null || !JocysCom.ClassLibrary.Controls.ControlsHelper.InvokeRequired)
+ if (so is null || !JocysCom.ClassLibrary.Controls.ControlsHelper.InvokeRequired)
{
DynamicInvoke(method, args);
}
diff --git a/FocusLogger/JocysCom/ComponentModel/PropertyComparer.cs b/FocusLogger/JocysCom/ComponentModel/PropertyComparer.cs
index 8b6b83f..08a022e 100644
--- a/FocusLogger/JocysCom/ComponentModel/PropertyComparer.cs
+++ b/FocusLogger/JocysCom/ComponentModel/PropertyComparer.cs
@@ -47,7 +47,7 @@ protected int Compare(T x, T y)
private int CompareValues(object xValue, object yValue, ListSortDirection direction)
{
int retValue;
- if (xValue == null && yValue == null)
+ if (xValue is null && yValue is null)
retValue = 0;
else if (xValue is IComparable)
retValue = ((IComparable)xValue).CompareTo(yValue);
diff --git a/FocusLogger/JocysCom/ComponentModel/SortableBindingList.cs b/FocusLogger/JocysCom/ComponentModel/SortableBindingList.cs
index 86b566c..3c823a7 100644
--- a/FocusLogger/JocysCom/ComponentModel/SortableBindingList.cs
+++ b/FocusLogger/JocysCom/ComponentModel/SortableBindingList.cs
@@ -96,7 +96,7 @@ private void ApplySortInternal(PropertyComparer comparer)
if (_OriginalCollection.Count == 0)
_OriginalCollection.AddRange(this);
var listRef = Items as List;
- if (listRef == null)
+ if (listRef is null)
return;
listRef.Sort(comparer);
_Sorted = true;
diff --git a/FocusLogger/JocysCom/Configuration/AssemblyInfo.cs b/FocusLogger/JocysCom/Configuration/AssemblyInfo.cs
index 0837ffb..7d5490b 100644
--- a/FocusLogger/JocysCom/Configuration/AssemblyInfo.cs
+++ b/FocusLogger/JocysCom/Configuration/AssemblyInfo.cs
@@ -26,7 +26,7 @@ public static AssemblyInfo Entry
{
lock (_EntryLock)
{
- if (_Entry == null)
+ if (_Entry is null)
_Entry = new AssemblyInfo();
return _Entry;
}
@@ -122,7 +122,7 @@ public string RunMode
{
get
{
- if (_RunMode == null)
+ if (_RunMode is null)
// TODO: Standardize configuration provider XML, JSON, INI, Registry, etc...
// https://docs.microsoft.com/en-us/dotnet/core/extensions/configuration-providers
//_RunMode = SettingsParser.Current.Parse("RunMode", "");
@@ -309,7 +309,7 @@ public static DateTime GetBuildDateTime(string filePath)
///
public static DateTime GetBuildDateTime(Assembly assembly, TimeZoneInfo tzi = null)
{
- if (assembly == null)
+ if (assembly is null)
throw new ArgumentNullException(nameof(assembly));
var names = assembly.GetManifestResourceNames();
var dt = default(DateTime);
@@ -388,7 +388,7 @@ public string AssemblyPath
string GetAttribute(Func value) where T : Attribute
{
T attribute = (T)Attribute.GetCustomAttribute(Assembly, typeof(T));
- return attribute == null
+ return attribute is null
? ""
: value.Invoke(attribute);
}
diff --git a/FocusLogger/JocysCom/Configuration/ISettingsItemFile.cs b/FocusLogger/JocysCom/Configuration/ISettingsItemFile.cs
new file mode 100644
index 0000000..8877256
--- /dev/null
+++ b/FocusLogger/JocysCom/Configuration/ISettingsItemFile.cs
@@ -0,0 +1,39 @@
+using System;
+
+namespace JocysCom.ClassLibrary.Configuration
+{
+ public interface ISettingsItemFile
+ {
+ ///
+ /// Map to property which contains base file name.
+ ///
+ string BaseName { get; set; }
+
+ ///
+ /// Map to property which contains last time item was modified.
+ /// Update on INotifyPropertyChanged.
+ ///
+ DateTime WriteTime { get; set; }
+
+ /* Example:
+
+ #region ■ ISettingsItemFile
+
+ [XmlIgnore]
+ string ISettingsItemFile.BaseName { get => Name; set => Name = value; }
+
+ [XmlIgnore]
+ DateTime ISettingsItemFile.WriteTime { get; set; }
+
+ #endregion
+
+ protected void OnPropertyChanged([CallerMemberName] string propertyName = null)
+ {
+ ((ISettingsItemFile)this).WriteTime = DateTime.Now;
+ }
+
+ */
+
+ }
+}
+
diff --git a/FocusLogger/JocysCom/Configuration/SettingsData.cs b/FocusLogger/JocysCom/Configuration/SettingsData.cs
index 0eb09e5..8e5f6dd 100644
--- a/FocusLogger/JocysCom/Configuration/SettingsData.cs
+++ b/FocusLogger/JocysCom/Configuration/SettingsData.cs
@@ -10,7 +10,7 @@
using System.Text;
using System.Xml;
using System.Xml.Serialization;
-using System.Xml.Linq;
+using JocysCom.ClassLibrary.Collections;
#if NETSTANDARD // .NET Standard
#elif NETCOREAPP // .NET Core
using System.Windows;
@@ -99,18 +99,6 @@ private void Initialize(string overrideFileName, bool? userLevel, string comment
[XmlIgnore]
public bool UseSeparateFiles { get; set; }
- [XmlIgnore]
- public string FileNamePropertyName
- {
- get => _FileNamePropertyName;
- set { _FileNamePropertyName = value; FileNameProperty = typeof(T).GetProperty(value); }
- }
- string _FileNamePropertyName;
-
-
- [XmlIgnore]
- public PropertyInfo FileNameProperty { get; set; }
-
[XmlIgnore]
public FileInfo XmlFile { get { return _XmlFile; } set { _XmlFile = value; } }
@@ -131,7 +119,7 @@ public virtual object SyncRoot
{
get
{
- if (_SyncRoot == null)
+ if (_SyncRoot is null)
System.Threading.Interlocked.CompareExchange