Working overlay

This commit is contained in:
Brett Sanderson 2016-02-28 16:31:35 -05:00
parent 9f2b72ee25
commit 0d09a3bcb6
61 changed files with 2444 additions and 781 deletions

View File

@ -2,103 +2,100 @@
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Xml.Schema;
namespace CdgLib
{
public class CDGFile : IDisposable
public class CdgFile : IDisposable
{
private const int COLOUR_TABLE_SIZE = 16;
private const int ColourTableSize = 16;
// To detect redundant calls
private bool disposedValue;
private bool _disposedValue;
#region " IDisposable Support "
// This code added by Visual Basic to correctly implement the disposable pattern.
public void Dispose()
{
// Do not change this code. Put cleanup code in Dispose(ByVal disposing As Boolean) above.
Dispose(true);
GC.SuppressFinalize(this);
}
#endregion
// IDisposable
protected virtual void Dispose(bool disposing)
{
if (!disposedValue)
if (!_disposedValue)
{
if (disposing)
{
m_pStream.Close();
_mPStream.Close();
}
m_pStream = null;
m_pSurface = null;
_mPStream = null;
_mPSurface = null;
}
disposedValue = true;
_disposedValue = true;
}
#region "Constants"
//CDG Command Code
private const byte CDG_COMMAND = 0x9;
private const byte CdgCommand = 0x9;
//CDG Instruction Codes
private const int CDG_INST_MEMORY_PRESET = 1;
private const int CDG_INST_BORDER_PRESET = 2;
private const int CDG_INST_TILE_BLOCK = 6;
private const int CDG_INST_SCROLL_PRESET = 20;
private const int CDG_INST_SCROLL_COPY = 24;
private const int CDG_INST_DEF_TRANSP_COL = 28;
private const int CDG_INST_LOAD_COL_TBL_LO = 30;
private const int CDG_INST_LOAD_COL_TBL_HIGH = 31;
private const int CdgInstMemoryPreset = 1;
private const int CdgInstBorderPreset = 2;
private const int CdgInstTileBlock = 6;
private const int CdgInstScrollPreset = 20;
private const int CdgInstScrollCopy = 24;
private const int CdgInstDefTranspCol = 28;
private const int CdgInstLoadColTblLo = 30;
private const int CdgInstLoadColTblHigh = 31;
private const int CDG_INST_TILE_BLOCK_XOR = 38;
private const int CdgInstTileBlockXor = 38;
//Bitmask for all CDG fields
private const byte CDG_MASK = 0x3f;
private const int CDG_PACKET_SIZE = 24;
private const int TILE_HEIGHT = 12;
private const byte CdgMask = 0x3f;
private const int CdgPacketSize = 24;
private const int TileHeight = 12;
private const int TILE_WIDTH = 6;
private const int TileWidth = 6;
//This is the size of the display as defined by the CDG specification.
//The pixels in this region can be painted, and scrolling operations
//rotate through this number of pixels.
public const int CDG_FULL_WIDTH = 300;
public const int CdgFullWidth = 300;
public const int CDG_FULL_HEIGHT = 216;
public const int CdgFullHeight = 216;
//This is the size of the screen that is actually intended to be
//visible. It is the center area of CDG_FULL.
private const int CDG_DISPLAY_WIDTH = 294;
private const int CdgDisplayWidth = 294;
private const int CDG_DISPLAY_HEIGHT = 204;
private const int CdgDisplayHeight = 204;
#endregion
#region "Private Declarations"
private readonly byte[,] m_pixelColours = new byte[CDG_FULL_HEIGHT, CDG_FULL_WIDTH];
private readonly int[] m_colourTable = new int[COLOUR_TABLE_SIZE];
private int m_presetColourIndex;
private int m_borderColourIndex;
private readonly byte[,] _mPixelColours = new byte[CdgFullHeight, CdgFullWidth];
private readonly int[] _mColourTable = new int[ColourTableSize];
private int _mPresetColourIndex;
private int _mBorderColourIndex;
private int m_transparentColour;
private int m_hOffset;
private int _mTransparentColour;
private int _mHOffset;
private int m_vOffset;
private CdgFileIoStream m_pStream;
private ISurface m_pSurface;
private long m_positionMs;
private int _mVOffset;
private CdgFileIoStream _mPStream;
private Surface _mPSurface;
private long _mPositionMs;
private long m_duration;
private long _mDuration;
private Bitmap mImage;
private Bitmap _mImage;
#endregion
#region "Properties"
public bool Transparent { get; set; }
public bool Transparent => true;
public Image RgbImage
{
@ -108,13 +105,13 @@ namespace CdgLib
try
{
var i = 0;
for (var ri = 0; ri <= CDG_FULL_HEIGHT - 1; ri++)
for (var ri = 0; ri <= CdgFullHeight - 1; ri++)
{
for (var ci = 0; ci <= CDG_FULL_WIDTH - 1; ci++)
for (var ci = 0; ci <= CdgFullWidth - 1; ci++)
{
var ARGBInt = m_pSurface.rgbData[ri, ci];
var argbInt = _mPSurface.RgbData[ri, ci];
var myByte = new byte[4];
myByte = BitConverter.GetBytes(ARGBInt);
myByte = BitConverter.GetBytes(argbInt);
temp.Write(myByte, 0, 4);
}
}
@ -123,7 +120,7 @@ namespace CdgLib
{
//Do nothing (empty bitmap will be returned)
}
var myBitmap = GraphicUtil.StreamToBitmap(ref temp, CDG_FULL_WIDTH, CDG_FULL_HEIGHT);
var myBitmap = GraphicUtil.StreamToBitmap(ref temp, CdgFullWidth, CdgFullHeight);
if (Transparent)
{
myBitmap.MakeTransparent(myBitmap.GetPixel(1, 1));
@ -143,59 +140,59 @@ namespace CdgLib
}
//New
public CDGFile(string cdgFileName)
public CdgFile(string cdgFileName)
{
m_pStream = new CdgFileIoStream();
m_pStream.Open(cdgFileName);
m_pSurface = new ISurface();
if (m_pStream != null && m_pSurface != null)
_mPStream = new CdgFileIoStream();
_mPStream.Open(cdgFileName);
_mPSurface = new Surface();
if (_mPStream != null && _mPSurface != null)
{
reset();
m_duration = m_pStream.Getsize() / CDG_PACKET_SIZE * 1000 / 300;
Reset();
_mDuration = _mPStream.Getsize()/CdgPacketSize*1000/300;
}
}
public long getTotalDuration()
public long GetTotalDuration()
{
return m_duration;
return _mDuration;
}
public bool renderAtPosition(long ms)
public bool RenderAtPosition(long ms)
{
var pack = new CdgPacket();
long numPacks = 0;
var res = true;
if (m_pStream == null)
if (_mPStream == null)
{
return false;
}
if (ms < m_positionMs)
if (ms < _mPositionMs)
{
if (m_pStream.Seek(0, SeekOrigin.Begin) < 0)
if (_mPStream.Seek(0, SeekOrigin.Begin) < 0)
return false;
m_positionMs = 0;
_mPositionMs = 0;
}
//duration of one packet is 1/300 seconds (4 packets per sector, 75 sectors per second)
numPacks = ms - m_positionMs;
numPacks = ms - _mPositionMs;
numPacks /= 10;
m_positionMs += numPacks * 10;
_mPositionMs += numPacks*10;
numPacks *= 3;
//TODO: double check logic due to inline while loop fucntionality
//AndAlso m_pSurface.rgbData Is Nothing
while (numPacks > 0)
{
res = readPacket(ref pack);
processPacket(ref pack);
res = ReadPacket(ref pack);
ProcessPacket(ref pack);
numPacks -= 1;
}
render();
Render();
return res;
}
@ -203,97 +200,97 @@ namespace CdgLib
#region "Private Methods"
private void reset()
private void Reset()
{
Array.Clear(m_pixelColours, 0, m_pixelColours.Length);
Array.Clear(m_colourTable, 0, m_colourTable.Length);
Array.Clear(_mPixelColours, 0, _mPixelColours.Length);
Array.Clear(_mColourTable, 0, _mColourTable.Length);
m_presetColourIndex = 0;
m_borderColourIndex = 0;
m_transparentColour = 0;
m_hOffset = 0;
m_vOffset = 0;
_mPresetColourIndex = 0;
_mBorderColourIndex = 0;
_mTransparentColour = 0;
_mHOffset = 0;
_mVOffset = 0;
m_duration = 0;
m_positionMs = 0;
_mDuration = 0;
_mPositionMs = 0;
//clear surface
if (m_pSurface.rgbData != null)
if (_mPSurface.RgbData != null)
{
Array.Clear(m_pSurface.rgbData, 0, m_pSurface.rgbData.Length);
Array.Clear(_mPSurface.RgbData, 0, _mPSurface.RgbData.Length);
}
}
private bool readPacket(ref CdgPacket pack)
private bool ReadPacket(ref CdgPacket pack)
{
if (m_pStream == null || m_pStream.Eof())
if (_mPStream == null || _mPStream.Eof())
{
return false;
}
var read = 0;
read += m_pStream.Read(ref pack.command, 1);
read += m_pStream.Read(ref pack.instruction, 1);
read += m_pStream.Read(ref pack.parityQ, 2);
read += m_pStream.Read(ref pack.data, 16);
read += m_pStream.Read(ref pack.parityP, 4);
read += _mPStream.Read(ref pack.Command, 1);
read += _mPStream.Read(ref pack.Instruction, 1);
read += _mPStream.Read(ref pack.ParityQ, 2);
read += _mPStream.Read(ref pack.Data, 16);
read += _mPStream.Read(ref pack.ParityP, 4);
return read == 24;
}
private void processPacket(ref CdgPacket pack)
private void ProcessPacket(ref CdgPacket pack)
{
var inst_code = 0;
var instCode = 0;
if ((pack.command[0] & CDG_MASK) == CDG_COMMAND)
if ((pack.Command[0] & CdgMask) == CdgCommand)
{
inst_code = pack.instruction[0] & CDG_MASK;
switch (inst_code)
instCode = pack.Instruction[0] & CdgMask;
switch (instCode)
{
case CDG_INST_MEMORY_PRESET:
memoryPreset(ref pack);
case CdgInstMemoryPreset:
MemoryPreset(ref pack);
break;
case CDG_INST_BORDER_PRESET:
borderPreset(ref pack);
case CdgInstBorderPreset:
BorderPreset(ref pack);
break;
case CDG_INST_TILE_BLOCK:
tileBlock(ref pack, false);
case CdgInstTileBlock:
TileBlock(ref pack, false);
break;
case CDG_INST_SCROLL_PRESET:
scroll(ref pack, false);
case CdgInstScrollPreset:
Scroll(ref pack, false);
break;
case CDG_INST_SCROLL_COPY:
scroll(ref pack, true);
case CdgInstScrollCopy:
Scroll(ref pack, true);
break;
case CDG_INST_DEF_TRANSP_COL:
defineTransparentColour(ref pack);
case CdgInstDefTranspCol:
DefineTransparentColour(ref pack);
break;
case CDG_INST_LOAD_COL_TBL_LO:
loadColorTable(ref pack, 0);
case CdgInstLoadColTblLo:
LoadColorTable(ref pack, 0);
break;
case CDG_INST_LOAD_COL_TBL_HIGH:
loadColorTable(ref pack, 1);
case CdgInstLoadColTblHigh:
LoadColorTable(ref pack, 1);
break;
case CDG_INST_TILE_BLOCK_XOR:
tileBlock(ref pack, true);
case CdgInstTileBlockXor:
TileBlock(ref pack, true);
break;
@ -306,20 +303,20 @@ namespace CdgLib
}
private void memoryPreset(ref CdgPacket pack)
private void MemoryPreset(ref CdgPacket pack)
{
var colour = 0;
var ri = 0;
var ci = 0;
var repeat = 0;
colour = pack.data[0] & 0xf;
repeat = pack.data[1] & 0xf;
colour = pack.Data[0] & 0xf;
repeat = pack.Data[1] & 0xf;
//Our new interpretation of CD+G Revealed is that memory preset
//commands should also change the border
m_presetColourIndex = colour;
m_borderColourIndex = colour;
_mPresetColourIndex = colour;
_mBorderColourIndex = colour;
//we have a reliable data stream, so the repeat command
//is executed only the first time
@ -335,59 +332,59 @@ namespace CdgLib
//Set the preset colour for every pixel. Must be stored in
//the pixel colour table indeces array
for (ri = 0; ri <= CDG_FULL_HEIGHT - 1; ri++)
for (ri = 0; ri <= CdgFullHeight - 1; ri++)
{
for (ci = 0; ci <= CDG_FULL_WIDTH - 1; ci++)
for (ci = 0; ci <= CdgFullWidth - 1; ci++)
{
m_pixelColours[ri, ci] = (byte)colour;
_mPixelColours[ri, ci] = (byte) colour;
}
}
}
}
private void borderPreset(ref CdgPacket pack)
private void BorderPreset(ref CdgPacket pack)
{
var colour = 0;
var ri = 0;
var ci = 0;
colour = pack.data[0] & 0xf;
m_borderColourIndex = colour;
colour = pack.Data[0] & 0xf;
_mBorderColourIndex = colour;
//The border area is the area contained with a rectangle
//defined by (0,0,300,216) minus the interior pixels which are contained
//within a rectangle defined by (6,12,294,204).
for (ri = 0; ri <= CDG_FULL_HEIGHT - 1; ri++)
for (ri = 0; ri <= CdgFullHeight - 1; ri++)
{
for (ci = 0; ci <= 5; ci++)
{
m_pixelColours[ri, ci] = (byte)colour;
_mPixelColours[ri, ci] = (byte) colour;
}
for (ci = CDG_FULL_WIDTH - 6; ci <= CDG_FULL_WIDTH - 1; ci++)
for (ci = CdgFullWidth - 6; ci <= CdgFullWidth - 1; ci++)
{
m_pixelColours[ri, ci] = (byte)colour;
_mPixelColours[ri, ci] = (byte) colour;
}
}
for (ci = 6; ci <= CDG_FULL_WIDTH - 7; ci++)
for (ci = 6; ci <= CdgFullWidth - 7; ci++)
{
for (ri = 0; ri <= 11; ri++)
{
m_pixelColours[ri, ci] = (byte)colour;
_mPixelColours[ri, ci] = (byte) colour;
}
for (ri = CDG_FULL_HEIGHT - 12; ri <= CDG_FULL_HEIGHT - 1; ri++)
for (ri = CdgFullHeight - 12; ri <= CdgFullHeight - 1; ri++)
{
m_pixelColours[ri, ci] = (byte)colour;
_mPixelColours[ri, ci] = (byte) colour;
}
}
}
private void loadColorTable(ref CdgPacket pack, int table)
private void LoadColorTable(ref CdgPacket pack, int table)
{
for (var i = 0; i <= 7; i++)
{
@ -395,8 +392,8 @@ namespace CdgLib
//7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0
//X X r r r r g g X X g g b b b b
var byte0 = pack.data[2 * i];
var byte1 = pack.data[2 * i + 1];
var byte0 = pack.Data[2*i];
var byte1 = pack.Data[2*i + 1];
var red = (byte0 & 0x3f) >> 2;
var green = ((byte0 & 0x3) << 2) | ((byte1 & 0x3f) >> 4);
var blue = byte1 & 0xf;
@ -405,34 +402,34 @@ namespace CdgLib
green *= 17;
blue *= 17;
if (m_pSurface != null)
if (_mPSurface != null)
{
m_colourTable[i + table * 8] = m_pSurface.MapRGBColour(red, green, blue);
_mColourTable[i + table*8] = _mPSurface.MapRgbColour(red, green, blue);
}
}
}
private void tileBlock(ref CdgPacket pack, bool bXor)
private void TileBlock(ref CdgPacket pack, bool bXor)
{
var colour0 = 0;
var colour1 = 0;
var column_index = 0;
var row_index = 0;
var columnIndex = 0;
var rowIndex = 0;
var myByte = 0;
var pixel = 0;
var xor_col = 0;
var xorCol = 0;
var currentColourIndex = 0;
var new_col = 0;
var newCol = 0;
colour0 = pack.data[0] & 0xf;
colour1 = pack.data[1] & 0xf;
row_index = (pack.data[2] & 0x1f) * 12;
column_index = (pack.data[3] & 0x3f) * 6;
colour0 = pack.Data[0] & 0xf;
colour1 = pack.Data[1] & 0xf;
rowIndex = (pack.Data[2] & 0x1f)*12;
columnIndex = (pack.Data[3] & 0x3f)*6;
if (row_index > CDG_FULL_HEIGHT - TILE_HEIGHT)
if (rowIndex > CdgFullHeight - TileHeight)
return;
if (column_index > CDG_FULL_WIDTH - TILE_WIDTH)
if (columnIndex > CdgFullWidth - TileWidth)
return;
//Set the pixel array for each of the pixels in the 12x6 tile.
@ -443,7 +440,7 @@ namespace CdgLib
for (var i = 0; i <= 11; i++)
{
myByte = pack.data[4 + i] & 0x3f;
myByte = pack.Data[4 + i] & 0x3f;
for (var j = 0; j <= 5; j++)
{
pixel = (myByte >> (5 - j)) & 0x1;
@ -452,44 +449,44 @@ namespace CdgLib
//Tile Block XOR
if (pixel == 0)
{
xor_col = colour0;
xorCol = colour0;
}
else
{
xor_col = colour1;
xorCol = colour1;
}
//Get the colour index currently at this location, and xor with it
currentColourIndex = m_pixelColours[row_index + i, column_index + j];
new_col = currentColourIndex ^ xor_col;
currentColourIndex = _mPixelColours[rowIndex + i, columnIndex + j];
newCol = currentColourIndex ^ xorCol;
}
else
{
if (pixel == 0)
{
new_col = colour0;
newCol = colour0;
}
else
{
new_col = colour1;
newCol = colour1;
}
}
//Set the pixel with the new colour. We set both the surfarray
//containing actual RGB values, as well as our array containing
//the colour indexes into our colour table.
m_pixelColours[row_index + i, column_index + j] = (byte)new_col;
_mPixelColours[rowIndex + i, columnIndex + j] = (byte) newCol;
}
}
}
private void defineTransparentColour(ref CdgPacket pack)
private void DefineTransparentColour(ref CdgPacket pack)
{
m_transparentColour = pack.data[0] & 0xf;
_mTransparentColour = pack.Data[0] & 0xf;
}
private void scroll(ref CdgPacket pack, bool copy)
private void Scroll(ref CdgPacket pack, bool copy)
{
var colour = 0;
var hScroll = 0;
@ -502,9 +499,9 @@ namespace CdgLib
var hScrollPixels = 0;
//Decode the scroll command parameters
colour = pack.data[0] & 0xf;
hScroll = pack.data[1] & 0x3f;
vScroll = pack.data[2] & 0x3f;
colour = pack.Data[0] & 0xf;
hScroll = pack.Data[1] & 0x3f;
vScroll = pack.Data[2] & 0x3f;
hSCmd = (hScroll & 0x30) >> 4;
hOffset = hScroll & 0x7;
@ -512,8 +509,8 @@ namespace CdgLib
vOffset = vScroll & 0xf;
m_hOffset = hOffset < 5 ? hOffset : 5;
m_vOffset = vOffset < 11 ? vOffset : 11;
_mHOffset = hOffset < 5 ? hOffset : 5;
_mVOffset = vOffset < 11 ? vOffset : 11;
//Scroll Vertical - Calculate number of pixels
@ -546,19 +543,19 @@ namespace CdgLib
//Perform the actual scroll.
var temp = new byte[CDG_FULL_HEIGHT + 1, CDG_FULL_WIDTH + 1];
var vInc = vScrollPixels + CDG_FULL_HEIGHT;
var hInc = hScrollPixels + CDG_FULL_WIDTH;
var temp = new byte[CdgFullHeight + 1, CdgFullWidth + 1];
var vInc = vScrollPixels + CdgFullHeight;
var hInc = hScrollPixels + CdgFullWidth;
var ri = 0;
//row index
var ci = 0;
//column index
for (ri = 0; ri <= CDG_FULL_HEIGHT - 1; ri++)
for (ri = 0; ri <= CdgFullHeight - 1; ri++)
{
for (ci = 0; ci <= CDG_FULL_WIDTH - 1; ci++)
for (ci = 0; ci <= CdgFullWidth - 1; ci++)
{
temp[(ri + vInc) % CDG_FULL_HEIGHT, (ci + hInc) % CDG_FULL_WIDTH] = m_pixelColours[ri, ci];
temp[(ri + vInc)%CdgFullHeight, (ci + hInc)%CdgFullWidth] = _mPixelColours[ri, ci];
}
}
@ -571,21 +568,21 @@ namespace CdgLib
{
if (vScrollPixels > 0)
{
for (ci = 0; ci <= CDG_FULL_WIDTH - 1; ci++)
for (ci = 0; ci <= CdgFullWidth - 1; ci++)
{
for (ri = 0; ri <= vScrollPixels - 1; ri++)
{
temp[ri, ci] = (byte)colour;
temp[ri, ci] = (byte) colour;
}
}
}
else if (vScrollPixels < 0)
{
for (ci = 0; ci <= CDG_FULL_WIDTH - 1; ci++)
for (ci = 0; ci <= CdgFullWidth - 1; ci++)
{
for (ri = CDG_FULL_HEIGHT + vScrollPixels; ri <= CDG_FULL_HEIGHT - 1; ri++)
for (ri = CdgFullHeight + vScrollPixels; ri <= CdgFullHeight - 1; ri++)
{
temp[ri, ci] = (byte)colour;
temp[ri, ci] = (byte) colour;
}
}
}
@ -595,19 +592,19 @@ namespace CdgLib
{
for (ci = 0; ci <= hScrollPixels - 1; ci++)
{
for (ri = 0; ri <= CDG_FULL_HEIGHT - 1; ri++)
for (ri = 0; ri <= CdgFullHeight - 1; ri++)
{
temp[ri, ci] = (byte)colour;
temp[ri, ci] = (byte) colour;
}
}
}
else if (hScrollPixels < 0)
{
for (ci = CDG_FULL_WIDTH + hScrollPixels; ci <= CDG_FULL_WIDTH - 1; ci++)
for (ci = CdgFullWidth + hScrollPixels; ci <= CdgFullWidth - 1; ci++)
{
for (ri = 0; ri <= CDG_FULL_HEIGHT - 1; ri++)
for (ri = 0; ri <= CdgFullHeight - 1; ri++)
{
temp[ri, ci] = (byte)colour;
temp[ri, ci] = (byte) colour;
}
}
}
@ -615,32 +612,32 @@ namespace CdgLib
//Now copy the temporary buffer back to our array
for (ri = 0; ri <= CDG_FULL_HEIGHT - 1; ri++)
for (ri = 0; ri <= CdgFullHeight - 1; ri++)
{
for (ci = 0; ci <= CDG_FULL_WIDTH - 1; ci++)
for (ci = 0; ci <= CdgFullWidth - 1; ci++)
{
m_pixelColours[ri, ci] = temp[ri, ci];
_mPixelColours[ri, ci] = temp[ri, ci];
}
}
}
private void render()
private void Render()
{
if (m_pSurface == null)
if (_mPSurface == null)
return;
for (var ri = 0; ri <= CDG_FULL_HEIGHT - 1; ri++)
for (var ri = 0; ri <= CdgFullHeight - 1; ri++)
{
for (var ci = 0; ci <= CDG_FULL_WIDTH - 1; ci++)
for (var ci = 0; ci <= CdgFullWidth - 1; ci++)
{
if (ri < TILE_HEIGHT || ri >= CDG_FULL_HEIGHT - TILE_HEIGHT || ci < TILE_WIDTH ||
ci >= CDG_FULL_WIDTH - TILE_WIDTH)
if (ri < TileHeight || ri >= CdgFullHeight - TileHeight || ci < TileWidth ||
ci >= CdgFullWidth - TileWidth)
{
m_pSurface.rgbData[ri, ci] = m_colourTable[m_borderColourIndex];
_mPSurface.RgbData[ri, ci] = _mColourTable[_mBorderColourIndex];
}
else
{
m_pSurface.rgbData[ri, ci] = m_colourTable[m_pixelColours[ri + m_vOffset, ci + m_hOffset]];
_mPSurface.RgbData[ri, ci] = _mColourTable[_mPixelColours[ri + _mVOffset, ci + _mHOffset]];
}
}
}
@ -648,30 +645,4 @@ namespace CdgLib
#endregion
}
}
namespace CdgLib
{
public class CdgPacket
{
public byte[] command = new byte[1];
public byte[] data = new byte[16];
public byte[] instruction = new byte[1];
public byte[] parityP = new byte[4];
public byte[] parityQ = new byte[2];
}
}
namespace CdgLib
{
public class ISurface
{
public int[,] rgbData = new int[CDGFile.CDG_FULL_HEIGHT, CDGFile.CDG_FULL_WIDTH];
public int MapRGBColour(int red, int green, int blue)
{
return Color.FromArgb(red, green, blue).ToArgb();
}
}
}
}

View File

@ -2,7 +2,6 @@
namespace CdgLib
{
/// <summary>
/// </summary>
public class CdgFileIoStream
@ -17,7 +16,7 @@ namespace CdgLib
}
/// <summary>
/// Reads the specified buf.
/// Reads the specified buf.
/// </summary>
/// <param name="buf">The buf.</param>
/// <param name="bufSize">The buf_size.</param>
@ -28,7 +27,7 @@ namespace CdgLib
}
/// <summary>
/// Writes the specified buf.
/// Writes the specified buf.
/// </summary>
/// <param name="buf">The buf.</param>
/// <param name="bufSize">The buf_size.</param>
@ -40,18 +39,18 @@ namespace CdgLib
}
/// <summary>
/// Seeks the specified offset.
/// Seeks the specified offset.
/// </summary>
/// <param name="offset">The offset.</param>
/// <param name="whence">The whence.</param>
/// <returns></returns>
public int Seek(int offset, SeekOrigin whence)
{
return (int)_cdgFile.Seek(offset, whence);
return (int) _cdgFile.Seek(offset, whence);
}
/// <summary>
/// EOFs this instance.
/// EOFs this instance.
/// </summary>
/// <returns></returns>
public bool Eof()
@ -60,16 +59,16 @@ namespace CdgLib
}
/// <summary>
/// Getsizes this instance.
/// Getsizes this instance.
/// </summary>
/// <returns></returns>
public int Getsize()
{
return (int)_cdgFile.Length;
return (int) _cdgFile.Length;
}
/// <summary>
/// Opens the specified filename.
/// Opens the specified filename.
/// </summary>
/// <param name="filename">The filename.</param>
/// <returns></returns>
@ -81,7 +80,7 @@ namespace CdgLib
}
/// <summary>
/// Closes this instance.
/// Closes this instance.
/// </summary>
public void Close()
{
@ -92,5 +91,4 @@ namespace CdgLib
}
}
}
}
}

