本文整理汇总了C#中MainWindow.HandleErrorMessage方法的典型用法代码示例。如果您正苦于以下问题:C# MainWindow.HandleErrorMessage方法的具体用法?C# MainWindow.HandleErrorMessage怎么用?C# MainWindow.HandleErrorMessage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MainWindow
的用法示例。
在下文中一共展示了MainWindow.HandleErrorMessage方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SpellFocusObject
// End DBCs
public SpellFocusObject(MainWindow window, MySQL.MySQL mySQLConn)
{
main = window;
mySQL = mySQLConn;
for (UInt32 i = 0; i < header.RecordCount; ++i)
{
body.records[i].ID = new UInt32();
body.records[i].Name = new UInt32[16];
body.records[i].Flags = new UInt32();
}
if (!File.Exists("DBC/SpellFocusObject.dbc"))
{
main.HandleErrorMessage("SpellFocusObject.dbc was not found!");
return;
}
FileStream fileStream = new FileStream("DBC/SpellFocusObject.dbc", FileMode.Open);
int count = Marshal.SizeOf(typeof(DBC_Header));
byte[] readBuffer = new byte[count];
BinaryReader reader = new BinaryReader(fileStream);
readBuffer = reader.ReadBytes(count);
GCHandle handle = GCHandle.Alloc(readBuffer, GCHandleType.Pinned);
header = (DBC_Header)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(DBC_Header));
handle.Free();
body.records = new SpellFocusObject_DBC_Record[header.RecordCount];
for (UInt32 i = 0; i < header.RecordCount; ++i)
{
count = Marshal.SizeOf(typeof(SpellFocusObject_DBC_Record));
readBuffer = new byte[count];
reader = new BinaryReader(fileStream);
readBuffer = reader.ReadBytes(count);
handle = GCHandle.Alloc(readBuffer, GCHandleType.Pinned);
body.records[i] = (SpellFocusObject_DBC_Record)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(SpellFocusObject_DBC_Record));
handle.Free();
}
body.StringBlock = Encoding.UTF8.GetString(reader.ReadBytes(header.StringBlockSize));
reader.Close();
fileStream.Close();
body.lookup = new List<SpellFocusObjectLookup>();
int boxIndex = 1;
main.RequiresSpellFocus.Items.Add("None");
SpellFocusObjectLookup t;
t.ID = 0;
t.offset = 0;
t.stringHash = "None".GetHashCode();
t.comboBoxIndex = 0;
body.lookup.Add(t);
for (UInt32 i = 0; i < header.RecordCount; ++i)
{
int offset = (int)body.records[i].Name[0];
if (offset == 0) { continue; }
int returnValue = offset;
string toAdd = "";
while (body.StringBlock[offset] != '\0') { toAdd += body.StringBlock[offset++]; }
SpellFocusObjectLookup temp;
temp.ID = (int)body.records[i].ID;
temp.offset = returnValue;
temp.stringHash = toAdd.GetHashCode();
temp.comboBoxIndex = boxIndex;
main.RequiresSpellFocus.Items.Add(toAdd);
body.lookup.Add(temp);
boxIndex++;
}
}
示例2: SpellCastTimes
// End DBCs
public SpellCastTimes(MainWindow window, MySQL.MySQL mySQLConn)
{
main = window;
mySQL = mySQLConn;
for (UInt32 i = 0; i < header.RecordCount; ++i)
{
body.records[i].ID = new UInt32();
body.records[i].CastingTime = new Int32();
body.records[i].CastingTimePerLevel = new float();
body.records[i].MinimumCastingTime = new Int32();
}
if (!File.Exists("DBC/SpellCastTimes.dbc"))
{
main.HandleErrorMessage("SpellCastTimes.dbc was not found!");
return;
}
FileStream fileStream = new FileStream("DBC/SpellCastTimes.dbc", FileMode.Open);
int count = Marshal.SizeOf(typeof(DBC_Header));
byte[] readBuffer = new byte[count];
BinaryReader reader = new BinaryReader(fileStream);
readBuffer = reader.ReadBytes(count);
GCHandle handle = GCHandle.Alloc(readBuffer, GCHandleType.Pinned);
header = (DBC_Header)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(DBC_Header));
handle.Free();
body.records = new SpellCastTimes_DBC_Record[header.RecordCount];
for (UInt32 i = 0; i < header.RecordCount; ++i)
{
count = Marshal.SizeOf(typeof(SpellCastTimes_DBC_Record));
readBuffer = new byte[count];
reader = new BinaryReader(fileStream);
readBuffer = reader.ReadBytes(count);
handle = GCHandle.Alloc(readBuffer, GCHandleType.Pinned);
body.records[i] = (SpellCastTimes_DBC_Record)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(SpellCastTimes_DBC_Record));
handle.Free();
}
reader.Close();
fileStream.Close();
body.lookup = new List<SpellCastTimeLookup>();
int boxIndex = 1;
main.CastTime.Items.Add(0);
SpellCastTimeLookup t;
t.ID = 0;
t.comboBoxIndex = 0;
body.lookup.Add(t);
for (UInt32 i = 0; i < header.RecordCount; ++i)
{
int castTime = (int)body.records[i].CastingTime;
SpellCastTimeLookup temp;
temp.ID = (int)body.records[i].ID;
temp.comboBoxIndex = boxIndex;
main.CastTime.Items.Add(castTime);
body.lookup.Add(temp);
boxIndex++;
}
}
示例3: SpellDuration
// End DBCs
public SpellDuration(MainWindow window, SpellDBC spellDBC)
{
main = window;
spell = spellDBC;
for (UInt32 i = 0; i < header.RecordCount; ++i)
{
body.records[i].ID = new UInt32();
body.records[i].BaseDuration = new Int32();
body.records[i].PerLevel = new Int32();
body.records[i].MaximumDuration = new Int32();
}
if (!File.Exists("DBC/SpellDuration.dbc"))
{
main.HandleErrorMessage("SpellDuration.dbc was not found!");
return;
}
FileStream fileStream = new FileStream("DBC/SpellDuration.dbc", FileMode.Open);
int count = Marshal.SizeOf(typeof(DBC_Header));
byte[] readBuffer = new byte[count];
BinaryReader reader = new BinaryReader(fileStream);
readBuffer = reader.ReadBytes(count);
GCHandle handle = GCHandle.Alloc(readBuffer, GCHandleType.Pinned);
header = (DBC_Header)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(DBC_Header));
handle.Free();
body.records = new SpellDurationRecord[header.RecordCount];
for (UInt32 i = 0; i < header.RecordCount; ++i)
{
count = Marshal.SizeOf(typeof(SpellDurationRecord));
readBuffer = new byte[count];
reader = new BinaryReader(fileStream);
readBuffer = reader.ReadBytes(count);
handle = GCHandle.Alloc(readBuffer, GCHandleType.Pinned);
body.records[i] = (SpellDurationRecord)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(SpellDurationRecord));
handle.Free();
}
reader.Close();
fileStream.Close();
body.lookup = new List<SpellDurationLookup>();
int boxIndex = 1;
main.Duration.Items.Add(0);
SpellDurationLookup t;
t.ID = 0;
t.comboBoxIndex = 0;
body.lookup.Add(t);
for (UInt32 i = 0; i < header.RecordCount; ++i)
{
int baseDuration = (int)body.records[i].BaseDuration;
SpellDurationLookup temp;
temp.ID = (int)body.records[i].ID;
temp.comboBoxIndex = boxIndex;
main.Duration.Items.Add(baseDuration);
body.lookup.Add(temp);
boxIndex++;
}
}
示例4: SpellRange
// End DBCs
public SpellRange(MainWindow window, SpellDBC spellDBC)
{
main = window;
spell = spellDBC;
for (UInt32 i = 0; i < header.RecordCount; ++i)
{
body.records[i].ID = new UInt32();
body.records[i].MinimumRangeHostile = new float();
body.records[i].MinimumRangeFriend = new float();
body.records[i].MaximumRangeHostile = new float();
body.records[i].MaximumRangeFriend = new float();
body.records[i].Type = new Int32();
body.records[i].Name = new UInt32[16];
body.records[i].NameFlags = new UInt32();
body.records[i].ShortName = new UInt32[16];
body.records[i].ShortNameFlags = new UInt32();
}
if (!File.Exists("DBC/SpellRange.dbc"))
{
main.HandleErrorMessage("SpellRange.dbc was not found!");
return;
}
FileStream fileStream = new FileStream("DBC/SpellRange.dbc", FileMode.Open);
int count = Marshal.SizeOf(typeof(DBC_Header));
byte[] readBuffer = new byte[count];
BinaryReader reader = new BinaryReader(fileStream);
readBuffer = reader.ReadBytes(count);
GCHandle handle = GCHandle.Alloc(readBuffer, GCHandleType.Pinned);
header = (DBC_Header)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(DBC_Header));
handle.Free();
body.records = new SpellRange_DBC_Record[header.RecordCount];
for (UInt32 i = 0; i < header.RecordCount; ++i)
{
count = Marshal.SizeOf(typeof(SpellRange_DBC_Record));
readBuffer = new byte[count];
reader = new BinaryReader(fileStream);
readBuffer = reader.ReadBytes(count);
handle = GCHandle.Alloc(readBuffer, GCHandleType.Pinned);
body.records[i] = (SpellRange_DBC_Record)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(SpellRange_DBC_Record));
handle.Free();
}
body.StringBlock = Encoding.UTF8.GetString(reader.ReadBytes(header.StringBlockSize));
reader.Close();
fileStream.Close();
body.lookup = new List<SpellRangeLookup>();
int boxIndex = 0;
for (UInt32 i = 0; i < header.RecordCount; ++i)
{
int offset = (int)body.records[i].Name[0];
int MinimumRangeHostile = (int)body.records[i].MinimumRangeHostile;
int MaximumRangeHostile = (int)body.records[i].MaximumRangeHostile;
int MinimumRangeFriend = (int)body.records[i].MinimumRangeFriend;
int MaximumRangeFriend = (int)body.records[i].MaximumRangeFriend;
if (offset == 0) { continue; }
int returnValue = offset;
string toAdd = "";
while (body.StringBlock[offset] != 0) { toAdd += body.StringBlock[offset++]; }
SpellRangeLookup temp;
temp.ID = (int)body.records[i].ID;
temp.comboBoxIndex = boxIndex;
main.Range.Items.Add(toAdd + "\t\t - " + "Hostile: " + MinimumRangeHostile + " - " + MaximumRangeHostile + "\t Friend: " + MinimumRangeFriend + " - " + MaximumRangeFriend);
body.lookup.Add(temp);
boxIndex++;
}
}
示例5: LoadDBCFile
// End Files
public bool LoadDBCFile(MainWindow window)
{
main = window;
try
{
FileStream fileStream = new FileStream("DBC/Spell.dbc", FileMode.Open);
fileSize = fileStream.Length;
int count = Marshal.SizeOf(typeof(DBC_Header));
byte[] readBuffer = new byte[count];
BinaryReader reader = new BinaryReader(fileStream);
readBuffer = reader.ReadBytes(count);
GCHandle handle = GCHandle.Alloc(readBuffer, GCHandleType.Pinned);
header = (DBC_Header)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(DBC_Header));
handle.Free();
body.records = new Spell_DBC_RecordMap[header.RecordCount];
count = Marshal.SizeOf(typeof(Spell_DBC_Record));
if (header.RecordSize != count)
throw new Exception("This Spell DBC version is not supported! It is not 3.3.5a.");
for (UInt32 i = 0; i < header.RecordCount; ++i)
{
readBuffer = new byte[count];
readBuffer = reader.ReadBytes(count);
handle = GCHandle.Alloc(readBuffer, GCHandleType.Pinned);
body.records[i].record = (Spell_DBC_Record)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(Spell_DBC_Record));
handle.Free();
}
string StringBlock;
Dictionary<UInt32, VirtualStrTableEntry> strings = new Dictionary<UInt32, VirtualStrTableEntry>();
StringBlock = Encoding.UTF8.GetString(reader.ReadBytes(header.StringBlockSize));
string temp = "";
UInt32 lastString = 0;
UInt32 counter = 0;
Int32 length = new System.Globalization.StringInfo(StringBlock).LengthInTextElements;
while (counter < length)
{
var t = StringBlock[(int)counter];
if (t == '\0')
{
VirtualStrTableEntry n = new VirtualStrTableEntry();
n.Value = temp;
n.NewValue = 0;
strings.Add(lastString, n);
lastString += (UInt32)Encoding.UTF8.GetByteCount(temp) + 1;
temp = "";
}
else { temp += t; }
++counter;
}
StringBlock = null;
for (int i = 0; i < body.records.Length; ++i)
{
body.records[i].spellName = new string[9];
body.records[i].spellRank = new string[9];
body.records[i].spellDesc = new string[9];
body.records[i].spellTool = new string[9];
for (int j = 0; j < 9; ++j)
{
body.records[i].spellName[j] = strings[body.records[i].record.SpellName[j]].Value;
body.records[i].spellRank[j] = strings[body.records[i].record.SpellRank[j]].Value;
body.records[i].spellDesc[j] = strings[body.records[i].record.SpellDescription[j]].Value;
body.records[i].spellTool[j] = strings[body.records[i].record.SpellToolTip[j]].Value;
}
}
reader.Close();
fileStream.Close();
}
catch (Exception ex)
{
main.HandleErrorMessage(ex.Message);
return false;
}
return true;
}
示例6: AreaGroup
// End DBCs
public AreaGroup(MainWindow window, SpellDBC spellDBC)
{
main = window;
spell = spellDBC;
for (UInt32 i = 0; i < header.RecordCount; ++i)
{
body.records[i].ID = new UInt32();
body.records[i].AreaID = new UInt32[6];
body.records[i].NextGroup = new UInt32();
}
if (!File.Exists("DBC/AreaGroup.dbc"))
{
main.HandleErrorMessage("AreaGroup.dbc was not found!");
return;
}
FileStream fileStream = new FileStream("DBC/AreaGroup.dbc", FileMode.Open);
int count = Marshal.SizeOf(typeof(DBC_Header));
byte[] readBuffer = new byte[count];
BinaryReader reader = new BinaryReader(fileStream);
readBuffer = reader.ReadBytes(count);
GCHandle handle = GCHandle.Alloc(readBuffer, GCHandleType.Pinned);
header = (DBC_Header)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(DBC_Header));
handle.Free();
body.records = new AreaGroup_DBC_Record[header.RecordCount];
for (UInt32 i = 0; i < header.RecordCount; ++i)
{
count = Marshal.SizeOf(typeof(AreaGroup_DBC_Record));
readBuffer = new byte[count];
reader = new BinaryReader(fileStream);
readBuffer = reader.ReadBytes(count);
handle = GCHandle.Alloc(readBuffer, GCHandleType.Pinned);
body.records[i] = (AreaGroup_DBC_Record)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(AreaGroup_DBC_Record));
handle.Free();
}
reader.Close();
fileStream.Close();
body.lookup = new List<AreaGroupLookup>();
int boxIndex = 1;
main.AreaGroup.Items.Add(0);
AreaGroupLookup t;
t.ID = 0;
t.comboBoxIndex = 0;
body.lookup.Add(t);
for (UInt32 i = 0; i < header.RecordCount; ++i)
{
int id = (int)body.records[i].ID;
AreaGroupLookup temp;
temp.ID = id;
temp.comboBoxIndex = boxIndex;
main.AreaGroup.Items.Add(id);
body.lookup.Add(temp);
boxIndex++;
}
}
示例7: ItemClass
// End DBCs
public ItemClass(MainWindow window, SpellDBC spellDBC)
{
main = window;
spell = spellDBC;
for (UInt32 i = 0; i < header.RecordCount; ++i)
{
body.records[i].ID = new UInt32();
body.records[i].SecondaryID = new UInt32();
body.records[i].IsWeapon = new UInt32();
body.records[i].Name = new UInt32[16];
body.records[i].Flags = new UInt32();
}
if (!File.Exists("DBC/ItemClass.dbc"))
{
main.HandleErrorMessage("ItemClass.dbc was not found!");
return;
}
FileStream fileStream = new FileStream("DBC/ItemClass.dbc", FileMode.Open);
int count = Marshal.SizeOf(typeof(DBC_Header));
byte[] readBuffer = new byte[count];
BinaryReader reader = new BinaryReader(fileStream);
readBuffer = reader.ReadBytes(count);
GCHandle handle = GCHandle.Alloc(readBuffer, GCHandleType.Pinned);
header = (DBC_Header)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(DBC_Header));
handle.Free();
body.records = new ItemClass_DBC_Record[header.RecordCount];
for (UInt32 i = 0; i < header.RecordCount; ++i)
{
count = Marshal.SizeOf(typeof(ItemClass_DBC_Record));
readBuffer = new byte[count];
reader = new BinaryReader(fileStream);
readBuffer = reader.ReadBytes(count);
handle = GCHandle.Alloc(readBuffer, GCHandleType.Pinned);
body.records[i] = (ItemClass_DBC_Record)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(ItemClass_DBC_Record));
handle.Free();
}
body.StringBlock = Encoding.UTF8.GetString(reader.ReadBytes(header.StringBlockSize));
reader.Close();
fileStream.Close();
body.lookup = new List<ItemClassLookup>();
int boxIndex = 1;
main.EquippedItemClass.Items.Add("None");
ItemClassLookup t;
t.ID = -1;
t.comboBoxIndex = -1;
body.lookup.Add(t);
for (UInt32 i = 0; i < header.RecordCount; ++i)
{
int offset = (int)body.records[i].Name[0];
if (offset == 0) { continue; }
int returnValue = offset;
string toAdd = "";
while (body.StringBlock[offset] != 0) { toAdd += body.StringBlock[offset++]; }
ItemClassLookup temp;
temp.ID = (int)body.records[i].ID;
temp.comboBoxIndex = boxIndex;
main.EquippedItemClass.Items.Add(toAdd);
body.lookup.Add(temp);
boxIndex++;
}
}