Skip to content

Commit

Permalink
Version 0.1.8239: Improvements
Browse files Browse the repository at this point in the history
- Improvement: 	remove '-' character when copy/paste data as "Hex"-String
- Improvement:	Closing "Update Dialog" without using "Cancel Button" does no
				longer minimize mainWindow
- Improvement: 	changed "application id" to application code and
				function cluster code according to NXP AN10787 (MAD)
- Improvement:	RunTask as ContextMenuItem
  • Loading branch information
c3rebro committed Jul 23, 2022
1 parent c133e06 commit d707038
Show file tree
Hide file tree
Showing 9 changed files with 188 additions and 74 deletions.
30 changes: 13 additions & 17 deletions RFiDGear/3rdParty/RedCell/RedCell.Diagnostics.Update/Updater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,8 @@ public Updater(FileInfo configFile)

catch (Exception e)
{
LogWriter.CreateLogEntry(string.Format("{0}\n{1}", e.Message, e.InnerException != null ? e.InnerException.Message : ""));
LogWriter.CreateLogEntry(string.Format("{0}: {1}; {2}", DateTime.Now, e.Message, e.InnerException != null ? e.InnerException.Message : ""));
}
//LogWriter.CreateLogEntry(string.Format("{0}\n{1}",e.Message, e.InnerException != null ? e.InnerException.Message : ""));
}
#endregion

Expand Down Expand Up @@ -183,43 +182,40 @@ private void Check(object state)

catch (Exception e)
{
LogWriter.CreateLogEntry(string.Format("{0}\n{1}", e.Message, e.InnerException != null ? e.InnerException.Message : ""));
LogWriter.CreateLogEntry(string.Format("{0}: {1}; {2}", DateTime.Now, e.Message, e.InnerException != null ? e.InnerException.Message : ""));
_remoteConfig = null;
return;
}

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

//string.Format("{0}{1}",this._localConfig.RemoteConfigUri,settings.DefaultLanguage == "german" ? "/de-de" : "/en-us")
if (_remoteConfig == null)
{
return;
}

if (_localConfig.SecurityToken != _remoteConfig.SecurityToken)
{
Log.Write("Security token mismatch.");
LogWriter.CreateLogEntry(string.Format("{0}: {1}", DateTime.Now, "Security token mismatch."));
return;
}
Log.Write("Remote config is valid.");
Log.Write("Local version is {0}.", _localConfig.Version);
Log.Write("Remote version is {0}.", _remoteConfig.Version);
LogWriter.CreateLogEntry(string.Format("{0}: {1}", DateTime.Now, "Remote config is valid.")); Log.Write("Remote config is valid.");
LogWriter.CreateLogEntry(string.Format("{0}: {1}, {2}", DateTime.Now, "Local version is ", _localConfig.Version));
LogWriter.CreateLogEntry(string.Format("{0}: {1}, {2}", DateTime.Now, "Remote version is ", _remoteConfig.Version));

if (_remoteConfig.Version == _localConfig.Version)
{
Log.Write("Versions are the same.");
Log.Write("Check ending.");
LogWriter.CreateLogEntry(string.Format("{0}: {1}", DateTime.Now, "Versions are the same. Check ending."));
return;
}
if (_remoteConfig.Version < _localConfig.Version)
{
Log.Write("Remote version is older. That's weird.");
Log.Write("Check ending.");
LogWriter.CreateLogEntry(string.Format("{0}: {1}", DateTime.Now, "Remote version is older. That's weird. Check ending."));
return;
}

Log.Write("Remote version is newer. Updating.");
LogWriter.CreateLogEntry(string.Format("{0}: {1}", DateTime.Now, "Remote version is newer. Updating."));
_timer.Change(0, 1000);

if (!AllowUpdate && !IsUserNotified)
Expand Down Expand Up @@ -257,7 +253,7 @@ public void Update()
try { Directory.Delete(Path.Combine(appDataPath, WorkPath), true); }
catch (IOException e)
{
LogWriter.CreateLogEntry(string.Format("{0}\n{1}", e.Message, e.InnerException != null ? e.InnerException.Message : ""));
LogWriter.CreateLogEntry(string.Format("{0}: {1}; {2}", DateTime.Now, e.Message, e.InnerException != null ? e.InnerException.Message : ""));
return;
}
}
Expand All @@ -270,7 +266,7 @@ public void Update()
}
catch (Exception e)
{
LogWriter.CreateLogEntry(string.Format("{0}\n{1}", e.Message, e.InnerException != null ? e.InnerException.Message : ""));
LogWriter.CreateLogEntry(string.Format("{0}: {1}; {2}", DateTime.Now, e.Message, e.InnerException != null ? e.InnerException.Message : ""));
return;
}
}
Expand Down Expand Up @@ -308,7 +304,7 @@ public void Update()
}
catch (Exception e)
{
LogWriter.CreateLogEntry(string.Format("{0}\n{1}", e.Message, e.InnerException != null ? e.InnerException.Message : ""));
LogWriter.CreateLogEntry(string.Format("{0}: {1}; {2}", DateTime.Now, e.Message, e.InnerException != null ? e.InnerException.Message : ""));
return;
}
}
Expand Down Expand Up @@ -336,7 +332,7 @@ public void Update()