View File

@ -41,9 +41,11 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="CDGFile.cs" />
<Compile Include="CdgFile.cs" />
<Compile Include="CdgFileIoStream.cs" />
<Compile Include="CdgPacket.cs" />
<Compile Include="GraphicUtil.cs" />
<Compile Include="Surface.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />

View File

@ -17,10 +17,10 @@ namespace CdgLib
/// <returns></returns>
public static Stream BitmapToStream(string filename)
{
var oldBmp = (Bitmap)Image.FromFile(filename);
var oldBmp = (Bitmap) Image.FromFile(filename);
var oldData = oldBmp.LockBits(new Rectangle(0, 0, oldBmp.Width, oldBmp.Height), ImageLockMode.WriteOnly,
PixelFormat.Format24bppRgb);
var length = oldData.Stride * oldBmp.Height;
var length = oldData.Stride*oldBmp.Height;
var stream = new byte[length];
Marshal.Copy(oldData.Scan0, stream, 0, length);
oldBmp.UnlockBits(oldData);
@ -61,7 +61,7 @@ namespace CdgLib
public static Bitmap GetCdgSizeBitmap(string filename)
{
var bm = new Bitmap(filename);
return ResizeBitmap(ref bm, CDGFile.CDG_FULL_WIDTH, CDGFile.CDG_FULL_HEIGHT);
return ResizeBitmap(ref bm, CdgFile.CdgFullWidth, CdgFile.CdgFullHeight);
}
/// <summary>
@ -106,4 +106,4 @@ namespace CdgLib
return mergedImage;
}
}
}
}

