git-svn-id: http://svn.sourceforge.jp/svnroot/lipsync@4 b1f601f4-4f45-0410-8980-aecacb008692

This commit is contained in:
kbinani
2009-06-25 14:06:02 +00:00
parent c71eedcc2f
commit 09b7366d95
597 changed files with 64861 additions and 0 deletions

483
trunk/IPlugin/AviReader.cs Normal file
View File

@@ -0,0 +1,483 @@
using System;
using System.Drawing;
using System.Drawing.Imaging;
using System.Runtime.InteropServices;
using System.IO;
namespace Plugin {
public class Avi {
public const int StreamtypeVIDEO = 1935960438; //mmioStringToFOURCC("vids", 0)
public const int OF_SHARE_DENY_WRITE = 32;
public const int BMP_MAGIC_COOKIE = 19778; //ascii string "BM"
#region structure declarations
[StructLayout( LayoutKind.Sequential, Pack = 1 )]
public struct RECT {
public UInt32 left;
public UInt32 top;
public UInt32 right;
public UInt32 bottom;
}
[StructLayout( LayoutKind.Sequential, Pack = 1 )]
public struct BITMAPINFOHEADER {
public UInt32 biSize;
public Int32 biWidth;
public Int32 biHeight;
public Int16 biPlanes;
public Int16 biBitCount;
public UInt32 biCompression;
public UInt32 biSizeImage;
public Int32 biXPelsPerMeter;
public Int32 biYPelsPerMeter;
public UInt32 biClrUsed;
public UInt32 biClrImportant;
}
[StructLayout( LayoutKind.Sequential, Pack = 1 )]
public struct AVISTREAMINFO {
public UInt32 fccType;
public UInt32 fccHandler;
public UInt32 dwFlags;
public UInt32 dwCaps;
public UInt16 wPriority;
public UInt16 wLanguage;
public UInt32 dwScale;
public UInt32 dwRate;
public UInt32 dwStart;
public UInt32 dwLength;
public UInt32 dwInitialFrames;
public UInt32 dwSuggestedBufferSize;
public UInt32 dwQuality;
public UInt32 dwSampleSize;
public RECT rcFrame;
public UInt32 dwEditCount;
public UInt32 dwFormatChangeCount;
[MarshalAs( UnmanagedType.ByValArray, SizeConst = 64 )]
public UInt16[] szName;
}
[StructLayout( LayoutKind.Sequential, Pack = 1 )]
public struct BITMAPFILEHEADER {
public Int16 bfType; //"magic cookie" - must be "BM"
public Int32 bfSize;
public Int16 bfReserved1;
public Int16 bfReserved2;
public Int32 bfOffBits;
}
#endregion structure declarations
#region method declarations
//Initialize the AVI library
[DllImport( "avifil32.dll" )]
public static extern void AVIFileInit();
//Open an AVI file
[DllImport( "avifil32.dll", PreserveSig = true )]
public static extern int AVIFileOpen(
ref int ppfile,
String szFile,
int uMode,
int pclsidHandler );
//Get a stream from an open AVI file
[DllImport( "avifil32.dll" )]
public static extern int AVIFileGetStream(
int pfile,
out IntPtr ppavi,
int fccType,
int lParam );
//Get the start position of a stream
[DllImport( "avifil32.dll", PreserveSig = true )]
public static extern int AVIStreamStart( int pavi );
//Get the length of a stream in frames
[DllImport( "avifil32.dll", PreserveSig = true )]
public static extern int AVIStreamLength( int pavi );
//Get information about an open stream
[DllImport( "avifil32.dll" )]
public static extern int AVIStreamInfo(
int pAVIStream,
ref AVISTREAMINFO psi,
int lSize );
//Get a pointer to a GETFRAME object (returns 0 on error)
[DllImport( "avifil32.dll" )]
public static extern int AVIStreamGetFrameOpen(
IntPtr pAVIStream,
ref BITMAPINFOHEADER bih );
/*[DllImport("avifil32.dll")]
public static extern int AVIStreamGetFrameOpen(
IntPtr pAVIStream,
int dummy);*/
//Get a pointer to a packed DIB (returns 0 on error)
[DllImport( "avifil32.dll" )]
public static extern int AVIStreamGetFrame(
int pGetFrameObj,
int lPos );
//Create a new stream in an open AVI file
[DllImport( "avifil32.dll" )]
public static extern int AVIFileCreateStream(
int pfile,
out IntPtr ppavi,
ref AVISTREAMINFO ptr_streaminfo );
//Set the format for a new stream
[DllImport( "avifil32.dll" )]
public static extern int AVIStreamSetFormat(
IntPtr aviStream, Int32 lPos,
ref BITMAPINFOHEADER lpFormat, Int32 cbFormat );
//Write a sample to a stream
[DllImport( "avifil32.dll" )]
public static extern int AVIStreamWrite(
IntPtr aviStream, Int32 lStart, Int32 lSamples,
IntPtr lpBuffer, Int32 cbBuffer, Int32 dwFlags,
Int32 dummy1, Int32 dummy2 );
//Release the GETFRAME object
[DllImport( "avifil32.dll" )]
public static extern int AVIStreamGetFrameClose(
int pGetFrameObj );
//Release an open AVI stream
[DllImport( "avifil32.dll" )]
public static extern int AVIStreamRelease( IntPtr aviStream );
//Release an open AVI file
[DllImport( "avifil32.dll" )]
public static extern int AVIFileRelease( int pfile );
//Close the AVI library
[DllImport( "avifil32.dll" )]
public static extern void AVIFileExit();
#endregion methos declarations
#region other useful avi functions
//public const int StreamtypeAUDIO = 1935963489; //mmioStringToFOURCC("auds", 0)
//public const int StreamtypeMIDI = 1935960429; //mmioStringToFOURCC("mids", 0)
//public const int StreamtypeTEXT = 1937012852; //mmioStringToFOURCC("txts", 0)
/*[StructLayout(LayoutKind.Sequential, Pack=1)]
public struct AVIFILEINFO{
public Int32 dwMaxBytesPerSecond;
public Int32 dwFlags;
public Int32 dwCaps;
public Int32 dwStreams;
public Int32 dwSuggestedBufferSize;
public Int32 dwWidth;
public Int32 dwHeight;
public Int32 dwScale;
public Int32 dwRate;
public Int32 dwLength;
public Int32 dwEditCount;
[MarshalAs(UnmanagedType.ByValArray, SizeConst=64)]
public char[] szFileType;
}*/
/*[StructLayout(LayoutKind.Sequential, Pack=1)]
public struct AVICOMPRESSOPTIONS {
public UInt32 fccType;
public UInt32 fccHandler;
public UInt32 dwKeyFrameEvery; // only used with AVICOMRPESSF_KEYFRAMES
public UInt32 dwQuality;
public UInt32 dwBytesPerSecond; // only used with AVICOMPRESSF_DATARATE
public UInt32 dwFlags;
public IntPtr lpFormat;
public UInt32 cbFormat;
public IntPtr lpParms;
public UInt32 cbParms;
public UInt32 dwInterleaveEvery;
}*/
/*[DllImport("avifil32.dll")]
public static extern int AVIMakeCompressedStream(
out IntPtr ppsCompressed, IntPtr aviStream,
ref AVICOMPRESSOPTIONS ao, int dummy);*/
/*[DllImport("avifil32.dll")]
public static extern int AVISaveOptions(
IntPtr hWnd,
int uiFlags,
int nStreams,
ref IntPtr ppavi,
ref IntPtr ppOptions);*/
/*[DllImport("avifil32.dll")]
public static extern int AVIFileInfo(
int pfile,
ref AVIFILEINFO pfi,
int lSize);*/
/*[DllImport("winmm.dll", EntryPoint="mmioStringToFOURCCA")]
public static extern int mmioStringToFOURCC(String sz, int uFlags);*/
/*[DllImport("avifil32.dll")]
public static extern int AVIStreamRead(
IntPtr pavi,
Int32 lStart,
Int32 lSamples,
IntPtr lpBuffer,
Int32 cbBuffer,
Int32 plBytes,
Int32 plSamples
);*/
#endregion other useful avi functions
}
/// <summary>Extract bitmaps from AVI files</summary>
public class AviReader {
//position of the first frame, count of frames in the stream
private int firstFrame = 0, countFrames = 0;
//pointers
private int aviFile = 0;
private int getFrameObject;
private IntPtr aviStream;
//stream and header info
private Avi.AVISTREAMINFO streamInfo;
public int CountFrames {
get {
return countFrames;
}
}
public UInt32 FrameRate {
get {
return streamInfo.dwRate / streamInfo.dwScale;
}
}
public Size BitmapSize {
get {
return new Size( (int)streamInfo.rcFrame.right, (int)streamInfo.rcFrame.bottom );
}
}
/// <summary>Opens an AVI file and creates a GetFrame object</summary>
/// <param name="fileName">Name of the AVI file</param>
public void Open( string fileName ) {
//Intitialize AVI library
Avi.AVIFileInit();
//Open the file
int result = Avi.AVIFileOpen(
ref aviFile, fileName,
Avi.OF_SHARE_DENY_WRITE, 0 );
if ( result != 0 ) {
throw new Exception( "Exception in AVIFileOpen: " + result.ToString() );
}
//Get the video stream
result = Avi.AVIFileGetStream(
aviFile,
out aviStream,
Avi.StreamtypeVIDEO, 0 );
if ( result != 0 ) {
throw new Exception( "Exception in AVIFileGetStream: " + result.ToString() );
}
firstFrame = Avi.AVIStreamStart( aviStream.ToInt32() );
countFrames = Avi.AVIStreamLength( aviStream.ToInt32() );
streamInfo = new Avi.AVISTREAMINFO();
result = Avi.AVIStreamInfo( aviStream.ToInt32(), ref streamInfo, Marshal.SizeOf( streamInfo ) );
if ( result != 0 ) {
throw new Exception( "Exception in AVIStreamInfo: " + result.ToString() );
}
//Open frames
Avi.BITMAPINFOHEADER bih = new Avi.BITMAPINFOHEADER();
bih.biBitCount = 24;
bih.biClrImportant = 0;
bih.biClrUsed = 0;
bih.biCompression = 0; //BI_RGB;
bih.biHeight = (Int32)streamInfo.rcFrame.bottom;
bih.biWidth = (Int32)streamInfo.rcFrame.right;
bih.biPlanes = 1;
bih.biSize = (UInt32)Marshal.SizeOf( bih );
bih.biXPelsPerMeter = 0;
bih.biYPelsPerMeter = 0;
getFrameObject = Avi.AVIStreamGetFrameOpen( aviStream, ref bih ); //force function to return 24bit DIBS
//getFrameObject = Avi.AVIStreamGetFrameOpen(aviStream, 0); //return any bitmaps
if ( getFrameObject == 0 ) {
throw new Exception( "Exception in AVIStreamGetFrameOpen!" );
}
}
/// <summary>Closes all streams, files and libraries</summary>
public void Close() {
if ( getFrameObject != 0 ) {
Avi.AVIStreamGetFrameClose( getFrameObject );
getFrameObject = 0;
}
if ( aviStream != IntPtr.Zero ) {
Avi.AVIStreamRelease( aviStream );
aviStream = IntPtr.Zero;
}
if ( aviFile != 0 ) {
Avi.AVIFileRelease( aviFile );
aviFile = 0;
}
Avi.AVIFileExit();
}
public Bitmap Export( int position ) {
if ( position > countFrames ) {
throw new Exception( "Invalid frame position" );
}
//Decompress the frame and return a pointer to the DIB
int pDib = Avi.AVIStreamGetFrame( getFrameObject, firstFrame + position );
//Copy the bitmap header into a managed struct
Avi.BITMAPINFOHEADER bih = new Avi.BITMAPINFOHEADER();
bih = (Avi.BITMAPINFOHEADER)Marshal.PtrToStructure( new IntPtr( pDib ), bih.GetType() );
/*if(bih.biBitCount < 24){
throw new Exception("Not enough colors! DIB color depth is less than 24 bit.");
}else */
if ( bih.biSizeImage < 1 ) {
throw new Exception( "Exception in AVIStreamGetFrame: Not bitmap decompressed." );
}
//Copy the image
byte[] bitmapData = new byte[bih.biSizeImage];
int address = pDib + Marshal.SizeOf( bih );
for ( int offset = 0; offset < bitmapData.Length; offset++ ) {
bitmapData[offset] = Marshal.ReadByte( new IntPtr( address ) );
address++;
}
//Copy bitmap info
byte[] bitmapInfo = new byte[Marshal.SizeOf( bih )];
IntPtr ptr;
ptr = Marshal.AllocHGlobal( bitmapInfo.Length );
Marshal.StructureToPtr( bih, ptr, false );
address = ptr.ToInt32();
for ( int offset = 0; offset < bitmapInfo.Length; offset++ ) {
bitmapInfo[offset] = Marshal.ReadByte( new IntPtr( address ) );
address++;
}
//Create file header
Avi.BITMAPFILEHEADER bfh = new Avi.BITMAPFILEHEADER();
bfh.bfType = Avi.BMP_MAGIC_COOKIE;
bfh.bfSize = (Int32)(55 + bih.biSizeImage); //size of file as written to disk
bfh.bfReserved1 = 0;
bfh.bfReserved2 = 0;
bfh.bfOffBits = Marshal.SizeOf( bih ) + Marshal.SizeOf( bfh );
//Create or overwrite the destination file
MemoryStream fs = new MemoryStream();
//FileStream fs = new FileStream( dstFileName, System.IO.FileMode.Create );
BinaryWriter bw = new BinaryWriter( fs );
//Write header
bw.Write( bfh.bfType );
bw.Write( bfh.bfSize );
bw.Write( bfh.bfReserved1 );
bw.Write( bfh.bfReserved2 );
bw.Write( bfh.bfOffBits );
//Write bitmap info
bw.Write( bitmapInfo );
//Write bitmap data
bw.Write( bitmapData );
bw.Close();
// fs.Close();
fs.Flush();
fs.Seek( 0, SeekOrigin.Begin );
Bitmap bmp = new Bitmap( fs );
fs.Close();
return bmp;
}
/// <summary>Exports a frame into a bitmap file</summary>
/// <param name="position">Position of the frame</param>
/// <param name="dstFileName">Name ofthe file to store the bitmap</param>
public void ExportBitmap( int position, String dstFileName ) {
if ( position > countFrames ) {
throw new Exception( "Invalid frame position" );
}
//Decompress the frame and return a pointer to the DIB
int pDib = Avi.AVIStreamGetFrame( getFrameObject, firstFrame + position );
//Copy the bitmap header into a managed struct
Avi.BITMAPINFOHEADER bih = new Avi.BITMAPINFOHEADER();
bih = (Avi.BITMAPINFOHEADER)Marshal.PtrToStructure( new IntPtr( pDib ), bih.GetType() );
/*if(bih.biBitCount < 24){
throw new Exception("Not enough colors! DIB color depth is less than 24 bit.");
}else */
if ( bih.biSizeImage < 1 ) {
throw new Exception( "Exception in AVIStreamGetFrame: Not bitmap decompressed." );
}
//Copy the image
byte[] bitmapData = new byte[bih.biSizeImage];
int address = pDib + Marshal.SizeOf( bih );
for ( int offset = 0; offset < bitmapData.Length; offset++ ) {
bitmapData[offset] = Marshal.ReadByte( new IntPtr( address ) );
address++;
}
//Copy bitmap info
byte[] bitmapInfo = new byte[Marshal.SizeOf( bih )];
IntPtr ptr;
ptr = Marshal.AllocHGlobal( bitmapInfo.Length );
Marshal.StructureToPtr( bih, ptr, false );
address = ptr.ToInt32();
for ( int offset = 0; offset < bitmapInfo.Length; offset++ ) {
bitmapInfo[offset] = Marshal.ReadByte( new IntPtr( address ) );
address++;
}
//Create file header
Avi.BITMAPFILEHEADER bfh = new Avi.BITMAPFILEHEADER();
bfh.bfType = Avi.BMP_MAGIC_COOKIE;
bfh.bfSize = (Int32)(55 + bih.biSizeImage); //size of file as written to disk
bfh.bfReserved1 = 0;
bfh.bfReserved2 = 0;
bfh.bfOffBits = Marshal.SizeOf( bih ) + Marshal.SizeOf( bfh );
//Create or overwrite the destination file
FileStream fs = new FileStream( dstFileName, System.IO.FileMode.Create );
BinaryWriter bw = new BinaryWriter( fs );
//Write header
bw.Write( bfh.bfType );
bw.Write( bfh.bfSize );
bw.Write( bfh.bfReserved1 );
bw.Write( bfh.bfReserved2 );
bw.Write( bfh.bfOffBits );
//Write bitmap info
bw.Write( bitmapInfo );
//Write bitmap data
bw.Write( bitmapData );
bw.Close();
fs.Close();
}
}
}