catch (Exception e)
{
LogWriter.CreateLogEntry(string.Format("{0}\n{1}", e.Message, e.InnerException != null ? e.InnerException.Message : ""));
LogWriter.CreateLogEntry(string.Format("{0}: {1}; {2}", DateTime.Now, e.Message, e.InnerException != null ? e.InnerException.Message : ""));
return;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ public SettingsReaderWriter()
}
catch (Exception e)
{
LogWriter.CreateLogEntry(string.Format("{0}\n{1}", e.Message, e.InnerException != null ? e.InnerException.Message : ""));
LogWriter.CreateLogEntry(string.Format("{0}: {1}; {2}", DateTime.Now, e.Message, e.InnerException != null ? e.InnerException.Message : ""));
}

if (!File.Exists(Path.Combine(appDataPath, _settingsFileFileName)))
Expand Down Expand Up @@ -195,7 +195,7 @@ public bool ReadSettings(string _fileName = "")
}
catch (Exception e)
{
LogWriter.CreateLogEntry(string.Format("{0}\n{1}", e.Message, e.InnerException != null ? e.InnerException.Message : ""));
LogWriter.CreateLogEntry(string.Format("{0}: {1}; {2}", DateTime.Now, e.Message, e.InnerException != null ? e.InnerException.Message : ""));
return true;
}

Expand Down Expand Up @@ -225,7 +225,7 @@ public bool SaveSettings(string _path = "")
}
catch (XmlException e)
{
LogWriter.CreateLogEntry(string.Format("{0}\n{1}", e.Message, e.InnerException != null ? e.InnerException.Message : ""));
LogWriter.CreateLogEntry(string.Format("{0}: {1}; {2}", DateTime.Now, e.Message, e.InnerException != null ? e.InnerException.Message : ""));
return false;
}
}
Expand All @@ -250,7 +250,7 @@ protected virtual void Dispose(bool disposing)

catch (Exception e)
{
LogWriter.CreateLogEntry(string.Format("{0}\n{1}", e.Message, e.InnerException != null ? e.InnerException.Message : ""));
LogWriter.CreateLogEntry(string.Format("{0}: {1}; {2}", DateTime.Now, e.Message, e.InnerException != null ? e.InnerException.Message : ""));
}
}

Expand Down
3 changes: 3 additions & 0 deletions RFiDGear/Resources/Manifest.de.resx
Original file line number Diff line number Diff line change
Expand Up @@ -1081,4 +1081,7 @@ Needed by:
<data name="buttonContentDoUpdateCommand" xml:space="preserve">
<value>Update starten</value>
</data>
<data name="contextMenuItemExecuteSelectedItem" xml:space="preserve">
<value>gewählte Aufgabe ausführen</value>
</data>
</root>
3 changes: 3 additions & 0 deletions RFiDGear/Resources/Manifest.en.resx
Original file line number Diff line number Diff line change
Expand Up @@ -1065,4 +1065,7 @@ Needed by:
<data name="buttonContentDoUpdateCommand" xml:space="preserve">
<value>Update</value>
</data>
<data name="contextMenuItemExecuteSelectedItem" xml:space="preserve">
<value>Run Selected Task</value>
</data>
</root>
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@
<Style TargetType="{x:Type TextBox}">
<Setter Property="TextWrapping" Value="Wrap" />
<Setter Property="MaxWidth" Value="250" />
<Setter Property="AcceptsReturn" Value="True" />
<!-- <Setter
Property="VerticalAlignment"
Value="Top" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -267,27 +267,27 @@
HorizontalAlignment="Left"
VerticalAlignment="Top"
Content="Use MAD"
IsChecked="{Binding UseMAD, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
IsChecked="{Binding UseMAD, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}" />
<Label
Grid.Row="0"
Grid.Column="0"
Height="26"
Margin="128,4,0,0"
Margin="265,6,0,0"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Content="MAD Version" />
<ComboBox
Grid.Row="0"
Height="24"
Margin="217,4,251,9"
Margin="349,8,119,10"
VerticalAlignment="Stretch"
ItemsSource="{Binding MADVersions}"
SelectedItem="{Binding SelectedMADVersion, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
<CheckBox
Grid.Row="0"
Width="176"
Width="114"
Height="15"
Margin="0,10,53,0"
Margin="0,10,0,0"
HorizontalAlignment="Right"
VerticalAlignment="Top"
Content="Multi Application"
Expand Down Expand Up @@ -326,17 +326,15 @@
Margin="8,9,7,7"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Content="Application ID" />
Content="Application Code" />
<Label
Grid.Row="1"
Grid.Column="0"
Margin="8,3,7,7"
Grid.Column="2"
Margin="10,3,10,7"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Content="@Sector" />
Content="Start @Sector" />
<ComboBox
Grid.Row="1"
Grid.Column="1"
Grid.Column="3"
Height="21"
Margin="10,8,10,7"
HorizontalAlignment="Stretch"
Expand Down Expand Up @@ -529,22 +527,20 @@
</GroupBox>
</Grid>
<CheckBox
Grid.Row="1"
Grid.Column="2"
Grid.ColumnSpan="2"
Height="15"
Margin="10,11,34,0"
HorizontalAlignment="Stretch"
Height="14"
Margin="94,-54,0,0"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Content="Use MAD Authentification"
IsChecked="{Binding UseMadAuth, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
IsChecked="{Binding UseMadAuth, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Width="162" />
<Label
Grid.Column="2"
Height="26"
Margin="10,8,6,2"
Margin="10,3,6,7"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Content="Size" />
Content="Size" Grid.Row="1" />
<TextBox
Grid.Column="3"
Height="21"
Expand All @@ -553,7 +549,7 @@
VerticalAlignment="Top"
HorizontalContentAlignment="Left"
VerticalContentAlignment="Center"
Text="{Binding FileSize, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}">
Text="{Binding FileSize, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Grid.Row="1">