View File

@ -1,10 +1,10 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("CdgLib")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
@ -17,9 +17,11 @@ using System.Runtime.InteropServices;
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("3203dfd2-da5b-47b3-b009-18dd9c401fc3")]
// Version information for an assembly consists of the following four values:
@ -32,5 +34,6 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

14
CdgLib/Surface.cs Normal file
View File

@ -0,0 +1,14 @@
using System.Drawing;
namespace CdgLib
{
public class Surface
{
public int[,] RgbData = new int[CdgFile.CdgFullHeight, CdgFile.CdgFullWidth];
public int MapRgbColour(int red, int green, int blue)
{
return Color.FromArgb(red, green, blue).ToArgb();
}
}
}

11
CdgLib/cdgPacket.cs Normal file
View File

@ -0,0 +1,11 @@
namespace CdgLib
{
public class CdgPacket
{
public byte[] Command = new byte[1];
public byte[] Data = new byte[16];
public byte[] Instruction = new byte[1];
public byte[] ParityP = new byte[4];
public byte[] ParityQ = new byte[2];
}
}

View File

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8" ?>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6" />
</startup>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6" />
</startup>
</configuration>

View File

@ -1,34 +1,33 @@
using AviFile;
using CdgLib;
using System;
using System.Collections.Generic;
using System;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Windows.Forms;
using AviFile;
using CdgLib;
namespace KaraokeConverter
{
public class ExportAVI
{
public delegate void StatusEventHandler(string message);
public void CDGtoAVI(string aviFileName, string cdgFileName, string mp3FileName, double frameRate, string backgroundFileName = "")
public void CDGtoAVI(string aviFileName, string cdgFileName, string mp3FileName, double frameRate,
string backgroundFileName = "")
{
Bitmap backgroundBmp = null;
Bitmap mergedBMP = null;
VideoStream aviStream = null;
CDGFile myCDGFile = new CDGFile(cdgFileName);
myCDGFile.renderAtPosition(0);
Bitmap bitmap__1 = (Bitmap)myCDGFile.RgbImage;
var myCDGFile = new CdgFile(cdgFileName);
myCDGFile.RenderAtPosition(0);
var bitmap__1 = (Bitmap) myCDGFile.RgbImage;
if (!string.IsNullOrEmpty(backgroundFileName))
{
try
{
if (IsMovie(backgroundFileName))
backgroundBmp = MovieFrameExtractor.GetBitmap(0, backgroundFileName, CDGFile.CDG_FULL_WIDTH, CDGFile.CDG_FULL_HEIGHT);
backgroundBmp = MovieFrameExtractor.GetBitmap(0, backgroundFileName, CdgFile.CdgFullWidth,
CdgFile.CdgFullHeight);
if (IsGraphic(backgroundFileName))
backgroundBmp = GraphicUtil.GetCdgSizeBitmap(backgroundFileName);
}
@ -36,7 +35,7 @@ namespace KaraokeConverter
{
}
}
AviManager aviManager = new AviManager(aviFileName, false);
var aviManager = new AviManager(aviFileName, false);
if (backgroundBmp != null)
{
mergedBMP = GraphicUtil.MergeImagesWithTransparency(backgroundBmp, bitmap__1);
@ -45,24 +44,26 @@ namespace KaraokeConverter
if (IsMovie(backgroundFileName))
backgroundBmp.Dispose();
}
else {
else
{
aviStream = aviManager.AddVideoStream(true, frameRate, bitmap__1);
}
int count = 0;
double frameInterval = 1000 / frameRate;
long totalDuration = myCDGFile.getTotalDuration();
var count = 0;
var frameInterval = 1000/frameRate;
var totalDuration = myCDGFile.GetTotalDuration();
double position = 0;
while (position <= totalDuration)
{
count += 1;
position = count * frameInterval;
myCDGFile.renderAtPosition(Convert.ToInt64(position));
bitmap__1 = (Bitmap)myCDGFile.RgbImage;
position = count*frameInterval;
myCDGFile.RenderAtPosition(Convert.ToInt64(position));
bitmap__1 = (Bitmap) myCDGFile.RgbImage;
if (!string.IsNullOrEmpty(backgroundFileName))
{
if (IsMovie(backgroundFileName))
backgroundBmp = MovieFrameExtractor.GetBitmap(position / 1000, backgroundFileName, CDGFile.CDG_FULL_WIDTH, CDGFile.CDG_FULL_HEIGHT);
backgroundBmp = MovieFrameExtractor.GetBitmap(position/1000, backgroundFileName,
CdgFile.CdgFullWidth, CdgFile.CdgFullHeight);
}
if (backgroundBmp != null)
{
@ -72,11 +73,12 @@ namespace KaraokeConverter
if (IsMovie(backgroundFileName))
backgroundBmp.Dispose();
}
else {
else
{
aviStream.AddFrame(bitmap__1);
}
bitmap__1.Dispose();
int percentageDone = (int)((position / totalDuration) * 100);
var percentageDone = (int) (position/totalDuration*100);
if (Status != null)
{
Status(percentageDone.ToString());
@ -119,12 +121,10 @@ namespace KaraokeConverter
public static bool IsGraphic(string filename)
{
return Regex.IsMatch(filename, "^.+(\\.jpg|\\.bmp|\\.png|\\.tif|\\.tiff|\\.gif|\\.wmf)$", RegexOptions.IgnoreCase);
return Regex.IsMatch(filename, "^.+(\\.jpg|\\.bmp|\\.png|\\.tif|\\.tiff|\\.gif|\\.wmf)$",
RegexOptions.IgnoreCase);
}
public event StatusEventHandler Status;
public delegate void StatusEventHandler(string message);
}
}
}

View File

@ -28,6 +28,7 @@
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1));
this.tbFileName = new System.Windows.Forms.TextBox();
this.btBrowseCDG = new System.Windows.Forms.Button();
this.OpenFileDialog1 = new System.Windows.Forms.OpenFileDialog();
@ -48,12 +49,17 @@
this.GroupBox2 = new System.Windows.Forms.GroupBox();
this.GroupBox1 = new System.Windows.Forms.GroupBox();
this.pbAVI = new System.Windows.Forms.ProgressBar();
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.Panel2 = new System.Windows.Forms.Panel();
this.vlcVideo = new AxAXVLC.AxVLCPlugin2();
this.SaveFileDialog1 = new System.Windows.Forms.SaveFileDialog();
this.Panel1.SuspendLayout();
this.GroupBox3.SuspendLayout();
this.GroupBox2.SuspendLayout();
this.GroupBox1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
this.Panel2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.vlcVideo)).BeginInit();
this.SuspendLayout();
//
// tbFileName
@ -63,6 +69,8 @@
this.tbFileName.ReadOnly = true;
this.tbFileName.Size = new System.Drawing.Size(475, 20);
this.tbFileName.TabIndex = 0;
this.tbFileName.Text = "D:\\Karaoke\\SF001 - SF339 Sunfly Hits Karaoke Complete\\SF339\\SF339-01 - Kiesza - H" +
"ideaway.cdg";
//
// btBrowseCDG
//
@ -86,8 +94,9 @@
this.Panel1.Dock = System.Windows.Forms.DockStyle.Top;
this.Panel1.Location = new System.Drawing.Point(0, 0);
this.Panel1.Name = "Panel1";
this.Panel1.Size = new System.Drawing.Size(577, 255);
this.Panel1.Size = new System.Drawing.Size(649, 255);
this.Panel1.TabIndex = 3;
this.Panel1.Paint += new System.Windows.Forms.PaintEventHandler(this.Panel1_Paint);
//
// GroupBox3
//
@ -158,6 +167,7 @@
this.tbBackGroundAVI.Name = "tbBackGroundAVI";
this.tbBackGroundAVI.Size = new System.Drawing.Size(356, 20);
this.tbBackGroundAVI.TabIndex = 17;
this.tbBackGroundAVI.Text = "C:\\Users\\l-bre\\Downloads\\Kristel\'s Jams\\drop.avi";
//
// btBackGroundBrowse
//
@ -185,6 +195,7 @@
this.tbAVIFile.Name = "tbAVIFile";
this.tbAVIFile.Size = new System.Drawing.Size(356, 20);
this.tbAVIFile.TabIndex = 9;
this.tbAVIFile.Text = "C:\\Users\\l-bre\\Desktop\\tester.avi";
//
// btOutputAVI
//
@ -251,29 +262,53 @@
this.pbAVI.Size = new System.Drawing.Size(555, 23);
this.pbAVI.TabIndex = 14;
//
// pictureBox1
//
this.pictureBox1.Location = new System.Drawing.Point(207, 47);
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(392, 151);
this.pictureBox1.TabIndex = 24;
this.pictureBox1.TabStop = false;
//
// Panel2
//
this.Panel2.Controls.Add(this.pictureBox1);
this.Panel2.Controls.Add(this.vlcVideo);
this.Panel2.Dock = System.Windows.Forms.DockStyle.Fill;
this.Panel2.Location = new System.Drawing.Point(0, 255);
this.Panel2.Name = "Panel2";
this.Panel2.Size = new System.Drawing.Size(577, 0);
this.Panel2.Size = new System.Drawing.Size(649, 225);
this.Panel2.TabIndex = 4;
this.Panel2.Paint += new System.Windows.Forms.PaintEventHandler(this.Panel2_Paint);
//
// vlcVideo
//
this.vlcVideo.Enabled = true;
this.vlcVideo.Location = new System.Drawing.Point(317, 47);
this.vlcVideo.Name = "vlcVideo";
this.vlcVideo.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("vlcVideo.OcxState")));
this.vlcVideo.Size = new System.Drawing.Size(320, 175);
this.vlcVideo.TabIndex = 25;
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(577, 253);
this.ClientSize = new System.Drawing.Size(649, 480);
this.Controls.Add(this.Panel2);
this.Controls.Add(this.Panel1);
this.Name = "Form1";
this.Text = "MP3+CDG To Video Converter";
this.Load += new System.EventHandler(this.Form1_Load);
this.Panel1.ResumeLayout(false);
this.GroupBox3.ResumeLayout(false);
this.GroupBox3.PerformLayout();
this.GroupBox2.ResumeLayout(false);
this.GroupBox2.PerformLayout();
this.GroupBox1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
this.Panel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.vlcVideo)).EndInit();
this.ResumeLayout(false);
}
@ -309,6 +344,9 @@
#endregion
private System.Windows.Forms.PictureBox pictureBox1;
private AxAXVLC.AxVLCPlugin2 vlcVideo;
}
}

View File

