Skip to content

Instantly share code, notes, and snippets.

@Iridio
Iridio / VideoCapture.cs
Last active March 23, 2016 15:36
Component for webcam streaming for XNA 4.0
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 August 3, 2012 16:16
CombGuid generator
//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);