Skip to content

Instantly share code, notes, and snippets.

View ThuCommix's full-sized avatar

Kevin Scholz ThuCommix

View GitHub Profile
//open a new ID3Stream to the specific file
var id3Stream = new ID3Stream(path, System.IO.FileMode.Open, System.IO.FileAccess.ReadWrite);
//read the ID3Tag through ID3 class (v1 example)
var result = (ID3V1Result)ID3.ReadID3Tag(new ID3V1Processor(id3Stream));
Console.WriteLine(result.Title);
Console.WriteLine(result.Artist);
Console.WriteLine(result.Album);
Console.WriteLine(result.Year);
package com.game;
public class Gameloop
extends Thread
{
public long Wait;
public Game Game;
private boolean run;
public Gameloop(Game g, long Wait)
using System;
using CSCore;
using CSCore.Codecs;
using CSCore.Streams;
using CSCore.XAudio2;
namespace Sharpex2D.Framework.Audio.XAudio2
{
public class XAudio2SoundProvider : ISoundProvider
{
[Serializable]
public class SerialCode
{
public string Code{set; get;}
public string GameName{set; get;}
public string Description{set; get;}
}
public SerialCodeProvider
{
/// <summary>
/// Sends the data.
/// </summary>
/// <param name="buffer">The Buffer.</param>
/// <param name="count">The Count.</param>
/// <param name="member">The SessionMember.</param>
public void Send(byte[] buffer, int count, SessionMember member)
{
var data = new byte[10 + count];
var msg = BitConverter.GetBytes((short) SystemMessage.UserDatagram);
public DataWriter(byte[] buffer)
{
if (buffer == null)
throw new ArgumentNullException("buffer");
GCHandle handle = GCHandle.Alloc(buffer, WhateverMode.Pinned);
_buffer = (byte*)handle.AddrOfPinnedObject();
}
public void Write(int value)
{
//send join request to server and wait for response.
//the initial join should be blocking since if we fail to connect we should not listing for packets
var joinRequest = new byte[2];
joinRequest = BitConverter.GetBytes((short) SystemMessage.Join);
_udpService.Send(joinRequest, joinRequest.Length, _joinedSessionEndPoint);
int timeOut = 1000;
//we should give the server some time to respond.
// Copyright (c) 2012-2015 Sharpex2D - Kevin Scholz (ThuCommix)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the 'Software'), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// Copyright (c) 2012-2015 Sharpex2D - Kevin Scholz (ThuCommix)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the 'Software'), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
private void ReadHeader()
{
var reader = new BinaryReader(_stream);
if (ReadChunk(reader) != "RIFF")
{
throw new Exception("Invalid file format.");
}
reader.ReadInt32();