@ -1,12 +1,7 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Text.RegularExpressions;
using System.Windows.Forms;
using CdgLib;
@ -18,14 +13,25 @@ namespace KaraokeConverter
{
InitializeComponent();
}
#region "Events"
private void mExportAVI_Status(string message)
{
pbAVI.Value = Convert.ToInt32(message);
}
#endregion
#region "Private Declarations"
private CDGFile mCDGFile;
private CdgFile mCDGFile;
private CdgFileIoStream mCDGStream;
private string mCDGFileName;
private string mMP3FileName;
private string mTempDir;
private ExportAVI withEventsField_mExportAVI;
private ExportAVI mExportAVI
{
get { return withEventsField_mExportAVI; }
@ -41,28 +47,28 @@ namespace KaraokeConverter
withEventsField_mExportAVI.Status += mExportAVI_Status;
}
}
}
#endregion
#region "Control Events"
private void btOutputAVI_Click_1(System.Object sender, System.EventArgs e)
private void btOutputAVI_Click_1(object sender, EventArgs e)
{
SelectOutputAVI();
}
private void btBackGroundBrowse_Click(System.Object sender, System.EventArgs e)
private void btBackGroundBrowse_Click(object sender, EventArgs e)
{
SelectBackGroundAVI();
}
private void btConvert_Click(System.Object sender, System.EventArgs e)
private void btConvert_Click(object sender, EventArgs e)
{
ConvertAVI();
}
private void tbFPS_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
private void tbFPS_KeyPress(object sender, KeyPressEventArgs e)
{
/*
if ((Strings.Asc(e.KeyChar) >= Keys.D0 & Strings.Asc(e.KeyChar) <= Keys.D9) | Strings.Asc(e.KeyChar) == Keys.Back | e.KeyChar == ".") {
@ -73,14 +79,14 @@ namespace KaraokeConverter
*/
}
private void btBrowseCDG_Click(System.Object sender, System.EventArgs e)
private void btBrowseCDG_Click(object sender, EventArgs e)
{
OpenFileDialog1.Filter = "CDG or Zip Files (*.zip, *.cdg)|*.zip;*.cdg";
OpenFileDialog1.ShowDialog();
tbFileName.Text = OpenFileDialog1.FileName;
}
private void chkBackGraph_CheckedChanged(System.Object sender, System.EventArgs e)
private void chkBackGraph_CheckedChanged(object sender, EventArgs e)
{
if (chkBackGround.Checked && chkBackGraph.Checked)
{
@ -89,7 +95,7 @@ namespace KaraokeConverter
ToggleCheckBox();
}
private void chkBackGround_CheckedChanged(System.Object sender, System.EventArgs e)
private void chkBackGround_CheckedChanged(object sender, EventArgs e)
{
if (chkBackGraph.Checked && chkBackGround.Checked)
{
@ -98,22 +104,13 @@ namespace KaraokeConverter
ToggleCheckBox();
}
private void btBrowseImg_Click(System.Object sender, System.EventArgs e)
private void btBrowseImg_Click(object sender, EventArgs e)
{
SelectBackGroundGraphic();
}
#endregion
#region "Events"
private void mExportAVI_Status(string message)
{
pbAVI.Value = (Convert.ToInt32(message));
}
#endregion
#region "Private Methods"
private void SelectOutputAVI()
@ -154,12 +151,13 @@ namespace KaraokeConverter
}
mExportAVI = new ExportAVI();
pbAVI.Value = 0;
string backGroundFilename = "";
var backGroundFilename = "";
if (chkBackGraph.Checked)
backGroundFilename = tbBackGroundImg.Text;
if (chkBackGround.Checked)
backGroundFilename = tbBackGroundAVI.Text;
mExportAVI.CDGtoAVI(tbAVIFile.Text, mCDGFileName, mMP3FileName, Convert.ToDouble(tbFPS.Text), backGroundFilename);
mExportAVI.CDGtoAVI(tbAVIFile.Text, mCDGFileName, mMP3FileName, Convert.ToDouble(tbFPS.Text),
backGroundFilename);
pbAVI.Value = 0;
try
{
@ -188,14 +186,13 @@ namespace KaraokeConverter
private void PreProcessFiles()
{
/*
string myCDGFileName = "";
if (Regex.IsMatch(tbFileName.Text, "\\.zip$")) {
string myTempDir = Path.GetTempPath() + Path.GetRandomFileName();
Directory.CreateDirectory(myTempDir);
mTempDir = myTempDir;
myCDGFileName = Unzip.UnzipMP3GFiles(tbFileName.Text, myTempDir);
goto PairUpFiles;
} else if (Regex.IsMatch(tbFileName.Text, "\\.cdg$")) {
myCDGFileName = tbFileName.Text;
PairUpFiles:
@ -206,7 +203,7 @@ namespace KaraokeConverter
mTempDir = "";
}
}
*/
}
@ -220,5 +217,26 @@ namespace KaraokeConverter
#endregion
private void Panel1_Paint(object sender, PaintEventArgs e)
{
}
private void Panel2_Paint(object sender, PaintEventArgs e)
{
}
private void Form1_Load(object sender, EventArgs e)
{
var file = new Uri(@"D:\HDMovies\28 Weeks Later (2007)\28.Weeks.Later.2007.720p.BrRip.264.YIFY.mp4");
vlcVideo.playlist.add(file.AbsoluteUri);
vlcVideo.playlist.play();
}
}
}
}

View File

@ -120,6 +120,20 @@
<metadata name="OpenFileDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<data name="vlcVideo.OcxState" mimetype="application/x-microsoft.net.object.binary.base64">
<value>
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACFTeXN0
ZW0uV2luZG93cy5Gb3Jtcy5BeEhvc3QrU3RhdGUBAAAABERhdGEHAgIAAAAJAwAAAA8DAAAAgwEAAAIB
AAAAAQAAAAAAAAAAAAAAAG4BAAAHAAAAKABDAG8AdQBuAHQAKQADAA0AAAAIAAAAQQB1AHQAbwBMAG8A
bwBwAAsAAAAIAAAAQQB1AHQAbwBQAGwAYQB5AAsA//8JAAAAQgBhAGMAawBDAG8AbABvAHIAAwAAAAAA
BwAAAEIAYQBzAGUAVQBSAEwACAAAAAAACAAAAEIAcgBhAG4AZABpAG4AZwALAP//DAAAAEUAeAB0AGUA
bgB0AEgAZQBpAGcAaAB0AAMAFhIAAAsAAABFAHgAdABlAG4AdABXAGkAZAB0AGgAAwATIQAAEQAAAEYA
dQBsAGwAcwBjAHIAZQBlAG4ARQBuAGEAYgBsAGUAZAALAP//AwAAAE0AUgBMAAgAAAAAAAkAAABTAHQA
YQByAHQAVABpAG0AZQADAAAAAAAHAAAAVABvAG8AbABiAGEAcgALAP//BwAAAFYAaQBzAGkAYgBsAGUA
CwD//wYAAABWAG8AbAB1AG0AZQADADIAAAAL
</value>
</data>
<metadata name="SaveFileDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>159, 17</value>
</metadata>

View File

@ -12,9 +12,11 @@
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<PlatformTarget>x86</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
@ -22,6 +24,7 @@
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
@ -33,6 +36,22 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Accord, Version=3.0.2.0, Culture=neutral, PublicKeyToken=fa1a88e29555ccf7, processorArchitecture=MSIL">
<HintPath>..\packages\Accord.3.0.2\lib\net45\Accord.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Accord.MachineLearning, Version=3.0.2.0, Culture=neutral, PublicKeyToken=fa1a88e29555ccf7, processorArchitecture=MSIL">
<HintPath>..\packages\Accord.MachineLearning.3.0.2\lib\net45\Accord.MachineLearning.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Accord.Math, Version=3.0.2.0, Culture=neutral, PublicKeyToken=fa1a88e29555ccf7, processorArchitecture=MSIL">
<HintPath>..\packages\Accord.Math.3.0.2\lib\net45\Accord.Math.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Accord.Statistics, Version=3.0.2.0, Culture=neutral, PublicKeyToken=fa1a88e29555ccf7, processorArchitecture=MSIL">
<HintPath>..\packages\Accord.Statistics.3.0.2\lib\net45\Accord.Statistics.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="AviFile, Version=1.0.3823.11378, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>lib\AviFile.dll</HintPath>
@ -50,8 +69,21 @@
<EmbedInteropTypes>False</EmbedInteropTypes>
<HintPath>lib\Interop.DexterLib.dll</HintPath>
</Reference>
<Reference Include="MediaToolkit, Version=1.1.0.1, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\MediaToolkit.1.1.0.1\lib\net40\MediaToolkit.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="NReco.VideoConverter, Version=1.0.8.0, Culture=neutral, PublicKeyToken=395ccb334978a0cd, processorArchitecture=MSIL">
<HintPath>..\packages\NReco.VideoConverter.1.0.8.0\lib\net20\NReco.VideoConverter.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="NReco.VideoInfo, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>lib\NReco.VideoInfo.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Drawing.Design" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
@ -61,6 +93,18 @@
<Reference Include="System.Net.Http" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="Vlc.DotNet.Core, Version=2.1.115.0, Culture=neutral, PublicKeyToken=84529da31f4eb963, processorArchitecture=x86">
<HintPath>..\packages\Vlc.DotNet.Core.2.1.115\lib\net45\x86\Vlc.DotNet.Core.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Vlc.DotNet.Core.Interops, Version=2.1.115.0, Culture=neutral, PublicKeyToken=84529da31f4eb963, processorArchitecture=x86">
<HintPath>..\packages\Vlc.DotNet.Core.Interops.2.1.115\lib\net45\x86\Vlc.DotNet.Core.Interops.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Vlc.DotNet.Forms, Version=2.1.115.0, Culture=neutral, PublicKeyToken=84529da31f4eb963, processorArchitecture=x86">
<HintPath>..\packages\Vlc.DotNet.Forms.2.1.115\lib\net45\x86\Vlc.DotNet.Forms.dll</HintPath>
<Private>True</Private>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="ExportAVI.cs" />
@ -85,6 +129,7 @@
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
<DesignTime>True</DesignTime>
</Compile>
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
@ -101,10 +146,40 @@
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<Content Include="lib\AviFile.dll" />
<Content Include="lib\DirectShowLib-2005.dll" />
<Content Include="lib\Interop.DexterLib.dll" />
<Content Include="lib\mencoder.exe" />
<Content Include="lib\AviFile.dll">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="lib\DirectShowLib-2005.dll">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="lib\Interop.DexterLib.dll">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="lib\mencoder.exe">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="lib\NReco.VideoInfo.dll" />
<Content Include="lib\NReco.VideoInfo.XML" />
<None Include="Resources\Google.png" />
</ItemGroup>
<ItemGroup>
<COMReference Include="AxAXVLC">
<Guid>{DF2BBE39-40A8-433B-A279-073F48DA94B6}</Guid>
<VersionMajor>1</VersionMajor>
<VersionMinor>0</VersionMinor>
<Lcid>0</Lcid>
<WrapperTool>aximp</WrapperTool>
<Isolated>False</Isolated>
</COMReference>
<COMReference Include="AXVLC">
<Guid>{DF2BBE39-40A8-433B-A279-073F48DA94B6}</Guid>
<VersionMajor>1</VersionMajor>
<VersionMinor>0</VersionMinor>
<Lcid>0</Lcid>
<WrapperTool>tlbimp</WrapperTool>
<Isolated>False</Isolated>
<EmbedInteropTypes>True</EmbedInteropTypes>
</COMReference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\CdgLib\CdgLib.csproj">
@ -113,6 +188,13 @@
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="..\packages\Accord.3.0.2\build\Accord.targets" Condition="Exists('..\packages\Accord.3.0.2\build\Accord.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\Accord.3.0.2\build\Accord.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Accord.3.0.2\build\Accord.targets'))" />
</Target>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">

View File

@ -1,33 +1,32 @@
using System.Drawing;
using System;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using DexterLib;
using DirectShowLib.DMO;
using NReco.VideoConverter;
namespace KaraokeConverter
{
public class MovieFrameExtractor
{
public static Bitmap GetBitmap(double position, string movieFileName, int width, int height)
{
var stopWatch = new Stopwatch();
stopWatch.Start();
var ffProbe = new NReco.VideoInfo.FFProbe();
var mediaInfo = ffProbe.GetMediaInfo(movieFileName);
var videoDuration = (int)mediaInfo.Duration.TotalSeconds;
DexterLib.MediaDetClass det = new DexterLib.MediaDetClass();
det.Filename = movieFileName;
det.CurrentStream = 0;
double len = det.StreamLength;
if (position > len)
var ffMpeg = new FFMpegConverter();
using (var ms = new MemoryStream())
{
return null;
ffMpeg.GetVideoThumbnail(movieFileName, ms, (float)position % videoDuration);
var bitmap = new Bitmap(ms);
stopWatch.Stop();
Debug.Print(stopWatch.ElapsedMilliseconds.ToString());
return bitmap;
}
string myTempFile = System.IO.Path.GetTempFileName();
det.WriteBitmapBits(position, width, height, myTempFile);
Bitmap myBMP = null;
using (FileStream lStream = new FileStream(myTempFile, FileMode.Open, FileAccess.Read))
{
myBMP = (Bitmap)Image.FromStream(lStream);
}
System.IO.File.Delete(myTempFile);
return myBMP;
}
}
}
}

View File

@ -1,22 +1,19 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace KaraokeConverter
{
static class Program
internal static class Program
{
/// <summary>
/// The main entry point for the application.
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
private static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
}
}
}

View File

