Skip to content

Commit

Permalink
Release v0.1.8231
Browse files Browse the repository at this point in the history
- Fix: Change Key Of Application is Now Possible by selecting ChangeKeyUsingKeyNo
- Fix: Limited Key Length in DataExplorer
- Fix: Writing Data in Backup Type Files failed
- Fix: Copy Pasting Data in DataExplorerHexView failed when it contained CR.LF or WS
- Fix: When Copy Pasting Data the DataLength is not refreshed after setting the cursor back to the top
- Feature: UpdateScreen now showing the latest Changes
  • Loading branch information
c3rebro committed Jul 15, 2022
1 parent 30043e9 commit 1c84b9f
Show file tree
Hide file tree
Showing 15 changed files with 255 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,12 @@ public Manifest(string data)
/// <value>The base URI.</value>
public string BaseUri { get; private set; }

/// <summary>
/// Gets the base URI.
/// </summary>
/// <value>The base URI.</value>
public string VersionInfoText { get; private set; }

/// <summary>
/// Gets the payload.
/// </summary>
Expand Down Expand Up @@ -102,6 +108,7 @@ private void Load(string data)
RemoteConfigUri = xml.Root.Element("RemoteConfigUri").Value;
BaseUri = xml.Root.Element("BaseUri").Value;
Payloads = xml.Root.Elements("Payload").Select(x => x.Value).ToArray();
VersionInfoText = xml.Root.Element("VersionInfoText").Value;
}
catch (Exception ex)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ public class Updater

public bool AllowUpdate { get; set; }
public bool IsUserNotified { get; set; }
public string UpdateInfoText { get; private set; }

#endregion

Expand Down Expand Up @@ -226,6 +227,7 @@ private void Check(object state)
if (!AllowUpdate && !IsUserNotified)
{
IsUserNotified = true;
UpdateInfoText = this._remoteConfig.VersionInfoText;
NewVersionAvailable(this, null);
return;
}
Expand Down
1 change: 1 addition & 0 deletions RFiDGear/App.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
<mainview:MifareDesfireSetupView x:Key="{x:Type vm:MifareDesfireSetupViewModel}" x:Shared="False" />
<mainview:MifareUltralightSetupView x:Key="{x:Type vm:MifareUltralightSetupViewModel}" x:Shared="False" />
<mainview:SetupView x:Key="{x:Type vm:SetupViewModel}" x:Shared="False" />
<mainview:UpdateNotifierView x:Key="{x:Type vm:UpdateNotifierViewModel}" x:Shared="False" />

<pre:MessageBoxPresenter x:Key="{x:Type dialogsvm:MessageBoxViewModel}" />
<pre:OpenFileDialogPresenter x:Key="{x:Type dialogsvm:OpenFileDialogViewModel}" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ 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 readonly string _baseUri = @"https://github.com/c3rebro/RFiDGear/releases/latest/download/";

private readonly Version Version = Assembly.GetExecutingAssembly().GetName().Version;
Expand Down Expand Up @@ -85,18 +86,21 @@ public SettingsReaderWriter()
XmlElement SecurityTokenElem = doc.CreateElement("SecurityToken");
XmlElement BaseUriElem = doc.CreateElement("BaseUri");
XmlElement PayLoadElem = doc.CreateElement("Payload");
XmlElement InfoTextElem = doc.CreateElement("VersionInfoText");

doc.DocumentElement.AppendChild(CheckIntervalElem);
doc.DocumentElement.AppendChild(RemoteConfigUriElem);
doc.DocumentElement.AppendChild(SecurityTokenElem);
doc.DocumentElement.AppendChild(BaseUriElem);
doc.DocumentElement.AppendChild(PayLoadElem);
doc.DocumentElement.AppendChild(InfoTextElem);

CheckIntervalElem.InnerText = _updateInterval.ToString();
RemoteConfigUriElem.InnerText = _updateURL;
SecurityTokenElem.InnerText = _securityToken;
BaseUriElem.InnerText = _baseUri;
PayLoadElem.InnerText = _payload;
InfoTextElem.InnerText = _infoText;