129
trunk/IPlugin/IPlugin.cs Normal file
View File

@@ -0,0 +1,129 @@
/*
* IPlugin.cs
* Copyright (c) 2007, 2008 kbinani
*
* This file is part of LipSync.
*
* LipSync is free software; you can redistribute it and/or
* modify it under the terms of the BSD License.
*
* LipSync is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/
using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using System.Windows.Forms;
namespace Plugin {
public class Constants {
/// <summary>
/// エントリーごとの設定が可能なプラグインであることを表します。
/// </summary>
public const ulong LS_ENABLES_ENTRY_SETTING = 1;
/// <summary>
/// このプラグインが、設定用ウィンドウを持たないことを表します。
/// </summary>
public const ulong LS_NO_EVENT_HANDLER = 2;
/// <summary>
/// このプラグインが、キャラクタ描画用のプラグインであることを表します。
/// </summary>
public const ulong LS_TYPE_CHARACTER = 4;
}
/// <summary>
/// メイン画面で使用されている変数へのプロキシを提供
/// </summary>
public class Proxy {
}
/// <summary>
/// プラグイン用のインターフェースを定義します
/// </summary>
public interface IPlugin {
/// <summary>
/// プラグインの名称
/// </summary>
string Name {
get;
}
/// <summary>
/// プラグインの簡潔な説明文。
/// </summary>
string Abstract {
get;
}
/// <summary>
/// フレームに加工を施す関数
/// </summary>
/// <param name="frame">加工の対象</param>
/// <param name="time">ビデオの先頭からの時刻(秒)</param>
/// <param name="e_begin">エントリの開始時刻</param>
/// <param name="e_body">エントリの終了時刻</param>
/// <param name="e_end">エントリの設定値</param>
void Apply( ref Bitmap frame, float time, float e_begin, float e_end, ref string e_body );
/// <summary>
/// プラグイン用の設定値を格納した文字列を指定します。
/// </summary>
/// <returns></returns>
string Config {
get;
set;
}
/// <summary>
/// メイン画面の言語設定が変更されたとき呼び出されます。
/// </summary>
/// <param name="language_code"></param>
void ApplyLanguage( string language_code );
/// <summary>
/// このプラグインの設定メニューが押された時呼び出されます。
/// </summary>
DialogResult BaseSetting();
/// <summary>
/// エントリーごとの設定メニューが押された時呼び出されます。
/// エントリーごとの設定は、ぷらぐいん側で任意に設定できます。
/// </summary>
/// <param name="entry_config">編集するエントリの設定</param>
DialogResult EntrySetting( ref string entry_config );
/// <summary>
/// このプラグインのタイプを指定します。
/// </summary>
ulong Type {
get;
}
/// <summary>
/// キャラクタ描画関数。
/// </summary>
/// <param name="g">キャラクタの描画先</param>
/// <param name="size">gのサイズ</param>
/// <param name="time">ビデオの先頭からの時刻</param>
/// <param name="mouth">時刻timeにおける口の形がコンマ区切りで列挙されている</param>
/// <param name="Reserved">(予約)</param>
void Render( Graphics g, Size size, float time, string mouth, string Reserved );
}
}

View File

@@ -0,0 +1,74 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>9.0.21022</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{FB0C1FBD-3CB7-46BF-8E39-57BE2C8D1F00}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>IPlugin</RootNamespace>
<AssemblyName>IPlugin</AssemblyName>
<FileUpgradeFlags>
</FileUpgradeFlags>
<OldToolsVersion>2.0</OldToolsVersion>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<UpgradeBackupLocation>
</UpgradeBackupLocation>
</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>
<DocumentationFile>bin\Debug\IPlugin.XML</DocumentationFile>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<DocumentationFile>bin\Release\IPlugin.XML</DocumentationFile>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="InputBox.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="InputBox.designer.cs">
<DependentUpon>InputBox.cs</DependentUpon>
</Compile>
<Compile Include="IPlugin.cs" />
<Compile Include="ISO639.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="InputBox.resx">
<DependentUpon>InputBox.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\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>
-->
<PropertyGroup>
<PostBuildEvent>
</PostBuildEvent>
</PropertyGroup>
</Project>

29
trunk/IPlugin/ISO639.cs Normal file
View File

@@ -0,0 +1,29 @@
/*
* ISO639.cs
* Copyright (c) 2007, 2008 kbinani
*
* This file is part of LipSync.
*
* LipSync is free software; you can redistribute it and/or
* modify it under the terms of the BSD License.
*
* LipSync is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/
using System.Globalization;
namespace Plugin {
public class ISO639 {
public static bool CheckValidity( string code_string ) {
try {
CultureInfo c = CultureInfo.CreateSpecificCulture( code_string );
} catch {
return false;
}
return true;
}
}
}

44
trunk/IPlugin/InputBox.cs Normal file
View File

@@ -0,0 +1,44 @@
/*
* InputBox.cs
* Copyright (c) 2007, 2008 kbinani
*
* This file is part of LipSync.
*
* LipSync is free software; you can redistribute it and/or
* modify it under the terms of the BSD License.
*
* LipSync is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace Plugin {
public partial class InputBox : Form {
public string rText{
get{
return input.Text;
}
set {
input.Text = value;
}
}
public InputBox( string title, string message ) {
InitializeComponent();
this.message.Text = message;
this.Text = title;
}
private void btnOK_Click( object sender, EventArgs e ) {
this.DialogResult = DialogResult.OK;
this.Close();
}
}
}

111
trunk/IPlugin/InputBox.designer.cs generated Normal file
View File

@@ -0,0 +1,111 @@
/*
* InputBox.designer.cs
* Copyright (c) 2007, 2008 kbinani
*
* This file is part of LipSync.
*
* LipSync is free software; you can redistribute it and/or
* modify it under the terms of the BSD License.
*
* LipSync is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/
namespace Plugin {
partial class InputBox {
/// <summary>
/// 必要なデザイナ変数です。
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 使用中のリソースをすべてクリーンアップします。
/// </summary>
/// <param name="disposing">マネージ リソースが破棄される場合 true、破棄されない場合は false です。</param>
protected override void Dispose( bool disposing ) {
if ( disposing && (components != null) ) {
components.Dispose();
}
base.Dispose( disposing );
}
#region Windows
/// <summary>
/// デザイナ サポートに必要なメソッドです。このメソッドの内容を
/// コード エディタで変更しないでください。
/// </summary>
private void InitializeComponent() {
this.btnOK = new System.Windows.Forms.Button();
this.btnCancel = new System.Windows.Forms.Button();
this.message = new System.Windows.Forms.Label();
this.input = new System.Windows.Forms.TextBox();
this.SuspendLayout();
//
// btnOK
//
this.btnOK.Location = new System.Drawing.Point( 114, 73 );
this.btnOK.Name = "btnOK";
this.btnOK.Size = new System.Drawing.Size( 75, 23 );
this.btnOK.TabIndex = 1;
this.btnOK.Text = "OK";
this.btnOK.UseVisualStyleBackColor = true;
this.btnOK.Click += new System.EventHandler( this.btnOK_Click );
//
// btnCancel
//
this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.btnCancel.Location = new System.Drawing.Point( 208, 73 );
this.btnCancel.Name = "btnCancel";
this.btnCancel.Size = new System.Drawing.Size( 75, 23 );
this.btnCancel.TabIndex = 2;
this.btnCancel.Text = "Cancel";
this.btnCancel.UseVisualStyleBackColor = true;
//
// message
//
this.message.AutoEllipsis = true;
this.message.AutoSize = true;
this.message.Location = new System.Drawing.Point( 12, 9 );
this.message.Name = "message";
this.message.Size = new System.Drawing.Size( 50, 12 );
this.message.TabIndex = 2;
this.message.Text = "message";
//
// input
//
this.input.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.input.Location = new System.Drawing.Point( 29, 35 );
this.input.Name = "input";
this.input.Size = new System.Drawing.Size( 254, 19 );
this.input.TabIndex = 0;
//
// InputBox
//
this.AcceptButton = this.btnOK;
this.AutoScaleDimensions = new System.Drawing.SizeF( 6F, 12F );
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.btnCancel;
this.ClientSize = new System.Drawing.Size( 298, 113 );
this.Controls.Add( this.input );
this.Controls.Add( this.message );
this.Controls.Add( this.btnCancel );
this.Controls.Add( this.btnOK );
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "InputBox";
this.Text = "InputBox";
this.ResumeLayout( false );
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Button btnOK;
private System.Windows.Forms.Button btnCancel;
private System.Windows.Forms.Label message;
private System.Windows.Forms.TextBox input;
}
}

120
trunk/IPlugin/InputBox.resx Normal file
View File

@@ -0,0 +1,120 @@
<?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=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,35 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// アセンブリに関する一般情報は以下の属性セットをとおして制御されます。
// アセンブリに関連付けられている情報を変更するには、
// これらの属性値を変更してください。
[assembly: AssemblyTitle( "IPlugin" )]
[assembly: AssemblyDescription( "" )]
[assembly: AssemblyConfiguration( "" )]
[assembly: AssemblyCompany( "Boare" )]
[assembly: AssemblyProduct( "IPlugin" )]
[assembly: AssemblyCopyright( "Copyright (C) 2007" )]
[assembly: AssemblyTrademark( "" )]
[assembly: AssemblyCulture( "" )]
// ComVisible を false に設定すると、このアセンブリ内の型は COM コンポーネントには
// 参照不可能になります。COM からこのアセンブリ内の型にアクセスする場合は、
// その型の ComVisible 属性を true に設定してください。
[assembly: ComVisible( false )]
// 次の GUID は、このプロジェクトが COM に公開される場合の、typelib の ID です
[assembly: Guid( "eb60d449-2a04-4bc0-b45c-d4ebf429cf13" )]
// アセンブリのバージョン情報は、以下の 4 つの値で構成されています:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// すべての値を指定するか、下のように '*' を使ってリビジョンおよびビルド番号を
// 既定値にすることができます:
[assembly: AssemblyVersion( "1.0.0.0" )]
[assembly: AssemblyFileVersion( "1.0.0.0" )]

10
trunk/IPlugin/makefile Normal file
View File

@@ -0,0 +1,10 @@
CP=cp
RM=rm
OPT=-r:System,System.Drawing,System.Windows.Forms
IPLUGIN_SRC=IPlugin.cs ISO639.cs InputBox.cs InputBox.designer.cs
IPlugin.dll: $(IPLUGIN_SRC)
gmcs -target:library -out:IPlugin.dll $(IPLUGIN_SRC) $(OPT)
clean:
$(RM) IPlugin.dll