@ -1,10 +1,10 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("KaraokeConverter")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
@ -17,9 +17,11 @@ using System.Runtime.InteropServices;
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("2821c26d-52d8-43d9-bef4-7ce4dfa60776")]
// Version information for an assembly consists of the following four values:
@ -32,5 +34,6 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@ -8,10 +8,10 @@
// </auto-generated>
//------------------------------------------------------------------------------
namespace KaraokeConverter.Properties
{
namespace KaraokeConverter.Properties {
using System;
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
@ -22,50 +22,52 @@ namespace KaraokeConverter.Properties
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources
{
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources()
{
internal Resources() {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager
{
get
{
if ((resourceMan == null))
{
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("KaraokeConverter.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture
{
get
{
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set
{
set {
resourceCulture = value;
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap Google {
get {
object obj = ResourceManager.GetObject("Google", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
}
}

View File

@ -46,7 +46,7 @@
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
@ -60,6 +60,7 @@
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
@ -68,9 +69,10 @@
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
@ -85,9 +87,10 @@
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
@ -109,9 +112,13 @@
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="Google" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Google.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>

View File

@ -1,7 +1,8 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>
</SettingsFile>

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

View File

@ -1,26 +1,21 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ICSharpCode.SharpZipLib.Zip;
namespace KaraokeConverter
{
public class Unzip
{
public static string UnzipMP3GFiles(string zipFilename, string outputPath)
{
string functionReturnValue = null;
functionReturnValue = "";
try
{
ICSharpCode.SharpZipLib.Zip.FastZip myZip = new ICSharpCode.SharpZipLib.Zip.FastZip();
var myZip = new FastZip();
myZip.ExtractZip(zipFilename, outputPath, "");
DirectoryInfo myDirInfo = new DirectoryInfo(outputPath);
FileInfo[] myFileInfo = myDirInfo.GetFiles("*.cdg", SearchOption.AllDirectories);
var myDirInfo = new DirectoryInfo(outputPath);
var myFileInfo = myDirInfo.GetFiles("*.cdg", SearchOption.AllDirectories);
if (myFileInfo.Length > 0)
{
functionReturnValue = myFileInfo[0].FullName;
@ -31,6 +26,5 @@ namespace KaraokeConverter
}
return functionReturnValue;
}
}
}
}

View File

@ -0,0 +1,162 @@
<?xml version="1.0"?>
<doc>
<assembly>
<name>NReco.VideoInfo</name>
</assembly>
<members>
<member name="T:NReco.VideoInfo.FFProbeException">
<summary>
The exception that is thrown when FFProbe process retruns non-zero error exit code
</summary>
</member>
<member name="P:NReco.VideoInfo.FFProbeException.ErrorCode">
<summary>
Get FFMpeg process error code
</summary>
</member>
<member name="T:NReco.VideoInfo.FFProbe">
<summary>
Provides information about media streams, video or audio files (wrapper for FFProbe command line tool)
</summary>
</member>
<member name="M:NReco.VideoInfo.FFProbe.#ctor">
<summary>
Create new instance of HtmlToPdfConverter
</summary>
</member>
<member name="M:NReco.VideoInfo.FFProbe.GetMediaInfo(System.String)">
<summary>
Returns information about local media file or online stream (URL).
</summary>
<param name="inputFile">local file path or URL</param>
<returns>Structured information about media</returns>
</member>
<member name="P:NReco.VideoInfo.FFProbe.ToolPath">
<summary>
Gets or sets path where FFProbe.exe is extracted
</summary>
<remarks>
By default this property initialized with folder with application assemblies.
For ASP.NET applications it is recommended to use "~/App_Code/".
</remarks>
</member>
<member name="P:NReco.VideoInfo.FFProbe.FFProbeExeName">
<summary>
Get or set FFProbe tool executive file name ('ffprobe.exe' by default)
</summary>
</member>
<member name="P:NReco.VideoInfo.FFProbe.CustomArgs">
<summary>
Get or set custom WkHtmlToImage command line arguments
</summary>
</member>
<member name="P:NReco.VideoInfo.FFProbe.ProcessPriority">
<summary>
Gets or sets FFProbe process priority (Normal by default)
</summary>
</member>
<member name="P:NReco.VideoInfo.FFProbe.ExecutionTimeout">
<summary>
Gets or sets maximum execution time for running FFProbe process (null is by default = no timeout)
</summary>
</member>
<member name="P:NReco.VideoInfo.FFProbe.IncludeFormat">
<summary>
Include information about file format.
</summary>
</member>
<member name="P:NReco.VideoInfo.FFProbe.IncludeStreams">
<summary>
Include information about media streams.
</summary>
</member>
<member name="T:NReco.VideoInfo.MediaInfo">
<summary>
Represents information about media file or stream.
</summary>
</member>
<member name="M:NReco.VideoInfo.MediaInfo.GetAttrValue(System.String)">
<summary>
Returns attribute value from FFProbe XML result.
</summary>
<param name="xpath">XPath selector</param>
<returns>attribute value or null</returns>
</member>
<member name="P:NReco.VideoInfo.MediaInfo.FormatName">
<summary>
Media container format identifier.
</summary>
</member>
<member name="P:NReco.VideoInfo.MediaInfo.FormatLongName">
<summary>
Human-readable container format name.
</summary>
</member>
<member name="P:NReco.VideoInfo.MediaInfo.FormatTags">
<summary>
List of media container tags.
</summary>
</member>
<member name="P:NReco.VideoInfo.MediaInfo.Streams">
<summary>
List of media streams.
</summary>
</member>
<member name="P:NReco.VideoInfo.MediaInfo.Duration">
<summary>
Total duration of the media.
</summary>
</member>
<member name="P:NReco.VideoInfo.MediaInfo.Result">
<summary>
FFProble XML result.
</summary>
</member>
<member name="T:NReco.VideoInfo.MediaInfo.StreamInfo">
<summary>
Represents information about stream.
</summary>
</member>
<member name="P:NReco.VideoInfo.MediaInfo.StreamInfo.Index">
<summary>
Stream index
</summary>
</member>
<member name="P:NReco.VideoInfo.MediaInfo.StreamInfo.CodecName">
<summary>
Codec name identifier
</summary>
</member>
<member name="P:NReco.VideoInfo.MediaInfo.StreamInfo.CodecLongName">
<summary>
Human-readable codec name.
</summary>
</member>
<member name="P:NReco.VideoInfo.MediaInfo.StreamInfo.CodecType">
<summary>
Codec type (video, audio).
</summary>
</member>
<member name="P:NReco.VideoInfo.MediaInfo.StreamInfo.PixelFormat">
<summary>
Video stream pixel format (if applicable).
</summary>
<remarks>Null is returned if pixel format is not available.</remarks>
</member>
<member name="P:NReco.VideoInfo.MediaInfo.StreamInfo.Width">
<summary>
Video frame width (if applicable).
</summary>
</member>
<member name="P:NReco.VideoInfo.MediaInfo.StreamInfo.Height">
<summary>
Video frame height (if applicable)
</summary>
</member>
<member name="P:NReco.VideoInfo.MediaInfo.StreamInfo.FrameRate">
<summary>
Video frame rate per second (if applicable).
</summary>
</member>
</members>
</doc>

Binary file not shown.

View File

@ -1,4 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Accord" version="3.0.2" targetFramework="net46" />
<package id="Accord.MachineLearning" version="3.0.2" targetFramework="net46" />
<package id="Accord.Math" version="3.0.2" targetFramework="net46" />
<package id="Accord.Statistics" version="3.0.2" targetFramework="net46" />
<package id="MediaToolkit" version="1.1.0.1" targetFramework="net46" />
<package id="NReco.VideoConverter" version="1.0.8.0" targetFramework="net46" />
<package id="SharpZipLib" version="0.86.0" targetFramework="net46" />
<package id="Vlc.DotNet.Core" version="2.1.115" targetFramework="net46" />
<package id="Vlc.DotNet.Core.Interops" version="2.1.115" targetFramework="net46" />
<package id="Vlc.DotNet.Forms" version="2.1.115" targetFramework="net46" />
</packages>

View File

@ -3,18 +3,22 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25008.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CdgLib", "CdgLib\CdgLib.csproj", "{3203DFD2-DA5B-47B3-B009-18DD9C401FC3}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KaraokePlayer", "KaraokePlayer\KaraokePlayer.csproj", "{2CF318E2-04B5-40FC-9577-6DAC62B86FB2}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KaraokeConverter", "KaraokeConverter\KaraokeConverter.csproj", "{2821C26D-52D8-43D9-BEF4-7CE4DFA60776}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CdgLib", "CdgLib\CdgLib.csproj", "{3203DFD2-DA5B-47B3-B009-18DD9C401FC3}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{3203DFD2-DA5B-47B3-B009-18DD9C401FC3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3203DFD2-DA5B-47B3-B009-18DD9C401FC3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3203DFD2-DA5B-47B3-B009-18DD9C401FC3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3203DFD2-DA5B-47B3-B009-18DD9C401FC3}.Release|Any CPU.Build.0 = Release|Any CPU
{2CF318E2-04B5-40FC-9577-6DAC62B86FB2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2CF318E2-04B5-40FC-9577-6DAC62B86FB2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2CF318E2-04B5-40FC-9577-6DAC62B86FB2}.Release|Any CPU.ActiveCfg = Release|Any CPU
@ -23,10 +27,6 @@ Global
{2821C26D-52D8-43D9-BEF4-7CE4DFA60776}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2821C26D-52D8-43D9-BEF4-7CE4DFA60776}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2821C26D-52D8-43D9-BEF4-7CE4DFA60776}.Release|Any CPU.Build.0 = Release|Any CPU
{3203DFD2-DA5B-47B3-B009-18DD9C401FC3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3203DFD2-DA5B-47B3-B009-18DD9C401FC3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3203DFD2-DA5B-47B3-B009-18DD9C401FC3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3203DFD2-DA5B-47B3-B009-18DD9C401FC3}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View File

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8" ?>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6" />
</startup>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6" />
</startup>
</configuration>

View File

@ -29,41 +29,77 @@
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(CDGWindow));
this.PictureBox1 = new System.Windows.Forms.PictureBox();
((System.ComponentModel.ISupportInitialize)this.PictureBox1).BeginInit();
this.pbLyrics = new System.Windows.Forms.PictureBox();
this.panel1 = new System.Windows.Forms.Panel();
this.vlcPlayer = new Vlc.DotNet.Forms.VlcControl();
((System.ComponentModel.ISupportInitialize)(this.pbLyrics)).BeginInit();
this.panel1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.vlcPlayer)).BeginInit();
this.SuspendLayout();
//
//PictureBox1
//
this.PictureBox1.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
this.PictureBox1.Dock = System.Windows.Forms.DockStyle.Fill;
this.PictureBox1.Location = new System.Drawing.Point(0, 0);
this.PictureBox1.Name = "PictureBox1";
this.PictureBox1.Size = new System.Drawing.Size(300, 216);
this.PictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
this.PictureBox1.TabIndex = 0;
this.PictureBox1.TabStop = false;
//
//CDGWindow
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6f, 13f);
//
// pbLyrics
//
this.pbLyrics.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
this.pbLyrics.Dock = System.Windows.Forms.DockStyle.Fill;
this.pbLyrics.Image = global::KaraokePlayer.Properties.Resources.Google;
this.pbLyrics.Location = new System.Drawing.Point(0, 0);
this.pbLyrics.Name = "pbLyrics";
this.pbLyrics.Size = new System.Drawing.Size(553, 414);
this.pbLyrics.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
this.pbLyrics.TabIndex = 0;
this.pbLyrics.TabStop = false;
//
// panel1
//
this.panel1.Controls.Add(this.vlcPlayer);
this.panel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel1.Enabled = false;
this.panel1.Location = new System.Drawing.Point(0, 0);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(553, 414);
this.panel1.TabIndex = 2;
//
// vlcPlayer
//
this.vlcPlayer.BackColor = System.Drawing.Color.Black;
this.vlcPlayer.Dock = System.Windows.Forms.DockStyle.Fill;
this.vlcPlayer.Location = new System.Drawing.Point(0, 0);
this.vlcPlayer.Name = "vlcPlayer";
this.vlcPlayer.Size = new System.Drawing.Size(553, 414);
this.vlcPlayer.Spu = -1;
this.vlcPlayer.TabIndex = 2;
this.vlcPlayer.Text = "vlcControl1";
this.vlcPlayer.VlcLibDirectory = ((System.IO.DirectoryInfo)(resources.GetObject("vlcPlayer.VlcLibDirectory")));
this.vlcPlayer.VlcMediaplayerOptions = new string[] {
"--audio-visual=visual",
"--effect-list=scope",
"--no-video"};
//
// CDGWindow
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.Color.Black;
this.ClientSize = new System.Drawing.Size(300, 216);
this.Controls.Add(this.PictureBox1);
this.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.ClientSize = new System.Drawing.Size(553, 414);
this.Controls.Add(this.pbLyrics);
this.Controls.Add(this.panel1);
this.KeyPreview = true;
this.Name = "CDGWindow";
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Karaoke";
this.TopMost = true;
((System.ComponentModel.ISupportInitialize)this.PictureBox1).EndInit();
this.Load += new System.EventHandler(this.CDGWindow_Load);
this.DoubleClick += new System.EventHandler(this.CDGWindow_DoubleClick_1);
((System.ComponentModel.ISupportInitialize)(this.pbLyrics)).EndInit();
this.panel1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.vlcPlayer)).EndInit();
this.ResumeLayout(false);
}
public System.Windows.Forms.PictureBox PictureBox1;
public System.Windows.Forms.PictureBox pbLyrics;
#endregion
private System.Windows.Forms.Panel panel1;
private Vlc.DotNet.Forms.VlcControl vlcPlayer;
}
}

View File

@ -1,63 +1,47 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Collections;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace KaraokePlayer
{
public partial class CDGWindow : Form
{
private void CDGWindow_DoubleClick(object sender, System.EventArgs e)
{
AutoSizeWindow();
}
private void PictureBox1_DoubleClick(object sender, System.EventArgs e)
{
AutoSizeWindow();
}
private void AutoSizeWindow()
{
if (this.WindowState == FormWindowState.Normal)
{
this.WindowState = FormWindowState.Maximized;
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.TopMost = true;
this.Refresh();
}
else {
this.WindowState = FormWindowState.Normal;
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Sizable;
this.TopMost = false;
this.Refresh();
}
}
private void CDGWindow_SizeChanged(object sender, System.EventArgs e)
{
if (this.WindowState == FormWindowState.Maximized)
{
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.TopMost = true;
}
else {
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Sizable;
this.TopMost = false;
}
}
public CDGWindow()
{
SizeChanged += CDGWindow_SizeChanged;
DoubleClick += CDGWindow_DoubleClick;
InitializeComponent();
}
private void CDGWindow_Load(object sender, EventArgs e)
{
var plexiGlass =new Plexiglass(this);
plexiGlass.Controls.Add(pbLyrics);
var file = new Uri(@"D:\Karaoke\SF001 - SF339 Sunfly Hits Karaoke Complete\SF339\SF339-01 - Kiesza - Hideaway.mp3");
vlcPlayer.SetMedia(file);
vlcPlayer.Play();
}
private void CDGWindow_DoubleClick_1(object sender, EventArgs e)
{
if (WindowState == FormWindowState.Maximized)
{
FormBorderStyle = FormBorderStyle.Sizable;
this.WindowState = FormWindowState.Normal;
}
else
{
FormBorderStyle = FormBorderStyle.None;
this.WindowState = FormWindowState.Maximized;
}
}
}
}
}

View File

@ -0,0 +1,127 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="vlcPlayer.VlcLibDirectory" mimetype="application/x-microsoft.net.object.binary.base64">
<value>
AAEAAAD/////AQAAAAAAAAAEAQAAABdTeXN0ZW0uSU8uRGlyZWN0b3J5SW5mbwIAAAAMT3JpZ2luYWxQ
YXRoCEZ1bGxQYXRoAQEGAgAAACNDOlxQcm9ncmFtIEZpbGVzICh4ODYpXFZpZGVvTEFOXFZMQwkCAAAA
Cw==
</value>
</data>
</root>

View File

@ -56,6 +56,8 @@
this.tbFileName.ReadOnly = true;
this.tbFileName.Size = new System.Drawing.Size(309, 20);
this.tbFileName.TabIndex = 0;
this.tbFileName.Text = "D:\\Karaoke\\SF001 - SF339 Sunfly Hits Karaoke Complete\\SF339\\SF339-01 - Kiesza - H" +
"ideaway.cdg";
//
// btBrowse
//

View File

@ -1,318 +1,328 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
using System.Text.RegularExpressions;
using System.Windows.Forms;
using CdgLib;
using Un4seen.Bass;
using System.Text.RegularExpressions;
using System.IO;
using Un4seen.Bass.AddOn.Fx;
namespace KaraokePlayer
{
public partial class Form1 : Form
{
{
public Form1()
{
InitializeComponent();
}
#region "Private Declarations"
#region "Private Declarations"
private CDGFile mCDGFile;
private CdgFileIoStream mCDGStream;
private int mSemitones = 0;
private bool mPaused;
private long mFrameCount = 0;
private bool mStop;
private string mCDGFileName;
private string mMP3FileName;
private string mTempDir;
private int mMP3Stream;
private CDGWindow withEventsField_mCDGWindow = new CDGWindow();
private CDGWindow mCDGWindow {
get { return withEventsField_mCDGWindow; }
set {
if (withEventsField_mCDGWindow != null) {
withEventsField_mCDGWindow.FormClosing -= mCDGWindow_FormClosing;
}
withEventsField_mCDGWindow = value;
if (withEventsField_mCDGWindow != null) {
withEventsField_mCDGWindow.FormClosing += mCDGWindow_FormClosing;
}
}
}
private CdgFile mCDGFile;
private CdgFileIoStream mCDGStream;
private int mSemitones = 0;
private bool mPaused;
private long mFrameCount;
private bool mStop;
private string mCDGFileName;
private string mMP3FileName;
private string mTempDir;
private int mMP3Stream;
private CDGWindow withEventsField_mCDGWindow = new CDGWindow();
private bool mBassInitalized = false;
#endregion
private CDGWindow mCDGWindow
{
get { return withEventsField_mCDGWindow; }
set
{
if (withEventsField_mCDGWindow != null)
{
withEventsField_mCDGWindow.FormClosing -= mCDGWindow_FormClosing;
}
withEventsField_mCDGWindow = value;
if (withEventsField_mCDGWindow != null)
{
withEventsField_mCDGWindow.FormClosing += mCDGWindow_FormClosing;
}
}
}
#region "Control Events"
private bool mBassInitalized;
private void Form1_Load(object sender, System.EventArgs e)
{
//Add registration key here if you have a license
//BassNet.Registration("email@domain.com", "0000000000000000")
try {
Bass.BASS_Init(-1, 44100, BASSInit.BASS_DEVICE_DEFAULT, this.Handle);
mBassInitalized = true;
} catch (Exception ex) {
MessageBox.Show("Unable to initialize the audio playback system.");
}
}
#endregion
private void Button1_Click(System.Object sender, System.EventArgs e)
{
BrowseCDGZip();
}
#region "Control Events"
private void Form1_FormClosed(object sender, System.Windows.Forms.FormClosedEventArgs e)
{
StopPlayback();
}
private void Form1_Load(object sender, EventArgs e)
{
//Add registration key here if you have a license
//BassNet.Registration("email@domain.com", "0000000000000000")
try
{
Bass.BASS_Init(-1, 44100, BASSInit.BASS_DEVICE_DEFAULT, Handle);
mBassInitalized = true;
}
catch (Exception ex)
{
MessageBox.Show("Unable to initialize the audio playback system.");
}
}
private void tsbPlay_Click(System.Object sender, System.EventArgs e)
{
Play();
}
private void Button1_Click(object sender, EventArgs e)
{
BrowseCDGZip();
}
private void tsbStop_Click(System.Object sender, System.EventArgs e)
{
try {
StopPlayback();
} catch (Exception ex) {
//Do nothing for now
}
}
private void Form1_FormClosed(object sender, FormClosedEventArgs e)
{
StopPlayback();
}
private void tsbPause_Click(System.Object sender, System.EventArgs e)
{
Pause();
}
private void tsbPlay_Click(object sender, EventArgs e)
{
Play();
}
private void TrackBar1_Scroll(System.Object sender, System.EventArgs e)
{
AdjustVolume();
}
private void tsbStop_Click(object sender, EventArgs e)
{
try
{
StopPlayback();
}
catch (Exception ex)
{
//Do nothing for now
}
}
private void nudKey_ValueChanged(System.Object sender, System.EventArgs e)
{
AdjustPitch();
}
private void tsbPause_Click(object sender, EventArgs e)
{
Pause();
}
private void mCDGWindow_FormClosing(object sender, System.Windows.Forms.FormClosingEventArgs e)
{
StopPlayback();
mCDGWindow.Hide();
e.Cancel = true;
}
private void TrackBar1_Scroll(object sender, EventArgs e)
{
AdjustVolume();
}
#endregion
private void nudKey_ValueChanged(object sender, EventArgs e)
{
AdjustPitch();
}
#region "CDG + MP3 Playback Operations"
private void mCDGWindow_FormClosing(object sender, FormClosingEventArgs e)
{
StopPlayback();
mCDGWindow.Hide();
e.Cancel = true;
}
private void Pause()
{
mPaused = !mPaused;
if (mMP3Stream != 0) {
if (Bass.BASS_ChannelIsActive(mMP3Stream) != BASSActive.BASS_ACTIVE_PLAYING) {
Bass.BASS_ChannelPlay(mMP3Stream, false);
tsbPause.Text = "Pause";
} else {
Bass.BASS_ChannelPause(mMP3Stream);
tsbPause.Text = "Resume";
}
}
}
#endregion
private void PlayMP3Bass(string mp3FileName)
{
if (mBassInitalized || Bass.BASS_Init(-1, 44100, BASSInit.BASS_DEVICE_DEFAULT, this.Handle)) {
mMP3Stream = 0;
mMP3Stream = Bass.BASS_StreamCreateFile(mp3FileName, 0, 0, BASSFlag.BASS_STREAM_DECODE | BASSFlag.BASS_SAMPLE_FLOAT | BASSFlag.BASS_STREAM_PRESCAN);
mMP3Stream = Un4seen.Bass.AddOn.Fx.BassFx.BASS_FX_TempoCreate(mMP3Stream, BASSFlag.BASS_FX_FREESOURCE | BASSFlag.BASS_SAMPLE_FLOAT | BASSFlag.BASS_SAMPLE_LOOP);
if (mMP3Stream != 0) {
AdjustPitch();
AdjustVolume();
ShowCDGWindow();
Bass.BASS_ChannelPlay(mMP3Stream, false);
} else {
throw new Exception(string.Format("Stream error: {0}", Bass.BASS_ErrorGetCode()));
}
}
}
#region "CDG + MP3 Playback Operations"
private void StopPlaybackBass()
{
Bass.BASS_Stop();
Bass.BASS_StreamFree(mMP3Stream);
Bass.BASS_Free();
mMP3Stream = 0;
mBassInitalized = false;
}
private void Pause()
{
mPaused = !mPaused;
if (mMP3Stream != 0)
{
if (Bass.BASS_ChannelIsActive(mMP3Stream) != BASSActive.BASS_ACTIVE_PLAYING)
{
Bass.BASS_ChannelPlay(mMP3Stream, false);
tsbPause.Text = "Pause";
}
else
{
Bass.BASS_ChannelPause(mMP3Stream);
tsbPause.Text = "Resume";
}
}
}
private void StopPlayback()
{
mStop = true;
HideCDGWindow();
StopPlaybackBass();
mCDGFile.Dispose();
CleanUp();
}
private void PlayMP3Bass(string mp3FileName)
{
if (mBassInitalized || Bass.BASS_Init(-1, 44100, BASSInit.BASS_DEVICE_DEFAULT, Handle))
{
mMP3Stream = 0;
mMP3Stream = Bass.BASS_StreamCreateFile(mp3FileName, 0, 0,
BASSFlag.BASS_STREAM_DECODE | BASSFlag.BASS_SAMPLE_FLOAT | BASSFlag.BASS_STREAM_PRESCAN);
mMP3Stream = BassFx.BASS_FX_TempoCreate(mMP3Stream,
BASSFlag.BASS_FX_FREESOURCE | BASSFlag.BASS_SAMPLE_FLOAT | BASSFlag.BASS_SAMPLE_LOOP);
if (mMP3Stream != 0)
{
AdjustPitch();
AdjustVolume();
ShowCDGWindow();
Bass.BASS_ChannelPlay(mMP3Stream, false);
}
else
{
throw new Exception(string.Format("Stream error: {0}", Bass.BASS_ErrorGetCode()));
}
}
}
private void PausePlayback()
{
Bass.BASS_Pause();
}
private void StopPlaybackBass()
{
Bass.BASS_Stop();
Bass.BASS_StreamFree(mMP3Stream);
Bass.BASS_Free();
mMP3Stream = 0;
mBassInitalized = false;
}
private void ResumePlayback()
{
Bass.BASS_Pause();
}
private void StopPlayback()
{
mStop = true;
HideCDGWindow();
StopPlaybackBass();
mCDGFile.Dispose();
CleanUp();
}
private void Play()
{
try {
if (mMP3Stream != 0 && Bass.BASS_ChannelIsActive(mMP3Stream) == BASSActive.BASS_ACTIVE_PLAYING) {
StopPlayback();
}
PreProcessFiles();
if (string.IsNullOrEmpty(mCDGFileName) | string.IsNullOrEmpty(mMP3FileName)) {
MessageBox.Show("Cannot find a CDG and MP3 file to play together.");
StopPlayback();
return;
}
mPaused = false;
mStop = false;
mFrameCount = 0;
mCDGFile = new CDGFile(mCDGFileName);
long cdgLength = mCDGFile.getTotalDuration();
PlayMP3Bass(mMP3FileName);
DateTime startTime = DateTime.Now;
var endTime = startTime.AddMilliseconds(mCDGFile.getTotalDuration());
long millisecondsRemaining = cdgLength;
while (millisecondsRemaining > 0) {
if (mStop) {
break; // TODO: might not be correct. Was : Exit While
}
millisecondsRemaining = (long)endTime.Subtract(DateTime.Now).TotalMilliseconds;
long pos = cdgLength - millisecondsRemaining;
while (mPaused) {
endTime = DateTime.Now.AddMilliseconds(millisecondsRemaining);
Application.DoEvents();
}
mCDGFile.renderAtPosition(pos);
mFrameCount += 1;
mCDGWindow.PictureBox1.Image = mCDGFile.RgbImage;
mCDGWindow.PictureBox1.BackColor = ((Bitmap)mCDGFile.RgbImage).GetPixel(1, 1);
mCDGWindow.PictureBox1.Refresh();
Application.DoEvents();
}
StopPlayback();
} catch (Exception ex) {
}
}
private void PausePlayback()
{
Bass.BASS_Pause();
}
private void AdjustPitch()
{
if (mMP3Stream != 0) {
Bass.BASS_ChannelSetAttribute(mMP3Stream, BASSAttribute.BASS_ATTRIB_TEMPO_PITCH, (float)nudKey.Value);
}
}
private void ResumePlayback()
{
Bass.BASS_Pause();
}
private void AdjustVolume()
{
if (mMP3Stream != 0) {
Bass.BASS_ChannelSetAttribute(mMP3Stream, BASSAttribute.BASS_ATTRIB_VOL, trbVolume.Value == 0 ? 0 : (trbVolume.Value / 100));
}
}
private void Play()
{
try
{
if (mMP3Stream != 0 && Bass.BASS_ChannelIsActive(mMP3Stream) == BASSActive.BASS_ACTIVE_PLAYING)
{
StopPlayback();
}
PreProcessFiles();
if (string.IsNullOrEmpty(mCDGFileName) | string.IsNullOrEmpty(mMP3FileName))
{
MessageBox.Show("Cannot find a CDG and MP3 file to play together.");
StopPlayback();
return;
}
mPaused = false;
mStop = false;
mFrameCount = 0;
mCDGFile = new CdgFile(mCDGFileName);
var cdgLength = mCDGFile.GetTotalDuration();
PlayMP3Bass(mMP3FileName);
var startTime = DateTime.Now;
var endTime = startTime.AddMilliseconds(mCDGFile.GetTotalDuration());
var millisecondsRemaining = cdgLength;
while (millisecondsRemaining > 0)
{
if (mStop)
{
break; // TODO: might not be correct. Was : Exit While
}
millisecondsRemaining = (long) endTime.Subtract(DateTime.Now).TotalMilliseconds;
var pos = cdgLength - millisecondsRemaining;
while (mPaused)
{
endTime = DateTime.Now.AddMilliseconds(millisecondsRemaining);
Application.DoEvents();
}
mCDGFile.RenderAtPosition(pos);
mFrameCount += 1;
mCDGWindow.pbLyrics.Image = mCDGFile.RgbImage;
mCDGWindow.pbLyrics.BackColor = ((Bitmap) mCDGFile.RgbImage).GetPixel(1, 1);
mCDGWindow.pbLyrics.Refresh();
#endregion
Application.DoEvents();
}
StopPlayback();
}
catch (Exception ex)
{
}
}
#region "File Access"
private void AdjustPitch()
{
if (mMP3Stream != 0)
{
Bass.BASS_ChannelSetAttribute(mMP3Stream, BASSAttribute.BASS_ATTRIB_TEMPO_PITCH, (float) nudKey.Value);
}
}
private void BrowseCDGZip()
{
OpenFileDialog1.Filter = "CDG or Zip Files (*.zip, *.cdg)|*.zip;*.cdg";
OpenFileDialog1.ShowDialog();
tbFileName.Text = OpenFileDialog1.FileName;
}
private void AdjustVolume()
{
if (mMP3Stream != 0)
{
Bass.BASS_ChannelSetAttribute(mMP3Stream, BASSAttribute.BASS_ATTRIB_VOL,
trbVolume.Value == 0 ? 0 : trbVolume.Value/100);
}
}
private void PreProcessFiles()
{
string myCDGFileName = "";
if (Regex.IsMatch(tbFileName.Text, "\\.zip$")) {
string myTempDir = Path.GetTempPath() + Path.GetRandomFileName();
Directory.CreateDirectory(myTempDir);
mTempDir = myTempDir;
myCDGFileName = Unzip.UnzipMP3GFiles(tbFileName.Text, myTempDir);
#endregion
} else if (Regex.IsMatch(tbFileName.Text, "\\.cdg$")) {
myCDGFileName = tbFileName.Text;
PairUpFiles:
string myMP3FileName = System.Text.RegularExpressions.Regex.Replace(myCDGFileName, "\\.cdg$", ".mp3");
if (File.Exists(myMP3FileName)) {
mMP3FileName = myMP3FileName;
mCDGFileName = myCDGFileName;
mTempDir = "";
}
}
}
#region "File Access"
private void CleanUp()
{
if (!string.IsNullOrEmpty(mTempDir)) {
try {
Directory.Delete(mTempDir, true);
} catch (Exception ex) {
}
}
mTempDir = "";
}
private void BrowseCDGZip()
{
OpenFileDialog1.Filter = "CDG or Zip Files (*.zip, *.cdg)|*.zip;*.cdg";
OpenFileDialog1.ShowDialog();
tbFileName.Text = OpenFileDialog1.FileName;
}
#endregion
private void PreProcessFiles()
{
var myCDGFileName = "";
if (Regex.IsMatch(tbFileName.Text, "\\.zip$"))
{
var myTempDir = Path.GetTempPath() + Path.GetRandomFileName();
Directory.CreateDirectory(myTempDir);
mTempDir = myTempDir;
myCDGFileName = Unzip.UnzipMP3GFiles(tbFileName.Text, myTempDir);
}
else if (Regex.IsMatch(tbFileName.Text, "\\.cdg$"))
{
myCDGFileName = tbFileName.Text;
var myMP3FileName = Regex.Replace(myCDGFileName, "\\.cdg$", ".mp3");
if (File.Exists(myMP3FileName))
{
mMP3FileName = myMP3FileName;
mCDGFileName = myCDGFileName;
mTempDir = "";
}
}
}
#region "CDG Graphics Window"
private void CleanUp()
{
if (!string.IsNullOrEmpty(mTempDir))
{
try
{
Directory.Delete(mTempDir, true);
}
catch (Exception ex)
{
}
}
mTempDir = "";
}
private void ShowCDGWindow()
{
mCDGWindow.Show();
}
#endregion
private void HideCDGWindow()
{
mCDGWindow.PictureBox1.Image = null;
mCDGWindow.Hide();
}
#region "CDG Graphics Window"
#endregion
private void ShowCDGWindow()
{
mCDGWindow.Show();
}
private void HideCDGWindow()
{
mCDGWindow.pbLyrics.Image = null;
mCDGWindow.Hide();
}
}
}
#endregion
}
}

View File

@ -42,6 +42,7 @@
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Drawing.Design" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
@ -51,6 +52,18 @@
<Reference Include="System.Net.Http" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="Vlc.DotNet.Core, Version=2.1.115.0, Culture=neutral, PublicKeyToken=84529da31f4eb963, processorArchitecture=x86">
<HintPath>..\packages\Vlc.DotNet.Core.2.1.115\lib\net45\x86\Vlc.DotNet.Core.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Vlc.DotNet.Core.Interops, Version=2.1.115.0, Culture=neutral, PublicKeyToken=84529da31f4eb963, processorArchitecture=x86">
<HintPath>..\packages\Vlc.DotNet.Core.Interops.2.1.115\lib\net45\x86\Vlc.DotNet.Core.Interops.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Vlc.DotNet.Forms, Version=2.1.115.0, Culture=neutral, PublicKeyToken=84529da31f4eb963, processorArchitecture=x86">
<HintPath>..\packages\Vlc.DotNet.Forms.2.1.115\lib\net45\x86\Vlc.DotNet.Forms.dll</HintPath>
<Private>True</Private>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="CDGWindow.cs">
@ -65,9 +78,15 @@
<Compile Include="Form1.Designer.cs">
<DependentUpon>Form1.cs</DependentUpon>
</Compile>
<Compile Include="PlexiGlass.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Unzip.cs" />
<EmbeddedResource Include="CDGWindow.resx">
<DependentUpon>CDGWindow.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Form1.resx">
<DependentUpon>Form1.cs</DependentUpon>
</EmbeddedResource>
@ -79,6 +98,7 @@
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
<DesignTime>True</DesignTime>
</Compile>
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
@ -98,6 +118,26 @@
<Content Include="lib\bass.dll" />
<Content Include="lib\Bass.Net.dll" />
<Content Include="lib\bass_fx.dll" />
<None Include="Resources\Google.png" />
</ItemGroup>
<ItemGroup>
<COMReference Include="AxAXVLC">
<Guid>{DF2BBE39-40A8-433B-A279-073F48DA94B6}</Guid>
<VersionMajor>1</VersionMajor>
<VersionMinor>0</VersionMinor>
<Lcid>0</Lcid>
<WrapperTool>aximp</WrapperTool>
<Isolated>False</Isolated>
</COMReference>
<COMReference Include="AXVLC">
<Guid>{DF2BBE39-40A8-433B-A279-073F48DA94B6}</Guid>
<VersionMajor>1</VersionMajor>
<VersionMinor>0</VersionMinor>
<Lcid>0</Lcid>
<WrapperTool>tlbimp</WrapperTool>
<Isolated>False</Isolated>
<EmbedInteropTypes>True</EmbedInteropTypes>
</COMReference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\CdgLib\CdgLib.csproj">

View File

@ -0,0 +1,69 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace KaraokePlayer
{
using System;
using System.Drawing;
using System.Windows.Forms;
using System.Runtime.InteropServices;
class Plexiglass : Form
{
public Plexiglass(Form tocover)
{
this.BackColor = Color.FromArgb(1,1,1);
TransparencyKey = Color.FromArgb(1, 1, 1);
this.FormBorderStyle = FormBorderStyle.None;
this.ControlBox = false;
this.ShowInTaskbar = false;
this.StartPosition = FormStartPosition.Manual;
this.AutoScaleMode = AutoScaleMode.None;
this.Location = tocover.PointToScreen(Point.Empty);
this.ClientSize = tocover.ClientSize;
tocover.LocationChanged += Cover_LocationChanged;
tocover.ClientSizeChanged += Cover_ClientSizeChanged;
this.Show(tocover);
tocover.Focus();
// Disable Aero transitions, the plexiglass gets too visible
if (Environment.OSVersion.Version.Major >= 6)
{
int value = 1;
DwmSetWindowAttribute(tocover.Handle, DWMWA_TRANSITIONS_FORCEDISABLED, ref value, 4);
}
}
private void Cover_LocationChanged(object sender, EventArgs e)
{
// Ensure the plexiglass follows the owner
this.Location = this.Owner.PointToScreen(Point.Empty);
}
private void Cover_ClientSizeChanged(object sender, EventArgs e)
{
// Ensure the plexiglass keeps the owner covered
this.ClientSize = this.Owner.ClientSize;
}
protected override void OnFormClosing(FormClosingEventArgs e)
{
// Restore owner
this.Owner.LocationChanged -= Cover_LocationChanged;
this.Owner.ClientSizeChanged -= Cover_ClientSizeChanged;
if (!this.Owner.IsDisposed && Environment.OSVersion.Version.Major >= 6)
{
int value = 1;
DwmSetWindowAttribute(this.Owner.Handle, DWMWA_TRANSITIONS_FORCEDISABLED, ref value, 4);
}
base.OnFormClosing(e);
}
protected override void OnActivated(EventArgs e)
{
// Always keep the owner activated instead
this.BeginInvoke(new Action(() => this.Owner.Activate()));
}
private const int DWMWA_TRANSITIONS_FORCEDISABLED = 3;
[DllImport("dwmapi.dll")]
private static extern int DwmSetWindowAttribute(IntPtr hWnd, int attr, ref int value, int attrLen);
}
}

View File

@ -1,22 +1,19 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace KaraokePlayer
{
static class Program
internal static class Program
{
/// <summary>
/// The main entry point for the application.
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
private static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
}
}
}