<TextBox.Resources>
<Style TargetType="{x:Type TextBox}">
Expand Down Expand Up @@ -581,16 +577,51 @@
VerticalAlignment="Top"
HorizontalContentAlignment="Left"
VerticalContentAlignment="Center"
Text="{Binding AppNumber, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}">
Text="{Binding ApplicationCode, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}">
<TextBox.Resources>
<Style TargetType="{x:Type TextBox}">
<Style.Triggers>
<DataTrigger Binding="{Binding IsValidApplicationCode}" Value="True">
<Setter Property="Foreground" Value="Green" />
<Setter Property="Background" Value="White" />
<Setter Property="FontWeight" Value="Normal" />
</DataTrigger>
<DataTrigger Binding="{Binding IsValidApplicationCode}" Value="False">
<Setter Property="Foreground" Value="Black" />
<Setter Property="Background" Value="Red" />
<Setter Property="FontWeight" Value="Normal" />
</DataTrigger>
</Style.Triggers>
</Style>
</TextBox.Resources>
</TextBox>
<Label
Grid.Row="1"
Grid.Column="0"
Height="26"
Margin="8,6,7,4"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Content="Function Cluster Code" />
<TextBox
Grid.Row="1"
Grid.Column="1"
Height="21"
Margin="10,5,10,0"
HorizontalAlignment="Stretch"
VerticalAlignment="Top"
HorizontalContentAlignment="Left"
VerticalContentAlignment="Center"
Text="{Binding FunctionClusterCode, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}">
<TextBox.Resources>
<Style TargetType="{x:Type TextBox}">
<Style.Triggers>
<DataTrigger Binding="{Binding IsValidAppNumber}" Value="True">
<DataTrigger Binding="{Binding IsValidFunctionClusterCode}" Value="True">
<Setter Property="Foreground" Value="Green" />
<Setter Property="Background" Value="White" />
<Setter Property="FontWeight" Value="Normal" />
</DataTrigger>
<DataTrigger Binding="{Binding IsValidAppNumber}" Value="False">
<DataTrigger Binding="{Binding IsValidFunctionClusterCode}" Value="False">
<Setter Property="Foreground" Value="Black" />
<Setter Property="Background" Value="Red" />
<Setter Property="FontWeight" Value="Normal" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ public string DataAsHexString
}
set
{
dataBlockAsHexString = value.Replace("\r", "").Replace("\n", "").Replace(" ", "");
dataBlockAsHexString = value.Replace("\r", "").Replace("\n", "").Replace(" ", "").Replace("-", "");

if (mifareClassicDataBlock != null && value.Length == 32 && CustomConverter.IsInHexFormat(value))
{
Expand Down
14 changes: 13 additions & 1 deletion RFiDGear/ViewModel/MainWindowViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,13 @@ public MainWindowViewModel()
})
});

rowContextMenuItems.Add(new MenuItem()
{
Header = ResourceLoader.GetResource("contextMenuItemExecuteSelectedItem"),
Command = WriteSelectedTaskToChipOnceCommand
});


Application.Current.MainWindow.Closing += new CancelEventHandler(CloseThreads);
Application.Current.MainWindow.Activated += new EventHandler(LoadCompleted);
updater.NewVersionAvailable += new EventHandler(EnableUpdate);
Expand Down Expand Up @@ -651,7 +658,6 @@ private void OnNewCreateDesfireTaskCommand()
{
if (device != null)
{

Dialogs.Add(new MifareDesfireSetupViewModel(SelectedSetupViewModel, dialogs)
{
Caption = ResourceLoader.GetResource("windowCaptionAddEditMifareDesfireTask"),
Expand Down Expand Up @@ -3795,6 +3801,12 @@ private void AskForUpdateNow()
},

OnCancel = (updateAction) =>
{
updater.AllowUpdate = false;
updateAction.Close();
},

OnCloseRequest = (updateAction) =>
{
updater.AllowUpdate = false;
updateAction.Close();
Expand Down
Loading

0 comments on commit d707038

Please sign in to comment.