doc.Save(Path.Combine(appDataPath, _updateConfigFileFileName));
}
Expand Down
6 changes: 3 additions & 3 deletions RFiDGear/DataAccessLayer/Remote/FromIO/RFiDDevice.cs
Original file line number Diff line number Diff line change
Expand Up @@ -725,15 +725,15 @@ public ERROR WriteMiFareClassicWithMAD(int _madApplicationID, int _madStartSecto
mlocation.MADApplicationID = (ushort)_madApplicationID;
mlocation.UseMAD = _useMADToAuth;
mlocation.Sector = _madStartSector;
MifareAccessInfo aiToWrite = new MifareAccessInfoClass();

MifareAccessInfo aiToWrite = new MifareAccessInfoClass();
aiToWrite.UseMAD = _keyToWriteUseMAD;
aiToWrite.MADKeyA.Value = _madAKeyToUse == _madAKeyToWrite ? madAKeyToUse.Value : madAKeyToWrite.Value; // only set new madkey if mad key has changed
aiToWrite.MADKeyB.Value = _madBKeyToUse == _madBKeyToWrite ? madBKeyToUse.Value : madBKeyToWrite.Value; // only set new madkey if mad key has changed
aiToWrite.KeyA.Value = _aKeyToUse == _aKeyToWrite ? mAKeyToUse.Value : mAKeyToWrite.Value;
aiToWrite.KeyB.Value = _bKeyToUse == _bKeyToWrite ? mBKeyToUse.Value : mBKeyToWrite.Value;
aiToWrite.MADGPB = _madGPB;

var aiToUse = new MifareAccessInfoClass();
aiToUse.UseMAD = _useMADToAuth;
aiToUse.KeyA = mAKeyToUse;
Expand Down
8 changes: 8 additions & 0 deletions RFiDGear/RFiDGear.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Properties\WPFAssemblyInfo.cs" />
<Compile Include="ViewModel\MainWindowViewModel.cs" />
<Compile Include="ViewModel\UpdateNotifierViewModel.cs" />
<Compile Include="ViewModel\SplashScreenViewModel.cs" />
<Compile Include="ViewModel\TaskSetupViewModels\GenericChipTaskViewModel.cs" />
<Compile Include="ViewModel\TaskSetupViewModels\CommonTaskViewModel.cs" />
Expand All @@ -214,6 +215,9 @@
<Compile Include="View\MainWindow.xaml.cs">
<DependentUpon>MainWindow.xaml</DependentUpon>
</Compile>
<Compile Include="View\UpdateNotifierView.xaml.cs">
<DependentUpon>UpdateNotifierView.xaml</DependentUpon>
</Compile>
<Compile Include="View\Splash.xaml.cs">
<DependentUpon>Splash.xaml</DependentUpon>
</Compile>
Expand Down Expand Up @@ -306,6 +310,10 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="View\UpdateNotifierView.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="View\Splash.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
Expand Down
2 changes: 1 addition & 1 deletion RFiDGear/View/Splash.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
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:local="clr-namespace:RFiDGear.View"
xmlns:gif="http://wpfanimatedgif.codeplex.com"
xmlns:local="clr-namespace:RFiDGear.View"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
Width="600"
Height="600"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,8 +231,8 @@
BindableSelectionStart="{Binding SelectedDataIndexStart, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}"
BorderThickness="0"
FontFamily="Lucida Console"
IsFocused="{Binding IsFocused}"
Text="{Binding DataAsHexString, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}">
<!-- IsFocused="{Binding IsFocused}" -->
<_3rdP:SelectionBindingTextBox.Style>
<Style TargetType="{x:Type TextBox}">
<Setter Property="TextWrapping" Value="Wrap" />
Expand Down
61 changes: 61 additions & 0 deletions RFiDGear/View/UpdateNotifierView.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
<?xml version="1.0" encoding="utf-8" ?>
<Window
x:Class="RFiDGear.View.UpdateNotifierView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:dal="clr-namespace:RFiDGear.DataAccessLayer"
xmlns:local="clr-namespace:RFiDGear.View"
xmlns:v="clr-namespace:RFiDGear.View"
Title="{Binding Caption}"
Width="500"
Height="600"
WindowStartupLocation="CenterScreen">
<Window.Resources>
<dal:ResourceLoader x:Key="Localization"/>
</Window.Resources>
<Grid Margin="0,0,0,0">
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="42" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="250" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<GroupBox
x:Name="groupBox"
Grid.ColumnSpan="3"
Margin="10,10,10,10"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Header="GroupBox">
<TextBox
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Margin="10,10,10,10"
TextWrapping="Wrap"
IsReadOnly="True"
AcceptsReturn="True"
AcceptsTab="True"
Text="{Binding UpdateHistoryText, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}"/>
</GroupBox>
<Button Grid.Column="1"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Margin="10,10,0,0"
Grid.Row="1"
Width="95"
Command="{Binding ApplyAndExitCommand}"
Content="{Binding LocalizationResourceSet, Converter={StaticResource Localization}, ConverterParameter='buttonSaveAndExitReaderSetupText'}" />
<Button Grid.Column="1"
HorizontalAlignment="Right"
Margin="0,10,10,0"
Grid.Row="1"
VerticalAlignment="Top"
Width="95"
Command="{Binding ApplyAndExitCommand}"
Content="{Binding LocalizationResourceSet, Converter={StaticResource Localization}, ConverterParameter='buttonSaveAndExitReaderSetupText'}"
/>
</Grid>
</Window>
28 changes: 28 additions & 0 deletions RFiDGear/View/UpdateNotifierView.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
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 RFiDGear.View
{
/// <summary>
/// Interaktionslogik für Splash.xaml
/// </summary>
public partial class UpdateNotifierView : Window
{
public UpdateNotifierView()
{
InitializeComponent();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,19 +41,6 @@ public RFiDChipChildLayerViewModel()
children = new ObservableCollection<RFiDChipGrandChildLayerViewModel>();
}

// public RFiDChipChildLayerViewModel(
// MifareClassicSectorModel _sectorModel,
// MifareClassicSetupViewModel _setupViewModel)
// {
// sectorModel = _sectorModel;
// setupViewModel = _setupViewModel;
//
// isTask = true;
// children = new ObservableCollection<RFiDChipGrandChildLayerViewModel>();
//
// LoadChildren();
// }

public RFiDChipChildLayerViewModel(
MifareClassicSectorModel _sectorModel,
RFiDChipParentLayerViewModel parent,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -492,9 +492,11 @@ public int SelectedDataIndexStart
set
{
selectedDataIndexStart = value;

if (value % 2 == 0)
{
SelectedDataIndexStartInBytes = value/2;
SelectedDataLengthInBytes = DataAsHexString.Length/2 - value/2;
IsValidSelectedDataIndexAndLength = true;
}
else
Expand Down
39 changes: 37 additions & 2 deletions RFiDGear/ViewModel/MainWindowViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ public class MainWindowViewModel : ViewModelBase
// set if task was completed; indicates greenlight to continue execution
//if programming takes too long; quit the process
private bool firstRun = true;
private bool updateAvailable = false;
private protected Mutex mutex;
//one reader, one instance - only

Expand Down Expand Up @@ -158,7 +159,7 @@ public MainWindowViewModel()

Application.Current.MainWindow.Closing += new CancelEventHandler(CloseThreads);
Application.Current.MainWindow.Activated += new EventHandler(LoadCompleted);
updater.NewVersionAvailable += new EventHandler(AskForUpdateNow);
updater.NewVersionAvailable += new EventHandler(EnableUpdate);

//reminder: any dialog boxes added in the constructor won't appear until DialogBehavior.DialogViewModels gets bound to the Dialogs collection.
}
Expand Down Expand Up @@ -3295,8 +3296,14 @@ public bool RadioButtonEnglishLanguageSelectedState

#region Extensions

private void EnableUpdate(object sender, EventArgs e)
{
updateAvailable = true;
}

private void AskForUpdateNow(object sender, EventArgs e)
{
/*
if (new MessageBoxViewModel
{
Caption = ResourceLoader.getResource("messageBoxUpdateAvailableCaption"),
Expand All @@ -3309,6 +3316,30 @@ private void AskForUpdateNow(object sender, EventArgs e)
{
(sender as Updater).AllowUpdate = false;
}
*/

updateAvailable = false;

this.Dialogs.Add(new UpdateNotifierViewModel(updater.UpdateInfoText)
{

Caption = "Update Available",

OnOk = (updateAction) =>
{
(sender as Updater).Update();
updateAction.Close();
},

OnCancel = (updateAction) =>
{
(sender as Updater).AllowUpdate = false;
updateAction.Close();
}
});




}

Expand All @@ -3334,11 +3365,14 @@ private void LoadCompleted(object sender, EventArgs e)
mw = (MainWindow)Application.Current.MainWindow;
mw.Title = string.Format("RFiDGear {0}.{1}.{2} {3}", Version.Major, Version.Minor, Version.Build, Constants.TITLE_SUFFIX);

if (updateAvailable)
AskForUpdateNow(null, null);

Task thread = new Task(() =>
{
while (true)
{
for(int i = 0; i<=10; i++)
for (int i = 0; i<=10; i++)
{
Thread.Sleep(500);
ReaderStatus = string.Format("{0}", DateTime.Now);
Expand Down Expand Up @@ -3372,6 +3406,7 @@ private void LoadCompleted(object sender, EventArgs e)
{
});


thread.Start();

if (firstRun)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1257,7 +1257,6 @@ public string SelectedMADVersion

RaisePropertyChanged("SelectedMADVersion");
}

}
private string selectedMADVersion;
private byte selectedMADVersionAsByte;
Expand Down
Loading

0 comments on commit 1c84b9f

Please sign in to comment.