Skip to content

Commit

Permalink
replace windows with unix line endings
Browse files Browse the repository at this point in the history
and remove BOM from config file
  • Loading branch information
Stricted committed Jan 23, 2016
1 parent 51c3eca commit 25c810a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
10 changes: 3 additions & 7 deletions SPHDecode/Implementations/Cryptography.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,15 +90,11 @@ private static byte[] AESHelper (byte[] data, bool decrypt = false)
encryptor.IV = IV;

MemoryStream ms = new MemoryStream();
CryptoStream cs;
CryptoStream cs = new CryptoStream(ms, encryptor.CreateEncryptor(), CryptoStreamMode.Write);

if (decrypt)
{
cs = new CryptoStream(ms, encryptor.CreateDecryptor(), CryptoStreamMode.Write);
}
else {
cs = new CryptoStream(ms, encryptor.CreateEncryptor(), CryptoStreamMode.Write);
}


cs.Write(data, 0, data.Length);
cs.Close();

Expand Down
6 changes: 6 additions & 0 deletions SPHDecode/Model/MainWindowModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,12 @@ private void OndstFileDialogExecute()
private void OnencryptExecute()
{
string orig = File.ReadAllText(srcFile);
// remove BOM from utf-8 file
orig = orig.Replace("\ufeff", "");

// replace windows with unix line endings
orig = orig.Replace("\r\n", "\n").Replace("\r", "\n");

byte[] encode = Cryptography.Encrypt(orig);
if (Object.Equals(encode, null).Equals(false))
{
Expand Down

0 comments on commit 25c810a

Please sign in to comment.