Skip to content

Commit

Permalink
Merge pull request #16 from c3rebro/develop
Browse files Browse the repository at this point in the history
merge develop into master
  • Loading branch information
c3rebro authored Dec 21, 2022
2 parents 7f77b82 + 01010c4 commit e841f36
Show file tree
Hide file tree
Showing 68 changed files with 2,931 additions and 2,427 deletions.
21 changes: 2 additions & 19 deletions RFiDGear.sln
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.30711.63
# Visual Studio Version 17
VisualStudioVersion = 17.3.32929.385
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RFiDGear", "RFiDGear\RFiDGear.csproj", "{D49B605A-7B08-4B82-B4D2-7DA7D0236B13}"
ProjectSection(ProjectDependencies) = postProject
{909DB876-4A74-42AC-BACF-C681017D0C77} = {909DB876-4A74-42AC-BACF-C681017D0C77}
EndProjectSection
EndProject
Project("{930C7802-8A8C-48F9-8165-68863BCCD9DD}") = "Setup", "Setup\Setup.wixproj", "{856CA06C-0B4C-46C6-AD71-873317F1C763}"
EndProject
Expand All @@ -25,8 +22,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PluginSystem", "..\PluginSy
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MVVMDialogs", "..\MVVMDialogs\MVVMDialogs.csproj", "{EF56252E-257F-41D1-974B-C9015071CE7E}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VCNEditor", "..\VCNEditor\VCNEditor.csproj", "{909DB876-4A74-42AC-BACF-C681017D0C77}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -125,18 +120,6 @@ Global
{EF56252E-257F-41D1-974B-C9015071CE7E}.Release|x64.Build.0 = Release|x64
{EF56252E-257F-41D1-974B-C9015071CE7E}.Release|x86.ActiveCfg = Release|Any CPU
{EF56252E-257F-41D1-974B-C9015071CE7E}.Release|x86.Build.0 = Release|Any CPU
{909DB876-4A74-42AC-BACF-C681017D0C77}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{909DB876-4A74-42AC-BACF-C681017D0C77}.Debug|Any CPU.Build.0 = Debug|Any CPU
{909DB876-4A74-42AC-BACF-C681017D0C77}.Debug|x64.ActiveCfg = Debug|x64
{909DB876-4A74-42AC-BACF-C681017D0C77}.Debug|x64.Build.0 = Debug|x64
{909DB876-4A74-42AC-BACF-C681017D0C77}.Debug|x86.ActiveCfg = Debug|x86
{909DB876-4A74-42AC-BACF-C681017D0C77}.Debug|x86.Build.0 = Debug|x86
{909DB876-4A74-42AC-BACF-C681017D0C77}.Release|Any CPU.ActiveCfg = Release|Any CPU
{909DB876-4A74-42AC-BACF-C681017D0C77}.Release|Any CPU.Build.0 = Release|Any CPU
{909DB876-4A74-42AC-BACF-C681017D0C77}.Release|x64.ActiveCfg = Release|x64
{909DB876-4A74-42AC-BACF-C681017D0C77}.Release|x64.Build.0 = Release|x64
{909DB876-4A74-42AC-BACF-C681017D0C77}.Release|x86.ActiveCfg = Release|x86
{909DB876-4A74-42AC-BACF-C681017D0C77}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ private static void OnEvent(string message)
/// <param name="args">The arguments.</param>
public static void Write(string format, params object[] args)
{
string message = string.Format(format, args);
var message = string.Format(format, args);
OnEvent(message);
if (Console)
{
Expand Down
10 changes: 5 additions & 5 deletions RFiDGear/3rdParty/RedCell/RedCell.Diagnostics.Update/Updater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public Updater(FileInfo configFile)
return;
}

string data = File.ReadAllText(configFile.FullName, new UTF8Encoding(false));
var data = File.ReadAllText(configFile.FullName, new UTF8Encoding(false));

_localConfig = new Manifest(data);
#if DEBUG
Expand Down Expand Up @@ -195,7 +195,7 @@ private void Check(object state)
return;
}

