Skip to content

Instantly share code, notes, and snippets.

@Iridio
Iridio / VideoCapture.cs
Last active Mar 23, 2016
Component for webcam streaming for XNA 4.0
View VideoCapture.cs
using DirectShowLib;
using Microsoft.Xna.Framework.Graphics;
using System;
using System.Runtime.InteropServices;
using System.Runtime.InteropServices.ComTypes;
using System.Threading;
namespace WindowsGame1
{
public class VideoCapture : ISampleGrabberCB, IDisposable
@Iridio
Iridio / CombGuid
Created Aug 3, 2012
CombGuid generator
View CombGuid
//from NHibernate source. Very helpful to prevent fragmentation when using Guid with clustered PK
Guid GenerateComb()
{
byte[] destinationArray = Guid.NewGuid().ToByteArray();
DateTime time = new DateTime(0x76c, 1, 1);
DateTime now = DateTime.Now;
TimeSpan span = new TimeSpan(now.Ticks - time.Ticks);
TimeSpan timeOfDay = now.TimeOfDay;
byte[] bytes = BitConverter.GetBytes(span.Days);