View File

@ -1,10 +1,10 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("KaraokePlayer")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
@ -17,9 +17,11 @@ using System.Runtime.InteropServices;
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("2cf318e2-04b5-40fc-9577-6dac62b86fb2")]
// Version information for an assembly consists of the following four values:
@ -32,5 +34,6 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@ -8,10 +8,10 @@
// </auto-generated>
//------------------------------------------------------------------------------
namespace KaraokePlayer.Properties
{
namespace KaraokePlayer.Properties {
using System;
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
@ -22,50 +22,52 @@ namespace KaraokePlayer.Properties
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources
{
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources()
{
internal Resources() {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager
{
get
{
if ((resourceMan == null))
{
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("KaraokePlayer.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture
{
get
{
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set
{
set {
resourceCulture = value;
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap Google {
get {
object obj = ResourceManager.GetObject("Google", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
}
}

View File

@ -46,7 +46,7 @@
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
@ -60,6 +60,7 @@
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
@ -68,9 +69,10 @@
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
@ -85,9 +87,10 @@
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
@ -109,9 +112,13 @@
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="Google" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Google.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>

View File

@ -1,7 +1,8 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>
</SettingsFile>

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

View File

@ -1,25 +1,21 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ICSharpCode.SharpZipLib.Zip;
namespace KaraokePlayer
{
class Unzip
internal class Unzip
{
public static string UnzipMP3GFiles(string zipFilename, string outputPath)
{
string functionReturnValue = null;
functionReturnValue = "";
try
{
ICSharpCode.SharpZipLib.Zip.FastZip myZip = new ICSharpCode.SharpZipLib.Zip.FastZip();
var myZip = new FastZip();
myZip.ExtractZip(zipFilename, outputPath, "");
DirectoryInfo myDirInfo = new DirectoryInfo(outputPath);
FileInfo[] myFileInfo = myDirInfo.GetFiles("*.cdg", SearchOption.AllDirectories);
var myDirInfo = new DirectoryInfo(outputPath);
var myFileInfo = myDirInfo.GetFiles("*.cdg", SearchOption.AllDirectories);
if (myFileInfo.Length > 0)
{
functionReturnValue = myFileInfo[0].FullName;
@ -30,6 +26,5 @@ namespace KaraokePlayer
}
return functionReturnValue;
}
}
}
}

View File

@ -1,4 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="SharpZipLib" version="0.86.0" targetFramework="net46" />
<package id="Vlc.DotNet.Core" version="2.1.115" targetFramework="net46" />
<package id="Vlc.DotNet.Core.Interops" version="2.1.115" targetFramework="net46" />
<package id="Vlc.DotNet.Forms" version="2.1.115" targetFramework="net46" />
</packages>

View File

@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("VlcPlayer")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("VlcPlayer")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("4daaf531-4269-4548-b4e3-516254615ec1")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

63
VlcPlayer/VlcControl.Designer.cs generated Normal file
View File

@ -0,0 +1,63 @@
namespace VlcPlayer
{
partial class VlcControl
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(VlcControl));
this.axVLCPlugin21 = new AxAXVLC.AxVLCPlugin2();
((System.ComponentModel.ISupportInitialize)(this.axVLCPlugin21)).BeginInit();
this.SuspendLayout();
//
// axVLCPlugin21
//
this.axVLCPlugin21.AccessibleRole = System.Windows.Forms.AccessibleRole.Document;
this.axVLCPlugin21.Dock = System.Windows.Forms.DockStyle.Fill;
this.axVLCPlugin21.Enabled = true;
this.axVLCPlugin21.Location = new System.Drawing.Point(0, 0);
this.axVLCPlugin21.Name = "axVLCPlugin21";
this.axVLCPlugin21.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("axVLCPlugin21.OcxState")));
this.axVLCPlugin21.Size = new System.Drawing.Size(473, 315);
this.axVLCPlugin21.TabIndex = 0;
//
// VlcControl
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.axVLCPlugin21);
this.Name = "VlcControl";
this.Size = new System.Drawing.Size(473, 315);
((System.ComponentModel.ISupportInitialize)(this.axVLCPlugin21)).EndInit();
this.ResumeLayout(false);
}
#endregion
public AxAXVLC.AxVLCPlugin2 axVLCPlugin21;
}
}

20
VlcPlayer/VlcControl.cs Normal file
View File

@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace VlcPlayer
{
public partial class VlcControl : UserControl
{
public VlcControl()
{
InitializeComponent();
}
}
}

134
VlcPlayer/VlcControl.resx Normal file
View File

@ -0,0 +1,134 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="axVLCPlugin21.OcxState" mimetype="application/x-microsoft.net.object.binary.base64">
<value>
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACFTeXN0
ZW0uV2luZG93cy5Gb3Jtcy5BeEhvc3QrU3RhdGUBAAAABERhdGEHAgIAAAAJAwAAAA8DAAAAgwEAAAIB
AAAAAQAAAAAAAAAAAAAAAG4BAAAHAAAAKABDAG8AdQBuAHQAKQADAA0AAAAIAAAAQQB1AHQAbwBMAG8A
bwBwAAsAAAAIAAAAQQB1AHQAbwBQAGwAYQB5AAsA//8JAAAAQgBhAGMAawBDAG8AbABvAHIAAwAAAAAA
BwAAAEIAYQBzAGUAVQBSAEwACAAAAAAACAAAAEIAcgBhAG4AZABpAG4AZwALAP//DAAAAEUAeAB0AGUA
bgB0AEgAZQBpAGcAaAB0AAMAjiAAAAsAAABFAHgAdABlAG4AdABXAGkAZAB0AGgAAwDjMAAAEQAAAEYA
dQBsAGwAcwBjAHIAZQBlAG4ARQBuAGEAYgBsAGUAZAALAP//AwAAAE0AUgBMAAgAAAAAAAkAAABTAHQA
YQByAHQAVABpAG0AZQADAAAAAAAHAAAAVABvAG8AbABiAGEAcgALAP//BwAAAFYAaQBzAGkAYgBsAGUA
CwD//wYAAABWAG8AbAB1AG0AZQADADIAAAAL
</value>
</data>
</root>

View File

@ -0,0 +1,86 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{4DAAF531-4269-4548-B4E3-516254615EC1}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>VlcPlayer</RootNamespace>
<AssemblyName>VlcPlayer</AssemblyName>
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
<Reference Include="WindowsFormsIntegration" />
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="VlcControl.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="VlcControl.Designer.cs">
<DependentUpon>VlcControl.cs</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="VlcControl.resx">
<DependentUpon>VlcControl.cs</DependentUpon>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<COMReference Include="AxAXVLC">
<Guid>{DF2BBE39-40A8-433B-A279-073F48DA94B6}</Guid>
<VersionMajor>1</VersionMajor>
<VersionMinor>0</VersionMinor>
<Lcid>0</Lcid>
<WrapperTool>aximp</WrapperTool>
<Isolated>False</Isolated>
</COMReference>
<COMReference Include="AXVLC">
<Guid>{DF2BBE39-40A8-433B-A279-073F48DA94B6}</Guid>
<VersionMajor>1</VersionMajor>
<VersionMinor>0</VersionMinor>
<Lcid>0</Lcid>
<WrapperTool>tlbimp</WrapperTool>
<Isolated>False</Isolated>
<EmbedInteropTypes>True</EmbedInteropTypes>
</COMReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6" />
</startup>
</configuration>

View File

@ -0,0 +1,9 @@
<Application x:Class="WpfKaraokePlayer.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:WpfKaraokePlayer"
StartupUri="MainWindow.xaml">
<Application.Resources>
</Application.Resources>
</Application>

View File

@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;
namespace WpfKaraokePlayer
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
}
}

View File

@ -0,0 +1,17 @@
<Window x:Class="WpfKaraokePlayer.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:WpfKaraokePlayer"
mc:Ignorable="d"
Title="MainWindow" Height="350" Width="525" Loaded="Window_Loaded">
<Grid>
<Canvas HorizontalAlignment="Left" Height="299" Margin="10,10,0,0" VerticalAlignment="Top" Width="497">
<WindowsFormsHost Name="vlcHost" Height="100" Canvas.Left="329" Canvas.Top="169" Width="100"/>
<Image x:Name="image" Height="279" Canvas.Left="10" Canvas.Top="10" Width="373"/>
</Canvas>
</Grid>
</Window>

View File

@ -0,0 +1,39 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Forms.Integration;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace WpfKaraokePlayer
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
private AxAXVLC.AxVLCPlugin2 _vlcPlayer;
public MainWindow()
{
InitializeComponent();
var _vlcPlayer = new VlcControl();
vlcHost.Child = _vlcPlayer;
}
private void Window_Loaded(object sender, RoutedEventArgs e)
{
image.Source = new BitmapImage(new Uri(@"C:\Users\l-bre\Desktop\ares2.png", UriKind.Absolute));
}
}
}

View File

@ -0,0 +1,55 @@
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Windows;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("WpfKaraokePlayer")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("WpfKaraokePlayer")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
//In order to begin building localizable applications, set
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
//inside a <PropertyGroup>. For example, if you are using US english
//in your source files, set the <UICulture> to en-US. Then uncomment
//the NeutralResourceLanguage attribute below. Update the "en-US" in
//the line below to match the UICulture setting in the project file.
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@ -0,0 +1,71 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace WpfKaraokePlayer.Properties
{
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources
{
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources()
{
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager
{
get
{
if ((resourceMan == null))
{
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("WpfKaraokePlayer.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture
{
get
{
return resourceCulture;
}
set
{
resourceCulture = value;
}
}
}
}

View File

@ -0,0 +1,117 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -0,0 +1,30 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace WpfKaraokePlayer.Properties
{
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
{
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default
{
get
{
return defaultInstance;
}
}
}
}

View File

@ -0,0 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="uri:settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>

61
WpfKaraokePlayer/VlcControl.Designer.cs generated Normal file
View File

@ -0,0 +1,61 @@
namespace WpfKaraokePlayer
{
partial class VlcControl
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(VlcControl));
this.vlcPlayer = new AxAXVLC.AxVLCPlugin2();
((System.ComponentModel.ISupportInitialize)(this.vlcPlayer)).BeginInit();
this.SuspendLayout();
//
// vlcPlayer
//
this.vlcPlayer.Dock = System.Windows.Forms.DockStyle.Fill;
this.vlcPlayer.Enabled = true;
this.vlcPlayer.Location = new System.Drawing.Point(0, 0);
this.vlcPlayer.Name = "vlcPlayer";
this.vlcPlayer.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("vlcPlayer.OcxState")));
this.vlcPlayer.Size = new System.Drawing.Size(150, 150);
this.vlcPlayer.TabIndex = 0;
//
// VlcControl
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.vlcPlayer);
this.Name = "VlcControl";
((System.ComponentModel.ISupportInitialize)(this.vlcPlayer)).EndInit();
this.ResumeLayout(false);
}
#endregion
private AxAXVLC.AxVLCPlugin2 vlcPlayer;
}
}

View File

@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace WpfKaraokePlayer
{
public partial class VlcControl : UserControl
{
public VlcControl()
{
InitializeComponent();
}
}
}

View File

@ -0,0 +1,134 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="vlcPlayer.OcxState" mimetype="application/x-microsoft.net.object.binary.base64">
<value>
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACFTeXN0
ZW0uV2luZG93cy5Gb3Jtcy5BeEhvc3QrU3RhdGUBAAAABERhdGEHAgIAAAAJAwAAAA8DAAAAgwEAAAIB
AAAAAQAAAAAAAAAAAAAAAG4BAAAHAAAAKABDAG8AdQBuAHQAKQADAA0AAAAIAAAAQQB1AHQAbwBMAG8A
bwBwAAsAAAAIAAAAQQB1AHQAbwBQAGwAYQB5AAsA//8JAAAAQgBhAGMAawBDAG8AbABvAHIAAwAAAAAA
BwAAAEIAYQBzAGUAVQBSAEwACAAAAAAACAAAAEIAcgBhAG4AZABpAG4AZwALAP//DAAAAEUAeAB0AGUA
bgB0AEgAZQBpAGcAaAB0AAMAgQ8AAAsAAABFAHgAdABlAG4AdABXAGkAZAB0AGgAAwCBDwAAEQAAAEYA
dQBsAGwAcwBjAHIAZQBlAG4ARQBuAGEAYgBsAGUAZAALAP//AwAAAE0AUgBMAAgAAAAAAAkAAABTAHQA
YQByAHQAVABpAG0AZQADAAAAAAAHAAAAVABvAG8AbABiAGEAcgALAP//BwAAAFYAaQBzAGkAYgBsAGUA
CwD//wYAAABWAG8AbAB1AG0AZQADADIAAAAL
</value>
</data>
</root>

View File

@ -0,0 +1,138 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{2B5657F5-A063-4E44-A953-E7C84D93C317}</ProjectGuid>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>WpfKaraokePlayer</RootNamespace>
<AssemblyName>WpfKaraokePlayer</AssemblyName>
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xaml">
<RequiredTargetFramework>4.0</RequiredTargetFramework>
</Reference>
<Reference Include="UIAutomationProvider" />
<Reference Include="WindowsBase" />
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
<Reference Include="WindowsFormsIntegration" />
</ItemGroup>
<ItemGroup>
<ApplicationDefinition Include="App.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</ApplicationDefinition>
<Compile Include="VlcControl.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="VlcControl.Designer.cs">
<DependentUpon>VlcControl.cs</DependentUpon>
</Compile>
<Page Include="MainWindow.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Compile Include="App.xaml.cs">
<DependentUpon>App.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="MainWindow.xaml.cs">
<DependentUpon>MainWindow.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
<EmbeddedResource Include="VlcControl.resx">
<DependentUpon>VlcControl.cs</DependentUpon>
</EmbeddedResource>
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<AppDesigner Include="Properties\" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<COMReference Include="AxAXVLC">
<Guid>{DF2BBE39-40A8-433B-A279-073F48DA94B6}</Guid>
<VersionMajor>1</VersionMajor>
<VersionMinor>0</VersionMinor>
<Lcid>0</Lcid>
<WrapperTool>aximp</WrapperTool>
<Isolated>False</Isolated>
</COMReference>
<COMReference Include="AXVLC">
<Guid>{DF2BBE39-40A8-433B-A279-073F48DA94B6}</Guid>
<VersionMajor>1</VersionMajor>
<VersionMinor>0</VersionMinor>
<Lcid>0</Lcid>
<WrapperTool>tlbimp</WrapperTool>
<Isolated>False</Isolated>
<EmbedInteropTypes>True</EmbedInteropTypes>
</COMReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

BIN
msvcr90.dll Normal file

Binary file not shown.