Skip to content

Commit

Permalink
Version 1.9.8843
Browse files Browse the repository at this point in the history
Version 1.8.8843
-----------------------------------------------------------------
Backend related changes:
- ReaderDevice Improvement: Upgraded Elatec.NET to v0.4
- Reimplementation of Leosac's LibLogicalAccess Library to support PCSC Readers
- Installer: Create a new EventSource "CardCheckAssistant"
  • Loading branch information
c3rebro committed Jun 12, 2024
1 parent b2a1c83 commit 0643549
Show file tree
Hide file tree
Showing 23 changed files with 2,165 additions and 2,666 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,4 @@
*.zip
*.htm
RFiDGear/RFiDGear.SDKStyle.csproj
*.txt
12 changes: 6 additions & 6 deletions RFiDGear.sln
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ Global
{D49B605A-7B08-4B82-B4D2-7DA7D0236B13}.Debug|x86.Build.0 = Debug|Any CPU
{D49B605A-7B08-4B82-B4D2-7DA7D0236B13}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D49B605A-7B08-4B82-B4D2-7DA7D0236B13}.Release|Any CPU.Build.0 = Release|Any CPU
{D49B605A-7B08-4B82-B4D2-7DA7D0236B13}.Release|x64.ActiveCfg = Release|Any CPU
{D49B605A-7B08-4B82-B4D2-7DA7D0236B13}.Release|x64.Build.0 = Release|Any CPU
{D49B605A-7B08-4B82-B4D2-7DA7D0236B13}.Release|x64.ActiveCfg = Release|x64
{D49B605A-7B08-4B82-B4D2-7DA7D0236B13}.Release|x64.Build.0 = Release|x64
{D49B605A-7B08-4B82-B4D2-7DA7D0236B13}.Release|x86.ActiveCfg = Release|Any CPU
{D49B605A-7B08-4B82-B4D2-7DA7D0236B13}.Release|x86.Build.0 = Release|Any CPU
{856CA06C-0B4C-46C6-AD71-873317F1C763}.Debug|Any CPU.ActiveCfg = Debug|x86
Expand Down Expand Up @@ -98,14 +98,14 @@ Global
{EF56252E-257F-41D1-974B-C9015071CE7E}.Release|x86.Build.0 = Release|Any CPU
{360F9AF9-6717-45B6-9707-5974575FE96A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{360F9AF9-6717-45B6-9707-5974575FE96A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{360F9AF9-6717-45B6-9707-5974575FE96A}.Debug|x64.ActiveCfg = Debug|x64
{360F9AF9-6717-45B6-9707-5974575FE96A}.Debug|x64.Build.0 = Debug|x64
{360F9AF9-6717-45B6-9707-5974575FE96A}.Debug|x64.ActiveCfg = Debug|Any CPU
{360F9AF9-6717-45B6-9707-5974575FE96A}.Debug|x64.Build.0 = Debug|Any CPU
{360F9AF9-6717-45B6-9707-5974575FE96A}.Debug|x86.ActiveCfg = Debug|x86
{360F9AF9-6717-45B6-9707-5974575FE96A}.Debug|x86.Build.0 = Debug|x86
{360F9AF9-6717-45B6-9707-5974575FE96A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{360F9AF9-6717-45B6-9707-5974575FE96A}.Release|Any CPU.Build.0 = Release|Any CPU
{360F9AF9-6717-45B6-9707-5974575FE96A}.Release|x64.ActiveCfg = Release|x64
{360F9AF9-6717-45B6-9707-5974575FE96A}.Release|x64.Build.0 = Release|x64
{360F9AF9-6717-45B6-9707-5974575FE96A}.Release|x64.ActiveCfg = Release|Any CPU
{360F9AF9-6717-45B6-9707-5974575FE96A}.Release|x64.Build.0 = Release|Any CPU
{360F9AF9-6717-45B6-9707-5974575FE96A}.Release|x86.ActiveCfg = Release|x86
{360F9AF9-6717-45B6-9707-5974575FE96A}.Release|x86.Build.0 = Release|x86
EndGlobalSection
Expand Down
57 changes: 33 additions & 24 deletions RFiDGear/3rdParty/RedCell/RedCell.Diagnostics.Update/Updater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,12 @@ public Updater(FileInfo configFile)

_localConfig = new Manifest(data);
#if DEBUG
_localConfig.Version = 0;
//_localConfig.Version = 0;
#endif
if (_localConfig != null)
{
Check(null, null);
}
var rootDirectory = new DirectoryInfo(Path.GetDirectoryName(me));
var rootFiles = rootDirectory.GetFiles("*.*", SearchOption.TopDirectoryOnly);
}
Expand Down Expand Up @@ -151,31 +155,12 @@ await Task.Run(() =>
/// <summary>
/// Checks the specified state.
/// </summary>
/// <param name="state">The state.</param>
/// <param name="state"></param>
/// <param name="args">true = download Changelog only</param>
public async void Check(object state, EventArgs args)
{
try
{
if (AllowUpdate && !_updating)
{
_timer.Interval = new TimeSpan(0, 0, 0, _localConfig.CheckInterval, 0);

_updating = true;
await Update();
_updating = false;
IsUserNotified = false;
eventLog.WriteEntry(string.Format("Check ending."), EventLogEntryType.Information);
return;
}
eventLog.WriteEntry(string.Format("Check starting."), EventLogEntryType.Information);

if (_updating)
{
eventLog.WriteEntry(string.Format("Updater is already updating."), EventLogEntryType.Warning);
eventLog.WriteEntry(string.Format("Check ending."), EventLogEntryType.Information);
return;
}

var remoteUri = new Uri(_localConfig.RemoteConfigUri);

eventLog.WriteEntry(string.Format("Fetching '{0}'.", _localConfig.RemoteConfigUri), EventLogEntryType.Information);
Expand All @@ -186,7 +171,7 @@ public async void Check(object state, EventArgs args)

if (!http.Success)
{

try
{
eventLog.WriteEntry(string.Format("Fetch error: {0}", http.Response != null ? http.Response.StatusDescription : ""), EventLogEntryType.Error);
Expand All @@ -196,7 +181,7 @@ public async void Check(object state, EventArgs args)
{
eventLog.WriteEntry(string.Format("Fetch error: Unknown http Err"), EventLogEntryType.Information);
}

_remoteConfig = null;
return;
}
Expand All @@ -212,6 +197,28 @@ public async void Check(object state, EventArgs args)
var data = Encoding.UTF8.GetString(http.ResponseData);
_remoteConfig = new Manifest(data);

UpdateInfoText = _remoteConfig.VersionInfoText;

if (AllowUpdate && !_updating)
{
_timer.Interval = new TimeSpan(0, 0, 0, _localConfig.CheckInterval, 0);

_updating = true;
await Update();
_updating = false;
IsUserNotified = false;
eventLog.WriteEntry(string.Format("Check ending."), EventLogEntryType.Information);
return;
}
eventLog.WriteEntry(string.Format("Check starting."), EventLogEntryType.Information);

if (_updating)
{
eventLog.WriteEntry(string.Format("Updater is already updating."), EventLogEntryType.Warning);
eventLog.WriteEntry(string.Format("Check ending."), EventLogEntryType.Information);
return;
}

if (_remoteConfig == null)
{
UpdateAvailable = false;
Expand All @@ -223,6 +230,7 @@ public async void Check(object state, EventArgs args)
UpdateAvailable = false;
return;
}

eventLog.WriteEntry(string.Format("Remote config is valid."), EventLogEntryType.Information);
eventLog.WriteEntry(string.Format("Local version is ", _localConfig.Version), EventLogEntryType.Information);
eventLog.WriteEntry(string.Format("Remote version is ", _remoteConfig.Version), EventLogEntryType.Information);
Expand All @@ -233,6 +241,7 @@ public async void Check(object state, EventArgs args)
UpdateAvailable = false;
return;
}

if (_remoteConfig.Version < _localConfig.Version)
{
eventLog.WriteEntry(string.Format("Remote version is older. That's weird o_O. Check ending."), EventLogEntryType.Warning);
Expand Down
24 changes: 12 additions & 12 deletions RFiDGear/DataAccessLayer/Remote/FromFile/ReportReaderWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ public class ReportReaderWriter : IDisposable
private readonly Version Version = Assembly.GetExecutingAssembly().GetName().Version;
private readonly EventLog eventLog = new EventLog("Application", ".", Assembly.GetEntryAssembly().GetName().Name);
private const string reportTemplateTempFileName = "temptemplate.pdf";
private readonly string appDataPath;
private readonly string appDataPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "RFiDGear");
private readonly string tempReportTemplateFileName = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "RFiDGear", reportTemplateTempFileName);
public string ReportOutputPath { get; set; }
public string ReportTemplateFile { get; set; }

Expand All @@ -32,18 +33,14 @@ public ReportReaderWriter()
// Set license key to use GemBox.Pdf in Free mode.
ComponentInfo.SetLicense("FREE-LIMITED-KEY");

appDataPath = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);

appDataPath = System.IO.Path.Combine(appDataPath, "RFiDGear");

if (!Directory.Exists(appDataPath))
{
Directory.CreateDirectory(appDataPath);
}

if (File.Exists(System.IO.Path.Combine(appDataPath, reportTemplateTempFileName)))
if (File.Exists(tempReportTemplateFileName))
{
File.Delete(System.IO.Path.Combine(appDataPath, reportTemplateTempFileName));
File.Delete(tempReportTemplateFileName);
}
}
catch (Exception e)
Expand Down Expand Up @@ -97,12 +94,15 @@ public async Task SetReportField(string _field, string _value)
{
await Task.Run(() =>
{
using (var pdfDoc = PdfDocument.Load(ReportTemplateFile))
if (!File.Exists(tempReportTemplateFileName))
{
File.Copy(ReportTemplateFile, tempReportTemplateFileName, true);
}

using (var pdfDoc = PdfDocument.Load(tempReportTemplateFileName))
{
try
{
ReportTemplateFile = System.IO.Path.Combine(appDataPath, reportTemplateTempFileName);

var form = pdfDoc.Form;
pdfDoc.Info.Title = "RFiDGear Report";
pdfDoc.Info.Author = "RFiDGear";
Expand All @@ -117,14 +117,14 @@ await Task.Run(() =>
pdfDoc.Save(ReportOutputPath);
pdfDoc.Close();

File.Copy(ReportOutputPath, System.IO.Path.Combine(appDataPath, reportTemplateTempFileName), true);
File.Copy(ReportOutputPath, tempReportTemplateFileName, true);
}
catch (Exception e)
{
eventLog.WriteEntry(string.Format(e.Message + "; SetReportField: " + _field), EventLogEntryType.Error);
}
}
}).ConfigureAwait(true);
});

return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,11 @@ public class SettingsReaderWriter : IDisposable
private readonly int _updateInterval = 900;
private readonly string _securityToken = "D68EF3A7-E787-4CC4-B020-878BA649B4CD";
private readonly string _payload = "update.zip";
private readonly string _infoText = "Version Info\n\ngoes here! \n==>";
private string _infoText = "Version Info\n\ngoes here! \n==>";
private readonly string _baseUri = @"https://github.com/c3rebro/RFiDGear/releases/latest/download/";


private readonly Version Version = Assembly.GetExecutingAssembly().GetName().Version;

private readonly string appDataPath;

private bool _disposed;
Expand Down
56 changes: 30 additions & 26 deletions RFiDGear/DataAccessLayer/Remote/FromIO/ElatecNetProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,22 +24,13 @@ public class ElatecNetProvider : ReaderDevice, IDisposable

private bool _disposed;

public override string ReaderUnitName
{
get; set;
}
public override string ReaderUnitVersion
{
get; set;
}

#region Constructor

private async Task Initialize()
{
if (GenericChip == null)
{
GenericChip = new List<GenericChipModel>();
GenericChip = new GenericChipModel();
}

try
Expand Down Expand Up @@ -73,7 +64,7 @@ public ElatecNetProvider()
{
if (GenericChip == null)
{
GenericChip = new List<GenericChipModel>();
GenericChip = new GenericChipModel();
}
}

Expand Down Expand Up @@ -143,40 +134,53 @@ public async override Task<ERROR> ReadChipPublic()

await readerDevice.SetTagTypesAsync(LFTagTypes.NOTAG, HFTagTypes.AllHFTags);

if (!string.IsNullOrWhiteSpace(hfTag?.UID) && GenericChip.Any(x => x.UID == hfTag.UID))
if (!string.IsNullOrWhiteSpace(hfTag?.UID) && GenericChip.UID == hfTag.UID)
{
return ERROR.NoError;
}

if (!string.IsNullOrWhiteSpace(hfTag?.UID) && !GenericChip.Any(x => x.UID == hfTag.UID))
if (!string.IsNullOrWhiteSpace(hfTag?.UID) && !(GenericChip.UID == hfTag.UID))
{
GenericChip = new List<GenericChipModel>();

if (!string.IsNullOrWhiteSpace(hfTag?.UID))
{
GenericChip.Add(hfTag);
GenericChip = hfTag;
}
}

if (GenericChip[0].Childs == null)
{
GenericChip[0].Childs = new List<GenericChipModel>();
}
if (hfTag != null && !string.IsNullOrEmpty(lfTag?.UID))
{
if (GenericChip.Childs == null)
{
GenericChip.Childs = new List<GenericChipModel>();
}

GenericChip.Childs.Add(lfTag);
}

if (!string.IsNullOrEmpty(lfTag?.UID))
else if (!string.IsNullOrEmpty(lfTag?.UID))
{
GenericChip[0].Childs.Add(lfTag);
GenericChip = lfTag;
}

if (hfTag != null && !string.IsNullOrEmpty(legicTag?.UID))
{
if (GenericChip.Childs == null)
{
GenericChip.Childs = new List<GenericChipModel>();
}

GenericChip.Childs.Add(legicTag);
}

if (!string.IsNullOrEmpty(legicTag?.UID))
else if (!string.IsNullOrEmpty(legicTag?.UID))
{
GenericChip[0].Childs.Add(legicTag);
GenericChip = legicTag;
}
}

if (hfTag == null && lfTag == null && legicTag == null)
{
GenericChip = new List<GenericChipModel>();
GenericChip = new GenericChipModel();
}

return ERROR.NoError;
Expand Down Expand Up @@ -400,7 +404,7 @@ private async Task<ERROR> ReadWriteAccessOnClassicSector(int sectorNumber, strin
#endregion

#region MifareUltralight
public override ERROR ReadMifareUltralightSinglePage(int _pageNo)
public override Task<ERROR> ReadMifareUltralightSinglePage(int _pageNo)
{
throw new NotImplementedException();
}
Expand Down
Loading

0 comments on commit 0643549

Please sign in to comment.