forked from SapphireServer/ffxivmon
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add missing files from previous commit
- Loading branch information
Showing
2 changed files
with
158 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<Window x:Class="FFXIVMonReborn.Views.AnonymiseView" | ||
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:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
xmlns:local="clr-namespace:FFXIVMonReborn.Views" | ||
mc:Ignorable="d" | ||
Title="AnonymiseView" Height="476" Width="818"> | ||
<Grid> | ||
<Grid.ColumnDefinitions> | ||
<ColumnDefinition Width="42*"/> | ||
<ColumnDefinition Width="367*"/> | ||
</Grid.ColumnDefinitions> | ||
|
||
<Grid Grid.ColumnSpan="2"> | ||
<Label Content="Content ID: (My Games/FINAL FANTASY XIV - A REALM REBORN/FFXIV__CHR################)" HorizontalAlignment="Left" VerticalAlignment="Top" Width="569" FontWeight="Bold" Margin="10,4,0,0"/> | ||
<TextBox x:Name="_ContentIDs" HorizontalAlignment="Left" Margin="10,30,0,0" TextChanged="_ContentIDs_TextChanged" TextWrapping="Wrap" Text="004000AABBCCDDEE" VerticalAlignment="Top" Width="250" Height="24"/> | ||
<Label x:Name="_ParsedContentId" Content="UInt64: " HorizontalAlignment="Left" Margin="272,28,0,0" VerticalAlignment="Top" Width="203"/> | ||
|
||
<Label Content="Character Name (ASCII string):" HorizontalAlignment="Left" Margin="10,78,0,328" Width="191" FontWeight="Bold"/> | ||
<TextBox x:Name="_CharacterNames" HorizontalAlignment="Left" Margin="10,106,0,0" TextWrapping="Wrap" Text="Main Character" VerticalAlignment="Top" Width="250" Height="25"/> | ||
|
||
<Label Content="Replace Strings (ASCII string, case-insensitive find):
" HorizontalAlignment="Left" Margin="10,150,0,0" VerticalAlignment="Top" Width="300" Height="29" FontWeight="Bold"/> | ||
<Label Content="findString
replaceString

findString#
replaceString#" HorizontalAlignment="Left" Margin="10,171,0,170" Width="95"/> | ||
<Label Content="Linkshell/FC names go here (and anything else that needs scrubbing).

NOTE: (replaceString.length <= findString.length)
Replacement strings shorter than the find string will be \0 padded to the find string length.
Excess whitespace will be stripped." HorizontalAlignment="Left" Margin="106,171,0,170" Width="494"/> | ||
<TextBox x:Name="_ReplaceStrings" HorizontalAlignment="Left" Margin="10,268,0,0" TextWrapping="Wrap" AcceptsReturn="True" VerticalScrollBarVisibility="Visible" Text="Find some string case-insensitive
Replace Case Sensitive

Find me three
Replace Me3" VerticalAlignment="Top" Width="737" Height="90"/> | ||
<Label Content="NOTE:
This does not guarantee full anonymisation of data, just makes it slightly harder for anyone to immediately tell who this belongs to.
Chat packets cannot be reliably found so must be manually modified." HorizontalAlignment="Left" Margin="10,363,0,21" Width="737"/> | ||
</Grid> | ||
<Button x:Name="OK" Content="OK" HorizontalAlignment="Left" Margin="665,398,0,0" VerticalAlignment="Top" Height="26" Width="41" Click="OK_Click" Grid.Column="1"/> | ||
</Grid> | ||
</Window> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
using FFXIVMonReborn.Properties; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Globalization; | ||
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.Shapes; | ||
|
||
namespace FFXIVMonReborn.Views | ||
{ | ||
/// <summary> | ||
/// Interaction logic for AnonymiseView.xaml | ||
/// </summary> | ||
public partial class AnonymiseView : Window | ||
{ | ||
private string ContentID; | ||
private string CharacterName; | ||
private Dictionary<string, string> ReplaceStrings; | ||
|
||
public AnonymiseView() | ||
{ | ||
InitializeComponent(); | ||
LoadDefaultSettings(); | ||
} | ||
|
||
public string GetContentID() | ||
{ | ||
return ContentID; | ||
} | ||
|
||
public string GetCharacterName() | ||
{ | ||
return CharacterName; | ||
} | ||
|
||
public Dictionary<string, string> GetReplacementStrings() | ||
{ | ||
return ReplaceStrings; | ||
} | ||
|
||
public void LoadDefaultSettings() | ||
{ | ||
_ContentIDs.Text = Settings.Default.AnonymiseContentID; | ||
_CharacterNames.Text = Settings.Default.AnonymiseCharacterName; | ||
_ReplaceStrings.Text = Settings.Default.AnonymiseStrings; | ||
} | ||
|
||
public void SaveAsDefaultSettings() | ||
{ | ||
Settings.Default.AnonymiseContentID = _ContentIDs.Text; | ||
Settings.Default.AnonymiseCharacterName = _CharacterNames.Text; | ||
Settings.Default.AnonymiseStrings = _ReplaceStrings.Text; | ||
|
||
Settings.Default.Save(); | ||
} | ||
|
||
private void OK_Click(object sender, RoutedEventArgs e) | ||
{ | ||
var success = false; | ||
|
||
ContentID = ""; | ||
foreach (var str in _ContentIDs.Text.Split(',')) | ||
{ | ||
var str2 = str.Trim(); | ||
if (str2.Length == 16) | ||
ContentID = str2; | ||
} | ||
|
||
try | ||
{ | ||
UInt64 val = Convert.ToUInt64("0x" + _ContentIDs.Text.Trim(), 16); | ||
if (val > 0x0040000000000000 && val < 0x0050000000000000) | ||
success = true; | ||
} | ||
catch (Exception ex) | ||
{ | ||
MessageBox.Show("Invalid ContentID entered. Must be a 8 byte hex string without spaces."); | ||
success = false; | ||
} | ||
|
||
CharacterName = _CharacterNames.Text.Trim(); | ||
|
||
ReplaceStrings = new Dictionary<string, string>(); | ||
|
||
for (var i = 0; i < _ReplaceStrings.LineCount; ++i) | ||
{ | ||
var find = _ReplaceStrings.GetLineText(i); | ||
if (string.IsNullOrWhiteSpace(find)) continue; | ||
|
||
var replace = _ReplaceStrings.GetLineText(i + 1); | ||
|
||
ReplaceStrings.Add(find.Trim().ToLower(), replace.Trim()); | ||
++i; | ||
} | ||
|
||
if (success) | ||
{ | ||
SaveAsDefaultSettings(); | ||
} | ||
this.DialogResult = success; | ||
} | ||
|
||
private void _ContentIDs_TextChanged(object sender, TextChangedEventArgs e) | ||
{ | ||
if (this._ParsedContentId == null) | ||
return; | ||
|
||
try | ||
{ | ||
UInt64 val = Convert.ToUInt64("0x" + _ContentIDs.Text.Trim(), 16); | ||
if (val > 0x0040000000000000 && val < 0x0050000000000000) | ||
this._ParsedContentId.Content = "UInt64: " + val.ToString(); | ||
else | ||
this._ParsedContentId.Content = "UInt64: Invalid"; | ||
} | ||
catch (Exception ex) { } | ||
} | ||
} | ||
} |