Skip to content

Instantly share code, notes, and snippets.

using System;
using System.ComponentModel;
using System.Diagnostics.Contracts;
using System.Runtime.InteropServices;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Interop;
using System.Windows.Media;
using LordJZ.WinAPI;
@LordJZ
LordJZ / gist:3892726
Created October 15, 2012 14:25
INotifyPropertyChanged Property Snippet
<?xml version="1.0" encoding="utf-8"?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
<CodeSnippet Format="1.0.0">
<Header>
<Title>INotifyPropertyChanged Property</Title>
<Shortcut>propn</Shortcut>
</Header>
<Snippet>
<Code Language="CSharp">
<![CDATA[#region $PropertyName$ property
@LordJZ
LordJZ / gist:3060011
Created July 6, 2012 12:53
Emote Fixer
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DBFilesClient.NET;
using System.IO;
namespace EmoteFixGen
{
public class EmoteEntry
@LordJZ
LordJZ / gist:2899215
Created June 9, 2012 03:09
LINQ goodness
void UpdateCheckedCategories()
{
this.ThreadSafeBegin(_ =>
{
var checkedInfos = _.m_categories
.Where(info => info.CheckBox.Visibility == Visibility.Visible)
.Where(info => info.CheckBox.IsChecked == true);
_.CategoriesExpanderHeader.Text = string.Join(", ", checkedInfos
.Select(info => info.Privilege.ToString())
@LordJZ
LordJZ / gist:2626246
Created May 7, 2012 06:26
mangos-style update field storage to rtrimmed LE binary storage converter
DELIMITER $$
DROP FUNCTION IF EXISTS int2le$$
CREATE FUNCTION int2le(src INT)
RETURNS BINARY(4)
BEGIN
RETURN REVERSE(UNHEX(LPAD(HEX(src), 8, '0')));
END$$
DROP FUNCTION IF EXISTS convertField$$
diff --git a/src/framework/Utilities/UnorderedMapSet.h b/src/framework/Utilities/UnorderedMapSet.h
index a50d7ec..d7adae2 100644
--- a/src/framework/Utilities/UnorderedMapSet.h
+++ b/src/framework/Utilities/UnorderedMapSet.h
@@ -31,6 +31,9 @@
#elif COMPILER == COMPILER_GNU && __GNUC__ >= 3
# include <ext/hash_map>
# include <ext/hash_set>
+#elif COMPILER == COMPILER_MICROSOFT && _MSC_VER >= 1700 // VC11.0 and later
+# include <unordered_map>
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using Kamilla.Network.Protocols.Wow.Game;
namespace Kamilla.Network.Protocols.Wow
{
public sealed class WowGuidSortedDictionary<T> : IDictionary<WowGuid, T>
{
@LordJZ
LordJZ / gist:1572224
Created January 6, 2012 20:18
Windows Presentation Framework thread-safeness providers
using System;
using System.Windows.Threading;
namespace Kamilla.WPF
{
/// <summary>
/// Contains extension methods to the classes of the Windows Presentation Framework (WPF).
/// </summary>
public static class WpfExtensions
{
@LordJZ
LordJZ / gist:1460491
Created December 11, 2011 13:02
SMSG_UPDATE_OBJECT movement part as of 4.3
WowGuid guid;
this.HaveAttackingTarget = Reader.UnalignedReadBit();
guid.Bytes[2] = Reader.UnalignedReadTinyInt(1);
this.HaveVehicleData = Reader.UnalignedReadBit();
guid.Bytes[1] = Reader.UnalignedReadTinyInt(1);
guid.Bytes[4] = Reader.UnalignedReadTinyInt(1);
guid.Bytes[3] = Reader.UnalignedReadTinyInt(1);
this.HaveTransportExtra = Reader.UnalignedReadBit();
this.HaveGameObjectPosition = Reader.UnalignedReadBit();
bool field_1C8 = Reader.UnalignedReadBit();
@LordJZ
LordJZ / gist:1460486
Created December 11, 2011 13:01
Area triggers created
Created Objects: 9
________________________________________
(DynamicObject, Counter: 198306) Type: DynamicObject
Movement: Flags: None
Position: {X:3856,047 Y:929,2022 Z:55,88532}
OBJECT_FIELD_GUID = (DynamicObject, Counter: 198306)
OBJECT_FIELD_TYPE = 65 0
OBJECT_FIELD_ENTRY = 43265
OBJECT_FIELD_SCALE_X = 1.0000