string data = Encoding.UTF8.GetString(http.ResponseData);
var data = Encoding.UTF8.GetString(http.ResponseData);
_remoteConfig = new Manifest(data);

if (_remoteConfig == null)
Expand Down Expand Up @@ -283,7 +283,7 @@ public void Update()


// Download files in manifest.
foreach (string update in _remoteConfig.Payloads)
foreach (var update in _remoteConfig.Payloads)
{
Log.Write("Fetching '{0}'.", update);
var url = _remoteConfig.BaseUri + update; //TODO: make this localizable ? e.g. + (settings.DefaultSpecification.DefaultLanguage == "german" ? "de-de/" : "en-us/")
Expand Down Expand Up @@ -323,8 +323,8 @@ public void Update()

if (IsUserNotified && AllowUpdate)
{
Process p = new Process();
ProcessStartInfo info = new ProcessStartInfo()
var p = new Process();
var info = new ProcessStartInfo()
{
FileName = "msiexec.exe",
Verb="runas",
Expand Down
2 changes: 1 addition & 1 deletion RFiDGear/3rdParty/RedCell/RedCell.Net/Fetch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public Fetch()
/// <returns></returns>
public void Load(string url)
{
for (int retry = 0; retry < Retries; retry++)
for (var retry = 0; retry < Retries; retry++)
{
try
{
Expand Down
4 changes: 2 additions & 2 deletions RFiDGear/3rdParty/SelectionBindingTextBox.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ private static void OnBindableSelectionStartChanged(DependencyObject dependencyO

if (!textBox.changeFromUI)
{
int newValue = (int)args.NewValue;
var newValue = (int)args.NewValue;
textBox.SelectionStart = newValue;
}
else
Expand All @@ -88,7 +88,7 @@ private static void OnBindableSelectionLengthChanged(DependencyObject dependency

if (!textBox.changeFromUI)
{
int newValue = (int)args.NewValue;
var newValue = (int)args.NewValue;
textBox.SelectionLength = newValue;
}
else
Expand Down
4 changes: 3 additions & 1 deletion RFiDGear/App.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
xmlns:mainvm="clr-namespace:MefMvvm.SharedContracts.ViewModel;assembly=PluginSystem"
xmlns:pre="clr-namespace:MvvmDialogs.Presenters;assembly=MVVMDialogs"
xmlns:vm="clr-namespace:RFiDGear.ViewModel"

d1p1:Ignorable="d"
StartupUri="View/MainWindow.xaml">

Expand All @@ -19,8 +20,9 @@
<mainvm:ViewModelLocator x:Key="Locator" d:IsDataSource="True" />

<mainview:Splash x:Key="{x:Type vm:SplashScreenViewModel}" x:Shared="False" />

<dialogsview:CustomDialogBox x:Key="{x:Type dialogsvm:CustomDialogViewModel}" x:Shared="False" />

<mainview:CommonTaskView x:Key="{x:Type vm:CommonTaskViewModel}" x:Shared="False" />
<mainview:GenericChipTaskView x:Key="{x:Type vm:GenericChipTaskViewModel}" x:Shared="False" />
<mainview:MifareClassicSetupView x:Key="{x:Type vm:MifareClassicSetupViewModel}" x:Shared="False" />
Expand Down
9 changes: 8 additions & 1 deletion RFiDGear/DataAccessLayer/Local/Constants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ public enum TaskType_GenericChipTask
{
None,
ChipIsOfType,
ChipIsMultiChip,
CheckUID,
ChangeDefault
}
Expand Down Expand Up @@ -265,6 +266,12 @@ public enum CARD_TYPE
DESFireEV1 = 0xC6,
DESFireEV2 = 0xC7,
DESFireEV3 = 0xC8,
SmartMX_DESFire_Generic = 0xC9,
SmartMX_DESFire_2K = 0xCA,
SmartMX_DESFire_4K = 0xCB,
SmartMX_DESFire_8K = 0xCC,
SmartMX_DESFire_16K = 0xCD,
SmartMX_DESFire_32K = 0xCE,
DESFire_256 = 0xD0,
DESFire_2K = 0xD1,
DESFire_4K = 0xD2,
Expand Down Expand Up @@ -388,7 +395,7 @@ public enum DESFireKeySettings
KS_CHANGE_KEY_FROZEN = 240
}

public struct DESFireFileSettings
public class DESFireFileSettings
{
public byte[] accessRights;
public byte FileType;
Expand Down
66 changes: 33 additions & 33 deletions RFiDGear/DataAccessLayer/Local/CustomConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public static class CustomConverter

public static bool KeyFormatQuickCheck(string keyToCheck)
{
foreach (char c in keyToCheck.ToCharArray())
foreach (var c in keyToCheck.ToCharArray())
{
if (c == ' ')
{
Expand All @@ -32,10 +32,10 @@ public static bool KeyFormatQuickCheck(string keyToCheck)

public static int GetByteCount(string hexString)
{
int numHexChars = 0;
var numHexChars = 0;
char c;
// remove all none A-F, 0-9, characters
for (int i = 0; i < hexString.Length; i++)
for (var i = 0; i < hexString.Length; i++)
{
c = hexString[i];
if (IsHexDigit(c))
Expand All @@ -54,10 +54,10 @@ public static int GetByteCount(string hexString)
public static byte[] GetBytes(string hexString, out int discarded)
{
discarded = 0;
string newString = "";
var newString = "";
char c;
// remove all none A-F, 0-9, characters
for (int i = 0; i < hexString.Length; i++)
for (var i = 0; i < hexString.Length; i++)
{
c = hexString[i];
if (IsHexDigit(c))
Expand All @@ -76,11 +76,11 @@ public static byte[] GetBytes(string hexString, out int discarded)
newString = newString.Substring(0, newString.Length - 1);
}

int byteLength = newString.Length / 2;
byte[] bytes = new byte[byteLength];
var byteLength = newString.Length / 2;
var bytes = new byte[byteLength];
string hex;
int j = 0;
for (int i = 0; i < bytes.Length; i++)
var j = 0;
for (var i = 0; i < bytes.Length; i++)
{
hex = new String(new Char[] { newString[j], newString[j + 1] });
bytes[i] = HexToByte(hex);
Expand All @@ -91,8 +91,8 @@ public static byte[] GetBytes(string hexString, out int discarded)

public static string HexToString(byte[] bytes)
{
string hexString = "";
for (int i = 0; i < bytes.Length; i++)
var hexString = "";
for (var i = 0; i < bytes.Length; i++)
{
hexString += bytes[i].ToString("X2");
}
Expand All @@ -101,7 +101,7 @@ public static string HexToString(byte[] bytes)

public static string HexToString(byte bytes)
{
string hexString = "";
var hexString = "";
{
hexString += bytes.ToString("X2");
}
Expand All @@ -110,9 +110,9 @@ public static string HexToString(byte bytes)

public static bool IsInHexFormat(string hexString)
{
bool hexFormat = true;
var hexFormat = true;

foreach (char digit in hexString)
foreach (var digit in hexString)
{
if (!IsHexDigit(digit))
{
Expand All @@ -126,8 +126,8 @@ public static bool IsInHexFormat(string hexString)
public static bool IsHexDigit(Char c)
{
int numChar;
int numA = Convert.ToInt32('A');
int num1 = Convert.ToInt32('0');
var numA = Convert.ToInt32('A');
var num1 = Convert.ToInt32('0');
c = Char.ToUpper(c);
numChar = Convert.ToInt32(c);
if (numChar >= numA && numChar < (numA + 6))
Expand All @@ -145,7 +145,7 @@ public static bool IsHexDigit(Char c)

public static string FormatMifareClassicKeyWithSpacesEachByte(string Str)
{
string temp = Str;
var temp = Str;

if (string.IsNullOrEmpty(temp))
{
Expand All @@ -163,7 +163,7 @@ public static string FormatMifareClassicKeyWithSpacesEachByte(string Str)
}
else
{
for (int i = (Str.Length) - 2; i > 0; i -= 2)
for (var i = (Str.Length) - 2; i > 0; i -= 2)
{
temp = temp.Insert(i, " ");
}
Expand All @@ -174,7 +174,7 @@ public static string FormatMifareClassicKeyWithSpacesEachByte(string Str)

public static KEY_ERROR FormatMifareDesfireKeyStringWithSpacesEachByte(string Str)
{
string temp = Str;
var temp = Str;

if (string.IsNullOrEmpty(temp))
{
Expand All @@ -191,7 +191,7 @@ public static KEY_ERROR FormatMifareDesfireKeyStringWithSpacesEachByte(string St
return KEY_ERROR.KEY_HAS_WRONG_LENGTH;
}

for (int i = (Str.Length) - 2; i > 0; i -= 2)
for (var i = (Str.Length) - 2; i > 0; i -= 2)
{
temp = temp.Insert(i, " ");
}
Expand All @@ -203,7 +203,7 @@ public static KEY_ERROR FormatMifareDesfireKeyStringWithSpacesEachByte(string St

public static KEY_ERROR FormatMifareClassicKeyStringWithSpacesEachByte(string Str)
{
string temp = Str;
var temp = Str;

if (string.IsNullOrEmpty(temp))
{
Expand All @@ -220,7 +220,7 @@ public static KEY_ERROR FormatMifareClassicKeyStringWithSpacesEachByte(string St
return KEY_ERROR.KEY_HAS_WRONG_LENGTH;
}

for (int i = (Str.Length) - 2; i > 0; i -= 2)
for (var i = (Str.Length) - 2; i > 0; i -= 2)
{
temp = temp.Insert(i, " ");
}
Expand All @@ -232,9 +232,9 @@ public static KEY_ERROR FormatMifareClassicKeyStringWithSpacesEachByte(string St

public static string NormalizeKey(string keyToNormalize)
{
char[] c = keyToNormalize.ToCharArray();
var c = keyToNormalize.ToCharArray();

for (int i = 0; i < keyToNormalize.Length; i++)
for (var i = 0; i < keyToNormalize.Length; i++)
{
if (c[i] == ' ')
{
Expand All @@ -252,7 +252,7 @@ public static string NormalizeKey(string keyToNormalize)
public static int GetChipBasedDataBlockNumber(int _sectorNumber, int _dataBlockNumberSectorBased)
{
int blockCount;
int dataBlockNumberChipBased = 0;
var dataBlockNumberChipBased = 0;

blockCount = (_sectorNumber <= 31 ? 4 : 16);

Expand Down Expand Up @@ -332,7 +332,7 @@ public static bool SectorTrailerHasWrongFormat(byte[] st)
public static bool SectorTrailerHasWrongFormat(string stString)
{
_ = new byte[255];
byte[] st = GetBytes(stString, out int _);
var st = GetBytes(stString, out var _);

if (!SectorTrailerHasWrongFormat(st))
{
Expand Down Expand Up @@ -363,15 +363,15 @@ private static byte HexToByte(string hex)
throw new ArgumentException("hex must be 1 or 2 characters in length");
}

byte newByte = byte.Parse(hex, System.Globalization.NumberStyles.HexNumber);
var newByte = byte.Parse(hex, System.Globalization.NumberStyles.HexNumber);
return newByte;
}

public static byte[] buildSectorTrailerInvNibble(byte[] st)
{
uint _C1, _C2, _C3;

byte[] new_st = new byte[st.Length];
var new_st = new byte[st.Length];

_C3 = st[2];
_C3 ^= 0xFF;
Expand Down Expand Up @@ -419,7 +419,7 @@ public byte Checksum(params byte[] val)

byte crc = 0xc7;

foreach (byte b in val)
foreach (var b in val)
{
crc = table[(byte)(crc ^ b)];
}
Expand All @@ -435,13 +435,13 @@ public byte[] Table

public byte[] GenerateTable(CRC8_POLY polynomial)
{
byte[] csTable = new byte[256];
var csTable = new byte[256];

for (int i = 0; i < 256; ++i)
for (var i = 0; i < 256; ++i)
{
int curr = i;
var curr = i;

for (int j = 0; j < 8; ++j)
for (var j = 0; j < 8; ++j)
{
if ((curr & 0x80) != 0)
{
Expand Down
Loading

0 comments on commit e841f36

Please sign in to comment.