Add import item from clipboard

This commit is contained in:
Kurt
2020-08-03 14:45:28 -07:00
parent 47c739a295
commit fec5c7e432

View File

@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Windows.Forms;
using NHSE.Core;
@@ -370,6 +371,19 @@ private void NUD_Count_ValueChanged(object sender, EventArgs e)
private void PB_Item_Click(object sender, EventArgs e)
{
// Import if requested
if (ModifierKeys == Keys.Shift && Clipboard.ContainsText())
{
var text = Clipboard.GetText();
if (!ulong.TryParse(text, NumberStyles.AllowHexSpecifier, CultureInfo.CurrentCulture, out var val))
return;
var import = BitConverter.GetBytes(val).ToClass<Item>();
LoadItem(import);
System.Media.SystemSounds.Asterisk.Play();
return;
}
// Otherwise, export
var item = SetItem(new Item());
var data = item.ToBytesClass();
var u64 = BitConverter.ToUInt64(data, 0);