From 9de5d2e51e57c47c5c1764870141d92dd95699e6 Mon Sep 17 00:00:00 2001 From: kbinani Date: Wed, 17 Mar 2010 03:14:08 +0000 Subject: [PATCH] [trunk] (ry git-svn-id: http://svn.sourceforge.jp/svnroot/lipsync@18 b1f601f4-4f45-0410-8980-aecacb008692 --- trunk/Boare.Lib.AppUtil/AuthorListEntry.cs | 43 +- .../Boare.Lib.AppUtil/BHScrollBar.Designer.cs | 6 +- trunk/Boare.Lib.AppUtil/BHScrollBar.cs | 8 +- trunk/Boare.Lib.AppUtil/BSplitContainer.cs | 28 +- trunk/Boare.Lib.AppUtil/BSplitterPanel.cs | 4 +- trunk/Boare.Lib.AppUtil/BTrackBar.cs | 4 +- .../Boare.Lib.AppUtil/BVScrollBar.Designer.cs | 2 +- trunk/Boare.Lib.AppUtil/BVScrollBar.cs | 8 +- trunk/Boare.Lib.AppUtil/BitmapEx.cs | 6 +- .../Boare.Lib.AppUtil.csproj | 37 +- trunk/Boare.Lib.AppUtil/ColorBar.cs | 8 +- trunk/Boare.Lib.AppUtil/CubicSpline.cs | 4 +- trunk/Boare.Lib.AppUtil/CursorUtil.cs | 4 +- trunk/Boare.Lib.AppUtil/DockPanelContainer.cs | 4 +- trunk/Boare.Lib.AppUtil/ISO639.cs | 4 +- trunk/Boare.Lib.AppUtil/InputBox.Designer.cs | 1 + trunk/Boare.Lib.AppUtil/InputBox.cs | 274 +- trunk/Boare.Lib.AppUtil/MessageBody.cs | 267 +- trunk/Boare.Lib.AppUtil/MessageBodyEntry.cs | 22 +- trunk/Boare.Lib.AppUtil/Messaging.cs | 118 +- trunk/Boare.Lib.AppUtil/Misc.cs | 2 +- .../Boare.Lib.AppUtil/VersionInfo.Designer.cs | 8 +- trunk/Boare.Lib.AppUtil/VersionInfo.cs | 187 +- trunk/Boare.Lib.Media/AviReader.cs | 2 +- trunk/Boare.Lib.Media/BSoundPlayer.cs | 131 + trunk/Boare.Lib.Media/Boare.Lib.Media.csproj | 5 +- trunk/Boare.Lib.Media/MediaPlayer.cs | 2 +- trunk/Boare.Lib.Media/MidiInDevice.cs | 43 +- trunk/Boare.Lib.Media/MidiOutDevice.cs | 16 +- trunk/Boare.Lib.Media/Wave.cs | 1031 +- trunk/Boare.Lib.Media/WavePlay.cs | 62 +- trunk/Boare.Lib.Media/WaveReader.cs | 395 +- trunk/Boare.Lib.Media/WaveWriter.cs | 412 +- trunk/Boare.Lib.Vsq/AttackConfig.cs | 57 +- trunk/Boare.Lib.Vsq/BPPair.cs | 12 +- trunk/Boare.Lib.Vsq/Boare.Lib.Vsq.csproj | 35 +- trunk/Boare.Lib.Vsq/ExpressionConfigSys.cs | 740 +- trunk/Boare.Lib.Vsq/ITextWriter.cs | 38 + trunk/Boare.Lib.Vsq/IconHandle.cs | 94 + .../Boare.Lib.Vsq/{VsqMetaText => }/Lyric.cs | 108 +- trunk/Boare.Lib.Vsq/LyricHandle.cs | 99 + trunk/Boare.Lib.Vsq/MidiEvent.cs | 282 + trunk/Boare.Lib.Vsq/MidiFile.cs | 203 + trunk/Boare.Lib.Vsq/NRPN.cs | 425 +- trunk/Boare.Lib.Vsq/NoteHeadHandle.cs | 94 + trunk/Boare.Lib.Vsq/NrpnData.cs | 10 +- trunk/Boare.Lib.Vsq/NrpnIterator.cs | 83 + trunk/Boare.Lib.Vsq/SMF/MidiFile.cs | 444 - trunk/Boare.Lib.Vsq/SingerConfig.cs | 85 +- trunk/Boare.Lib.Vsq/SingerConfigSys.cs | 76 +- trunk/Boare.Lib.Vsq/SymbolTable.cs | 227 +- trunk/Boare.Lib.Vsq/SynthesizerType.cs | 27 + trunk/Boare.Lib.Vsq/TempoTableEntry.cs | 159 +- trunk/Boare.Lib.Vsq/TextMemoryStream.cs | 68 +- trunk/Boare.Lib.Vsq/TimeSigTableEntry.cs | 31 +- trunk/Boare.Lib.Vsq/Timesig.cs | 27 + trunk/Boare.Lib.Vsq/TransCodeUtil.cs | 29 +- trunk/Boare.Lib.Vsq/UstEnvelope.cs | 62 +- trunk/Boare.Lib.Vsq/UstEvent.cs | 118 +- trunk/Boare.Lib.Vsq/UstFile.cs | 310 +- trunk/Boare.Lib.Vsq/UstPortamento.cs | 130 +- trunk/Boare.Lib.Vsq/UstPortamentoPoint.cs | 28 + trunk/Boare.Lib.Vsq/UstPortamentoType.cs | 41 + trunk/Boare.Lib.Vsq/UstTrack.cs | 42 +- trunk/Boare.Lib.Vsq/UstVibrato.cs | 60 +- trunk/Boare.Lib.Vsq/VibratoBPList.cs | 84 +- trunk/Boare.Lib.Vsq/VibratoBPPair.cs | 20 +- trunk/Boare.Lib.Vsq/VibratoConfig.cs | 89 +- trunk/Boare.Lib.Vsq/VibratoHandle.cs | 104 + trunk/Boare.Lib.Vsq/VocaloSysUtil.cs | 947 +- trunk/Boare.Lib.Vsq/VsqBPList.cs | 484 +- trunk/Boare.Lib.Vsq/VsqBPPair.cs | 18 + trunk/Boare.Lib.Vsq/VsqBPPairSearchContext.cs | 21 +- trunk/Boare.Lib.Vsq/VsqBarLineType.cs | 9 +- trunk/Boare.Lib.Vsq/VsqCommand.cs | 285 +- trunk/Boare.Lib.Vsq/VsqCommandType.cs | 8 + trunk/Boare.Lib.Vsq/VsqCommon.cs | 194 + trunk/Boare.Lib.Vsq/VsqEvent.cs | 109 +- trunk/Boare.Lib.Vsq/VsqEventList.cs | 46 +- trunk/Boare.Lib.Vsq/VsqFile.cs | 1488 ++- trunk/Boare.Lib.Vsq/VsqHandle.cs | 406 + trunk/Boare.Lib.Vsq/VsqHandleType.cs | 29 + trunk/Boare.Lib.Vsq/VsqID.cs | 334 + trunk/Boare.Lib.Vsq/VsqIDType.cs | 28 + trunk/Boare.Lib.Vsq/VsqMaster.cs | 148 + .../{VsqMetaText => }/VsqMetaText.cs | 683 +- trunk/Boare.Lib.Vsq/VsqMetaText/Common.cs | 157 - trunk/Boare.Lib.Vsq/VsqMetaText/Common.java | 151 - trunk/Boare.Lib.Vsq/VsqMetaText/Handle.cs | 537 - trunk/Boare.Lib.Vsq/VsqMetaText/ID.cs | 311 - trunk/Boare.Lib.Vsq/VsqMetaText/Master.cs | 107 - trunk/Boare.Lib.Vsq/VsqMetaText/Mixer.cs | 279 - trunk/Boare.Lib.Vsq/VsqMixer.cs | 183 + trunk/Boare.Lib.Vsq/VsqMixerEntry.cs | 75 + trunk/Boare.Lib.Vsq/VsqNote.cs | 27 +- trunk/Boare.Lib.Vsq/VsqNrpn.cs | 72 +- trunk/Boare.Lib.Vsq/VsqPhoneticSymbol.cs | 204 +- trunk/Boare.Lib.Vsq/VsqTrack.cs | 195 +- trunk/Boare.Lib.Vsq/VsqVoiceLanguage.cs | 16 +- trunk/Boare.Lib.Vsq/WrappedStreamWriter.cs | 65 + .../Boare.Lib.Vsq/port_cpp/Boare.Lib.Vsq.sln | 20 - .../port_cpp/Boare.Lib.Vsq.vcproj | 187 - trunk/Boare.Lib.Vsq/port_cpp/cp932.cpp | 9579 ----------------- trunk/Boare.Lib.Vsq/port_cpp/cp932.h | 13 - trunk/Boare.Lib.Vsq/port_cpp/libvsq.cpp | 2 - trunk/Boare.Lib.Vsq/port_cpp/libvsq.h | 1184 -- trunk/Boare.Lib.Vsq/port_cpp/main.cpp | 17 - trunk/LipSync/LipSync.sln | 6 +- .../LipSync/Editor/DisplacementControl.resx | 123 + .../Editor/FormCurveExport.Designer.cs | 204 + .../LipSync/LipSync/Editor/FormCurveExport.cs | 146 + .../LipSync/Editor/FormCurveExport.resx | 126 + .../LipSync/Editor/FormSeriesImage.resx | 120 + trunk/bocoree/Arrays.cs | 27 + trunk/bocoree/BBackgroundWorker.cs | 21 + trunk/bocoree/BButton.cs | 248 + trunk/bocoree/BCancelEventArgs.cs | 16 + trunk/bocoree/BCheckBox.cs | 105 + trunk/bocoree/BComboBox.cs | 255 + trunk/bocoree/BDelegate.cs | 16 + trunk/bocoree/BDialogResult.cs | 27 + trunk/bocoree/BDoWorkEventArgs.cs | 16 + trunk/bocoree/BDoWorkEventHandler.cs | 16 + trunk/bocoree/BEvent.cs | 16 + trunk/bocoree/BEventArgs.cs | 16 + trunk/bocoree/BEventHandler.cs | 16 + trunk/bocoree/BFileChooser.cs | 159 + trunk/bocoree/BFolderBrowser.cs | 64 + trunk/bocoree/BFontChooser.cs | 50 + trunk/bocoree/BForm.cs | 413 + trunk/bocoree/BFormClosedEventArgs.cs | 16 + trunk/bocoree/BFormClosingEventArgs.cs | 16 + trunk/bocoree/BFormClosingEventHandler.cs | 16 + trunk/bocoree/BFormWindowState.cs | 26 + trunk/bocoree/BGroupBox.cs | 15 + trunk/bocoree/BHScrollBar.cs | 228 + trunk/bocoree/BKeyEventArgs.cs | 16 + trunk/bocoree/BKeyEventHandler.cs | 16 + trunk/bocoree/BKeyPressEventArgs.cs | 16 + trunk/bocoree/BKeys.cs | 432 + trunk/bocoree/BLabel.cs | 236 + trunk/bocoree/BListView.cs | 217 + trunk/bocoree/BListViewItem.cs | 52 + trunk/bocoree/BMenu.cs | 229 + trunk/bocoree/BMenuBar.cs | 155 + trunk/bocoree/BMenuItem.cs | 234 + trunk/bocoree/BMenuSeparator.cs | 237 + trunk/bocoree/BMouseButtons.cs | 16 + trunk/bocoree/BMouseEventArgs.cs | 16 + trunk/bocoree/BMouseEventHandler.cs | 16 + trunk/bocoree/BNumericUpDown.cs | 269 + trunk/bocoree/BPaintEventArgs.cs | 16 + trunk/bocoree/BPanel.cs | 232 + trunk/bocoree/BPictureBox.cs | 273 + trunk/bocoree/BPopupMenu.cs | 163 + trunk/bocoree/BPreviewKeyDownEventArgs.cs | 16 + trunk/bocoree/BProgressBar.cs | 46 + trunk/bocoree/BProgressChangedEventArgs.cs | 16 + trunk/bocoree/BProgressChangedEventHandler.cs | 16 + trunk/bocoree/BRunWorkerCompletedEventArgs.cs | 16 + .../BRunWorkerCompletedEventHandler.cs | 16 + trunk/bocoree/BSlider.cs | 158 + trunk/bocoree/BSplitPane.cs | 46 + trunk/bocoree/BStatusLabel.cs | 50 + trunk/bocoree/BTextArea.cs | 30 + trunk/bocoree/BTextBox.cs | 185 + trunk/bocoree/BTimer.cs | 39 + trunk/bocoree/BToggleButton.cs | 23 + trunk/bocoree/BToolBar.cs | 36 + trunk/bocoree/BToolStripButton.cs | 192 + trunk/bocoree/BToolStripDropDownButton.cs | 9 + trunk/bocoree/BToolStripLabel.cs | 7 + trunk/bocoree/BToolStripTextBox.cs | 13 + trunk/bocoree/BVScrollBar.cs | 216 + trunk/bocoree/Base64.cs | 156 + trunk/bocoree/BufferedReader.cs | 92 + trunk/bocoree/BufferedWriter.cs | 126 + trunk/bocoree/ByRef.cs | 35 + trunk/bocoree/Collections.cs | 14 +- trunk/bocoree/File.cs | 475 + trunk/bocoree/Graphics.cs | 12 +- trunk/bocoree/IEventHandler.cs | 16 + trunk/bocoree/Iterator.cs | 14 +- trunk/bocoree/ListIterator.cs | 14 +- trunk/bocoree/PortUtil.cs | 1574 +++ trunk/bocoree/RandomAccessFile.cs | 78 + trunk/bocoree/TreeMap.cs | 12 +- trunk/bocoree/ValuePair.cs | 91 + trunk/bocoree/Vector.cs | 24 +- trunk/bocoree/XmlMember.cs | 288 + trunk/bocoree/XmlPoint.cs | 109 + trunk/bocoree/XmlRectangle.cs | 138 + trunk/bocoree/XmlSerializable.cs | 31 + trunk/bocoree/XmlSerializeWithDescription.cs | 272 + trunk/bocoree/XmlSerializer.cs | 431 + trunk/bocoree/XmlStaticMemberSerializer.cs | 246 + trunk/bocoree/awt.cs | 536 + trunk/bocoree/awt.event.cs | 239 + trunk/bocoree/awt.geom.cs | 30 + trunk/bocoree/awt.image.cs | 54 + trunk/bocoree/bocoree.csproj | 156 +- trunk/bocoree/cp932.cs | 123 +- trunk/bocoree/cp932reader.cs | 4 +- trunk/bocoree/cp932writer.cs | 4 +- trunk/bocoree/fft.cs | 6 +- trunk/bocoree/imageio.cs | 65 + trunk/bocoree/io.cs | 541 + trunk/bocoree/math.cs | 4 +- trunk/bocoree/misc.cs | 94 +- trunk/bocoree/swing.cs | 86 + trunk/bocoree/util.cs | 369 + trunk/bocoree/windows.cs | 8 +- trunk/bocoree/wingdi.cs | 6 +- trunk/bocoree/winmm.cs | 10 +- 214 files changed, 22026 insertions(+), 17358 deletions(-) create mode 100644 trunk/Boare.Lib.Media/BSoundPlayer.cs create mode 100644 trunk/Boare.Lib.Vsq/ITextWriter.cs create mode 100644 trunk/Boare.Lib.Vsq/IconHandle.cs rename trunk/Boare.Lib.Vsq/{VsqMetaText => }/Lyric.cs (65%) create mode 100644 trunk/Boare.Lib.Vsq/LyricHandle.cs create mode 100644 trunk/Boare.Lib.Vsq/MidiEvent.cs create mode 100644 trunk/Boare.Lib.Vsq/MidiFile.cs create mode 100644 trunk/Boare.Lib.Vsq/NoteHeadHandle.cs create mode 100644 trunk/Boare.Lib.Vsq/NrpnIterator.cs delete mode 100644 trunk/Boare.Lib.Vsq/SMF/MidiFile.cs create mode 100644 trunk/Boare.Lib.Vsq/SynthesizerType.cs create mode 100644 trunk/Boare.Lib.Vsq/Timesig.cs create mode 100644 trunk/Boare.Lib.Vsq/UstPortamentoPoint.cs create mode 100644 trunk/Boare.Lib.Vsq/UstPortamentoType.cs create mode 100644 trunk/Boare.Lib.Vsq/VibratoHandle.cs create mode 100644 trunk/Boare.Lib.Vsq/VsqCommon.cs create mode 100644 trunk/Boare.Lib.Vsq/VsqHandle.cs create mode 100644 trunk/Boare.Lib.Vsq/VsqHandleType.cs create mode 100644 trunk/Boare.Lib.Vsq/VsqID.cs create mode 100644 trunk/Boare.Lib.Vsq/VsqIDType.cs create mode 100644 trunk/Boare.Lib.Vsq/VsqMaster.cs rename trunk/Boare.Lib.Vsq/{VsqMetaText => }/VsqMetaText.cs (55%) delete mode 100644 trunk/Boare.Lib.Vsq/VsqMetaText/Common.cs delete mode 100644 trunk/Boare.Lib.Vsq/VsqMetaText/Common.java delete mode 100644 trunk/Boare.Lib.Vsq/VsqMetaText/Handle.cs delete mode 100644 trunk/Boare.Lib.Vsq/VsqMetaText/ID.cs delete mode 100644 trunk/Boare.Lib.Vsq/VsqMetaText/Master.cs delete mode 100644 trunk/Boare.Lib.Vsq/VsqMetaText/Mixer.cs create mode 100644 trunk/Boare.Lib.Vsq/VsqMixer.cs create mode 100644 trunk/Boare.Lib.Vsq/VsqMixerEntry.cs create mode 100644 trunk/Boare.Lib.Vsq/WrappedStreamWriter.cs delete mode 100644 trunk/Boare.Lib.Vsq/port_cpp/Boare.Lib.Vsq.sln delete mode 100644 trunk/Boare.Lib.Vsq/port_cpp/Boare.Lib.Vsq.vcproj delete mode 100644 trunk/Boare.Lib.Vsq/port_cpp/cp932.cpp delete mode 100644 trunk/Boare.Lib.Vsq/port_cpp/cp932.h delete mode 100644 trunk/Boare.Lib.Vsq/port_cpp/libvsq.cpp delete mode 100644 trunk/Boare.Lib.Vsq/port_cpp/libvsq.h delete mode 100644 trunk/Boare.Lib.Vsq/port_cpp/main.cpp create mode 100644 trunk/LipSync/LipSync/Editor/DisplacementControl.resx create mode 100644 trunk/LipSync/LipSync/Editor/FormCurveExport.Designer.cs create mode 100644 trunk/LipSync/LipSync/Editor/FormCurveExport.cs create mode 100644 trunk/LipSync/LipSync/Editor/FormCurveExport.resx create mode 100644 trunk/LipSync/LipSync/Editor/FormSeriesImage.resx create mode 100644 trunk/bocoree/Arrays.cs create mode 100644 trunk/bocoree/BBackgroundWorker.cs create mode 100644 trunk/bocoree/BButton.cs create mode 100644 trunk/bocoree/BCancelEventArgs.cs create mode 100644 trunk/bocoree/BCheckBox.cs create mode 100644 trunk/bocoree/BComboBox.cs create mode 100644 trunk/bocoree/BDelegate.cs create mode 100644 trunk/bocoree/BDialogResult.cs create mode 100644 trunk/bocoree/BDoWorkEventArgs.cs create mode 100644 trunk/bocoree/BDoWorkEventHandler.cs create mode 100644 trunk/bocoree/BEvent.cs create mode 100644 trunk/bocoree/BEventArgs.cs create mode 100644 trunk/bocoree/BEventHandler.cs create mode 100644 trunk/bocoree/BFileChooser.cs create mode 100644 trunk/bocoree/BFolderBrowser.cs create mode 100644 trunk/bocoree/BFontChooser.cs create mode 100644 trunk/bocoree/BForm.cs create mode 100644 trunk/bocoree/BFormClosedEventArgs.cs create mode 100644 trunk/bocoree/BFormClosingEventArgs.cs create mode 100644 trunk/bocoree/BFormClosingEventHandler.cs create mode 100644 trunk/bocoree/BFormWindowState.cs create mode 100644 trunk/bocoree/BGroupBox.cs create mode 100644 trunk/bocoree/BHScrollBar.cs create mode 100644 trunk/bocoree/BKeyEventArgs.cs create mode 100644 trunk/bocoree/BKeyEventHandler.cs create mode 100644 trunk/bocoree/BKeyPressEventArgs.cs create mode 100644 trunk/bocoree/BKeys.cs create mode 100644 trunk/bocoree/BLabel.cs create mode 100644 trunk/bocoree/BListView.cs create mode 100644 trunk/bocoree/BListViewItem.cs create mode 100644 trunk/bocoree/BMenu.cs create mode 100644 trunk/bocoree/BMenuBar.cs create mode 100644 trunk/bocoree/BMenuItem.cs create mode 100644 trunk/bocoree/BMenuSeparator.cs create mode 100644 trunk/bocoree/BMouseButtons.cs create mode 100644 trunk/bocoree/BMouseEventArgs.cs create mode 100644 trunk/bocoree/BMouseEventHandler.cs create mode 100644 trunk/bocoree/BNumericUpDown.cs create mode 100644 trunk/bocoree/BPaintEventArgs.cs create mode 100644 trunk/bocoree/BPanel.cs create mode 100644 trunk/bocoree/BPictureBox.cs create mode 100644 trunk/bocoree/BPopupMenu.cs create mode 100644 trunk/bocoree/BPreviewKeyDownEventArgs.cs create mode 100644 trunk/bocoree/BProgressBar.cs create mode 100644 trunk/bocoree/BProgressChangedEventArgs.cs create mode 100644 trunk/bocoree/BProgressChangedEventHandler.cs create mode 100644 trunk/bocoree/BRunWorkerCompletedEventArgs.cs create mode 100644 trunk/bocoree/BRunWorkerCompletedEventHandler.cs create mode 100644 trunk/bocoree/BSlider.cs create mode 100644 trunk/bocoree/BSplitPane.cs create mode 100644 trunk/bocoree/BStatusLabel.cs create mode 100644 trunk/bocoree/BTextArea.cs create mode 100644 trunk/bocoree/BTextBox.cs create mode 100644 trunk/bocoree/BTimer.cs create mode 100644 trunk/bocoree/BToggleButton.cs create mode 100644 trunk/bocoree/BToolBar.cs create mode 100644 trunk/bocoree/BToolStripButton.cs create mode 100644 trunk/bocoree/BToolStripDropDownButton.cs create mode 100644 trunk/bocoree/BToolStripLabel.cs create mode 100644 trunk/bocoree/BToolStripTextBox.cs create mode 100644 trunk/bocoree/BVScrollBar.cs create mode 100644 trunk/bocoree/Base64.cs create mode 100644 trunk/bocoree/BufferedReader.cs create mode 100644 trunk/bocoree/BufferedWriter.cs create mode 100644 trunk/bocoree/ByRef.cs create mode 100644 trunk/bocoree/File.cs create mode 100644 trunk/bocoree/IEventHandler.cs create mode 100644 trunk/bocoree/PortUtil.cs create mode 100644 trunk/bocoree/RandomAccessFile.cs create mode 100644 trunk/bocoree/ValuePair.cs create mode 100644 trunk/bocoree/XmlMember.cs create mode 100644 trunk/bocoree/XmlPoint.cs create mode 100644 trunk/bocoree/XmlRectangle.cs create mode 100644 trunk/bocoree/XmlSerializable.cs create mode 100644 trunk/bocoree/XmlSerializeWithDescription.cs create mode 100644 trunk/bocoree/XmlSerializer.cs create mode 100644 trunk/bocoree/XmlStaticMemberSerializer.cs create mode 100644 trunk/bocoree/awt.cs create mode 100644 trunk/bocoree/awt.event.cs create mode 100644 trunk/bocoree/awt.geom.cs create mode 100644 trunk/bocoree/awt.image.cs create mode 100644 trunk/bocoree/imageio.cs create mode 100644 trunk/bocoree/io.cs create mode 100644 trunk/bocoree/swing.cs create mode 100644 trunk/bocoree/util.cs diff --git a/trunk/Boare.Lib.AppUtil/AuthorListEntry.cs b/trunk/Boare.Lib.AppUtil/AuthorListEntry.cs index 8b75b3c..c23d126 100644 --- a/trunk/Boare.Lib.AppUtil/AuthorListEntry.cs +++ b/trunk/Boare.Lib.AppUtil/AuthorListEntry.cs @@ -11,40 +11,49 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */ -using System.Drawing; +#if JAVA +package org.kbinani.apputil; + +import java.awt.*; +#else +using System; +using bocoree.java.awt; namespace Boare.Lib.AppUtil { +#endif public class AuthorListEntry { - string m_name; - FontStyle m_style; + String m_name; + int m_style; - public AuthorListEntry( string name, FontStyle style ) - : this( name ) { + public AuthorListEntry( String name, int style ) { + m_name = name; m_style = style; } - public AuthorListEntry( string name ) { - m_name = name; - m_style = FontStyle.Regular; +#if JAVA + public AuthorListEntry( String name ){ + this( name, Font.PLAIN ); +#else + public AuthorListEntry( String name ) + : this( name, Font.PLAIN ) { +#endif } public AuthorListEntry() { m_name = ""; - m_style = FontStyle.Regular; + m_style = Font.PLAIN; } - public string Name { - get { - return m_name; - } + public String getName() { + return m_name; } - public FontStyle Style { - get { - return m_style; - } + public int getStyle() { + return m_style; } } +#if !JAVA } +#endif diff --git a/trunk/Boare.Lib.AppUtil/BHScrollBar.Designer.cs b/trunk/Boare.Lib.AppUtil/BHScrollBar.Designer.cs index 9564606..166780e 100644 --- a/trunk/Boare.Lib.AppUtil/BHScrollBar.Designer.cs +++ b/trunk/Boare.Lib.AppUtil/BHScrollBar.Designer.cs @@ -1,4 +1,5 @@ -/* +#if !JAVA +/* * BHScrollBar.Designer.cs * Copyright (c) 2009 kbinani * @@ -12,7 +13,7 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */ namespace Boare.Lib.AppUtil { - partial class BHScrollBar { + partial class OBSOLUTE_BHScrollBar { /// /// 必要なデザイナ変数です。 /// @@ -64,3 +65,4 @@ namespace Boare.Lib.AppUtil { private System.Windows.Forms.HScrollBar hScroll; } } +#endif diff --git a/trunk/Boare.Lib.AppUtil/BHScrollBar.cs b/trunk/Boare.Lib.AppUtil/BHScrollBar.cs index 0831ec9..899ac4b 100644 --- a/trunk/Boare.Lib.AppUtil/BHScrollBar.cs +++ b/trunk/Boare.Lib.AppUtil/BHScrollBar.cs @@ -1,4 +1,5 @@ -/* +#if !JAVA +/* * BHScrollBar.cs * Copyright (c) 2009 kbinani * @@ -19,13 +20,13 @@ namespace Boare.Lib.AppUtil { /// /// Valueの値が正しくMinimumからMaximumの間を動くスクロールバー /// - public partial class BHScrollBar : UserControl { + public partial class OBSOLUTE_BHScrollBar : UserControl { int m_max = 100; int m_min = 0; public event EventHandler ValueChanged; - public BHScrollBar() { + public OBSOLUTE_BHScrollBar() { InitializeComponent(); } @@ -84,3 +85,4 @@ namespace Boare.Lib.AppUtil { } } +#endif diff --git a/trunk/Boare.Lib.AppUtil/BSplitContainer.cs b/trunk/Boare.Lib.AppUtil/BSplitContainer.cs index aac39df..dcfbd19 100644 --- a/trunk/Boare.Lib.AppUtil/BSplitContainer.cs +++ b/trunk/Boare.Lib.AppUtil/BSplitContainer.cs @@ -1,4 +1,5 @@ -/* +#if !JAVA +/* * BSplitContainer.cs * Copyright (c) 2008-2009 kbinani * @@ -102,6 +103,14 @@ namespace Boare.Lib.AppUtil { } } + public bool isSplitterFixed() { + return this.IsSplitterFixed; + } + + public void setSplitterFixed( bool value ) { + this.IsSplitterFixed = value; + } + /// /// 使用中のリソースをすべてクリーンアップします。 /// @@ -277,6 +286,14 @@ namespace Boare.Lib.AppUtil { } } + public int getDividerSize() { + return this.SplitterWidth; + } + + public void setDividerSize( int value ) { + this.SplitterWidth = value; + } + private bool UpdateLayout( int splitter_distance, int splitter_width, int panel1_min, int panel2_min, bool check_only ) { Point mouse = this.PointToClient( Control.MousePosition ); int pad1 = (m_panel1.BorderStyle == BorderStyle.FixedSingle) ? 1 : 0; @@ -396,6 +413,14 @@ namespace Boare.Lib.AppUtil { } } + public int getDividerLocation() { + return this.SplitterDistance; + } + + public void setDividerLocation( int value ) { + this.SplitterDistance = value; + } + public Orientation Orientation { get { return m_orientation; @@ -504,3 +529,4 @@ namespace Boare.Lib.AppUtil { } } +#endif diff --git a/trunk/Boare.Lib.AppUtil/BSplitterPanel.cs b/trunk/Boare.Lib.AppUtil/BSplitterPanel.cs index e886e8d..02dfcc0 100644 --- a/trunk/Boare.Lib.AppUtil/BSplitterPanel.cs +++ b/trunk/Boare.Lib.AppUtil/BSplitterPanel.cs @@ -1,4 +1,5 @@ -/* +#if !JAVA +/* * BSplitterPanel.cs * Copyright (c) 2008-2009 kbinani * @@ -94,3 +95,4 @@ namespace Boare.Lib.AppUtil { } } +#endif diff --git a/trunk/Boare.Lib.AppUtil/BTrackBar.cs b/trunk/Boare.Lib.AppUtil/BTrackBar.cs index afd4b16..36551f8 100644 --- a/trunk/Boare.Lib.AppUtil/BTrackBar.cs +++ b/trunk/Boare.Lib.AppUtil/BTrackBar.cs @@ -1,4 +1,5 @@ -/* +#if !JAVA +/* * BTrackBar.cs * Copyright (c) 2009 kbinani * @@ -287,3 +288,4 @@ namespace Boare.Lib.AppUtil { } } +#endif diff --git a/trunk/Boare.Lib.AppUtil/BVScrollBar.Designer.cs b/trunk/Boare.Lib.AppUtil/BVScrollBar.Designer.cs index 83939a7..f0484a0 100644 --- a/trunk/Boare.Lib.AppUtil/BVScrollBar.Designer.cs +++ b/trunk/Boare.Lib.AppUtil/BVScrollBar.Designer.cs @@ -12,7 +12,7 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */ namespace Boare.Lib.AppUtil { - partial class BVScrollBar { + partial class OBSOLUTE_BVScrollBar { /// /// 必要なデザイナ変数です。 /// diff --git a/trunk/Boare.Lib.AppUtil/BVScrollBar.cs b/trunk/Boare.Lib.AppUtil/BVScrollBar.cs index 1a43c4d..2592103 100644 --- a/trunk/Boare.Lib.AppUtil/BVScrollBar.cs +++ b/trunk/Boare.Lib.AppUtil/BVScrollBar.cs @@ -1,4 +1,5 @@ -/* +#if !JAVA +/* * BVScrollBar.cs * Copyright (c) 2009 kbinani * @@ -19,13 +20,13 @@ namespace Boare.Lib.AppUtil { /// /// Valueの値が正しくMinimumからMaximumの間を動くスクロールバー /// - public partial class BVScrollBar : UserControl { + public partial class OBSOLUTE_BVScrollBar : UserControl { int m_max = 100; int m_min = 0; public event EventHandler ValueChanged; - public BVScrollBar() { + public OBSOLUTE_BVScrollBar() { InitializeComponent(); } @@ -84,3 +85,4 @@ namespace Boare.Lib.AppUtil { } } +#endif diff --git a/trunk/Boare.Lib.AppUtil/BitmapEx.cs b/trunk/Boare.Lib.AppUtil/BitmapEx.cs index 4a22791..62202af 100644 --- a/trunk/Boare.Lib.AppUtil/BitmapEx.cs +++ b/trunk/Boare.Lib.AppUtil/BitmapEx.cs @@ -1,4 +1,5 @@ -/* +#if !JAVA +/* * BitmapEx.cs * Copyright (c) 2008-2009 kbinani * @@ -156,4 +157,5 @@ namespace Boare.Lib.AppUtil { } } -} \ No newline at end of file +} +#endif diff --git a/trunk/Boare.Lib.AppUtil/Boare.Lib.AppUtil.csproj b/trunk/Boare.Lib.AppUtil/Boare.Lib.AppUtil.csproj index 0b38cdb..4b16d1c 100644 --- a/trunk/Boare.Lib.AppUtil/Boare.Lib.AppUtil.csproj +++ b/trunk/Boare.Lib.AppUtil/Boare.Lib.AppUtil.csproj @@ -3,7 +3,7 @@ Debug AnyCPU - 9.0.30729 + 9.0.21022 2.0 {0C58B068-272F-4390-A14F-3D72AFCF3DFB} Library @@ -18,37 +18,17 @@ true - full - false bin\Debug\ - DEBUG;TRACE - prompt - 4 - Boare.Lib.AppUtil.xml + DEBUG true + bin\x86\Debug\Boare.Lib.AppUtil.XML + AnyCPU - pdbonly - true bin\Release\ - TRACE - prompt - 4 - Boare.Lib.AppUtil.xml - true - - - x86 - bin\x86\Debug\ - true - DEBUG - bin\x86\Debug\Boare.Lib.AppUtil.XML - - - x86 - bin\x86\Release\ true bin\x86\Release\Boare.Lib.AppUtil.XML + AnyCPU @@ -81,14 +61,10 @@ Form - - InputBox.cs - - Component @@ -99,6 +75,7 @@ UserControl + Form @@ -111,8 +88,6 @@ BVScrollBar.cs - - diff --git a/trunk/Boare.Lib.AppUtil/ColorBar.cs b/trunk/Boare.Lib.AppUtil/ColorBar.cs index d0464f2..f8afeb0 100644 --- a/trunk/Boare.Lib.AppUtil/ColorBar.cs +++ b/trunk/Boare.Lib.AppUtil/ColorBar.cs @@ -1,3 +1,4 @@ +#if !JAVA /* * ColorBar.cs * Copyright (c) 2008-2009 kbinani @@ -41,7 +42,7 @@ namespace Boare.Lib.AppUtil { rflow_rainbow = 20, } - public static partial class Misc { + public static partial class Util { const double OPORT_OP_PI = 3.141592653589793238462643383279502884197169399; const double OPORT_OP_PI2 = 3.141592653589793238462643383279502884197169399 * 2.0; const double OPORT_OP_1P9 = 1.0 / 9.0; @@ -120,7 +121,7 @@ namespace Boare.Lib.AppUtil { h = oport_colorbar_rainbow_banded_h( y ); s = oport_colorbar_rainbow_banded_s( y ); v = oport_colorbar_rainbow_banded_v( y ); - HsvToRgb( h, s, v, out r, out g, out b ); + Util.HsvToRgb( h, s, v, out r, out g, out b ); red = (int)(r * 255.0); green = (int)(g * 255.0); blue = (int)(b * 255.0); @@ -139,7 +140,7 @@ namespace Boare.Lib.AppUtil { h = oport_colorbar_rainbow_striped_h( y ); s = oport_colorbar_rainbow_striped_s( y ); v = oport_colorbar_rainbow_striped_v( y ); - HsvToRgb( h, s, v, out r, out g, out b ); + Util.HsvToRgb( h, s, v, out r, out g, out b ); red = (int)(r * 255.0); green = (int)(g * 255.0); blue = (int)(b * 255.0); @@ -1116,3 +1117,4 @@ namespace Boare.Lib.AppUtil { } } +#endif diff --git a/trunk/Boare.Lib.AppUtil/CubicSpline.cs b/trunk/Boare.Lib.AppUtil/CubicSpline.cs index bf0f59e..dfd4fa4 100644 --- a/trunk/Boare.Lib.AppUtil/CubicSpline.cs +++ b/trunk/Boare.Lib.AppUtil/CubicSpline.cs @@ -1,4 +1,5 @@ -/* +#if !JAVA +/* * CubicSpline.cs * Copyright (c) 2008-2009 kbinani * @@ -273,3 +274,4 @@ namespace Boare.Lib.AppUtil { } } +#endif diff --git a/trunk/Boare.Lib.AppUtil/CursorUtil.cs b/trunk/Boare.Lib.AppUtil/CursorUtil.cs index 9dfda41..d99d42e 100644 --- a/trunk/Boare.Lib.AppUtil/CursorUtil.cs +++ b/trunk/Boare.Lib.AppUtil/CursorUtil.cs @@ -1,4 +1,5 @@ -#define RGB24 +#if !JAVA +#define RGB24 using System; using System.Runtime.InteropServices; using System.Drawing; @@ -208,3 +209,4 @@ namespace Boare.Lib.AppUtil { } } +#endif diff --git a/trunk/Boare.Lib.AppUtil/DockPanelContainer.cs b/trunk/Boare.Lib.AppUtil/DockPanelContainer.cs index c8784b2..8194400 100644 --- a/trunk/Boare.Lib.AppUtil/DockPanelContainer.cs +++ b/trunk/Boare.Lib.AppUtil/DockPanelContainer.cs @@ -1,4 +1,5 @@ -using System; +#if !JAVA +using System; using System.Windows.Forms; namespace Boare.Lib.AppUtil { @@ -7,3 +8,4 @@ namespace Boare.Lib.AppUtil { } } +#endif diff --git a/trunk/Boare.Lib.AppUtil/ISO639.cs b/trunk/Boare.Lib.AppUtil/ISO639.cs index 601b2fa..645960b 100644 --- a/trunk/Boare.Lib.AppUtil/ISO639.cs +++ b/trunk/Boare.Lib.AppUtil/ISO639.cs @@ -1,4 +1,5 @@ -/* +#if !JAVA +/* * ISO639.cs * Copyright (c) 2008-2009 kbinani * @@ -27,3 +28,4 @@ namespace Boare.Lib.AppUtil { } } +#endif diff --git a/trunk/Boare.Lib.AppUtil/InputBox.Designer.cs b/trunk/Boare.Lib.AppUtil/InputBox.Designer.cs index 23c6272..1c11a90 100644 --- a/trunk/Boare.Lib.AppUtil/InputBox.Designer.cs +++ b/trunk/Boare.Lib.AppUtil/InputBox.Designer.cs @@ -97,6 +97,7 @@ namespace Boare.Lib.AppUtil { this.Name = "InputBox"; this.ShowIcon = false; this.ShowInTaskbar = false; + this.StartPosition = System.Windows.Forms.FormStartPosition.Manual; this.Text = "InputBox"; this.ResumeLayout( false ); this.PerformLayout(); diff --git a/trunk/Boare.Lib.AppUtil/InputBox.cs b/trunk/Boare.Lib.AppUtil/InputBox.cs index db2ea7e..495accb 100644 --- a/trunk/Boare.Lib.AppUtil/InputBox.cs +++ b/trunk/Boare.Lib.AppUtil/InputBox.cs @@ -11,27 +11,281 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */ +#if JAVA +package org.kbinani.apputil; + +import java.awt.*; +import javax.swing.*; +import org.kbinani.*; +import org.kbinani.windows.forms.*; +#else using System; using System.Windows.Forms; +using bocoree.windows.forms; namespace Boare.Lib.AppUtil { - public partial class InputBox : Form { - public InputBox( string message ) { + using BEventArgs = System.EventArgs; +#endif + +#if JAVA + public class InputBox extends BForm{ +#else + public class InputBox : BForm { +#endif + private BLabel lblMessage; + private BButton btnCancel; + private BTextBox txtInput; + private BButton btnOk; +#if JAVA + public boolean closed = false; + private BDialogResult m_result = BDialogResult.CANCEL; +#else + /// + /// 必要なデザイナ変数です。 + /// + private System.ComponentModel.IContainer components = null; +#endif + + public InputBox( String message ) { +#if JAVA + initializeComponent(); +#else InitializeComponent(); - lblMessage.Text = message; +#endif + lblMessage.setText( message ); } - public string Result { - get { - return txtInput.Text; - } - set { - txtInput.Text = value; +#if JAVA + public class ShowDialogRunner implements Runnable{ + public void run(){ + show(); + while( !closed ){ + try{ + Thread.sleep( 100 ); + }catch( Exception ex ){ + break; + } + } + hide(); } } - private void btnOk_Click( object sender, EventArgs e ) { + public BDialogResult showDialog(){ + Thread t = new Thread( new ShowDialogRunner() ); + t.run(); + return m_result; + } +#endif + + public String getResult(){ + return txtInput.getText(); + } + + public void setResult( String value ){ + txtInput.setText( value ); + } + + public void btnOk_Click( Object sender, BEventArgs e ) { +#if JAVA + closed = true; + m_result = BDialogResult.OK; +#else DialogResult = DialogResult.OK; +#endif } + +#if JAVA + private void initializeComponent(){ + txtInput = new BTextBox(); + btnOk = new BButton(); + lblMessage = new BLabel(); + btnCancel = new BButton(); + // + // txtInput + // + // + // btnOk + // + this.btnOk.setText( "OK" ); + this.btnOk.clickEvent.add( new BEventHandler( this, "btnOk_Click" ) ); + // + // lblMessage + // + // + // btnCancel + // + this.btnCancel.setText( "Cancel" ); + this.btnCancel.setVisible( false ); + // + // InputBox + // + GridBagLayout gridbag = new GridBagLayout(); + GridBagConstraints c = new GridBagConstraints(); + setLayout( gridbag ); + // 1段目 + JPanel jp1_1 = new JPanel(); + gridbag.setConstraints( jp1_1, c ); + add( jp1_1 ); + + c.gridwidth = 2; + c.fill = GridBagConstraints.HORIZONTAL; + gridbag.setConstraints( lblMessage, c ); + add( lblMessage ); + + JPanel jp1_2 = new JPanel(); + c.gridwidth = GridBagConstraints.REMAINDER; + c.fill = GridBagConstraints.NONE; + gridbag.setConstraints( jp1_2, c ); + add( jp1_2 ); + + // 2段目 + JPanel jp2_1 = new JPanel(); + c.gridwidth = 1; + gridbag.setConstraints( jp2_1, c ); + add( jp2_1 ); + + c.gridwidth = 2; + c.fill = GridBagConstraints.HORIZONTAL; + c.weightx = 1.0; + gridbag.setConstraints( txtInput, c ); + add( txtInput ); + + JPanel jp2_2 = new JPanel(); + c.gridwidth = GridBagConstraints.REMAINDER; + c.fill = GridBagConstraints.NONE; + c.weightx = 0.0; + gridbag.setConstraints( jp2_2, c ); + add( jp2_2 ); + + // 3段目 + JPanel jp3 = new JPanel(); + c.gridwidth = GridBagConstraints.REMAINDER; + gridbag.setConstraints( jp3, c ); + add( jp3 ); + + // 4段目 + JPanel jp4_1 = new JPanel(); + c.gridwidth = 2; + gridbag.setConstraints( jp4_1, c ); + add( jp4_1 ); + + c.gridwidth = 1; + c.anchor = GridBagConstraints.EAST; + gridbag.setConstraints( btnOk, c ); + add( btnOk ); + + JPanel jp4_2 = new JPanel(); + c.gridwidth = GridBagConstraints.REMAINDER; + c.anchor = GridBagConstraints.CENTER; + gridbag.setConstraints( jp4_2, c ); + add( jp4_2 ); + + // 5段目 + JPanel jp5 = new JPanel(); + c.gridwidth = GridBagConstraints.REMAINDER; + c.gridheight = GridBagConstraints.REMAINDER; + c.fill = GridBagConstraints.BOTH; + gridbag.setConstraints( jp5, c ); + add( jp5 ); + + this.formClosedEvent.add( new BEventHandler( this, "InputBox_FormClosed" ) ); + this.setTitle( "InputBox" ); + this.setSize( 339, 110 ); + } + + public void InputBox_FormClosed( Object sender, BEventArgs e ){ + closed = true; + } +#else + /// + /// 使用中のリソースをすべてクリーンアップします。 + /// + /// マネージ リソースが破棄される場合 true、破棄されない場合は false です。 + protected override void Dispose( bool disposing ) { + if ( disposing && (components != null) ) { + components.Dispose(); + } + base.Dispose( disposing ); + } + + #region Windows フォーム デザイナで生成されたコード + + /// + /// デザイナ サポートに必要なメソッドです。このメソッドの内容を + /// コード エディタで変更しないでください。 + /// + private void InitializeComponent() { + this.txtInput = new BTextBox(); + this.btnOk = new BButton(); + this.lblMessage = new BLabel(); + this.btnCancel = new BButton(); + this.SuspendLayout(); + // + // txtInput + // + this.txtInput.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.txtInput.Location = new System.Drawing.Point( 12, 24 ); + this.txtInput.Name = "txtInput"; + this.txtInput.Size = new System.Drawing.Size( 309, 19 ); + this.txtInput.TabIndex = 0; + // + // btnOk + // + this.btnOk.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.btnOk.Location = new System.Drawing.Point( 246, 49 ); + 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 ); + // + // lblMessage + // + this.lblMessage.AutoSize = true; + this.lblMessage.Location = new System.Drawing.Point( 12, 9 ); + this.lblMessage.Name = "lblMessage"; + this.lblMessage.Size = new System.Drawing.Size( 0, 12 ); + this.lblMessage.TabIndex = 2; + // + // btnCancel + // + this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; + this.btnCancel.Location = new System.Drawing.Point( -100, 49 ); + this.btnCancel.Name = "btnCancel"; + this.btnCancel.Size = new System.Drawing.Size( 75, 23 ); + this.btnCancel.TabIndex = 3; + this.btnCancel.Text = "Cancel"; + this.btnCancel.UseVisualStyleBackColor = true; + // + // 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( 333, 82 ); + this.Controls.Add( this.btnCancel ); + this.Controls.Add( this.lblMessage ); + this.Controls.Add( this.btnOk ); + this.Controls.Add( this.txtInput ); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "InputBox"; + this.ShowIcon = false; + this.ShowInTaskbar = false; + this.StartPosition = System.Windows.Forms.FormStartPosition.Manual; + this.Text = "InputBox"; + this.ResumeLayout( false ); + this.PerformLayout(); + + } + #endregion +#endif } + +#if !JAVA } +#endif diff --git a/trunk/Boare.Lib.AppUtil/MessageBody.cs b/trunk/Boare.Lib.AppUtil/MessageBody.cs index 2ca09ac..bb7361a 100644 --- a/trunk/Boare.Lib.AppUtil/MessageBody.cs +++ b/trunk/Boare.Lib.AppUtil/MessageBody.cs @@ -11,192 +11,235 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */ +#if JAVA +package org.kbinani.apputil; + +import java.util.*; +import java.io.*; +import java.awt.image.*; +import org.kbinani.*; +#else using System; -using System.Collections.Generic; -using System.Text; -using System.IO; +using bocoree; +using bocoree.java.util; +using bocoree.java.io; namespace Boare.Lib.AppUtil { + using boolean = System.Boolean; +#endif public class MessageBody { - public string lang; - public string po_header = ""; - public Dictionary list = new Dictionary(); + public String lang; + public String poHeader = ""; + public TreeMap list = new TreeMap(); - public MessageBody( string lang_ ) { + public MessageBody( String lang_ ) { lang = lang_; } - public MessageBody( string lang, string[] ids, string[] messages ) { + public MessageBody( String lang, String[] ids, String[] messages ) { this.lang = lang; - list = new Dictionary(); + list = new TreeMap(); for( int i = 0; i < ids.Length; i++ ) { - list.Add( ids[i], new MessageBodyEntry( messages[i], new string[] { } ) ); + list.put( ids[i], new MessageBodyEntry( messages[i], new String[] { } ) ); } } - public MessageBody( string lang_, string file ) { + public MessageBody( String lang_, String file ) { lang = lang_; - po_header = ""; - using ( StreamReader sr = new StreamReader( file ) ) { - while ( sr.Peek() >= 0 ) { - string msgid; - string first_line = sr.ReadLine(); - string[] location; - string last_line = ReadTillMessageEnd( sr, first_line, "msgid", out msgid, out location ); - string msgstr; - string[] location_dumy; - last_line = ReadTillMessageEnd( sr, last_line, "msgstr", out msgstr, out location_dumy ); - if ( msgid.Length > 0 ) { - if ( list.ContainsKey( msgid ) ) { - list[msgid] = new MessageBodyEntry( msgstr, location ); - } else { - list.Add( msgid, new MessageBodyEntry( msgstr, location ) ); - } + poHeader = ""; + BufferedReader sr = null; + try { + sr = new BufferedReader( new FileReader( file ) ); + String line2 = ""; + while ( (line2 = sr.readLine()) != null ) { + ByRef msgid = new ByRef( "" ); + String first_line = line2; + ByRef location = new ByRef(); + String last_line = readTillMessageEnd( sr, first_line, "msgid", msgid, location ); + ByRef msgstr = new ByRef( "" ); + ByRef location_dumy = new ByRef(); + last_line = readTillMessageEnd( sr, last_line, "msgstr", msgstr, location_dumy ); + if ( PortUtil.getStringLength( msgid.value ) > 0 ) { + list.put( msgid.value, new MessageBodyEntry( msgstr.value, location.value ) ); } else { - po_header = msgstr; - string[] spl = po_header.Split( new char[] { (char)0x0d, (char)0x0a }, StringSplitOptions.RemoveEmptyEntries ); - po_header = ""; + poHeader = msgstr.value; + String[] spl = PortUtil.splitString( poHeader, new char[] { (char)0x0d, (char)0x0a }, true ); + poHeader = ""; int count = 0; - foreach ( string line in spl ) { - string[] spl2 = line.Split( new char[] { ':' }, 2 ); + for ( int i = 0; i < spl.Length; i++ ) { + String line = spl[i]; + String[] spl2 = PortUtil.splitString( line, new char[] { ':' }, 2 ); if ( spl2.Length == 2 ) { - string name = spl2[0].Trim(); - if ( name.ToLower() == "Content-Type".ToLower() ) { - po_header += (count == 0 ? "" : "\n") + "Content-Type: text/plain; charset=UTF-8"; - } else if ( name.ToLower() == "Content-Transfer-Encoding".ToLower() ) { - po_header += (count == 0 ? "" : "\n") + "Content-Transfer-Encoding: 8bit"; + String name = spl2[0].Trim(); + String ct = "Content-Type"; + String cte = "Content-Transfer-Encoding"; + if ( name.ToLower().Equals( ct.ToLower() ) ) { + poHeader += (count == 0 ? "" : "\n") + "Content-Type: text/plain; charset=UTF-8"; + } else if ( name.ToLower().Equals( cte.ToLower() ) ) { + poHeader += (count == 0 ? "" : "\n") + "Content-Transfer-Encoding: 8bit"; } else { - po_header += (count == 0 ? "" : "\n") + line; + poHeader += (count == 0 ? "" : "\n") + line; } } else { - po_header += (count == 0 ? "" : "\n") + line; + poHeader += (count == 0 ? "" : "\n") + line; } count++; } } } + } catch ( Exception ex ) { + } finally { + if ( sr != null ) { + try { + sr.close(); + } catch ( Exception ex2 ) { + } + } } -#if DEBUG - Console.WriteLine( "MessageBody..ctor; po_header=" + po_header ); -#endif } - public string GetMessage( string id ) { - if ( list.ContainsKey( id ) ) { - string ret = list[id].Message; - if ( ret == "" ) { + public String getMessage( String id ) { + if ( list.containsKey( id ) ) { + String ret = list.get( id ).message; + if ( ret.Equals( "" ) ) { return id; } else { - return list[id].Message; + return list.get( id ).message; } } return id; } - public MessageBodyEntry GetMessageDetail( string id ) { - if ( list.ContainsKey( id ) ) { - string ret = list[id].Message; - if ( ret == "" ) { - return new MessageBodyEntry( id, new string[] { } ); + public MessageBodyEntry getMessageDetail( String id ) { + if ( list.containsKey( id ) ) { + String ret = list.get( id ).message; + if ( ret.Equals( "" ) ) { + return new MessageBodyEntry( id, new String[] { } ); } else { - return list[id]; + return list.get( id ); } } - return new MessageBodyEntry( id, new string[] { } ); + return new MessageBodyEntry( id, new String[] { } ); } - public void Write( string file ) { - using ( StreamWriter sw = new StreamWriter( file ) ) { - if ( po_header != "" ) { - sw.WriteLine( "msgid \"\"" ); - sw.WriteLine( "msgstr \"\"" ); - string[] spl = po_header.Split( new char[] { (char)0x0d, (char)0x0a }, StringSplitOptions.RemoveEmptyEntries ); - foreach ( string line in spl ) { - sw.WriteLine( "\"" + line + "\\" + "n\"" ); + public void write( String file ) { + BufferedWriter sw = null; + try { + sw = new BufferedWriter( new FileWriter( file ) ); + if ( !poHeader.Equals( "" ) ) { + sw.write( "msgid \"\"" ); + sw.newLine(); + sw.write( "msgstr \"\"" ); + sw.newLine(); + String[] spl = PortUtil.splitString( poHeader, new char[] { (char)0x0d, (char)0x0a }, true ); + for ( int i = 0; i < spl.Length; i++ ){ + String line = spl[i]; + sw.write( "\"" + line + "\\" + "n\"" ); + sw.newLine(); } - sw.WriteLine(); + sw.newLine(); } else { - sw.WriteLine( "msgid \"\"" ); - sw.WriteLine( "msgstr \"\"" ); - sw.WriteLine( "\"Content-Type: text/plain; charset=UTF-8\\" + "n\"" ); - sw.WriteLine( "\"Content-Transfer-Encoding: 8bit\\" + "n\"" ); - sw.WriteLine(); + sw.write( "msgid \"\"" ); + sw.newLine(); + sw.write( "msgstr \"\"" ); + sw.newLine(); + sw.write( "\"Content-Type: text/plain; charset=UTF-8\\" + "n\"" ); + sw.newLine(); + sw.write( "\"Content-Transfer-Encoding: 8bit\\" + "n\"" ); + sw.newLine(); + sw.newLine(); } - foreach ( string key in list.Keys ) { - string skey = key.Replace( "\n", "\\n\"\n\"" ); - string s = list[key].Message; - List location = list[key].Location; - for ( int i = 0; i < location.Count; i++ ) { - sw.WriteLine( "#: " + location[i] ); + for ( Iterator itr = list.keySet().iterator(); itr.hasNext(); ){ + String key = (String)itr.next(); + String skey = key.Replace( "\n", "\\n\"\n\"" ); + MessageBodyEntry mbe = list.get( key ); + String s = mbe.message; + Vector location = mbe.location; + int count = location.size(); + for ( int i = 0; i < count; i++ ) { + sw.write( "#: " + location.get( i ) ); + sw.newLine(); } - sw.WriteLine( "msgid \"" + skey + "\"" ); + sw.write( "msgid \"" + skey + "\"" ); + sw.newLine(); s = s.Replace( "\n", "\\n\"\n\"" ); - sw.WriteLine( "msgstr \"" + s + "\"" ); - sw.WriteLine(); + sw.write( "msgstr \"" + s + "\"" ); + sw.newLine(); + sw.newLine(); + } + } catch ( Exception ex ) { + } finally { + if ( sw != null ) { + try { + sw.close(); + } catch ( Exception ex2 ) { + } } } } - private static void SeparateEntryAndMessage( string source, out string entry, out string message ) { - string line = source.Trim(); - entry = ""; - message = ""; - if ( line.Length <= 0 ) { + private static void separateEntryAndMessage( String source, ByRef entry, ByRef message ) { + String line = source.Trim(); + entry.value = ""; + message.value = ""; + if ( PortUtil.getStringLength( line ) <= 0 ) { return; } int index_space = line.IndexOf( ' ' ); int index_dquoter = line.IndexOf( '"' ); int index = Math.Min( index_dquoter, index_space ); - entry = line.Substring( 0, index ); - message = line.Substring( index_dquoter + 1 ); - message = message.Substring( 0, message.Length - 1 ); + entry.value = line.Substring( 0, index ); + message.value = line.Substring( index_dquoter + 1 ); + message.value = message.value.Substring( 0, PortUtil.getStringLength( message.value ) - 1 ); } - private static string ReadTillMessageEnd( StreamReader sr, string first_line, string entry, out string msg, out string[] locations ) { - msg = ""; - string line = first_line; - List location = new List(); - bool entry_found = false; + private static String readTillMessageEnd( BufferedReader sr, String first_line, String entry, ByRef msg, ByRef locations ) +#if JAVA + throws IOException +#endif + { + msg.value = ""; + String line = first_line; + Vector location = new Vector(); + boolean entry_found = false; if ( line.StartsWith( entry ) ) { // 1行目がすでに"entry"の行だった場合 - string dum, dum2; - SeparateEntryAndMessage( line, out dum, out dum2 ); - msg += dum2; + ByRef dum = new ByRef( "" ); + ByRef dum2 = new ByRef( "" ); + separateEntryAndMessage( line, dum, dum2 ); + msg.value += dum2.value; } else { - while ( true ) { + while ( (line = sr.readLine()) != null ) { if ( line.StartsWith( "#:" ) ) { line = line.Substring( 2 ).Trim(); - location.Add( line ); + location.add( line ); } else if ( line.StartsWith( entry ) ) { - string dum, dum2; - SeparateEntryAndMessage( line, out dum, out dum2 ); - msg += dum2; - break; - } - if ( sr.Peek() >= 0 ) { - line = sr.ReadLine(); - } else { + ByRef dum = new ByRef( "" ); + ByRef dum2 = new ByRef( "" ); + separateEntryAndMessage( line, dum, dum2 ); + msg.value += dum2.value; break; } } } - locations = location.ToArray(); - string ret = ""; - while ( sr.Peek() >= 0 ) { - line = sr.ReadLine(); + locations.value = location.toArray( new String[] { } ); + String ret = ""; + while ( (line = sr.readLine()) != null ) { if ( !line.StartsWith( "\"" ) ) { - msg = msg.Replace( "\\\"", "\"" ); - msg = msg.Replace( "\\n", "\n" ); + msg.value = msg.value.Replace( "\\\"", "\"" ); + msg.value = msg.value.Replace( "\\n", "\n" ); return line; } int index = line.LastIndexOf( "\"" ); - msg += line.Substring( 1, index - 1 ); + msg.value += line.Substring( 1, index - 1 ); } - msg = msg.Replace( "\\\"", "\"" ); - msg = msg.Replace( "\\n", "\n" ); + msg.value = msg.value.Replace( "\\\"", "\"" ); + msg.value = msg.value.Replace( "\\n", "\n" ); return line; } } +#if !JAVA } +#endif diff --git a/trunk/Boare.Lib.AppUtil/MessageBodyEntry.cs b/trunk/Boare.Lib.AppUtil/MessageBodyEntry.cs index 21367cd..1d35678 100644 --- a/trunk/Boare.Lib.AppUtil/MessageBodyEntry.cs +++ b/trunk/Boare.Lib.AppUtil/MessageBodyEntry.cs @@ -11,21 +11,29 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */ +#if JAVA +package org.kbinani.apputil; + +import java.util.*; +#else using System; -using System.Collections.Generic; +using bocoree.java.util; namespace Boare.Lib.AppUtil { +#endif public class MessageBodyEntry { - public string Message; - public List Location = new List(); + public String message; + public Vector location = new Vector(); - public MessageBodyEntry( string message, string[] location ) { - Message = message; - for ( int i = 0; i < location.Length; i++ ) { - Location.Add( location[i] ); + public MessageBodyEntry( String message_, String[] location_ ) { + message = message_; + for ( int i = 0; i < location_.Length; i++ ) { + location.add( location_[i] ); } } } +#if !JAVA } +#endif diff --git a/trunk/Boare.Lib.AppUtil/Messaging.cs b/trunk/Boare.Lib.AppUtil/Messaging.cs index 4af6471..f25c690 100644 --- a/trunk/Boare.Lib.AppUtil/Messaging.cs +++ b/trunk/Boare.Lib.AppUtil/Messaging.cs @@ -11,109 +11,121 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */ +#if JAVA +package org.kbinani.apputil; + +import org.kbinani.*; +import java.util.*; +#else using System; -using System.Collections.Generic; -using System.IO; -using System.Windows.Forms; +using bocoree; +using bocoree.java.util; namespace Boare.Lib.AppUtil { +#endif - public static class Messaging { - private static string s_lang = ""; - private static List s_messages = new List(); + public class Messaging { + private static String s_lang = ""; + private static Vector s_messages = new Vector(); - public static string[] GetKeys( string lang ) { - foreach ( MessageBody dict in s_messages ) { - if ( lang == dict.lang ) { - List list = new List(); - foreach ( string key in dict.list.Keys ) { - list.Add( key ); + public static String[] getKeys( String lang ) { + for( Iterator itr = s_messages.iterator(); itr.hasNext(); ){ + MessageBody dict = (MessageBody)itr.next(); + if ( lang.Equals( dict.lang ) ) { + Vector list = new Vector(); + for ( Iterator itr2 = dict.list.keySet().iterator(); itr2.hasNext(); ) { + String key = (String)itr2.next(); + list.add( key ); } - return list.ToArray(); + return list.toArray( new String[] { } ); } } return null; } - public static string[] GetRegisteredLanguage() { - List res = new List(); - foreach ( MessageBody dict in s_messages ) { - res.Add( dict.lang ); + public static String[] getRegisteredLanguage() { + Vector res = new Vector(); + for ( Iterator itr = s_messages.iterator(); itr.hasNext(); ) { + MessageBody dict = (MessageBody)itr.next(); + res.add( dict.lang ); } - return res.ToArray(); + return res.toArray( new String[] { } ); } - public static string Language { - get { - if ( s_lang != "" ) { - return s_lang; - } else { - s_lang = "en"; - return s_lang; - } + public static String getLanguage() { + if ( !s_lang.Equals( "" ) ) { + return s_lang; + } else { + s_lang = "en"; + return s_lang; } - set { - if ( value != "" ) { - s_lang = value; - } else { - s_lang = "en"; - } + } + + public static void setLanguage( String value ) { + if ( !value.Equals( "" ) ) { + s_lang = value; + } else { + s_lang = "en"; } } /// /// 現在の実行ディレクトリにある言語設定ファイルを全て読込み、メッセージリストに追加します /// - public static void LoadMessages() { - LoadMessages( Application.StartupPath ); + public static void loadMessages() { + loadMessages( PortUtil.getApplicationStartupPath() ); } /// /// 指定されたディレクトリにある言語設定ファイルを全て読込み、メッセージリストに追加します /// /// - public static void LoadMessages( string directory ) { - DirectoryInfo current = new DirectoryInfo( directory ); - s_messages.Clear(); + public static void loadMessages( String directory ) { + s_messages.clear(); #if DEBUG Console.WriteLine( "Messaging+LoadMessages()" ); #endif - foreach ( FileInfo fi in current.GetFiles( "*.po" ) ) { - string fname = fi.FullName; + String[] files = PortUtil.listFiles( directory, ".po" ); + for ( int i = 0; i < files.Length; i++ ){ + String fname = PortUtil.combinePath( directory, files[i] ); #if DEBUG Console.WriteLine( " fname=" + fname ); #endif - AppendFromFile( fname ); + appendFromFile( fname ); } } - public static void AppendFromFile( string file ) { - s_messages.Add( new MessageBody( Path.GetFileNameWithoutExtension( file ), file ) ); + public static void appendFromFile( String file ) { + s_messages.add( new MessageBody( PortUtil.getFileNameWithoutExtension( file ), file ) ); } - public static MessageBodyEntry GetMessageDetail( string id ) { - if ( s_lang.Length <= 0 ) { + public static MessageBodyEntry getMessageDetail( String id ) { + if ( s_lang.Equals( "" ) ) { s_lang = "en"; } - foreach ( MessageBody mb in s_messages ) { - if ( mb.lang == s_lang ) { - return mb.GetMessageDetail( id ); + for ( Iterator itr = s_messages.iterator(); itr.hasNext(); ){ + MessageBody mb = (MessageBody)itr.next(); + if ( mb.lang.Equals( s_lang ) ) { + return mb.getMessageDetail( id ); } } - return new MessageBodyEntry( id, new string[] { } ); + return new MessageBodyEntry( id, new String[] { } ); } - public static string GetMessage( string id ) { - if ( s_lang.Length <= 0 ) { + public static String getMessage( String id ) { + if ( s_lang.Equals( "" ) ) { s_lang = "en"; } - foreach ( MessageBody mb in s_messages ) { - if ( mb.lang == s_lang ) { - return mb.GetMessage( id ); + for ( Iterator itr = s_messages.iterator(); itr.hasNext(); ){ + MessageBody mb = (MessageBody)itr.next(); + if ( mb.lang.Equals( s_lang ) ) { + return mb.getMessage( id ); } } return id; } } +#if !JAVA } +#endif diff --git a/trunk/Boare.Lib.AppUtil/Misc.cs b/trunk/Boare.Lib.AppUtil/Misc.cs index 28d1e40..7d62d46 100644 --- a/trunk/Boare.Lib.AppUtil/Misc.cs +++ b/trunk/Boare.Lib.AppUtil/Misc.cs @@ -21,7 +21,7 @@ using System.Windows.Forms; namespace Boare.Lib.AppUtil { - public static partial class Misc { + public static partial class Util { public static void ApplyContextMenuFontRecurse( ContextMenuStrip item, Font font ) { item.Font = font; foreach ( ToolStripItem tsi in item.Items ) { diff --git a/trunk/Boare.Lib.AppUtil/VersionInfo.Designer.cs b/trunk/Boare.Lib.AppUtil/VersionInfo.Designer.cs index dcd0c91..65671bd 100644 --- a/trunk/Boare.Lib.AppUtil/VersionInfo.Designer.cs +++ b/trunk/Boare.Lib.AppUtil/VersionInfo.Designer.cs @@ -115,10 +115,10 @@ namespace Boare.Lib.AppUtil { public void ApplyLanguage() { string about = string.Format( _( "About {0}" ), m_app_name ); string credit = _( "Credit" ); - Size size1 = Misc.MeasureString( about, btnFlip.Font ); - Size size2 = Misc.MeasureString( credit, btnFlip.Font ); - m_button_width_about = Math.Max( 75, (int)(size1.Width * 1.3) ); - m_button_width_credit = Math.Max( 75, (int)(size2.Width * 1.3) ); + bocoree.java.awt.Dimension size1 = Util.measureString( about, new bocoree.java.awt.Font( btnFlip.Font ) ); + bocoree.java.awt.Dimension size2 = Util.measureString( credit, new bocoree.java.awt.Font( btnFlip.Font ) ); + m_button_width_about = Math.Max( 75, (int)(size1.width * 1.3) ); + m_button_width_credit = Math.Max( 75, (int)(size2.width * 1.3) ); if( m_credit_mode ) { btnFlip.Width = m_button_width_about; btnFlip.Text = about; diff --git a/trunk/Boare.Lib.AppUtil/VersionInfo.cs b/trunk/Boare.Lib.AppUtil/VersionInfo.cs index e1af10a..b89ef76 100644 --- a/trunk/Boare.Lib.AppUtil/VersionInfo.cs +++ b/trunk/Boare.Lib.AppUtil/VersionInfo.cs @@ -1,4 +1,5 @@ -/* +#if !JAVA +/* * VersionInfo.cs * Copyright (c) 2008-2009 kbinani * @@ -12,13 +13,19 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */ using System; -using System.Drawing; -using System.Drawing.Drawing2D; -using System.Windows.Forms; +//using System.Drawing; +//using System.Drawing.Drawing2D; +//using System.Windows.Forms; +using bocoree; +using bocoree.java.awt; +using bocoree.java.awt.image; namespace Boare.Lib.AppUtil { + using java = bocoree.java; + using javax = bocoree.javax; + using Graphics = bocoree.java.awt.Graphics2D; - public partial class VersionInfo : Form { + public partial class VersionInfo : System.Windows.Forms.Form { DateTime m_scroll_started; private AuthorListEntry[] m_credit; const float m_speed = 35f; @@ -29,12 +36,12 @@ namespace Boare.Lib.AppUtil { float m_shift = 0f; int m_button_width_about = 75; int m_button_width_credit = 75; - Bitmap m_scroll; + BufferedImage m_scroll; const int m_height = 380; - readonly Color m_background = Color.White; + readonly Color m_background = Color.white; private string m_app_name = ""; - private Color m_app_name_color = Color.Black; - private Color m_version_color = Color.FromArgb( 105, 105, 105 ); + private Color m_app_name_color = Color.black; + private Color m_version_color = new Color( 105, 105, 105 ); private bool m_shadow_enablde = true; public VersionInfo( string app_name, string version ) { @@ -43,9 +50,9 @@ namespace Boare.Lib.AppUtil { InitializeComponent(); ApplyLanguage(); - this.SetStyle( ControlStyles.DoubleBuffer, true ); - this.SetStyle( ControlStyles.UserPaint, true ); - this.SetStyle( ControlStyles.AllPaintingInWmPaint, true ); + this.SetStyle( System.Windows.Forms.ControlStyles.DoubleBuffer, true ); + this.SetStyle( System.Windows.Forms.ControlStyles.UserPaint, true ); + this.SetStyle( System.Windows.Forms.ControlStyles.AllPaintingInWmPaint, true ); m_credit = new AuthorListEntry[] { }; btnSaveAuthorList.Visible = false; @@ -63,7 +70,7 @@ namespace Boare.Lib.AppUtil { } public static string _( string s ) { - return Messaging.GetMessage( s ); + return Messaging.getMessage( s ); } /// @@ -90,7 +97,7 @@ namespace Boare.Lib.AppUtil { } } - public Bitmap Credit { + public BufferedImage Credit { set { m_scroll = value; } @@ -118,55 +125,44 @@ namespace Boare.Lib.AppUtil { const float shadow_shift = 2f; const string font_name = "Arial"; const int font_size = 10; - Font font = new Font( font_name, font_size ); - Size size = Boare.Lib.AppUtil.Misc.MeasureString( "Qjqp", font ); + Font font = new Font( font_name, java.awt.Font.PLAIN, font_size ); + Dimension size = Boare.Lib.AppUtil.Util.measureString( "Qjqp", font ); float width = this.Width; - float height = size.Height; - StringFormat sf = new StringFormat(); - m_scroll = new Bitmap( (int)width, (int)(40f + m_credit.Length * height * 1.1f) ); - using ( Graphics g = Graphics.FromImage( m_scroll ) ) { - sf.Alignment = StringAlignment.Center; + float height = size.height; + //StringFormat sf = new StringFormat(); + m_scroll = new BufferedImage( (int)width, (int)(40f + m_credit.Length * height * 1.1f), BufferedImage.TYPE_INT_BGR ); + Graphics2D g = m_scroll.createGraphics(); + //sf.Alignment = StringAlignment.Center; + g.setFont( new Font( font_name, java.awt.Font.BOLD, (int)(font_size * 1.1f) ) ); + if ( m_shadow_enablde ) { + g.setColor( new Color( 0, 0, 0, 40 ) ); + g.drawString( m_app_name, shadow_shift, shadow_shift ); //, width, height ), sf ); + } + g.setColor( Color.black ); + g.drawString( m_app_name, 0f, 0f ); //, width, height ), sf ); + for ( int i = 0; i < m_credit.Length; i++ ) { + g.setFont( new Font( font_name, m_credit[i].getStyle(), font_size ) ); if ( m_shadow_enablde ) { - g.DrawString( m_app_name, - new Font( font_name, (int)(font_size * 1.1f), FontStyle.Bold ), - new SolidBrush( Color.FromArgb( 40, Color.Black ) ), - new RectangleF( shadow_shift, shadow_shift, width, height ), - sf ); - } - g.DrawString( m_app_name, - new Font( font_name, (int)(font_size * 1.1f), FontStyle.Bold ), - Brushes.Black, - new RectangleF( 0f, 0f, width, height ), - sf ); - for ( int i = 0; i < m_credit.Length; i++ ) { - if ( m_shadow_enablde ) { - g.DrawString( m_credit[i].Name, - new Font( font_name, font_size, m_credit[i].Style ), - new SolidBrush( Color.FromArgb( 40, Color.Black ) ), - new RectangleF( 0f + shadow_shift, 40f + i * height * 1.1f + shadow_shift, width, height ), - sf ); - } - g.DrawString( m_credit[i].Name, - new Font( font_name, font_size, m_credit[i].Style ), - Brushes.Black, - new RectangleF( 0f, 40f + i * height * 1.1f, width, height ), - sf ); + g.setColor( new Color( 0, 0, 0, 40 ) ); + g.drawString( m_credit[i].getName(), 0f + shadow_shift, 40f + i * height * 1.1f + shadow_shift ); //, width, height ), sf ); } + g.setColor( Color.black ); + g.drawString( m_credit[i].getName(), 0f, 40f + i * height * 1.1f );// , width, height ), sf ); } } void btnSaveAuthorList_Click( object sender, EventArgs e ) { #if DEBUG - using ( SaveFileDialog dlg = new SaveFileDialog() ){ - if( dlg.ShowDialog() == DialogResult.OK ){ - m_scroll.Save( dlg.FileName, System.Drawing.Imaging.ImageFormat.Png ); + using ( System.Windows.Forms.SaveFileDialog dlg = new System.Windows.Forms.SaveFileDialog() ){ + if( dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK ){ + javax.imageio.ImageIO.write( m_scroll, "png", new java.io.File( dlg.FileName ) ); } } #endif } private void btnOK_Click( object sender, EventArgs e ) { - this.DialogResult = DialogResult.OK; + this.DialogResult = System.Windows.Forms.DialogResult.OK; this.Close(); } @@ -193,50 +189,9 @@ namespace Boare.Lib.AppUtil { this.Invalidate(); } - private void VersionInfoEx_Paint( object sender, PaintEventArgs e ) { + private void VersionInfoEx_Paint( object sender, System.Windows.Forms.PaintEventArgs e ) { try { - Graphics g = e.Graphics; - g.Clip = new Region( new Rectangle( 0, 0, this.Width, m_height ) ); - g.Clear( m_background ); - if ( m_credit_mode ) { - float times = (float)(((DateTime.Now).Subtract( m_scroll_started )).TotalSeconds) - 3f; - float speed = (float)((2.0 - bocoree.math.erfcc( times * 0.8 )) / 2.0) * m_speed; - float dt = times - m_last_t; - m_shift += (speed + m_last_speed) * dt / 2f; - m_last_t = times; - m_last_speed = speed; - float dx = (this.Width - m_scroll.Width) * 0.5f; - if ( m_scroll != null ) { - g.DrawImage( m_scroll, - dx, 90f - m_shift, - m_scroll.Width, m_scroll.Height ); - if ( 90f - m_shift + m_scroll.Height < 0 ) { - m_shift = -m_height * 1.5f; - } - } - int grad_height = 60; - Rectangle top = new Rectangle( 0, 0, this.Width, grad_height ); - using ( LinearGradientBrush lgb = new LinearGradientBrush( top, Color.White, Color.Transparent, LinearGradientMode.Vertical ) ) { - g.FillRectangle( lgb, top ); - } - Rectangle bottom = new Rectangle( 0, m_height - grad_height, this.Width, grad_height ); - g.Clip = new Region( new Rectangle( 0, m_height - grad_height + 1, this.Width, grad_height - 1 ) ); - using ( LinearGradientBrush lgb = new LinearGradientBrush( bottom, Color.Transparent, Color.White, LinearGradientMode.Vertical ) ) { - g.FillRectangle( lgb, bottom ); - } - g.ResetClip(); - } else { - g.DrawString( - m_app_name, - new Font( "Century Gorhic", 24, FontStyle.Bold ), - new SolidBrush( m_app_name_color ), - new PointF( 20, 110 ) ); - g.DrawString( - "version " + m_version, - new Font( "Arial", 10 ), - new SolidBrush( m_version_color ), - new PointF( 25, 150 ) ); - } + paint( new Graphics2D( e.Graphics ) ); } catch ( Exception ex ) { #if DEBUG Console.WriteLine( "VersionInfoEx_Paint" ); @@ -245,19 +200,57 @@ namespace Boare.Lib.AppUtil { } } - private void VersionInfoEx_KeyDown( object sender, KeyEventArgs e ) { - if ( (e.KeyCode & Keys.Escape) == Keys.Escape ) { - this.DialogResult = DialogResult.Cancel; + public void paint( Graphics g1 ) { + Graphics2D g = (Graphics2D)g1; + g.clipRect( 0, 0, this.Width, m_height ); + g.clearRect( 0, 0, this.Width, this.Height ); + if ( m_credit_mode ) { + float times = (float)(((DateTime.Now).Subtract( m_scroll_started )).TotalSeconds) - 3f; + float speed = (float)((2.0 - bocoree.math.erfcc( times * 0.8 )) / 2.0) * m_speed; + float dt = times - m_last_t; + m_shift += (speed + m_last_speed) * dt / 2f; + m_last_t = times; + m_last_speed = speed; + float dx = (this.Width - m_scroll.getWidth( null )) * 0.5f; + if ( m_scroll != null ) { + g.drawImage( m_scroll, (int)dx, (int)(90f - m_shift), null ); + if ( 90f - m_shift + m_scroll.getHeight( null ) < 0 ) { + m_shift = -m_height * 1.5f; + } + } + int grad_height = 60; + Rectangle top = new Rectangle( 0, 0, this.Width, grad_height ); + /*using ( LinearGradientBrush lgb = new LinearGradientBrush( top, Color.White, Color.Transparent, LinearGradientMode.Vertical ) ) { + g.FillRectangle( lgb, top ); + }*/ + Rectangle bottom = new Rectangle( 0, m_height - grad_height, this.Width, grad_height ); + g.clipRect( 0, m_height - grad_height + 1, this.Width, grad_height - 1 ); + /*using ( LinearGradientBrush lgb = new LinearGradientBrush( bottom, Color.Transparent, Color.White, LinearGradientMode.Vertical ) ) { + g.FillRectangle( lgb, bottom ); + }*/ + g.setClip( null ); + } else { + g.setFont( new Font( "Century Gorhic", java.awt.Font.BOLD, 24 ) ); + g.setColor( m_app_name_color ); + g.drawString( m_app_name, 20, 110 ); + g.setFont( new Font( "Arial", 0, 10 ) ); + g.drawString( "version " + m_version, 25, 150 ); + } + } + + private void VersionInfoEx_KeyDown( object sender, System.Windows.Forms.KeyEventArgs e ) { + if ( (e.KeyCode & System.Windows.Forms.Keys.Escape) == System.Windows.Forms.Keys.Escape ) { + this.DialogResult = System.Windows.Forms.DialogResult.Cancel; this.Close(); } } private void VersionInfoEx_FontChanged( object sender, EventArgs e ) { - Font font = this.Font; for ( int i = 0; i < this.Controls.Count; i++ ) { - Misc.ApplyFontRecurse( this.Controls[i], font ); + Util.applyFontRecurse( this.Controls[i], new java.awt.Font( this.Font ) ); } } } } +#endif diff --git a/trunk/Boare.Lib.Media/AviReader.cs b/trunk/Boare.Lib.Media/AviReader.cs index 05312a6..7af83c4 100644 --- a/trunk/Boare.Lib.Media/AviReader.cs +++ b/trunk/Boare.Lib.Media/AviReader.cs @@ -82,7 +82,7 @@ namespace Boare.Lib.Media { //Open the file int result = VFW.AVIFileOpenW( ref aviFile, fileName, - (int)windows.OF_SHARE_DENY_WRITE, 0 ); + (int)win32.OF_SHARE_DENY_WRITE, 0 ); if ( result != 0 ) { throw new Exception( "Exception in AVIFileOpen: " + result.ToString() ); diff --git a/trunk/Boare.Lib.Media/BSoundPlayer.cs b/trunk/Boare.Lib.Media/BSoundPlayer.cs new file mode 100644 index 0000000..232e531 --- /dev/null +++ b/trunk/Boare.Lib.Media/BSoundPlayer.cs @@ -0,0 +1,131 @@ +#if JAVA +package org.kbinani.media; + +import java.io.*; +import javax.sound.sampled.*; + +public class BSoundPlayer{ + private static final int BUFLEN = 128000; + private AudioInputStream m_stream = null; + private boolean m_stop_required = false; + private boolean m_playing = false; + private String m_sound_location = ""; + + public BSoundPlayer( String sound_location ){ + setSoundLocation( sound_location ); + } + + public BSoundPlayer(){ + } + + public String getSoundLocation(){ + return m_sound_location; + } + + public void setSoundLocation( String value ){ + stop(); + m_sound_location = value; + if( m_stream != null ){ + try{ + m_stream.close(); + }catch( Exception ex0 ){ + System.err.println( "BSoundPlayer#setSoundLocation; ex0=" + ex0 ); + } + } + try { + File sound_file = new File( m_sound_location ); + m_stream = AudioSystem.getAudioInputStream( sound_file ); + }catch( Exception ex ){ + System.err.println( "BSoundPlayer#.ctor; ex=" + ex ); + } + } + + public void play(){ + try{ + Thread t = new Thread( new PlaySoundRunner() ); + t.start(); + t.join(); + }catch( Exception ex ){ + System.out.println( "BSoundPlayer#play; ex=" + ex ); + } + } + + public void stop(){ + if( m_playing ){ + try{ + m_stop_required = true; + while( m_playing ){ + Thread.sleep( 0 ); + } + m_stop_required = false; + }catch( Exception ex ){ + System.err.println( "BSoundPlayer#stop; ex=" + ex ); + } + } + } + + public class PlaySoundRunner implements Runnable{ + public void run(){ + SourceDataLine line = null; + m_playing = true; + try{ + AudioFormat audioFormat = m_stream.getFormat(); + + DataLine.Info info = new DataLine.Info( SourceDataLine.class, audioFormat ); + line = (SourceDataLine)AudioSystem.getLine( info ); + line.open( audioFormat ); + line.start(); + + int len = 1; + byte[] buf = new byte[BUFLEN]; + while( len > 0 && !m_stop_required ){ + len = m_stream.read( buf, 0, buf.length ); + if( len >= 0 ){ + int nBytesWritten = line.write( buf, 0, len ); + }else{ + break; + } + } + } catch( Exception ex ){ + System.err.println( "BSoundPlayer.PlaySoundRunner#run; ex=" + ex ); + } finally { + if( line != null ){ + try{ + line.drain(); + line.close(); + }catch( Exception ex2 ){ + System.err.println( "BSoundPlayer.PlaySoundRunner#run; ex2=" + ex2 ); + } + } + } + m_playing = false; + } + } +} +#else +namespace Boare.Lib.Media { + + public class BSoundPlayer : System.Media.SoundPlayer { + public BSoundPlayer( string sound_location ) + : base( sound_location ) { + } + + public BSoundPlayer() + : base() { + } + + public void play() { + base.Play(); + } + + public string getSoundLocation() { + return base.SoundLocation; + } + + public void setSoundLocation( string value ) { + base.SoundLocation = value; + } + } + +} +#endif diff --git a/trunk/Boare.Lib.Media/Boare.Lib.Media.csproj b/trunk/Boare.Lib.Media/Boare.Lib.Media.csproj index 9e0ac18..d19e9bb 100644 --- a/trunk/Boare.Lib.Media/Boare.Lib.Media.csproj +++ b/trunk/Boare.Lib.Media/Boare.Lib.Media.csproj @@ -2,7 +2,7 @@ Debug AnyCPU - 9.0.21022 + 9.0.30729 2.0 {F4F8F601-4E3D-43F5-A8A8-AA1FB7F48452} Library @@ -63,6 +63,9 @@ + + Component + diff --git a/trunk/Boare.Lib.Media/MediaPlayer.cs b/trunk/Boare.Lib.Media/MediaPlayer.cs index fd20f96..a11314f 100644 --- a/trunk/Boare.Lib.Media/MediaPlayer.cs +++ b/trunk/Boare.Lib.Media/MediaPlayer.cs @@ -229,7 +229,7 @@ namespace Boare.Lib.Media { Close(); } this.m_filename = filename; - m_alias = bocoree.misc.getmd5( m_filename ); + m_alias = bocoree.Misc.getmd5( m_filename ); #if DEBUG Console.WriteLine( " m_alias=" + m_alias ); #endif diff --git a/trunk/Boare.Lib.Media/MidiInDevice.cs b/trunk/Boare.Lib.Media/MidiInDevice.cs index aca1e56..d86458e 100644 --- a/trunk/Boare.Lib.Media/MidiInDevice.cs +++ b/trunk/Boare.Lib.Media/MidiInDevice.cs @@ -11,15 +11,21 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */ -using System; -using System.Runtime.InteropServices; -using System.Collections.Generic; +#if JAVA +package org.kbinani.media; +public class MidiInDevice{ + +} +#else +using System; +using System.Collections.Generic; +using System.Runtime.InteropServices; using bocoree; namespace Boare.Lib.Media { - public delegate void MidiReceivedEventHandler( DateTime time, byte[] data ); + public delegate void MidiReceivedEventHandler( double time, byte[] data ); public class MidiInDevice : IDisposable { delegate void MidiInProcDelegate( uint hMidiIn, uint wMsg, int dwInstance, int dwParam1, int dwParam2 ); @@ -35,13 +41,13 @@ namespace Boare.Lib.Media { m_port_number = port_number; m_delegate = new MidiInProcDelegate( MidiInProc ); m_delegate_pointer = Marshal.GetFunctionPointerForDelegate( m_delegate ); - windows.midiInOpen( ref m_hmidiin, port_number, m_delegate_pointer, 0, windows.CALLBACK_FUNCTION ); + win32.midiInOpen( ref m_hmidiin, port_number, m_delegate_pointer, 0, win32.CALLBACK_FUNCTION ); } public void Start() { if ( m_hmidiin > 0 ) { try { - windows.midiInStart( m_hmidiin ); + win32.midiInStart( m_hmidiin ); } catch ( Exception ex ) { debug.push_log( "MidiInDevice.Start" ); debug.push_log( " ex=" + ex ); @@ -52,7 +58,7 @@ namespace Boare.Lib.Media { public void Stop() { if ( m_hmidiin > 0 ) { try { - windows.midiInReset( m_hmidiin ); + win32.midiInReset( m_hmidiin ); } catch ( Exception ex ) { debug.push_log( "MidiInDevice.Stop" ); debug.push_log( " ex=" + ex ); @@ -63,7 +69,7 @@ namespace Boare.Lib.Media { public void Close() { if ( m_hmidiin > 0 ) { try { - windows.midiInClose( m_hmidiin ); + win32.midiInClose( m_hmidiin ); } catch ( Exception ex ) { debug.push_log( "MidiInDevice.Close" ); debug.push_log( " ex=" + ex ); @@ -78,7 +84,7 @@ namespace Boare.Lib.Media { public static int GetNumDevs() { try { - int i = (int)windows.midiInGetNumDevs(); + int i = (int)win32.midiInGetNumDevs(); return i; } catch ( Exception ex ) { debug.push_log( "MidiInDevice.GetNumDevs" ); @@ -91,13 +97,13 @@ namespace Boare.Lib.Media { List ret = new List(); uint num = 0; try { - num = windows.midiInGetNumDevs(); + num = win32.midiInGetNumDevs(); } catch { num = 0; } for ( uint i = 0; i < num; i++ ) { MIDIINCAPS m = new MIDIINCAPS(); - uint r = windows.midiInGetDevCaps( i, ref m, (uint)Marshal.SizeOf( m ) ); + uint r = win32.midiInGetDevCaps( i, ref m, (uint)Marshal.SizeOf( m ) ); ret.Add( m ); } return ret.ToArray(); @@ -106,13 +112,13 @@ namespace Boare.Lib.Media { public void MidiInProc( uint hMidiIn, uint wMsg, int dwInstance, int dwParam1, int dwParam2 ) { try { switch ( wMsg ) { - case windows.MM_MIM_OPEN: + case win32.MM_MIM_OPEN: return; - case windows.MM_MIM_CLOSE: + case win32.MM_MIM_CLOSE: return; - case windows.MM_MIM_DATA: + case win32.MM_MIM_DATA: int receive = dwParam1; - DateTime now = DateTime.Now; + double now = PortUtil.getCurrentTime(); switch ( receive & 0xF0 ) { case 0x80: case 0x90: @@ -134,11 +140,11 @@ namespace Boare.Lib.Media { break; } return; - case windows.MM_MIM_LONGDATA: + case win32.MM_MIM_LONGDATA: return; - case windows.MM_MIM_ERROR: + case win32.MM_MIM_ERROR: return; - case windows.MM_MIM_LONGERROR: + case win32.MM_MIM_LONGERROR: return; } } catch ( Exception ex ) { @@ -149,3 +155,4 @@ namespace Boare.Lib.Media { } } +#endif diff --git a/trunk/Boare.Lib.Media/MidiOutDevice.cs b/trunk/Boare.Lib.Media/MidiOutDevice.cs index a57c84f..705526c 100644 --- a/trunk/Boare.Lib.Media/MidiOutDevice.cs +++ b/trunk/Boare.Lib.Media/MidiOutDevice.cs @@ -25,12 +25,12 @@ namespace Boare.Lib.Media { public MidiOutDevice( uint device_id ) { m_device_id = device_id; - windows.midiOutOpen( ref m_handle, m_device_id, null, 0, windows.CALLBACK_NULL ); + win32.midiOutOpen( ref m_handle, m_device_id, null, 0, win32.CALLBACK_NULL ); } public void Close() { if ( !m_handle.Equals( IntPtr.Zero ) ) { - windows.midiOutClose( m_handle ); + win32.midiOutClose( m_handle ); } } @@ -55,7 +55,7 @@ namespace Boare.Lib.Media { for ( int i = 0; i < data.Length; i++ ) { message |= ((uint)data[i]) << (i * 8); } - windows.midiOutShortMsg( m_handle, message ); + win32.midiOutShortMsg( m_handle, message ); } private void SendLong( byte[] data ) { @@ -66,15 +66,15 @@ namespace Boare.Lib.Media { hdr.lpData = (byte*)dataHandle.AddrOfPinnedObject().ToPointer(); hdr.dwBufferLength = (uint)data.Length; hdr.dwFlags = 0; - windows.midiOutPrepareHeader( m_handle, ref hdr, size ); - while ( (hdr.dwFlags & windows.WHDR_PREPARED) != windows.WHDR_PREPARED ) { + win32.midiOutPrepareHeader( m_handle, ref hdr, size ); + while ( (hdr.dwFlags & win32.WHDR_PREPARED) != win32.WHDR_PREPARED ) { Application.DoEvents(); } - windows.midiOutLongMsg( m_handle, ref hdr, size ); - while ( (hdr.dwFlags & windows.WHDR_DONE) != windows.WHDR_DONE ) { + win32.midiOutLongMsg( m_handle, ref hdr, size ); + while ( (hdr.dwFlags & win32.WHDR_DONE) != win32.WHDR_DONE ) { Application.DoEvents(); } - windows.midiOutUnprepareHeader( m_handle, ref hdr, size ); + win32.midiOutUnprepareHeader( m_handle, ref hdr, size ); } finally { dataHandle.Free(); } diff --git a/trunk/Boare.Lib.Media/Wave.cs b/trunk/Boare.Lib.Media/Wave.cs index 5de0197..6fdbe00 100644 --- a/trunk/Boare.Lib.Media/Wave.cs +++ b/trunk/Boare.Lib.Media/Wave.cs @@ -11,24 +11,22 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */ -using System; -using System.IO; -using System.Collections.Generic; +#if JAVA +package org.kbinani.media; +import java.io.*; +import org.kbinani.*; +#else +using System; +using System.Collections.Generic; using bocoree; +using bocoree.java.io; namespace Boare.Lib.Media { + using boolean = System.Boolean; +#endif - public enum Channel { - Right, - Left, - } - - public enum WaveChannel : int { - Monoral = 1, - Stereo = 2 - } - +#if !JAVA /// /// Parameters of first formanto detection algorithm /// @@ -62,21 +60,37 @@ namespace Boare.Lib.Media { } } } +#endif + +#if JAVA + public class Wave +#else + public class Wave : IDisposable +#endif + { + public enum Channel { + Right, + Left, + } + + public enum WaveChannel { + Monoral, + Stereo + } - public class Wave : IDisposable { private WaveChannel m_channel; - private ushort m_bit_per_sample; - private uint m_sample_rate; - private uint m_total_samples; + private int m_bit_per_sample; + private long m_sample_rate; + private long m_total_samples; private byte[] L8; private byte[] R8; private short[] L16; private short[] R16; - //public void +#if !JAVA #if DEBUG - private static bool s_test = false; - public static bool TestEnabled { + private static boolean s_test = false; + public static boolean TestEnabled { get { return s_test; } @@ -85,14 +99,28 @@ namespace Boare.Lib.Media { } } #endif +#endif + +#if !JAVA public unsafe double TEST_GetF0( uint time, double[] window_function ) { int window_size = window_function.Length; double[] formanto = GetFormanto( time, window_function ); #if DEBUG if ( s_test ) { - using ( StreamWriter sw = new StreamWriter( @"C:\TEST_GetF0_formanto.txt" ) ) { + BufferedWriter sw = null; + try { + sw = new BufferedWriter( new FileWriter( @"C:\TEST_GetF0_formanto.txt" ) ); for ( int i = 0; i < formanto.Length; i++ ) { - sw.WriteLine( Math.Abs( formanto[i] ) ); + sw.write( Math.Abs( formanto[i] ) + "" ); + sw.newLine(); + } + } catch ( Exception ex ) { + } finally { + if ( sw != null ) { + try { + sw.close(); + } catch ( Exception ex2 ) { + } } } } @@ -114,27 +142,42 @@ namespace Boare.Lib.Media { } #if DEBUG if ( s_test ) { - using ( StreamWriter sw = new StreamWriter( @"C:\TEST_GetF0_fft_formanto.txt" ) ) { + BufferedWriter sw = null; + try { + sw = new BufferedWriter( new FileWriter( @"C:\TEST_GetF0_fft_formanto.txt" ) ); for ( int i = 0; i < wv.Length; i++ ) { - sw.WriteLine( Math.Abs( wv[i] ) ); + sw.write( Math.Abs( wv[i] ) + "" ); + sw.newLine(); + } + } catch ( Exception ex ) { + } finally { + if ( sw != null ) { + try { + sw.close(); + } catch { + } } } } #endif return 0; } +#endif +#if !JAVA public double GetF0( uint time, double[] window_function ) { return GetF0( time, window_function, new FormantoDetectionArguments() ); } +#endif +#if !JAVA /// /// 第timeサンプルにおけるフォルマントを取得する /// /// /// /// - public double GetF0( uint time, double[] window_function, FormantoDetectionArguments argument ) { + public double GetF0( uint time, double[] window_function, FormantoDetectionArguments argument ) { int window_size = window_function.Length; double[] formanto = GetFormanto( time, window_function ); int length = formanto.Length; @@ -152,9 +195,20 @@ namespace Boare.Lib.Media { #if DEBUG Console.WriteLine( "Wave+GetF0" ); if ( s_test ) { - using ( StreamWriter sw = new StreamWriter( "formanto.txt" ) ) { + BufferedWriter sw = null; + try { + sw = new BufferedWriter( new FileWriter( "formanto.txt" ) ); for ( int i = 0; i < length; i++ ) { - sw.WriteLine( (i * hz_from_index) + "\t" + formanto[i] ); + sw.write( (i * hz_from_index) + "\t" + formanto[i] ); + sw.newLine(); + } + } catch ( Exception ex ) { + } finally { + if ( sw != null ) { + try { + sw.close(); + } catch ( Exception ex2 ) { + } } } } @@ -182,9 +236,20 @@ namespace Boare.Lib.Media { } #if DEBUG if ( s_test ) { - using ( StreamWriter sw = new StreamWriter( "ma.txt" ) ) { + BufferedWriter sw = null; + try { + sw = new BufferedWriter( new FileWriter( "ma.txt" ) ); for ( int i = 0; i < length; i++ ) { - sw.WriteLine( (i * hz_from_index) + "\t" + ma[i] ); + sw.write( (i * hz_from_index) + "\t" + ma[i] ); + sw.newLine(); + } + } catch ( Exception ex ) { + } finally { + if ( sw != null ) { + try { + sw.close(); + } catch ( Exception ex2 ) { + } } } } @@ -194,7 +259,7 @@ namespace Boare.Lib.Media { double last_slope = 0.0; int index = -1; List peak_positions = new List(); - bool first = true; + boolean first = true; for ( int i = 1; i < window_size - 1; i++ ) { double slope = ma[i + 1] - ma[i - 1]; if ( ma[i] > threshold && slope <= 0.0 && 0.0 < last_slope ) { @@ -209,9 +274,20 @@ namespace Boare.Lib.Media { } #if DEBUG if ( s_test ) { - using ( StreamWriter sw = new StreamWriter( "peak_positions.txt" ) ) { + BufferedWriter sw = null; + try { + sw = new BufferedWriter( new FileWriter( "peak_positions.txt" ) ); for ( int i = 0; i < peak_positions.Count; i++ ) { - sw.WriteLine( peak_positions[i].ToString() ); + sw.write( peak_positions[i].ToString() ); + sw.newLine(); + } + } catch ( Exception ex ) { + } finally { + if ( sw != null ) { + try { + sw.close(); + } catch ( Exception ex2 ) { + } } } } @@ -229,9 +305,20 @@ namespace Boare.Lib.Media { } #if DEBUG if ( s_test ) { - using ( StreamWriter sw = new StreamWriter( "peaks.txt" ) ) { + BufferedWriter sw = null; + try { + sw = new BufferedWriter( new FileWriter( "peaks.txt" ) ); for ( int i = 0; i < peaks.Count; i++ ) { - sw.WriteLine( peaks[i] ); + sw.write( peaks[i] + "" ); + sw.newLine(); + } + } catch ( Exception ex ) { + } finally { + if ( sw != null ) { + try { + sw.close(); + } catch ( Exception ex2 ) { + } } } } @@ -243,9 +330,20 @@ namespace Boare.Lib.Media { #if DEBUG Console.WriteLine( "min_peak_distance=" + min_peak_distance ); if ( s_test ) { - using ( StreamWriter sw = new StreamWriter( "evaluation.txt" ) ) { + BufferedWriter sw = null; + try { + sw = new BufferedWriter( new FileWriter( "evaluation.txt" ) ); for ( int i = (int)min_peak_distance; i < (int)(4 * min_peak_distance); i++ ) { - sw.WriteLine( i + "\t" + GetFormantoGetEvaluationValue( peaks, i ) ); + sw.write( i + "\t" + GetFormantoGetEvaluationValue( peaks, i ) ); + sw.newLine(); + } + } catch ( Exception ex ) { + } finally { + if ( sw != null ) { + try { + sw.close(); + } catch ( Exception ex2 ) { + } } } } @@ -264,7 +362,9 @@ namespace Boare.Lib.Media { return 0; } } +#endif +#if !JAVA private static double GetFormantoGetEvaluationValue( List peaks, double t ) { double ret = 0.0; for ( int i = 0; i < peaks.Count; i++ ) { @@ -274,36 +374,9 @@ namespace Boare.Lib.Media { } return ret / t; } +#endif - /*public unsafe double[,] GetFormanto( uint time, uint count, double[] window_function ) { - int size = window_function.Length; - double[] buffer = new double[size]; // 波形のバッファ - int nmaxsqrt = (int)Math.Sqrt( size ); - int[] ip_ = new int[nmaxsqrt + 2]; - double[] w_ = new double[size * 5 / 4]; - ip_[0] = 0; - - double[,] ret = new double[count, size]; - - for ( uint j = time; j < time + count; j++ ) { - GetNormalizedWave( (uint)(time - size / 2), ref buffer ); - // 窓関数をかける - for ( int i = 0; i < size; i++ ) { - buffer[i] *= window_function[i]; - } - - fixed ( int* ip = &ip_[0] ) - fixed ( double* w = &w_[0] ) - fixed ( double* a = &buffer[0] ) { - fft.rdft( size, 1, a, ip, w ); - } - for ( int i = 0; i < size; i++ ) { - ret[j - time, i] = buffer[i]; - } - } - return ret; - }*/ - +#if !JAVA /// /// 第timeサンプルにおけるフォルマントを取得する /// @@ -312,7 +385,7 @@ namespace Boare.Lib.Media { /// public unsafe double[] GetFormanto( uint time, double[] window_function ) { int size = window_function.Length; - double[] wv = GetNormalizedWave( (int)(time - size / 2), (uint)(size + 1) ); + double[] wv = getNormalizedWave( (int)(time - size / 2), (uint)(size + 1) ); // 窓関数をかける for ( int i = 0; i < size; i++ ) { wv[i] = wv[i] * window_function[i]; @@ -329,20 +402,22 @@ namespace Boare.Lib.Media { } return wv; } +#endif - +#if !JAVA public double GetVolume( int start_sample, double[] window_function ) { int window_size = window_function.Length; double[] conv = new double[window_size]; - GetNormalizedWave( start_sample - window_size / 2, ref conv ); + getNormalizedWave( start_sample - window_size / 2, conv ); double ret = 0.0; for ( int i = 0; i < window_size; i++ ) { ret += Math.Abs( conv[i] ) * window_function[i]; } return ret / (double)window_size; } +#endif - +#if !JAVA /// /// 指定したサンプル位置における音量を計算します /// @@ -352,7 +427,7 @@ namespace Boare.Lib.Media { /// public double GetVolume( int start_sample, int window_size, math.WindowFunctionType window_function_type ) { double[] conv = new double[window_size]; - GetNormalizedWave( start_sample - window_size / 2, ref conv ); + getNormalizedWave( start_sample - window_size / 2, conv ); double ret = 0.0; for ( int i = 0; i < window_size; i++ ) { double x = i / (double)window_size; @@ -360,8 +435,9 @@ namespace Boare.Lib.Media { } return ret / (double)window_size; } +#endif - +#if !JAVA /// /// 音量の時間変化を取得します /// @@ -370,7 +446,7 @@ namespace Boare.Lib.Media { /// 解像度(サンプル数) /// public double[] GetVolume( int window_size, math.WindowFunctionType window_function_type ) { - double[] conv = GetNormalizedWave(); + double[] conv = getNormalizedWave(); for ( int i = 0; i < conv.Length; i++ ) { conv[i] = Math.Abs( conv[i] ); } @@ -380,7 +456,7 @@ namespace Boare.Lib.Media { double x = i / (double)window_size; w[i] = math.window_func( window_function_type, x ); } - double[] ret = new double[m_total_samples]; + double[] ret = new double[(int)m_total_samples]; double inv = 1.0 / (double)window_size; int ws2 = window_size / 2; for ( int i = 0; i < m_total_samples; i++ ) { @@ -404,9 +480,9 @@ namespace Boare.Lib.Media { } return ret; } +#endif - - public void GetNormalizedWave( int start_index, ref double[] conv ) { + public void getNormalizedWave( int start_index, double[] conv ) { int count = conv.Length; int cp_start = start_index; int cp_end = start_index + count; @@ -428,99 +504,77 @@ namespace Boare.Lib.Media { conv[i - start_index] = (L8[i] - 64.0) / 64.0; } } else { - for (int i = cp_start; i < cp_end; i++ ) { + for ( int i = cp_start; i < cp_end; i++ ) { conv[i - start_index] = L16[i] / 32768.0; } } } else { if ( m_bit_per_sample == 8 ) { - for (int i = cp_start; i < cp_end; i++ ) { + for ( int i = cp_start; i < cp_end; i++ ) { conv[i - start_index] = ((L8[i] + R8[i]) * 0.5 - 64.0) / 64.0; } } else { - for (int i = cp_start; i < cp_end; i++ ) { + for ( int i = cp_start; i < cp_end; i++ ) { conv[i - start_index] = (L16[i] + R16[i]) * 0.5 / 32768.0; } } } } - - public double[] GetNormalizedWave() { - return GetNormalizedWave( 0, m_total_samples ); + public double[] getNormalizedWave() { + return getNormalizedWave( 0, m_total_samples ); } - - /// /// -1から1までに規格化された波形を取得します /// /// - public double[] GetNormalizedWave( int start_index, uint count ) { - double[] conv = new double[count]; - GetNormalizedWave( start_index, ref conv ); + public double[] getNormalizedWave( int start_index, long count ) { + double[] conv = new double[(int)count]; + getNormalizedWave( start_index, conv ); return conv; } - - public int this[int index, Channel channel] { - get { - if ( m_channel == WaveChannel.Monoral || channel == Channel.Left ) { - if ( m_bit_per_sample == 8 ) { - return L8[index]; - } else { - return L16[index]; - } + private void set( int index, Channel channel, int value ) { + if ( m_channel == WaveChannel.Monoral || channel == Channel.Left ) { + if ( m_bit_per_sample == 8 ) { + L8[index] = (byte)value; } else { - if ( m_bit_per_sample == 8 ) { - return R8[index]; - } else { - return R16[index]; - } + L16[index] = (short)value; } - } - set { - if ( m_channel == WaveChannel.Monoral || channel == Channel.Left ) { - if ( m_bit_per_sample == 8 ) { - L8[index] = (byte)value; - } else { - L16[index] = (short)value; - } + } else { + if ( m_bit_per_sample == 8 ) { + R8[index] = (byte)value; } else { - if ( m_bit_per_sample == 8 ) { - R8[index] = (byte)value; - } else { - R16[index] = (short)value; - } + R16[index] = (short)value; } } } - - public int this[int index] { - get { + private int get( int index, Channel channel ) { + if ( m_channel == WaveChannel.Monoral || channel == Channel.Left ) { if ( m_bit_per_sample == 8 ) { return L8[index]; } else { return L16[index]; } - } - set { + } else { if ( m_bit_per_sample == 8 ) { - L8[index] = (byte)value; - if ( m_channel == WaveChannel.Stereo ) { - R8[index] = (byte)value; - } + return R8[index]; } else { - L16[index] = (short)value; - if ( m_channel == WaveChannel.Stereo ) { - R16[index] = (short)value; - } + return R16[index]; } } } - public double Get( int index ) { + private void set( int index, int value ) { + set( index, Channel.Left, value ); + if ( m_channel == WaveChannel.Stereo ) { + set( index, Channel.Right, value ); + } + } + + public double getDouble( int index ) { if ( m_channel == WaveChannel.Monoral ) { if ( m_bit_per_sample == 8 ) { return (L8[index] - 64.0) / 64.0; @@ -536,57 +590,52 @@ namespace Boare.Lib.Media { } } - public uint SampleRate { - get { - return m_sample_rate; - } + public long getSampleRate() { + return m_sample_rate; } - - public uint TotalSamples { - get { - return m_total_samples; - } - set { - m_total_samples = value; - if ( m_channel == WaveChannel.Monoral ) { - if ( m_bit_per_sample == 8 ) { - if ( L8 == null ) { - L8 = new byte[m_total_samples]; - } else { - Array.Resize( ref L8, (int)m_total_samples ); - } + private void setTotalSamples( long value ) { + m_total_samples = value; + if ( m_channel == WaveChannel.Monoral ) { + if ( m_bit_per_sample == 8 ) { + if ( L8 == null ) { + L8 = new byte[(int)m_total_samples]; } else { - if ( L16 == null ) { - L16 = new short[m_total_samples]; - } else { - Array.Resize( ref L16, (int)m_total_samples ); - } + L8 = resizeArray( L8, (int)m_total_samples ); } } else { - if ( m_bit_per_sample == 8 ) { - if ( L8 == null ) { - L8 = new byte[m_total_samples]; - R8 = new byte[m_total_samples]; - } else { - Array.Resize( ref L8, (int)m_total_samples ); - Array.Resize( ref R8, (int)m_total_samples ); - } + if ( L16 == null ) { + L16 = new short[(int)m_total_samples]; } else { - if ( L16 == null ) { - L16 = new short[m_total_samples]; - R16 = new short[m_total_samples]; - } else { - Array.Resize( ref L16, (int)m_total_samples ); - Array.Resize( ref R16, (int)m_total_samples ); - } + L16 = resizeArray( L16, (int)m_total_samples ); + } + } + } else { + if ( m_bit_per_sample == 8 ) { + if ( L8 == null ) { + L8 = new byte[(int)m_total_samples]; + R8 = new byte[(int)m_total_samples]; + } else { + L8 = resizeArray( L8, (int)m_total_samples ); + R8 = resizeArray( R8, (int)m_total_samples ); + } + } else { + if ( L16 == null ) { + L16 = new short[(int)m_total_samples]; + R16 = new short[(int)m_total_samples]; + } else { + L16 = resizeArray( L16, (int)m_total_samples ); + R16 = resizeArray( R16, (int)m_total_samples ); } } } } + public long getTotalSamples() { + return m_total_samples; + } - public void Replace( Wave srcWave, uint srcStart, uint destStart, uint count ) { + public void replace( Wave srcWave, int srcStart, int destStart, int count ) { #if DEBUG Console.WriteLine( "Wave.Replace(Wave,uint,uint,uint)" ); #endif @@ -615,51 +664,51 @@ namespace Boare.Lib.Media { } } - count = (count > srcWave.TotalSamples - srcStart) ? srcWave.TotalSamples - srcStart : count; - uint new_last_index = destStart + count; + count = (int)((count > srcWave.getTotalSamples() - srcStart) ? srcWave.getTotalSamples() - srcStart : count); + long new_last_index = destStart + count; if ( m_total_samples < new_last_index ) { if ( m_channel == WaveChannel.Monoral ) { if ( m_bit_per_sample == 8 ) { - Array.Resize( ref L8, (int)new_last_index ); + L8 = resizeArray( L8, (int)new_last_index ); } else { - Array.Resize( ref L16, (int)new_last_index ); + L16 = resizeArray( L16, (int)new_last_index ); } } else { if ( m_bit_per_sample == 8 ) { - Array.Resize( ref L8, (int)new_last_index ); - Array.Resize( ref R8, (int)new_last_index ); + L8 = resizeArray( L8, (int)new_last_index ); + R8 = resizeArray( R8, (int)new_last_index ); } else { - Array.Resize( ref L16, (int)new_last_index ); - Array.Resize( ref R16, (int)new_last_index ); + L16 = resizeArray( L16, (int)new_last_index ); + R16 = resizeArray( R16, (int)new_last_index ); } } m_total_samples = new_last_index; } if ( m_channel == WaveChannel.Monoral ) { if ( m_bit_per_sample == 8 ) { - Array.Copy( srcWave.L8, srcStart, L8, destStart, count ); + copyArray( srcWave.L8, srcStart, L8, destStart, count ); } else { - Array.Copy( srcWave.L16, srcStart, L16, destStart, count ); + copyArray( srcWave.L16, srcStart, L16, destStart, count ); } } else { if ( m_bit_per_sample == 8 ) { - Array.Copy( srcWave.L8, srcStart, L8, destStart, count ); - Array.Copy( srcWave.R8, srcStart, R8, destStart, count ); + copyArray( srcWave.L8, srcStart, L8, destStart, count ); + copyArray( srcWave.R8, srcStart, R8, destStart, count ); } else { - Array.Copy( srcWave.L16, srcStart, L16, destStart, count ); - Array.Copy( srcWave.R16, srcStart, R16, destStart, count ); + copyArray( srcWave.L16, srcStart, L16, destStart, count ); + copyArray( srcWave.R16, srcStart, R16, destStart, count ); } } } - public void Replace( byte[] data, uint start_index ) { + public void replace( byte[] data, int start_index ) { if ( m_channel != WaveChannel.Monoral || m_bit_per_sample != 8 || L8 == null ) { return; } - uint new_last_index = (uint)(start_index + data.Length); + long new_last_index = (long)(start_index + data.Length); if ( m_total_samples < new_last_index ) { - Array.Resize( ref L8, (int)new_last_index ); + L8 = resizeArray( L8, (int)new_last_index ); m_total_samples = new_last_index; } for ( int i = 0; i < data.Length; i++ ) { @@ -668,13 +717,13 @@ namespace Boare.Lib.Media { } - public void Replace( short[] data, uint start_index ) { + public void replace( short[] data, int start_index ) { if ( m_channel != WaveChannel.Monoral || m_bit_per_sample != 16 || L16 == null ) { return; } - uint new_last_index = (uint)(start_index + data.Length); + long new_last_index = (long)(start_index + data.Length); if ( m_total_samples < new_last_index ) { - Array.Resize( ref L16, (int)new_last_index ); + L16 = resizeArray( L16, (int)new_last_index ); m_total_samples = new_last_index; } for ( int i = 0; i < data.Length; i++ ) { @@ -683,14 +732,14 @@ namespace Boare.Lib.Media { } - public void Replace( byte[] left, byte[] right, uint start_index ) { + public void replace( byte[] left, byte[] right, int start_index ) { if ( m_channel != WaveChannel.Stereo || m_bit_per_sample != 8 || L8 == null || R8 == null ) { return; } - uint new_last_index = (uint)(start_index + left.Length); + long new_last_index = (long)(start_index + left.Length); if ( m_total_samples < new_last_index ) { - Array.Resize( ref L8, (int)new_last_index ); - Array.Resize( ref R8, (int)new_last_index ); + L8 = resizeArray( L8, (int)new_last_index ); + R8 = resizeArray( R8, (int)new_last_index ); m_total_samples = new_last_index; } for ( int i = 0; i < left.Length; i++ ) { @@ -700,14 +749,14 @@ namespace Boare.Lib.Media { } - public void Replace( short[] left, short[] right, uint start_index ) { + public void replace( short[] left, short[] right, int start_index ) { if ( m_channel != WaveChannel.Stereo || m_bit_per_sample != 16 || L16 == null || R16 == null ) { return; } - uint new_last_index = (uint)(start_index + left.Length); + long new_last_index = (long)(start_index + left.Length); if ( m_total_samples < new_last_index ) { - Array.Resize( ref L16, (int)new_last_index ); - Array.Resize( ref R16, (int)new_last_index ); + L16 = resizeArray( L16, (int)new_last_index ); + R16 = resizeArray( R16, (int)new_last_index ); m_total_samples = new_last_index; } for ( int i = 0; i < left.Length; i++ ) { @@ -716,41 +765,41 @@ namespace Boare.Lib.Media { } } - public void Replace( float[] left, float[] right, uint start_index ) { - uint new_last_index = (uint)(start_index + left.Length); + public void replace( float[] left, float[] right, int start_index ) { + long new_last_index = (long)(start_index + left.Length); if ( m_total_samples < new_last_index ) { if ( m_channel == WaveChannel.Monoral ) { if ( m_bit_per_sample == 8 ) { if ( L8 == null ) { return; } - Array.Resize( ref L8, (int)new_last_index ); + L8 = resizeArray( L8, (int)new_last_index ); } else { if ( L16 == null ) { return; } - Array.Resize( ref L16, (int)new_last_index ); + L16 = resizeArray( L16, (int)new_last_index ); } } else { if ( m_bit_per_sample == 8 ) { if ( L8 == null || R8 == null ) { return; } - Array.Resize( ref L8, (int)new_last_index ); - Array.Resize( ref R8, (int)new_last_index ); + L8 = resizeArray( L8, (int)new_last_index ); + R8 = resizeArray( R8, (int)new_last_index ); } else { if ( L16 == null || R16 == null ) { return; } - Array.Resize( ref L16, (int)new_last_index ); - Array.Resize( ref R16, (int)new_last_index ); + L16 = resizeArray( L16, (int)new_last_index ); + R16 = resizeArray( R16, (int)new_last_index ); } } m_total_samples = new_last_index; } if ( m_channel == WaveChannel.Monoral ) { float[] mono = new float[left.Length]; - for( int i = 0; i < left.Length; i++ ){ + for ( int i = 0; i < left.Length; i++ ) { mono[i] = (left[i] + right[i]) / 2f; } if ( m_bit_per_sample == 8 ) { @@ -777,29 +826,43 @@ namespace Boare.Lib.Media { } } - public void PrintToText( string path ) { - using ( StreamWriter sw = new StreamWriter( path ) ) { + public void printToText( String path ) { + BufferedWriter sw = null; + try { + sw = new BufferedWriter( new FileWriter( path ) ); if ( m_channel == WaveChannel.Monoral ) { if ( m_bit_per_sample == 8 ) { for ( int i = 0; i < m_total_samples; i++ ) { - sw.WriteLine( L8[i] ); + sw.write( L8[i] + "" ); + sw.newLine(); } } else { for ( int i = 0; i < m_total_samples; i++ ) { - sw.WriteLine( L16[i] ); + sw.write( L16[i] + "" ); + sw.newLine(); } } } else { if ( m_bit_per_sample == 8 ) { for ( int i = 0; i < m_total_samples; i++ ) { - sw.WriteLine( L8[i] + "\t" + R8[i] ); + sw.write( L8[i] + "\t" + R8[i] ); + sw.newLine(); } } else { for ( int i = 0; i < m_total_samples; i++ ) { - sw.WriteLine( L16[i] + "\t" + R16[i] ); + sw.write( L16[i] + "\t" + R16[i] ); + sw.newLine(); } } } + } catch ( Exception ex ) { + } finally { + if ( sw != null ) { + try { + sw.close(); + } catch ( Exception ex2 ) { + } + } } } @@ -808,13 +871,17 @@ namespace Boare.Lib.Media { R8 = null; L16 = null; R16 = null; +#if JAVA + System.gc(); +#else GC.Collect(); +#endif } /// /// サンプルあたりのビット数を8に変更する /// - public void ConvertTo8Bit() { + public void convertTo8Bit() { if ( m_bit_per_sample == 8 ) { return; } @@ -844,114 +911,129 @@ namespace Boare.Lib.Media { /// ファイルに保存 /// /// - public void Write( string file ) { - using ( FileStream fs = new FileStream( file, FileMode.Create ) ) { + public void write( String file ) { + RandomAccessFile fs = null; + try { + fs = new RandomAccessFile( file, "rw" ); // RIFF - fs.WriteByte( 0x52 ); - fs.WriteByte( 0x49 ); - fs.WriteByte( 0x46 ); - fs.WriteByte( 0x46 ); + fs.write( 0x52 ); + fs.write( 0x49 ); + fs.write( 0x46 ); + fs.write( 0x46 ); // ファイルサイズ - 8最後に記入 - fs.WriteByte( 0x00 ); - fs.WriteByte( 0x00 ); - fs.WriteByte( 0x00 ); - fs.WriteByte( 0x00 ); + fs.write( 0x00 ); + fs.write( 0x00 ); + fs.write( 0x00 ); + fs.write( 0x00 ); // WAVE - fs.WriteByte( 0x57 ); - fs.WriteByte( 0x41 ); - fs.WriteByte( 0x56 ); - fs.WriteByte( 0x45 ); + fs.write( 0x57 ); + fs.write( 0x41 ); + fs.write( 0x56 ); + fs.write( 0x45 ); // fmt - fs.WriteByte( 0x66 ); - fs.WriteByte( 0x6d ); - fs.WriteByte( 0x74 ); - fs.WriteByte( 0x20 ); + fs.write( 0x66 ); + fs.write( 0x6d ); + fs.write( 0x74 ); + fs.write( 0x20 ); // fmt チャンクのサイズ - fs.WriteByte( 0x12 ); - fs.WriteByte( 0x00 ); - fs.WriteByte( 0x00 ); - fs.WriteByte( 0x00 ); + fs.write( 0x12 ); + fs.write( 0x00 ); + fs.write( 0x00 ); + fs.write( 0x00 ); // format ID - fs.WriteByte( 0x01 ); - fs.WriteByte( 0x00 ); + fs.write( 0x01 ); + fs.write( 0x00 ); // チャンネル数 if ( m_channel == WaveChannel.Monoral ) { - fs.WriteByte( 0x01 ); - fs.WriteByte( 0x00 ); + fs.write( 0x01 ); + fs.write( 0x00 ); } else { - fs.WriteByte( 0x02 ); - fs.WriteByte( 0x00 ); + fs.write( 0x02 ); + fs.write( 0x00 ); } // サンプリングレート - byte[] buf = BitConverter.GetBytes( m_sample_rate ); - WriteByteArray( fs, buf, 4 ); + byte[] buf = PortUtil.getbytes_uint32_le( m_sample_rate ); + writeByteArray( fs, buf, 4 ); // データ速度 - ushort block_size = (ushort)(m_bit_per_sample / 8 * (int)m_channel); - uint data_rate = m_sample_rate * block_size; - buf = BitConverter.GetBytes( data_rate ); - WriteByteArray( fs, buf, 4 ); + int ichannel = (m_channel == WaveChannel.Monoral) ? 1 : 2; + int block_size = (int)(m_bit_per_sample / 8 * ichannel); + long data_rate = m_sample_rate * block_size; + buf = PortUtil.getbytes_uint32_le( data_rate ); + writeByteArray( fs, buf, 4 ); // ブロックサイズ - buf = BitConverter.GetBytes( block_size ); - WriteByteArray( fs, buf, 2 ); + buf = PortUtil.getbytes_uint16_le( block_size ); + writeByteArray( fs, buf, 2 ); // サンプルあたりのビット数 - buf = BitConverter.GetBytes( m_bit_per_sample ); - WriteByteArray( fs, buf, 2 ); + buf = PortUtil.getbytes_uint16_le( m_bit_per_sample ); + writeByteArray( fs, buf, 2 ); // 拡張部分 - fs.WriteByte( 0x00 ); - fs.WriteByte( 0x00 ); + fs.write( 0x00 ); + fs.write( 0x00 ); // data - fs.WriteByte( 0x64 ); - fs.WriteByte( 0x61 ); - fs.WriteByte( 0x74 ); - fs.WriteByte( 0x61 ); + fs.write( 0x64 ); + fs.write( 0x61 ); + fs.write( 0x74 ); + fs.write( 0x61 ); // size of data chunk - uint size = block_size * m_total_samples; - buf = BitConverter.GetBytes( size ); - WriteByteArray( fs, buf, 4 ); + long size = block_size * m_total_samples; + buf = PortUtil.getbytes_uint32_le( size ); + writeByteArray( fs, buf, 4 ); // 波形データ for ( int i = 0; i < m_total_samples; i++ ) { if ( m_bit_per_sample == 8 ) { - fs.WriteByte( L8[i] ); + fs.write( L8[i] ); if ( m_channel == WaveChannel.Stereo ) { - fs.WriteByte( R8[i] ); + fs.write( R8[i] ); } } else { - buf = BitConverter.GetBytes( L16[i] ); - WriteByteArray( fs, buf, 2 ); + buf = PortUtil.getbytes_int16_le( L16[i] ); + writeByteArray( fs, buf, 2 ); if ( m_channel == WaveChannel.Stereo ) { - buf = BitConverter.GetBytes( R16[i] ); - WriteByteArray( fs, buf, 2 ); + buf = PortUtil.getbytes_int16_le( R16[i] ); + writeByteArray( fs, buf, 2 ); } } } // 最後にWAVEチャンクのサイズ - uint position = (uint)fs.Position; - fs.Seek( 4, SeekOrigin.Begin ); - buf = BitConverter.GetBytes( position - 8 ); - WriteByteArray( fs, buf, 4 ); + long position = fs.getFilePointer(); + fs.seek( 4 ); + buf = PortUtil.getbytes_uint32_le( position - 8 ); + writeByteArray( fs, buf, 4 ); + } catch ( Exception ex ) { + } finally { + if ( fs != null ) { + try { + fs.close(); + } catch ( Exception ex2 ) { + } + } } } - private static void WriteByteArray( FileStream fs, byte[] dat, int limit ) { - fs.Write( dat, 0, (dat.Length > limit) ? limit : dat.Length ); + private static void writeByteArray( RandomAccessFile fs, byte[] dat, int limit ) +#if JAVA + throws IOException +#endif + { + fs.write( dat, 0, (dat.Length > limit) ? limit : dat.Length ); if ( dat.Length < limit ) { for ( int i = 0; i < limit - dat.Length; i++ ) { - fs.WriteByte( 0x00 ); + fs.write( 0x00 ); } } } @@ -959,7 +1041,7 @@ namespace Boare.Lib.Media { /// /// ステレオをモノラル化 /// - public void Monoralize() { + public void monoralize() { if ( m_channel != WaveChannel.Stereo ) { return; } @@ -982,7 +1064,7 @@ namespace Boare.Lib.Media { /// /// 前後の無音部分を削除します /// - public void TrimSilence() { + public void trimSilence() { #if DEBUG Console.WriteLine( "Wave.TrimSilence" ); #endif @@ -1004,10 +1086,10 @@ namespace Boare.Lib.Media { } int count = non_silence_end - non_silence_begin + 1; R8 = new byte[count]; - Array.Copy( L8, non_silence_begin, R8, 0, count ); + copyArray( L8, non_silence_begin, R8, 0, count ); L8 = null; L8 = new byte[count]; - Array.Copy( R8, L8, count ); + copyArray( R8, 0, L8, 0, count ); R8 = null; } else { int non_silence_begin = 1; @@ -1026,14 +1108,14 @@ namespace Boare.Lib.Media { } int count = non_silence_end - non_silence_begin + 1; byte[] buf = new byte[count]; - Array.Copy( L8, non_silence_begin, buf, 0, count ); + copyArray( L8, non_silence_begin, buf, 0, count ); L8 = null; L8 = new byte[count]; - Array.Copy( buf, L8, count ); - Array.Copy( R8, non_silence_begin, buf, 0, count ); + copyArray( buf, 0, L8, 0, count ); + copyArray( R8, non_silence_begin, buf, 0, count ); R8 = null; R8 = new byte[count]; - Array.Copy( buf, R8, count ); + copyArray( buf, 0, R8, 0, count ); buf = null; } } else { @@ -1054,9 +1136,9 @@ namespace Boare.Lib.Media { } int count = non_silence_end - non_silence_begin + 1; R16 = new short[count]; - Array.Copy( L16, non_silence_begin, R16, 0, count ); - Array.Resize( ref L16, count ); - Array.Copy( R16, L16, count ); + copyArray( L16, non_silence_begin, R16, 0, count ); + L16 = resizeArray( L16, count ); + copyArray( R16, 0, L16, 0, count ); R16 = null; } else { int non_silence_begin = 1; @@ -1079,21 +1161,21 @@ namespace Boare.Lib.Media { #endif int count = non_silence_end - non_silence_begin + 1; short[] buf = new short[count]; - Array.Copy( L16, non_silence_begin, buf, 0, count ); - Array.Resize( ref L16, count ); - Array.Copy( buf, 0, L16, 0, count ); - - Array.Copy( R16, non_silence_begin, buf, 0, count ); - Array.Resize( ref R16, count ); - Array.Copy( buf, 0, R16, 0, count ); + copyArray( L16, non_silence_begin, buf, 0, count ); + L16 = resizeArray( L16, count ); + copyArray( buf, 0, L16, 0, count ); + + copyArray( R16, non_silence_begin, buf, 0, count ); + R16 = resizeArray( R16, count ); + copyArray( buf, 0, R16, 0, count ); buf = null; } } if ( m_bit_per_sample == 8 ) { - m_total_samples = (uint)L8.Length; + m_total_samples = (long)L8.Length; } else { - m_total_samples = (uint)L16.Length; + m_total_samples = (long)L16.Length; } } @@ -1103,31 +1185,31 @@ namespace Boare.Lib.Media { m_sample_rate = 44100; } - public Wave( WaveChannel channels, ushort bit_per_sample, uint sample_rate, uint initial_capacity ) { + public Wave( WaveChannel channels, int bit_per_sample, int sample_rate, int initial_capacity ) { m_channel = channels; m_bit_per_sample = bit_per_sample; m_sample_rate = sample_rate; m_total_samples = initial_capacity; if ( m_bit_per_sample == 8 ) { - L8 = new byte[m_total_samples]; + L8 = new byte[(int)m_total_samples]; if ( m_channel == WaveChannel.Stereo ) { - R8 = new byte[m_total_samples]; + R8 = new byte[(int)m_total_samples]; } } else if ( m_bit_per_sample == 16 ) { - L16 = new short[m_total_samples]; + L16 = new short[(int)m_total_samples]; if ( m_channel == WaveChannel.Stereo ) { - R16 = new short[m_total_samples]; + R16 = new short[(int)m_total_samples]; } } } - public void Append( double[] L, double[] R ) { + public void append( double[] L, double[] R ) { int length = Math.Min( L.Length, R.Length ); int old_length = L16.Length; if ( m_bit_per_sample == 16 && m_channel == WaveChannel.Stereo ) { - Array.Resize( ref L16, (int)(m_total_samples + length) ); - Array.Resize( ref R16, (int)(m_total_samples + length) ); - m_total_samples += (uint)length; + L16 = resizeArray( L16, (int)(m_total_samples + length) ); + R16 = resizeArray( R16, (int)(m_total_samples + length) ); + m_total_samples += (long)length; for ( int i = old_length; i < m_total_samples; i++ ) { L16[i] = (short)(L[i - old_length] * 32768f); R16[i] = (short)(R[i - old_length] * 32768f); @@ -1135,53 +1217,124 @@ namespace Boare.Lib.Media { } //else ... TODO: Wave+Append他のbitpersec, channelのとき } - /*public void Append( short[] L, short[] R ) { - int length = Math.Min( L.Length, R.Length ); - int old_length = L16.Length; - if ( m_bit_per_sample == 16 && m_channel == WaveChannel.Stereo ) { - Array.Resize( ref L16, (int)(m_total_samples + length) ); - Array.Resize( ref R16, (int)(m_total_samples + length) ); - m_total_samples += (uint)length; - for ( int i = old_length; i < m_total_samples; i++ ) { - L16[i] = L[i - old_length]; - R16[i] = R[i - old_length]; - } - } //else ... TODO: Wave+Append他のbitpersec, channelのとき - }*/ - - public Wave( string path ) { - Read( path ); + public Wave( String path ) { + read( path ); } - - public bool Read( string path ) { - FileStream fs = null; + private boolean parseAiffHeader( RandomAccessFile fs ) { try { - fs = new FileStream( path, FileMode.Open ); - // check RIFF header byte[] buf = new byte[4]; - fs.Read( buf, 0, 4 ); - if ( buf[0] != 0x52 || - buf[1] != 0x49 || - buf[2] != 0x46 || - buf[3] != 0x46 ) { + fs.read( buf, 0, 4 ); + long chunk_size_form = PortUtil.make_uint32_be( buf ); + fs.read( buf, 0, 4 ); // AIFF + String tag = new String( new char[] { (char)buf[0], (char)buf[1], (char)buf[2], (char)buf[3] } ); + if ( !tag.Equals( "AIFF" ) ) { #if DEBUG - System.Diagnostics.Debug.WriteLine( "invalid header" ); + Console.WriteLine( "Wave#parseAiffHeader; error; tag=" + tag + " and must be AIFF" ); #endif - fs.Close(); return false; } + fs.read( buf, 0, 4 ); // COMM + tag = new String( new char[] { (char)buf[0], (char)buf[1], (char)buf[2], (char)buf[3] } ); + if ( !tag.Equals( "COMM" ) ) { +#if DEBUG + Console.WriteLine( "Wave#parseAiffHeader; error; tag=" + tag + " and must be COMM" ); +#endif + return false; + } + fs.read( buf, 0, 4 ); // COMM chunk size + long chunk_size_comm = PortUtil.make_uint32_be( buf ); + long chunk_loc_comm = fs.getFilePointer(); + fs.read( buf, 0, 2 ); // number of channel + int num_channel = PortUtil.make_uint16_be( buf ); + if ( num_channel == 1 ) { + m_channel = WaveChannel.Monoral; + } else { + m_channel = WaveChannel.Stereo; + } + fs.read( buf, 0, 4 ); // number of samples + m_total_samples = PortUtil.make_uint32_be( buf ); +#if DEBUG + Console.WriteLine( "Wave#parseAiffHeader; m_total_samples=" + m_total_samples ); +#endif + fs.read( buf, 0, 2 ); // block size + m_bit_per_sample = PortUtil.make_uint16_be( buf ); + byte[] buf10 = new byte[10]; + fs.read( buf10, 0, 10 ); // sample rate + m_sample_rate = (long)make_double_from_extended( buf10 ); +#if DEBUG + Console.WriteLine( "Wave#parseAiffHeader; m_sample_rate=" + m_sample_rate ); +#endif + fs.seek( chunk_loc_comm + (long)chunk_size_comm ); + fs.read( buf, 0, 4 ); // SSND + tag = new String( new char[] { (char)buf[0], (char)buf[1], (char)buf[2], (char)buf[3] } ); + if ( !tag.Equals( "SSND" ) ) { +#if DEBUG + Console.WriteLine( "Wave#parseAiffHeader; error; tag=" + tag + " and must be SSND" ); +#endif + return false; + } + fs.read( buf, 0, 4 ); // SSND chunk size + long chunk_size_ssnd = PortUtil.make_uint32_be( buf ); + } catch ( Exception ex ) { + return false; + } + return true; + } + + private static double make_double_from_extended( byte[] bytes ) { + double f; + long hiMant, loMant; + + int expon = ((bytes[0] & 0x7F) << 8) | (bytes[1] & 0xFF); + hiMant = ((long)(bytes[2] & 0xFF) << 24) + | ((long)(bytes[3] & 0xFF) << 16) + | ((long)(bytes[4] & 0xFF) << 8) + | ((long)(bytes[5] & 0xFF)); + loMant = ((long)(bytes[6] & 0xFF) << 24) + | ((long)(bytes[7] & 0xFF) << 16) + | ((long)(bytes[8] & 0xFF) << 8) + | ((long)(bytes[9] & 0xFF)); + + if ( expon == 0 && hiMant == 0 && loMant == 0 ) { + f = 0; + } else { + if ( expon == 0x7FFF ) { + f = double.MaxValue; + } else { + expon -= 16383; + //f = ldexp( double_from_uint( hiMant ), expon -= 31 ); + f = Math.Pow( 2.0, expon - 31 ) * double_from_uint( hiMant ); + //f += ldexp( double_from_uint( loMant ), expon -= 32 ); + f += Math.Pow( 2.0, expon - 32 ) * double_from_uint( loMant ); + } + } + + if ( (bytes[0] & 0x80) != 0 ) { + return -f; + } else { + return f; + } + } + + private static double double_from_uint( long u ) { + return (((double)((int)(u - 2147483647 - 1))) + 2147483648.0); + } + + private boolean parseWaveHeader( RandomAccessFile fs ) { + try { + byte[] buf = new byte[4]; // detect size of RIFF chunk - fs.Read( buf, 0, 4 ); - uint riff_chunk_size = GetUIntFrom4Bytes( buf ); + fs.read( buf, 0, 4 ); + long riff_chunk_size = PortUtil.make_uint32_le( buf ); #if DEBUG System.Diagnostics.Debug.WriteLine( "riff_chunk_size=" + riff_chunk_size ); #endif // check wave header - fs.Seek( 8, SeekOrigin.Begin ); - fs.Read( buf, 0, 4 ); + fs.seek( 8 ); + fs.read( buf, 0, 4 ); if ( buf[0] != 0x57 || buf[1] != 0x41 || buf[2] != 0x56 || @@ -1189,12 +1342,12 @@ namespace Boare.Lib.Media { #if DEBUG System.Diagnostics.Debug.WriteLine( "invalid wave header" ); #endif - fs.Close(); + fs.close(); return false; } // check fmt chunk header - fs.Read( buf, 0, 4 ); + fs.read( buf, 0, 4 ); if ( buf[0] != 0x66 || buf[1] != 0x6d || buf[2] != 0x74 || @@ -1202,23 +1355,23 @@ namespace Boare.Lib.Media { #if DEBUG System.Diagnostics.Debug.WriteLine( "invalid fmt header" ); #endif - fs.Close(); + fs.close(); return false; } // detect size of fmt chunk - uint fmt_chunk_bytes; - fs.Read( buf, 0, 4 ); - fmt_chunk_bytes = GetUIntFrom4Bytes( buf ); + long fmt_chunk_bytes; + fs.read( buf, 0, 4 ); + fmt_chunk_bytes = PortUtil.make_uint32_le( buf ); #if DEBUG System.Diagnostics.Debug.WriteLine( "fmt_chunk_bytes=" + fmt_chunk_bytes ); #endif // get format ID - fs.Read( buf, 0, 2 ); - ushort format_id = GetUShortFrom2Bytes( buf ); + fs.read( buf, 0, 2 ); + int format_id = PortUtil.make_uint16_le( buf ); if ( format_id != 1 ) { - fs.Close(); + fs.close(); return false; } #if DEBUG @@ -1226,14 +1379,14 @@ namespace Boare.Lib.Media { #endif // get the number of channel(s) - fs.Read( buf, 0, 2 ); - ushort num_channels = GetUShortFrom2Bytes( buf ); + fs.read( buf, 0, 2 ); + int num_channels = PortUtil.make_uint16_le( buf ); if ( num_channels == 1 ) { m_channel = WaveChannel.Monoral; } else if ( num_channels == 2 ) { m_channel = WaveChannel.Stereo; } else { - fs.Close(); + fs.close(); return false; } #if DEBUG @@ -1241,115 +1394,173 @@ namespace Boare.Lib.Media { #endif // get sampling rate - fs.Read( buf, 0, 4 ); - m_sample_rate = GetUIntFrom4Bytes( buf ); + fs.read( buf, 0, 4 ); + m_sample_rate = PortUtil.make_uint32_le( buf ); #if DEBUG System.Diagnostics.Debug.WriteLine( "m_sample_rate=" + m_sample_rate ); #endif // get bit per sample - fs.Seek( 0x22, SeekOrigin.Begin ); - fs.Read( buf, 0, 2 ); - m_bit_per_sample = GetUShortFrom2Bytes( buf ); + fs.seek( 0x22 ); + fs.read( buf, 0, 2 ); + m_bit_per_sample = PortUtil.make_uint16_le( buf ); #if DEBUG System.Diagnostics.Debug.WriteLine( "m_bit_per_sample=" + m_bit_per_sample ); #endif if ( m_bit_per_sample != 0x08 && m_bit_per_sample != 0x10 ) { - fs.Close(); + fs.close(); return false; } // move to the end of fmt chunk - fs.Seek( 0x14 + fmt_chunk_bytes, SeekOrigin.Begin ); + fs.seek( 0x14 + fmt_chunk_bytes ); // move to the top of data chunk - fs.Read( buf, 0, 4 ); - string tag = new string( new char[] { (char)buf[0], (char)buf[1], (char)buf[2], (char)buf[3] } ); + fs.read( buf, 0, 4 ); + String tag = new String( new char[] { (char)buf[0], (char)buf[1], (char)buf[2], (char)buf[3] } ); #if DEBUG System.Diagnostics.Debug.WriteLine( "tag=" + tag ); #endif while ( tag != "data" ) { - fs.Read( buf, 0, 4 ); - uint size = GetUIntFrom4Bytes( buf ); - fs.Seek( size, SeekOrigin.Current ); - fs.Read( buf, 0, 4 ); - tag = new string( new char[] { (char)buf[0], (char)buf[1], (char)buf[2], (char)buf[3] } ); + fs.read( buf, 0, 4 ); + long size = PortUtil.make_uint32_le( buf ); + fs.seek( fs.getFilePointer() + size ); + fs.read( buf, 0, 4 ); + tag = new String( new char[] { (char)buf[0], (char)buf[1], (char)buf[2], (char)buf[3] } ); #if DEBUG System.Diagnostics.Debug.WriteLine( "tag=" + tag ); #endif } // get size of data chunk - fs.Read( buf, 0, 4 ); - uint data_chunk_bytes = GetUIntFrom4Bytes( buf ); - m_total_samples = (uint)(data_chunk_bytes / (num_channels * m_bit_per_sample / 8)); + fs.read( buf, 0, 4 ); + long data_chunk_bytes = PortUtil.make_uint32_le( buf ); + m_total_samples = (long)(data_chunk_bytes / (num_channels * m_bit_per_sample / 8)); #if DEBUG System.Diagnostics.Debug.WriteLine( "m_total_samples=" + m_total_samples ); #endif - // prepare data - if ( m_bit_per_sample == 8 ) { - L8 = new byte[m_total_samples]; - if ( m_channel == WaveChannel.Stereo ) { - R8 = new byte[m_total_samples]; - } - } else { - L16 = new short[m_total_samples]; - if ( m_channel == WaveChannel.Stereo ) { - R16 = new short[m_total_samples]; - } - } - - // read data - byte[] buf2 = new byte[2]; - for ( int i = 0; i < m_total_samples; i++ ) { - if ( m_bit_per_sample == 8 ) { - fs.Read( buf, 0, 1 ); - L8[i] = buf[0]; - if ( m_channel == WaveChannel.Stereo ) { - fs.Read( buf, 0, 1 ); - R8[i] = buf[0]; - } - } else { - fs.Read( buf2, 0, 2 ); - /*if ( BitConverter.IsLittleEndian ) { - byte b = buf2[0]; - buf2[0] = buf2[1]; - buf2[1] = b; - }*/ - L16[i] = BitConverter.ToInt16( buf2, 0 ); - if ( m_channel == WaveChannel.Stereo ) { - fs.Read( buf2, 0, 2 ); - /*if ( BitConverter.IsLittleEndian ) { - byte b = buf2[0]; - buf2[0] = buf2[1]; - buf2[1] = b; - }*/ - R16[i] = BitConverter.ToInt16( buf2, 0 ); - } - } - } } catch ( Exception ex ) { #if DEBUG System.Diagnostics.Debug.Write( ex.StackTrace ); #endif - } finally { - if ( fs != null ) { - fs.Close(); - } } return true; } + public boolean read( String path ) { + RandomAccessFile fs = null; + boolean ret = false; + try { + fs = new RandomAccessFile( path, "r" ); + // check RIFF header + byte[] buf = new byte[4]; + fs.read( buf, 0, 4 ); + boolean change_byte_order = false; + if ( buf[0] == 0x52 && buf[1] == 0x49 && buf[2] == 0x46 && buf[3] == 0x46 ) { + ret = parseWaveHeader( fs ); + } else if ( buf[0] == 0x46 && buf[1] == 0x4f && buf[2] == 0x52 && buf[3] == 0x4d ) { + ret = parseAiffHeader( fs ); + change_byte_order = true; + } else { + ret = false; + } + // prepare data + if ( m_bit_per_sample == 8 ) { + L8 = new byte[(int)m_total_samples]; + if ( m_channel == WaveChannel.Stereo ) { + R8 = new byte[(int)m_total_samples]; + } + } else { + L16 = new short[(int)m_total_samples]; + if ( m_channel == WaveChannel.Stereo ) { + R16 = new short[(int)m_total_samples]; + } + } - private uint GetUIntFrom4Bytes( byte[] dat ) { - return (uint)(dat[3] << 24) + (uint)(dat[2] << 16) + (uint)(dat[1] << 8) + (uint)dat[0]; + // read data + // TODO: big endianのときの読込み。 + byte[] buf2 = new byte[2]; + for ( int i = 0; i < m_total_samples; i++ ) { + if ( m_bit_per_sample == 8 ) { + fs.read( buf, 0, 1 ); + L8[i] = buf[0]; + if ( m_channel == WaveChannel.Stereo ) { + fs.read( buf, 0, 1 ); + R8[i] = buf[0]; + } + } else { + fs.read( buf2, 0, 2 ); + if ( change_byte_order ) { + byte b = buf2[0]; + buf2[0] = buf2[1]; + buf2[1] = b; + } + L16[i] = PortUtil.make_int16_le( buf2 ); + if ( m_channel == WaveChannel.Stereo ) { + fs.read( buf2, 0, 2 ); + if ( change_byte_order ) { + byte b = buf2[0]; + buf2[0] = buf2[1]; + buf2[1] = b; + } + R16[i] = PortUtil.make_int16_le( buf2 ); + } + } + } + } catch ( Exception ex ) { + } finally { + if ( fs != null ) { + try { + fs.close(); + } catch ( Exception ex2 ) { + } + } + } + return ret; } + private static short[] resizeArray( short[] src, int length ) { + short[] ret = new short[length]; + if ( src.Length <= length ) { + for ( int i = 0; i < src.Length; i++ ) { + ret[i] = src[i]; + } + } else { + for ( int i = 0; i < length; i++ ) { + ret[i] = src[i]; + } + } + return ret; + } - private ushort GetUShortFrom2Bytes( byte[] dat ) { - return (ushort)((dat[1] << 8) | dat[0]); + private static byte[] resizeArray( byte[] src, int length ) { + byte[] ret = new byte[length]; + if ( src.Length <= length ) { + for ( int i = 0; i < src.Length; i++ ) { + ret[i] = src[i]; + } + } else { + for ( int i = 0; i < length; i++ ) { + ret[i] = src[i]; + } + } + return ret; + } + + private static void copyArray( short[] src, int src_start, short[] dest, int dest_start, int length ) { + for ( int i = 0; i < length; i++ ) { + dest[i + dest_start] = src[i + src_start]; + } + } + + private static void copyArray( byte[] src, int src_start, byte[] dest, int dest_start, int length ) { + for ( int i = 0; i < length; i++ ) { + dest[i + dest_start] = src[i + src_start]; + } } } +#if !JAVA } +#endif diff --git a/trunk/Boare.Lib.Media/WavePlay.cs b/trunk/Boare.Lib.Media/WavePlay.cs index 64306bb..70fa090 100644 --- a/trunk/Boare.Lib.Media/WavePlay.cs +++ b/trunk/Boare.Lib.Media/WavePlay.cs @@ -62,7 +62,7 @@ namespace Boare.Lib.Media { #if DEBUG Console.WriteLine( "WavePlay.wave_callback; uMsg=" + uMsg ); #endif - if ( uMsg == windows.MM_WOM_DONE ) { + if ( uMsg == win32.MM_WOM_DONE ) { int index_done = 0; WAVEHDR whdr = (WAVEHDR)Marshal.PtrToStructure( new IntPtr( dwParam1 ), typeof( WAVEHDR ) ); int dwuser = whdr.dwUser.ToInt32(); @@ -163,7 +163,7 @@ namespace Boare.Lib.Media { #if DEBUG bocoree.debug.push_log( "calling waveOutWrite...; s_hawve_out=0x" + Convert.ToString( s_hwave_out.ToInt32(), 16 ) ); #endif - uint ret = windows.waveOutWrite( s_hwave_out, ref s_wave_header[0], (uint)sizeof( WAVEHDR ) ); + uint ret = win32.waveOutWrite( s_hwave_out, ref s_wave_header[0], (uint)sizeof( WAVEHDR ) ); #if DEBUG bocoree.debug.push_log( "...done; ret=" + ret ); #endif @@ -181,7 +181,7 @@ namespace Boare.Lib.Media { #if DEBUG bocoree.debug.push_log( "calling waveOutWrite...; s_hawve_out=0x" + Convert.ToString( s_hwave_out.ToInt32(), 16 ) ); #endif - uint ret2 = windows.waveOutWrite( s_hwave_out, ref s_wave_header[buffer_index], (uint)sizeof( WAVEHDR ) ); + uint ret2 = win32.waveOutWrite( s_hwave_out, ref s_wave_header[buffer_index], (uint)sizeof( WAVEHDR ) ); #if DEBUG bocoree.debug.push_log( "...done; ret2=" + ret2 ); #endif @@ -192,7 +192,7 @@ namespace Boare.Lib.Media { #if DEBUG bocoree.debug.push_log( "calling waveOutWrite...; s_hawve_out=0x" + Convert.ToString( s_hwave_out.ToInt32(), 16 ) ); #endif - uint ret3 = windows.waveOutWrite( s_hwave_out, ref s_wave_header[s_current_buffer], (uint)sizeof( WAVEHDR ) ); + uint ret3 = win32.waveOutWrite( s_hwave_out, ref s_wave_header[s_current_buffer], (uint)sizeof( WAVEHDR ) ); #if DEBUG bocoree.debug.push_log( "...done; ret3=" + ret3 ); #endif @@ -229,7 +229,7 @@ namespace Boare.Lib.Media { #if DEBUG bocoree.debug.push_log( "calling waveOutWrite...; s_hawve_out=0x" + Convert.ToString( s_hwave_out.ToInt32(), 16 ) ); #endif - uint ret35 = windows.waveOutWrite( s_hwave_out, ref s_wave_header[0], (uint)sizeof( WAVEHDR ) ); + uint ret35 = win32.waveOutWrite( s_hwave_out, ref s_wave_header[0], (uint)sizeof( WAVEHDR ) ); #if DEBUG bocoree.debug.push_log( "...done; ret35=" + ret35 ); bocoree.debug.push_log( "(s_first_buffer_written_callback==null)=" + (s_first_buffer_written_callback == null) ); @@ -247,7 +247,7 @@ namespace Boare.Lib.Media { #if DEBUG bocoree.debug.push_log( "calling waveOutWrite...; s_hawve_out=0x" + Convert.ToString( s_hwave_out.ToInt32(), 16 ) ); #endif - uint ret36 = windows.waveOutWrite( s_hwave_out, ref s_wave_header[i], (uint)sizeof( WAVEHDR ) ); + uint ret36 = win32.waveOutWrite( s_hwave_out, ref s_wave_header[i], (uint)sizeof( WAVEHDR ) ); #if DEBUG bocoree.debug.push_log( "...done; ret36=" + ret36 ); #endif @@ -276,7 +276,7 @@ namespace Boare.Lib.Media { #if DEBUG bocoree.debug.push_log( "calling waveOutWrite...; s_hawve_out=0x" + Convert.ToString( s_hwave_out.ToInt32(), 16 ) ); #endif - uint ret4 = windows.waveOutWrite( s_hwave_out, ref s_wave_header[s_current_buffer], (uint)sizeof( WAVEHDR ) ); + uint ret4 = win32.waveOutWrite( s_hwave_out, ref s_wave_header[s_current_buffer], (uint)sizeof( WAVEHDR ) ); #if DEBUG bocoree.debug.push_log( "...done; ret4=" + ret4 ); #endif @@ -295,10 +295,10 @@ namespace Boare.Lib.Media { void mix( int processed_count, float amp_left, float amp_right ) { int current_buffer = (processed_count - 1) % _NUM_BUF; for ( int k = 0; k < s_num_wave_reader; k++ ) { - s_wave_reader[k].Read( s_block_size * (processed_count - 1) + (int)s_wave_read_offset_samples, + s_wave_reader[k].read( s_block_size * (processed_count - 1) + (int)s_wave_read_offset_samples, s_block_size, - out s_ptr_another_wave_l[k], - out s_ptr_another_wave_r[k] ); + ref s_ptr_another_wave_l[k], + ref s_ptr_another_wave_r[k] ); } for ( int i = 0; i < s_block_size; i++ ) { float l = s_wave_buffer_l[i] * amp_left; @@ -316,7 +316,7 @@ namespace Boare.Lib.Media { //byte* err = (byte*)ptr_err.ToPointer(); //System.Text.StringBuilder sb = new System.Text.StringBuilder( 260 ); string ret = ""; - windows.mciGetErrorStringA( msg, ret, 260 ); + win32.mciGetErrorStringA( msg, ret, 260 ); /*int len = 260; for ( int i = 1; i < 260; i++ ) { if ( err[i] == '\0' ) { @@ -349,7 +349,7 @@ namespace Boare.Lib.Media { Console.WriteLine( " s_wave_fomratx.cbSize=" + s_wave_formatx.cbSize ); Console.WriteLine( " sizeof( WAVEHDR )=" + sizeof( WAVEHDR ) ); #endif - s_wave_formatx.wFormatTag = windows.WAVE_FORMAT_PCM; + s_wave_formatx.wFormatTag = win32.WAVE_FORMAT_PCM; s_wave_formatx.nChannels = 2; s_wave_formatx.wBitsPerSample = 16; s_wave_formatx.nBlockAlign = (ushort)(s_wave_formatx.nChannels * s_wave_formatx.wBitsPerSample / 8); @@ -359,12 +359,12 @@ namespace Boare.Lib.Media { s_wave_callback = new delegateWaveOutProc( wave_callback ); s_hwave_out = IntPtr.Zero; Console.WriteLine( " calling waveOutOpen..." ); - uint ret = windows.waveOutOpen( ref s_hwave_out, - windows.WAVE_MAPPER, + uint ret = win32.waveOutOpen( ref s_hwave_out, + win32.WAVE_MAPPER, ref s_wave_formatx, s_wave_callback, - IntPtr.Zero, - (uint)windows.CALLBACK_FUNCTION ); + IntPtr.Zero, + (uint)win32.CALLBACK_FUNCTION ); Console.WriteLine( " ...done; ret=" + ret ); #if DEBUG bocoree.debug.push_log( " s_hwave_out=0x" + Convert.ToString( s_hwave_out.ToInt32(), 16 ) ); @@ -377,13 +377,13 @@ namespace Boare.Lib.Media { s_wave_header[k] = (WAVEHDR)Marshal.PtrToStructure( s_ptr_wave_header[k], typeof( WAVEHDR ) ); s_wave_header[k].lpData = s_ptr_wave[k]; s_wave_header[k].dwBufferLength = (uint)(sizeof( uint ) * s_block_size); - s_wave_header[k].dwFlags = windows.WHDR_BEGINLOOP | windows.WHDR_ENDLOOP; + s_wave_header[k].dwFlags = win32.WHDR_BEGINLOOP | win32.WHDR_ENDLOOP; s_wave_header[k].dwLoops = 1; #if DEBUG Console.WriteLine( "calling waveOutPrepareHeader..." ); #endif - uint ret2 = windows.waveOutPrepareHeader( s_hwave_out, ref s_wave_header[k], (uint)sizeof( WAVEHDR ) ); + uint ret2 = win32.waveOutPrepareHeader( s_hwave_out, ref s_wave_header[k], (uint)sizeof( WAVEHDR ) ); #if DEBUG Console.WriteLine( "...done; ret2=" + ret2 ); #endif @@ -428,18 +428,18 @@ namespace Boare.Lib.Media { if ( s_playing ) { MMTIME mmt = new MMTIME(); mmt.cb = (uint)sizeof( MMTIME ); - mmt.wType = windows.TIME_MS; - uint ret = windows.waveOutGetPosition( s_hwave_out, ref mmt, (uint)sizeof( MMTIME ) ); + mmt.wType = win32.TIME_MS; + uint ret = win32.waveOutGetPosition( s_hwave_out, ref mmt, (uint)sizeof( MMTIME ) ); #if DEBUG bocoree.debug.push_log( " ret=" + ret ); #endif float ms = 0.0f; switch ( mmt.wType ) { - case windows.TIME_MS: + case win32.TIME_MS: return mmt.ms * 0.001f; - case windows.TIME_SAMPLES: + case win32.TIME_SAMPLES: return (float)mmt.sample / (float)s_wave_formatx.nSamplesPerSec; - case windows.TIME_BYTES: + case win32.TIME_BYTES: return (float)mmt.cb / (float)s_wave_formatx.nAvgBytesPerSec; default: return -1.0f; @@ -456,7 +456,7 @@ namespace Boare.Lib.Media { for ( int k = 0; k < _NUM_BUF; k++ ) { s_wave_header[k].dwUser = new IntPtr( _NUM_BUF + k ); } - windows.waveOutReset( s_hwave_out ); + win32.waveOutReset( s_hwave_out ); uint zero = MAKELONG( 0, 0 ); for ( int k = 0; k < _NUM_BUF; k++ ) { for ( int i = 0; i < s_block_size; i++ ) { @@ -465,7 +465,7 @@ namespace Boare.Lib.Media { } } for ( int i = 0; i < s_num_wave_reader; i++ ) { - s_wave_reader[i].Close(); + s_wave_reader[i].close(); } } @@ -500,7 +500,7 @@ namespace Boare.Lib.Media { if ( s_wave_reader != null ) { for ( int i = 0; i < s_num_wave_reader; i++ ) { - s_wave_reader[i].Close(); + s_wave_reader[i].close(); } //delete [] s_wave_reader; } @@ -530,8 +530,8 @@ namespace Boare.Lib.Media { name[k] = buf[k]; } name[len] = '\0';*/ - s_wave_reader[i].Open( files[i] ); - int samples = s_wave_reader[i].TotalSamples; + s_wave_reader[i].open( files[i] ); + int samples = s_wave_reader[i].getTotalSamples(); if ( samples > max_samples ) { max_samples = samples; } @@ -560,14 +560,14 @@ namespace Boare.Lib.Media { public void terminate() { if ( s_hwave_out.ToInt32() != 0 ) { - windows.waveOutReset( s_hwave_out ); + win32.waveOutReset( s_hwave_out ); #if DEBUG bocoree.debug.push_log( "waveplay::terminate; waveOutReset" ); #endif for ( int k = 0; k < _NUM_BUF; k++ ) { - windows.waveOutUnprepareHeader( s_hwave_out, ref s_wave_header[k], (uint)sizeof( WAVEHDR ) ); + win32.waveOutUnprepareHeader( s_hwave_out, ref s_wave_header[k], (uint)sizeof( WAVEHDR ) ); } - windows.waveOutClose( s_hwave_out ); + win32.waveOutClose( s_hwave_out ); } for ( int i = 0; i < _NUM_BUF; i++ ) { if ( s_ptr_wave[i].ToInt32() != 0 ) { diff --git a/trunk/Boare.Lib.Media/WaveReader.cs b/trunk/Boare.Lib.Media/WaveReader.cs index 7f0bfcc..9394017 100644 --- a/trunk/Boare.Lib.Media/WaveReader.cs +++ b/trunk/Boare.Lib.Media/WaveReader.cs @@ -11,125 +11,254 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */ +#if JAVA +package org.kbinani.media; + +import java.io.*; +import java.util.*; +import org.kbinani.*; +#else using System; -using System.IO; -using System.Runtime.InteropServices; +using bocoree; +using bocoree.java.io; namespace Boare.Lib.Media { + using boolean = System.Boolean; +#endif - public class WaveReader : IDisposable{ +#if JAVA + public class WaveReader { +#else + public class WaveReader : IDisposable { +#endif private int m_channel; private int m_byte_per_sample; - private bool m_opened; - private FileStream m_stream; + private boolean m_opened; + private RandomAccessFile m_stream; private int m_total_samples; + private double m_amplify_left = 1.0; + private double m_amplify_right = 1.0; + /// + /// ファイル先頭から,dataチャンクまでのオフセット + /// + private int m_header_offset = 0x2e; + private Object m_tag = null; + private double m_offset_seconds = 0.0; + private int m_sample_per_sec; public WaveReader() { m_opened = false; } - public WaveReader( string file ) { - Open( file ); + public WaveReader( String file ) +#if JAVA + throws IOException, FileNotFoundException +#endif + { + boolean ret = open( file ); +#if DEBUG + Console.WriteLine( "WaveReader#.ctor; file=" + file + "; ret=" + ret ); +#endif } + public double getOffsetSeconds() { + return m_offset_seconds; + } + + public void setOffsetSeconds( double value ) { + m_offset_seconds = value; + } + + public Object getTag() { + return m_tag; + } + + public void setTag( Object value ) { + m_tag = value; + } + + public double getAmplifyLeft() { + return m_amplify_left; + } + + public void setAmplifyLeft( double value ) { + m_amplify_left = value; + } + + public double getAmplifyRight() { + return m_amplify_right; + } + + public void setAmplifyRight( double value ) { + m_amplify_right = value; + } + +#if !JAVA public void Dispose() { - Close(); + close(); } +#endif - public bool Open( string file ) { + public boolean open( String file ) +#if JAVA + throws IOException, FileNotFoundException +#endif + { if ( m_opened ) { - m_stream.Close(); + m_stream.close(); } - m_stream = new FileStream( file, FileMode.Open, FileAccess.Read ); + m_stream = new RandomAccessFile( file, "r" ); // RIFF byte[] buf = new byte[4]; - m_stream.Read( buf, 0, 4 ); + m_stream.read( buf, 0, 4 ); if ( buf[0] != 'R' || buf[1] != 'I' || buf[2] != 'F' || buf[3] != 'F' ) { - m_stream.Close(); + m_stream.close(); +#if DEBUG + Console.WriteLine( "WaveReader#Open; header error(RIFF)" ); +#endif return false; } // ファイルサイズ - 8最後に記入 - m_stream.Read( buf, 0, 4 ); + m_stream.read( buf, 0, 4 ); // WAVE - m_stream.Read( buf, 0, 4 ); + m_stream.read( buf, 0, 4 ); if ( buf[0] != 'W' || buf[1] != 'A' || buf[2] != 'V' || buf[3] != 'E' ) { - m_stream.Close(); + m_stream.close(); +#if DEBUG + Console.WriteLine( "WaveReader#Open; header error(WAVE)" ); +#endif return false; } // fmt - m_stream.Read( buf, 0, 4 ); + m_stream.read( buf, 0, 4 ); if ( buf[0] != 'f' || buf[1] != 'm' || buf[2] != 't' || buf[3] != ' ' ) { - m_stream.Close(); + m_stream.close(); +#if DEBUG + Console.WriteLine( "WaveReader#Open; header error(fmt )" ); +#endif return false; } // fmt チャンクのサイズ - m_stream.Read( buf, 0, 4 ); + m_stream.read( buf, 0, 4 ); + int chunksize = (int)PortUtil.make_uint32_le( buf ); + long fmt_chunk_end_location = m_stream.getFilePointer() + chunksize; // format ID - m_stream.Read( buf, 0, 2 ); + m_stream.read( buf, 0, 2 ); // チャンネル数 - m_stream.Read( buf, 0, 2 ); + m_stream.read( buf, 0, 2 ); m_channel = buf[1] << 8 | buf[0]; // サンプリングレート - m_stream.Read( buf, 0, 4 ); + m_stream.read( buf, 0, 4 ); + m_sample_per_sec = (int)PortUtil.make_uint32_le( buf ); // データ速度 - m_stream.Read( buf, 0, 4 ); + m_stream.read( buf, 0, 4 ); // ブロックサイズ - m_stream.Read( buf, 0, 2 ); + m_stream.read( buf, 0, 2 ); // サンプルあたりのビット数 - m_stream.Read( buf, 0, 2 ); + m_stream.read( buf, 0, 2 ); int bit_per_sample = buf[1] << 8 | buf[0]; m_byte_per_sample = bit_per_sample / 8; // 拡張部分 - m_stream.Read( buf, 0, 2 ); + m_stream.seek( fmt_chunk_end_location ); + //m_stream.Read( buf, 0, 2 ); // data - m_stream.Read( buf, 0, 4 ); + m_stream.read( buf, 0, 4 ); if ( buf[0] != 'd' || buf[1] != 'a' || buf[2] != 't' || buf[3] != 'a' ) { - m_stream.Close(); + m_stream.close(); +#if DEBUG + Console.WriteLine( "WaveReader#Open; header error (data)" ); +#endif return false; } // size of data chunk - m_stream.Read( buf, 0, 4 ); - int size = BitConverter.ToInt32( buf, 0 ); + m_stream.read( buf, 0, 4 ); + int size = (int)PortUtil.make_uint32_le( buf ); m_total_samples = size / (m_channel * m_byte_per_sample); m_opened = true; + m_header_offset = (int)m_stream.getFilePointer(); return true; } - public int TotalSamples { - get { - return m_total_samples; - } + public int getTotalSamples() { + return m_total_samples; } - public void Read( long start, int length, out double[] left, out double[] right ) { - left = new double[length]; - right = new double[length]; + public void read( long start, int length, double[] left, double[] right ) +#if JAVA + throws IOException +#endif + { + //left = new double[length]; + //right = new double[length]; if ( !m_opened ) { return; } - long loc = 0x2e + m_byte_per_sample * m_channel * start; - m_stream.Seek( loc, SeekOrigin.Begin ); + int i_start = 0; + int i_end = length - 1; + long required_sample_start = start + (long)(m_offset_seconds * m_sample_per_sec); + long required_sample_end = required_sample_start + length; + // 第required_sample_startサンプルから,第required_sample_endサンプルまでの読み込みが要求された. + if ( required_sample_start < 0 ) { + i_start = -(int)required_sample_start + 1; + // 0 -> i_start - 1までは0で埋める + if ( i_start >= length ) { + // 全部0で埋める必要のある場合. + for ( int i = 0; i < length; i++ ) { + left[i] = 0.0; + right[i] = 0.0; + } + return; + } else { + for ( int i = 0; i < i_start; i++ ) { + left[i] = 0.0; + right[i] = 0.0; + } + } + m_stream.seek( m_header_offset ); + } else { + long loc = m_header_offset + m_byte_per_sample * m_channel * required_sample_start; + m_stream.seek( loc ); + } + if ( m_total_samples < required_sample_end ) { + i_end = length - 1 - (int)required_sample_end + m_total_samples; + // i_end + 1 -> length - 1までは0で埋める + if ( i_end < 0 ) { + // 全部0で埋める必要のある場合 + for ( int i = 0; i < length; i++ ) { + left[i] = 0.0; + right[i] = 0.0; + } + return; + } else { + for ( int i = i_end + 1; i < length; i++ ) { + left[i] = 0.0; + right[i] = 0.0; + } + } + } if ( m_byte_per_sample == 2 ) { if ( m_channel == 2 ) { byte[] buf = new byte[4]; - for ( int i = 0; i < length; i++ ) { - int ret = m_stream.Read( buf, 0, 4 ); + double coeff_left = m_amplify_left / 32768.0; + double coeff_right = m_amplify_right / 32768.0; + for ( int i = i_start; i <= i_end; i++ ) { + int ret = m_stream.read( buf, 0, 4 ); if ( ret < 4 ) { for ( int j = i; j < length; j++ ) { left[j] = 0.0f; @@ -139,13 +268,14 @@ namespace Boare.Lib.Media { } short l = (short)(buf[0] | buf[1] << 8); short r = (short)(buf[2] | buf[3] << 8); - left[i] = l / 32768.0f; - right[i] = r / 32768.0f; + left[i] = l * coeff_left; + right[i] = r * coeff_right; } } else { byte[] buf = new byte[2]; - for ( int i = 0; i < length; i++ ) { - int ret = m_stream.Read( buf, 0, 2 ); + double coeff_left = m_amplify_left / 32768.0; + for ( int i = i_start; i <= i_end; i++ ) { + int ret = m_stream.read( buf, 0, 2 ); if ( ret < 2 ) { for ( int j = i; j < length; j++ ) { left[j] = 0.0f; @@ -154,15 +284,17 @@ namespace Boare.Lib.Media { break; } short l = (short)(buf[0] | buf[1] << 8); - left[i] = l / 32768.0f; + left[i] = l * coeff_left; right[i] = left[i]; } } } else { if ( m_channel == 2 ) { byte[] buf = new byte[2]; - for ( int i = 0; i < length; i++ ) { - int ret = m_stream.Read( buf, 0, 2 ); + double coeff_left = m_amplify_left / 64.0; + double coeff_right = m_amplify_right / 64.0; + for ( int i = i_start; i <= i_end; i++ ) { + int ret = m_stream.read( buf, 0, 2 ); if ( ret < 2 ) { for ( int j = i; j < length; j++ ) { left[j] = 0.0f; @@ -170,13 +302,14 @@ namespace Boare.Lib.Media { } break; } - left[i] = (buf[0] - 64.0f) / 64.0f; - right[i] = (buf[1] - 64.0f) / 64.0f; + left[i] = (buf[0] - 64.0f) * coeff_left; + right[i] = (buf[1] - 64.0f) * coeff_right; } } else { byte[] buf = new byte[1]; - for ( int i = 0; i < length; i++ ) { - int ret = m_stream.Read( buf, 0, 1 ); + double coeff_left = m_amplify_left / 64.0; + for ( int i = i_start; i <= i_end; i++ ) { + int ret = m_stream.read( buf, 0, 1 ); if ( ret < 1 ) { for ( int j = i; j < length; j++ ) { left[j] = 0.0f; @@ -184,104 +317,161 @@ namespace Boare.Lib.Media { } break; } - left[i] = (buf[0] - 64.0f) / 64.0f; + left[i] = (buf[0] - 64.0f) * coeff_left; right[i] = left[i]; } } } } - public void Read( long start, int length, out float[] left, out float[] right ) { - left = new float[length]; - right = new float[length]; + public void read( long start, int length, ByRef left, ByRef right ) +#if JAVA + throws IOException +#endif + { + left.value = new float[length]; + right.value = new float[length]; if ( !m_opened ) { return; } - long loc = 0x2e + m_byte_per_sample * m_channel * start; - m_stream.Seek( loc, SeekOrigin.Begin ); + int i_start = 0; + int i_end = length; + long required_sample_start = start + (long)(m_offset_seconds * m_sample_per_sec); + long required_sample_end = required_sample_start + length; + // 第required_sample_startサンプルから,第required_sample_endサンプルまでの読み込みが要求された. + if ( required_sample_start < 0 ) { + i_start = -(int)required_sample_start + 1; + // 0 -> i_start - 1までは0で埋める + for ( int i = 0; i < i_start; i++ ) { + left.value[i] = 0.0f; + right.value[i] = 0.0f; + } + m_stream.seek( m_header_offset ); + } else { + long loc = m_header_offset + m_byte_per_sample * m_channel * required_sample_start; + m_stream.seek( loc ); + } + if ( m_total_samples < required_sample_end ) { + i_end = length - 1 - (int)required_sample_end + m_total_samples; + // i_end + 1 -> length - 1までは0で埋める + for ( int i = i_end + 1; i < length; i++ ) { + left.value[i] = 0.0f; + right.value[i] = 0.0f; + } + } if ( m_byte_per_sample == 2 ) { if ( m_channel == 2 ) { byte[] buf = new byte[4]; + float coeff_left = (float)(m_amplify_left / 32768.0f); + float coeff_right = (float)(m_amplify_right / 32768.0f); for ( int i = 0; i < length; i++ ) { - int ret = m_stream.Read( buf, 0, 4 ); + int ret = m_stream.read( buf, 0, 4 ); if ( ret < 4 ) { for ( int j = i; j < length; j++ ) { - left[j] = 0.0f; - right[j] = 0.0f; + left.value[j] = 0.0f; + right.value[j] = 0.0f; } break; } short l = (short)(buf[0] | buf[1] << 8); short r = (short)(buf[2] | buf[3] << 8); - left[i] = l / 32768.0f; - right[i] = r / 32768.0f; + left.value[i] = l * coeff_left; + right.value[i] = r * coeff_right; } } else { byte[] buf = new byte[2]; + float coeff_left = (float)(m_amplify_left / 32768.0f); for ( int i = 0; i < length; i++ ) { - int ret = m_stream.Read( buf, 0, 2 ); + int ret = m_stream.read( buf, 0, 2 ); if ( ret < 2 ) { for ( int j = i; j < length; j++ ) { - left[j] = 0.0f; - right[j] = 0.0f; + left.value[j] = 0.0f; + right.value[j] = 0.0f; } break; } short l = (short)(buf[0] | buf[1] << 8); - left[i] = l / 32768.0f; - right[i] = left[i]; + left.value[i] = l * coeff_left; + right.value[i] = left.value[i]; } } } else { if ( m_channel == 2 ) { byte[] buf = new byte[2]; + float coeff_left = (float)(m_amplify_left / 64.0f); + float coeff_right = (float)(m_amplify_right / 64.0f); for ( int i = 0; i < length; i++ ) { - int ret = m_stream.Read( buf, 0, 2 ); + int ret = m_stream.read( buf, 0, 2 ); if ( ret < 2 ) { for ( int j = i; j < length; j++ ) { - left[j] = 0.0f; - right[j] = 0.0f; + left.value[j] = 0.0f; + right.value[j] = 0.0f; } break; } - left[i] = (buf[0] - 64.0f) / 64.0f; - right[i] = (buf[1] - 64.0f) / 64.0f; + left.value[i] = (buf[0] - 64.0f) * coeff_left; + right.value[i] = (buf[1] - 64.0f) * coeff_right; } } else { byte[] buf = new byte[1]; + float coeff_left = (float)(m_amplify_left / 64.0f); for ( int i = 0; i < length; i++ ) { - int ret = m_stream.Read( buf, 0, 1 ); + int ret = m_stream.read( buf, 0, 1 ); if ( ret < 1 ) { for ( int j = i; j < length; j++ ) { - left[j] = 0.0f; - right[j] = 0.0f; + left.value[j] = 0.0f; + right.value[j] = 0.0f; } break; } - left[i] = (buf[0] - 64.0f) / 64.0f; - right[i] = left[i]; + left.value[i] = (buf[0] - 64.0f) * coeff_left; + right.value[i] = left.value[i]; } } } } - public unsafe void Read( long start, int length, out IntPtr ptr_left, out IntPtr ptr_right ) { - ptr_left = Marshal.AllocHGlobal( sizeof( float ) * length ); - ptr_right = Marshal.AllocHGlobal( sizeof( float ) * length ); +#if !JAVA + public unsafe void read( long start, int length, ref IntPtr ptr_left, ref IntPtr ptr_right ) { float* left = (float*)ptr_left.ToPointer(); float* right = (float*)ptr_right.ToPointer(); if ( !m_opened ) { return; } - long loc = 0x2e + m_byte_per_sample * m_channel * start; - m_stream.Seek( loc, SeekOrigin.Begin ); + int i_start = 0; + int i_end = length; + long required_sample_start = start + (long)(m_offset_seconds * m_sample_per_sec); + long required_sample_end = required_sample_start + length; + // 第required_sample_startサンプルから,第required_sample_endサンプルまでの読み込みが要求された. + if ( required_sample_start < 0 ) { + i_start = -(int)required_sample_start + 1; + // 0 -> i_start - 1までは0で埋める + for ( int i = 0; i < i_start; i++ ) { + left[i] = 0.0f; + right[i] = 0.0f; + } + m_stream.seek( m_header_offset ); + } else { + long loc = m_header_offset + m_byte_per_sample * m_channel * required_sample_start; + m_stream.seek( loc ); + } + if ( m_total_samples < required_sample_end ) { + i_end = length - 1 - (int)required_sample_end + m_total_samples; + // i_end + 1 -> length - 1までは0で埋める + for ( int i = i_end + 1; i < length; i++ ) { + left[i] = 0.0f; + right[i] = 0.0f; + } + } if ( m_byte_per_sample == 2 ) { if ( m_channel == 2 ) { byte[] buf = new byte[4]; + float coeff_left = (float)(m_amplify_left / 32768.0f); + float coeff_right = (float)(m_amplify_right / 32768.0f); for ( int i = 0; i < length; i++ ) { - int ret = m_stream.Read( buf, 0, 4 ); + int ret = m_stream.read( buf, 0, 4 ); if ( ret < 4 ) { for ( int j = i; j < length; j++ ) { left[j] = 0.0f; @@ -291,13 +481,14 @@ namespace Boare.Lib.Media { } short l = (short)(buf[0] | buf[1] << 8); short r = (short)(buf[2] | buf[3] << 8); - left[i] = l / 32768.0f; - right[i] = r / 32768.0f; + left[i] = l * coeff_left; + right[i] = r * coeff_right; } } else { byte[] buf = new byte[2]; + float coeff_left = (float)(m_amplify_left / 32768.0f); for ( int i = 0; i < length; i++ ) { - int ret = m_stream.Read( buf, 0, 2 ); + int ret = m_stream.read( buf, 0, 2 ); if ( ret < 2 ) { for ( int j = i; j < length; j++ ) { left[j] = 0.0f; @@ -306,15 +497,17 @@ namespace Boare.Lib.Media { break; } short l = (short)(buf[0] | buf[1] << 8); - left[i] = l / 32768.0f; + left[i] = l * coeff_left; right[i] = left[i]; } } } else { if ( m_channel == 2 ) { byte[] buf = new byte[2]; + float coeff_left = (float)(m_amplify_left / 64.0f); + float coeff_right = (float)(m_amplify_right / 64.0f); for ( int i = 0; i < length; i++ ) { - int ret = m_stream.Read( buf, 0, 2 ); + int ret = m_stream.read( buf, 0, 2 ); if ( ret < 2 ) { for ( int j = i; j < length; j++ ) { left[j] = 0.0f; @@ -322,13 +515,14 @@ namespace Boare.Lib.Media { } break; } - left[i] = (buf[0] - 64.0f) / 64.0f; - right[i] = (buf[1] - 64.0f) / 64.0f; + left[i] = (buf[0] - 64.0f) * coeff_left; + right[i] = (buf[1] - 64.0f) * coeff_right; } } else { byte[] buf = new byte[1]; + float coeff_left = (float)(m_amplify_left / 64.0f); for ( int i = 0; i < length; i++ ) { - int ret = m_stream.Read( buf, 0, 1 ); + int ret = m_stream.read( buf, 0, 1 ); if ( ret < 1 ) { for ( int j = i; j < length; j++ ) { left[j] = 0.0f; @@ -336,24 +530,33 @@ namespace Boare.Lib.Media { } break; } - left[i] = (buf[0] - 64.0f) / 64.0f; + left[i] = (buf[0] - 64.0f) * coeff_left; right[i] = left[i]; } } } } +#endif - public void Close() { + public void close() +#if JAVA + throws IOException +#endif + { m_opened = false; if ( m_stream != null ) { - m_stream.Close(); + m_stream.close(); m_stream = null; } } +#if !JAVA ~WaveReader() { - Close(); + close(); } +#endif } +#if !JAVA } +#endif diff --git a/trunk/Boare.Lib.Media/WaveWriter.cs b/trunk/Boare.Lib.Media/WaveWriter.cs index e94795d..52a3101 100644 --- a/trunk/Boare.Lib.Media/WaveWriter.cs +++ b/trunk/Boare.Lib.Media/WaveWriter.cs @@ -11,374 +11,404 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */ +#if JAVA +package org.kbinani.media; + +import java.io.*; +import org.kbinani.*; +#else using System; -using System.IO; +using bocoree; +using bocoree.java.io; namespace Boare.Lib.Media { +#endif - public class WaveWriter : IDisposable { - private WaveChannel m_channel; - private ushort m_bit_per_sample; - private uint m_sample_rate; - private uint m_total_samples = 0; - private FileStream m_stream = null; - private string m_path = ""; +#if JAVA + public class WaveWriter{ +#else + public class WaveWriter : IDisposable{ +#endif + private int m_channel = 1; + private int m_bit_per_sample; + private int m_sample_rate; + private int m_total_samples = 0; + private RandomAccessFile m_stream = null; + private String m_path = ""; - public WaveWriter( string path ) : - this ( path, WaveChannel.Stereo, 16, 44100 ) { + public WaveWriter( String path ) +#if JAVA + + throws IOException + { + this ( path, 2, 16, 44100 ); +#else + : this( path, 2, 16, 44100 ) { +#endif } - public WaveWriter( string path, WaveChannel channel, ushort bit_per_sample, uint sample_rate ) { + public WaveWriter( String path, int channel, int bit_per_sample, int sample_rate ) +#if JAVA + throws IOException +#endif + { m_path = path; - m_stream = new FileStream( m_path, FileMode.Create, FileAccess.Write ); + m_stream = new RandomAccessFile( m_path, "rw" ); m_channel = channel; m_bit_per_sample = bit_per_sample; m_sample_rate = sample_rate; m_total_samples = 0; - WriteHeader(); + writeHeader(); } +#if !JAVA + public void Dispose() { + close(); + } +#endif + /// /// Writes header of WAVE file /// - private void WriteHeader() { + private void writeHeader() +#if JAVA + throws IOException +#endif + { // RIFF - m_stream.WriteByte( 0x52 ); // loc=0x00 - m_stream.WriteByte( 0x49 ); - m_stream.WriteByte( 0x46 ); - m_stream.WriteByte( 0x46 ); + m_stream.writeByte( 0x52 ); // loc=0x00 + m_stream.writeByte( 0x49 ); + m_stream.writeByte( 0x46 ); + m_stream.writeByte( 0x46 ); // ファイルサイズ - 8最後に記入 - m_stream.WriteByte( 0x00 ); // loc=0x04 - m_stream.WriteByte( 0x00 ); - m_stream.WriteByte( 0x00 ); - m_stream.WriteByte( 0x00 ); + m_stream.writeByte( 0x00 ); // loc=0x04 + m_stream.writeByte( 0x00 ); + m_stream.writeByte( 0x00 ); + m_stream.writeByte( 0x00 ); // WAVE - m_stream.WriteByte( 0x57 ); // loc=0x08 - m_stream.WriteByte( 0x41 ); - m_stream.WriteByte( 0x56 ); - m_stream.WriteByte( 0x45 ); + m_stream.writeByte( 0x57 ); // loc=0x08 + m_stream.writeByte( 0x41 ); + m_stream.writeByte( 0x56 ); + m_stream.writeByte( 0x45 ); // fmt - m_stream.WriteByte( 0x66 ); // loc=0x0c - m_stream.WriteByte( 0x6d ); - m_stream.WriteByte( 0x74 ); - m_stream.WriteByte( 0x20 ); + m_stream.writeByte( 0x66 ); // loc=0x0c + m_stream.writeByte( 0x6d ); + m_stream.writeByte( 0x74 ); + m_stream.writeByte( 0x20 ); // fmt チャンクのサイズ - m_stream.WriteByte( 0x12 ); // loc=0x10 - m_stream.WriteByte( 0x00 ); - m_stream.WriteByte( 0x00 ); - m_stream.WriteByte( 0x00 ); + m_stream.writeByte( 0x12 ); // loc=0x10 + m_stream.writeByte( 0x00 ); + m_stream.writeByte( 0x00 ); + m_stream.writeByte( 0x00 ); // format ID - m_stream.WriteByte( 0x01 ); // loc=0x14 - m_stream.WriteByte( 0x00 ); + m_stream.writeByte( 0x01 ); // loc=0x14 + m_stream.writeByte( 0x00 ); // チャンネル数 - if ( m_channel == WaveChannel.Monoral ) { - m_stream.WriteByte( 0x01 ); // loc=0x16 - m_stream.WriteByte( 0x00 ); + if ( m_channel == 1 ) { + m_stream.writeByte( 0x01 ); // loc=0x16 + m_stream.writeByte( 0x00 ); } else { - m_stream.WriteByte( 0x02 ); //loc=0x16 - m_stream.WriteByte( 0x00 ); + m_stream.writeByte( 0x02 ); //loc=0x16 + m_stream.writeByte( 0x00 ); } // サンプリングレート - byte[] buf = BitConverter.GetBytes( m_sample_rate ); - WriteByteArray( m_stream, buf, 4 ); // 0x18 + byte[] buf = PortUtil.getbytes_uint32_le( m_sample_rate ); + writeByteArray( m_stream, buf, 4 ); // 0x18 // データ速度 - ushort block_size = (ushort)(m_bit_per_sample / 8 * (int)m_channel); - uint data_rate = m_sample_rate * block_size; - buf = BitConverter.GetBytes( data_rate ); - WriteByteArray( m_stream, buf, 4 );//loc=0x1c + int block_size = (int)(m_bit_per_sample / 8 * (int)m_channel); + int data_rate = m_sample_rate * block_size; + buf = PortUtil.getbytes_uint32_le( data_rate ); + writeByteArray( m_stream, buf, 4 );//loc=0x1c // ブロックサイズ - buf = BitConverter.GetBytes( block_size ); - WriteByteArray( m_stream, buf, 2 ); //0x20 + buf = PortUtil.getbytes_uint16_le( block_size ); + writeByteArray( m_stream, buf, 2 ); //0x20 // サンプルあたりのビット数 - buf = BitConverter.GetBytes( m_bit_per_sample ); - WriteByteArray( m_stream, buf, 2 ); //loc=0x22 + buf = PortUtil.getbytes_uint16_le( m_bit_per_sample ); + writeByteArray( m_stream, buf, 2 ); //loc=0x22 // 拡張部分 - m_stream.WriteByte( 0x00 ); //loc=0x24 - m_stream.WriteByte( 0x00 ); + m_stream.writeByte( 0x00 ); //loc=0x24 + m_stream.writeByte( 0x00 ); // data - m_stream.WriteByte( 0x64 ); //loc=0x26 - m_stream.WriteByte( 0x61 ); - m_stream.WriteByte( 0x74 ); - m_stream.WriteByte( 0x61 ); + m_stream.writeByte( 0x64 ); //loc=0x26 + m_stream.writeByte( 0x61 ); + m_stream.writeByte( 0x74 ); + m_stream.writeByte( 0x61 ); // size of data chunk - uint size = block_size * m_total_samples; - buf = BitConverter.GetBytes( size ); - WriteByteArray( m_stream, buf, 4 ); + int size = block_size * m_total_samples; + buf = PortUtil.getbytes_uint32_le( size ); + writeByteArray( m_stream, buf, 4 ); } - public void Close(){ + public void close() +#if JAVA + throws IOException +#endif + { if ( m_stream != null ) { // 最後にWAVEチャンクのサイズ - uint position = (uint)m_stream.Position; - m_stream.Seek( 4, SeekOrigin.Begin ); - byte[] buf = BitConverter.GetBytes( position - 8 ); - WriteByteArray( m_stream, buf, 4 ); + int position = (int)m_stream.getFilePointer(); + m_stream.seek( 4 ); + byte[] buf = PortUtil.getbytes_uint32_le( position - 8 ); + writeByteArray( m_stream, buf, 4 ); // size of data chunk - ushort block_size = (ushort)(m_bit_per_sample / 8 * (int)m_channel); - uint size = block_size * m_total_samples; - m_stream.Seek( 42, SeekOrigin.Begin ); - buf = BitConverter.GetBytes( size ); - WriteByteArray( m_stream, buf, 4 ); + int block_size = (int)(m_bit_per_sample / 8 * (int)m_channel); + int size = block_size * m_total_samples; + m_stream.seek( 42 ); + buf = PortUtil.getbytes_uint32_le( size ); + writeByteArray( m_stream, buf, 4 ); - m_stream.Close(); + m_stream.close(); } } - public uint SampleRate { - get { - return m_sample_rate; - } + public int getSampleRate(){ + return m_sample_rate; } - public void Dispose() { - Close(); - } - - public void Append( float[] L ) { + public void append( float[] L ) +#if JAVA + throws IOException +#endif + { int total = L.Length; if ( m_bit_per_sample == 8 ) { - if ( m_channel == WaveChannel.Monoral ) { + if ( m_channel == 1 ) { for ( int i = 0; i < total; i++ ) { - m_stream.WriteByte( (byte)((L[i] + 1.0f) * 127.5f) ); + m_stream.writeByte( (int)((L[i] + 1.0f) * 127.5f) ); } } else { for ( int i = 0; i < total; i++ ) { - byte b = (byte)((L[i] + 1.0f) * 127.5f); - m_stream.WriteByte( b ); - m_stream.WriteByte( b ); + int b = (int)((L[i] + 1.0f) * 127.5f); + m_stream.writeByte( b ); + m_stream.writeByte( b ); } } } else { byte[] buf; - if ( m_channel == WaveChannel.Monoral ) { + if ( m_channel == 1 ) { for ( int i = 0; i < total; i++ ) { - buf = BitConverter.GetBytes( (short)(L[i] * 32768f) ); - WriteByteArray( m_stream, buf, 2 ); + buf = PortUtil.getbytes_int16_le( (short)(L[i] * 32768f) ); + writeByteArray( m_stream, buf, 2 ); } } else { for ( int i = 0; i < total; i++ ) { - buf = BitConverter.GetBytes( (short)(L[i] * 32768f) ); - WriteByteArray( m_stream, buf, 2 ); - WriteByteArray( m_stream, buf, 2 ); + buf = PortUtil.getbytes_int16_le( (short)(L[i] * 32768f) ); + writeByteArray( m_stream, buf, 2 ); + writeByteArray( m_stream, buf, 2 ); } } } - m_total_samples += (uint)total; + m_total_samples += (int)total; } - public void Append( double[] L ) { + public void append( double[] L ) +#if JAVA + throws IOException +#endif + { int total = L.Length; if ( m_bit_per_sample == 8 ) { - if ( m_channel == WaveChannel.Monoral ) { + if ( m_channel == 1 ) { for ( int i = 0; i < total; i++ ) { - m_stream.WriteByte( (byte)((L[i] + 1.0) * 127.5) ); + m_stream.writeByte( (int)((L[i] + 1.0) * 127.5) ); } } else { for ( int i = 0; i < total; i++ ) { - byte b = (byte)((L[i] + 1.0) * 127.5); - m_stream.WriteByte( b ); - m_stream.WriteByte( b ); + int b = (int)((L[i] + 1.0) * 127.5); + m_stream.writeByte( b ); + m_stream.writeByte( b ); } } } else { byte[] buf; - if ( m_channel == WaveChannel.Monoral ) { + if ( m_channel == 1 ) { for ( int i = 0; i < total; i++ ) { - buf = BitConverter.GetBytes( (short)(L[i] * 32768.0) ); - WriteByteArray( m_stream, buf, 2 ); + buf = PortUtil.getbytes_int16_le( (short)(L[i] * 32768.0) ); + writeByteArray( m_stream, buf, 2 ); } } else { for ( int i = 0; i < total; i++ ) { - buf = BitConverter.GetBytes( (short)(L[i] * 32768.0) ); - WriteByteArray( m_stream, buf, 2 ); - WriteByteArray( m_stream, buf, 2 ); + buf = PortUtil.getbytes_int16_le( (short)(L[i] * 32768.0) ); + writeByteArray( m_stream, buf, 2 ); + writeByteArray( m_stream, buf, 2 ); } } } - m_total_samples += (uint)total; + m_total_samples += (int)total; } - public void Append( float[] L, float[] R ) { + public void append( float[] L, float[] R ) +#if JAVA + throws IOException +#endif + { int total = Math.Min( L.Length, R.Length ); if ( m_bit_per_sample == 8 ) { - if ( m_channel == WaveChannel.Monoral ) { + if ( m_channel == 1 ) { for ( int i = 0; i < total; i++ ) { - m_stream.WriteByte( (byte)((L[i] + R[i] + 2.0f) * 63.75f) ); + m_stream.writeByte( (byte)((L[i] + R[i] + 2.0f) * 63.75f) ); } } else { for ( int i = 0; i < total; i++ ) { - m_stream.WriteByte( (byte)((L[i] + 1.0f) * 127.5f) ); - m_stream.WriteByte( (byte)((R[i] + 1.0f) * 127.5f) ); + m_stream.writeByte( (byte)((L[i] + 1.0f) * 127.5f) ); + m_stream.writeByte( (byte)((R[i] + 1.0f) * 127.5f) ); } } } else { byte[] buf; - if ( m_channel == WaveChannel.Monoral ) { + if ( m_channel == 1 ) { for ( int i = 0; i < total; i++ ) { - buf = BitConverter.GetBytes( (short)((L[i] + R[i]) * 16384f) ); - WriteByteArray( m_stream, buf, 2 ); + buf = PortUtil.getbytes_int16_le( (short)((L[i] + R[i]) * 16384f) ); + writeByteArray( m_stream, buf, 2 ); } } else { for ( int i = 0; i < total; i++ ) { - buf = BitConverter.GetBytes( (short)(L[i] * 32768f) ); - WriteByteArray( m_stream, buf, 2 ); - buf = BitConverter.GetBytes( (short)(R[i] * 32768f) ); - WriteByteArray( m_stream, buf, 2 ); + buf = PortUtil.getbytes_int16_le( (short)(L[i] * 32768f) ); + writeByteArray( m_stream, buf, 2 ); + buf = PortUtil.getbytes_int16_le( (short)(R[i] * 32768f) ); + writeByteArray( m_stream, buf, 2 ); } } } - m_total_samples += (uint)total; + m_total_samples += (int)total; } - public unsafe void Append( float* L, float* R, int length ) { - if ( m_bit_per_sample == 8 ) { - if ( m_channel == WaveChannel.Monoral ) { - for ( int i = 0; i < length; i++ ) { - m_stream.WriteByte( (byte)((L[i] + R[i] + 2.0f) * 63.75f) ); - } - } else { - for ( int i = 0; i < length; i++ ) { - m_stream.WriteByte( (byte)((L[i] + 1.0f) * 127.5f) ); - m_stream.WriteByte( (byte)((R[i] + 1.0f) * 127.5f) ); - } - } - } else { - byte[] buf; - if ( m_channel == WaveChannel.Monoral ) { - for ( int i = 0; i < length; i++ ) { - buf = BitConverter.GetBytes( (short)((L[i] + R[i]) * 16384f) ); - WriteByteArray( m_stream, buf, 2 ); - } - } else { - for ( int i = 0; i < length; i++ ) { - buf = BitConverter.GetBytes( (short)(L[i] * 32768f) ); - WriteByteArray( m_stream, buf, 2 ); - buf = BitConverter.GetBytes( (short)(R[i] * 32768f) ); - WriteByteArray( m_stream, buf, 2 ); - } - } - } - m_total_samples += (uint)length; - } - - public void Append( double[] L, double[] R ) { + public void append( double[] L, double[] R ) +#if JAVA + throws IOException +#endif + { int total = Math.Min( L.Length, R.Length ); if ( m_bit_per_sample == 8 ) { - if ( m_channel == WaveChannel.Monoral ) { + if ( m_channel == 1 ) { for ( int i = 0; i < total; i++ ) { - m_stream.WriteByte( (byte)((L[i] + R[i] + 2.0) * 63.75) ); + m_stream.writeByte( (int)((L[i] + R[i] + 2.0) * 63.75) ); } } else { for ( int i = 0; i < total; i++ ) { - m_stream.WriteByte( (byte)((L[i] + 1.0) * 127.5) ); - m_stream.WriteByte( (byte)((R[i] + 1.0) * 127.5) ); + m_stream.writeByte( (int)((L[i] + 1.0) * 127.5) ); + m_stream.writeByte( (int)((R[i] + 1.0) * 127.5) ); } } } else { byte[] buf; - if ( m_channel == WaveChannel.Monoral ) { + if ( m_channel == 1 ) { for ( int i = 0; i < total; i++ ) { - buf = BitConverter.GetBytes( (short)((L[i] + R[i]) * 16384.0) ); - WriteByteArray( m_stream, buf, 2 ); + buf = PortUtil.getbytes_int16_le( (short)((L[i] + R[i]) * 16384.0) ); + writeByteArray( m_stream, buf, 2 ); } } else { for ( int i = 0; i < total; i++ ) { - buf = BitConverter.GetBytes( (short)(L[i] * 32768.0) ); - WriteByteArray( m_stream, buf, 2 ); - buf = BitConverter.GetBytes( (short)(R[i] * 32768.0) ); - WriteByteArray( m_stream, buf, 2 ); + buf = PortUtil.getbytes_int16_le( (short)(L[i] * 32768.0) ); + writeByteArray( m_stream, buf, 2 ); + buf = PortUtil.getbytes_int16_le( (short)(R[i] * 32768.0) ); + writeByteArray( m_stream, buf, 2 ); } } } - m_total_samples += (uint)total; + m_total_samples += (int)total; } - public void Append( byte[] L, byte[] R ) { + public void append( byte[] L, byte[] R ) +#if JAVA + throws IOException +#endif + { int total = Math.Min( L.Length, R.Length ); if ( m_bit_per_sample == 8 ) { - if ( m_channel == WaveChannel.Monoral ) { + if ( m_channel == 1 ) { for ( int i = 0; i < total; i++ ) { - m_stream.WriteByte( (byte)((L[i] + R[i]) / 2) ); + m_stream.writeByte( 0xff & ((L[i] + R[i]) / 2) ); } } else { for ( int i = 0; i < total; i++ ) { - m_stream.WriteByte( L[i] ); - m_stream.WriteByte( R[i] ); + m_stream.writeByte( 0xff & L[i] ); + m_stream.writeByte( 0xff & R[i] ); } } } else { byte[] buf; - if ( m_channel == WaveChannel.Monoral ) { + if ( m_channel == 1 ) { for ( int i = 0; i < total; i++ ) { - buf = BitConverter.GetBytes( (short)((L[i] + R[i]) * 128.5f - 32768f) ); - WriteByteArray( m_stream, buf, 2 ); + buf = PortUtil.getbytes_int16_le( (short)((L[i] + R[i]) * 128.5f - 32768f) ); + writeByteArray( m_stream, buf, 2 ); } } else { for ( int i = 0; i < total; i++ ) { - buf = BitConverter.GetBytes( (short)(L[i] * 257f - 32768f) ); - WriteByteArray( m_stream, buf, 2 ); - buf = BitConverter.GetBytes( (short)(R[i] * 257f - 32768f) ); - WriteByteArray( m_stream, buf, 2 ); + buf = PortUtil.getbytes_int16_le( (short)(L[i] * 257f - 32768f) ); + writeByteArray( m_stream, buf, 2 ); + buf = PortUtil.getbytes_int16_le( (short)(R[i] * 257f - 32768f) ); + writeByteArray( m_stream, buf, 2 ); } } } - m_total_samples += (uint)total; + m_total_samples += (int)total; } - public void Append( short[] L, short[] R ) { + public void append( short[] L, short[] R ) +#if JAVA + throws IOException +#endif + { int total = Math.Min( L.Length, R.Length ); if ( m_bit_per_sample == 8 ) { - if ( m_channel == WaveChannel.Monoral ) { + if ( m_channel == 1 ) { for ( int i = 0; i < total; i++ ) { - m_stream.WriteByte( (byte)(((L[i] + R[i]) / 2f + 32768f) / 255f) ); + m_stream.writeByte( (int)(((L[i] + R[i]) / 2f + 32768f) / 255f) ); } } else { for ( int i = 0; i < total; i++ ) { - m_stream.WriteByte( (byte)((L[i] + 32768f) / 255f) ); - m_stream.WriteByte( (byte)((R[i] + 32768f) / 255f) ); + m_stream.writeByte( (int)((L[i] + 32768f) / 255f) ); + m_stream.writeByte( (int)((R[i] + 32768f) / 255f) ); } } } else { byte[] buf; - if ( m_channel == WaveChannel.Monoral ) { + if ( m_channel == 1 ) { for ( int i = 0; i < total; i++ ) { - buf = BitConverter.GetBytes( (L[i] + R[i]) / 2 ); - WriteByteArray( m_stream, buf, 2 ); + buf = PortUtil.getbytes_int16_le( (short)((L[i] + R[i]) / 2) ); + writeByteArray( m_stream, buf, 2 ); } } else { for ( int i = 0; i < total; i++ ) { - buf = BitConverter.GetBytes( L[i] ); - WriteByteArray( m_stream, buf, 2 ); - buf = BitConverter.GetBytes( R[i] ); - WriteByteArray( m_stream, buf, 2 ); + buf = PortUtil.getbytes_int16_le( L[i] ); + writeByteArray( m_stream, buf, 2 ); + buf = PortUtil.getbytes_int16_le( R[i] ); + writeByteArray( m_stream, buf, 2 ); } } } - m_total_samples += (uint)total; + m_total_samples += (int)total; } - private static void WriteByteArray( FileStream fs, byte[] dat, int limit ) { - fs.Write( dat, 0, (dat.Length > limit) ? limit : dat.Length ); + private static void writeByteArray( RandomAccessFile fs, byte[] dat, int limit ) +#if JAVA + throws IOException +#endif + { + fs.write( dat, 0, (dat.Length > limit) ? limit : dat.Length ); if ( dat.Length < limit ) { for ( int i = 0; i < limit - dat.Length; i++ ) { - fs.WriteByte( 0x00 ); + fs.writeByte( 0x00 ); } } } } +#if !JAVA } +#endif diff --git a/trunk/Boare.Lib.Vsq/AttackConfig.cs b/trunk/Boare.Lib.Vsq/AttackConfig.cs index 58fb615..f18f6f3 100644 --- a/trunk/Boare.Lib.Vsq/AttackConfig.cs +++ b/trunk/Boare.Lib.Vsq/AttackConfig.cs @@ -12,13 +12,14 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */ #if JAVA -package com.boare.vsq; +package org.kbinani.vsq; + import java.io.*; +import org.kbinani.*; #else using System; -using System.IO; - using bocoree; +using bocoree.java.io; namespace Boare.Lib.Vsq { #endif @@ -34,12 +35,30 @@ namespace Boare.Lib.Vsq { contents = new NoteHeadHandle(); } +#if JAVA + public String toString(){ +#else + public override string ToString() { +#endif + if ( contents != null ) { + return contents.Caption; + } else { +#if JAVA + return super.toString(); +#else + return base.ToString(); +#endif + } + } + public void parseAic( String aic_file ) { - using ( StreamReader sr = new StreamReader( aic_file ) ) { + BufferedReader sr = null; + try { + sr = new BufferedReader( new FileReader( aic_file ) ); String line; String current_entry = ""; String articulation = ""; - while ( (line = sr.ReadLine()) != null ) { + while ( (line = sr.readLine()) != null ) { if ( line.StartsWith( "[" ) ) { current_entry = line; continue; @@ -47,7 +66,7 @@ namespace Boare.Lib.Vsq { continue; } - String[] spl = line.Split( new char[] { '=' }, StringSplitOptions.RemoveEmptyEntries ); + String[] spl = PortUtil.splitString( line, new char[] { '=' }, true ); if ( spl.Length < 2 ) { continue; } @@ -60,21 +79,33 @@ namespace Boare.Lib.Vsq { } else if ( current_entry.Equals( "[Parameter]" ) ) { if ( spl[0].Equals( "Length" ) ) { try { - this.contents.Length = int.Parse( spl[1] ); - } catch { } + this.contents.setLength( PortUtil.parseInt( spl[1] ) ); + } catch ( Exception ex ) { + } } else if ( spl[0].Equals( "Duration" ) ) { try { - this.contents.Duration = int.Parse( spl[1] ); - } catch { } + this.contents.Duration = PortUtil.parseInt( spl[1] ); + } catch ( Exception ex ) { + } } else if ( spl[0].Equals( "Depth" ) ) { try { - this.contents.Depth = int.Parse( spl[1] ); - } catch { } + this.contents.Depth = PortUtil.parseInt( spl[1] ); + } catch ( Exception ex ) { + } } } } + } catch ( Exception ex ) { + } finally { + if ( sr != null ) { + try { + sr.close(); + } catch ( Exception ex2 ) { + } + } } } } - +#if !JAVA } +#endif diff --git a/trunk/Boare.Lib.Vsq/BPPair.cs b/trunk/Boare.Lib.Vsq/BPPair.cs index 8ef236c..c2d80c8 100644 --- a/trunk/Boare.Lib.Vsq/BPPair.cs +++ b/trunk/Boare.Lib.Vsq/BPPair.cs @@ -12,7 +12,9 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */ #if JAVA -package com.boare.vsq; +package org.kbinani.vsq; + +import java.io.*; #else using System; @@ -23,10 +25,10 @@ namespace Boare.Lib.Vsq { /// Stores the paired value of "Clock" and integer. Mainly used in VsqBPList /// #if JAVA - class BPPair implements Comparable { + public class BPPair implements Comparable, Serializable{ #else [Serializable] - public class BPPair : IComparable { + public class BPPair : IComparable{ #endif public int Clock; public int Value; @@ -46,9 +48,11 @@ namespace Boare.Lib.Vsq { } } +#if !JAVA public int CompareTo( BPPair item ) { return compareTo( item ); } +#endif public BPPair( int clock_, int value_ ) { Clock = clock_; @@ -56,4 +60,6 @@ namespace Boare.Lib.Vsq { } } +#if !JAVA } +#endif diff --git a/trunk/Boare.Lib.Vsq/Boare.Lib.Vsq.csproj b/trunk/Boare.Lib.Vsq/Boare.Lib.Vsq.csproj index afa6219..f9b0e81 100644 --- a/trunk/Boare.Lib.Vsq/Boare.Lib.Vsq.csproj +++ b/trunk/Boare.Lib.Vsq/Boare.Lib.Vsq.csproj @@ -2,7 +2,7 @@ Debug AnyCPU - 9.0.21022 + 9.0.30729 2.0 {673347F3-6FC2-4F82-9273-BF158E0F8CB1} Library @@ -61,28 +61,47 @@ - + + + + + + + + - + + + + - + + + + + + + + + + @@ -95,17 +114,11 @@ - - - - - - - + diff --git a/trunk/Boare.Lib.Vsq/ExpressionConfigSys.cs b/trunk/Boare.Lib.Vsq/ExpressionConfigSys.cs index b43a300..9acdc45 100644 --- a/trunk/Boare.Lib.Vsq/ExpressionConfigSys.cs +++ b/trunk/Boare.Lib.Vsq/ExpressionConfigSys.cs @@ -12,64 +12,719 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */ #if JAVA -package com.boare.vsq; +package org.kbinani.vsq; + +import java.util.*; +import java.io.*; +import org.kbinani.*; #else using System; -using System.Collections.Generic; -using System.IO; using System.Text; - using bocoree; +using bocoree.java.util; +using bocoree.java.io; namespace Boare.Lib.Vsq { #endif public class ExpressionConfigSys { +#if JAVA + private final int MAX_VIBRATO = 0x400; +#else private const int MAX_VIBRATO = 0x400; +#endif private Vector m_vibrato_configs; private Vector m_attack_configs; + private void printTo( String file ) { + BufferedWriter sw = null; + try { + sw = new BufferedWriter( new FileWriter( file ) ); + int count = 0; + for ( Iterator itr = m_vibrato_configs.iterator(); itr.hasNext(); ) { + count++; + VibratoConfig vconfig = (VibratoConfig)itr.next(); + String name = "v" + count; + sw.write( "VibratoConfig " + name + " = new VibratoConfig();" ); + sw.newLine(); + sw.write( name + ".author = \"" + vconfig.author + "\";" ); + sw.newLine(); + sw.write( name + ".file = \"" + vconfig.file + "\";" ); + sw.newLine(); + sw.write( name + ".number = " + vconfig.number + ";" ); + sw.newLine(); + sw.write( name + ".vendor = \"" + vconfig.vendor + "\";" ); + sw.newLine(); + sw.write( name + ".contents.IconID = \"" + vconfig.contents.IconID + "\";" ); + sw.newLine(); + sw.write( name + ".contents.IDS = \"" + vconfig.contents.IDS + "\";" ); + sw.newLine(); + sw.write( name + ".contents.Original = " + vconfig.contents.Original + ";" ); + sw.newLine(); + sw.write( name + ".contents.Caption = \"" + vconfig.contents.Caption + "\";" ); + sw.newLine(); + sw.write( name + ".contents.Length = " + vconfig.contents.getLength() + ";" ); + sw.newLine(); + sw.write( name + ".contents.StartDepth = " + vconfig.contents.StartDepth + ";" ); + sw.write( name + ".contents.DepthBP = new VibratoBPList( new float[]{ " ); + for ( int i = 0; i < vconfig.contents.DepthBP.getCount(); i++ ) { + sw.write( ((i > 0) ? ", " : "") + vconfig.contents.DepthBP.getElement( i ).X + "f" ); + } + sw.write( " }, new int[]{ " ); + for ( int i = 0; i < vconfig.contents.DepthBP.getCount(); i++ ) { + sw.write( ((i > 0) ? ", " : "") + vconfig.contents.DepthBP.getElement( i ).Y ); + } + sw.write( " } );" ); + sw.newLine(); + sw.write( name + ".contents.StartRate = " + vconfig.contents.StartRate + ";" ); + sw.newLine(); + sw.write( name + ".contents.RateBP = new VibratoBPList( new float[]{ " ); + for ( int i = 0; i < vconfig.contents.RateBP.getCount(); i++ ) { + sw.write( ((i > 0) ? ", " : "") + vconfig.contents.RateBP.getElement( i ).X + "f" ); + } + sw.write( " }, new int[]{ " ); + for ( int i = 0; i < vconfig.contents.RateBP.getCount(); i++ ) { + sw.write( ((i > 0) ? ", " : "") + vconfig.contents.RateBP.getElement( i ).Y ); + } + sw.write( " } );" ); + sw.newLine(); + sw.write( "ret.m_vibrato_configs.add( " + name + " );" ); + sw.newLine(); + sw.newLine(); + } + count = 0; + + for ( Iterator itr = m_attack_configs.iterator(); itr.hasNext(); ) { + count++; + AttackConfig aconfig = (AttackConfig)itr.next(); + String name = "a" + count; + sw.write( "AttackConfig " + name + " = new AttackConfig();" ); + sw.newLine(); + sw.write( name + ".author = \"" + aconfig.author + "\";" ); + sw.newLine(); + sw.write( name + ".file = \"" + aconfig.file + "\";" ); + sw.newLine(); + sw.write( name + ".number = " + aconfig.number + ";" ); + sw.newLine(); + sw.write( name + ".vendor = \"" + aconfig.vendor + "\";" ); + sw.newLine(); + sw.write( name + ".contents.IconID = \"" + aconfig.contents.IconID + "\";" ); + sw.newLine(); + sw.write( name + ".contents.IDS = \"" + aconfig.contents.IDS + "\";" ); + sw.newLine(); + sw.write( name + ".contents.Original = " + aconfig.contents.Original + ";" ); + sw.newLine(); + sw.write( name + ".contents.Caption = \"" + aconfig.contents.Caption + "\";" ); + sw.newLine(); + sw.write( name + ".contents.Length = " + aconfig.contents.getLength() + ";" ); + sw.newLine(); + sw.write( name + ".contents.Duration = " + aconfig.contents.Duration + ";" ); + sw.newLine(); + sw.write( name + ".contents.Depth = " + aconfig.contents.Depth + ";" ); + sw.newLine(); + sw.write( "ret.m_attack_configs.add( " + name + " );" ); + sw.newLine(); + sw.newLine(); + } + } catch ( Exception ex ) { + } finally { + if ( sw != null ) { + try { + sw.close(); + } catch ( Exception ex2 ) { + } + } + } + } + + public static ExpressionConfigSys getVocaloid1Default() { + ExpressionConfigSys ret = new ExpressionConfigSys(); + ret.m_vibrato_configs = new Vector(); + ret.m_attack_configs = new Vector(); + VibratoConfig v1 = new VibratoConfig(); + v1.author = "Taro"; + v1.file = "normal.aic"; + v1.number = 1; + v1.vendor = "YAMAHA"; + v1.contents.IconID = "$04040001"; + v1.contents.IDS = "normal"; + v1.contents.Original = 0; + v1.contents.Caption = "Normal Vibrato"; + v1.contents.setLength( 480 ); + v1.contents.StartDepth = 64; + v1.contents.DepthBP = new VibratoBPList( new float[] { }, new int[] { } ); + v1.contents.StartRate = 64; + v1.contents.RateBP = new VibratoBPList( new float[] { }, new int[] { } ); + ret.m_vibrato_configs.add( v1 ); + + VibratoConfig v2 = new VibratoConfig(); + v2.author = "Taro"; + v2.file = "subtle.aic"; + v2.number = 2; + v2.vendor = "YAMAHA"; + v2.contents.IconID = "$04040002"; + v2.contents.IDS = "normal"; + v2.contents.Original = 0; + v2.contents.Caption = "Subtle Vibrato"; + v2.contents.setLength( 480 ); + v2.contents.StartDepth = 32; + v2.contents.DepthBP = new VibratoBPList( new float[] { }, new int[] { } ); + v2.contents.StartRate = 56; + v2.contents.RateBP = new VibratoBPList( new float[] { }, new int[] { } ); + ret.m_vibrato_configs.add( v2 ); + + VibratoConfig v3 = new VibratoConfig(); + v3.author = "Taro"; + v3.file = "slight.aic"; + v3.number = 3; + v3.vendor = "YAMAHA"; + v3.contents.IconID = "$04040003"; + v3.contents.IDS = "slight"; + v3.contents.Original = 0; + v3.contents.Caption = "Slight Vibrato"; + v3.contents.setLength( 480 ); + v3.contents.StartDepth = 32; + v3.contents.DepthBP = new VibratoBPList( new float[] { }, new int[] { } ); + v3.contents.StartRate = 64; + v3.contents.RateBP = new VibratoBPList( new float[] { }, new int[] { } ); + ret.m_vibrato_configs.add( v3 ); + + VibratoConfig v4 = new VibratoConfig(); + v4.author = "Taro"; + v4.file = "deep.aic"; + v4.number = 4; + v4.vendor = "YAMAHA"; + v4.contents.IconID = "$04040004"; + v4.contents.IDS = "deep"; + v4.contents.Original = 0; + v4.contents.Caption = "Deep Vibrato"; + v4.contents.setLength( 480 ); + v4.contents.StartDepth = 64; + v4.contents.DepthBP = new VibratoBPList( new float[] { }, new int[] { } ); + v4.contents.StartRate = 64; + v4.contents.RateBP = new VibratoBPList( new float[] { }, new int[] { } ); + ret.m_vibrato_configs.add( v4 ); + + VibratoConfig v5 = new VibratoConfig(); + v5.author = "Taro"; + v5.file = "verydeep.aic"; + v5.number = 5; + v5.vendor = "YAMAHA"; + v5.contents.IconID = "$04040005"; + v5.contents.IDS = "extreme"; + v5.contents.Original = 0; + v5.contents.Caption = "Very Deep Vibrato"; + v5.contents.setLength( 480 ); + v5.contents.StartDepth = 64; + v5.contents.DepthBP = new VibratoBPList( new float[] { }, new int[] { } ); + v5.contents.StartRate = 120; + v5.contents.RateBP = new VibratoBPList( new float[] { }, new int[] { } ); + ret.m_vibrato_configs.add( v5 ); + + VibratoConfig v6 = new VibratoConfig(); + v6.author = "Taro"; + v6.file = "extreme.aic"; + v6.number = 6; + v6.vendor = "YAMAHA"; + v6.contents.IconID = "$04040006"; + v6.contents.IDS = "extreme"; + v6.contents.Original = 0; + v6.contents.Caption = "Extreme Vibrato (like Japanese Enka)"; + v6.contents.setLength( 480 ); + v6.contents.StartDepth = 64; + v6.contents.DepthBP = new VibratoBPList( new float[] { }, new int[] { } ); + v6.contents.StartRate = 64; + v6.contents.RateBP = new VibratoBPList( new float[] { }, new int[] { } ); + ret.m_vibrato_configs.add( v6 ); + + AttackConfig a1 = new AttackConfig(); + a1.author = "Taro"; + a1.file = "na_tenuto.aic"; + a1.number = 1; + a1.vendor = "YAMAHA"; + a1.contents.IconID = "$01010001"; + a1.contents.IDS = "tenuto"; + a1.contents.Original = 0; + a1.contents.Caption = "Tenuto"; + a1.contents.setLength( 120 ); + a1.contents.Duration = 64; + a1.contents.Depth = 64; + ret.m_attack_configs.add( a1 ); + + AttackConfig a2 = new AttackConfig(); + a2.author = "Taro"; + a2.file = "na_accent.aic"; + a2.number = 2; + a2.vendor = "YAMAHA"; + a2.contents.IconID = "$01010002"; + a2.contents.IDS = "accent"; + a2.contents.Original = 0; + a2.contents.Caption = "Accent"; + a2.contents.setLength( 120 ); + a2.contents.Duration = 64; + a2.contents.Depth = 64; + ret.m_attack_configs.add( a2 ); + + AttackConfig a3 = new AttackConfig(); + a3.author = "Taro"; + a3.file = "na_extreme_accent.aic"; + a3.number = 3; + a3.vendor = "YAMAHA"; + a3.contents.IconID = "$01010003"; + a3.contents.IDS = "accent_extreme"; + a3.contents.Original = 0; + a3.contents.Caption = "Extreme Accent"; + a3.contents.setLength( 120 ); + a3.contents.Duration = 64; + a3.contents.Depth = 64; + ret.m_attack_configs.add( a3 ); + + AttackConfig a4 = new AttackConfig(); + a4.author = "Taro"; + a4.file = "na_legato.aic"; + a4.number = 4; + a4.vendor = "YAMAHA"; + a4.contents.IconID = "$01010004"; + a4.contents.IDS = "legato"; + a4.contents.Original = 0; + a4.contents.Caption = "Legato"; + a4.contents.setLength( 120 ); + a4.contents.Duration = 64; + a4.contents.Depth = 64; + ret.m_attack_configs.add( a4 ); + + AttackConfig a5 = new AttackConfig(); + a5.author = "Taro"; + a5.file = "na_fast_bendup.aic"; + a5.number = 5; + a5.vendor = "YAMAHA"; + a5.contents.IconID = "$01010005"; + a5.contents.IDS = "bendup_fast"; + a5.contents.Original = 0; + a5.contents.Caption = "Fast Bendu"; + a5.contents.setLength( 120 ); + a5.contents.Duration = 64; + a5.contents.Depth = 64; + ret.m_attack_configs.add( a5 ); + + AttackConfig a6 = new AttackConfig(); + a6.author = "Taro"; + a6.file = "na_slow_bendup.aic"; + a6.number = 6; + a6.vendor = "YAMAHA"; + a6.contents.IconID = "$01010006"; + a6.contents.IDS = "bendup_slow"; + a6.contents.Original = 0; + a6.contents.Caption = "Slow Bendup"; + a6.contents.setLength( 120 ); + a6.contents.Duration = 64; + a6.contents.Depth = 64; + ret.m_attack_configs.add( a6 ); + + AttackConfig a7 = new AttackConfig(); + a7.author = "Taro"; + a7.file = "na_trill_semi.aic"; + a7.number = 7; + a7.vendor = "YAMAHA"; + a7.contents.IconID = "$01010007"; + a7.contents.IDS = "trill_semi"; + a7.contents.Original = 0; + a7.contents.Caption = "Trill Semitone"; + a7.contents.setLength( 120 ); + a7.contents.Duration = 64; + a7.contents.Depth = 64; + ret.m_attack_configs.add( a7 ); + + AttackConfig a8 = new AttackConfig(); + a8.author = "Taro"; + a8.file = "na_trill_whole.aic"; + a8.number = 8; + a8.vendor = "YAMAHA"; + a8.contents.IconID = "$01010008"; + a8.contents.IDS = "trill_whole"; + a8.contents.Original = 0; + a8.contents.Caption = "Trill Wholetone"; + a8.contents.setLength( 120 ); + a8.contents.Duration = 64; + a8.contents.Depth = 64; + ret.m_attack_configs.add( a8 ); + + AttackConfig a9 = new AttackConfig(); + a9.author = "Taro"; + a9.file = "na_mordent_semi.aic"; + a9.number = 9; + a9.vendor = "YAMAHA"; + a9.contents.IconID = "$01010009"; + a9.contents.IDS = "mordent_semi"; + a9.contents.Original = 0; + a9.contents.Caption = "Mordent Semitone"; + a9.contents.setLength( 120 ); + a9.contents.Duration = 64; + a9.contents.Depth = 64; + ret.m_attack_configs.add( a9 ); + + AttackConfig a10 = new AttackConfig(); + a10.author = "Taro"; + a10.file = "na_mordent_whole.aic"; + a10.number = 10; + a10.vendor = "YAMAHA"; + a10.contents.IconID = "$0101000a"; + a10.contents.IDS = "mordent_whole"; + a10.contents.Original = 0; + a10.contents.Caption = "Mordent Wholetone"; + a10.contents.setLength( 120 ); + a10.contents.Duration = 64; + a10.contents.Depth = 64; + ret.m_attack_configs.add( a10 ); + + return ret; + } + + public static ExpressionConfigSys getVocaloid2Default() { + ExpressionConfigSys ret = new ExpressionConfigSys(); + ret.m_vibrato_configs = new Vector(); + ret.m_attack_configs = new Vector(); + VibratoConfig v1 = new VibratoConfig(); + v1.author = "Standard"; + v1.file = "normal2_type1.aic"; + v1.number = 1; + v1.vendor = "YAMAHA"; + v1.contents.IconID = "$04040001"; + v1.contents.IDS = "normal"; + v1.contents.Original = 0; + v1.contents.Caption = "[Normal] Type 1"; + v1.contents.setLength( 480 ); + v1.contents.StartDepth = 64; + v1.contents.DepthBP = new VibratoBPList( new float[] { }, new int[] { } ); + v1.contents.StartRate = 50; + v1.contents.RateBP = new VibratoBPList( new float[] { }, new int[] { } ); + ret.m_vibrato_configs.add( v1 ); + + VibratoConfig v2 = new VibratoConfig(); + v2.author = "Standard"; + v2.file = "normal2_type2.aic"; + v2.number = 2; + v2.vendor = "YAMAHA"; + v2.contents.IconID = "$04040002"; + v2.contents.IDS = "normal"; + v2.contents.Original = 0; + v2.contents.Caption = "[Normal] Type 2"; + v2.contents.setLength( 480 ); + v2.contents.StartDepth = 40; + v2.contents.DepthBP = new VibratoBPList( new float[] { }, new int[] { } ); + v2.contents.StartRate = 50; + v2.contents.RateBP = new VibratoBPList( new float[] { }, new int[] { } ); + ret.m_vibrato_configs.add( v2 ); + + VibratoConfig v3 = new VibratoConfig(); + v3.author = "Standard"; + v3.file = "normal2_type3.aic"; + v3.number = 3; + v3.vendor = "YAMAHA"; + v3.contents.IconID = "$04040003"; + v3.contents.IDS = "normal"; + v3.contents.Original = 0; + v3.contents.Caption = "[Normal] Type 3"; + v3.contents.setLength( 480 ); + v3.contents.StartDepth = 127; + v3.contents.DepthBP = new VibratoBPList( new float[] { }, new int[] { } ); + v3.contents.StartRate = 50; + v3.contents.RateBP = new VibratoBPList( new float[] { }, new int[] { } ); + ret.m_vibrato_configs.add( v3 ); + + VibratoConfig v4 = new VibratoConfig(); + v4.author = "Standard"; + v4.file = "normal2_type4.aic"; + v4.number = 4; + v4.vendor = "YAMAHA"; + v4.contents.IconID = "$04040004"; + v4.contents.IDS = "normal"; + v4.contents.Original = 0; + v4.contents.Caption = "[Normal] Type 4"; + v4.contents.setLength( 480 ); + v4.contents.StartDepth = 64; + v4.contents.DepthBP = new VibratoBPList( new float[] { 0.6042f, 0.6125f, 0.6167f, 0.6208f, 0.625f, 0.6333f, 0.6375f, 0.6417f, 0.6458f, 0.6542f, 0.6583f, 0.6667f, 0.6708f, 0.675f, 0.6792f, 0.6833f, 0.6917f, 0.6958f, 0.7042f, 0.7083f, 0.7125f, 0.7167f, 0.7208f, 0.725f, 0.7292f, 0.7375f, 0.7458f, 0.75f, 0.7583f, 0.7625f, 0.7667f, 0.7708f, 0.775f, 0.7833f, 0.7917f, 0.7958f, 0.8f, 0.8042f, 0.8083f, 0.8125f, 0.8208f, 0.8292f, 0.8375f, 0.8417f, 0.8458f, 0.85f, 0.8542f, 0.8625f, 0.8667f, 0.875f, 0.8792f, 0.8833f, 0.8875f, 0.8917f, 0.8958f, 0.9f, 1f }, new int[] { 64, 63, 62, 61, 59, 58, 57, 56, 55, 54, 52, 51, 50, 49, 48, 47, 45, 44, 43, 42, 41, 40, 39, 38, 37, 35, 34, 32, 31, 30, 29, 28, 27, 25, 24, 23, 22, 21, 20, 19, 17, 15, 14, 13, 12, 11, 10, 8, 7, 6, 5, 4, 3, 2, 1, 0, 0 } ); + v4.contents.StartRate = 50; + v4.contents.RateBP = new VibratoBPList( new float[] { 0.6f, 0.6125f, 0.6167f, 0.6208f, 0.6292f, 0.6333f, 0.6375f, 0.6417f, 0.6542f, 0.6583f, 0.6625f, 0.6667f, 0.675f, 0.6833f, 0.6875f, 0.6917f, 0.7f, 0.7042f, 0.7083f, 0.7125f, 0.725f, 0.7292f, 0.7333f, 0.7375f, 0.7458f, 0.75f, 0.7583f, 0.7625f, 0.7708f, 0.775f, 0.7792f, 0.7833f, 0.7958f, 0.8f, 0.8042f, 0.8083f, 0.8167f, 0.8208f, 0.8292f, 0.8333f, 0.8417f, 0.8458f, 0.85f, 0.8542f, 0.8667f, 0.8708f, 0.875f, 0.8792f, 0.8875f, 0.8917f, 0.9f, 1f }, new int[] { 50, 49, 48, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 0 } ); + ret.m_vibrato_configs.add( v4 ); + + VibratoConfig v5 = new VibratoConfig(); + v5.author = "Standard"; + v5.file = "extreme2_type1.aic"; + v5.number = 5; + v5.vendor = "YAMAHA"; + v5.contents.IconID = "$04040005"; + v5.contents.IDS = "extreme"; + v5.contents.Original = 0; + v5.contents.Caption = "[Extreme] Type 1"; + v5.contents.setLength( 480 ); + v5.contents.StartDepth = 64; + v5.contents.DepthBP = new VibratoBPList( new float[] { }, new int[] { } ); + v5.contents.StartRate = 64; + v5.contents.RateBP = new VibratoBPList( new float[] { }, new int[] { } ); + ret.m_vibrato_configs.add( v5 ); + + VibratoConfig v6 = new VibratoConfig(); + v6.author = "Standard"; + v6.file = "extreme2_type2.aic"; + v6.number = 6; + v6.vendor = "YAMAHA"; + v6.contents.IconID = "$04040006"; + v6.contents.IDS = "extreme"; + v6.contents.Original = 0; + v6.contents.Caption = "[Extreme] Type 2"; + v6.contents.setLength( 480 ); + v6.contents.StartDepth = 32; + v6.contents.DepthBP = new VibratoBPList( new float[] { }, new int[] { } ); + v6.contents.StartRate = 32; + v6.contents.RateBP = new VibratoBPList( new float[] { }, new int[] { } ); + ret.m_vibrato_configs.add( v6 ); + + VibratoConfig v7 = new VibratoConfig(); + v7.author = "Standard"; + v7.file = "extreme2_type3.aic"; + v7.number = 7; + v7.vendor = "YAMAHA"; + v7.contents.IconID = "$04040007"; + v7.contents.IDS = "extreme"; + v7.contents.Original = 0; + v7.contents.Caption = "[Extreme] Type 3"; + v7.contents.setLength( 480 ); + v7.contents.StartDepth = 100; + v7.contents.DepthBP = new VibratoBPList( new float[] { }, new int[] { } ); + v7.contents.StartRate = 50; + v7.contents.RateBP = new VibratoBPList( new float[] { }, new int[] { } ); + ret.m_vibrato_configs.add( v7 ); + + VibratoConfig v8 = new VibratoConfig(); + v8.author = "Standard"; + v8.file = "extreme2_type4.aic"; + v8.number = 8; + v8.vendor = "YAMAHA"; + v8.contents.IconID = "$04040008"; + v8.contents.IDS = "extreme"; + v8.contents.Original = 0; + v8.contents.Caption = "[Extreme] Type 4"; + v8.contents.setLength( 480 ); + v8.contents.StartDepth = 64; + v8.contents.DepthBP = new VibratoBPList( new float[] { 0.6042f, 0.6125f, 0.6167f, 0.6208f, 0.625f, 0.6333f, 0.6375f, 0.6417f, 0.6458f, 0.6542f, 0.6583f, 0.6667f, 0.6708f, 0.675f, 0.6792f, 0.6833f, 0.6917f, 0.6958f, 0.7042f, 0.7083f, 0.7125f, 0.7167f, 0.7208f, 0.725f, 0.7292f, 0.7375f, 0.7458f, 0.75f, 0.7583f, 0.7625f, 0.7667f, 0.7708f, 0.775f, 0.7833f, 0.7917f, 0.7958f, 0.8f, 0.8042f, 0.8083f, 0.8125f, 0.8208f, 0.8292f, 0.8375f, 0.8417f, 0.8458f, 0.85f, 0.8542f, 0.8625f, 0.8667f, 0.875f, 0.8792f, 0.8833f, 0.8875f, 0.8917f, 0.8958f, 0.9f, 1f }, new int[] { 64, 63, 62, 61, 59, 58, 57, 56, 55, 54, 52, 51, 50, 49, 48, 47, 45, 44, 43, 42, 41, 40, 39, 38, 37, 35, 34, 32, 31, 30, 29, 28, 27, 25, 24, 23, 22, 21, 20, 19, 17, 15, 14, 13, 12, 11, 10, 8, 7, 6, 5, 4, 3, 2, 1, 0, 0 } ); + v8.contents.StartRate = 64; + v8.contents.RateBP = new VibratoBPList( new float[] { 0.6042f, 0.6125f, 0.6167f, 0.6208f, 0.625f, 0.6333f, 0.6375f, 0.6417f, 0.6458f, 0.6542f, 0.6583f, 0.6667f, 0.6708f, 0.675f, 0.6792f, 0.6833f, 0.6917f, 0.6958f, 0.7042f, 0.7083f, 0.7125f, 0.7167f, 0.7208f, 0.725f, 0.7292f, 0.7375f, 0.7458f, 0.75f, 0.7583f, 0.7625f, 0.7667f, 0.7708f, 0.775f, 0.7833f, 0.7917f, 0.7958f, 0.8f, 0.8042f, 0.8083f, 0.8125f, 0.8208f, 0.8292f, 0.8375f, 0.8417f, 0.8458f, 0.85f, 0.8542f, 0.8625f, 0.8667f, 0.875f, 0.8792f, 0.8833f, 0.8875f, 0.8917f, 0.8958f, 0.9f, 1f }, new int[] { 64, 63, 62, 61, 59, 58, 57, 56, 55, 54, 52, 51, 50, 49, 48, 47, 45, 44, 43, 42, 41, 40, 39, 38, 37, 35, 34, 32, 31, 30, 29, 28, 27, 25, 24, 23, 22, 21, 20, 19, 17, 15, 14, 13, 12, 11, 10, 8, 7, 6, 5, 4, 3, 2, 1, 0, 0 } ); + ret.m_vibrato_configs.add( v8 ); + + VibratoConfig v9 = new VibratoConfig(); + v9.author = "Standard"; + v9.file = "fast2_type1.aic"; + v9.number = 9; + v9.vendor = "YAMAHA"; + v9.contents.IconID = "$04040009"; + v9.contents.IDS = "fast"; + v9.contents.Original = 0; + v9.contents.Caption = "[Fast] Type 1"; + v9.contents.setLength( 480 ); + v9.contents.StartDepth = 64; + v9.contents.DepthBP = new VibratoBPList( new float[] { }, new int[] { } ); + v9.contents.StartRate = 64; + v9.contents.RateBP = new VibratoBPList( new float[] { }, new int[] { } ); + ret.m_vibrato_configs.add( v9 ); + + VibratoConfig v10 = new VibratoConfig(); + v10.author = "Standard"; + v10.file = "fast2_type2.aic"; + v10.number = 10; + v10.vendor = "YAMAHA"; + v10.contents.IconID = "$0404000a"; + v10.contents.IDS = "fast"; + v10.contents.Original = 0; + v10.contents.Caption = "[Fast] Type 2"; + v10.contents.setLength( 480 ); + v10.contents.StartDepth = 40; + v10.contents.DepthBP = new VibratoBPList( new float[] { }, new int[] { } ); + v10.contents.StartRate = 50; + v10.contents.RateBP = new VibratoBPList( new float[] { }, new int[] { } ); + ret.m_vibrato_configs.add( v10 ); + + VibratoConfig v11 = new VibratoConfig(); + v11.author = "Standard"; + v11.file = "fast2_type3.aic"; + v11.number = 11; + v11.vendor = "YAMAHA"; + v11.contents.IconID = "$0404000b"; + v11.contents.IDS = "fast"; + v11.contents.Original = 0; + v11.contents.Caption = "[Fast] Type 3"; + v11.contents.setLength( 480 ); + v11.contents.StartDepth = 80; + v11.contents.DepthBP = new VibratoBPList( new float[] { }, new int[] { } ); + v11.contents.StartRate = 70; + v11.contents.RateBP = new VibratoBPList( new float[] { }, new int[] { } ); + ret.m_vibrato_configs.add( v11 ); + + VibratoConfig v12 = new VibratoConfig(); + v12.author = "Standard"; + v12.file = "fast2_type4.aic"; + v12.number = 12; + v12.vendor = "YAMAHA"; + v12.contents.IconID = "$0404000c"; + v12.contents.IDS = "fast"; + v12.contents.Original = 0; + v12.contents.Caption = "[Fast] Type 4"; + v12.contents.setLength( 480 ); + v12.contents.StartDepth = 64; + v12.contents.DepthBP = new VibratoBPList( new float[] { 0.6042f, 0.6125f, 0.6167f, 0.6208f, 0.625f, 0.6333f, 0.6375f, 0.6417f, 0.6458f, 0.6542f, 0.6583f, 0.6667f, 0.6708f, 0.675f, 0.6792f, 0.6833f, 0.6917f, 0.6958f, 0.7042f, 0.7083f, 0.7125f, 0.7167f, 0.7208f, 0.725f, 0.7292f, 0.7375f, 0.7458f, 0.75f, 0.7583f, 0.7625f, 0.7667f, 0.7708f, 0.775f, 0.7833f, 0.7917f, 0.7958f, 0.8f, 0.8042f, 0.8083f, 0.8125f, 0.8208f, 0.8292f, 0.8375f, 0.8417f, 0.8458f, 0.85f, 0.8542f, 0.8625f, 0.8667f, 0.875f, 0.8792f, 0.8833f, 0.8875f, 0.8917f, 0.8958f, 0.9f, 1f }, new int[] { 64, 63, 62, 61, 59, 58, 57, 56, 55, 54, 52, 51, 50, 49, 48, 47, 45, 44, 43, 42, 41, 40, 39, 38, 37, 35, 34, 32, 31, 30, 29, 28, 27, 25, 24, 23, 22, 21, 20, 19, 17, 15, 14, 13, 12, 11, 10, 8, 7, 6, 5, 4, 3, 2, 1, 0, 0 } ); + v12.contents.StartRate = 64; + v12.contents.RateBP = new VibratoBPList( new float[] { 0.6042f, 0.6125f, 0.6167f, 0.6208f, 0.625f, 0.6333f, 0.6375f, 0.6417f, 0.6458f, 0.6542f, 0.6583f, 0.6667f, 0.6708f, 0.675f, 0.6792f, 0.6833f, 0.6917f, 0.6958f, 0.7042f, 0.7083f, 0.7125f, 0.7167f, 0.7208f, 0.725f, 0.7292f, 0.7375f, 0.7458f, 0.75f, 0.7583f, 0.7625f, 0.7667f, 0.7708f, 0.775f, 0.7833f, 0.7917f, 0.7958f, 0.8f, 0.8042f, 0.8083f, 0.8125f, 0.8208f, 0.8292f, 0.8375f, 0.8417f, 0.8458f, 0.85f, 0.8542f, 0.8625f, 0.8667f, 0.875f, 0.8792f, 0.8833f, 0.8875f, 0.8917f, 0.8958f, 0.9f, 1f }, new int[] { 64, 63, 62, 61, 59, 58, 57, 56, 55, 54, 52, 51, 50, 49, 48, 47, 45, 44, 43, 42, 41, 40, 39, 38, 37, 35, 34, 32, 31, 30, 29, 28, 27, 25, 24, 23, 22, 21, 20, 19, 17, 15, 14, 13, 12, 11, 10, 8, 7, 6, 5, 4, 3, 2, 1, 0, 0 } ); + ret.m_vibrato_configs.add( v12 ); + + VibratoConfig v13 = new VibratoConfig(); + v13.author = "Standard"; + v13.file = "slight2_type1.aic"; + v13.number = 13; + v13.vendor = "YAMAHA"; + v13.contents.IconID = "$0404000d"; + v13.contents.IDS = "slight"; + v13.contents.Original = 0; + v13.contents.Caption = "[Slight] Type 1"; + v13.contents.setLength( 480 ); + v13.contents.StartDepth = 64; + v13.contents.DepthBP = new VibratoBPList( new float[] { }, new int[] { } ); + v13.contents.StartRate = 64; + v13.contents.RateBP = new VibratoBPList( new float[] { }, new int[] { } ); + ret.m_vibrato_configs.add( v13 ); + + VibratoConfig v14 = new VibratoConfig(); + v14.author = "Standard"; + v14.file = "slight2_type2.aic"; + v14.number = 14; + v14.vendor = "YAMAHA"; + v14.contents.IconID = "$0404000e"; + v14.contents.IDS = "slight"; + v14.contents.Original = 0; + v14.contents.Caption = "[Slight] Type 2"; + v14.contents.setLength( 480 ); + v14.contents.StartDepth = 40; + v14.contents.DepthBP = new VibratoBPList( new float[] { }, new int[] { } ); + v14.contents.StartRate = 64; + v14.contents.RateBP = new VibratoBPList( new float[] { }, new int[] { } ); + ret.m_vibrato_configs.add( v14 ); + + VibratoConfig v15 = new VibratoConfig(); + v15.author = "Standard"; + v15.file = "slight2_type3.aic"; + v15.number = 15; + v15.vendor = "YAMAHA"; + v15.contents.IconID = "$0404000f"; + v15.contents.IDS = "slight"; + v15.contents.Original = 0; + v15.contents.Caption = "[Slight] Type 3"; + v15.contents.setLength( 480 ); + v15.contents.StartDepth = 72; + v15.contents.DepthBP = new VibratoBPList( new float[] { }, new int[] { } ); + v15.contents.StartRate = 64; + v15.contents.RateBP = new VibratoBPList( new float[] { }, new int[] { } ); + ret.m_vibrato_configs.add( v15 ); + + VibratoConfig v16 = new VibratoConfig(); + v16.author = "Standard"; + v16.file = "slight2_type4.aic"; + v16.number = 16; + v16.vendor = "YAMAHA"; + v16.contents.IconID = "$04040010"; + v16.contents.IDS = "slight"; + v16.contents.Original = 0; + v16.contents.Caption = "[Slight] Type 4"; + v16.contents.setLength( 480 ); + v16.contents.StartDepth = 64; + v16.contents.DepthBP = new VibratoBPList( new float[] { 0.6042f, 0.6125f, 0.6167f, 0.6208f, 0.625f, 0.6333f, 0.6375f, 0.6417f, 0.6458f, 0.6542f, 0.6583f, 0.6667f, 0.6708f, 0.675f, 0.6792f, 0.6833f, 0.6917f, 0.6958f, 0.7042f, 0.7083f, 0.7125f, 0.7167f, 0.7208f, 0.725f, 0.7292f, 0.7375f, 0.7458f, 0.75f, 0.7583f, 0.7625f, 0.7667f, 0.7708f, 0.775f, 0.7833f, 0.7917f, 0.7958f, 0.8f, 0.8042f, 0.8083f, 0.8125f, 0.8208f, 0.8292f, 0.8375f, 0.8417f, 0.8458f, 0.85f, 0.8542f, 0.8625f, 0.8667f, 0.875f, 0.8792f, 0.8833f, 0.8875f, 0.8917f, 0.8958f, 0.9f, 1f }, new int[] { 64, 63, 62, 61, 59, 58, 57, 56, 55, 54, 52, 51, 50, 49, 48, 47, 45, 44, 43, 42, 41, 40, 39, 38, 37, 35, 34, 32, 31, 30, 29, 28, 27, 25, 24, 23, 22, 21, 20, 19, 17, 15, 14, 13, 12, 11, 10, 8, 7, 6, 5, 4, 3, 2, 1, 0, 0 } ); + v16.contents.StartRate = 64; + v16.contents.RateBP = new VibratoBPList( new float[] { 0.6042f, 0.6125f, 0.6167f, 0.6208f, 0.625f, 0.6333f, 0.6375f, 0.6417f, 0.6458f, 0.6542f, 0.6583f, 0.6667f, 0.6708f, 0.675f, 0.6792f, 0.6833f, 0.6917f, 0.6958f, 0.7042f, 0.7083f, 0.7125f, 0.7167f, 0.7208f, 0.725f, 0.7292f, 0.7375f, 0.7458f, 0.75f, 0.7583f, 0.7625f, 0.7667f, 0.7708f, 0.775f, 0.7833f, 0.7917f, 0.7958f, 0.8f, 0.8042f, 0.8083f, 0.8125f, 0.8208f, 0.8292f, 0.8375f, 0.8417f, 0.8458f, 0.85f, 0.8542f, 0.8625f, 0.8667f, 0.875f, 0.8792f, 0.8833f, 0.8875f, 0.8917f, 0.8958f, 0.9f, 1f }, new int[] { 64, 63, 62, 61, 59, 58, 57, 56, 55, 54, 52, 51, 50, 49, 48, 47, 45, 44, 43, 42, 41, 40, 39, 38, 37, 35, 34, 32, 31, 30, 29, 28, 27, 25, 24, 23, 22, 21, 20, 19, 17, 15, 14, 13, 12, 11, 10, 8, 7, 6, 5, 4, 3, 2, 1, 0, 0 } ); + ret.m_vibrato_configs.add( v16 ); + + return ret; + } + + public int getVibratoConfigCount() { + return m_vibrato_configs.size(); + } + + public int getAttackConfigCount() { + return m_attack_configs.size(); + } + + public Iterator vibratoConfigIterator() { +#if JAVA + return m_vibrato_configs.iterator(); +#else + return new ListIterator( m_vibrato_configs ); +#endif + } + + public Iterator attackConfigIterator() { +#if JAVA + return m_attack_configs.iterator(); +#else + return new ListIterator( m_attack_configs ); +#endif + } + + private ExpressionConfigSys() { + } + public ExpressionConfigSys( String path_expdb ) { m_vibrato_configs = new Vector(); m_attack_configs = new Vector(); - String expression = Path.Combine( path_expdb, "expression.map" ); - if ( !File.Exists( expression ) ) { + String expression = PortUtil.combinePath( path_expdb, "expression.map" ); + if ( !PortUtil.isFileExists( expression ) ) { +#if DEBUG + PortUtil.println( "ExpressionConfigSys#.ctor; expression.map does not exist" ); +#endif return; } - FileStream fs = null; + RandomAccessFile fs = null; try { - new FileStream( expression, FileMode.Open, FileAccess.Read ); + fs = new RandomAccessFile( expression, "r" ); byte[] dat = new byte[8]; - fs.Seek( 0x20, SeekOrigin.Begin ); + fs.seek( 0x20 ); for ( int i = 0; i < MAX_VIBRATO; i++ ) { - fs.Read( dat, 0, 8 ); - ulong value = VocaloSysUtil.makelong_le( dat ); - + fs.read( dat, 0, 8 ); + long value = VocaloSysUtil.makelong_le( dat ); if ( value <= 0 ) { continue; } - String ved = Path.Combine( path_expdb, "vexp" + value + ".ved" ); - if ( !File.Exists( ved ) ) { + String ved = PortUtil.combinePath( path_expdb, "vexp" + value + ".ved" ); + if ( !PortUtil.isFileExists( ved ) ) { continue; } - String vexp_dir = Path.Combine( path_expdb, "vexp" + value ); - if ( !Directory.Exists( vexp_dir ) ) { + String vexp_dir = PortUtil.combinePath( path_expdb, "vexp" + value ); + if ( !PortUtil.isFileExists( vexp_dir ) ) { continue; } +#if DEBUG + PortUtil.println( "ExpresionConfigSys#.ctor; ved=" + ved + "; vexp_dir=" + vexp_dir ); +#endif String NL = (char)0x0D + "" + (char)0x0A; - FileStream fs_ved = null; + RandomAccessFile fs_ved = null; try { - fs_ved = new FileStream( ved, FileMode.Open, FileAccess.Read ); - byte[] byte_ved = new byte[fs_ved.Length]; - fs_ved.Read( byte_ved, 0, byte_ved.Length ); - TransCodeUtil.decodeBytes( ref byte_ved ); - String str = new String( Encoding.ASCII.GetChars( byte_ved ) ); - String[] spl = str.Split( new String[] { NL }, StringSplitOptions.RemoveEmptyEntries ); + fs_ved = new RandomAccessFile( ved, "r" ); + byte[] byte_ved = new byte[(int)fs_ved.length()]; + fs_ved.read( byte_ved, 0, byte_ved.Length ); + TransCodeUtil.decodeBytes( byte_ved ); + String str = PortUtil.getDecodedString( "ASCII", byte_ved ); +#if DEBUG + String txt_file = PortUtil.combinePath( path_expdb, "vexp" + value + ".txt" ); + using ( System.IO.StreamWriter sw = new System.IO.StreamWriter( txt_file ) ) { + sw.Write( str ); + } +#endif + String[] spl = PortUtil.splitString( str, new String[] { NL }, true ); String current_entry = ""; for ( int j = 0; j < spl.Length; j++ ) { +#if DEBUG + //PortUtil.println( "ExpressionConfigSys#.ctor; line=" + spl[j] ); +#endif if ( spl[j].StartsWith( "[" ) ) { current_entry = spl[j]; continue; @@ -77,63 +732,82 @@ namespace Boare.Lib.Vsq { continue; } if ( current_entry.Equals( "[VIBRATO]" ) ) { - String[] spl2 = spl[j].Split( ',' ); + String[] spl2 = PortUtil.splitString( spl[j], ',' ); if ( spl2.Length < 6 ) { continue; } // ex: 1,1,"normal","normal2_type1.aic","[Normal]:Type:1","Standard","YAMAHA",0 VibratoConfig item = new VibratoConfig(); - item.number = int.Parse( spl2[0] ); + item.number = PortUtil.parseInt( spl2[0] ); item.contents.IDS = spl2[2].Replace( "\"", "" ); item.file = spl2[3].Replace( "\"", "" ); item.contents.Caption = spl2[4].Replace( ":", " " ).Replace( "\"", "" ); item.author = spl2[5].Replace( "\"", "" ); item.vendor = spl2[6].Replace( "\"", "" ); - String aic_file = Path.Combine( vexp_dir, item.file ); - if ( !File.Exists( aic_file ) ) { + item.contents.IconID = "$0404" + PortUtil.toHexString( item.number, 4 ); + String aic_file = PortUtil.combinePath( vexp_dir, item.file ); + if ( !PortUtil.isFileExists( aic_file ) ) { continue; } item.parseAic( aic_file ); + m_vibrato_configs.add( item ); } if ( current_entry.Equals( "[NOTEATTACK]" ) ) { - String[] spl2 = spl[j].Split( ',' ); + String[] spl2 = PortUtil.splitString( spl[j], ',' ); if ( spl2.Length < 6 ) { continue; } // ex: 1,1,"normal","normal2_type1.aic","[Normal]:Type:1","Standard","YAMAHA",0 AttackConfig item = new AttackConfig(); - item.number = int.Parse( spl2[0] ); + item.number = PortUtil.parseInt( spl2[0] ); item.contents.IDS = spl2[2].Replace( "\"", "" ); item.file = spl2[3].Replace( "\"", "" ); item.contents.Caption = spl2[4].Replace( ":", " " ).Replace( "\"", "" ); item.author = spl2[5].Replace( "\"", "" ); item.vendor = spl2[6].Replace( "\"", "" ); - String aic_file = Path.Combine( vexp_dir, item.file ); - if ( !File.Exists( aic_file ) ) { + item.contents.IconID = "$0101" + PortUtil.toHexString( item.number, 4 ); + String aic_file = PortUtil.combinePath( vexp_dir, item.file ); + if ( !PortUtil.isFileExists( aic_file ) ) { continue; } item.parseAic( aic_file ); + m_attack_configs.add( item ); } } } catch ( Exception ex ) { +#if DEBUG + PortUtil.println( "ExpressionConfigSys#.ctor; ex=" + ex ); +#endif } finally { if ( fs_ved != null ) { try { - fs_ved.Close(); + fs_ved.close(); } catch ( Exception ex2 ) { +#if DEBUG + PortUtil.println( "ExpressionConfigSys#.ctor; ex2=" + ex2 ); +#endif } } } } } catch ( Exception ex ) { +#if DEBUG + PortUtil.println( "ExpressionConfigSys#.ctor; ex=" + ex ); +#endif } finally { if ( fs != null ) { try { - fs.Close(); + fs.close(); } catch ( Exception ex2 ) { +#if DEBUG + PortUtil.println( "ExpressionConfigSys#.ctor; ex2=" + ex2 ); +#endif } } } } + } +#if !JAVA } +#endif diff --git a/trunk/Boare.Lib.Vsq/ITextWriter.cs b/trunk/Boare.Lib.Vsq/ITextWriter.cs new file mode 100644 index 0000000..a55c42c --- /dev/null +++ b/trunk/Boare.Lib.Vsq/ITextWriter.cs @@ -0,0 +1,38 @@ +/* + * ITextWriter.cs + * Copyright (c) 2009 kbinani + * + * This file is part of Boare.Lib.Vsq. + * + * Boare.Lib.Vsq is free software; you can redistribute it and/or + * modify it under the terms of the BSD License. + * + * Boare.Lib.Vsq 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. + */ +#if JAVA +package org.kbinani.vsq; + +import java.io.*; +#else +using System; + +namespace Boare.Lib.Vsq { +#endif + + public interface ITextWriter { +#if JAVA + void write( String value ) throws IOException; + void writeLine( String value ) throws IOException; + void close() throws IOException; +#else + void write( String value ); + void writeLine( String value ); + void close(); +#endif + } + +#if !JAVA +} +#endif diff --git a/trunk/Boare.Lib.Vsq/IconHandle.cs b/trunk/Boare.Lib.Vsq/IconHandle.cs new file mode 100644 index 0000000..e649776 --- /dev/null +++ b/trunk/Boare.Lib.Vsq/IconHandle.cs @@ -0,0 +1,94 @@ +/* + * IconHandle.cs + * Copyright (c) 2008-2009 kbinani + * + * This file is part of Boare.Lib.Vsq. + * + * Boare.Lib.Vsq is free software; you can redistribute it and/or + * modify it under the terms of the BSD License. + * + * Boare.Lib.Vsq 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. + */ +#if JAVA +package org.kbinani.vsq; + +import java.io.*; +#else +using System; + +namespace Boare.Lib.Vsq { + using boolean = System.Boolean; +#endif + +#if JAVA + public class IconHandle implements Cloneable, Serializable{ +#else + [Serializable] + public class IconHandle : ICloneable{ +#endif + public String Caption = ""; + public String IconID = ""; + public String IDS = ""; + public int Index; + public int Length; + public int Original; + public int Program; + public int Language; + + public IconHandle() { + } + + public int getLength() { + return Length; + } + + public void setLength( int value ) { + Length = value; + } + + public boolean equals( IconHandle item ) { + if ( item == null ) { + return false; + } else { + return IconID.Equals( item.IconID ); + } + } + + public Object clone() { + IconHandle ret = new IconHandle(); + ret.Caption = Caption; + ret.IconID = IconID; + ret.IDS = IDS; + ret.Index = Index; + ret.Language = Language; + ret.setLength( Length ); + ret.Original = Original; + ret.Program = Program; + return ret; + } + +#if !JAVA + public object Clone() { + return clone(); + } +#endif + + public VsqHandle castToVsqHandle() { + VsqHandle ret = new VsqHandle(); + ret.m_type = VsqHandleType.Singer; + ret.Caption = Caption; + ret.IconID = IconID; + ret.IDS = IDS; + ret.Index = Index; + ret.Language = Language; + ret.setLength( Length ); + ret.Program = Program; + return ret; + } + } + +#if !JAVA +} +#endif diff --git a/trunk/Boare.Lib.Vsq/VsqMetaText/Lyric.cs b/trunk/Boare.Lib.Vsq/Lyric.cs similarity index 65% rename from trunk/Boare.Lib.Vsq/VsqMetaText/Lyric.cs rename to trunk/Boare.Lib.Vsq/Lyric.cs index c5b89dd..c7f4e01 100644 --- a/trunk/Boare.Lib.Vsq/VsqMetaText/Lyric.cs +++ b/trunk/Boare.Lib.Vsq/Lyric.cs @@ -1,5 +1,5 @@ /* - * VsqMetaText/Lyric.cs + * Lyric.cs * Copyright (c) 2008-2009 kbinani * * This file is part of Boare.Lib.Vsq. @@ -11,23 +11,28 @@ * 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.IO; -using System.Windows.Forms; +#if JAVA +package org.kbinani.vsq; +import java.io.*; +import org.kbinani.*; +#else +using System; using bocoree; namespace Boare.Lib.Vsq { - using boolean = System.Boolean; +#endif /// /// VsqHandleに格納される歌詞の情報を扱うクラス。 /// +#if JAVA + public class Lyric implements Serializable{ +#else [Serializable] public class Lyric { +#endif /// /// この歌詞のフレーズ /// @@ -45,16 +50,28 @@ namespace Boare.Lib.Vsq { /// このオブジェクトの簡易コピーを取得します。 /// /// このインスタンスの簡易コピー - public Lyric Clone() { + public Object clone() { Lyric result = new Lyric(); result.Phrase = this.Phrase; - result.m_phonetic_symbol = (String[])this.m_phonetic_symbol.Clone(); + result.m_phonetic_symbol = new String[m_phonetic_symbol.Length]; + for ( int i = 0; i < m_phonetic_symbol.Length; i++ ) { + result.m_phonetic_symbol[i] = m_phonetic_symbol[i]; + } result.UnknownFloat = this.UnknownFloat; - result.m_consonant_adjustment = (int[])this.m_consonant_adjustment.Clone(); + result.m_consonant_adjustment = new int[m_consonant_adjustment.Length]; + for ( int i = 0; i < m_consonant_adjustment.Length; i++ ) { + result.m_consonant_adjustment[i] = m_consonant_adjustment[i]; + } result.PhoneticSymbolProtected = PhoneticSymbolProtected; return result; } +#if !JAVA + public Object Clone() { + return clone(); + } +#endif + /// /// 歌詞、発音記号を指定したコンストラクタ /// @@ -85,9 +102,9 @@ namespace Boare.Lib.Vsq { /// public void setPhoneticSymbol( String value ) { String s = value.Replace( " ", " " ); - m_phonetic_symbol = s.Split( " ".ToCharArray(), 16 ); + m_phonetic_symbol = PortUtil.splitString( s, new char[] { ' ' }, 16 ); for ( int i = 0; i < m_phonetic_symbol.Length; i++ ) { - m_phonetic_symbol[i] = m_phonetic_symbol[i].Replace( @"\\", @"\" ); + m_phonetic_symbol[i] = m_phonetic_symbol[i].Replace( "\\" + "\\", "\\" ); } m_consonant_adjustment = new int[m_phonetic_symbol.Length]; for ( int i = 0; i < m_phonetic_symbol.Length; i++ ) { @@ -99,6 +116,7 @@ namespace Boare.Lib.Vsq { } } +#if !JAVA /// /// XMLシリアライズ用 /// @@ -110,6 +128,7 @@ namespace Boare.Lib.Vsq { setPhoneticSymbol( value ); } } +#endif public String[] getPhoneticSymbolList() { String[] ret = new String[m_phonetic_symbol.Length]; @@ -124,12 +143,7 @@ namespace Boare.Lib.Vsq { /// /// 生成元の文字列 public Lyric( String _line ) { - byte[] b = new byte[_line.Length]; - for ( int i = 0; i < _line.Length; i++ ) { - b[i] = (byte)_line[i]; - } - String s = cp932.convert( b ); - String[] spl = s.Split( new char[] { ',' } ); + String[] spl = PortUtil.splitString( _line, ',' ); int c_length = spl.Length - 3; if ( spl.Length < 4 ) { Phrase = "a"; @@ -142,57 +156,32 @@ namespace Boare.Lib.Vsq { Phrase = Phrase.Substring( 1 ); } if ( Phrase.EndsWith( "\"" ) ) { - Phrase = Phrase.Substring( 0, Phrase.Length - 1 ); + Phrase = Phrase.Substring( 0, PortUtil.getStringLength( Phrase ) - 1 ); } String symbols = spl[1]; if ( symbols.StartsWith( "\"" ) ) { symbols = symbols.Substring( 1 ); } if ( symbols.EndsWith( "\"" ) ) { - symbols = symbols.Substring( 0, symbols.Length - 1 ); + symbols = symbols.Substring( 0, PortUtil.getStringLength( symbols ) - 1 ); } setPhoneticSymbol( symbols ); - UnknownFloat = float.Parse( spl[2] ); + UnknownFloat = PortUtil.parseFloat( spl[2] ); PhoneticSymbolProtected = (spl[spl.Length - 1].Equals( "0" )) ? false : true; } } - /// - /// 与えられた文字列の中の2バイト文字を\x**の形式にエンコードします。 - /// - /// エンコード対象 - /// エンコードした文字列 - public static char[] encode( String item ) { - //Encoding sjis = Encoding.GetEncoding( 932 ); - byte[] bytea = cp932.convert( item );// sjis.GetBytes( item ); - String result = ""; - for ( int i = 0; i < bytea.Length; i++ ) { - if ( isprint( (char)bytea[i] ) ) { - result += (char)bytea[i]; - } else { - result += "\\x" + Convert.ToString( bytea[i], 16 ); - } - } - char[] res = result.ToCharArray(); - return res; - } - /// /// このインスタンスを文字列に変換します /// /// 2バイト文字をエンコードするか否かを指定するフラグ /// 変換後の文字列 - public String ToString( boolean a_encode ) { + public String toString() { String result; - if ( a_encode ) { - String njp = new String( encode( this.Phrase ) ); - result = "\"" + njp + "\",\"" + this.getPhoneticSymbol() + "\"," + UnknownFloat.ToString( "0.000000" ); - } else { - result = "\""; - result += this.Phrase; - result += "\",\"" + this.getPhoneticSymbol() + "\"," + UnknownFloat.ToString( "0.000000" ); - result = result.Replace( @"\\", @"\" ); - } + result = "\""; + result += this.Phrase; + result += "\",\"" + this.getPhoneticSymbol() + "\"," + PortUtil.formatDecimal( "0.000000", UnknownFloat ); + result = result.Replace( "\\" + "\\", "\\" ); for ( int i = 0; i < m_consonant_adjustment.Length; i++ ) { result += "," + m_consonant_adjustment[i]; } @@ -204,18 +193,13 @@ namespace Boare.Lib.Vsq { return result; } - /// - /// 文字がプリント出力可能かどうかを判定します - /// - /// - /// - private static boolean isprint( char ch ) { - if ( 32 <= (int)ch && (int)ch <= 126 ) { - return true; - } else { - return false; - } +#if !JAVA + public override string ToString() { + return toString(); } +#endif } +#if !JAVA } +#endif diff --git a/trunk/Boare.Lib.Vsq/LyricHandle.cs b/trunk/Boare.Lib.Vsq/LyricHandle.cs new file mode 100644 index 0000000..c2cae5f --- /dev/null +++ b/trunk/Boare.Lib.Vsq/LyricHandle.cs @@ -0,0 +1,99 @@ +/* + * LyricHandle.cs + * Copyright (c) 2008-2009 kbinani + * + * This file is part of Boare.Lib.Vsq. + * + * Boare.Lib.Vsq is free software; you can redistribute it and/or + * modify it under the terms of the BSD License. + * + * Boare.Lib.Vsq 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. + */ +#if JAVA +package org.kbinani.vsq; + +import java.io.*; +import java.util.*; +#else +using System; +using bocoree.java.util; + +namespace Boare.Lib.Vsq { +#endif + +#if JAVA + public class LyricHandle implements Cloneable, Serializable{ +#else + [Serializable] + public class LyricHandle : ICloneable { +#endif + public Lyric L0; + public int Index; + public Vector Trailing = new Vector(); + + public LyricHandle() { + L0 = new Lyric(); + } + + public Lyric getLyricAt( int index ){ + if( index == 0 ){ + return L0; + }else{ + return Trailing.get( index - 1 ); + } + } + + public void setLyricAt( int index, Lyric value ){ + if( index == 0 ){ + L0 = value; + }else{ + Trailing.set( index - 1, value ); + } + } + + public int getCount(){ + return Trailing.size() + 1; + } + + /// + /// type = Lyric用のhandleのコンストラクタ + /// + /// 歌詞 + /// 発音記号 + public LyricHandle( String phrase, String phonetic_symbol ) { + L0 = new Lyric( phrase, phonetic_symbol ); + } + + public Object clone() { + LyricHandle ret = new LyricHandle(); + ret.Index = Index; + ret.L0 = (Lyric)L0.clone(); + int c = Trailing.size(); + for( int i = 0; i < c; i++ ){ + Lyric buf = (Lyric)Trailing.get( i ).clone(); + ret.Trailing.add( buf ); + } + return ret; + } + +#if !JAVA + public object Clone() { + return clone(); + } +#endif + + public VsqHandle castToVsqHandle() { + VsqHandle ret = new VsqHandle(); + ret.m_type = VsqHandleType.Lyric; + ret.L0 = (Lyric)L0.clone(); + ret.Trailing = Trailing; + ret.Index = Index; + return ret; + } + } + +#if !JAVA +} +#endif diff --git a/trunk/Boare.Lib.Vsq/MidiEvent.cs b/trunk/Boare.Lib.Vsq/MidiEvent.cs new file mode 100644 index 0000000..eedee2c --- /dev/null +++ b/trunk/Boare.Lib.Vsq/MidiEvent.cs @@ -0,0 +1,282 @@ +/* + * MidiEvent.cs + * Copyright (c) 2009 kbinani + * + * This file is part of Boare.Lib.Vsq. + * + * Boare.Lib.Vsq is free software; you can redistribute it and/or + * modify it under the terms of the BSD License. + * + * Boare.Lib.Vsq 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. + */ +#if JAVA +package org.kbinani.vsq; + +import java.io.*; +import org.kbinani.*; +#else +using System; +using bocoree; +using bocoree.java.io; + +namespace Boare.Lib.Vsq { + using boolean = System.Boolean; + using Long = System.Int64; +#endif + + /// + /// midiイベント。メタイベントは、メタイベントのデータ長をData[1]に格納せず、生のデータをDataに格納するので、注意が必要 + /// +#if JAVA + public class MidiEvent implements Comparable { +#else + public struct MidiEvent : IComparable { +#endif + public long clock; + public byte firstByte; + public byte[] data; + + private static void writeDeltaClock( RandomAccessFile stream, long number ) +#if JAVA + throws IOException +#endif + { + boolean[] bits = new boolean[64]; + long val = 0x1; + bits[0] = (number & val) == val; + for ( int i = 1; i < 64; i++ ) { + val = val << 1; + bits[i] = (number & val) == val; + } + int first = 0; + for ( int i = 63; i >= 0; i-- ) { + if ( bits[i] ) { + first = i; + break; + } + } + // 何バイト必要か? + int bytes = first / 7 + 1; + for ( int i = 1; i <= bytes; i++ ) { + long num = 0; + long count = 0x80; + for ( int j = (bytes - i + 1) * 7 - 1; j >= (bytes - i + 1) * 7 - 6 - 1; j-- ) { + count = count >> 1; + if ( bits[j] ) { + num += count; + } + } + if ( i != bytes ) { + num += 0x80; + } + stream.write( (byte)num ); + } + } + + private static long readDeltaClock( RandomAccessFile stream ) +#if JAVA + throws IOException +#endif + { + long ret = 0; + while ( true ) { + int i = stream.read(); + if ( i < 0 ) { + break; + } + byte d = (byte)i; + ret = (ret << 7) | ((long)d & 0x7f); + if ( (d & 0x80) == 0x00 ) { + break; + } + } + return ret; + } + + public static MidiEvent read( RandomAccessFile stream, ByRef last_clock, ByRef last_status_byte ) +#if JAVA + throws IOException, Exception +#endif + { + long delta_clock = readDeltaClock( stream ); + last_clock.value += delta_clock; + byte first_byte = (byte)stream.read(); + if ( first_byte < 0x80 ) { + // ランニングステータスが適用される + long pos = stream.getFilePointer(); + stream.seek( pos - 1 ); + first_byte = last_status_byte.value; + } else { + last_status_byte.value = first_byte; + } + byte ctrl = (byte)(first_byte & (byte)0xf0); + if ( ctrl == 0x80 || ctrl == 0x90 || ctrl == 0xA0 || ctrl == 0xB0 || ctrl == 0xE0 || first_byte == 0xF2 ) { + // 3byte使用するチャンネルメッセージ: + // 0x8*: ノートオフ + // 0x9*: ノートオン + // 0xA*: ポリフォニック・キープレッシャ + // 0xB*: コントロールチェンジ + // 0xE*: ピッチベンドチェンジ + // 3byte使用するシステムメッセージ + // 0xF2: ソングポジション・ポインタ + MidiEvent me = new MidiEvent(); + me.clock = last_clock.value; + me.firstByte = first_byte; + me.data = new byte[2]; + stream.read( me.data, 0, 2 ); + return me; + } else if ( ctrl == 0xC0 || ctrl == 0xD0 || first_byte == 0xF1 || first_byte == 0xF2 ) { + // 2byte使用するチャンネルメッセージ + // 0xC*: プログラムチェンジ + // 0xD*: チャンネルプレッシャ + // 2byte使用するシステムメッセージ + // 0xF1: クォータフレーム + // 0xF3: ソングセレクト + MidiEvent me = new MidiEvent(); + me.clock = last_clock.value; + me.firstByte = first_byte; + me.data = new byte[1]; + stream.read( me.data, 0, 1 ); + return me; + } else if ( first_byte == 0xF6 ) { + // 1byte使用するシステムメッセージ + // 0xF6: チューンリクエスト + // 0xF7: エンドオブエクスクルーシブ(このクラスではF0ステータスのSysExの一部として取り扱う) + // 0xF8: タイミングクロック + // 0xFA: スタート + // 0xFB: コンティニュー + // 0xFC: ストップ + // 0xFE: アクティブセンシング + // 0xFF: システムリセット + MidiEvent me = new MidiEvent(); + me.clock = last_clock.value; + me.firstByte = first_byte; + me.data = new byte[0]; + return me; + } else if ( first_byte == 0xff ) { + // メタイベント + byte meta_event_type = (byte)stream.read(); + long meta_event_length = readDeltaClock( stream ); + MidiEvent me = new MidiEvent(); + me.clock = last_clock.value; + me.firstByte = first_byte; + me.data = new byte[(int)meta_event_length + 1]; + me.data[0] = meta_event_type; + stream.read( me.data, 1, (int)meta_event_length ); + return me; + } else if ( first_byte == 0xf0 ) { + // f0ステータスのSysEx + MidiEvent me = new MidiEvent(); + me.clock = last_clock.value; + me.firstByte = first_byte; + long sysex_length = readDeltaClock( stream ); + me.data = new byte[(int)sysex_length + 1]; + stream.read( me.data, 0, (int)(sysex_length + 1) ); + return me; + } else if ( first_byte == 0xf7 ) { + // f7ステータスのSysEx + MidiEvent me = new MidiEvent(); + me.clock = last_clock.value; + me.firstByte = first_byte; + long sysex_length = readDeltaClock( stream ); + me.data = new byte[(int)sysex_length]; + stream.read( me.data, 0, (int)sysex_length ); + return me; + } else { + throw new Exception( "don't know how to process first_byte: 0x" + PortUtil.toHexString( first_byte ) ); + } + } + + public void writeData( RandomAccessFile stream ) +#if JAVA + throws IOException +#endif + { + stream.write( firstByte ); + if ( firstByte == 0xff ) { + stream.write( data[0] ); + writeDeltaClock( stream, data.Length - 1 ); + //stream.WriteByte( (byte)(Data.Length - 1) ); + stream.write( data, 1, data.Length - 1 ); + } else { + stream.write( data, 0, data.Length ); + } + } + + public int compareTo( MidiEvent item ) { + if ( clock != item.clock ) { + return (int)(clock - item.clock); + } else { + int first_this = firstByte & 0xf0; + int first_item = item.firstByte & 0xf0; + + if ( (first_this == 0x80 || first_this == 0x90) && (first_item == 0x80 || first_item == 0x90) ) { + if ( data != null && data.Length >= 2 && item.data != null && item.data.Length >= 2 ) { + if ( first_item == 0x90 && item.data[1] == 0 ) { + first_item = 0x80; + } + if ( first_this == 0x90 && data[1] == 0 ) { + first_this = 0x80; + } + if ( data[0] == item.data[0] ) { + if ( first_this == 0x90 ) { + if ( first_item == 0x80 ) { + // ON -> OFF + return 1; + } else { + // ON -> ON + return 0; + } + } else { + if ( first_item == 0x80 ) { + // OFF -> OFF + return 0; + } else { + // OFF -> ON + return -1; + } + } + } + } + } + return (int)(clock - item.clock); + } + } + +#if !JAVA + public int CompareTo( MidiEvent item ) { + return compareTo( item ); + } +#endif + + public static MidiEvent generateTimeSigEvent( int clock, int numerator, int denominator ) { + MidiEvent ret = new MidiEvent(); + ret.clock = clock; + ret.firstByte = (byte)0xff; + byte b_numer = (byte)(Math.Log( denominator ) / Math.Log( 2 ) + 0.1); +#if DEBUG + PortUtil.println( "VsqEvent.generateTimeSigEvent; b_number=" + b_numer + "; denominator=" + denominator ); +#endif + ret.data = new byte[] { 0x58, (byte)numerator, b_numer, 0x18, 0x08 }; + return ret; + } + + public static MidiEvent generateTempoChangeEvent( int clock, int tempo ) { + MidiEvent ret = new MidiEvent(); + ret.clock = clock; + ret.firstByte = (byte)0xff; + byte b1 = (byte)(tempo & 0xff); + tempo = tempo >> 8; + byte b2 = (byte)(tempo & 0xff); + tempo = tempo >> 8; + byte b3 = (byte)(tempo & 0xff); + ret.data = new byte[] { (byte)0x51, b3, b2, b1 }; + return ret; + } + } + +#if !JAVA +} +#endif diff --git a/trunk/Boare.Lib.Vsq/MidiFile.cs b/trunk/Boare.Lib.Vsq/MidiFile.cs new file mode 100644 index 0000000..f3bf746 --- /dev/null +++ b/trunk/Boare.Lib.Vsq/MidiFile.cs @@ -0,0 +1,203 @@ +/* + * MidiFile.cs + * Copyright (c) 2009 kbinani + * + * This file is part of Boare.Lib.Vsq. + * + * Boare.Lib.Vsq is free software; you can redistribute it and/or + * modify it under the terms of the BSD License. + * + * Boare.Lib.Vsq 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. + */ +#if JAVA +package org.kbinani.vsq; + +import java.io.*; +import java.util.*; +import org.kbinani.*; +#else +using System; +using bocoree; +using bocoree.java.util; +using bocoree.java.io; + +namespace Boare.Lib.Vsq { + using boolean = System.Boolean; + using Long = System.Int64; +#endif + + public class MidiFile { + private Vector> m_events; + private int m_format; + private int m_time_format; + + public MidiFile( String path ) +#if JAVA + throws FileNotFoundException +#endif + { + RandomAccessFile stream = new RandomAccessFile( path, "r" ); + try { + // ヘッダ + byte[] byte4 = new byte[4]; + stream.read( byte4, 0, 4 ); + if ( PortUtil.make_uint32_be( byte4 ) != 0x4d546864 ) { + throw new Exception( "header error: MThd" ); + } + + // データ長 + stream.read( byte4, 0, 4 ); + long length = PortUtil.make_uint32_be( byte4 ); + + // フォーマット + stream.read( byte4, 0, 2 ); + m_format = PortUtil.make_uint16_be( byte4 ); + + // トラック数 + int tracks = 0; + stream.read( byte4, 0, 2 ); + tracks = (int)PortUtil.make_uint16_be( byte4 ); + + // 時間分解能 + stream.read( byte4, 0, 2 ); + m_time_format = PortUtil.make_uint16_be( byte4 ); + + // 各トラックを読込み + m_events = new Vector>(); + for ( int track = 0; track < tracks; track++ ) { + Vector track_events = new Vector(); + // ヘッダー + stream.read( byte4, 0, 4 ); + if ( PortUtil.make_uint32_be( byte4 ) != 0x4d54726b ) { + throw new Exception( "header error; MTrk" ); + } + + // チャンクサイズ + stream.read( byte4, 0, 4 ); + long size = (long)PortUtil.make_uint32_be( byte4 ); + long startpos = stream.getFilePointer(); + + // チャンクの終わりまで読込み + ByRef clock = new ByRef( (long)0 ); + ByRef last_status_byte = new ByRef( (byte)0x00 ); + while ( stream.getFilePointer() < startpos + size ) { + MidiEvent mi = MidiEvent.read( stream, clock, last_status_byte ); + track_events.add( mi ); + } + if ( m_time_format != 480 ) { + int count = track_events.size(); + for ( int i = 0; i < count; i++ ) { + MidiEvent mi = track_events.get( i ); + mi.clock = mi.clock * 480 / m_time_format; + track_events.set( i, mi ); + } + } + m_events.add( track_events ); + } + m_time_format = 480; +#if DEBUG && MIDI_PRINT_TO_FILE + String dbg = PortUtil.combinePath( PortUtil.getDirectoryName( path ), PortUtil.getFileNameWithoutExtension( path ) + ".txt" ); + BufferedWriter sw = null; + try { + sw = new BufferedWriter( new FileWriter( dbg ) ); + const String format = " {0,8} 0x{1:X4} {2,-35} 0x{3:X2} 0x{4:X2}"; + const String format0 = " {0,8} 0x{1:X4} {2,-35} 0x{3:X2}"; + for ( int track = 1; track < m_events.size(); track++ ) { + sw.write( "MidiFile..ctor; track=" + track ); + sw.newLine(); + byte msb, lsb, data_msb, data_lsb; + msb = lsb = data_msb = data_lsb = 0x0; + for ( int i = 0; i < m_events.get( track ).size(); i++ ) { + if ( m_events.get( track ).get( i ).firstByte == 0xb0 ) { + switch ( m_events.get( track ).get( i ).data[0] ) { + case 0x63: + msb = m_events.get( track ).get( i ).data[1]; + lsb = 0x0; + break; + case 0x62: + lsb = m_events.get( track ).get( i ).data[1]; + break; + case 0x06: + data_msb = m_events.get( track ).get( i ).data[1]; + ushort nrpn = (ushort)(msb << 8 | lsb); + String name = NRPN.getName( nrpn ); + if ( name.Equals( "" ) ) { + name = "* * UNKNOWN * *"; + sw.write( String.Format( format0, m_events.get( track ).get( i ).clock, nrpn, name, data_msb ) ); + sw.newLine(); + } else { + //if ( !NRPN.is_require_data_lsb( nrpn ) ) { + sw.write( String.Format( format0, m_events.get( track ).get( i ).clock, nrpn, name, data_msb ) ); + sw.newLine(); + //} + } + break; + case 0x26: + data_lsb = m_events.get( track ).get( i ).data[1]; + ushort nrpn2 = (ushort)(msb << 8 | lsb); + String name2 = NRPN.getName( nrpn2 ); + if ( name2.Equals( "" ) ) { + name2 = "* * UNKNOWN * *"; + } + sw.write( String.Format( format, m_events.get( track ).get( i ).clock, nrpn2, name2, data_msb, data_lsb ) ); + sw.newLine(); + break; + } + } + } + } + } catch ( Exception ex ) { + } finally { + if ( sw != null ) { + try { + sw.close(); + } catch ( Exception ex2 ) { + } + } + } +#endif + } catch ( Exception ex ) { + } finally { + if ( stream != null ) { + try { + stream.close(); + } catch ( Exception ex2 ) { + } + } + } + } + + public Vector getMidiEventList( int track ) { + if ( m_events == null ) { + return new Vector(); + } else if ( 0 <= track && track < m_events.size() ) { + return m_events.get( track ); + } else { + return new Vector(); + } + } + + public int getTrackCount() { + if ( m_events == null ) { + return 0; + } else { + return m_events.size(); + } + } + + public void close() { + if ( m_events != null ) { + int c = m_events.size(); + for ( int i = 0; i < c; i++ ) { + m_events.get( i ).clear(); + } + m_events.clear(); + } + } + } + +#if !JAVA +} +#endif diff --git a/trunk/Boare.Lib.Vsq/NRPN.cs b/trunk/Boare.Lib.Vsq/NRPN.cs index 88c9596..af0a673 100644 --- a/trunk/Boare.Lib.Vsq/NRPN.cs +++ b/trunk/Boare.Lib.Vsq/NRPN.cs @@ -11,595 +11,573 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */ +#if JAVA +package org.kbinani.vsq; + +import java.util.*; +import java.lang.reflect.*; +import org.kbinani.*; +#else using System; using System.Reflection; -using System.Collections.Generic; - using bocoree; +using bocoree.java.util; namespace Boare.Lib.Vsq { - using boolean = System.Boolean; + using Integer = System.Int32; +#endif - public static class NRPN { + public class NRPN { /// /// (0x5000) Version number(MSB) &, Device number(LSB) /// - public const ushort CVM_NM_VERSION_AND_DEVICE = 0x5000; + public const int CVM_NM_VERSION_AND_DEVICE = 0x5000; /// /// (0x5001) Delay in millisec(MSB, LSB) /// - public const ushort CVM_NM_DELAY = 0x5001; + public const int CVM_NM_DELAY = 0x5001; /// /// (0x5002) Note number(MSB) /// - public const ushort CVM_NM_NOTE_NUMBER = 0x5002; + public const int CVM_NM_NOTE_NUMBER = 0x5002; /// /// (0x5003) Velocity(MSB) /// - public const ushort CVM_NM_VELOCITY = 0x5003; + public const int CVM_NM_VELOCITY = 0x5003; /// /// (0x5004) Note Duration in millisec(MSB, LSB) /// - public const ushort CVM_NM_NOTE_DURATION = 0x5004; + public const int CVM_NM_NOTE_DURATION = 0x5004; /// /// (0x5005) Note Location(MSB) /// - public const ushort CVM_NM_NOTE_LOCATION = 0x5005; + public const int CVM_NM_NOTE_LOCATION = 0x5005; /// /// (0x5006) Attack Type(MSB, LSB) /// - public const ushort CVM_NM_ATTACK_TYPE = 0x5006; + public const int CVM_NM_ATTACK_TYPE = 0x5006; /// /// (0x5007) Attack Duration in millisec(MSB, LSB) /// - public const ushort CVM_NM_ATTACK_DURATION = 0x5007; + public const int CVM_NM_ATTACK_DURATION = 0x5007; /// /// (0x5008) Attack Depth(MSB) /// - public const ushort CVM_NM_ATTACK_DEPTH = 0x5008; + public const int CVM_NM_ATTACK_DEPTH = 0x5008; /// /// (0x500c) Index of Vibrato DB(MSB: ID_H00, LSB:ID_L00) /// - public const ushort CVM_NM_INDEX_OF_VIBRATO_DB = 0x500c; + public const int CVM_NM_INDEX_OF_VIBRATO_DB = 0x500c; /// /// (0x500d) Vibrato configuration(MSB: Index of Vibrato Type, LSB: Duration &, Configuration parameter of vibrato) /// - public const ushort CVM_NM_VIBRATO_CONFIG = 0x500d; + public const int CVM_NM_VIBRATO_CONFIG = 0x500d; /// /// (0x500e) Vibrato Delay(MSB) /// - public const ushort CVM_NM_VIBRATO_DELAY = 0x500e; - /*/// - /// (0x5011) Unknonw(MSB), only used in VOCALOID1 - /// - public const ushort CVM_NM_UNKNOWN1 = 0x5011;*/ + public const int CVM_NM_VIBRATO_DELAY = 0x500e; + // // + // // (0x5011) Unknonw(MSB), only used in VOCALOID1 + // // + // public const int CVM_NM_UNKNOWN1 = 0x5011; /// /// (0x5012) Number of phonetic symbols in bytes(MSB) /// - public const ushort CVM_NM_PHONETIC_SYMBOL_BYTES = 0x5012; + public const int CVM_NM_PHONETIC_SYMBOL_BYTES = 0x5012; /// /// (0x5013) Phonetic symbol 1(MSB:Phonetic symbol 1, LSB: Consonant adjustment 1) /// - public const ushort CVM_NM_PHONETIC_SYMBOL1 = 0x5013; + public const int CVM_NM_PHONETIC_SYMBOL1 = 0x5013; /// /// (0x5014) Phonetic symbol 2(MSB:Phonetic symbol 2, LSB: Consonant adjustment 2) /// - public const ushort CVM_NM_PHONETIC_SYMBOL2 = 0x5014; + public const int CVM_NM_PHONETIC_SYMBOL2 = 0x5014; /// /// (0x5015) Phonetic symbol 3(MSB:Phonetic symbol 3, LSB: Consonant adjustment 3) /// - public const ushort CVM_NM_PHONETIC_SYMBOL3 = 0x5015; + public const int CVM_NM_PHONETIC_SYMBOL3 = 0x5015; /// /// (0x5016) Phonetic symbol 4(MSB:Phonetic symbol 4, LSB: Consonant adjustment 4) /// - public const ushort CVM_NM_PHONETIC_SYMBOL4 = 0x5016; + public const int CVM_NM_PHONETIC_SYMBOL4 = 0x5016; /// /// (0x5017) Phonetic symbol 5(MSB:Phonetic symbol 5, LSB: Consonant adjustment 5) /// - public const ushort CVM_NM_PHONETIC_SYMBOL5 = 0x5017; + public const int CVM_NM_PHONETIC_SYMBOL5 = 0x5017; /// /// (0x5018) Phonetic symbol 6(MSB:Phonetic symbol 6, LSB: Consonant adjustment 6) /// - public const ushort CVM_NM_PHONETIC_SYMBOL6 = 0x5018; + public const int CVM_NM_PHONETIC_SYMBOL6 = 0x5018; /// /// (0x5019) Phonetic symbol 7(MSB:Phonetic symbol 7, LSB: Consonant adjustment 7) /// - public const ushort CVM_NM_PHONETIC_SYMBOL7 = 0x5019; + public const int CVM_NM_PHONETIC_SYMBOL7 = 0x5019; /// /// (0x501a) Phonetic symbol 8(MSB:Phonetic symbol 8, LSB: Consonant adjustment 8) /// - public const ushort CVM_NM_PHONETIC_SYMBOL8 = 0x501a; + public const int CVM_NM_PHONETIC_SYMBOL8 = 0x501a; /// /// (0x501b) Phonetic symbol 9(MSB:Phonetic symbol 9, LSB: Consonant adjustment 9) /// - public const ushort CVM_NM_PHONETIC_SYMBOL9 = 0x501b; + public const int CVM_NM_PHONETIC_SYMBOL9 = 0x501b; /// /// (0x501c) Phonetic symbol 10(MSB:Phonetic symbol 10, LSB: Consonant adjustment 10) /// - public const ushort CVM_NM_PHONETIC_SYMBOL10 = 0x501c; + public const int CVM_NM_PHONETIC_SYMBOL10 = 0x501c; /// /// (0x501d) Phonetic symbol 11(MSB:Phonetic symbol 11, LSB: Consonant adjustment 11) /// - public const ushort CVM_NM_PHONETIC_SYMBOL11 = 0x501d; + public const int CVM_NM_PHONETIC_SYMBOL11 = 0x501d; /// /// (0x501e) Phonetic symbol 12(MSB:Phonetic symbol 12, LSB: Consonant adjustment 12) /// - public const ushort CVM_NM_PHONETIC_SYMBOL12 = 0x501e; + public const int CVM_NM_PHONETIC_SYMBOL12 = 0x501e; /// /// (0x501f) Phonetic symbol 13(MSB:Phonetic symbol 13, LSB: Consonant adjustment 13) /// - public const ushort CVM_NM_PHONETIC_SYMBOL13 = 0x501f; + public const int CVM_NM_PHONETIC_SYMBOL13 = 0x501f; /// /// (0x5020) Phonetic symbol 14(MSB:Phonetic symbol 14, LSB: Consonant adjustment 14) /// - public const ushort CVM_NM_PHONETIC_SYMBOL14 = 0x5020; + public const int CVM_NM_PHONETIC_SYMBOL14 = 0x5020; /// /// (0x5021) Phonetic symbol 15(MSB:Phonetic symbol 15, LSB: Consonant adjustment 15) /// - public const ushort CVM_NM_PHONETIC_SYMBOL15 = 0x5021; + public const int CVM_NM_PHONETIC_SYMBOL15 = 0x5021; /// /// (0x5022) Phonetic symbol 16(MSB:Phonetic symbol 16, LSB: Consonant adjustment 16) /// - public const ushort CVM_NM_PHONETIC_SYMBOL16 = 0x5022; + public const int CVM_NM_PHONETIC_SYMBOL16 = 0x5022; /// /// (0x5023) Phonetic symbol 17(MSB:Phonetic symbol 17, LSB: Consonant adjustment 17) /// - public const ushort CVM_NM_PHONETIC_SYMBOL17 = 0x5023; + public const int CVM_NM_PHONETIC_SYMBOL17 = 0x5023; /// /// (0x5024) Phonetic symbol 18(MSB:Phonetic symbol 18, LSB: Consonant adjustment 18) /// - public const ushort CVM_NM_PHONETIC_SYMBOL18 = 0x5024; + public const int CVM_NM_PHONETIC_SYMBOL18 = 0x5024; /// /// (0x5025) Phonetic symbol 19(MSB:Phonetic symbol 19, LSB: Consonant adjustment 19) /// - public const ushort CVM_NM_PHONETIC_SYMBOL19 = 0x5025; + public const int CVM_NM_PHONETIC_SYMBOL19 = 0x5025; /// /// (0x5026) Phonetic symbol 20(MSB:Phonetic symbol 20, LSB: Consonant adjustment 20) /// - public const ushort CVM_NM_PHONETIC_SYMBOL20 = 0x5026; + public const int CVM_NM_PHONETIC_SYMBOL20 = 0x5026; /// /// (0x5027) Phonetic symbol 21(MSB:Phonetic symbol 21, LSB: Consonant adjustment 21) /// - public const ushort CVM_NM_PHONETIC_SYMBOL21 = 0x5027; + public const int CVM_NM_PHONETIC_SYMBOL21 = 0x5027; /// /// (0x5028) Phonetic symbol 22(MSB:Phonetic symbol 22, LSB: Consonant adjustment 22) /// - public const ushort CVM_NM_PHONETIC_SYMBOL22 = 0x5028; + public const int CVM_NM_PHONETIC_SYMBOL22 = 0x5028; /// /// (0x5029) Phonetic symbol 23(MSB:Phonetic symbol 23, LSB: Consonant adjustment 23) /// - public const ushort CVM_NM_PHONETIC_SYMBOL23 = 0x5029; + public const int CVM_NM_PHONETIC_SYMBOL23 = 0x5029; /// /// (0x502a) Phonetic symbol 24(MSB:Phonetic symbol 24, LSB: Consonant adjustment 24) /// - public const ushort CVM_NM_PHONETIC_SYMBOL24 = 0x502a; + public const int CVM_NM_PHONETIC_SYMBOL24 = 0x502a; /// /// (0x502b) Phonetic symbol 25(MSB:Phonetic symbol 25, LSB: Consonant adjustment 25) /// - public const ushort CVM_NM_PHONETIC_SYMBOL25 = 0x502b; + public const int CVM_NM_PHONETIC_SYMBOL25 = 0x502b; /// /// (0x502c) Phonetic symbol 26(MSB:Phonetic symbol 26, LSB: Consonant adjustment 26) /// - public const ushort CVM_NM_PHONETIC_SYMBOL26 = 0x502c; + public const int CVM_NM_PHONETIC_SYMBOL26 = 0x502c; /// /// (0x502d) Phonetic symbol 27(MSB:Phonetic symbol 27, LSB: Consonant adjustment 27) /// - public const ushort CVM_NM_PHONETIC_SYMBOL27 = 0x502d; + public const int CVM_NM_PHONETIC_SYMBOL27 = 0x502d; /// /// (0x502e) Phonetic symbol 28(MSB:Phonetic symbol 28, LSB: Consonant adjustment 28) /// - public const ushort CVM_NM_PHONETIC_SYMBOL28 = 0x502e; + public const int CVM_NM_PHONETIC_SYMBOL28 = 0x502e; /// /// (0x502f) Phonetic symbol 29(MSB:Phonetic symbol 29, LSB: Consonant adjustment 29) /// - public const ushort CVM_NM_PHONETIC_SYMBOL29 = 0x502f; + public const int CVM_NM_PHONETIC_SYMBOL29 = 0x502f; /// /// (0x5030) Phonetic symbol 30(MSB:Phonetic symbol 30, LSB: Consonant adjustment 30) /// - public const ushort CVM_NM_PHONETIC_SYMBOL30 = 0x5030; + public const int CVM_NM_PHONETIC_SYMBOL30 = 0x5030; /// /// (0x5031) Phonetic symbol 31(MSB:Phonetic symbol 31, LSB: Consonant adjustment 31) /// - public const ushort CVM_NM_PHONETIC_SYMBOL31 = 0x5031; + public const int CVM_NM_PHONETIC_SYMBOL31 = 0x5031; /// /// (0x5032) Phonetic symbol 32(MSB:Phonetic symbol 32, LSB: Consonant adjustment 32) /// - public const ushort CVM_NM_PHONETIC_SYMBOL32 = 0x5032; + public const int CVM_NM_PHONETIC_SYMBOL32 = 0x5032; /// /// (0x5033) Phonetic symbol 33(MSB:Phonetic symbol 33, LSB: Consonant adjustment 33) /// - public const ushort CVM_NM_PHONETIC_SYMBOL33 = 0x5033; + public const int CVM_NM_PHONETIC_SYMBOL33 = 0x5033; /// /// (0x5034) Phonetic symbol 34(MSB:Phonetic symbol 34, LSB: Consonant adjustment 34) /// - public const ushort CVM_NM_PHONETIC_SYMBOL34 = 0x5034; + public const int CVM_NM_PHONETIC_SYMBOL34 = 0x5034; /// /// (0x5035) Phonetic symbol 35(MSB:Phonetic symbol 35, LSB: Consonant adjustment 35) /// - public const ushort CVM_NM_PHONETIC_SYMBOL35 = 0x5035; + public const int CVM_NM_PHONETIC_SYMBOL35 = 0x5035; /// /// (0x5036) Phonetic symbol 36(MSB:Phonetic symbol 36, LSB: Consonant adjustment 36) /// - public const ushort CVM_NM_PHONETIC_SYMBOL36 = 0x5036; + public const int CVM_NM_PHONETIC_SYMBOL36 = 0x5036; /// /// (0x5037) Phonetic symbol 37(MSB:Phonetic symbol 37, LSB: Consonant adjustment 37) /// - public const ushort CVM_NM_PHONETIC_SYMBOL37 = 0x5037; + public const int CVM_NM_PHONETIC_SYMBOL37 = 0x5037; /// /// (0x5038) Phonetic symbol 38(MSB:Phonetic symbol 38, LSB: Consonant adjustment 38) /// - public const ushort CVM_NM_PHONETIC_SYMBOL38 = 0x5038; + public const int CVM_NM_PHONETIC_SYMBOL38 = 0x5038; /// /// (0x5039) Phonetic symbol 39(MSB:Phonetic symbol 39, LSB: Consonant adjustment 39) /// - public const ushort CVM_NM_PHONETIC_SYMBOL39 = 0x5039; + public const int CVM_NM_PHONETIC_SYMBOL39 = 0x5039; /// /// (0x503a) Phonetic symbol 40(MSB:Phonetic symbol 40, LSB: Consonant adjustment 40) /// - public const ushort CVM_NM_PHONETIC_SYMBOL40 = 0x503a; + public const int CVM_NM_PHONETIC_SYMBOL40 = 0x503a; /// /// (0x503b) Phonetic symbol 41(MSB:Phonetic symbol 41, LSB: Consonant adjustment 41) /// - public const ushort CVM_NM_PHONETIC_SYMBOL41 = 0x503b; + public const int CVM_NM_PHONETIC_SYMBOL41 = 0x503b; /// /// (0x503c) Phonetic symbol 42(MSB:Phonetic symbol 42, LSB: Consonant adjustment 42) /// - public const ushort CVM_NM_PHONETIC_SYMBOL42 = 0x503c; + public const int CVM_NM_PHONETIC_SYMBOL42 = 0x503c; /// /// (0x503d) Phonetic symbol 43(MSB:Phonetic symbol 43, LSB: Consonant adjustment 43) /// - public const ushort CVM_NM_PHONETIC_SYMBOL43 = 0x503d; + public const int CVM_NM_PHONETIC_SYMBOL43 = 0x503d; /// /// (0x503e) Phonetic symbol 44(MSB:Phonetic symbol 44, LSB: Consonant adjustment 44) /// - public const ushort CVM_NM_PHONETIC_SYMBOL44 = 0x503e; + public const int CVM_NM_PHONETIC_SYMBOL44 = 0x503e; /// /// (0x503f) Phonetic symbol 45(MSB:Phonetic symbol 45, LSB: Consonant adjustment 45) /// - public const ushort CVM_NM_PHONETIC_SYMBOL45 = 0x503f; + public const int CVM_NM_PHONETIC_SYMBOL45 = 0x503f; /// /// (0x5040) Phonetic symbol 46(MSB:Phonetic symbol 46, LSB: Consonant adjustment 46) /// - public const ushort CVM_NM_PHONETIC_SYMBOL46 = 0x5040; + public const int CVM_NM_PHONETIC_SYMBOL46 = 0x5040; /// /// (0x5041) Phonetic symbol 47(MSB:Phonetic symbol 47, LSB: Consonant adjustment 47) /// - public const ushort CVM_NM_PHONETIC_SYMBOL47 = 0x5041; + public const int CVM_NM_PHONETIC_SYMBOL47 = 0x5041; /// /// (0x5042) Phonetic symbol 48(MSB:Phonetic symbol 48, LSB: Consonant adjustment 48) /// - public const ushort CVM_NM_PHONETIC_SYMBOL48 = 0x5042; + public const int CVM_NM_PHONETIC_SYMBOL48 = 0x5042; /// /// (0x5043) Phonetic symbol 49(MSB:Phonetic symbol 49, LSB: Consonant adjustment 49) /// - public const ushort CVM_NM_PHONETIC_SYMBOL49 = 0x5043; + public const int CVM_NM_PHONETIC_SYMBOL49 = 0x5043; /// /// (0x5044) Phonetic symbol 50(MSB:Phonetic symbol 50, LSB: Consonant adjustment 50) /// - public const ushort CVM_NM_PHONETIC_SYMBOL50 = 0x5044; + public const int CVM_NM_PHONETIC_SYMBOL50 = 0x5044; /// /// (0x5045) Phonetic symbol 51(MSB:Phonetic symbol 51, LSB: Consonant adjustment 51) /// - public const ushort CVM_NM_PHONETIC_SYMBOL51 = 0x5045; + public const int CVM_NM_PHONETIC_SYMBOL51 = 0x5045; /// /// (0x5046) Phonetic symbol 52(MSB:Phonetic symbol 52, LSB: Consonant adjustment 52) /// - public const ushort CVM_NM_PHONETIC_SYMBOL52 = 0x5046; + public const int CVM_NM_PHONETIC_SYMBOL52 = 0x5046; /// /// (0x5047) Phonetic symbol 53(MSB:Phonetic symbol 53, LSB: Consonant adjustment 53) /// - public const ushort CVM_NM_PHONETIC_SYMBOL53 = 0x5047; + public const int CVM_NM_PHONETIC_SYMBOL53 = 0x5047; /// /// (0x5048) Phonetic symbol 54(MSB:Phonetic symbol 54, LSB: Consonant adjustment 54) /// - public const ushort CVM_NM_PHONETIC_SYMBOL54 = 0x5048; + public const int CVM_NM_PHONETIC_SYMBOL54 = 0x5048; /// /// (0x5049) Phonetic symbol 55(MSB:Phonetic symbol 55, LSB: Consonant adjustment 55) /// - public const ushort CVM_NM_PHONETIC_SYMBOL55 = 0x5049; + public const int CVM_NM_PHONETIC_SYMBOL55 = 0x5049; /// /// (0x504a) Phonetic symbol 56(MSB:Phonetic symbol 56, LSB: Consonant adjustment 56) /// - public const ushort CVM_NM_PHONETIC_SYMBOL56 = 0x504a; + public const int CVM_NM_PHONETIC_SYMBOL56 = 0x504a; /// /// (0x504b) Phonetic symbol 57(MSB:Phonetic symbol 57, LSB: Consonant adjustment 57) /// - public const ushort CVM_NM_PHONETIC_SYMBOL57 = 0x504b; + public const int CVM_NM_PHONETIC_SYMBOL57 = 0x504b; /// /// (0x504c) Phonetic symbol 58(MSB:Phonetic symbol 58, LSB: Consonant adjustment 58) /// - public const ushort CVM_NM_PHONETIC_SYMBOL58 = 0x504c; + public const int CVM_NM_PHONETIC_SYMBOL58 = 0x504c; /// /// (0x504d) Phonetic symbol 59(MSB:Phonetic symbol 59, LSB: Consonant adjustment 59) /// - public const ushort CVM_NM_PHONETIC_SYMBOL59 = 0x504d; + public const int CVM_NM_PHONETIC_SYMBOL59 = 0x504d; /// /// (0x504e) Phonetic symbol 60(MSB:Phonetic symbol 60, LSB: Consonant adjustment 60) /// - public const ushort CVM_NM_PHONETIC_SYMBOL60 = 0x504e; + public const int CVM_NM_PHONETIC_SYMBOL60 = 0x504e; /// /// (0x504f) Phonetic symbol continuation(MSB, 0x7f=end, 0x00=continue) /// - public const ushort CVM_NM_PHONETIC_SYMBOL_CONTINUATION = 0x504f; + public const int CVM_NM_PHONETIC_SYMBOL_CONTINUATION = 0x504f; /// /// (0x5050) v1mean in Cent/5(MSB) /// - public const ushort CVM_NM_V1MEAN = 0x5050; + public const int CVM_NM_V1MEAN = 0x5050; /// /// (0x5051) d1mean in millisec/5(MSB) /// - public const ushort CVM_NM_D1MEAN = 0x5051; + public const int CVM_NM_D1MEAN = 0x5051; /// /// (0x5052) d1meanFirstNote in millisec/5(MSB) /// - public const ushort CVM_NM_D1MEAN_FIRST_NOTE = 0x5052; + public const int CVM_NM_D1MEAN_FIRST_NOTE = 0x5052; /// /// (0x5053) d2mean in millisec/5(MSB) /// - public const ushort CVM_NM_D2MEAN = 0x5053; + public const int CVM_NM_D2MEAN = 0x5053; /// /// (0x5054) d4mean in millisec/5(MSB) /// - public const ushort CVM_NM_D4MEAN = 0x5054; + public const int CVM_NM_D4MEAN = 0x5054; /// /// (0x5055) pMeanOnsetFirstNote in Cent/5(MSB) /// - public const ushort CVM_NM_PMEAN_ONSET_FIRST_NOTE = 0x5055; + public const int CVM_NM_PMEAN_ONSET_FIRST_NOTE = 0x5055; /// /// (0x5056) vMeanNoteTransition in Cent/5(MSB) /// - public const ushort CVM_NM_VMEAN_NOTE_TRNSITION = 0x5056; + public const int CVM_NM_VMEAN_NOTE_TRNSITION = 0x5056; /// /// (0x5057) pMeanEndingNote in Cent/5(MSB) /// - public const ushort CVM_NM_PMEAN_ENDING_NOTE = 0x5057; + public const int CVM_NM_PMEAN_ENDING_NOTE = 0x5057; /// /// (0x5058) AddScooptoUpIntervals &, AddPortamentoToDownIntervals(MSB) /// - public const ushort CVM_NM_ADD_PORTAMENTO = 0x5058; + public const int CVM_NM_ADD_PORTAMENTO = 0x5058; /// /// (0x5059) changAfterPeak(MSB) /// - public const ushort CVM_NM_CHANGE_AFTER_PEAK = 0x5059; + public const int CVM_NM_CHANGE_AFTER_PEAK = 0x5059; /// /// (0x505a) Accent(MSB) /// - public const ushort CVM_NM_ACCENT = 0x505a; + public const int CVM_NM_ACCENT = 0x505a; /// /// (0x507f) Note message continuation(MSB) /// - public const ushort CVM_NM_NOTE_MESSAGE_CONTINUATION = 0x507f; + public const int CVM_NM_NOTE_MESSAGE_CONTINUATION = 0x507f; /// /// (0x5075) Extended Note message; Voice Overlap(MSB, LSB)(VoiceOverlap = ((MSB & 0x7f) << 7) | (LSB & 0x7f) - 8192) /// - public const ushort CVM_EXNM_VOICE_OVERLAP = 0x5075; + public const int CVM_EXNM_VOICE_OVERLAP = 0x5075; /// /// (0x5076) Extended Note message; Flags length in bytes(MSB, LSB) /// - public const ushort CVM_EXNM_FLAGS_BYTES = 0x5076; + public const int CVM_EXNM_FLAGS_BYTES = 0x5076; /// /// (0x5077) Extended Note message; Flag(MSB) /// - public const ushort CVM_EXNM_FLAGS = 0x5077; + public const int CVM_EXNM_FLAGS = 0x5077; /// /// (0x5078) Extended Note message; Flag continuation(MSB)(MSB, 0x7f=end, 0x00=continue) /// - public const ushort CVM_EXNM_FLAGS_CONINUATION = 0x5078; + public const int CVM_EXNM_FLAGS_CONINUATION = 0x5078; /// /// (0x5079) Extended Note message; Moduration(MSB, LSB)(Moduration = ((MSB & 0x7f) << 7) | (LSB & 0x7f) - 100) /// - public const ushort CVM_EXNM_MODURATION = 0x5079; + public const int CVM_EXNM_MODURATION = 0x5079; /// /// (0x507a) Extended Note message; PreUtterance(MSB, LSB)(PreUtterance = ((MSB & 0x7f) << 7) | (LSB & 0x7f) - 8192) /// - public const ushort CVM_EXNM_PRE_UTTERANCE = 0x507a; + public const int CVM_EXNM_PRE_UTTERANCE = 0x507a; /// /// (0x507e) Extended Note message; Envelope: value1(MSB, LSB) actual value = (value3.msb & 0xf) << 28 | (value2.msb & 0x7f) << 21 | (value2.lsb & 0x7f) << 14 | (value1.msb & 0x7f) << 7 | (value1.lsb & 0x7f) /// - public const ushort CVM_EXNM_ENV_DATA1 = 0x507e; + public const int CVM_EXNM_ENV_DATA1 = 0x507e; /// /// (0x507d) Extended Note message; Envelope: value2(MSB, LSB) /// - public const ushort CVM_EXNM_ENV_DATA2 = 0x507d; + public const int CVM_EXNM_ENV_DATA2 = 0x507d; /// /// (0x507c) Extended Note message; Envelope: value3(MSB) /// - public const ushort CVM_EXNM_ENV_DATA3 = 0x507c; + public const int CVM_EXNM_ENV_DATA3 = 0x507c; /// /// (0x507b) Extended Note message; Envelope: data point continuation(MSB)(MSB, 0x7f=end, 0x00=continue) /// - public const ushort CVM_EXNM_ENV_DATA_CONTINUATION = 0x507b; + public const int CVM_EXNM_ENV_DATA_CONTINUATION = 0x507b; /// /// (0x6000) Version number &, Device number(MSB, LSB) /// - public const ushort CC_BS_VERSION_AND_DEVICE = 0x6000; + public const int CC_BS_VERSION_AND_DEVICE = 0x6000; /// /// (0x6001) Delay in millisec(MSB, LSB) /// - public const ushort CC_BS_DELAY = 0x6001; + public const int CC_BS_DELAY = 0x6001; /// /// (0x6002) Laugnage type(MSB, optional LSB) /// - public const ushort CC_BS_LANGUAGE_TYPE = 0x6002; + public const int CC_BS_LANGUAGE_TYPE = 0x6002; /// /// (0x6100) Version number &, device number(MSB, LSB) /// - public const ushort CC_CV_VERSION_AND_DEVICE = 0x6100; + public const int CC_CV_VERSION_AND_DEVICE = 0x6100; /// /// (0x6101) Delay in millisec(MSB, LSB) /// - public const ushort CC_CV_DELAY = 0x6101; + public const int CC_CV_DELAY = 0x6101; /// /// (0x6102) Volume value(MSB) /// - public const ushort CC_CV_VOLUME = 0x6102; + public const int CC_CV_VOLUME = 0x6102; /// /// (0x6200) Version number &, device number(MSB, LSB) /// - public const ushort CC_P_VERSION_AND_DEVICE = 0x6200; + public const int CC_P_VERSION_AND_DEVICE = 0x6200; /// /// (0x6201) Delay in millisec(MSB, LSB) /// - public const ushort CC_P_DELAY = 0x6201; + public const int CC_P_DELAY = 0x6201; /// /// (0x6202) Pan value(MSB) /// - public const ushort CC_PAN = 0x6202; + public const int CC_PAN = 0x6202; /// /// (0x6300) Version number &, device number(MSB, LSB) /// - public const ushort CC_E_VESION_AND_DEVICE = 0x6300; + public const int CC_E_VESION_AND_DEVICE = 0x6300; /// /// (0x6301) Delay in millisec(MSB, LSB) /// - public const ushort CC_E_DELAY = 0x6301; + public const int CC_E_DELAY = 0x6301; /// /// (0x6302) Expression vlaue(MSB) /// - public const ushort CC_E_EXPRESSION = 0x6302; + public const int CC_E_EXPRESSION = 0x6302; /// /// (0x6400) Version number &, device number(MSB, LSB) /// - public const ushort CC_VR_VERSION_AND_DEVICE = 0x6400; + public const int CC_VR_VERSION_AND_DEVICE = 0x6400; /// /// (0x6401) Delay in millisec(MSB, LSB) /// - public const ushort CC_VR_DELAY = 0x6401; + public const int CC_VR_DELAY = 0x6401; /// /// (0x6402) Vibrato Rate value(MSB) /// - public const ushort CC_VR_VIBRATO_RATE = 0x6402; + public const int CC_VR_VIBRATO_RATE = 0x6402; /// /// (0x6500) Version number &, device number(MSB, LSB) /// - public const ushort CC_VD_VERSION_AND_DEVICE = 0x6500; + public const int CC_VD_VERSION_AND_DEVICE = 0x6500; /// /// (0x6501) Delay in millisec(MSB, LSB) /// - public const ushort CC_VD_DELAY = 0x6501; + public const int CC_VD_DELAY = 0x6501; /// /// (0x6502) Vibrato Depth value(MSB) /// - public const ushort CC_VD_VIBRATO_DEPTH = 0x6502; + public const int CC_VD_VIBRATO_DEPTH = 0x6502; /// /// (0x6600) Version number &, device number(MSB, LSB) /// - public const ushort CC_FX2_VERSION_AND_DEVICE = 0x6600; + public const int CC_FX2_VERSION_AND_DEVICE = 0x6600; /// /// (0x6601) Delay in millisec(MSB, LSB) /// - public const ushort CC_FX2_DELAY = 0x6601; + public const int CC_FX2_DELAY = 0x6601; /// /// (0x6602) Effect2 Depth(MSB) /// - public const ushort CC_FX2_EFFECT2_DEPTH = 0x6602; + public const int CC_FX2_EFFECT2_DEPTH = 0x6602; /// /// (0x6700) Version number &, device number(MSB, LSB) /// - public const ushort CC_PBS_VERSION_AND_DEVICE = 0x6700; + public const int CC_PBS_VERSION_AND_DEVICE = 0x6700; /// /// (0x6701) Delay in millisec(MSB, LSB) /// - public const ushort CC_PBS_DELAY = 0x6701; + public const int CC_PBS_DELAY = 0x6701; /// /// (0x6702) Pitch Bend Sensitivity(MSB, LSB) /// - public const ushort CC_PBS_PITCH_BEND_SENSITIVITY = 0x6702; + public const int CC_PBS_PITCH_BEND_SENSITIVITY = 0x6702; /// /// (0x5300) Version number &, device number(MSB, LSB) /// - public const ushort PC_VERSION_AND_DEVICE = 0x5300; + public const int PC_VERSION_AND_DEVICE = 0x5300; /// /// (0x5301) Delay in millisec(MSB, LSB) /// - public const ushort PC_DELAY = 0x5301; + public const int PC_DELAY = 0x5301; /// /// (0x5302) Voice Type(MSB) /// - public const ushort PC_VOICE_TYPE = 0x5302; + public const int PC_VOICE_TYPE = 0x5302; /// /// (0x5400) Version number &, device number(MSB, LSB) /// - public const ushort PB_VERSION_AND_DEVICE = 0x5400; + public const int PB_VERSION_AND_DEVICE = 0x5400; /// /// (0x5401) Delay in millisec(MSB, LSB) /// - public const ushort PB_DELAY = 0x5401; + public const int PB_DELAY = 0x5401; /// /// (0x5402) Pitch Bend value(MSB, LSB) /// - public const ushort PB_PITCH_BEND = 0x5402; + public const int PB_PITCH_BEND = 0x5402; /// /// (0x5500) Version number &, device number(MSB, LSB) /// - public const ushort VCP_VERSION_AND_DEVICE = 0x5500; + public const int VCP_VERSION_AND_DEVICE = 0x5500; /// /// (0x5501) Delay in millisec(MSB, LSB) /// - public const ushort VCP_DELAY = 0x5501; + public const int VCP_DELAY = 0x5501; /// /// (0x5502) Voice Change Parameter ID(MSB) /// - public const ushort VCP_VOICE_CHANGE_PARAMETER_ID = 0x5502; + public const int VCP_VOICE_CHANGE_PARAMETER_ID = 0x5502; /// /// (0x5503) Voice Change Parameter value(MSB) /// - public const ushort VCP_VOICE_CHANGE_PARAMETER = 0x5503; + public const int VCP_VOICE_CHANGE_PARAMETER = 0x5503; - private class NrpnIterator : Iterator { - private Vector nrpns = new Vector(); - private int m_pos = -1; - - public NrpnIterator() { - Type t = typeof( NRPN ); - foreach ( FieldInfo fi in t.GetFields() ) { - if ( fi.FieldType.Equals( typeof( ushort ) ) ) { - nrpns.add( (ushort)fi.GetValue( t ) ); - } - } - } - - public boolean hasNext() { - if ( 0 <= m_pos + 1 && m_pos + 1 < nrpns.size() ) { - return true; - } else { - return false; - } - } - - public Object next() { - m_pos++; - return nrpns.get( m_pos ); - } - - public void remove() { - } + private NRPN() { } public static Iterator iterator() { return new NrpnIterator(); } - public static String getName( ushort nrpn ) { - foreach ( FieldInfo fi in typeof( NRPN ).GetFields() ) { - if ( fi.FieldType.Equals( typeof( ushort ) ) ) { - ushort v = (ushort)fi.GetValue( typeof( NRPN ) ); - if ( v == nrpn ) { - return fi.Name; - } + public static String getName( int nrpn ) { + for ( Iterator itr = iterator(); itr.hasNext(); ) { + ValuePair v = (ValuePair)itr.next(); + if ( v.getValue() == nrpn ) { + return v.getKey(); } } return ""; @@ -612,69 +590,50 @@ namespace Boare.Lib.Vsq { /// public static byte getVoiceChangeParameterID( String curve_name ) { byte lsb = 0x31; - switch ( curve_name.ToLower() ) { - case "harmonics": - lsb = 0x30; - break; - case "bre": - lsb = 0x31; - break; - case "bri": - lsb = 0x32; - break; - case "cle": - lsb = 0x33; - break; - case "por": - lsb = 0x34; - break; - case "ope": - lsb = 0x35; - break; - case "reso1freq": - lsb = 0x40; - break; - case "reso2freq": - lsb = 0x41; - break; - case "reso3freq": - lsb = 0x42; - break; - case "reso4freq": - lsb = 0x43; - break; - case "reso1bw": - lsb = 0x50; - break; - case "reso2bw": - lsb = 0x51; - break; - case "reso3bw": - lsb = 0x52; - break; - case "reso4bw": - lsb = 0x53; - break; - case "reso1amp": - lsb = 0x60; - break; - case "reso2amp": - lsb = 0x61; - break; - case "reso3amp": - lsb = 0x62; - break; - case "reso4amp": - lsb = 0x63; - break; - case "gen": - lsb = 0x70; - break; + curve_name = curve_name.ToLower(); + if ( curve_name.Equals( "harmonics" ) ) { + lsb = 0x30; + } else if ( curve_name.Equals( "bre" ) ) { + lsb = 0x31; + } else if ( curve_name.Equals( "bri" ) ) { + lsb = 0x32; + } else if ( curve_name.Equals( "cle" ) ) { + lsb = 0x33; + } else if ( curve_name.Equals( "por" ) ) { + lsb = 0x34; + } else if ( curve_name.Equals( "ope" ) ) { + lsb = 0x35; + } else if ( curve_name.Equals( "reso1freq" ) ) { + lsb = 0x40; + } else if ( curve_name.Equals( "reso2freq" ) ) { + lsb = 0x41; + } else if ( curve_name.Equals( "reso3freq" ) ) { + lsb = 0x42; + } else if ( curve_name.Equals( "reso4freq" ) ) { + lsb = 0x43; + } else if ( curve_name.Equals( "reso1bw" ) ) { + lsb = 0x50; + } else if ( curve_name.Equals( "reso2bw" ) ) { + lsb = 0x51; + } else if ( curve_name.Equals( "reso3bw" ) ) { + lsb = 0x52; + } else if ( curve_name.Equals( "reso4bw" ) ) { + lsb = 0x53; + } else if ( curve_name.Equals( "reso1amp" ) ) { + lsb = 0x60; + } else if ( curve_name.Equals( "reso2amp" ) ) { + lsb = 0x61; + } else if ( curve_name.Equals( "reso3amp" ) ) { + lsb = 0x62; + } else if ( curve_name.Equals( "reso4amp" ) ) { + lsb = 0x63; + } else if ( curve_name.Equals( "gen" ) ) { + lsb = 0x70; } return lsb; } - public static boolean is_require_data_lsb( ushort nrpn ) { + public static boolean is_require_data_lsb( int nrpn ) { switch ( nrpn ) { case CVM_NM_VERSION_AND_DEVICE: case CVM_NM_DELAY: @@ -747,4 +706,6 @@ namespace Boare.Lib.Vsq { } +#if !JAVA } +#endif diff --git a/trunk/Boare.Lib.Vsq/NoteHeadHandle.cs b/trunk/Boare.Lib.Vsq/NoteHeadHandle.cs new file mode 100644 index 0000000..ca9ebe5 --- /dev/null +++ b/trunk/Boare.Lib.Vsq/NoteHeadHandle.cs @@ -0,0 +1,94 @@ +/* + * NoteHeadHandle.cs + * Copyright (c) 2009 kbinani + * + * This file is part of Boare.Lib.Vsq. + * + * Boare.Lib.Vsq is free software; you can redistribute it and/or + * modify it under the terms of the BSD License. + * + * Boare.Lib.Vsq 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. + */ +#if JAVA +package org.kbinani.vsq; + +import java.io.*; +#else +using System; + +namespace Boare.Lib.Vsq { +#endif + +#if JAVA + public class NoteHeadHandle implements Cloneable, Serializable { +#else + [Serializable] + public class NoteHeadHandle : ICloneable { +#endif + public int Index; + public String IconID = ""; + public String IDS = ""; + public int Original; + public String Caption = ""; + public int Length; + public int Duration; + public int Depth; + + public NoteHeadHandle() { + } + + public int getLength() { + return Length; + } + + public void setLength( int value ) { + Length = value; + } + + public String getDisplayString() { + String s = IDS; + if ( !Caption.Equals( "" ) ) { + s += " (" + Caption + ")"; + } + return s; + } + +#if !JAVA + public object Clone() { + return clone(); + } +#endif + + public Object clone() { + NoteHeadHandle result = new NoteHeadHandle(); + result.Index = Index; + result.IconID = IconID; + result.IDS = IDS; + result.Original = Original; + result.Caption = Caption; + result.setLength( Length ); + result.Duration = Duration; + result.Depth = Depth; + return result; + } + + public VsqHandle castToVsqHandle() { + VsqHandle ret = new VsqHandle(); + ret.m_type = VsqHandleType.NoteHeadHandle; + ret.Index = Index; + ret.IconID = IconID; + ret.IDS = IDS; + ret.Original = Original; + ret.Caption = Caption; + ret.setLength( Length ); + ret.Duration = Duration; + ret.Depth = Depth; + return ret; + } + } + +#if !JAVA +} +#endif diff --git a/trunk/Boare.Lib.Vsq/NrpnData.cs b/trunk/Boare.Lib.Vsq/NrpnData.cs index 05ebdba..37f4ac4 100644 --- a/trunk/Boare.Lib.Vsq/NrpnData.cs +++ b/trunk/Boare.Lib.Vsq/NrpnData.cs @@ -11,7 +11,11 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */ +#if JAVA +package org.kbinani.vsq; +#else namespace Boare.Lib.Vsq { +#endif public class NrpnData { int m_clock; @@ -24,13 +28,15 @@ namespace Boare.Lib.Vsq { Value = value; } - public int getClock(){ + public int getClock() { return m_clock; } - public byte getParameter(){ + public byte getParameter() { return m_parameter; } } +#if !JAVA } +#endif diff --git a/trunk/Boare.Lib.Vsq/NrpnIterator.cs b/trunk/Boare.Lib.Vsq/NrpnIterator.cs new file mode 100644 index 0000000..8c9aed8 --- /dev/null +++ b/trunk/Boare.Lib.Vsq/NrpnIterator.cs @@ -0,0 +1,83 @@ +/* + * NrpnIterator.cs + * Copyright (c) 2009 kbinani + * + * This file is part of Boare.Lib.Vsq. + * + * Boare.Lib.Vsq is free software; you can redistribute it and/or + * modify it under the terms of the BSD License. + * + * Boare.Lib.Vsq 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. + */ +#if JAVA +package org.kbinani.vsq; + +import java.lang.reflect.*; +import java.util.*; +import org.kbinani.*; +#else +using System; +using System.Reflection; +using bocoree; +using bocoree.java.util; + +namespace Boare.Lib.Vsq { + using boolean = System.Boolean; + using Integer = System.Int32; +#endif + +#if JAVA + public class NrpnIterator implements Iterator { +#else + public class NrpnIterator : Iterator { +#endif + private Vector> nrpns = new Vector>(); + private int m_pos = -1; + + public NrpnIterator() { +#if JAVA + try{ + Field[] fields = NRPN.class.getFields(); + for( int i = 0; i < 0; i++ ){ + Class type = fields[i].getType(); + if( type == Integer.class || type == Integer.TYPE ){ + Integer value = (Integer)fields[i].get( null ); + String name = fields[i].getName(); + nrpns.add( new ValuePair( name, value ) ); + } + } + }catch( Exception ex ){ + System.out.println( "com.boare.vsq.NrpnIterator#.ctor; ex=" + ex ); + } +#else + Type t = typeof( NRPN ); + foreach ( FieldInfo fi in t.GetFields() ) { + if ( fi.FieldType.Equals( typeof( int ) ) ) { + nrpns.add( new ValuePair( fi.Name, (int)fi.GetValue( t ) ) ); + } + } +#endif + } + + public boolean hasNext() { + if ( 0 <= m_pos + 1 && m_pos + 1 < nrpns.size() ) { + return true; + } else { + return false; + } + } + + public Object next() { + m_pos++; + return nrpns.get( m_pos ).getValue(); + } + + public void remove() { + } + } + +#if !JAVA +} +#endif diff --git a/trunk/Boare.Lib.Vsq/SMF/MidiFile.cs b/trunk/Boare.Lib.Vsq/SMF/MidiFile.cs deleted file mode 100644 index 1eed05d..0000000 --- a/trunk/Boare.Lib.Vsq/SMF/MidiFile.cs +++ /dev/null @@ -1,444 +0,0 @@ -/* - * MidiFile.cs - * Copyright (c) 2009 kbinani - * - * This file is part of Boare.Lib.Vsq. - * - * Boare.Lib.Vsq is free software; you can redistribute it and/or - * modify it under the terms of the BSD License. - * - * Boare.Lib.Vsq 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.IO; -using System.Collections.Generic; - -using bocoree; - -namespace Boare.Lib.Vsq { - - using boolean = System.Boolean; - - /// - /// midiイベント。メタイベントは、メタイベントのデータ長をData[1]に格納せず、生のデータをDataに格納するので、注意が必要 - /// - public struct MidiEvent : IComparable { - public long clock; - public byte firstByte; - public byte[] data; - - public long Clock { - get { - return clock; - } - set { - clock = value; - } - } - - public byte FirstByte { - get { - return firstByte; - } - set { - firstByte = value; - } - } - - public byte[] Data { - get { - return data; - } - set { - data = value; - } - } - - private static void writeDeltaClock( Stream stream, long number ) { - boolean[] bits = new boolean[64]; - long val = 0x1; - bits[0] = (number & val) == val; - for ( int i = 1; i < 64; i++ ) { - val = val << 1; - bits[i] = (number & val) == val; - } - int first = 0; - for ( int i = 63; i >= 0; i-- ) { - if ( bits[i] ) { - first = i; - break; - } - } - // 何バイト必要か? - int bytes = first / 7 + 1; - for ( int i = 1; i <= bytes; i++ ) { - uint num = 0; - uint count = 0x80; - for ( int j = (bytes - i + 1) * 7 - 1; j >= (bytes - i + 1) * 7 - 6 - 1; j-- ) { - count = count >> 1; - if ( bits[j] ) { - num += count; - } - } - if ( i != bytes ) { - num += 0x80; - } - stream.WriteByte( (byte)num ); - } - } - - private static long readDeltaClock( Stream stream ) { - long ret = 0; - while ( true ) { - int i = stream.ReadByte(); - if ( i < 0 ) { - break; - } - byte d = (byte)i; - ret = (ret << 7) | ((long)d & 0x7f); - if ( (d & 0x80) == 0x00 ) { - break; - } - } - return ret; - } - - public static MidiEvent read( Stream stream, ref long last_clock, ref byte last_status_byte ) { - long delta_clock = readDeltaClock( stream ); - last_clock += delta_clock; - byte first_byte = (byte)stream.ReadByte(); - if ( first_byte < 0x80 ) { - // ランニングステータスが適用される - stream.Seek( -1, SeekOrigin.Current ); - first_byte = last_status_byte; - } else { - last_status_byte = first_byte; - } - byte ctrl = (byte)(first_byte & (byte)0xf0); - if ( ctrl == 0x80 || ctrl == 0x90 || ctrl == 0xA0 || ctrl == 0xB0 || ctrl == 0xE0 || first_byte == 0xF2 ) { - // 3byte使用するチャンネルメッセージ: - // 0x8*: ノートオフ - // 0x9*: ノートオン - // 0xA*: ポリフォニック・キープレッシャ - // 0xB*: コントロールチェンジ - // 0xE*: ピッチベンドチェンジ - // 3byte使用するシステムメッセージ - // 0xF2: ソングポジション・ポインタ - MidiEvent me = new MidiEvent(); - me.clock = last_clock; - me.firstByte = first_byte; - me.data = new byte[2]; - stream.Read( me.data, 0, 2 ); - return me; - } else if ( ctrl == 0xC0 || ctrl == 0xD0 || first_byte == 0xF1 || first_byte == 0xF2 ) { - // 2byte使用するチャンネルメッセージ - // 0xC*: プログラムチェンジ - // 0xD*: チャンネルプレッシャ - // 2byte使用するシステムメッセージ - // 0xF1: クォータフレーム - // 0xF3: ソングセレクト - MidiEvent me = new MidiEvent(); - me.clock = last_clock; - me.firstByte = first_byte; - me.data = new byte[1]; - stream.Read( me.data, 0, 1 ); - return me; - } else if ( first_byte == 0xF6 ) { - // 1byte使用するシステムメッセージ - // 0xF6: チューンリクエスト - // 0xF7: エンドオブエクスクルーシブ(このクラスではF0ステータスのSysExの一部として取り扱う) - // 0xF8: タイミングクロック - // 0xFA: スタート - // 0xFB: コンティニュー - // 0xFC: ストップ - // 0xFE: アクティブセンシング - // 0xFF: システムリセット - MidiEvent me = new MidiEvent(); - me.clock = last_clock; - me.firstByte = first_byte; - me.data = new byte[0]; - return me; - } else if ( first_byte == 0xff ) { - // メタイベント - byte meta_event_type = (byte)stream.ReadByte(); - long meta_event_length = readDeltaClock( stream ); - MidiEvent me = new MidiEvent(); - me.clock = last_clock; - me.firstByte = first_byte; - me.data = new byte[meta_event_length + 1]; - me.data[0] = meta_event_type; - stream.Read( me.data, 1, (int)meta_event_length ); - return me; - } else if ( first_byte == 0xf0 ) { - // f0ステータスのSysEx - MidiEvent me = new MidiEvent(); - me.clock = last_clock; - me.firstByte = first_byte; - long sysex_length = readDeltaClock( stream ); - me.data = new byte[sysex_length + 1]; - stream.Read( me.data, 0, (int)(sysex_length + 1) ); - return me; - } else if ( first_byte == 0xf7 ) { - // f7ステータスのSysEx - MidiEvent me = new MidiEvent(); - me.clock = last_clock; - me.firstByte = first_byte; - long sysex_length = readDeltaClock( stream ); - me.data = new byte[sysex_length]; - stream.Read( me.data, 0, (int)sysex_length ); - return me; - } else { - throw new ApplicationException( "don't know how to process first_byte: 0x" + Convert.ToString( first_byte, 16 ) ); - } - } - - public void writeData( Stream stream ) { - stream.WriteByte( firstByte ); - if ( firstByte == 0xff ) { - stream.WriteByte( data[0] ); - writeDeltaClock( stream, data.Length - 1 ); - //stream.WriteByte( (byte)(Data.Length - 1) ); - stream.Write( data, 1, data.Length - 1 ); - } else { - stream.Write( data, 0, data.Length ); - } - } - - public int CompareTo( MidiEvent item ) { - if ( clock != item.clock ) { - return (int)(clock - item.clock); - } else { - int first_this = firstByte & 0xf0; - int first_item = item.firstByte & 0xf0; - - if ( (first_this == 0x80 || first_this == 0x90) && (first_item == 0x80 || first_item == 0x90) ) { - if ( data != null && data.Length >= 2 && item.data != null && item.data.Length >= 2 ) { - if ( first_item == 0x90 && item.data[1] == 0 ) { - first_item = 0x80; - } - if ( first_this == 0x90 && data[1] == 0 ) { - first_this = 0x80; - } - if ( data[0] == item.data[0] ) { - if ( first_this == 0x90 ) { - if ( first_item == 0x80 ) { - // ON -> OFF - return 1; - } else { - // ON -> ON - return 0; - } - } else { - if ( first_item == 0x80 ) { - // OFF -> OFF - return 0; - } else { - // OFF -> ON - return -1; - } - } - } - } - } - return (int)(clock - item.clock); - } - } - - public static MidiEvent generateTimeSigEvent( int clock, int numerator, int denominator ) { - MidiEvent ret = new MidiEvent(); - ret.clock = clock; - ret.firstByte = 0xff; - byte b_numer = (byte)(Math.Log( denominator, 2 ) + 0.1); -#if DEBUG - Console.WriteLine( "VsqEvent.generateTimeSigEvent; b_number=" + b_numer + "; denominator=" + denominator ); -#endif - ret.data = new byte[5] { 0x58, (byte)numerator, b_numer, 0x18, 0x08 }; - return ret; - } - - public static MidiEvent generateTempoChangeEvent( int clock, int tempo ) { - MidiEvent ret = new MidiEvent(); - ret.clock = clock; - ret.firstByte = 0xff; - byte b1 = (byte)(tempo & 0xff); - tempo = tempo >> 8; - byte b2 = (byte)(tempo & 0xff); - tempo = tempo >> 8; - byte b3 = (byte)(tempo & 0xff); - ret.data = new byte[4] { 0x51, b3, b2, b1 }; - return ret; - } - } - - public class MidiFile : IDisposable { - private Vector> m_events; - private ushort m_format; - private ushort m_time_format; - - public MidiFile( String path ){ - Stream stream = new FileStream( path, FileMode.Open, FileAccess.Read ); - // ヘッダ - byte[] byte4 = new byte[4]; - stream.Read( byte4, 0, 4 ); - if ( makeUInt32( byte4 ) != 0x4d546864 ) { - throw new ApplicationException( "header error: MThd" ); - } - - // データ長 - stream.Read( byte4, 0, 4 ); - uint length = makeUInt32( byte4 ); - - // フォーマット - stream.Read( byte4, 0, 2 ); - m_format = makeUint16( byte4 ); - - // トラック数 - int tracks = 0; - stream.Read( byte4, 0, 2 ); - tracks = (int)makeUint16( byte4 ); - - // 時間分解能 - stream.Read( byte4, 0, 2 ); - m_time_format = makeUint16( byte4 ); - - // 各トラックを読込み - m_events = new Vector>(); - for ( int track = 0; track < tracks; track++ ) { - // ヘッダー - stream.Read( byte4, 0, 4 ); - if ( makeUInt32( byte4 ) != 0x4d54726b ) { - throw new ApplicationException( "header error; MTrk" ); - } - m_events.add( new Vector() ); - - // チャンクサイズ - stream.Read( byte4, 0, 4 ); - long size = (long)makeUInt32( byte4 ); - long startpos = stream.Position; - - // チャンクの終わりまで読込み - long clock = 0; - byte last_status_byte = 0x00; - while ( stream.Position < startpos + size ) { - MidiEvent mi = MidiEvent.read( stream, ref clock, ref last_status_byte ); - m_events.get( track ).add( mi ); - } - if ( m_time_format != 480 ) { - int count = m_events.get( track ).size(); - for ( int i = 0; i < count; i++ ) { - MidiEvent mi = m_events.get( track ).get( i ); - mi.clock = mi.clock * 480 / m_time_format; - m_events.get( track ).set( i, mi ); - } - } - } - m_time_format = 480; -#if DEBUG - String dbg = Path.Combine( Path.GetDirectoryName( path ), Path.GetFileNameWithoutExtension( path ) + ".txt" ); - using ( StreamWriter sw = new StreamWriter( dbg ) ) { - const String format = " {0,8} 0x{1:X4} {2,-35} 0x{3:X2} 0x{4:X2}"; - const String format0 = " {0,8} 0x{1:X4} {2,-35} 0x{3:X2}"; - for ( int track = 1; track < m_events.size(); track++ ) { - sw.WriteLine( "MidiFile..ctor; track=" + track ); - byte msb, lsb, data_msb, data_lsb; - msb = lsb = data_msb = data_lsb = 0x0; - for ( int i = 0; i < m_events.get( track ).size(); i++ ) { - if ( m_events.get( track ).get( i ).firstByte == 0xb0 ) { - switch ( m_events.get( track ).get( i ).data[0] ) { - case 0x63: - msb = m_events.get( track ).get( i ).data[1]; - lsb = 0x0; - break; - case 0x62: - lsb = m_events.get( track ).get( i ).data[1]; - break; - case 0x06: - data_msb = m_events.get( track ).get( i ).data[1]; - ushort nrpn = (ushort)(msb << 8 | lsb); - String name = NRPN.getName( nrpn ); - if ( name.Equals( "" ) ) { - name = "* * UNKNOWN * *"; - sw.WriteLine( String.Format( format0, m_events.get( track ).get( i ).clock, nrpn, name, data_msb ) ); - } else { - //if ( !NRPN.is_require_data_lsb( nrpn ) ) { - sw.WriteLine( String.Format( format0, m_events.get( track ).get( i ).clock, nrpn, name, data_msb ) ); - //} - } - break; - case 0x26: - data_lsb = m_events.get( track ).get( i ).data[1]; - ushort nrpn2 = (ushort)(msb << 8 | lsb); - String name2 = NRPN.getName( nrpn2 ); - if ( name2.Equals( "" ) ) { - name2 = "* * UNKNOWN * *"; - } - sw.WriteLine( String.Format( format, m_events.get( track ).get( i ).clock, nrpn2, name2, data_msb, data_lsb ) ); - break; - } - } - } - } - } -#endif - stream.Close(); - } - - /*public void Write( String path ) { - }*/ - - public Vector getMidiEventList( int track ) { - if ( m_events == null ) { - return new Vector(); - } else if ( 0 <= track && track < m_events.size() ) { - return m_events.get( track ); - } else { - return new Vector(); - } - } - - public int getTrackCount() { - if ( m_events == null ) { - return 0; - } else { - return m_events.size(); - } - } - - public void Dispose() { - Close(); - } - - public void Close() { - if ( m_events != null ) { - for ( int i = 0; i < m_events.size(); i++ ) { - m_events.get( i ).clear(); - } - m_events.clear(); - } - } - - private static UInt32 makeUInt32( byte[] value ) { - return (uint)((uint)((uint)((uint)(value[0] << 8) | value[1]) << 8 | value[2]) << 8 | value[3]); - } - - private static UInt16 makeUint16( byte[] value ) { - return (ushort)((ushort)(value[0] << 8) | value[1]); - } - - private static long readDeltaClock( Stream stream ) { - byte[] b; - long ret = 0; - while ( true ) { - byte d = (byte)stream.ReadByte(); - ret = (ret << 7) | ((long)d & 0x7f); - if ( (d & 0x80) == 0x00 ) { - break; - } - } - return ret; - } - } - -} \ No newline at end of file diff --git a/trunk/Boare.Lib.Vsq/SingerConfig.cs b/trunk/Boare.Lib.Vsq/SingerConfig.cs index 799e2f6..2e14de7 100644 --- a/trunk/Boare.Lib.Vsq/SingerConfig.cs +++ b/trunk/Boare.Lib.Vsq/SingerConfig.cs @@ -11,18 +11,29 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */ -using System; -using System.IO; -using System.Collections.Generic; +#if JAVA +package org.kbinani.vsq; +import java.io.*; +import java.util.*; +import org.kbinani.*; +#else +using System; using bocoree; +using bocoree.java.util; +using bocoree.java.io; namespace Boare.Lib.Vsq { +#endif +#if JAVA + public class SingerConfig implements Cloneable { +#else public class SingerConfig : ICloneable { +#endif public String ID = ""; public String FORMAT = ""; - public String VOICEIDSTR = ""; + public String VOICEIDSTR = ""; public String VOICENAME = "Unknown"; public int Breathiness; public int Brightness; @@ -47,8 +58,8 @@ namespace Boare.Lib.Vsq { public SingerConfig() { } - - public object Clone() { + + public Object clone() { SingerConfig ret = new SingerConfig(); ret.ID = ID; ret.FORMAT = FORMAT; @@ -77,6 +88,12 @@ namespace Boare.Lib.Vsq { return ret; } +#if !JAVA + public object Clone() { + return clone(); + } +#endif + public static SingerConfig fromVvd( String file, int original ) { SingerConfig sc = new SingerConfig(); //original = original; @@ -90,21 +107,23 @@ namespace Boare.Lib.Vsq { sc.Opening = 0; sc.GenderFactor = 0; sc.Original = original; //original = 0; - FileStream fs = null; + RandomAccessFile fs = null; try { - fs = new FileStream( file, FileMode.Open, FileAccess.Read ); - int length = (int)fs.Length; + fs = new RandomAccessFile( file, "r" ); + int length = (int)fs.length(); byte[] dat = new byte[length]; - fs.Read( dat, 0, length ); - TransCodeUtil.decodeBytes( ref dat ); - String str = bocoree.cp932.convert( dat ); + fs.read( dat, 0, length ); + TransCodeUtil.decodeBytes( dat ); + String str = PortUtil.getDecodedString( "Shift_JIS", dat ); #if DEBUG - Console.WriteLine( "SingerConfig.readSingerConfig; str=" + str ); + PortUtil.println( "SingerConfig.readSingerConfig; str=" + str ); #endif - String crlf = ((char)0x0d).ToString() + ((char)0x0a).ToString(); - String[] spl = str.Split( new String[] { crlf }, StringSplitOptions.RemoveEmptyEntries ); + String crlf = "" + (char)0x0d + "" + (char)0x0a; + String[] spl = PortUtil.splitString( str, new String[] { crlf }, true ); - foreach ( String s in spl ) { + int count = spl.Length; + for ( int i = 0; i < spl.Length; i++ ) { + String s = spl[i]; int first = s.IndexOf( '"' ); int first_end = get_quated_string( s, first ); int second = s.IndexOf( '"', first_end + 1 ); @@ -112,11 +131,14 @@ namespace Boare.Lib.Vsq { char[] chs = s.ToCharArray(); String id = new String( chs, first, first_end - first + 1 ); String value = new String( chs, second, second_end - second + 1 ); - id = id.Substring( 1, id.Length - 2 ); - value = value.Substring( 1, value.Length - 2 ); - value = value.Replace( "\\\"", "\"" ); + id = id.Substring( 1, PortUtil.getStringLength( id ) - 2 ); + value = value.Substring( 1, PortUtil.getStringLength( value ) - 2 ); + value = value.Replace( "\\" + "\"", "\"" ); int parsed_int = 64; - int.TryParse( value, out parsed_int ); + try { + parsed_int = PortUtil.parseInt( value ); + } catch ( Exception ex ) { + } if ( id.Equals( "ID" ) ) { sc.ID = value; } else if ( id.Equals( "FORMAT" ) ) { @@ -163,11 +185,14 @@ namespace Boare.Lib.Vsq { sc.Harmonics = parsed_int; } } - } catch { + } catch ( Exception ex ) { } finally { if ( fs != null ) { - fs.Close(); + try { + fs.close(); + } catch ( Exception ex2 ) { + } } } return sc; @@ -211,17 +236,27 @@ namespace Boare.Lib.Vsq { ret.add( "\"Clearness\":=:\"" + Clearness + "\"" ); ret.add( "\"Opening\":=:\"" + Opening + "\"" ); ret.add( "\"Gender:Factor\":=:\"" + GenderFactor + "\"" ); - return ret.toArray( new String[]{} ); + return ret.toArray( new String[] { } ); } - public override String ToString() { +#if !JAVA + public override string ToString() { + return toString(); + } +#endif + + public String toString() { String[] r = ToStringArray(); String ret = ""; - foreach ( String s in r ) { + int count = r.Length; + for ( int i = 0; i < count; i++ ) { + String s = r[i]; ret += s + "\n"; } return ret; } } +#if !JAVA } +#endif diff --git a/trunk/Boare.Lib.Vsq/SingerConfigSys.cs b/trunk/Boare.Lib.Vsq/SingerConfigSys.cs index cf661bf..c108cbf 100644 --- a/trunk/Boare.Lib.Vsq/SingerConfigSys.cs +++ b/trunk/Boare.Lib.Vsq/SingerConfigSys.cs @@ -11,13 +11,20 @@ * 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.IO; +#if JAVA +package org.kbinani.vsq; +import java.io.*; +import java.util.*; +import org.kbinani.*; +#else +using System; using bocoree; +using bocoree.java.util; +using bocoree.java.io; namespace Boare.Lib.Vsq { +#endif public class SingerConfigSys { private const int MAX_SINGERS = 0x4000; @@ -33,23 +40,25 @@ namespace Boare.Lib.Vsq { public SingerConfigSys( String path_voicedb, String[] path_installed_singers ) { m_installed_singers = new Vector(); m_singer_configs = new Vector(); - String map = Path.Combine( path_voicedb, "voice.map" ); - if ( !File.Exists( map ) ) { + String map = PortUtil.combinePath( path_voicedb, "voice.map" ); + if ( !PortUtil.isFileExists( map ) ) { return; } - using ( FileStream fs = new FileStream( map, FileMode.Open, FileAccess.Read ) ) { + RandomAccessFile fs = null; + try { + fs = new RandomAccessFile( map, "r" ); byte[] dat = new byte[8]; - fs.Seek( 0x20, SeekOrigin.Begin ); + fs.seek( 0x20 ); for ( int i = 0; i < MAX_SINGERS; i++ ) { - fs.Read( dat, 0, 8 ); - ulong value = VocaloSysUtil.makelong_le( dat ); + fs.read( dat, 0, 8 ); + long value = VocaloSysUtil.makelong_le( dat ); if ( value >= 1 ) { - String vvd = Path.Combine( path_voicedb, "vvoice" + value + ".vvd" ); + String vvd = PortUtil.combinePath( path_voicedb, "vvoice" + value + ".vvd" ); SingerConfig item = SingerConfig.fromVvd( vvd, 0 ); item.Program = i; int original = -1; - for ( Iterator itr = m_installed_singers.iterator(); itr.hasNext(); ){ + for ( Iterator itr = m_installed_singers.iterator(); itr.hasNext(); ) { SingerConfig sc = (SingerConfig)itr.next(); if ( sc.VOICEIDSTR.Equals( item.VOICEIDSTR ) ) { original = sc.Program; @@ -57,10 +66,20 @@ namespace Boare.Lib.Vsq { } } if ( original < 0 ) { - foreach ( String ipath in path_installed_singers ) { +#if JAVA + int count = path_installed_singers.length; +#else + int count = path_installed_singers.Length; +#endif + for ( int j = 0; j < count; j++ ) { + String ipath = path_installed_singers[j]; if ( ipath.EndsWith( item.VOICEIDSTR ) ) { - String[] vvds = Directory.GetFiles( ipath, "*.vvd" ); + String[] vvds = PortUtil.listFiles( ipath, "*.vvd" ); +#if JAVA + if ( vvds.length > 0 ) { +#else if ( vvds.Length > 0 ) { +#endif original = m_installed_singers.size(); SingerConfig installed = SingerConfig.fromVvd( vvds[0], original ); installed.Program = original; @@ -75,11 +94,19 @@ namespace Boare.Lib.Vsq { m_singer_configs.add( item ); } } + } catch ( Exception ex ) { + } finally { + if ( fs != null ) { + try { + fs.close(); + } catch ( Exception ex2 ) { + } + } } } public SingerConfig[] getInstalledSingers() { - return m_installed_singers.toArray( new SingerConfig[]{} ); + return m_installed_singers.toArray( new SingerConfig[] { } ); } /// @@ -101,32 +128,37 @@ namespace Boare.Lib.Vsq { sc = new SingerConfig(); } int lang = 0; - for( Iterator itr = m_installed_singers.iterator(); itr.hasNext(); ){ + for ( Iterator itr = m_installed_singers.iterator(); itr.hasNext(); ) { SingerConfig sc2 = (SingerConfig)itr.next(); if ( sc.VOICEIDSTR.Equals( sc2.VOICEIDSTR ) ) { - lang = (int)VocaloSysUtil.getLanguageFromName( sc.VOICENAME ); + VsqVoiceLanguage lang_enum = VocaloSysUtil.getLanguageFromName( sc.VOICENAME ); +#if JAVA + lang = lang_enum.ordinal(); +#else + lang = (int)lang_enum; +#endif break; } } ret.IconHandle = new IconHandle(); - ret.IconHandle.IconID = "$0701" + sc.Program.ToString( "0000" ); + ret.IconHandle.IconID = "$0701" + PortUtil.toHexString( sc.Program, 4 ); ret.IconHandle.IDS = sc.VOICENAME; ret.IconHandle.Index = 0; ret.IconHandle.Language = lang; - ret.IconHandle.Length = 1; + ret.IconHandle.setLength( 1 ); ret.IconHandle.Original = sc.Original; ret.IconHandle.Program = sc.Program; ret.IconHandle.Caption = ""; return ret; } - + /// /// Gets the singer information of pecified program change. /// /// /// public SingerConfig getSingerInfo( String singer ) { - for ( Iterator itr = m_installed_singers.iterator(); itr.hasNext(); ){ + for ( Iterator itr = m_installed_singers.iterator(); itr.hasNext(); ) { SingerConfig item = (SingerConfig)itr.next(); if ( item.VOICENAME.Equals( singer ) ) { return item; @@ -140,8 +172,10 @@ namespace Boare.Lib.Vsq { /// /// public SingerConfig[] getSingerConfigs() { - return m_singer_configs.toArray( new SingerConfig[]{} ); + return m_singer_configs.toArray( new SingerConfig[] { } ); } } +#if !JAVA } +#endif diff --git a/trunk/Boare.Lib.Vsq/SymbolTable.cs b/trunk/Boare.Lib.Vsq/SymbolTable.cs index 65492d1..f002680 100644 --- a/trunk/Boare.Lib.Vsq/SymbolTable.cs +++ b/trunk/Boare.Lib.Vsq/SymbolTable.cs @@ -11,28 +11,43 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */ -using System; -using System.IO; -using System.Text; -using System.Collections.Generic; -using System.Windows.Forms; +#if JAVA +package org.kbinani.vsq; +import java.util.*; +import java.io.*; +import org.kbinani.*; +#else +using System; +using System.Text; +using System.Windows.Forms; using bocoree; +using bocoree.java.util; +using bocoree.java.io; namespace Boare.Lib.Vsq { - using boolean = System.Boolean; + using Integer = System.Int32; +#endif +#if JAVA + public class SymbolTable implements Cloneable { +#else public class SymbolTable : ICloneable { +#endif private TreeMap m_dict; private String m_name; private boolean m_enabled; #region Static Field - private static SortedList s_table = new SortedList(); + private static TreeMap s_table = new TreeMap(); private static SymbolTable s_default_jp = null; private static boolean s_initialized = false; +#if JAVA + public static final String[][] _KEY_JP = { +#else public static readonly String[,] _KEY_JP = { +#endif {"あ", "a"}, {"い", "i"}, {"う", "M"}, @@ -60,7 +75,7 @@ namespace Boare.Lib.Vsq { {"の", "n o"}, {"は", "h a"}, {"ひ", "C i"}, - {"ふ", @"p\ M"}, + {"ふ", "p\\ M"}, {"へ", "h e"}, {"ほ", "h o"}, {"ま", "m a"}, @@ -134,10 +149,10 @@ namespace Boare.Lib.Vsq { {"ひゅ", "C M"}, {"ひぇ", "C e"}, {"ひょ", "C o"}, - {"ふゃ", @"p\' a"}, - {"ふぃ", @"p\' i"}, - {"ふゅ", @"p\' M"}, - {"ふぇ", @"p\ e"}, + {"ふゃ", "p\\' a"}, + {"ふぃ", "p\\' i"}, + {"ふゅ", "p\\' M"}, + {"ふぇ", "p\\ e"}, {"みゃ", "m' a"}, {"みゅ", "m' M"}, {"みぇ", "m' e"}, @@ -162,8 +177,8 @@ namespace Boare.Lib.Vsq { {"ぴゅ", "p' M"}, {"ぴぇ", "p' e"}, {"ぴょ", "p' o"}, - {"ふぁ", @"p\ a"}, - {"ふぉ", @"p\ o"}, + {"ふぁ", "p\\ a"}, + {"ふぉ", "p\\ o"}, {"てゃ", "t' a"}, {"てぃ", "t' i"}, {"てゅ", "t' M"}, @@ -209,7 +224,7 @@ namespace Boare.Lib.Vsq { {"ノ", "n o"}, {"ハ", "h a"}, {"ヒ", "C i"}, - {"フ", @"p\ M"}, + {"フ", "p\\ M"}, {"ヘ", "h e"}, {"ホ", "h o"}, {"マ", "m a"}, @@ -283,10 +298,10 @@ namespace Boare.Lib.Vsq { {"ヒュ", "C M"}, {"ヒェ", "C e"}, {"ヒョ", "C o"}, - {"フャ", @"p\' a"}, - {"フィ", @"p\' i"}, - {"フュ", @"p\' M"}, - {"フェ", @"p\ e"}, + {"フャ", "p\\' a"}, + {"フィ", "p\\' i"}, + {"フュ", "p\\' M"}, + {"フェ", "p\\ e"}, {"ミャ", "m' a"}, {"ミュ", "m' M"}, {"ミェ", "m' e"}, @@ -311,8 +326,8 @@ namespace Boare.Lib.Vsq { {"ピュ", "p' M"}, {"ピェ", "p' e"}, {"ピョ", "p' o"}, - {"ファ", @"p\ a"}, - {"フォ", @"p\ o"}, + {"ファ", "p\\ a"}, + {"フォ", "p\\ o"}, {"テャ", "t' a"}, {"ティ", "t' i"}, {"テュ", "t' M"}, @@ -452,7 +467,7 @@ namespace Boare.Lib.Vsq { {"chi", "tS i"}, {"chu", "tS M"}, {"cho", "tS o"}, - {"fu", @"p\ M"}, + {"fu", "p\\ M"}, {"ja", "dZ a"}, {"ji", "dZ i"}, {"ju", "dZ M"}, @@ -465,8 +480,8 @@ namespace Boare.Lib.Vsq { if ( !s_initialized ) { loadDictionary(); } - if ( 0 <= index && index < s_table.Count ) { - return s_table[index]; + if ( 0 <= index && index < s_table.size() ) { + return s_table.get( index ); } else { return null; } @@ -474,64 +489,65 @@ namespace Boare.Lib.Vsq { public static void loadDictionary() { #if DEBUG - Console.WriteLine( "SymbolTable.LoadDictionary()" ); + PortUtil.println( "SymbolTable.LoadDictionary()" ); #endif s_default_jp = new SymbolTable( "DEFAULT_JP", _KEY_JP, true ); - s_table.Clear(); - s_table.Add( 0, s_default_jp ); + s_table.clear(); + s_table.put( 0, s_default_jp ); int count = 0; // 辞書フォルダからの読込み - String editor_path = VocaloSysUtil.getEditorPath2(); + String editor_path = VocaloSysUtil.getEditorPath( SynthesizerType.VOCALOID2 ); if ( editor_path != "" ) { - String path = Path.Combine( Path.GetDirectoryName( editor_path ), "UDIC" ); - if ( !Directory.Exists( path ) ) { + String path = PortUtil.combinePath( PortUtil.getDirectoryName( editor_path ), "UDIC" ); + if ( !PortUtil.isDirectoryExists( path ) ) { return; } - String[] files = Directory.GetFiles( path, "*.udc" ); + String[] files = PortUtil.listFiles( path, "*.udc" ); for ( int i = 0; i < files.Length; i++ ) { - files[i] = Path.GetFileName( files[i] ); + files[i] = PortUtil.getFileName( files[i] ); #if DEBUG - Console.WriteLine( " files[i]=" + files[i] ); + PortUtil.println( " files[i]=" + files[i] ); #endif count++; - String dict = Path.Combine( path, files[i] ); - s_table.Add( count, new SymbolTable( dict, true, false ) ); + String dict = PortUtil.combinePath( path, files[i] ); + s_table.put( count, new SymbolTable( dict, true, false ) ); } } // 起動ディレクトリ - String path2 = Path.Combine( Application.StartupPath, "udic" ); - if ( Directory.Exists( path2 ) ) { - String[] files2 = Directory.GetFiles( path2, "*.eudc" ); + String path2 = PortUtil.combinePath( PortUtil.getApplicationStartupPath(), "udic" ); + if ( PortUtil.isDirectoryExists( path2 ) ) { + String[] files2 = PortUtil.listFiles( path2, "*.eudc" ); for ( int i = 0; i < files2.Length; i++ ) { - files2[i] = Path.GetFileName( files2[i] ); + files2[i] = PortUtil.getFileName( files2[i] ); #if DEBUG - Console.WriteLine( " files2[i]=" + files2[i] ); + PortUtil.println( " files2[i]=" + files2[i] ); #endif count++; - String dict = Path.Combine( path2, files2[i] ); - s_table.Add( count, new SymbolTable( dict, false, false ) ); + String dict = PortUtil.combinePath( path2, files2[i] ); + s_table.put( count, new SymbolTable( dict, false, false ) ); } } s_initialized = true; } - public static boolean attatch( String phrase, out String result ) { + public static boolean attatch( String phrase, ByRef result ) { #if DEBUG - Console.WriteLine( "SymbolTable.Attatch" ); - Console.WriteLine( " phrase=" + phrase ); + PortUtil.println( "SymbolTable.Attatch" ); + PortUtil.println( " phrase=" + phrase ); #endif - for ( int i = 0; i < s_table.Keys.Count; i++ ) { - int key = s_table.Keys[i]; - if ( s_table[key].isEnabled() ) { - if ( s_table[key].attatchImp( phrase, out result ) ) { + for ( Iterator itr = s_table.keySet().iterator(); itr.hasNext(); ) { + int key = (Integer)itr.next(); + SymbolTable table = s_table.get( key ); + if ( table.isEnabled() ) { + if ( table.attatchImp( phrase, result ) ) { return true; } } } - result = "a"; + result.value = "a"; return false; } @@ -539,27 +555,31 @@ namespace Boare.Lib.Vsq { if ( !s_initialized ) { loadDictionary(); } - return s_table.Count; + return s_table.size(); } - public static void changeOrder( KeyValuePair[] list ) { + public static void changeOrder( Vector> list ) { #if DEBUG - Console.WriteLine( "SymbolTable.Sort()" ); + PortUtil.println( "SymbolTable.Sort()" ); #endif - SortedList buff = new SortedList(); - foreach ( int key in s_table.Keys ) { - buff.Add( key, (SymbolTable)s_table[key].Clone() ); + TreeMap buff = new TreeMap(); + for ( Iterator itr = s_table.keySet().iterator(); itr.hasNext(); ) { + int key = (Integer)itr.next(); + buff.put( key, (SymbolTable)s_table.get( key ).clone() ); } - s_table.Clear(); - for ( int i = 0; i < list.Length; i++ ) { + s_table.clear(); + int count = list.size(); + for ( int i = 0; i < count; i++ ) { + ValuePair itemi = list.get( i ); #if DEBUG - Console.WriteLine( " list[i]=" + list[i].Key + "," + list[i].Value ); + PortUtil.println( " list[i]=" + itemi.getKey() + "," + itemi.getValue() ); #endif - for ( int j = 0; j < buff.Keys.Count; j++ ) { - int key = buff.Keys[j]; - if ( buff[key].getName().Equals( list[i].Key ) ) { - buff[key].setEnabled( list[i].Value ); - s_table.Add( i, buff[key] ); + for ( Iterator itr = buff.keySet().iterator(); itr.hasNext(); ) { + int key = (Integer)itr.next(); + SymbolTable table = buff.get( key ); + if ( table.getName().Equals( itemi.getKey() ) ) { + table.setEnabled( itemi.getValue() ); + s_table.put( i, table ); break; } } @@ -567,10 +587,16 @@ namespace Boare.Lib.Vsq { } #endregion +#if !JAVA public object Clone() { + return clone(); + } +#endif + + public Object clone() { SymbolTable ret = new SymbolTable(); ret.m_dict = new TreeMap(); - for ( Iterator itr = m_dict.keySet().iterator(); itr.hasNext(); ){ + for ( Iterator itr = m_dict.keySet().iterator(); itr.hasNext(); ) { String key = (String)itr.next(); ret.m_dict.put( key, m_dict.get( key ) ); } @@ -589,91 +615,96 @@ namespace Boare.Lib.Vsq { public boolean isEnabled() { return m_enabled; } - - public void setEnabled( boolean value ){ + + public void setEnabled( boolean value ) { m_enabled = value; } public SymbolTable( String path, boolean is_udc_mode, boolean enabled ) { m_dict = new TreeMap(); m_enabled = enabled; - if ( !File.Exists( path ) ) { + if ( !PortUtil.isFileExists( path ) ) { return; } - m_name = Path.GetFileName( path ); - cp932reader sr1 = null; - StreamReader sr2 = null; + m_name = PortUtil.getFileName( path ); + BufferedReader sr = null; try { if ( is_udc_mode ) { - sr1 = new cp932reader( path ); - if ( sr1 == null ) { + sr = new BufferedReader( new InputStreamReader( new FileInputStream( path ), "Shift_JIS" ) ); + if ( sr == null ) { return; } } else { - sr2 = new StreamReader( path, Encoding.UTF8 ); - if ( sr2 == null ) { + sr = new BufferedReader( new InputStreamReader( new FileInputStream( path ), "UTF8" ) ); + if ( sr == null ) { return; } } String line; - int peek = (is_udc_mode) ? sr1.Peek() : sr2.Peek(); - while ( peek >= 0 ) { - line = (is_udc_mode) ? sr1.ReadLine() : sr2.ReadLine(); + while ( sr.ready() ) { + line = sr.readLine(); if ( !line.StartsWith( "//" ) ) { - String[] spl = line.Split( "\t".ToCharArray(), 2, StringSplitOptions.RemoveEmptyEntries ); + String[] spl = PortUtil.splitString( line, new String[] { "\t" }, 2, true ); if ( spl.Length >= 2 ) { if ( m_dict.containsKey( spl[0] ) ) { - bocoree.debug.push_log( "SymbolTable..ctor" ); - bocoree.debug.push_log( " dictionary already contains key: " + spl[0] ); + PortUtil.println( "SymbolTable..ctor" ); + PortUtil.println( " dictionary already contains key: " + spl[0] ); } else { m_dict.put( spl[0], spl[1] ); } } } - peek = (is_udc_mode) ? sr1.Peek() : sr2.Peek(); } } catch ( Exception ex ) { - bocoree.debug.push_log( "SymbolTable..ctor" ); - bocoree.debug.push_log( " " + ex ); + PortUtil.println( "SymbolTable..ctor" ); + PortUtil.println( " " + ex ); } finally { - if ( sr1 != null ) { - sr1.Close(); - } - if ( sr2 != null ) { - sr2.Close(); + if ( sr != null ) { + try { + sr.close(); + } catch ( Exception ex2 ) { + } } } } - private boolean attatchImp( String phrase, out String result ) { + private boolean attatchImp( String phrase, ByRef result ) { String s = phrase.ToLower(); if ( m_dict.containsKey( s ) ) { - result = m_dict.get( s ); + result.value = m_dict.get( s ); return true; } else { - result = "a"; + result.value = "a"; return false; } } +#if JAVA + private SymbolTable( String name, String[][] key, boolean enabled ){ +#else private SymbolTable( String name, String[,] key, boolean enabled ) { -#if DEBUG - Console.WriteLine( "SymolTable.ctor(String,String[,])" ); - Console.WriteLine( " key.GetLength(0)=" + key.GetLength( 0 ) ); #endif m_enabled = enabled; m_name = name; m_dict = new TreeMap(); +#if JAVA + for( int i = 0; i < key.length; i++ ){ + if( m_dict.containsKey( key[i][0] ) ){ + }else{ + m_dict.put( key[i][0], key[i][1] ); + } + } +#else for ( int i = 0; i < key.GetLength( 0 ); i++ ) { if ( m_dict.containsKey( key[i, 0] ) ) { -#if DEBUG - throw new ApplicationException( "dictionary already contains key: " + key[i, 0] ); -#endif } else { m_dict.put( key[i, 0], key[i, 1] ); } } +#endif } } +#if !JAVA } +#endif diff --git a/trunk/Boare.Lib.Vsq/SynthesizerType.cs b/trunk/Boare.Lib.Vsq/SynthesizerType.cs new file mode 100644 index 0000000..256a2cc --- /dev/null +++ b/trunk/Boare.Lib.Vsq/SynthesizerType.cs @@ -0,0 +1,27 @@ +/* + * SynthesizerType.cs + * Copyright (c) 2009 kbinani + * + * This file is part of Boare.Cadencii. + * + * Boare.Cadencii is free software; you can redistribute it and/or + * modify it under the terms of the GPLv3 License. + * + * Boare.Cadencii 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. + */ +#if JAVA +package org.kbinani.vsq; +#else +namespace Boare.Lib.Vsq { +#endif + + public enum SynthesizerType { + VOCALOID1, + VOCALOID2, + } + +#if !JAVA +} +#endif diff --git a/trunk/Boare.Lib.Vsq/TempoTableEntry.cs b/trunk/Boare.Lib.Vsq/TempoTableEntry.cs index be6f172..0630aef 100644 --- a/trunk/Boare.Lib.Vsq/TempoTableEntry.cs +++ b/trunk/Boare.Lib.Vsq/TempoTableEntry.cs @@ -11,152 +11,37 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */ -using System; -using System.Collections.Generic; +#if JAVA +package org.kbinani.vsq; -using bocoree; +import java.io.*; +#else +using System; namespace Boare.Lib.Vsq { - using boolean = System.Boolean; +#endif - public class TempoTable : ICloneable { - private struct TempoTableEntry : IComparable { - public int Clock; - public int Tempo; - public double Time; - - public TempoTableEntry( int clock, int tempo, double time ) { - Clock = clock; - Tempo = tempo; - Time = time; - } - - public int CompareTo( TempoTableEntry item ) { - return Clock - item.Clock; - } - } - - private Vector m_tempo_table; - private int m_base_tempo; - private int m_tpq; - - private TempoTable() { - } - - public TempoTable( int base_tempo, int clock_per_quoter ) { - m_base_tempo = base_tempo; - m_tpq = clock_per_quoter; - m_tempo_table = new Vector(); - m_tempo_table.add( new TempoTableEntry( 0, base_tempo, 0.0 ) ); - } - - public object Clone() { - TempoTable ret = new TempoTable(); - ret.m_base_tempo = m_base_tempo; - ret.m_tpq = m_tpq; - ret.m_tempo_table = new Vector(); - for ( int i = 0; i < m_tempo_table.size(); i++ ) { - ret.m_tempo_table.add( m_tempo_table.get( i ) ); - } - ret.update(); - return ret; - } - - public void add( int clock, int tempo ) { - boolean found = false; - for ( int i = 0; i < m_tempo_table.size(); i++ ) { - if ( m_tempo_table.get( i ).Clock == clock ) { - found = true; - m_tempo_table.set( i, new TempoTableEntry( clock, tempo, 0.0 ) ); - break; - } - } - if ( !found ) { - m_tempo_table.add( new TempoTableEntry( clock, tempo, 0.0 ) ); - } - Collections.sort( m_tempo_table ); - update(); - } - - public void clear( int base_tempo ) { - m_tempo_table.clear(); - m_tempo_table.add( new TempoTableEntry( 0, base_tempo, 0.0 ) ); - } - - private void update() { - for ( int i = 0; i < m_tempo_table.size(); i++ ) { - long sum = 0; - for ( int k = 0; k < i; k++ ) { - sum += (m_tempo_table.get( k ).Tempo * (m_tempo_table.get( k + 1 ).Clock - m_tempo_table.get( k ).Clock)); - } - double time = sum / (m_tpq * 1e6); - m_tempo_table.set( i, new TempoTableEntry( m_tempo_table.get( i ).Clock, m_tempo_table.get( i ).Tempo, time ) ); - } - } - - /// - /// 指定した時刻における、クロックを取得します - /// - /// - /// - public double getClockFromSec( double time ) { - // timeにおけるテンポを取得 - int tempo = m_base_tempo; - double base_clock = 0; - double base_time = 0f; - if ( m_tempo_table.size() == 0 ) { - tempo = m_base_tempo; - base_clock = 0; - base_time = 0f; - } else if ( m_tempo_table.size() == 1 ) { - tempo = m_tempo_table.get( 0 ).Tempo; - base_clock = m_tempo_table.get( 0 ).Clock; - base_time = m_tempo_table.get( 0 ).Time; - } else { - for ( int i = m_tempo_table.size() - 1; i >= 0; i-- ) { - if ( m_tempo_table.get( i ).Time < time ) { - return m_tempo_table.get( i ).Clock + (time - m_tempo_table.get( i ).Time) * m_tpq * 1000000.0 / m_tempo_table.get( i ).Tempo; - } - } - } - double dt = time - base_time; - return base_clock + dt * m_tpq * 1000000.0 / (double)tempo; - } - - /// - /// 指定したクロックにおける、clock=0からの演奏経過時間(sec)を取得します - /// - /// - /// - public double getSecFromClock( int clock ) { - for ( int i = m_tempo_table.size() - 1; i >= 0; i-- ) { - if ( m_tempo_table.get( i ).Clock < clock ) { - double init = m_tempo_table.get( i ).Time; - int dclock = clock - m_tempo_table.get( i ).Clock; - double sec_per_clock1 = m_tempo_table.get( i ).Tempo * 1e-6 / 480.0; - return init + dclock * sec_per_clock1; - } - } - double sec_per_clock = m_base_tempo * 1e-6 / 480.0; - return clock * sec_per_clock; - } - - public int getBaseTempo() { - return m_base_tempo; - } - } - +#if JAVA + public class TempoTableEntry implements Comparable, Cloneable, Serializable { +#else [Serializable] public class TempoTableEntry : IComparable, ICloneable { +#endif public int Clock; public int Tempo; public double Time; - public object Clone() { + public Object clone() { return new TempoTableEntry( Clock, Tempo, Time ); } +#if !JAVA + public object Clone() { + return clone(); + } +#endif + public TempoTableEntry( int clock, int _tempo, double _time ) { this.Clock = clock; this.Tempo = _tempo; @@ -166,10 +51,16 @@ namespace Boare.Lib.Vsq { public TempoTableEntry() { } - public int CompareTo( TempoTableEntry entry ) { + public int compareTo( TempoTableEntry entry ) { return this.Clock - entry.Clock; } +#if !JAVA + public int CompareTo( TempoTableEntry entry ) { + return compareTo( entry ); + } +#endif + public boolean Equals( TempoTableEntry entry ) { if ( this.Clock == entry.Clock ) { return true; @@ -179,4 +70,6 @@ namespace Boare.Lib.Vsq { } } +#if !JAVA } +#endif diff --git a/trunk/Boare.Lib.Vsq/TextMemoryStream.cs b/trunk/Boare.Lib.Vsq/TextMemoryStream.cs index 0da581b..0106832 100644 --- a/trunk/Boare.Lib.Vsq/TextMemoryStream.cs +++ b/trunk/Boare.Lib.Vsq/TextMemoryStream.cs @@ -11,16 +11,26 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */ -using System; -using System.IO; -using System.Text; -using System.Collections.Generic; +#if JAVA +package org.kbinani.vsq; +import java.util.*; +import java.io.*; +import org.kbinani.*; +#else +using System; using bocoree; +using bocoree.java.util; +using bocoree.java.io; namespace Boare.Lib.Vsq { +#endif - public class TextMemoryStream : IDisposable { +#if JAVA + public class TextMemoryStream implements ITextWriter { +#else + public class TextMemoryStream : IDisposable, ITextWriter { +#endif private static readonly String NL = (char)0x0d + "" + (char)0x0a; private Vector m_lines; @@ -32,16 +42,26 @@ namespace Boare.Lib.Vsq { m_index = 0; } - public TextMemoryStream( String path, Encoding encoding ) { + public TextMemoryStream( String path, String encoding ) { m_lines = new Vector(); m_index = 0; - if ( File.Exists( path ) ) { - using ( StreamReader sr = new StreamReader( path, encoding ) ) { - while ( sr.Peek() >= 0 ) { - String line = sr.ReadLine(); + if ( PortUtil.isFileExists( path ) ) { + BufferedReader sr = null; + try { + sr = new BufferedReader( new InputStreamReader( new FileInputStream( path ), encoding ) ); + while ( sr.ready() ) { + String line = sr.readLine(); m_lines.add( line ); m_index++; } + } catch ( Exception ex ) { + } finally { + if ( sr != null ) { + try { + sr.close(); + } catch ( Exception ex2 ) { + } + } } } } @@ -54,15 +74,23 @@ namespace Boare.Lib.Vsq { appendString( value + NL ); } - private void appendString( String value ) { - String[] lines = value.Split( new String[] { NL }, StringSplitOptions.None ); - Vector lines2 = new Vector(); - for ( int i = 0; i < lines.Length; i++ ) { - String[] spl = lines[i].Split( (char)0x0d, (char)0x0a ); - for ( int j = 0; j < spl.Length; j++ ) { - lines2.add( spl[j] ); + private static Vector splitLine( String line ) { + Vector ret = new Vector(); + String[] spl_0x0d_0x0a = PortUtil.splitString( line, new String[] { NL }, false ); + for ( int i = 0; i < spl_0x0d_0x0a.Length; i++ ) { + String[] spl_0x0d = PortUtil.splitString( spl_0x0d_0x0a[i], (char)0x0d ); + for ( int j = 0; j < spl_0x0d.Length; j++ ) { + String[] spl_0x0a = PortUtil.splitString( spl_0x0d[j], (char)0x0a ); + for ( int k = 0; k < spl_0x0a.Length; k++ ) { + ret.add( spl_0x0a[k] ); + } } } + return ret; + } + + private void appendString( String value ) { + Vector lines2 = splitLine( value ); int count = lines2.size(); if ( count > 0 ) { m_lines.set( m_index, m_lines.get( m_index ) + lines2.get( 0 ) ); @@ -87,7 +115,11 @@ namespace Boare.Lib.Vsq { if ( m_lines.get( m_index ).Equals( "" ) ) { return -1; } else { +#if JAVA + return (int)m_lines.get( m_index ).charAt( 0 ); +#else return (int)m_lines.get( m_index )[0]; +#endif } } else { return -1; @@ -103,4 +135,6 @@ namespace Boare.Lib.Vsq { } } +#if !JAVA } +#endif diff --git a/trunk/Boare.Lib.Vsq/TimeSigTableEntry.cs b/trunk/Boare.Lib.Vsq/TimeSigTableEntry.cs index 61b8468..bf8a42a 100644 --- a/trunk/Boare.Lib.Vsq/TimeSigTableEntry.cs +++ b/trunk/Boare.Lib.Vsq/TimeSigTableEntry.cs @@ -11,14 +11,23 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */ -using System; +#if JAVA +package org.kbinani.vsq; +import java.io.*; +#else +using System; using bocoree; -namespace Boare.Lib.Vsq{ +namespace Boare.Lib.Vsq { +#endif +#if JAVA + public class TimeSigTableEntry implements Comparable, Cloneable, Serializable { +#else [Serializable] public class TimeSigTableEntry : IComparable, ICloneable { +#endif /// /// クロック数 /// @@ -54,13 +63,27 @@ namespace Boare.Lib.Vsq{ return "{Clock=" + Clock + ", Numerator=" + Numerator + ", Denominator=" + Denominator + ", BarCount=" + BarCount + "}"; } - public object Clone() { + public Object clone() { return new TimeSigTableEntry( Clock, Numerator, Denominator, BarCount ); } - public int CompareTo( TimeSigTableEntry item ) { +#if !JAVA + public object Clone() { + return clone(); + } +#endif + + public int compareTo( TimeSigTableEntry item ) { return this.BarCount - item.BarCount; } + +#if !JAVA + public int CompareTo( TimeSigTableEntry item ) { + return compareTo( item ); + } +#endif } +#if !JAVA } +#endif diff --git a/trunk/Boare.Lib.Vsq/Timesig.cs b/trunk/Boare.Lib.Vsq/Timesig.cs new file mode 100644 index 0000000..2e7dd83 --- /dev/null +++ b/trunk/Boare.Lib.Vsq/Timesig.cs @@ -0,0 +1,27 @@ +/* + * Timesig.cs + * Copyright (c) 2009 kbinani + * + * This file is part of Boare.Lib.Vsq. + * + * Boare.Lib.Vsq is free software; you can redistribute it and/or + * modify it under the terms of the BSD License. + * + * Boare.Lib.Vsq 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. + */ +#if JAVA +package org.kbinani.vsq; +#else +namespace Boare.Lib.Vsq { +#endif + + public struct Timesig { + public int numerator; + public int denominator; + } + +#if !JAVA +} +#endif diff --git a/trunk/Boare.Lib.Vsq/TransCodeUtil.cs b/trunk/Boare.Lib.Vsq/TransCodeUtil.cs index f0dbf2a..5cfa00e 100644 --- a/trunk/Boare.Lib.Vsq/TransCodeUtil.cs +++ b/trunk/Boare.Lib.Vsq/TransCodeUtil.cs @@ -1,10 +1,27 @@ -namespace Boare.Lib.Vsq { +/* + * TransCodeUtil.cs + * Copyright (c) 2009 kbinani + * + * This file is part of Boare.Lib.Vsq. + * + * Boare.Lib.Vsq is free software; you can redistribute it and/or + * modify it under the terms of the BSD License. + * + * Boare.Lib.Vsq 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. + */ +#if JAVA +package org.kbinani.vsq; +#else +namespace Boare.Lib.Vsq { +#endif - public static class TransCodeUtil { + public class TransCodeUtil { private static readonly byte[] MAP_L = new byte[] { 0xA, 0xB, 0x8, 0x9, 0xE, 0xF, 0xC, 0xD, 0x2, 0x3, 0x0, 0x1, 0x6, 0x7, 0x4, 0x5 }; private static readonly byte[] MAP_R = new byte[] { 0x1, 0x0, 0x3, 0x2, 0x5, 0x4, 0x7, 0x6, 0x9, 0x8, 0xB, 0xA, 0xD, 0xC, 0xF, 0xE }; - - public static void decodeBytes( ref byte[] dat ) { + + public static void decodeBytes( byte[] dat ) { for ( int i = 0; i < dat.Length; i++ ) { byte M = (byte)(dat[i] >> 4); byte L = (byte)(dat[i] - (M << 4)); @@ -29,4 +46,6 @@ } } -} \ No newline at end of file +#if !JAVA +} +#endif diff --git a/trunk/Boare.Lib.Vsq/UstEnvelope.cs b/trunk/Boare.Lib.Vsq/UstEnvelope.cs index fa31bc3..dd3abcd 100644 --- a/trunk/Boare.Lib.Vsq/UstEnvelope.cs +++ b/trunk/Boare.Lib.Vsq/UstEnvelope.cs @@ -11,14 +11,24 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */ -using System; +#if JAVA +package org.kbinani.vsq; +import java.io.*; +import org.kbinani.*; +#else +using System; using bocoree; namespace Boare.Lib.Vsq { +#endif +#if JAVA + public class UstEnvelope implements Cloneable, Serializable { +#else [Serializable] public class UstEnvelope : ICloneable { +#endif public int p1 = 0; public int p2 = 5; public int p3 = 35; @@ -36,33 +46,45 @@ namespace Boare.Lib.Vsq { public UstEnvelope( String line ) { if ( line.ToLower().StartsWith( "envelope=" ) ) { - String[] spl = line.Split( '=' ); - spl = spl[1].Split( ',' ); + String[] spl = PortUtil.splitString( line, '=' ); + spl = PortUtil.splitString( spl[1], ',' ); if ( spl.Length < 7 ) { return; } //Separator = ""; - p1 = int.Parse( spl[0] ); - p2 = int.Parse( spl[1] ); - p3 = int.Parse( spl[2] ); - v1 = int.Parse( spl[3] ); - v2 = int.Parse( spl[4] ); - v3 = int.Parse( spl[5] ); - v4 = int.Parse( spl[6] ); + p1 = PortUtil.parseInt( spl[0] ); + p2 = PortUtil.parseInt( spl[1] ); + p3 = PortUtil.parseInt( spl[2] ); + v1 = PortUtil.parseInt( spl[3] ); + v2 = PortUtil.parseInt( spl[4] ); + v3 = PortUtil.parseInt( spl[5] ); + v4 = PortUtil.parseInt( spl[6] ); if ( spl.Length == 11 ) { //Separator = "%"; - p4 = int.Parse( spl[8] ); - p5 = int.Parse( spl[9] ); - v5 = int.Parse( spl[10] ); + p4 = PortUtil.parseInt( spl[8] ); + p5 = PortUtil.parseInt( spl[9] ); + v5 = PortUtil.parseInt( spl[10] ); } } } - public object Clone() { - return new UstEnvelope( ToString() ); + public Object clone() { + return new UstEnvelope( toString() ); } - public override String ToString() { +#if !JAVA + public object Clone() { + return clone(); + } +#endif + +#if !JAVA + public override string ToString() { + return toString(); + } +#endif + + public String toString() { String ret = "Envelope=" + p1 + "," + p2 + "," + p3 + "," + v1 + "," + v2 + "," + v3 + "," + v4; ret += ",%," + p4 + "," + p5 + "," + v5; return ret; @@ -70,11 +92,13 @@ namespace Boare.Lib.Vsq { public int getCount() { //if ( Separator == "%" ) { - return 5; + return 5; //} else { - //return 4; + //return 4; //} } } -} \ No newline at end of file +#if !JAVA +} +#endif diff --git a/trunk/Boare.Lib.Vsq/UstEvent.cs b/trunk/Boare.Lib.Vsq/UstEvent.cs index f114fdb..b6bac25 100644 --- a/trunk/Boare.Lib.Vsq/UstEvent.cs +++ b/trunk/Boare.Lib.Vsq/UstEvent.cs @@ -11,17 +11,25 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */ -using System; -using System.IO; -using System.Collections.Generic; -using System.Text; +#if JAVA +package org.kbinani.vsq; +import java.io.*; +import org.kbinani.*; +#else +using System; using bocoree; +using bocoree.java.io; namespace Boare.Lib.Vsq { +#endif +#if JAVA + public class UstEvent implements Cloneable, Serializable { +#else [Serializable] public class UstEvent : ICloneable { +#endif public String Tag; public int Length = 0; public String Lyric = ""; @@ -39,12 +47,20 @@ namespace Boare.Lib.Vsq { public int Moduration = 100; public int Index; - public UstEvent(){ + public UstEvent() { } - public object Clone() { + public int getLength() { + return Length; + } + + public void setLength( int value ) { + Length = value; + } + + public Object clone() { UstEvent ret = new UstEvent(); - ret.Length = Length; + ret.setLength( Length ); ret.Lyric = Lyric; ret.Note = Note; ret.Intensity = Intensity; @@ -57,13 +73,13 @@ namespace Boare.Lib.Vsq { } ret.Tempo = Tempo; if ( Vibrato != null ) { - ret.Vibrato = (UstVibrato)Vibrato.Clone(); + ret.Vibrato = (UstVibrato)Vibrato.clone(); } if ( Portamento != null ) { - ret.Portamento = (UstPortamento)Portamento.Clone(); + ret.Portamento = (UstPortamento)Portamento.clone(); } if ( Envelope != null ) { - ret.Envelope = (UstEnvelope)Envelope.Clone(); + ret.Envelope = (UstEnvelope)Envelope.clone(); } ret.PreUtterance = PreUtterance; ret.VoiceOverlap = VoiceOverlap; @@ -73,57 +89,99 @@ namespace Boare.Lib.Vsq { return ret; } - public void print( StreamWriter sw ) { +#if !JAVA + public object Clone() { + return clone(); + } +#endif + + public void print( BufferedWriter sw ) +#if JAVA + throws IOException +#endif + { if ( this.Index == int.MinValue ) { - sw.WriteLine( "[#PREV]" ); + sw.write( "[#PREV]" ); + sw.newLine(); } else if ( this.Index == int.MaxValue ) { - sw.WriteLine( "[#NEXT]" ); + sw.write( "[#NEXT]" ); + sw.newLine(); } else { - sw.WriteLine( String.Format( "[#{0:d4}]", Index ) ); + sw.write( "[#" + PortUtil.formatDecimal( "0000", Index ) + "]" ); + sw.newLine(); } - sw.WriteLine( "Length=" + Length ); - sw.WriteLine( "Lyric=" + Lyric ); - sw.WriteLine( "NoteNum=" + Note ); + sw.write( "Length=" + Length ); + sw.newLine(); + sw.write( "Lyric=" + Lyric ); + sw.newLine(); + sw.write( "NoteNum=" + Note ); + sw.newLine(); if ( Intensity >= 0 ) { - sw.WriteLine( "Intensity=" + Intensity ); + sw.write( "Intensity=" + Intensity ); + sw.newLine(); } if ( PBType >= 0 && Pitches != null ) { - sw.WriteLine( "PBType=" + PBType ); - sw.Write( "Piches=" ); + sw.write( "PBType=" + PBType ); + sw.newLine(); + sw.write( "Piches=" ); for ( int i = 0; i < Pitches.Length; i++ ) { if ( i == 0 ) { - sw.Write( Pitches[i] ); + sw.write( Pitches[i] + "" ); } else { - sw.Write( "," + Pitches[i] ); + sw.write( "," + Pitches[i] ); } } - sw.WriteLine(); + sw.newLine(); } if ( Tempo > 0 ) { - sw.WriteLine( "Tempo=" + Tempo ); + sw.write( "Tempo=" + Tempo ); + sw.newLine(); } if ( Vibrato != null ) { - sw.WriteLine( Vibrato.ToString() ); + sw.write( Vibrato.ToString() ); + sw.newLine(); } if ( Portamento != null ) { Portamento.print( sw ); } if ( Envelope != null ) { if ( PreUtterance >= 0 ) { - sw.WriteLine( "PreUtterance=" + PreUtterance ); + sw.write( "PreUtterance=" + PreUtterance ); + sw.newLine(); } if ( VoiceOverlap != 0 ) { - sw.WriteLine( "VoiceOverlap=" + VoiceOverlap ); + sw.write( "VoiceOverlap=" + VoiceOverlap ); + sw.newLine(); } - sw.WriteLine( Envelope.ToString() ); + sw.write( Envelope.ToString() ); + sw.newLine(); } if ( Flags != "" ) { - sw.WriteLine( "Flags=" + Flags ); + sw.write( "Flags=" + Flags ); + sw.newLine(); } if ( Moduration >= 0 ) { - sw.WriteLine( "Moduration=" + Moduration ); + sw.write( "Moduration=" + Moduration ); + sw.newLine(); } } + + /*public VsqEvent convertToVsqEvent( int clock, int internal_id ) { + VsqEvent ret = new VsqEvent(); + ret.Clock = clock; + ret.InternalID = internal_id; + ret.UstEvent = (UstEvent)this.clone(); + ret.ID.setLength( Length ); + ByRef phonetic_symbol = new ByRef( "" ); + SymbolTable.attatch( Lyric, phonetic_symbol ); + ret.ID.LyricHandle = new LyricHandle( Lyric, phonetic_symbol.value ); + ret.ID.Note = Note; + ret.ID.Dynamics = Intensity; + ret.ID.type = VsqIDType.Anote; + return ret; + }*/ } +#if !JAVA } +#endif diff --git a/trunk/Boare.Lib.Vsq/UstFile.cs b/trunk/Boare.Lib.Vsq/UstFile.cs index abfbbc3..c9f8638 100644 --- a/trunk/Boare.Lib.Vsq/UstFile.cs +++ b/trunk/Boare.Lib.Vsq/UstFile.cs @@ -1,4 +1,4 @@ -/* +/* * UstFile.cs * Copyright (c) 2009 kbinani, PEX * @@ -11,17 +11,38 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */ +#if JAVA +package org.kbinani.vsq; + +import java.util.*; +import java.io.*; +import org.kbinani.*; +#else using System; -using System.IO; -using System.Collections.Generic; -using System.Text; - using bocoree; +using bocoree.java.util; +using bocoree.java.io; -namespace Boare.Lib.Vsq{ +namespace Boare.Lib.Vsq { + using Float = System.Single; + using boolean = System.Boolean; +#endif +#if JAVA + public class UstFile implements Cloneable { +#else public class UstFile : ICloneable { - public object Tag; +#endif + /// + /// [#PREV]が指定されているUstEventのIndex + /// + public const int PREV_INDEX = int.MinValue; + /// + /// [#NEXT]が指定されているUstEventのIndex + /// + public const int NEXT_INDEX = int.MaxValue; + + public Object Tag; private float m_tempo = 120.00f; private String m_project_name = ""; private String m_voice_dir = ""; @@ -31,23 +52,24 @@ namespace Boare.Lib.Vsq{ private String m_tool2 = ""; private Vector m_tracks = new Vector(); private Vector m_tempo_table; - - public UstFile( String path ){ + + public UstFile( String path ) { + BufferedReader sr = null; try { - cp932reader sr = new cp932reader( path ); + sr = new BufferedReader( new InputStreamReader( new FileInputStream( path ), "Shift_JIS" ) ); #if DEBUG bocoree.debug.push_log( "path=" + path ); bocoree.debug.push_log( "(sr==null)=" + (sr == null) ); #endif - String line = sr.ReadLine(); - if ( line != "[#SETTING]" ) { + String line = sr.readLine(); + if ( !line.Equals( "[#SETTING]" ) ) { throw new Exception( "invalid ust file" ); } UstTrack track = new UstTrack(); int type = 0; //0 => reading "SETTING" section while ( true ) { #if DEBUG - bocoree.debug.push_log( "line=" + line ); + PortUtil.println( "line=" + line ); #endif UstEvent ue = null; if ( type == 1 ) { @@ -57,32 +79,40 @@ namespace Boare.Lib.Vsq{ if ( line.Equals( "[#TRACKEND]" ) ) { break; } else if ( line.ToUpper().Equals( "[#NEXT]" ) ) { - index = int.MaxValue; + index = NEXT_INDEX; } else if ( line.ToUpper().Equals( "[#PREV]" ) ) { - index = int.MinValue; + index = PREV_INDEX; } else { - String s = line.Replace( "[#", "" ).Replace( "#", "" ).Trim(); - int.TryParse( s, out index ); + String s = line.Replace( "[#", "" ).Replace( "]", "" ).Trim(); + try { + index = PortUtil.parseInt( s ); + } catch ( Exception ex ) { +#if DEBUG + PortUtil.println( "UstFile#.ctor; ex=" + ex ); +#endif + } } #if DEBUG bocoree.debug.push_log( "index=" + index ); #endif - line = sr.ReadLine(); // "[#" ̍s + line = sr.readLine(); // "[#" 直下の行 if ( line == null ) { break; } while ( !line.StartsWith( "[#" ) ) { #if DEBUG - Console.WriteLine( "line=" + line ); + PortUtil.println( "line=" + line ); #endif - String[] spl = line.Split( "=".ToCharArray(), 2 ); + String[] spl = PortUtil.splitString( line, new char[] { '=' }, 2 ); if ( type == 0 ) { // reading "SETTING" section if ( spl[0].Equals( "Tempo" ) ) { m_tempo = 125f; float v = 125f; - if ( float.TryParse( spl[1], out v ) ) { + try { + v = PortUtil.parseFloat( spl[1] ); m_tempo = v; + } catch ( Exception ex ) { } } else if ( spl[0].Equals( "ProjectName" ) ) { m_project_name = spl[1]; @@ -100,45 +130,58 @@ namespace Boare.Lib.Vsq{ } else if ( type == 1 ) { // readin event section if ( spl[0].Equals( "Length" ) ) { - ue.Length = 0; + ue.setLength( 0 ); int v = 0; - if ( int.TryParse( spl[1], out v ) ) { - ue.Length = v; + try { + v = PortUtil.parseInt( spl[1] ); + ue.setLength( v ); + } catch ( Exception ex ) { } } else if ( spl[0].Equals( "Lyric" ) ) { ue.Lyric = spl[1]; } else if ( spl[0].Equals( "NoteNum" ) ) { ue.Note = 0; int v = 0; - if ( int.TryParse( spl[1], out v ) ) { + try { + v = PortUtil.parseInt( spl[1] ); ue.Note = v; + } catch ( Exception ex ) { } } else if ( spl[0].Equals( "Intensity" ) ) { ue.Intensity = 64; int v = 64; - if ( int.TryParse( spl[1], out v ) ) { + try { + v = PortUtil.parseInt( spl[1] ); ue.Intensity = v; + } catch ( Exception ex ) { } } else if ( spl[0].Equals( "PBType" ) ) { ue.PBType = 5; int v = 5; - if ( int.TryParse( spl[1], out v ) ) { + try { + v = PortUtil.parseInt( spl[1] ); ue.PBType = v; + } catch ( Exception ex ) { } } else if ( spl[0].Equals( "Piches" ) ) { - String[] spl2 = spl[1].Split( ",".ToCharArray() ); + String[] spl2 = PortUtil.splitString( spl[1], ',' ); float[] t = new float[spl2.Length]; for ( int i = 0; i < spl2.Length; i++ ) { float v = 0; - float.TryParse( spl2[i], out v ); - t[i] = v; + try { + v = PortUtil.parseFloat( spl2[i] ); + t[i] = v; + } catch ( Exception ex ) { + } } ue.Pitches = t; } else if ( spl[0].Equals( "Tempo" ) ) { ue.Tempo = 125f; float v; - if ( float.TryParse( spl[1], out v ) ) { + try { + v = PortUtil.parseFloat( spl[1] ); ue.Tempo = v; + } catch ( Exception ex ) { } } else if ( spl[0].Equals( "VBR" ) ) { ue.Vibrato = new UstVibrato( line ); @@ -159,20 +202,24 @@ namespace Boare.Lib.Vsq{ //VoiceOverlap=6 } else if ( spl[0].Equals( "VoiceOverlap" ) ) { if ( spl[1] != "" ) { - ue.VoiceOverlap = int.Parse( spl[1] ); + ue.VoiceOverlap = PortUtil.parseInt( spl[1] ); } } else if ( spl[0].Equals( "PreUtterance" ) ) { if ( spl[1] != "" ) { - ue.PreUtterance = int.Parse( spl[1] ); + ue.PreUtterance = PortUtil.parseInt( spl[1] ); } } else if ( spl[0].Equals( "Flags" ) ) { ue.Flags = line.Substring( 6 ); + } else { +#if DEBUG + PortUtil.println( "UstFile#.ctor; info: don't know how to process this line; line=" + line ); +#endif } } - if ( sr.Peek() < 0 ) { + if ( !sr.ready() ) { break; } - line = sr.ReadLine(); + line = sr.readLine(); } #if DEBUG bocoree.debug.push_log( "(ue==null)=" + (ue == null) ); @@ -185,16 +232,109 @@ namespace Boare.Lib.Vsq{ } } m_tracks.add( track ); - sr.Close(); updateTempoInfo(); } catch ( Exception ex ) { #if DEBUG bocoree.debug.push_log( "ex=" + ex ); #endif + } finally { + if ( sr != null ) { + try { + sr.close(); + } catch ( Exception ex2 ) { + } + } } } - private UstFile(){ + /// + /// vsqの指定したトラックを元に,トラックを1つだけ持つustを構築します + /// + /// + /// + public UstFile( VsqFile vsq, int track_index ) { + VsqTrack track = vsq.Track.get( track_index ); + + // デフォルトのテンポ + if( vsq.TempoTable.size() <= 0 ){ + m_tempo = 120.0f; + }else{ + m_tempo = (float)(60e6 / (double)vsq.TempoTable.get( 0 ).Tempo); + } + updateTempoInfo(); + + // R用音符のテンプレート + int PBTYPE = 5; + UstEvent template = new UstEvent(); + template.Lyric = "R"; + template.Note = 60; + template.PreUtterance = 0; + template.VoiceOverlap = 0; + template.Intensity = 100; + template.Moduration = 0; + + // 再生秒時をとりあえず無視して,ゲートタイム基準で音符を追加 + UstTrack track_add = new UstTrack(); + int last_clock = 0; + int index = 0; + for( Iterator itr = track.getNoteEventIterator(); itr.hasNext(); ){ + VsqEvent item = (VsqEvent)itr.next(); + if( last_clock < item.Clock ){ + // ゲートタイム差あり,Rを追加 + UstEvent itemust = (UstEvent)template.clone(); + itemust.setLength( item.Clock - last_clock ); + itemust.Index = index; + index++; + track_add.addEvent( itemust ); + } + UstEvent item_add = new UstEvent(); + item_add.setLength( item.ID.getLength() ); + item_add.Lyric = item.ID.LyricHandle.L0.Phrase; + item_add.Note = item.ID.Note; + item_add.Index = index; + item_add.Intensity = item.ID.Dynamics; + item_add.Moduration = item.UstEvent.Moduration; + item_add.PreUtterance = item.UstEvent.PreUtterance; + item_add.VoiceOverlap = item.UstEvent.VoiceOverlap; + index++; + track_add.addEvent( item_add ); + last_clock = item.Clock + item.ID.getLength(); + } + + // 再生秒時を無視して,ピッチベンドを追加 + //VsqBPList pbs = track.getCurve( "pbs" ); + //VsqBPList pit = track.getCurve( "pit" ); + int clock = 0; + for ( Iterator itr = track_add.getNoteEventIterator(); itr.hasNext(); ) { + UstEvent item = (UstEvent)itr.next(); + int clock_begin = clock; + int clock_end = clock + item.getLength(); + Vector pitch = new Vector(); + boolean allzero = true; + for ( int cl = clock_begin; cl <= clock_end; cl += PBTYPE ) { + float pit = (float)track.getPitchAt( cl ); + if ( pit != 0.0 ) { + allzero = false; + } + pitch.add( pit ); + } + if ( !allzero ) { + item.Pitches = PortUtil.convertFloatArray( pitch.toArray( new Float[] { } ) ); + item.PBType = PBTYPE; + } else { + item.PBType = -1; + } + clock += item.getLength(); + } + + // 再生秒時を考慮して,適時テンポを追加 + //TODO: このへん + // throw new NotImplementedException(); + + m_tracks.add( track_add ); + } + + private UstFile() { } public String getProjectName() { @@ -210,7 +350,7 @@ namespace Boare.Lib.Vsq{ for ( int track = 0; track < m_tracks.size(); track++ ) { int count = 0; for ( int i = 0; i < m_tracks.get( track ).getEventCount(); i++ ) { - count += (int)m_tracks.get( track ).getEvent( i ).Length; + count += (int)m_tracks.get( track ).getEvent( i ).getLength(); } max = Math.Max( max, count ); } @@ -230,7 +370,7 @@ namespace Boare.Lib.Vsq{ } /// - /// TempoTable[*].Time̕XV܂ + /// TempoTableの[*].Timeの部分を更新します /// /// public void updateTempoInfo() { @@ -240,8 +380,8 @@ namespace Boare.Lib.Vsq{ } int clock = 0; double time = 0.0; - int last_tempo_clock = 0; //ŌTempolĂCxg̃NbN - float last_tempo = m_tempo; //ŌɑĂe|̒l + int last_tempo_clock = 0; //最後にTempo値が代入されていたイベントのクロック + float last_tempo = m_tempo; //最後に代入されていたテンポの値 for ( int i = 0; i < m_tracks.get( 0 ).getEventCount(); i++ ) { if ( m_tracks.get( 0 ).getEvent( i ).Tempo > 0f ) { time += (clock - last_tempo_clock) / (8.0 * last_tempo); @@ -252,29 +392,23 @@ namespace Boare.Lib.Vsq{ last_tempo = m_tracks.get( 0 ).getEvent( i ).Tempo; last_tempo_clock = clock; } - clock += (int)m_tracks.get( 0 ).getEvent( i ).Length; + clock += (int)m_tracks.get( 0 ).getEvent( i ).getLength(); } -#if DEBUG - using ( StreamWriter sw = new StreamWriter( Path.Combine( System.Windows.Forms.Application.StartupPath, "ust_tempo_info.txt" ) ) ) { - sw.WriteLine( "Clock\tTime\tTempo" ); - for ( int i = 0; i < m_tempo_table.size(); i++ ) { - sw.WriteLine( m_tempo_table.get( i ).Clock + "\t" + m_tempo_table.get( i ).Time + "\t" + m_tempo_table.get( i ).Tempo ); - } - } -#endif } /// - /// w肵NbNɂAclock=0̉toߎ(sec) + /// 指定したクロックにおける、clock=0からの演奏経過時間(sec) /// /// /// public double getSecFromClock( int clock ) { - for ( int i = m_tempo_table.size() - 1; i >= 0; i-- ) { - if ( m_tempo_table.get( i ).Clock < clock ) { - double init = m_tempo_table.get( i ).Time; - int dclock = clock - m_tempo_table.get( i ).Clock; - double sec_per_clock1 = m_tempo_table.get( i ).Tempo * 1e-6 / 480.0; + int c = m_tempo_table.size(); + for ( int i = c - 1; i >= 0; i-- ) { + TempoTableEntry item = m_tempo_table.get( i ); + if ( item.Clock < clock ) { + double init = item.Time; + int dclock = clock - item.Clock; + double sec_per_clock1 = item.Tempo * 1e-6 / 480.0; return init + dclock * sec_per_clock1; } } @@ -283,24 +417,46 @@ namespace Boare.Lib.Vsq{ } public void write( String file ) { - StreamWriter sw = new StreamWriter( file, false, Encoding.GetEncoding( "Shift_JIS" ) ); - sw.WriteLine( "[#SETTING]" ); - sw.WriteLine( "Tempo=" + m_tempo ); - sw.WriteLine( "Tracks=1" ); - sw.WriteLine( "ProjectName=" + m_project_name ); - sw.WriteLine( "VoiceDir=" + m_voice_dir ); - sw.WriteLine( "OutFile=" + m_out_file ); - sw.WriteLine( "CacheDir=" + m_cache_dir ); - sw.WriteLine( "Tool1=" + m_tool1 ); - sw.WriteLine( "Tool2=" + m_tool2 ); - for ( int i = 0; i < m_tracks.get( 0 ).getEventCount(); i++ ) { - m_tracks.get( 0 ).getEvent( i ).print( sw ); + BufferedWriter sw = null; + try { + sw = new BufferedWriter( new OutputStreamWriter( new FileOutputStream( file ), "Shift_JIS" ) ); + sw.write( "[#SETTING]" ); + sw.newLine(); + sw.write( "Tempo=" + m_tempo ); + sw.newLine(); + sw.write( "Tracks=1" ); + sw.newLine(); + sw.write( "ProjectName=" + m_project_name ); + sw.newLine(); + sw.write( "VoiceDir=" + m_voice_dir ); + sw.newLine(); + sw.write( "OutFile=" + m_out_file ); + sw.newLine(); + sw.write( "CacheDir=" + m_cache_dir ); + sw.newLine(); + sw.write( "Tool1=" + m_tool1 ); + sw.newLine(); + sw.write( "Tool2=" + m_tool2 ); + sw.newLine(); + UstTrack target = m_tracks.get( 0 ); + int count = target.getEventCount(); + for ( int i = 0; i < count; i++ ) { + target.getEvent( i ).print( sw ); + } + sw.write( "[#TRACKEND]" ); + sw.newLine(); + } catch ( Exception ex ) { + } finally { + if ( sw != null ) { + try { + sw.close(); + } catch ( Exception ex2 ) { + } + } } - sw.WriteLine( "[#TRACKEND]" ); - sw.Close(); } - public object Clone(){ + public Object clone() { UstFile ret = new UstFile(); ret.m_tempo = m_tempo; ret.m_project_name = m_project_name; @@ -310,14 +466,22 @@ namespace Boare.Lib.Vsq{ ret.m_tool1 = m_tool1; ret.m_tool2 = m_tool2; for ( int i = 0; i < m_tracks.size(); i++ ) { - ret.m_tracks.set( i, (UstTrack)m_tracks.get( i ).Clone() ); + ret.m_tracks.set( i, (UstTrack)m_tracks.get( i ).clone() ); } ret.m_tempo_table = new Vector(); for ( int i = 0; i < m_tempo_table.size(); i++ ) { - ret.m_tempo_table.add( (TempoTableEntry)m_tempo_table.get( i ).Clone() ); + ret.m_tempo_table.add( (TempoTableEntry)m_tempo_table.get( i ).clone() ); } return ret; } + +#if !JAVA + public object Clone() { + return clone(); + } +#endif } +#if !JAVA } +#endif diff --git a/trunk/Boare.Lib.Vsq/UstPortamento.cs b/trunk/Boare.Lib.Vsq/UstPortamento.cs index 5b1ab10..fe517d1 100644 --- a/trunk/Boare.Lib.Vsq/UstPortamento.cs +++ b/trunk/Boare.Lib.Vsq/UstPortamento.cs @@ -11,59 +11,82 @@ * 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.IO; +#if JAVA +package org.kbinani.vsq; +import java.util.*; +import java.io.*; +import org.kbinani.*; +#else +using System; using bocoree; +using bocoree.java.util; +using bocoree.java.io; namespace Boare.Lib.Vsq { +#endif +#if JAVA + public class UstPortamento implements Cloneable, Serializable { +#else [Serializable] public class UstPortamento : ICloneable { +#endif public Vector Points = new Vector(); public int Start; - public void print( StreamWriter sw ) { + public void print( BufferedWriter sw ) +#if JAVA + throws IOException +#endif + { String pbw = ""; String pby = ""; String pbm = ""; - for ( int i = 0; i < Points.size(); i++ ) { + int count = Points.size(); + for ( int i = 0; i < count; i++ ) { String comma = (i == 0 ? "" : ","); pbw += comma + Points.get( i ).Step; pby += comma + Points.get( i ).Value; String type = ""; - switch ( Points.get( i ).Type ) { - case UstPortamentoType.S: - type = ""; - break; - case UstPortamentoType.Linear: - type = "s"; - break; - case UstPortamentoType.R: - type = "r"; - break; - case UstPortamentoType.J: - type = "j"; - break; + UstPortamentoType ut = Points.get( i ).Type; + if ( ut == UstPortamentoType.S ) { + type = ""; + } else if ( ut == UstPortamentoType.Linear ) { + type = "s"; + } else if ( ut == UstPortamentoType.R ) { + type = "r"; + } else if ( ut == UstPortamentoType.J ) { + type = "j"; } pbm += comma + type; } - sw.WriteLine( "PBW=" + pbw ); - sw.WriteLine( "PBS=" + Start ); - sw.WriteLine( "PBY=" + pby ); - sw.WriteLine( "PBM=" + pbm ); + sw.write( "PBW=" + pbw ); + sw.newLine(); + sw.write( "PBS=" + Start ); + sw.newLine(); + sw.write( "PBY=" + pby ); + sw.newLine(); + sw.write( "PBM=" + pbm ); + sw.newLine(); } - public object Clone() { + public Object clone() { UstPortamento ret = new UstPortamento(); - for ( int i = 0; i < Points.size(); i++ ) { + int count = Points.size(); + for ( int i = 0; i < count; i++ ) { ret.Points.add( Points.get( i ) ); } ret.Start = Start; return ret; } +#if !JAVA + public object Clone() { + return clone(); + } +#endif + /* PBW=50,50,46,48,56,50,50,50,50 PBS=-87 @@ -72,20 +95,20 @@ namespace Boare.Lib.Vsq { */ public void ParseLine( String line ) { line = line.ToLower(); - String[] spl = line.Split( '=' ); + String[] spl = PortUtil.splitString( line, '=' ); if ( spl.Length == 0 ) { return; } - String[] values = spl[1].Split( ',' ); + String[] values = PortUtil.splitString( spl[1], ',' ); if ( line.StartsWith( "pbs=" ) ) { - Start = int.Parse( values[0] ); + Start = PortUtil.parseInt( values[0] ); } else if ( line.StartsWith( "pbw=" ) ) { for ( int i = 0; i < values.Length; i++ ) { if ( i >= Points.size() ) { Points.add( new UstPortamentoPoint() ); } UstPortamentoPoint up = Points.get( i ); - up.Step = int.Parse( values[i] ); + up.Step = PortUtil.parseInt( values[i] ); Points.set( i, up ); } } else if ( line.StartsWith( "pby=" ) ) { @@ -94,7 +117,7 @@ namespace Boare.Lib.Vsq { Points.add( new UstPortamentoPoint() ); } UstPortamentoPoint up = Points.get( i ); - up.Value = float.Parse( values[i] ); + up.Value = PortUtil.parseFloat( values[i] ); Points.set( i, up ); } } else if ( line.StartsWith( "pbm=" ) ) { @@ -103,19 +126,15 @@ namespace Boare.Lib.Vsq { Points.add( new UstPortamentoPoint() ); } UstPortamentoPoint up = Points.get( i ); - switch ( values[i].ToLower() ) { - case "s": - up.Type = UstPortamentoType.Linear; - break; - case "r": - up.Type = UstPortamentoType.R; - break; - case "j": - up.Type = UstPortamentoType.J; - break; - default: - up.Type = UstPortamentoType.S; - break; + String search = values[i].ToLower(); + if ( search.Equals( "s" ) ) { + up.Type = UstPortamentoType.Linear; + } else if ( search.Equals( "r" ) ) { + up.Type = UstPortamentoType.R; + } else if ( search.Equals( "j" ) ) { + up.Type = UstPortamentoType.J; + } else { + up.Type = UstPortamentoType.S; } Points.set( i, up ); } @@ -125,29 +144,6 @@ namespace Boare.Lib.Vsq { } } - public struct UstPortamentoPoint { - public int Step; - public float Value; - public UstPortamentoType Type; - } - - public enum UstPortamentoType{ - /// - /// S型.表記は''(空文字) - /// - S, - /// - /// 直線型.表記は's' - /// - Linear, - /// - /// R型.表記は'r' - /// - R, - /// - /// J型.表記は'j' - /// - J, - } - +#if !JAVA } +#endif diff --git a/trunk/Boare.Lib.Vsq/UstPortamentoPoint.cs b/trunk/Boare.Lib.Vsq/UstPortamentoPoint.cs new file mode 100644 index 0000000..17c8622 --- /dev/null +++ b/trunk/Boare.Lib.Vsq/UstPortamentoPoint.cs @@ -0,0 +1,28 @@ +/* + * UstPortamentoPoint.cs + * Copyright (c) 2009 kbinani + * + * This file is part of Boare.Lib.Vsq. + * + * Boare.Lib.Vsq is free software; you can redistribute it and/or + * modify it under the terms of the BSD License. + * + * Boare.Lib.Vsq 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. + */ +#if JAVA +package org.kbinani.vsq; +#else +namespace Boare.Lib.Vsq { +#endif + + public struct UstPortamentoPoint { + public int Step; + public float Value; + public UstPortamentoType Type; + } + +#if !JAVA +} +#endif diff --git a/trunk/Boare.Lib.Vsq/UstPortamentoType.cs b/trunk/Boare.Lib.Vsq/UstPortamentoType.cs new file mode 100644 index 0000000..99dfe39 --- /dev/null +++ b/trunk/Boare.Lib.Vsq/UstPortamentoType.cs @@ -0,0 +1,41 @@ +/* + * UstPortamentoType.cs + * Copyright (c) 2009 kbinani + * + * This file is part of Boare.Lib.Vsq. + * + * Boare.Lib.Vsq is free software; you can redistribute it and/or + * modify it under the terms of the BSD License. + * + * Boare.Lib.Vsq 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. + */ +#if JAVA +package org.kbinani.vsq; +#else +namespace Boare.Lib.Vsq { +#endif + + public enum UstPortamentoType { + /// + /// S型.表記は''(空文字) + /// + S, + /// + /// 直線型.表記は's' + /// + Linear, + /// + /// R型.表記は'r' + /// + R, + /// + /// J型.表記は'j' + /// + J, + } + +#if !JAVA +} +#endif diff --git a/trunk/Boare.Lib.Vsq/UstTrack.cs b/trunk/Boare.Lib.Vsq/UstTrack.cs index 19307e3..682bec6 100644 --- a/trunk/Boare.Lib.Vsq/UstTrack.cs +++ b/trunk/Boare.Lib.Vsq/UstTrack.cs @@ -11,18 +11,27 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */ +#if JAVA +package org.kbinani.vsq; + +import java.util.*; +#else using System; -using System.Collections.Generic; - using bocoree; +using bocoree.java.util; -namespace Boare.Lib.Vsq{ +namespace Boare.Lib.Vsq { +#endif +#if JAVA + public class UstTrack implements Cloneable { +#else public class UstTrack : ICloneable { - public object Tag; +#endif + public Object Tag; private Vector m_events; - - public UstTrack(){ + + public UstTrack() { m_events = new Vector(); } @@ -38,7 +47,7 @@ namespace Boare.Lib.Vsq{ m_events.add( item ); } - public void removeEvent( int index ) { + public void removeEventAt( int index ) { m_events.removeElementAt( index ); } @@ -47,16 +56,29 @@ namespace Boare.Lib.Vsq{ } public Iterator getNoteEventIterator() { +#if JAVA + return m_events.iterator(); +#else return new ListIterator( m_events ); +#endif } - public object Clone() { + public Object clone() { UstTrack ret = new UstTrack(); - for ( int i = 0; i < m_events.size(); i++ ) { - ret.m_events.set( i, (UstEvent)m_events.get( i ).Clone() ); + int c = m_events.size(); + for ( int i = 0; i < c; i++ ) { + ret.m_events.set( i, (UstEvent)m_events.get( i ).clone() ); } return ret; } + +#if !JAVA + public object Clone() { + return clone(); + } +#endif } +#if !JAVA } +#endif diff --git a/trunk/Boare.Lib.Vsq/UstVibrato.cs b/trunk/Boare.Lib.Vsq/UstVibrato.cs index f02a10f..6365cc7 100644 --- a/trunk/Boare.Lib.Vsq/UstVibrato.cs +++ b/trunk/Boare.Lib.Vsq/UstVibrato.cs @@ -11,14 +11,24 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */ -using System; +#if JAVA +package org.kbinani.vsq; +import java.io.*; +import org.kbinani.*; +#else +using System; using bocoree; namespace Boare.Lib.Vsq { +#endif +#if JAVA + public class UstVibrato implements Cloneable, Serializable { +#else [Serializable] public class UstVibrato : ICloneable { +#endif /// /// 音符の長さに対する、パーセントで表したビブラートの長さ。 /// @@ -51,18 +61,18 @@ namespace Boare.Lib.Vsq { public UstVibrato( String line ) { if ( line.ToLower().StartsWith( "vbr=" ) ) { - String[] spl = line.Split( '=' ); - spl = spl[1].Split( ',' ); + String[] spl = PortUtil.splitString( line, '=' ); + spl = PortUtil.splitString( spl[1], ',' ); //VBR=65,180,70,20.0,17.6,82.8,49.8,100 if ( spl.Length >= 8 ) { - Length = float.Parse( spl[0] ); - Period = float.Parse( spl[1] ); - Depth = float.Parse( spl[2] ); - In = float.Parse( spl[3] ); - Out = float.Parse( spl[4] ); - Phase = float.Parse( spl[5] ); - Shift = float.Parse( spl[6] ); - Unknown = float.Parse( spl[7] ); + Length = PortUtil.parseFloat( spl[0] ); + Period = PortUtil.parseFloat( spl[1] ); + Depth = PortUtil.parseFloat( spl[2] ); + In = PortUtil.parseFloat( spl[3] ); + Out = PortUtil.parseFloat( spl[4] ); + Phase = PortUtil.parseFloat( spl[5] ); + Shift = PortUtil.parseFloat( spl[6] ); + Unknown = PortUtil.parseFloat( spl[7] ); } } } @@ -70,13 +80,27 @@ namespace Boare.Lib.Vsq { public UstVibrato() { } - public override String ToString() { + public float getLength() { + return Length; + } + + public void setLength( float value ) { + Length = value; + } + +#if !JAVA + public override string ToString() { + return toString(); + } +#endif + + public String toString() { return "VBR=" + Length + "," + Period + "," + Depth + "," + In + "," + Out + "," + Phase + "," + Shift + "," + Unknown; } - public object Clone() { + public Object clone() { UstVibrato ret = new UstVibrato(); - ret.Length = Length; + ret.setLength( Length ); ret.Period = Period; ret.Depth = Depth; ret.In = In; @@ -86,6 +110,14 @@ namespace Boare.Lib.Vsq { ret.Unknown = Unknown; return ret; } + +#if !JAVA + public object Clone() { + return clone(); + } +#endif } +#if !JAVA } +#endif diff --git a/trunk/Boare.Lib.Vsq/VibratoBPList.cs b/trunk/Boare.Lib.Vsq/VibratoBPList.cs index 371bd9d..4d2f290 100644 --- a/trunk/Boare.Lib.Vsq/VibratoBPList.cs +++ b/trunk/Boare.Lib.Vsq/VibratoBPList.cs @@ -11,27 +11,50 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */ -using System; -using System.Collections.Generic; +#if JAVA +package org.kbinani.vsq; +import java.util.*; +import java.io.*; +import org.kbinani.*; +#else +using System; using bocoree; +using bocoree.java.util; namespace Boare.Lib.Vsq { +#endif +#if JAVA + public class VibratoBPList implements Cloneable, Serializable { +#else [Serializable] public class VibratoBPList : ICloneable { +#endif private Vector m_list; public VibratoBPList() { m_list = new Vector(); } - public VibratoBPList( float[] x, int[] y ){ - if ( x == null ){ + public VibratoBPList( float[] x, int[] y ) +#if JAVA + throws NullPointerException +#endif + { + if ( x == null ) { +#if JAVA + throw new NullPointerException( "x" ); +#else throw new ArgumentNullException( "x" ); +#endif } - if ( y == null ){ + if ( y == null ) { +#if JAVA + throw new NullPointerException( "y" ); +#else throw new ArgumentNullException( "y" ); +#endif } int len = Math.Min( x.Length, y.Length ); m_list = new Vector( len ); @@ -46,7 +69,8 @@ namespace Boare.Lib.Vsq { return default_value; } int index = -1; - for ( int i = 0; i < m_list.size(); i++ ) { + int size = m_list.size(); + for ( int i = 0; i < size; i++ ) { if ( x < m_list.get( i ).X ) { break; } @@ -59,7 +83,7 @@ namespace Boare.Lib.Vsq { } } - public object Clone() { + public Object clone() { VibratoBPList ret = new VibratoBPList(); for ( int i = 0; i < m_list.size(); i++ ) { ret.m_list.add( new VibratoBPPair( m_list.get( i ).X, m_list.get( i ).Y ) ); @@ -67,6 +91,12 @@ namespace Boare.Lib.Vsq { return ret; } +#if !JAVA + public object Clone() { + return clone(); + } +#endif + public int getCount() { return m_list.size(); } @@ -79,29 +109,41 @@ namespace Boare.Lib.Vsq { m_list.set( index, value ); } +#if !JAVA /// /// XMLシリアライズ用 /// public String Data { get { - String ret = ""; - for ( int i = 0; i < m_list.size(); i++ ) { - ret += (i == 0 ? "" : ",") + m_list.get( i ).X + "=" + m_list.get( i ).Y; - } - return ret; + return getData(); } set { - m_list.clear(); - String[] spl = value.Split( ',' ); - for ( int i = 0; i < spl.Length; i++ ) { - String[] spl2 = spl[i].Split( '=' ); - if ( spl2.Length < 2 ) { - continue; - } - m_list.add( new VibratoBPPair( float.Parse( spl2[0] ), int.Parse( spl2[1] ) ) ); + setData( value ); + } + } +#endif + + public String getData() { + String ret = ""; + for ( int i = 0; i < m_list.size(); i++ ) { + ret += (i == 0 ? "" : ",") + m_list.get( i ).X + "=" + m_list.get( i ).Y; + } + return ret; + } + + public void setData( String value ) { + m_list.clear(); + String[] spl = PortUtil.splitString( value, ',' ); + for ( int i = 0; i < spl.Length; i++ ) { + String[] spl2 = PortUtil.splitString( spl[i], '=' ); + if ( spl2.Length < 2 ) { + continue; } + m_list.add( new VibratoBPPair( PortUtil.parseFloat( spl2[0] ), PortUtil.parseInt( spl2[1] ) ) ); } } } -} \ No newline at end of file +#if !JAVA +} +#endif diff --git a/trunk/Boare.Lib.Vsq/VibratoBPPair.cs b/trunk/Boare.Lib.Vsq/VibratoBPPair.cs index 8262ee4..1ec3f8a 100644 --- a/trunk/Boare.Lib.Vsq/VibratoBPPair.cs +++ b/trunk/Boare.Lib.Vsq/VibratoBPPair.cs @@ -11,12 +11,22 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */ +#if JAVA +package org.kbinani.vsq; + +import java.io.*; +#else using System; namespace Boare.Lib.Vsq { +#endif +#if JAVA + public class VibratoBPPair implements Comparable, Serializable { +#else [Serializable] public class VibratoBPPair : IComparable { +#endif public float X; public int Y; @@ -28,7 +38,7 @@ namespace Boare.Lib.Vsq { Y = y; } - public int CompareTo( VibratoBPPair item ) { + public int compareTo( VibratoBPPair item ) { float v = X - item.X; if ( v > 0.0f ) { return 1; @@ -37,6 +47,14 @@ namespace Boare.Lib.Vsq { } return 0; } + +#if !JAVA + public int CompareTo( VibratoBPPair item ) { + return compareTo( item ); + } +#endif } +#if !JAVA } +#endif diff --git a/trunk/Boare.Lib.Vsq/VibratoConfig.cs b/trunk/Boare.Lib.Vsq/VibratoConfig.cs index d2e4b15..6ed794a 100644 --- a/trunk/Boare.Lib.Vsq/VibratoConfig.cs +++ b/trunk/Boare.Lib.Vsq/VibratoConfig.cs @@ -11,12 +11,18 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */ -using System; -using System.IO; +#if JAVA +package org.kbinani.vsq; +import java.io.*; +import org.kbinani.*; +#else +using System; using bocoree; +using bocoree.java.io; namespace Boare.Lib.Vsq { +#endif public class VibratoConfig { public int number; @@ -25,12 +31,22 @@ namespace Boare.Lib.Vsq { public String vendor; public VibratoHandle contents; + public override String ToString() { + if ( contents == null ) { + return base.ToString(); + } else { + return contents.Caption; + } + } + public VibratoConfig() { contents = new VibratoHandle(); } public void parseAic( String aic_file ) { - using ( StreamReader sr = new StreamReader( aic_file ) ) { + BufferedReader sr = null; + try { + sr = new BufferedReader( new FileReader( aic_file ) ); String line; String current_entry = ""; String articulation = ""; @@ -40,7 +56,7 @@ namespace Boare.Lib.Vsq { String rate_bpy = ""; int depth_bpnum = 0; int rate_bpnum = 0; - while ( (line = sr.ReadLine()) != null ) { + while ( (line = sr.readLine()) != null ) { if ( line.StartsWith( "[" ) ) { current_entry = line; continue; @@ -48,7 +64,7 @@ namespace Boare.Lib.Vsq { continue; } - String[] spl = line.Split( new char[] { '=' }, StringSplitOptions.RemoveEmptyEntries ); + String[] spl = PortUtil.splitString( line, new char[] { '=' }, true ); if ( spl.Length < 2 ) { continue; } @@ -61,28 +77,33 @@ namespace Boare.Lib.Vsq { } else if ( current_entry.Equals( "[Parameter]" ) ) { if ( spl[0].Equals( "Length" ) ) { try { - this.contents.Length = int.Parse( spl[1] ); - } catch { } + this.contents.setLength( PortUtil.parseInt( spl[1] ) ); + } catch ( Exception ex0 ) { + } } else if ( spl[0].Equals( "StartDepth" ) ) { try { - this.contents.StartDepth = int.Parse( spl[1] ); - } catch { } + this.contents.StartDepth = PortUtil.parseInt( spl[1] ); + } catch ( Exception ex0 ) { + } } else if ( spl[0].Equals( "DepthBPNum" ) ) { try { - depth_bpnum = int.Parse( spl[1] ); - } catch { } + depth_bpnum = PortUtil.parseInt( spl[1] ); + } catch ( Exception ex0 ) { + } } else if ( spl[0].Equals( "DepthBPX" ) ) { depth_bpx = spl[1]; } else if ( spl[0].Equals( "DepthBPY" ) ) { depth_bpy = spl[1]; } else if ( spl[0].Equals( "StartRate" ) ) { try { - this.contents.StartRate = int.Parse( spl[1] ); - } catch { } + this.contents.StartRate = PortUtil.parseInt( spl[1] ); + } catch ( Exception ex0 ) { + } } else if ( spl[0].Equals( "RateBPNum" ) ) { try { - rate_bpnum = int.Parse( spl[1] ); - } catch { } + rate_bpnum = PortUtil.parseInt( spl[1] ); + } catch ( Exception ex0 ) { + } } else if ( spl[0].Equals( "RateBPX" ) ) { rate_bpx = spl[1]; } else if ( spl[0].Equals( "RateBPY" ) ) { @@ -90,45 +111,57 @@ namespace Boare.Lib.Vsq { } } } - if ( articulation != "Vibrato" ) { + if ( !articulation.Equals( "Vibrato" ) ) { return; } // depth bp - if ( depth_bpnum > 0 && depth_bpx != "" && depth_bpy != "" ) { - String[] bpx = depth_bpx.Split( ',' ); - String[] bpy = depth_bpy.Split( ',' ); + if ( depth_bpnum > 0 && !depth_bpx.Equals( "" ) && !depth_bpy.Equals( "" ) ) { + String[] bpx = PortUtil.splitString( depth_bpx, ',' ); + String[] bpy = PortUtil.splitString( depth_bpy, ',' ); if ( depth_bpnum == bpx.Length && depth_bpnum == bpy.Length ) { float[] x = new float[depth_bpnum]; int[] y = new int[depth_bpnum]; try { for ( int i = 0; i < depth_bpnum; i++ ) { - x[i] = float.Parse( bpx[i] ); - y[i] = int.Parse( bpy[i] ); + x[i] = PortUtil.parseFloat( bpx[i] ); + y[i] = PortUtil.parseInt( bpy[i] ); } this.contents.DepthBP = new VibratoBPList( x, y ); - } catch { } + } catch ( Exception ex0 ) { + } } } // rate bp - if ( rate_bpnum > 0 && rate_bpx != "" && rate_bpy != "" ) { - String[] bpx = rate_bpx.Split( ',' ); - String[] bpy = rate_bpy.Split( ',' ); + if ( rate_bpnum > 0 && !rate_bpx.Equals( "" ) && !rate_bpy.Equals( "" ) ) { + String[] bpx = PortUtil.splitString( rate_bpx, ',' ); + String[] bpy = PortUtil.splitString( rate_bpy, ',' ); if ( rate_bpnum == bpx.Length && rate_bpnum == bpy.Length ) { float[] x = new float[rate_bpnum]; int[] y = new int[rate_bpnum]; try { for ( int i = 0; i < rate_bpnum; i++ ) { - x[i] = float.Parse( bpx[i] ); - y[i] = int.Parse( bpy[i] ); + x[i] = PortUtil.parseFloat( bpx[i] ); + y[i] = PortUtil.parseInt( bpy[i] ); } this.contents.RateBP = new VibratoBPList( x, y ); - } catch { } + } catch ( Exception ex0 ) { + } + } + } + } catch ( Exception ex ) { + } finally { + if ( sr != null ) { + try { + sr.close(); + } catch ( Exception ex2 ) { } } } } } +#if !JAVA } +#endif diff --git a/trunk/Boare.Lib.Vsq/VibratoHandle.cs b/trunk/Boare.Lib.Vsq/VibratoHandle.cs new file mode 100644 index 0000000..2000d57 --- /dev/null +++ b/trunk/Boare.Lib.Vsq/VibratoHandle.cs @@ -0,0 +1,104 @@ +/* + * VibratoHandle.cs + * Copyright (c) 2009 kbinani + * + * This file is part of Boare.Lib.Vsq. + * + * Boare.Lib.Vsq is free software; you can redistribute it and/or + * modify it under the terms of the BSD License. + * + * Boare.Lib.Vsq 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. + */ +#if JAVA +package org.kbinani.vsq; + +import java.io.*; +#else +using System; + +namespace Boare.Lib.Vsq { +#endif + +#if JAVA + public class VibratoHandle implements Cloneable, Serializable { +#else + [Serializable] + public class VibratoHandle : ICloneable { +#endif + public int StartDepth; + public VibratoBPList DepthBP; + public int StartRate; + public VibratoBPList RateBP; + public int Index; + public String IconID = ""; + public String IDS = ""; + public int Original; + public String Caption = ""; + public int Length; + + public VibratoHandle() { + StartRate = 64; + StartDepth = 64; + RateBP = new VibratoBPList(); + DepthBP = new VibratoBPList(); + } + + public int getLength() { + return Length; + } + + public void setLength( int value ) { + Length = value; + } + + public String getDisplayString() { + String s = IDS; + if ( !Caption.Equals( "" ) ) { + s += " (" + Caption + ")"; + } + return s; + } + +#if !JAVA + public object Clone() { + return clone(); + } +#endif + + public Object clone() { + VibratoHandle result = new VibratoHandle(); + result.Index = Index; + result.IconID = IconID; + result.IDS = this.IDS; + result.Original = this.Original; + result.Caption = this.Caption; + result.setLength( Length ); + result.StartDepth = this.StartDepth; + result.DepthBP = (VibratoBPList)DepthBP.clone(); + result.StartRate = this.StartRate; + result.RateBP = (VibratoBPList)RateBP.clone(); + return result; + } + + public VsqHandle castToVsqHandle() { + VsqHandle ret = new VsqHandle(); + ret.m_type = VsqHandleType.Vibrato; + ret.Index = Index; + ret.IconID = IconID; + ret.IDS = IDS; + ret.Original = Original; + ret.Caption = Caption; + ret.setLength( Length ); + ret.StartDepth = StartDepth; + ret.StartRate = StartRate; + ret.DepthBP = (VibratoBPList)DepthBP.clone(); + ret.RateBP = (VibratoBPList)RateBP.clone(); + return ret; + } + } + +#if !JAVA +} +#endif diff --git a/trunk/Boare.Lib.Vsq/VocaloSysUtil.cs b/trunk/Boare.Lib.Vsq/VocaloSysUtil.cs index 5f10f78..237157d 100644 --- a/trunk/Boare.Lib.Vsq/VocaloSysUtil.cs +++ b/trunk/Boare.Lib.Vsq/VocaloSysUtil.cs @@ -11,169 +11,263 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */ +#if JAVA +package org.kbinani.vsq; + +import java.io.*; +import java.util.*; +import org.kbinani.*; +#else using System; -using System.IO; using System.Collections.Generic; using Microsoft.Win32; - using bocoree; +using bocoree.java.util; +using bocoree.java.io; namespace Boare.Lib.Vsq { +#endif - using boolean = Boolean; + public class VocaloSysUtil { + private static TreeMap s_singer_config_sys = new TreeMap(); + private static TreeMap s_exp_config_sys = new TreeMap(); + private static TreeMap s_path_vsti = new TreeMap(); + private static TreeMap s_path_editor = new TreeMap(); - public static class VocaloSysUtil{ - private static SingerConfigSys s_singer_config_sys1; - private static SingerConfigSys s_singer_config_sys2; - private static ExpressionConfigSys s_exp_config_sys1; - private static ExpressionConfigSys s_exp_config_sys2; - private static String s_path_vsti1 = ""; - private static String s_path_vsti2 = ""; - private static String s_path_editor1 = ""; - private static String s_path_editor2 = ""; + private VocaloSysUtil() { + } +#if JAVA + static{ +#else static VocaloSysUtil() { +#endif + ExpressionConfigSys exp_config_sys1 = null; try { Vector dir1 = new Vector(); - RegistryKey key1 = Registry.LocalMachine.OpenSubKey( "SOFTWARE\\VOCALOID", false ); - String path_voicedb1 = ""; - String path_expdb1 = ""; + ByRef path_voicedb1 = new ByRef( "" ); + ByRef path_expdb1 = new ByRef( "" ); Vector installed_singers1 = new Vector(); - if ( key1 != null ) { - String header1 = "HKLM\\SOFTWARE\\VOCALOID"; - print( key1, header1, dir1 ); - key1.Close(); - extract( dir1, - header1, - out s_path_vsti1, - out path_voicedb1, - out path_expdb1, - out s_path_editor1, - installed_singers1 ); + String header1 = "HKLM\\SOFTWARE\\VOCALOID"; + print( "SOFTWARE\\VOCALOID", header1, dir1 ); +#if DEBUG + BufferedWriter sw = null; + try { + sw = new BufferedWriter( new FileWriter( PortUtil.combinePath( System.Windows.Forms.Application.StartupPath, "reg_keys_vocalo1.txt" ) ) ); + foreach ( String s in dir1 ) { + sw.write( s ); + sw.newLine(); + } + } catch ( Exception ex ) { + } finally { + if ( sw != null ) { + try { + sw.close(); + } catch ( Exception ex2 ) { + } + } } - s_singer_config_sys1 = new SingerConfigSys( path_voicedb1, installed_singers1.toArray( new String[] { } ) ); - s_exp_config_sys1 = new ExpressionConfigSys( path_expdb1 ); - }catch( Exception ex ){ - Console.WriteLine( "VocaloSysUtil..cctor; ex=" + ex ); - s_singer_config_sys1 = new SingerConfigSys( "", new String[] { } ); - s_exp_config_sys1 = new ExpressionConfigSys( "" ); - } - - try{ - Vector dir2 = new Vector(); - RegistryKey key2 = Registry.LocalMachine.OpenSubKey( "SOFTWARE\\VOCALOID2", false ); - String path_voicedb2 = ""; - String path_expdb2 = ""; - Vector installed_singers2 = new Vector(); - if ( key2 != null ) { - String header2 = "HKLM\\SOFTWARE\\VOCALOID2"; - print( key2, header2, dir2 ); - key2.Close(); - extract( dir2, - header2, - out s_path_vsti2, - out path_voicedb2, - out path_expdb2, - out s_path_editor2, - installed_singers2 ); +#endif + ByRef path_vsti = new ByRef( "" ); + ByRef path_editor = new ByRef( "" ); + extract( dir1, + header1, + path_vsti, + path_voicedb1, + path_expdb1, + path_editor, + installed_singers1 ); + s_path_vsti.put( SynthesizerType.VOCALOID1, path_vsti.value ); + s_path_editor.put( SynthesizerType.VOCALOID1, path_editor.value ); + SingerConfigSys singer_config_sys = new SingerConfigSys( path_voicedb1.value, installed_singers1.toArray( new String[] { } ) ); + if ( PortUtil.isFileExists( PortUtil.combinePath( path_expdb1.value, "expression.map" ) ) ) { + exp_config_sys1 = new ExpressionConfigSys( path_expdb1.value ); } - s_singer_config_sys2 = new SingerConfigSys( path_voicedb2, installed_singers2.toArray( new String[] { } ) ); - s_exp_config_sys2 = new ExpressionConfigSys( path_expdb2 ); + s_singer_config_sys.put( SynthesizerType.VOCALOID1, singer_config_sys ); } catch ( Exception ex ) { - Console.WriteLine( "VocaloSysUtil..cctor; ex=" + ex ); - s_singer_config_sys2 = new SingerConfigSys( "", new String[] { } ); - s_exp_config_sys2 = new ExpressionConfigSys( "" ); + PortUtil.println( "VocaloSysUtil..cctor; ex=" + ex ); + SingerConfigSys singer_config_sys = new SingerConfigSys( "", new String[] { } ); + exp_config_sys1 = null; + s_singer_config_sys.put( SynthesizerType.VOCALOID1, singer_config_sys ); } + if ( exp_config_sys1 == null ) { + exp_config_sys1 = ExpressionConfigSys.getVocaloid1Default(); + } + s_exp_config_sys.put( SynthesizerType.VOCALOID1, exp_config_sys1 ); + + ExpressionConfigSys exp_config_sys2 = null; + try { + Vector dir2 = new Vector(); + ByRef path_voicedb2 = new ByRef( "" ); + ByRef path_expdb2 = new ByRef( "" ); + Vector installed_singers2 = new Vector(); + String header2 = "HKLM\\SOFTWARE\\VOCALOID2"; + print( "SOFTWARE\\VOCALOID2", header2, dir2 ); +#if DEBUG + BufferedWriter sw = null; + try { + sw = new BufferedWriter( new FileWriter( PortUtil.combinePath( System.Windows.Forms.Application.StartupPath, "reg_keys_vocalo2.txt" ) ) ); + foreach ( String s in dir2 ) { + sw.write( s ); + sw.newLine(); + } + } catch ( Exception ex ) { + } finally { + if ( sw != null ) { + try { + sw.close(); + } catch ( Exception ex2 ) { + } + } + } +#endif + ByRef path_vsti = new ByRef( "" ); + ByRef path_editor = new ByRef( "" ); + extract( dir2, + header2, + path_vsti, + path_voicedb2, + path_expdb2, + path_editor, + installed_singers2 ); + s_path_vsti.put( SynthesizerType.VOCALOID2, path_vsti.value ); + s_path_editor.put( SynthesizerType.VOCALOID2, path_editor.value ); + SingerConfigSys singer_config_sys = new SingerConfigSys( path_voicedb2.value, installed_singers2.toArray( new String[] { } ) ); + if ( PortUtil.isFileExists( PortUtil.combinePath( path_expdb2.value, "expression.map" ) ) ) { + exp_config_sys2 = new ExpressionConfigSys( path_expdb2.value ); + } + s_singer_config_sys.put( SynthesizerType.VOCALOID2, singer_config_sys ); + } catch ( Exception ex ) { + PortUtil.println( "VocaloSysUtil..cctor; ex=" + ex ); + SingerConfigSys singer_config_sys = new SingerConfigSys( "", new String[] { } ); + exp_config_sys2 = null; + s_singer_config_sys.put( SynthesizerType.VOCALOID2, singer_config_sys ); + } + if ( exp_config_sys2 == null ) { + exp_config_sys2 = ExpressionConfigSys.getVocaloid2Default(); + } + s_exp_config_sys.put( SynthesizerType.VOCALOID2, exp_config_sys2 ); +#if DEBUG + SingerConfigSys scs2 = s_singer_config_sys.get( SynthesizerType.VOCALOID2 ); + foreach( SingerConfig sc in scs2.getInstalledSingers() ){ + PortUtil.println( "VocaloSysUtil#.ctor; sc=" + sc.toString() ); + } +#endif } + /// + /// ビブラートのプリセットタイプから,VibratoHandleを作成します + /// + /// + /// + /// + public static VibratoHandle getDefaultVibratoHandle( String icon_id, int vibrato_length, SynthesizerType type ) { + if ( s_exp_config_sys.containsKey( type ) ) { + for ( Iterator itr = s_exp_config_sys.get( type ).vibratoConfigIterator(); itr.hasNext(); ) { + VibratoConfig vconfig = (VibratoConfig)itr.next(); + if ( vconfig.contents.IconID.Equals( icon_id ) ) { + VibratoHandle ret = (VibratoHandle)vconfig.contents.clone(); + ret.setLength( vibrato_length ); + return ret; + } + } + } + VibratoHandle empty = new VibratoHandle(); + empty.IconID = "$04040000"; + return empty; + } + + private static void extract( Vector dir, String header, - out String path_vsti, - out String path_voicedb, - out String path_expdb, - out String path_editor, + ByRef path_vsti, + ByRef path_voicedb, + ByRef path_expdb, + ByRef path_editor, Vector installed_singers ) { Vector application = new Vector(); Vector expression = new Vector(); Vector voice = new Vector(); - path_vsti = ""; - path_expdb = ""; - path_voicedb = ""; - path_editor = ""; - for( Iterator itr = dir.iterator(); itr.hasNext(); ) { + path_vsti.value = ""; + path_expdb.value = ""; + path_voicedb.value = ""; + path_editor.value = ""; + for ( Iterator itr = dir.iterator(); itr.hasNext(); ) { String s = (String)itr.next(); if ( s.StartsWith( header + "\\APPLICATION" ) ) { - application.add( s.Substring( (header + "\\APPLICATION").Length ) ); + application.add( s.Substring( PortUtil.getStringLength( header + "\\APPLICATION" ) ) ); } else if ( s.StartsWith( header + "\\DATABASE\\EXPRESSION" ) ) { - expression.add( s.Substring( (header + "\\DATABASE\\EXPRESSION").Length ) ); + expression.add( s.Substring( PortUtil.getStringLength( header + "\\DATABASE\\EXPRESSION" ) ) ); } else if ( s.StartsWith( header + "\\DATABASE\\VOICE" ) ) { - voice.add( s.Substring( (header + "\\DATABASE\\VOICE\\").Length ) ); + voice.add( s.Substring( PortUtil.getStringLength( header + "\\DATABASE\\VOICE\\" ) ) ); } } // path_vstiを取得 - for( Iterator itr = application.iterator(); itr.hasNext(); ){ + for ( Iterator itr = application.iterator(); itr.hasNext(); ) { String s = (String)itr.next(); - String[] spl = s.Split( '\t' ); - if ( spl.Length >= 3 && spl[1].Equals( "PATH" ) ){ + String[] spl = PortUtil.splitString( s, '\t' ); + if ( spl.Length >= 3 && spl[1].Equals( "PATH" ) ) { if ( spl[2].ToLower().EndsWith( ".dll" ) ) { - path_vsti = spl[2]; + path_vsti.value = spl[2]; } else if ( spl[2].ToLower().EndsWith( ".exe" ) ) { - path_editor = spl[2]; + path_editor.value = spl[2]; } } } // path_vicedbを取得 - Vector voice_ids = new Vector(); + TreeMap install_dirs = new TreeMap(); // 最初はpath_voicedbの取得と、id(BHXXXXXXXXXXXXXXXX)のようなシリアルを取得 - for( Iterator itr = voice.iterator(); itr.hasNext(); ){ + for ( Iterator itr = voice.iterator(); itr.hasNext(); ) { String s = (String)itr.next(); - String[] spl = s.Split( '\t' ); + String[] spl = PortUtil.splitString( s, '\t' ); if ( spl.Length >= 2 ) { if ( spl[0].Equals( "VOICEDIR" ) ) { - path_voicedb = spl[1]; + path_voicedb.value = spl[1]; } else if ( spl.Length >= 3 ) { - String[] spl2 = spl[0].Split( '\\' ); - if ( spl2.Length == 1 ) { - if ( !voice_ids.contains( spl2[0] ) ) { - voice_ids.add( spl2[0] ); + String[] spl2 = PortUtil.splitString( spl[0], '\\' ); + if ( spl2.Length == 1 ){ + if ( !install_dirs.containsKey( spl2[0] ) ) { + String install = ""; + if ( spl[1].Equals( "INSTALLDIR" ) ) { + install = spl[2]; + } + install_dirs.put( spl2[0], install ); + } else { + if ( spl[1].Equals( "INSTALLDIR" ) ) { + install_dirs.put( spl2[0], spl[2] ); + } } } } } } - // 取得したシリアルを元に、installed_singersを取得 - for( Iterator itr = voice_ids.iterator(); itr.hasNext(); ) { - String s = (String)itr.next(); - String install_dir = ""; - for( Iterator itr2 = voice.iterator(); itr2.hasNext(); ){ - String s2 = (String)itr2.next(); - if ( s2.StartsWith( header + "\\" + s + "\t" ) ) { - String[] spl = s2.Split( '\t' ); - if ( spl.Length >= 3 && spl[1].Equals( "INSTALLDIR" ) ) { - install_dir = Path.Combine( spl[2], s ); - break; - } - } + + // installed_singersに追加 + for ( Iterator itr = install_dirs.keySet().iterator(); itr.hasNext(); ) { + String id = (String)itr.next(); + String install = install_dirs.get( id ); + if ( id.Equals( "" ) ) { + install = path_voicedb.value; } - if ( install_dir.Equals( "" ) ) { - install_dir = Path.Combine( path_voicedb, s ); - } - installed_singers.add( install_dir ); + installed_singers.add( install ); } // path_expdbを取得 Vector exp_ids = new Vector(); // 最初はpath_expdbの取得と、id(BHXXXXXXXXXXXXXXXX)のようなシリアルを取得 - for( Iterator itr = expression.iterator(); itr.hasNext(); ){ + for ( Iterator itr = expression.iterator(); itr.hasNext(); ) { String s = (String)itr.next(); - String[] spl = s.Split( '\t' ); +#if DEBUG + PortUtil.println( "VocaloSysUtil#extract; s=" + s ); +#endif + String[] spl = PortUtil.splitString( s, new char[] { '\t' }, true ); if ( spl.Length >= 2 ) { if ( spl[0].Equals( "EXPRESSIONDIR" ) ) { - path_expdb = spl[1]; + path_expdb.value = spl[1]; } else if ( spl.Length >= 3 ) { - String[] spl2 = spl[0].Split( '\\' ); + String[] spl2 = PortUtil.splitString( spl[0], '\\' ); if ( spl2.Length == 1 ) { if ( !exp_ids.contains( spl2[0] ) ) { exp_ids.add( spl2[0] ); @@ -182,59 +276,65 @@ namespace Boare.Lib.Vsq { } } } - // 取得したシリアルを元に、installed_singersを取得 - /*foreach ( String s in exp_ids ) { - String install_dir = ""; - foreach ( String s2 in expression ) { - if ( s2.StartsWith( header + "\\" + s + "\t" ) ) { - String[] spl = s2.Split( '\t' ); - if ( spl.Length >= 3 && spl[1].Equals( "INSTALLDIR" ) ) { - install_dir = Path.Combine( spl[2], s ); - break; - } - } - } - if ( install_dir.Equals( "" ) ) { - install_dir = Path.Combine( path_expdb, s ); - } - installed_singers.Add( install_dir ); - }*/ - #if DEBUG - Console.WriteLine( "path_vsti=" + path_vsti ); - Console.WriteLine( "path_voicedb=" + path_voicedb ); - Console.WriteLine( "path_expdb=" + path_expdb ); - Console.WriteLine( "installed_singers=" ); - for( Iterator itr = installed_singers.iterator(); itr.hasNext(); ){ + PortUtil.println( "path_vsti=" + path_vsti.value ); + PortUtil.println( "path_voicedb=" + path_voicedb.value ); + PortUtil.println( "path_expdb=" + path_expdb.value ); + PortUtil.println( "installed_singers=" ); + for ( Iterator itr = installed_singers.iterator(); itr.hasNext(); ) { String s = (String)itr.next(); - Console.WriteLine( " " + s ); + PortUtil.println( " " + s ); } #endif } - // レジストリkey内の値を再帰的に検索し、ファイルfpに順次出力する - private static void print( RegistryKey key, String parent_name, Vector list ){ + /// + /// レジストリkey内の値を再帰的に検索し、ファイルfpに順次出力する + /// + /// + /// + /// + private static void print( String reg_key_name, String parent_name, Vector list ) { +#if JAVA +#else + RegistryKey key = Registry.LocalMachine.OpenSubKey( reg_key_name, false ); if ( key == null ) { return; } // 直下のキー内を再帰的にリストアップ String[] subkeys = key.GetSubKeyNames(); - foreach( String s in subkeys ){ - RegistryKey subkey = key.OpenSubKey( s, false ); - print( subkey, parent_name + "\\" + s, list ); - subkey.Close(); + foreach ( String s in subkeys ) { + print( reg_key_name + "\\" + s, parent_name + "\\" + s, list ); } // 直下の値を出力 String[] valuenames = key.GetValueNames(); - foreach( String s in valuenames ){ + foreach ( String s in valuenames ) { RegistryValueKind kind = key.GetValueKind( s ); - if ( kind == RegistryValueKind.String ){ + if ( kind == RegistryValueKind.String ) { String str = parent_name + "\t" + s + "\t" + (String)key.GetValue( s, "" ); list.add( str ); } } + key.Close(); +#endif + } + + public static Iterator attackConfigIterator( SynthesizerType type ) { + if ( s_exp_config_sys.containsKey( type ) ) { + return s_exp_config_sys.get( type ).attackConfigIterator(); + } else { + return (new Vector()).iterator(); + } + } + + public static Iterator vibratoConfigIterator( SynthesizerType type ) { + if ( s_exp_config_sys.containsKey( type ) ) { + return s_exp_config_sys.get( type ).vibratoConfigIterator(); + } else { + return (new Vector()).iterator(); + } } /// @@ -242,9 +342,13 @@ namespace Boare.Lib.Vsq { /// /// /// - public static String getOriginalSinger1( String singer ) { + public static String getOriginalSinger( String singer, SynthesizerType type ) { String voiceidstr = ""; - SingerConfig[] singer_configs = s_singer_config_sys1.getSingerConfigs(); + if ( !s_singer_config_sys.containsKey( type ) ) { + return ""; + } + SingerConfigSys scs = s_singer_config_sys.get( type ); + SingerConfig[] singer_configs = scs.getSingerConfigs(); for ( int i = 0; i < singer_configs.Length; i++ ) { if ( singer.Equals( singer_configs[i].VOICENAME ) ) { voiceidstr = singer_configs[i].VOICEIDSTR; @@ -254,7 +358,7 @@ namespace Boare.Lib.Vsq { if ( voiceidstr.Equals( "" ) ) { return ""; } - SingerConfig[] installed_singers = s_singer_config_sys1.getInstalledSingers(); + SingerConfig[] installed_singers = scs.getInstalledSingers(); for ( int i = 0; i < installed_singers.Length; i++ ) { if ( voiceidstr.Equals( installed_singers[i].VOICEIDSTR ) ) { return installed_singers[i].VOICENAME; @@ -263,62 +367,36 @@ namespace Boare.Lib.Vsq { return ""; } - /// - /// Gets the name of original singer of specified program change. - /// - /// - /// - public static String getOriginalSinger2( String singer ) { - String voiceidstr = ""; - SingerConfig[] singer_configs = s_singer_config_sys2.getSingerConfigs(); - for ( int i = 0; i < singer_configs.Length; i++ ) { - if ( singer.Equals( singer_configs[i].VOICENAME ) ) { - voiceidstr = singer_configs[i].VOICEIDSTR; - break; - } + public static VsqID getSingerID( String singer, SynthesizerType type ) { + if ( !s_singer_config_sys.containsKey( type ) ) { + return null; + } else { + return s_singer_config_sys.get( type ).getSingerID( singer ); } - if ( voiceidstr.Equals( "" ) ) { + } + + public static String getEditorPath( SynthesizerType type ) { + if ( !s_path_editor.containsKey( type ) ) { return ""; + } else { + return s_path_editor.get( type ); } - SingerConfig[] installed_singers = s_singer_config_sys2.getInstalledSingers(); - for ( int i = 0; i < installed_singers.Length; i++ ) { - if ( voiceidstr.Equals( installed_singers[i].VOICEIDSTR ) ) { - return installed_singers[i].VOICENAME; - } + } + + public static String getDllPathVsti( SynthesizerType type ) { + if ( !s_path_vsti.containsKey( type ) ) { + return ""; + } else { + return s_path_vsti.get( type ); } - return ""; } - public static VsqID getSingerID1( String singer ) { - return s_singer_config_sys1.getSingerID( singer ); - } - - public static VsqID getSingerID2( String singer ) { - return s_singer_config_sys2.getSingerID( singer ); - } - - public static String getEditorPath1() { - return s_path_editor1; - } - - public static String getEditorPath2() { - return s_path_editor2; - } - - public static String getDllPathVsti1() { - return s_path_vsti1; - } - - public static String getDllPathVsti2() { - return s_path_vsti2; - } - - public static SingerConfig[] getSingerConfigs1() { - return s_singer_config_sys1.getSingerConfigs(); - } - - public static SingerConfig[] getSingerConfigs2() { - return s_singer_config_sys2.getSingerConfigs(); + public static SingerConfig[] getSingerConfigs( SynthesizerType type ) { + if ( !s_singer_config_sys.containsKey( type ) ) { + return new SingerConfig[] { }; + } else { + return s_singer_config_sys.get( type ).getSingerConfigs(); + } } /// @@ -327,25 +405,25 @@ namespace Boare.Lib.Vsq { /// name of singer /// public static VsqVoiceLanguage getLanguageFromName( String name ) { - switch ( name.ToLower() ) { - case "meiko": - case "kaito": - case "miku": - case "rin": - case "len": - case "rin_act2": - case "len_act2": - case "gackpoid": - case "luka_jpn": - case "megpoid": - return VsqVoiceLanguage.Japanese; - case "sweet_ann": - case "prima": - case "luka_eng": - case "sonika": - return VsqVoiceLanguage.English; + String search = name.ToLower(); + if ( search.Equals( "meiko" ) || + search.Equals( "kaito" ) || + search.Equals( "miku" ) || + search.Equals( "rin" ) || + search.Equals( "len" ) || + search.Equals( "rin_act2" ) || + search.Equals( "len_act2" ) || + search.Equals( "gackpoid" ) || + search.Equals( "luka_jpn" ) || + search.Equals( "megpoid" ) ) { + return VsqVoiceLanguage.Japanese; + } else if ( search.Equals( "sweet_ann" ) || + search.Equals( "prima" ) || + search.Equals( "luka_eng" ) || + search.Equals( "sonika" ) ) { + return VsqVoiceLanguage.English; } - return VsqVoiceLanguage.Default; + return VsqVoiceLanguage.Japanese; } public static double getAmplifyCoeffFromPanLeft( int pan ) { @@ -365,462 +443,11 @@ namespace Boare.Lib.Vsq { /// /// /// - public static ulong makelong_le( byte[] oct ) { - return (ulong)oct[7] << 56 | (ulong)oct[6] << 48 | (ulong)oct[5] << 40 | (ulong)oct[4] << 32 | (ulong)oct[3] << 24 | (ulong)oct[2] << 16 | (ulong)oct[1] << 8 | (ulong)oct[0]; - } - } - - public static class VocaloSysUtil_ { - private static boolean s_initialized = false; - - private static String s_dll_path2 = ""; - private static String s_editor_path2 = ""; - private static String s_voicedbdir2 = ""; - private static Vector s_installed_singers2 = new Vector(); - private static Vector s_singer_configs2 = new Vector(); - - private static String s_dll_path1 = ""; - private static String s_editor_path1 = ""; - private static String s_voicedbdir1 = ""; - private static Vector s_installed_singers1 = new Vector(); - private static Vector s_singer_configs1 = new Vector(); - - private const int MAX_SINGERS = 0x4000; - - static VocaloSysUtil_() { - init_vocalo2(); - init_vocalo1(); - } - - /// - /// Gets the name of original singer of specified program change. - /// - /// - /// - public static String getOriginalSinger1( String singer ) { - String voiceidstr = ""; - for ( int i = 0; i < s_singer_configs1.size(); i++ ) { - if ( singer.Equals( s_singer_configs1.get( i ).VOICENAME ) ) { - voiceidstr = s_singer_configs1.get( i ).VOICEIDSTR; - } - } - if ( voiceidstr.Equals( "" ) ) { - return ""; - } - for ( int i = 0; i < s_installed_singers1.size(); i++ ) { - if ( voiceidstr.Equals( s_installed_singers1.get( i ).VOICEIDSTR ) ) { - return s_installed_singers1.get( i ).VOICENAME; - } - } - return ""; - } - - /// - /// Gets the name of original singer of specified program change. - /// - /// - /// - public static String getOriginalSinger2( String singer ) { - String voiceidstr = ""; - for ( int i = 0; i < s_singer_configs2.size(); i++ ) { - if ( singer.Equals( s_singer_configs2.get( i ).VOICENAME ) ) { - voiceidstr = s_singer_configs2.get( i ).VOICEIDSTR; - } - } - if ( voiceidstr.Equals( "" ) ) { - return ""; - } - for ( int i = 0; i < s_installed_singers2.size(); i++ ) { - if ( voiceidstr.Equals( s_installed_singers2.get( i ).VOICEIDSTR ) ) { - return s_installed_singers2.get( i ).VOICENAME; - } - } - return ""; - } - - /// - /// Gets the voice language of specified program change - /// - /// name of singer - /// - public static VsqVoiceLanguage getLanguageFromName( String name ) { - switch ( name ) { - case "MEIKO": - case "KAITO": - case "Miku": - case "Rin": - case "Len": - case "Rin_ACT2": - case "Len_ACT2": - case "Gackpoid": - case "Luka_JPN": - case "Megpoid": - return VsqVoiceLanguage.Japanese; - case "Sweet_Ann": - case "Prima": - case "Luka_ENG": - return VsqVoiceLanguage.English; - } - return VsqVoiceLanguage.Default; - } - - public static VsqID getSingerID1( String singer_name ) { - VsqID ret = new VsqID( 0 ); - ret.type = VsqIDType.Singer; - SingerConfig sc = null; - for ( int i = 0; i < s_singer_configs1.size(); i++ ) { - if ( s_singer_configs1.get( i ).VOICENAME.Equals( singer_name ) ) { - sc = s_singer_configs1.get( i ); - break; - } - } - if ( sc == null ) { - sc = new SingerConfig(); - } - int lang = 0; - for ( Iterator itr = s_installed_singers1.iterator(); itr.hasNext(); ){ - SingerConfig sc2 = (SingerConfig)itr.next(); - if ( sc.VOICEIDSTR.Equals( sc2.VOICEIDSTR ) ) { - lang = (int)getLanguageFromName( sc.VOICENAME ); - break; - } - } - ret.IconHandle = new IconHandle(); - ret.IconHandle.IconID = "$0701" + sc.Program.ToString( "0000" ); - ret.IconHandle.IDS = sc.VOICENAME; - ret.IconHandle.Index = 0; - ret.IconHandle.Language = lang; - ret.IconHandle.Length = 1; - ret.IconHandle.Original = sc.Original; - ret.IconHandle.Program = sc.Program; - ret.IconHandle.Caption = ""; - return ret; - } - - public static VsqID getSingerID2( String singer_name ) { - VsqID ret = new VsqID( 0 ); - ret.type = VsqIDType.Singer; - SingerConfig sc = null; - for ( int i = 0; i < s_singer_configs2.size(); i++ ) { - if ( s_singer_configs2.get( i ).VOICENAME.Equals( singer_name ) ) { - sc = s_singer_configs2.get( i ); - break; - } - } - if ( sc == null ) { - sc = new SingerConfig(); - } - int lang = 0; - for ( Iterator itr = s_installed_singers2.iterator(); itr.hasNext(); ){ - SingerConfig sc2 = (SingerConfig)itr.next(); - if ( sc.VOICEIDSTR.Equals( sc2.VOICEIDSTR ) ) { - lang = (int)getLanguageFromName( sc.VOICENAME ); - break; - } - } - ret.IconHandle = new IconHandle(); - ret.IconHandle.IconID = "$0701" + sc.Program.ToString( "0000" ); - ret.IconHandle.IDS = sc.VOICENAME; - ret.IconHandle.Index = 0; - ret.IconHandle.Language = lang; - ret.IconHandle.Length = 1; - ret.IconHandle.Original = sc.Original; - ret.IconHandle.Program = sc.Program; - ret.IconHandle.Caption = ""; - return ret; - } - - public static SingerConfig[] getSingerConfigs1() { - return s_singer_configs1.toArray( new SingerConfig[]{} ); - } - - public static SingerConfig[] getSingerConfigs2() { - return s_singer_configs2.toArray( new SingerConfig[]{} ); - } - - public static double getAmplifyCoeffFromPanLeft( int pan ) { - return pan / -64.0 + 1.0; - } - - public static double getAmplifyCoeffFromPanRight( int pan ) { - return pan / 64.0 + 1.0; - } - - public static double getAmplifyCoeffFromFeder( int feder ) { - return Math.Exp( -1.26697245e-02 + 1.18448420e-01 * feder / 10.0 ); - } - - public static String getEditorPath2() { - return s_editor_path2; - } - - public static String getEditorPath1() { - return s_editor_path1; - } - - public static String getDllPathVsti2() { - return s_dll_path2; - } - - public static String getDllPathVsti1() { - return s_dll_path1; - } - - /// - /// VOCALOID1システムのプロパティを取得 - /// - private static void init_vocalo1() { - // vocaloid1 dll path - RegistryKey v1application = null; - v1application = Registry.LocalMachine.OpenSubKey( "SOFTWARE\\VOCALOID\\APPLICATION", false ); - if ( v1application != null ) { - String[] keys = v1application.GetSubKeyNames(); - for ( int i = 0; i < keys.Length; i++ ) { - RegistryKey key = v1application.OpenSubKey( keys[i], false ); - if ( key != null ) { - String name = (String)key.GetValue( "PATH" ); - if ( name.ToLower().EndsWith( "\\vocaloid.dll" ) ) { - s_dll_path1 = name; - } else if ( name.ToLower().EndsWith( "\\vocaloid.exe" ) ) { - s_editor_path1 = name; - } - key.Close(); - } - } - v1application.Close(); - } - - // voicedbdir for vocaloid1 - RegistryKey v1database = Registry.LocalMachine.OpenSubKey( "SOFTWARE\\VOCALOID\\DATABASE\\VOICE", false ); - if ( v1database != null ) { - s_voicedbdir1 = (String)v1database.GetValue( "VOICEDIR", "" ); -#if DEBUG - Console.WriteLine( "s_voicedbdir1=" + s_voicedbdir1 ); -#endif - // インストールされている歌手のVOICEIDSTRを列挙 - String[] singer_voiceidstrs = v1database.GetSubKeyNames(); - Vector vvoice_keys = new Vector(); - Vector vvoice_values = new Vector(); - foreach ( String voiceidstr in singer_voiceidstrs ) { - RegistryKey singer = v1database.OpenSubKey( voiceidstr ); - if ( singer == null ) { - continue; - } - RegistryKey vvoice = singer.OpenSubKey( "vvoice" ); - if ( vvoice != null ) { - String[] vvoices = vvoice.GetValueNames(); - - // インストールされた歌手の.vvdを読みにいく - // installdir以下の、拡張子.vvdのファイルを探す - foreach ( String file in Directory.GetFiles( Path.Combine( s_voicedbdir1, voiceidstr ), "*.vvd" ) ) { - SingerConfig config = SingerConfig.fromVvd( file, 0 ); //とりあえずプログラムチェンジは0 - s_installed_singers1.add( config ); - } - - // vvoice*.vvdを読みにいく。 - foreach ( String s in vvoices ) { -#if DEBUG - Console.WriteLine( "s=" + s ); -#endif - String file = Path.Combine( s_voicedbdir1, s + ".vvd" ); - if ( File.Exists( file ) ) { - SingerConfig config = SingerConfig.fromVvd( file, 0 ); - vvoice_keys.add( s ); - vvoice_values.add( config ); - } - } - } - singer.Close(); - } - - // voice.mapを読み込んで、s_singer_configs1のプログラムチェンジを更新する - String map = Path.Combine( s_voicedbdir1, "voice.map" ); - if ( File.Exists( map ) ) { - using ( FileStream fs = new FileStream( map, FileMode.Open, FileAccess.Read ) ) { - byte[] dat = new byte[8]; - fs.Seek( 0x20, SeekOrigin.Begin ); - for ( int i = 0; i < MAX_SINGERS; i++ ) { - fs.Read( dat, 0, 8 ); - ulong value = makelong_le( dat ); - if ( value >= 1 ) { -#if DEBUG - Console.WriteLine( "value=" + value ); -#endif - for ( int j = 0; j < vvoice_keys.size(); j++ ) { - if ( vvoice_keys.get( j ).Equals( "vvoice" + value ) ) { - vvoice_values.get( j ).Program = i; - } - } - } - } - } - } - - // s_installed_singers1のSingerConfigのProgramとOriginalを適当に頒番する - for ( int i = 0; i < s_installed_singers1.size(); i++ ) { - s_installed_singers1.get( i ).Program = i; - s_installed_singers1.get( i ).Original = i; - } - - // s_singer_configs1を更新 - for ( int i = 0; i < vvoice_values.size(); i++ ) { - for ( int j = 0; j < s_installed_singers1.size(); j++ ) { - if ( vvoice_values.get( i ).VOICEIDSTR.Equals( s_installed_singers1.get( j ).VOICEIDSTR ) ) { - vvoice_values.get( i ).Original = s_installed_singers1.get( j ).Program; - break; - } - } - s_singer_configs1.add( vvoice_values.get( i ) ); - } - v1database.Close(); - } -#if DEBUG - Console.WriteLine( "installed" ); - for ( Iterator itr = s_installed_singers1.iterator(); itr.hasNext(); ){ - SingerConfig sc = (SingerConfig)itr.next(); - Console.WriteLine( "VOICENAME=" + sc.VOICENAME + "; VOICEIDSTR=" + sc.VOICEIDSTR + "; Program=" + sc.Program + "; Original=" + sc.Original ); - } - Console.WriteLine( "singer configs" ); - for ( Iterator itr = s_singer_configs1.iterator(); itr.hasNext(); ){ - SingerConfig sc = (SingerConfig)itr.next(); - Console.WriteLine( "VOICENAME=" + sc.VOICENAME + "; VOICEIDSTR=" + sc.VOICEIDSTR + "; Program=" + sc.Program + "; Original=" + sc.Original ); - } -#endif - } - - /// - /// VOCALOID2システムのプロパティを取得 - /// - private static void init_vocalo2() { - // 最初はvstiとeditorのパスを取得 - RegistryKey v2application = Registry.LocalMachine.OpenSubKey( "SOFTWARE\\VOCALOID2\\APPLICATION", false ); - if ( v2application == null ) { - v2application = Registry.LocalMachine.OpenSubKey( "SOFTWARE\\VOCALOID2_DEMO\\APPLICATION", false ); - } - if ( v2application != null ) { - String[] keys = v2application.GetSubKeyNames(); - for ( int i = 0; i < keys.Length; i++ ) { - RegistryKey key = v2application.OpenSubKey( keys[i], false ); - if ( key != null ) { - String name = (String)key.GetValue( "PATH" ); - if ( name.ToLower().EndsWith( "\\vocaloid2.dll" ) ) { - s_dll_path2 = name; - } else if ( name.ToLower().EndsWith( "\\vocaloid2_demo.dll" ) ) { - s_dll_path2 = name; - } else if ( name.ToLower().EndsWith( "\\vocaloid2.exe" ) ) { - s_editor_path2 = name; - } - key.Close(); - } - } - v2application.Close(); - } - - // 歌声データベースを取得 - RegistryKey v2database = Registry.LocalMachine.OpenSubKey( "SOFTWARE\\VOCALOID2\\DATABASE\\VOICE", false ); - if ( v2database != null ) { - // データベース(というよりもvoice.map)が保存されているパスを取得 - s_voicedbdir2 = (String)v2database.GetValue( "VOICEDIR", "" ); - // インストールされている歌手のVOICEIDSTRを列挙 - String[] singer_voiceidstrs = v2database.GetSubKeyNames(); - Vector vvoice_keys = new Vector(); - Vector vvoice_values = new Vector(); - foreach ( String voiceidstr in singer_voiceidstrs ) { - RegistryKey singer = v2database.OpenSubKey( voiceidstr ); - if ( singer == null ) { - continue; - } - String installdir = (String)singer.GetValue( "INSTALLDIR", "" ); -#if DEBUG - Console.WriteLine( "installdir=" + installdir ); -#endif - RegistryKey vvoice = singer.OpenSubKey( "vvoice" ); - if ( vvoice != null ) { - String[] vvoices = vvoice.GetValueNames(); - - // インストールされた歌手の.vvdを読みにいく - // installdir以下の、拡張子.vvdのファイルを探す - foreach ( String file in Directory.GetFiles( Path.Combine( installdir, voiceidstr ), "*.vvd" ) ) { - SingerConfig config = SingerConfig.fromVvd( file, 0 ); //とりあえずプログラムチェンジは0 - s_installed_singers2.add( config ); - } - - // vvoice*.vvdを読みにいく。場所は、installdirではなく、s_voicedbdir2 - foreach ( String s in vvoices ) { - String file = Path.Combine( s_voicedbdir2, s + ".vvd" ); - if ( File.Exists( file ) ) { - SingerConfig config = SingerConfig.fromVvd( file, 0 ); - vvoice_keys.add( s ); - vvoice_values.add( config ); - } - } - } - singer.Close(); - } - - // voice.mapを読み込んで、s_singer_configs2のプログラムチェンジを更新する - String map = Path.Combine( s_voicedbdir2, "voice.map" ); - if ( File.Exists( map ) ) { - using ( FileStream fs = new FileStream( map, FileMode.Open, FileAccess.Read ) ) { - byte[] dat = new byte[8]; - fs.Seek( 0x20, SeekOrigin.Begin ); - for ( int i = 0; i < MAX_SINGERS; i++ ) { - fs.Read( dat, 0, 8 ); - ulong value = makelong_le( dat ); - if ( value >= 1 ) { -#if DEBUG - Console.WriteLine( "value=" + value ); -#endif - for ( int j = 0; j < vvoice_keys.size(); j++ ) { - if ( vvoice_keys.get( j ).Equals( "vvoice" + value ) ) { - vvoice_values.get( j ).Program = i; - } - } - } - } - } - } - - // s_installed_singers2のSingerConfigのProgramとOriginalを適当に頒番する - for ( int i = 0; i < s_installed_singers2.size(); i++ ) { - s_installed_singers2.get( i ).Program = i; - s_installed_singers2.get( i ).Original = i; - } - - // s_singer_configs2を更新 - for ( int i = 0; i < vvoice_values.size(); i++ ) { - for ( int j = 0; j < s_installed_singers2.size(); j++ ) { - if ( vvoice_values.get( i ).VOICEIDSTR.Equals( s_installed_singers2.get( j ).VOICEIDSTR ) ) { - vvoice_values.get( i ).Original = s_installed_singers2.get( j ).Program; - break; - } - } - s_singer_configs2.add( vvoice_values.get( i ) ); - } - v2database.Close(); - } -#if DEBUG - Console.WriteLine( "installed" ); - for ( Iterator itr = s_installed_singers2.iterator(); itr.hasNext(); ){ - SingerConfig sc = (SingerConfig)itr.next(); - Console.WriteLine( "VOICENAME=" + sc.VOICENAME + "; VOICEIDSTR=" + sc.VOICEIDSTR + "; Program=" + sc.Program + "; Original=" + sc.Original ); - } - Console.WriteLine( "singer configs" ); - for ( Iterator itr = s_singer_configs2.iterator(); itr.hasNext(); ){ - SingerConfig sc = (SingerConfig)itr.next(); - Console.WriteLine( "VOICENAME=" + sc.VOICENAME + "; VOICEIDSTR=" + sc.VOICEIDSTR + "; Program=" + sc.Program + "; Original=" + sc.Original ); - } -#endif - } - - /// - /// Transform the byte array(length=8) to unsigned long, assuming that the byte array is little endian. - /// - /// - /// - public static ulong makelong_le( byte[] oct ) { - return (ulong)oct[7] << 56 | (ulong)oct[6] << 48 | (ulong)oct[5] << 40 | (ulong)oct[4] << 32 | (ulong)oct[3] << 24 | (ulong)oct[2] << 16 | (ulong)oct[1] << 8 | (ulong)oct[0]; + public static long makelong_le( byte[] oct ) { + return (long)oct[7] << 56 | (long)oct[6] << 48 | (long)oct[5] << 40 | (long)oct[4] << 32 | (long)oct[3] << 24 | (long)oct[2] << 16 | (long)oct[1] << 8 | (long)oct[0]; } } +#if !JAVA } +#endif diff --git a/trunk/Boare.Lib.Vsq/VsqBPList.cs b/trunk/Boare.Lib.Vsq/VsqBPList.cs index 3a85226..9d066da 100644 --- a/trunk/Boare.Lib.Vsq/VsqBPList.cs +++ b/trunk/Boare.Lib.Vsq/VsqBPList.cs @@ -11,65 +11,89 @@ * 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.IO; +#if JAVA +package org.kbinani.vsq; +import java.util.*; +import java.io.*; +import org.kbinani.*; +#else +using System; using bocoree; +using bocoree.java.io; +using bocoree.java.util; namespace Boare.Lib.Vsq { - using boolean = System.Boolean; + using Integer = System.Int32; +#endif - /// - /// BPListのデータ部分を取り扱うためのクラス。 - /// +#if JAVA + public class VsqBPList implements Cloneable, Serializable{ +#else [Serializable] public class VsqBPList : ICloneable { - private SortedList m_list = new SortedList(); +#endif + private Vector m_clock = new Vector(); + private Vector m_items = new Vector(); private int m_default = 0; private int m_maximum = 127; private int m_minimum = 0; - /// - /// このリストに設定されたidの最大値.次にデータ点が追加されたときは,個の値+1がidとして利用される.削除された場合でも減らない - /// - private int m_max_id = 0; + private long m_max_id = 0; - private class KeyClockIterator : Iterator { - private SortedList m_list; + class KeyClockIterator : Iterator { + private VsqBPList m_list; private int m_pos; - public KeyClockIterator( SortedList list ) { + public KeyClockIterator( VsqBPList list ) { m_list = list; m_pos = -1; } public boolean hasNext() { - if ( m_pos + 1 < m_list.Keys.Count ) { + if ( m_pos + 1 < m_list.m_clock.size() ) { return true; } else { return false; } } - public object next() { + public Object next() { m_pos++; - return m_list.Keys[m_pos]; + return m_list.m_clock.get( m_pos ); } public void remove() { - if ( 0 <= m_pos && m_pos < m_list.Keys.Count ) { - int key = m_list.Keys[m_pos]; - m_list.Remove( key ); + if ( 0 <= m_pos && m_pos < m_list.m_clock.size() ) { + int key = m_list.m_clock.get( m_pos ); + m_list.m_clock.removeElementAt( m_pos ); + m_list.m_items.removeElementAt( m_pos ); } } } - public VsqBPList() - : this( 0, 0, 64 ) { + + /// + /// コンストラクタ。デフォルト値はココで指定する。 + /// + /// + public VsqBPList( int default_value, int minimum, int maximum ) { + m_default = default_value; + m_maximum = maximum; + m_minimum = minimum; + m_max_id = 0; } +#if JAVA + public VsqBPList(){ + this( 0, 0, 64 ); +#else + public VsqBPList() + : this( 0, 0, 64 ) { +#endif + } + +#if !JAVA public int Default { get { return getDefault(); @@ -78,6 +102,11 @@ namespace Boare.Lib.Vsq { setDefault( value ); } } +#endif + + public long getMaxID() { + return m_max_id; + } /// /// このBPListのデフォルト値を取得します @@ -96,44 +125,60 @@ namespace Boare.Lib.Vsq { /// public void renumberIDs() { m_max_id = 0; - for ( Iterator itr = keyClockIterator(); itr.hasNext(); ) { - VsqBPPair item = (VsqBPPair)itr.next(); + int count = m_items.size(); + for ( int i = 0; i < count; i++ ) { m_max_id++; - item.id = m_max_id; + VsqBPPair v = m_items.get( i ); + v.id = m_max_id; + m_items.set( i, v ); } } +#if !JAVA /// /// XMLシリアライズ用 /// public String Data { get { - String ret = ""; - int count = -1; - foreach ( int key in m_list.Keys ) { - count++; - ret += (count == 0 ? "" : "," ) + key + "=" + m_list[key].value; - } - return ret; + return getData(); } set { - m_list.Clear(); - m_max_id = 0; - String[] spl = value.Split( ',' ); - for ( int i = 0; i < spl.Length; i++ ) { - String[] spl2 = spl[i].Split( '=' ); - if ( spl2.Length < 2 ) { - continue; - } - try { - m_list.Add( int.Parse( spl2[0] ), new VsqBPPair( int.Parse( spl2[1] ), m_max_id + 1 ) ); - m_max_id++; - } catch ( Exception ex ) { -#if DEBUG - Console.WriteLine( " ex=" + ex ); - Console.WriteLine( " i=" + i + "; spl2[0]=" + spl2[0] + "; spl2[1]=" + spl2[1] ); + setData( value ); + } + } +#endif + + public String getData() { + String ret = ""; + int count = -1; + int size = m_clock.size(); + for ( int i = 0; i < size; i++ ) { + count++; + ret += (count == 0 ? "" : ",") + m_clock.get( i ) + "=" + m_items.get( i ).value; + } + return ret; + } + + public void setData( String value ) { + m_clock.clear(); + m_items.clear(); + m_max_id = 0; + String[] spl = PortUtil.splitString( value, ',' ); + for ( int i = 0; i < spl.Length; i++ ) { + String[] spl2 = PortUtil.splitString( spl[i], '=' ); + if ( spl2.Length < 2 ) { + continue; + } + try { + int clock = PortUtil.parseInt( spl2[0] ); + m_clock.add( clock ); + m_items.add( new VsqBPPair( PortUtil.parseInt( spl2[1] ), m_max_id + 1 ) ); + m_max_id++; + } catch ( Exception ex ) { +#if DEBUG + PortUtil.println( " ex=" + ex ); + PortUtil.println( " i=" + i + "; spl2[0]=" + spl2[0] + "; spl2[1]=" + spl2[1] ); #endif - } } } } @@ -143,29 +188,27 @@ namespace Boare.Lib.Vsq { /// /// public Object clone() { - VsqBPList res = new VsqBPList( getDefault(), getMinimum(), getMaximum() ); - foreach ( int key in m_list.Keys ) { - res.m_list.Add( key, m_list[key] ); + VsqBPList res = new VsqBPList( m_default, m_minimum, m_maximum ); + int count = m_clock.size(); + for ( int i = 0; i < count; i++ ) { + res.m_clock.add( m_clock.get( i ) ); +#if JAVA + res.m_items.add( (VsqBPPair)m_items.get( i ).clone() ); +#else + res.m_items.add( m_items.get( i ) ); +#endif } res.m_max_id = m_max_id; return res; } +#if !JAVA public object Clone() { return clone(); } +#endif - /// - /// コンストラクタ。デフォルト値はココで指定する。 - /// - /// - public VsqBPList( int default_value, int minimum, int maximum ) { - m_default = default_value; - m_maximum = maximum; - m_minimum = minimum; - m_max_id = 0; - } - +#if !JAVA public int Maximum { get { return getMaximum(); @@ -174,6 +217,7 @@ namespace Boare.Lib.Vsq { setMaximum( value ); } } +#endif /// /// このリストに設定された最大値を取得します。 @@ -182,10 +226,11 @@ namespace Boare.Lib.Vsq { return m_maximum; } - public void setMaximum( int value ){ + public void setMaximum( int value ) { m_maximum = value; } +#if !JAVA public int Minimum { get { return getMinimum(); @@ -194,6 +239,7 @@ namespace Boare.Lib.Vsq { setMinimum( value ); } } +#endif /// /// このリストに設定された最小値を取得します @@ -206,31 +252,29 @@ namespace Boare.Lib.Vsq { m_minimum = value; } - public Iterator keyClockIterator() { - return new KeyClockIterator( m_list ); + public void remove( int clock ) { + int index = m_clock.indexOf( clock ); + removeElementAt( index ); } - public void remove( int clock ) { - if ( m_list.ContainsKey( clock ) ) { - m_list.Remove( clock ); + public void removeElementAt( int index ) { + if ( index >= 0 ) { + m_clock.removeElementAt( index ); + m_items.removeElementAt( index ); } } public boolean isContainsKey( int clock ) { - return m_list.ContainsKey( clock ); + return m_clock.contains( clock ); } - public int size() { - return m_list.Count; - } - - public int[] getKeys() { - Vector t = new Vector(); + /* public int[] getKeys() { + Vector t = new Vector(); foreach( int key in m_list.Keys ){ t.add( key ); } - return t.toArray( new Int32[]{} ); - } + return t.toArray( new Integer[]{} ); + }*/ /// /// 時刻clockのデータを時刻new_clockに移動します。 @@ -240,46 +284,30 @@ namespace Boare.Lib.Vsq { /// /// public void move( int clock, int new_clock, int new_value ) { - if ( !m_list.ContainsKey( clock ) ) { + int index = m_clock.indexOf( clock ); + if ( index < 0 ) { return; } - VsqBPPair item = m_list[clock]; - m_list.Remove( clock ); - if ( m_list.ContainsKey( new_clock ) ) { - m_list.Remove( new_clock ); + VsqBPPair item = m_items.get( index ); + m_clock.removeElementAt( index ); + m_items.removeElementAt( index ); + int index_new = m_clock.indexOf( new_clock ); + if ( index_new >= 0 ) { + item.value = new_value; + m_items.set( index_new, item ); + return; + } else { + m_clock.add( new_clock ); + Collections.sort( m_clock ); + index_new = m_clock.indexOf( new_clock ); + item.value = new_value; + m_items.insertElementAt( item, index_new ); } - item.value = new_value; - m_list.Add( new_clock, item ); } public void clear() { - m_list.Clear(); - } - - /// - /// 新しいデータ点を追加します。 - /// 戻り値に、新しいデータ点のIDを返します - /// - /// - /// - /// - public long add( int clock, int value ) { - lock ( m_list ) { - if ( m_list.ContainsKey( clock ) ) { - VsqBPPair v = m_list[clock]; - v.value = value; - m_list[clock] = v; - return v.id; - } else { - VsqBPPair v = new VsqBPPair( value, m_max_id + 1 ); - m_max_id++; -#if DEBUG - //Console.WriteLine( "VsqBPList#add; m_max_id=" + m_max_id ); -#endif - m_list.Add( clock, v ); - return m_max_id; - } - } + m_clock.clear(); + m_items.clear(); } public int getElement( int index ) { @@ -287,22 +315,23 @@ namespace Boare.Lib.Vsq { } public int getElementA( int index ) { - return m_list[m_list.Keys[index]].value; + return m_items.get( index ).value; } public VsqBPPair getElementB( int index ) { - return m_list[m_list.Keys[index]]; + return m_items.get( index ); } public int getKeyClock( int index ) { - return m_list.Keys[index]; + return m_clock.get( index ); } public int findValueFromID( long id ) { - int c = m_list.Keys.Count; - foreach ( int key in m_list.Keys ) { - if ( m_list[key].id == id ) { - return m_list[key].value; + int c = m_items.size(); + for ( int i = 0; i < c; i++ ) { + VsqBPPair item = m_items.get( i ); + if ( item.id == id ) { + return item.value; } } return m_default; @@ -315,12 +344,11 @@ namespace Boare.Lib.Vsq { /// public VsqBPPairSearchContext findElement( long id ) { VsqBPPairSearchContext context = new VsqBPPairSearchContext(); - int c = m_list.Keys.Count; + int c = m_items.size(); for ( int i = 0; i < c; i++ ) { - int clock = m_list.Keys[i]; - VsqBPPair item = m_list[clock]; + VsqBPPair item = m_items.get( i ); if ( item.id == id ) { - context.clock = clock; + context.clock = m_clock.get( i ); context.index = i; context.point = item; return context; @@ -333,94 +361,82 @@ namespace Boare.Lib.Vsq { } public void setValueForID( long id, int value ) { - int c = m_list.Keys.Count; - foreach ( int key in m_list.Keys ) { - if ( m_list[key].id == id ) { - VsqBPPair v = m_list[key]; - v.value = value; - m_list[key] = v; + int c = m_items.size(); + for ( int i = 0; i < c; i++ ) { + VsqBPPair item = m_items.get( i ); + if ( item.id == id ) { + item.value = value; + m_items.set( i, item ); break; } } } - public int getValue( int clock, ref int index ) { - if ( m_list.Count == 0 ) { + public int getValue( int clock, ByRef index ) { + int count = m_clock.size(); + if ( count == 0 ) { return m_default; } else { - if ( index < 0 ) { - index = 0; + if ( index.value < 0 ) { + index.value = 0; } - for ( int i = index ; i < m_list.Keys.Count; i++ ) { - int keyclock = m_list.Keys[i]; + for ( int i = index.value; i < count; i++ ) { + int keyclock = m_clock.get( i ); if ( clock < keyclock ) { if ( i > 0 ) { - index = i; - return m_list[m_list.Keys[i - 1]].value; + index.value = i; + return m_items.get( i - 1 ).value; } else { - index = i; + index.value = i; return m_default; } } } - index = m_list.Keys.Count - 1; - return m_list[m_list.Keys[m_list.Keys.Count - 1]].value; + index.value = count - 1; + return m_items.get( count - 1 ).value; } } - public int getValue( int clock ) { - if ( m_list.Count == 0 ) { - return m_default; - } else { - for ( int i = 0; i < m_list.Keys.Count; i++ ) { - int keyclock = m_list.Keys[i]; - if ( clock < keyclock ) { - if ( i > 0 ) { - return m_list[m_list.Keys[i - 1]].value; - } else { - return m_default; - } - } - } - return m_list[m_list.Keys[m_list.Keys.Count - 1]].value; - } - } - - /// - /// このBPListの内容をテキストファイルに書き出します - /// - /// - public void print( StreamWriter writer ) { - boolean first = true; - foreach ( int key in m_list.Keys ) { - int val = m_list[key].value; - if ( first ) { - writer.WriteLine( key + "=" + val ); - first = false; - } else { - writer.WriteLine( key + "=" + val ); - } - } - } - - /// - /// このBPListの内容をテキストファイルに書き出します - /// - /// - public void print( TextMemoryStream writer, int start, String header ) { - boolean first = true; - foreach ( int key in m_list.Keys ) { - if ( start <= key ) { - if ( first ) { - writer.writeLine( header ); - first = false; - } - int val = m_list[key].value; + private void printCor( ITextWriter writer, int start_clock, String header ) +#if JAVA + throws IOException +#endif + { + writer.writeLine( header ); + int c = m_clock.size(); + for ( int i = 0; i < c; i++ ) { + int key = m_clock.get( i ); + if ( start_clock <= key ) { + int val = m_items.get( i ).value; writer.writeLine( key + "=" + val ); } } } + /// + /// このBPListの内容をテキストファイルに書き出します + /// + /// + public void print( BufferedWriter writer, int start, String header ) +#if JAVA + throws IOException +#endif + { + printCor( new WrappedStreamWriter( writer ), start, header ); + } + + /// + /// このBPListの内容をテキストファイルに書き出します + /// + /// + public void print( TextMemoryStream writer, int start, String header ) +#if JAVA + throws IOException +#endif + { + printCor( writer, start, header ); + } + /// /// テキストファイルからデータ点を読込み、現在のリストに追加します /// @@ -429,12 +445,10 @@ namespace Boare.Lib.Vsq { public String appendFromText( TextMemoryStream reader ) { String last_line = reader.readLine(); while ( !last_line.StartsWith( "[" ) ) { - String[] spl = last_line.Split( new char[] { '=' } ); - int i1 = int.Parse( spl[0] ); - int i2 = int.Parse( spl[1] ); - VsqBPPair v = new VsqBPPair( i2, m_max_id + 1 ); - m_max_id++; - m_list.Add( i1, v ); + String[] spl = PortUtil.splitString( last_line, new char[] { '=' } ); + int clock = PortUtil.parseInt( spl[0] ); + int value = PortUtil.parseInt( spl[1] ); + this.add( clock, value ); if ( reader.peek() < 0 ) { break; } else { @@ -443,6 +457,86 @@ namespace Boare.Lib.Vsq { } return last_line; } + + public int size() { + return m_clock.size(); + } + + public Iterator keyClockIterator() { + return new KeyClockIterator( this ); + } + + public long add( int clock, int value ) { + int index = m_clock.indexOf( clock ); + if ( index >= 0 ) { + VsqBPPair v = m_items.get( index ); + v.value = value; + m_items.set( index, v ); + return v.id; + } else { + m_clock.add( clock ); + Collections.sort( m_clock ); + index = m_clock.indexOf( clock ); + m_max_id++; + m_items.insertElementAt( new VsqBPPair( value, m_max_id ), index ); + return m_max_id; + } + } + + public void addWithID( int clock, int value, long id ) { + int index = m_clock.indexOf( clock ); + if ( index >= 0 ) { + VsqBPPair v = m_items.get( index ); + v.value = value; + v.id = id; + m_items.set( index, v ); + } else { + m_clock.add( clock ); + Collections.sort( m_clock ); + index = m_clock.indexOf( clock ); + m_items.insertElementAt( new VsqBPPair( value, id ), index ); + m_max_id = Math.Max( m_max_id, id ); + } + } + + public void removeWithID( long id ) { + int c = m_items.size(); + for ( int i = 0; i < c; i++ ) { + if ( m_items.get( i ).id == id ) { + m_items.removeElementAt( i ); + m_clock.removeElementAt( i ); + break; + } + } + } + + public int getValue( int clock ) { + int index = m_clock.indexOf( clock ); + if ( index >= 0 ) { + return m_items.get( index ).value; + } else { + int count = m_clock.size(); + if ( count <= 0 ) { + return m_default; + } else { + int draft = -1; + for ( int i = 0; i < count; i++ ) { + int c = m_clock.get( i ); + if ( clock < c ) { + break; + } + draft = i; + } + if ( draft < 0 ) { + return m_default; + } else { + return m_items.get( draft ).value; + } + } + } + } } +#if !JAVA } +#endif diff --git a/trunk/Boare.Lib.Vsq/VsqBPPair.cs b/trunk/Boare.Lib.Vsq/VsqBPPair.cs index 5b039c5..d706798 100644 --- a/trunk/Boare.Lib.Vsq/VsqBPPair.cs +++ b/trunk/Boare.Lib.Vsq/VsqBPPair.cs @@ -11,12 +11,22 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */ +#if JAVA +package org.kbinani.vsq; + +import java.io.*; +#else using System; namespace Boare.Lib.Vsq { +#endif +#if JAVA + public class VsqBPPair implements Cloneable, Serializable { +#else [Serializable] public struct VsqBPPair { +#endif public int value; public long id; @@ -24,6 +34,14 @@ namespace Boare.Lib.Vsq { value = value_; id = id_; } + +#if JAVA + public Object clone(){ + return new VsqBPPair( value, id ); + } +#endif } +#if !JAVA } +#endif diff --git a/trunk/Boare.Lib.Vsq/VsqBPPairSearchContext.cs b/trunk/Boare.Lib.Vsq/VsqBPPairSearchContext.cs index 081401e..3c5ac43 100644 --- a/trunk/Boare.Lib.Vsq/VsqBPPairSearchContext.cs +++ b/trunk/Boare.Lib.Vsq/VsqBPPairSearchContext.cs @@ -1,4 +1,21 @@ -namespace Boare.Lib.Vsq { +/* + * VsqBPPairSearchContext.cs + * Copyright (c) 2009 kbinani + * + * This file is part of Boare.Lib.Vsq. + * + * Boare.Lib.Vsq is free software; you can redistribute it and/or + * modify it under the terms of the BSD License. + * + * Boare.Lib.Vsq 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. + */ +#if JAVA +package org.kbinani.vsq; +#else +namespace Boare.Lib.Vsq { +#endif public class VsqBPPairSearchContext { public int clock; @@ -6,4 +23,6 @@ public VsqBPPair point; } +#if !JAVA } +#endif diff --git a/trunk/Boare.Lib.Vsq/VsqBarLineType.cs b/trunk/Boare.Lib.Vsq/VsqBarLineType.cs index 5e33612..f3e1f2d 100644 --- a/trunk/Boare.Lib.Vsq/VsqBarLineType.cs +++ b/trunk/Boare.Lib.Vsq/VsqBarLineType.cs @@ -11,11 +11,14 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */ +#if JAVA +package org.kbinani.vsq; +#else using System; namespace Boare.Lib.Vsq { - using boolean = System.Boolean; +#endif public struct VsqBarLineType { private int m_clock; @@ -53,4 +56,6 @@ namespace Boare.Lib.Vsq { } } -} \ No newline at end of file +#if !JAVA +} +#endif diff --git a/trunk/Boare.Lib.Vsq/VsqCommand.cs b/trunk/Boare.Lib.Vsq/VsqCommand.cs index 61819a2..cdd6682 100644 --- a/trunk/Boare.Lib.Vsq/VsqCommand.cs +++ b/trunk/Boare.Lib.Vsq/VsqCommand.cs @@ -11,27 +11,38 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */ +#if JAVA +package org.kbinani.vsq; + +import java.io.*; +import java.util.*; +import org.kbinani.*; +#else using System; using System.Collections.Generic; - using bocoree; +using bocoree.java.util; namespace Boare.Lib.Vsq { - using boolean = System.Boolean; using Integer = System.Int32; using Long = System.Int64; +#endif /// /// /// +#if JAVA + public class VsqCommand implements Serializable { +#else [Serializable] public class VsqCommand { +#endif public VsqCommandType Type; /// /// コマンドの処理内容を保持します。Args具体的な内容は、処理するクラスごとに異なります /// - public object[] Args; + public Object[] Args; /// /// 後続するコマンド /// @@ -56,25 +67,25 @@ namespace Boare.Lib.Vsq { public static VsqCommand generateCommandReplace( VsqFile vsq ) { VsqCommand command = new VsqCommand(); - command.Args = new object[1]; + command.Args = new Object[1]; command.Type = VsqCommandType.REPLACE; - command.Args[0] = (VsqFile)vsq.Clone(); + command.Args[0] = (VsqFile)vsq.clone(); return command; } public static VsqCommand generateCommandTrackReplace( int track, VsqTrack item ) { VsqCommand command = new VsqCommand(); command.Type = VsqCommandType.TRACK_REPLACE; - command.Args = new object[2]; + command.Args = new Object[2]; command.Args[0] = track; - command.Args[1] = (VsqTrack)item.Clone(); + command.Args[1] = (VsqTrack)item.clone(); return command; } public static VsqCommand generateCommandUpdateTimesig( int bar_count, int new_barcount, int numerator, int denominator ) { VsqCommand command = new VsqCommand(); command.Type = VsqCommandType.UPDATE_TIMESIG; - command.Args = new object[4]; + command.Args = new Object[4]; command.Args[0] = bar_count; command.Args[1] = numerator; command.Args[2] = denominator; @@ -85,28 +96,28 @@ namespace Boare.Lib.Vsq { public static VsqCommand generateCommandUpdateTimesigRange( int[] bar_counts, int[] new_barcounts, int[] numerators, int[] denominators ) { VsqCommand command = new VsqCommand(); command.Type = VsqCommandType.UPDATE_TIMESIG_RANGE; - command.Args = new object[4]; - command.Args[0] = (int[])bar_counts.Clone(); - command.Args[1] = (int[])numerators.Clone(); - command.Args[2] = (int[])denominators.Clone(); - command.Args[3] = (int[])new_barcounts.Clone(); + command.Args = new Object[4]; + command.Args[0] = copyIntArray( bar_counts ); + command.Args[1] = copyIntArray( numerators ); + command.Args[2] = copyIntArray( denominators ); + command.Args[3] = copyIntArray( new_barcounts ); return command; } public static VsqCommand generateCommandUpdateTempoRange( int[] clocks, int[] new_clocks, int[] tempos ) { VsqCommand command = new VsqCommand(); command.Type = VsqCommandType.UPDATE_TEMPO_RANGE; - command.Args = new object[3]; - command.Args[0] = (int[])clocks.Clone(); - command.Args[1] = (int[])tempos.Clone(); - command.Args[2] = (int[])new_clocks.Clone(); + command.Args = new Object[3]; + command.Args[0] = copyIntArray( clocks ); + command.Args[1] = copyIntArray( tempos ); + command.Args[2] = copyIntArray( new_clocks ); return command; } public static VsqCommand generateCommandUpdateTempo( int clock, int new_clock, int tempo ) { VsqCommand command = new VsqCommand(); command.Type = VsqCommandType.UPDATE_TEMPO; - command.Args = new object[3]; + command.Args = new Object[3]; command.Args[0] = clock; command.Args[1] = tempo; command.Args[2] = new_clock; @@ -116,7 +127,7 @@ namespace Boare.Lib.Vsq { public static VsqCommand generateCommandChangePreMeasure( int pre_measure ) { VsqCommand command = new VsqCommand(); command.Type = VsqCommandType.CHANGE_PRE_MEASURE; - command.Args = new object[1]; + command.Args = new Object[1]; command.Args[0] = pre_measure; return command; } @@ -124,7 +135,7 @@ namespace Boare.Lib.Vsq { public static VsqCommand generateCommandDeleteTrack( int track ) { VsqCommand command = new VsqCommand(); command.Type = VsqCommandType.TRACK_DELETE; - command.Args = new object[1]; + command.Args = new Object[1]; command.Args[0] = track; return command; } @@ -137,7 +148,7 @@ namespace Boare.Lib.Vsq { public static VsqCommand generateCommandAddTrack( VsqTrack track, VsqMixerEntry mixer, int position ) { VsqCommand command = new VsqCommand(); command.Type = VsqCommandType.TRACK_ADD; - command.Args = new object[5]; + command.Args = new Object[3]; command.Args[0] = track; command.Args[1] = mixer; command.Args[2] = position; @@ -153,7 +164,7 @@ namespace Boare.Lib.Vsq { public static VsqCommand generateCommandTrackChangeName( int track, String new_name ) { VsqCommand command = new VsqCommand(); command.Type = VsqCommandType.TRACK_CHANGE_NAME; - command.Args = new object[2]; + command.Args = new Object[2]; command.Args[0] = track; command.Args[1] = new_name; return command; @@ -162,7 +173,7 @@ namespace Boare.Lib.Vsq { public static VsqCommand generateCommandTrackChangePlayMode( int track, int play_mode ) { VsqCommand command = new VsqCommand(); command.Type = VsqCommandType.TRACK_CHANGE_PLAY_MODE; - command.Args = new object[2]; + command.Args = new Object[2]; command.Args[0] = track; command.Args[1] = play_mode; return command; @@ -180,11 +191,15 @@ namespace Boare.Lib.Vsq { VsqCommand command = new VsqCommand(); command.Type = VsqCommandType.EVENT_CHANGE_CLOCK_AND_ID_CONTAINTS_RANGE; int count = internal_ids.Length; - command.Args = new object[4]; + command.Args = new Object[4]; command.Args[0] = track; - command.Args[1] = (int[])internal_ids.Clone(); - command.Args[2] = (int[])clocks.Clone(); - command.Args[3] = (VsqID[])values.Clone(); + command.Args[1] = copyIntArray( internal_ids ); + command.Args[2] = copyIntArray( clocks ); + VsqID[] cp_values = new VsqID[values.Length]; + for ( int i = 0; i < values.Length; i++ ) { + cp_values[i] = (VsqID)values[i].clone(); + } + command.Args[3] = cp_values; return command; } @@ -199,7 +214,7 @@ namespace Boare.Lib.Vsq { public static VsqCommand generateCommandEventChangeClockAndIDContaints( int track, int internal_id, int clock, VsqID value ) { VsqCommand command = new VsqCommand(); command.Type = VsqCommandType.EVENT_CHANGE_CLOCK_AND_ID_CONTAINTS; - command.Args = new object[4]; + command.Args = new Object[4]; command.Args[0] = track; command.Args[1] = internal_id; command.Args[2] = clock; @@ -217,9 +232,9 @@ namespace Boare.Lib.Vsq { public static VsqCommand generateCommandEventChangeIDContaintsRange( int track, int[] internal_ids, VsqID[] values ) { VsqCommand command = new VsqCommand(); command.Type = VsqCommandType.EVENT_CHANGE_ID_CONTAINTS_RANGE; - command.Args = new object[3]; + command.Args = new Object[3]; command.Args[0] = track; - command.Args[1] = (int[])internal_ids.Clone(); + command.Args[1] = copyIntArray( internal_ids ); VsqID[] list = new VsqID[values.Length]; for ( int i = 0; i < values.Length; i++ ) { list[i] = (VsqID)values[i].clone(); @@ -238,7 +253,7 @@ namespace Boare.Lib.Vsq { public static VsqCommand generateCommandEventChangeIDContaints( int track, int internal_id, VsqID value ) { VsqCommand command = new VsqCommand(); command.Type = VsqCommandType.EVENT_CHANGE_ID_CONTAINTS; - command.Args = new object[3]; + command.Args = new Object[3]; command.Args[0] = track; command.Args[1] = internal_id; command.Args[2] = (VsqID)value.clone(); @@ -256,7 +271,7 @@ namespace Boare.Lib.Vsq { public static VsqCommand generateCommandEventChangeClockAndLength( int track, int internal_id, int new_clock, int new_length ) { VsqCommand command = new VsqCommand(); command.Type = VsqCommandType.EVENT_CHANGE_CLOCK_AND_LENGTH; - command.Args = new object[4]; + command.Args = new Object[4]; command.Args[0] = track; command.Args[1] = internal_id; command.Args[2] = new_clock; @@ -274,7 +289,7 @@ namespace Boare.Lib.Vsq { public static VsqCommand generateCommandEventChangeLength( int track, int internal_id, int new_length ) { VsqCommand command = new VsqCommand(); command.Type = VsqCommandType.EVENT_CHANGE_LENGTH; - command.Args = new object[3]; + command.Args = new Object[3]; command.Args[0] = track; command.Args[1] = internal_id; command.Args[2] = new_length; @@ -288,15 +303,15 @@ namespace Boare.Lib.Vsq { /// /// /// - public static VsqCommand generateCommandEventChangeVelocity( int track, Vector> velocity ) { + public static VsqCommand generateCommandEventChangeVelocity( int track, Vector> velocity ) { VsqCommand command = new VsqCommand(); command.Type = VsqCommandType.EVENT_CHANGE_VELOCITY; - command.Args = new object[2]; + command.Args = new Object[2]; command.Args[0] = track; - Vector> list = new Vector>(); - for( Iterator itr = velocity.iterator(); itr.hasNext(); ){ - KeyValuePair item = (KeyValuePair)itr.next(); - list.add( new KeyValuePair( item.Key, item.Value ) ); + Vector> list = new Vector>(); + for ( Iterator itr = velocity.iterator(); itr.hasNext(); ) { + ValuePair item = (ValuePair)itr.next(); + list.add( new ValuePair( item.getKey(), item.getValue() ) ); } command.Args[1] = list; return command; @@ -305,7 +320,7 @@ namespace Boare.Lib.Vsq { public static VsqCommand generateCommandEventReplace( int track, VsqEvent item ) { VsqCommand command = new VsqCommand(); command.Type = VsqCommandType.EVENT_REPLACE; - command.Args = new object[2]; + command.Args = new Object[2]; command.Args[0] = track; command.Args[1] = item.clone(); return command; @@ -314,10 +329,10 @@ namespace Boare.Lib.Vsq { public static VsqCommand generateCommandEventReplaceRange( int track, VsqEvent[] items ) { VsqCommand command = new VsqCommand(); command.Type = VsqCommandType.EVENT_REPLACE_RANGE; - command.Args = new object[2]; + command.Args = new Object[2]; command.Args[0] = track; VsqEvent[] objs = new VsqEvent[items.Length]; - for( int i = 0; i < items.Length; i++ ){ + for ( int i = 0; i < items.Length; i++ ) { objs[i] = (VsqEvent)items[i].clone(); } command.Args[1] = objs; @@ -331,15 +346,15 @@ namespace Boare.Lib.Vsq { /// /// /// - public static VsqCommand generateCommandEventChangeAccent( int track, Vector> accent_list ) { + public static VsqCommand generateCommandEventChangeAccent( int track, Vector> accent_list ) { VsqCommand command = new VsqCommand(); command.Type = VsqCommandType.EVENT_CHANGE_ACCENT; - command.Args = new object[2]; + command.Args = new Object[2]; command.Args[0] = track; - Vector> list = new Vector>(); - for ( Iterator itr = accent_list.iterator(); itr.hasNext(); ){ - KeyValuePair item = (KeyValuePair)itr.next(); - list.add( new KeyValuePair( item.Key, item.Value ) ); + Vector> list = new Vector>(); + for ( Iterator itr = accent_list.iterator(); itr.hasNext(); ) { + ValuePair item = (ValuePair)itr.next(); + list.add( new ValuePair( item.getKey(), item.getValue() ) ); } command.Args[1] = list; return command; @@ -352,15 +367,15 @@ namespace Boare.Lib.Vsq { /// /// /// - public static VsqCommand generateCommandEventChangeDecay( int track, Vector> decay_list ) { + public static VsqCommand generateCommandEventChangeDecay( int track, Vector> decay_list ) { VsqCommand command = new VsqCommand(); command.Type = VsqCommandType.EVENT_CHANGE_DECAY; - command.Args = new object[2]; + command.Args = new Object[2]; command.Args[0] = track; - Vector> list = new Vector>(); - for ( Iterator itr = decay_list.iterator(); itr.hasNext(); ){ - KeyValuePair item = (KeyValuePair)itr.next(); - list.add( new KeyValuePair( item.Key, item.Value ) ); + Vector> list = new Vector>(); + for ( Iterator itr = decay_list.iterator(); itr.hasNext(); ) { + ValuePair item = (ValuePair)itr.next(); + list.add( new ValuePair( item.getKey(), item.getValue() ) ); } command.Args[1] = list; return command; @@ -369,7 +384,7 @@ namespace Boare.Lib.Vsq { public static VsqCommand generateCommandTrackCurveReplaceRange( int track, String[] target_curve, VsqBPList[] bplist ) { VsqCommand command = new VsqCommand(); command.Type = VsqCommandType.TRACK_CURVE_REPLACE_RANGE; - command.Args = new object[3]; + command.Args = new Object[3]; command.Args[0] = track; String[] arr = new String[target_curve.Length]; for ( int i = 0; i < target_curve.Length; i++ ) { @@ -387,7 +402,7 @@ namespace Boare.Lib.Vsq { public static VsqCommand generateCommandTrackCurveReplace( int track, String target_curve, VsqBPList bplist ) { VsqCommand command = new VsqCommand(); command.Type = VsqCommandType.TRACK_CURVE_REPLACE; - command.Args = new object[3]; + command.Args = new Object[3]; command.Args[0] = track; command.Args[1] = target_curve; command.Args[2] = bplist.clone(); @@ -397,7 +412,7 @@ namespace Boare.Lib.Vsq { /*public static VsqCommand generateCommandTrackRemovePoints( int track, String target, Vector ids ) { VsqCommand command = new VsqCommand(); command.Type = VsqCommandType.TRACK_CURVE_REMOVE_POINTS; - command.Args = new object[3]; + command.Args = new Object[3]; command.Args[0] = track; command.Args[1] = target; Vector cpy = new Vector(); @@ -421,11 +436,11 @@ namespace Boare.Lib.Vsq { public static VsqCommand generateCommandTrackCurveEdit( int track, String target, Vector edit ) { VsqCommand command = new VsqCommand(); command.Type = VsqCommandType.TRACK_CURVE_EDIT; - command.Args = new object[5]; + command.Args = new Object[3]; command.Args[0] = track; command.Args[1] = target; Vector copied = new Vector(); - for ( Iterator itr = edit.iterator(); itr.hasNext(); ){ + for ( Iterator itr = edit.iterator(); itr.hasNext(); ) { BPPair item = (BPPair)itr.next(); copied.add( item ); } @@ -433,22 +448,107 @@ namespace Boare.Lib.Vsq { return command; } - public static VsqCommand generateCommandTrackCurveEditRange( int track, String[] targets, Vector[] edits ) { + /// + /// コントロールカーブを編集するコマンドを発行します. + /// + /// 編集対象のコントロールカーブが含まれるトラックの番号 + /// 編集対象のコントロールカーブ名 + /// 削除を行うデータ点のリスト + /// 追加または移動を行うデータ点のリスト + /// + public static VsqCommand generateCommandTrackCurveEdit2( int track, String target, Vector delete, TreeMap add ) { + VsqCommand command = new VsqCommand(); + command.Type = VsqCommandType.TRACK_CURVE_EDIT2; + command.Args = new Object[4]; + command.Args[0] = track; + command.Args[1] = target; + Vector cp_delete = new Vector(); + for ( Iterator itr = delete.iterator(); itr.hasNext(); ) { + long id = (Long)itr.next(); + cp_delete.add( id ); + } + command.Args[2] = cp_delete; + + TreeMap cp_add = new TreeMap(); + for ( Iterator itr = add.keySet().iterator(); itr.hasNext(); ) { + int clock = (Integer)itr.next(); + VsqBPPair item = add.get( clock ); + cp_add.put( clock, item ); + } + command.Args[3] = cp_add; + return command; + } + + public static VsqCommand generateCommandTrackCurveEditRange( int track, Vector targets, Vector> edits ) { VsqCommand command = new VsqCommand(); command.Type = VsqCommandType.TRACK_CURVE_EDIT_RANGE; - command.Args = new object[3]; + command.Args = new Object[3]; command.Args[0] = track; - command.Args[1] = (String[])targets.Clone(); - Vector[] cpy = new Vector[targets.Length]; - for ( int i = 0; i < edits.Length; i++ ) { + Vector cp_targets = new Vector(); + int count = targets.size(); + for ( int i = 0; i < count; i++ ) { + cp_targets.add( targets.get( i ) ); + } + command.Args[1] = cp_targets; + Vector> cp_edits = new Vector>(); + count = edits.size(); + for ( int i = 0; i < count; i++ ) { Vector copied = new Vector(); - for ( Iterator itr = edits[i].iterator(); itr.hasNext(); ){ + for ( Iterator itr = edits.get( i ).iterator(); itr.hasNext(); ) { BPPair item = (BPPair)itr.next(); copied.add( new BPPair( item.Clock, item.Value ) ); } - cpy[i] = copied; + cp_edits.add( copied ); } - command.Args[2] = cpy; + command.Args[2] = cp_edits; + return command; + } + + /// + /// コントロールカーブを編集するコマンドを発行します. + /// + /// 編集対象のコントロールカーブが含まれるトラックの番号 + /// 編集対象のコントロールカーブ名 + /// 削除を行うデータ点のリスト + /// 追加または移動を行うデータ点のリスト + /// + public static VsqCommand generateCommandTrackCurveEdit2All( int track, Vector target, Vector> delete, Vector> add ) { + VsqCommand command = new VsqCommand(); + command.Type = VsqCommandType.TRACK_CURVE_EDIT2_ALL; + command.Args = new Object[4]; + command.Args[0] = track; + Vector cp_target = new Vector(); + int c = target.size(); + for ( int i = 0; i < c; i++ ) { + cp_target.add( target.get( i ) ); + } + command.Args[1] = cp_target; + + Vector> cp_vec_delete = new Vector>(); + c = delete.size(); + for ( int i = 0; i < c; i++ ) { + Vector cp_delete = new Vector(); + for ( Iterator itr = delete.get( i ).iterator(); itr.hasNext(); ) { + long id = (Long)itr.next(); + cp_delete.add( id ); + } + cp_vec_delete.add( cp_delete ); + } + command.Args[2] = cp_vec_delete; + + Vector> cp_vec_add = new Vector>(); + c = add.size(); + for ( int i = 0; i < c; i++ ) { + TreeMap cp_add = new TreeMap(); + TreeMap tmp = add.get( i ); + for ( Iterator itr = tmp.keySet().iterator(); itr.hasNext(); ) { + int clock = (Integer)itr.next(); + VsqBPPair item = tmp.get( clock ); + cp_add.put( clock, item ); + } + cp_vec_add.add( cp_add ); + } + command.Args[3] = cp_vec_add; return command; } @@ -463,7 +563,7 @@ namespace Boare.Lib.Vsq { public static VsqCommand generateCommandEventChangeLyric( int track, int internal_id, String phrase, String phonetic_symbol, boolean protect_symbol ) { VsqCommand command = new VsqCommand(); command.Type = VsqCommandType.EVENT_CHANGE_LYRIC; - command.Args = new object[5]; + command.Args = new Object[5]; command.Args[0] = track; command.Args[1] = internal_id; command.Args[2] = phrase; @@ -482,19 +582,19 @@ namespace Boare.Lib.Vsq { public static VsqCommand generateCommandEventChangeClock( int track, int internal_id, int value ) { VsqCommand command = new VsqCommand(); command.Type = VsqCommandType.EVENT_CHANGE_CLOCK; - command.Args = new object[3]; + command.Args = new Object[3]; command.Args[0] = track; command.Args[1] = internal_id; command.Args[2] = value; return command; } - public static VsqCommand generateCommandEventDeleteRange( int track, int[] internal_ids ) { + public static VsqCommand generateCommandEventDeleteRange( int track, Vector internal_ids ) { VsqCommand command = new VsqCommand(); command.Type = VsqCommandType.EVENT_DELETE_RANGE; - command.Args = new object[2]; - command.Args[0] = (int[])internal_ids.Clone(); - command.Args[1] = track; + command.Args = new Object[2]; + command.Args[0] = track; + command.Args[1] = copyIntVector( internal_ids ); return command; } @@ -506,18 +606,22 @@ namespace Boare.Lib.Vsq { public static VsqCommand generateCommandEventDelete( int track, int internal_id ) { VsqCommand command = new VsqCommand(); command.Type = VsqCommandType.EVENT_DELETE; - command.Args = new object[2]; - command.Args[1] = track; - command.Args[0] = internal_id; + command.Args = new Object[2]; + command.Args[0] = track; + command.Args[1] = internal_id; return command; } public static VsqCommand generateCommandEventAddRange( int track, VsqEvent[] items ) { VsqCommand command = new VsqCommand(); command.Type = VsqCommandType.EVENT_ADD_RANGE; - command.Args = new object[2]; + command.Args = new Object[2]; command.Args[0] = track; - command.Args[1] = (VsqEvent[])items.Clone(); + VsqEvent[] cp_items = new VsqEvent[items.Length]; + for ( int i = 0; i < items.Length; i++ ) { + cp_items[i] = (VsqEvent)items[i].clone(); + } + command.Args[1] = cp_items; return command; } @@ -530,7 +634,7 @@ namespace Boare.Lib.Vsq { public static VsqCommand generateCommandEventAdd( int track, VsqEvent item ) { VsqCommand command = new VsqCommand(); command.Type = VsqCommandType.EVENT_ADD; - command.Args = new object[2]; + command.Args = new Object[2]; command.Args[0] = track; command.Args[1] = (VsqEvent)item.clone(); return command; @@ -546,7 +650,7 @@ namespace Boare.Lib.Vsq { public static VsqCommand generateCommandEventChangeNote( int track, int internal_id, int note ) { VsqCommand command = new VsqCommand(); command.Type = VsqCommandType.EVENT_CHANGE_NOTE; - command.Args = new object[3]; + command.Args = new Object[3]; command.Args[0] = track; command.Args[1] = internal_id; command.Args[2] = note; @@ -563,13 +667,32 @@ namespace Boare.Lib.Vsq { public static VsqCommand generateCommandEventChangeClockAndNote( int track, int internal_id, int clock, int note ) { VsqCommand command = new VsqCommand(); command.Type = VsqCommandType.EVENT_CHANGE_CLOCK_AND_NOTE; - command.Args = new object[4]; + command.Args = new Object[4]; command.Args[0] = track; command.Args[1] = internal_id; command.Args[2] = clock; command.Args[3] = note; return command; } + + private static int[] copyIntArray( int[] value ) { + int[] ret = new int[value.Length]; + for ( int i = 0; i < value.Length; i++ ) { + ret[i] = value[i]; + } + return ret; + } + + private static Vector copyIntVector( Vector value ) { + Vector ret = new Vector(); + int count = value.size(); + for ( int i = 0; i < count; i++ ) { + ret.add( value.get( i ) ); + } + return ret; + } } +#if !JAVA } +#endif diff --git a/trunk/Boare.Lib.Vsq/VsqCommandType.cs b/trunk/Boare.Lib.Vsq/VsqCommandType.cs index 14c6109..4399f91 100644 --- a/trunk/Boare.Lib.Vsq/VsqCommandType.cs +++ b/trunk/Boare.Lib.Vsq/VsqCommandType.cs @@ -11,7 +11,11 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */ +#if JAVA +package org.kbinani.vsq; +#else namespace Boare.Lib.Vsq { +#endif public enum VsqCommandType { ROOT, @@ -24,6 +28,8 @@ namespace Boare.Lib.Vsq { EVENT_CHANGE_CLOCK_AND_NOTE, TRACK_CURVE_EDIT, TRACK_CURVE_EDIT_RANGE, + TRACK_CURVE_EDIT2, + TRACK_CURVE_EDIT2_ALL, //TRACK_CURVE_REMOVE_POINTS, TRACK_CURVE_REPLACE, TRACK_CURVE_REPLACE_RANGE, @@ -52,4 +58,6 @@ namespace Boare.Lib.Vsq { EVENT_REPLACE_RANGE, } +#if !JAVA } +#endif diff --git a/trunk/Boare.Lib.Vsq/VsqCommon.cs b/trunk/Boare.Lib.Vsq/VsqCommon.cs new file mode 100644 index 0000000..c20e917 --- /dev/null +++ b/trunk/Boare.Lib.Vsq/VsqCommon.cs @@ -0,0 +1,194 @@ +/* + * VsqCommon.cs + * Copyright (c) 2008-2009 kbinani + * + * This file is part of Boare.Lib.Vsq. + * + * Boare.Lib.Vsq is free software; you can redistribute it and/or + * modify it under the terms of the BSD License. + * + * Boare.Lib.Vsq 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. +*/ +#if JAVA +package org.kbinani.vsq; + +import java.io.*; +import org.kbinani.*; +#else +using System; +using bocoree; +using bocoree.java.io; + +namespace Boare.Lib.Vsq { + + using boolean = System.Boolean; +#endif + + /// + /// vsqファイルのメタテキストの[Common]セクションに記録される内容を取り扱う + /// +#if JAVA + public class VsqCommon implements Cloneable, Serializable { +#else + [Serializable] + public class VsqCommon : ICloneable { +#endif + public String Version; + public String Name; + public String Color; + public int DynamicsMode; + public int PlayMode = 1; + +#if !JAVA + public object Clone() { + return clone(); + } +#endif + + public Object clone() { + String[] spl = PortUtil.splitString( Color, new char[] { ',' }, 3 ); + int r = PortUtil.parseInt( spl[0] ); + int g = PortUtil.parseInt( spl[1] ); + int b = PortUtil.parseInt( spl[2] ); + VsqCommon res = new VsqCommon( Name, r, g, b, DynamicsMode, PlayMode ); + res.Version = Version; + return res; + } + + /// + /// 各パラメータを指定したコンストラクタ + /// + /// トラック名 + /// Color値(意味は不明) + /// DynamicsMode(デフォルトは1) + /// PlayMode(デフォルトは1) + public VsqCommon( String name, int red, int green, int blue, int dynamics_mode, int play_mode ) { + this.Version = "DSB301"; + this.Name = name; + this.Color = red + "," + green + "," + blue; + this.DynamicsMode = dynamics_mode; + this.PlayMode = play_mode; + } + +#if JAVA + public VsqCommon(){ + this( "Miku", 179, 181, 123, 1, 1 ); +#else + public VsqCommon() + : this( "Miku", 179, 181, 123, 1, 1 ) { +#endif + } + + /// + /// MetaTextのテキストファイルからのコンストラクタ + /// + /// 読み込むテキストファイル + /// 読み込んだ最後の行が返される + public VsqCommon( TextMemoryStream sr, ByRef last_line ) { + Version = ""; + Name = ""; + Color = "0,0,0"; + DynamicsMode = 0; + PlayMode = 1; + last_line.value = sr.readLine(); + String[] spl; + while ( !last_line.value.StartsWith( "[" ) ) { + spl = PortUtil.splitString( last_line.value, new char[] { '=' } ); + String search = spl[0]; + if ( search.Equals( "Version" ) ) { + this.Version = spl[1]; + } else if ( search.Equals( "Name" ) ) { + this.Name = spl[1]; + } else if ( search.Equals( "Color" ) ) { + this.Color = spl[1]; + } else if ( search.Equals( "DynamicsMode" ) ) { + this.DynamicsMode = PortUtil.parseInt( spl[1] ); + } else if ( search.Equals( "PlayMode" ) ) { + this.PlayMode = PortUtil.parseInt( spl[1] ); + } + if ( sr.peek() < 0 ) { + break; + } + last_line.value = sr.readLine(); + } + } + + /// + /// インスタンスの内容をテキストファイルに出力します + /// + /// 出力先 + public void write( TextMemoryStream sw ) { + sw.writeLine( "[Common]" ); + sw.writeLine( "Version=" + Version ); + sw.writeLine( "Name=" + Name ); + sw.writeLine( "Color=" + Color ); + sw.writeLine( "DynamicsMode=" + DynamicsMode ); + sw.writeLine( "PlayMode=" + PlayMode ); + } + + /// + /// VsqCommon構造体を構築するテストを行います + /// + /// テストに成功すればtrue、そうでなければfalse + public static boolean test() +#if JAVA + throws IOException +#endif + { + String fpath = PortUtil.createTempFile(); + BufferedWriter sw = new BufferedWriter( new FileWriter( fpath ) ); + sw.write( "Version=DSB301" ); + sw.newLine(); + sw.write( "Name=Voice1" ); + sw.newLine(); + sw.write( "Color=181,162,123" ); + sw.newLine(); + sw.write( "DynamicsMode=1" ); + sw.newLine(); + sw.write( "PlayMode=1" ); + sw.newLine(); + sw.write( "[Master]" ); + sw.newLine(); + sw.close(); + + VsqCommon vsqCommon = null; + ByRef last_line = new ByRef( "" ); + TextMemoryStream sr = null; + try { + sr = new TextMemoryStream( fpath, "UTF8" ); + vsqCommon = new VsqCommon( sr, last_line ); + } catch ( Exception ex ) { + } finally { + if ( sr != null ) { + try { + sr.close(); + } catch ( Exception ex2 ) { + } + } + } + if ( vsqCommon == null ) { + vsqCommon = new VsqCommon(); + } + + boolean result; + if ( vsqCommon.Version.Equals( "DSB301" ) && + vsqCommon.Name.Equals( "Voice1" ) && + vsqCommon.Color.Equals( "181,162,123" ) && + vsqCommon.DynamicsMode == 1 && + vsqCommon.PlayMode == 1 && + last_line.value.Equals( "[Master]" ) ) { + result = true; + } else { + result = false; + } + + PortUtil.deleteFile( fpath ); + return result; + } + } + +#if !JAVA +} +#endif diff --git a/trunk/Boare.Lib.Vsq/VsqEvent.cs b/trunk/Boare.Lib.Vsq/VsqEvent.cs index 420538e..d62930d 100644 --- a/trunk/Boare.Lib.Vsq/VsqEvent.cs +++ b/trunk/Boare.Lib.Vsq/VsqEvent.cs @@ -11,17 +11,30 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */ -using System; +#if JAVA +package org.kbinani.vsq; +import java.io.*; +import java.util.*; +import org.kbinani.*; +#else +using System; using bocoree; +using bocoree.java.util; +using bocoree.java.io; namespace Boare.Lib.Vsq { +#endif /// /// vsqファイルのメタテキスト内に記述されるイベント。 /// +#if JAVA + public class VsqEvent implements Comparable, Cloneable, Serializable { +#else [Serializable] public class VsqEvent : IComparable, ICloneable { +#endif public String Tag; /// /// 内部で使用するインスタンス固有のID @@ -31,6 +44,75 @@ namespace Boare.Lib.Vsq { public VsqID ID; public UstEvent UstEvent = new UstEvent(); + /// + /// インスタンスをテキストファイルに出力します + /// + /// 出力先 + public void write( TextMemoryStream sw ) +#if JAVA + throws IOException +#endif + { + Vector def = new Vector( Arrays.asList( new String[]{ "Length", + "Note#", + "Dynamics", + "PMBendDepth", + "PMBendLength", + "PMbPortamentoUse", + "DEMdecGainRate", + "DEMaccent" } ) ); + write( sw, def ); + } + + public void write( TextMemoryStream writer, Vector print_targets ) +#if JAVA + throws IOException +#endif + { + writeCor( writer, print_targets ); + } + + public void write( BufferedWriter writer, Vector print_targets ) +#if JAVA + throws IOException +#endif + { + writeCor( new WrappedStreamWriter( writer ), print_targets ); + } + + private void writeCor( ITextWriter writer, Vector print_targets ) +#if JAVA + throws IOException +#endif + { + writer.writeLine( "[ID#" + PortUtil.formatDecimal( "0000", ID.value ) + "]" ); + writer.writeLine( "Type=" + ID.type ); + if ( ID.type == VsqIDType.Anote ) { + if ( print_targets.contains( "Length" ) ) writer.writeLine( "Length=" + ID.getLength() ); + if ( print_targets.contains( "Note#" ) ) writer.writeLine( "Note#=" + ID.Note ); + if ( print_targets.contains( "Dynamics" ) ) writer.writeLine( "Dynamics=" + ID.Dynamics ); + if ( print_targets.contains( "PMBendDepth" ) ) writer.writeLine( "PMBendDepth=" + ID.PMBendDepth ); + if ( print_targets.contains( "PMBendLength" ) ) writer.writeLine( "PMBendLength=" + ID.PMBendLength ); + if ( print_targets.contains( "PMbPortamentoUse" ) ) writer.writeLine( "PMbPortamentoUse=" + ID.PMbPortamentoUse ); + if ( print_targets.contains( "DEMdecGainRate" ) ) writer.writeLine( "DEMdecGainRate=" + ID.DEMdecGainRate ); + if ( print_targets.contains( "DEMaccent" ) ) writer.writeLine( "DEMaccent=" + ID.DEMaccent ); + if ( print_targets.contains( "PreUtterance" ) ) writer.writeLine( "PreUtterance=" + UstEvent.PreUtterance ); + if ( print_targets.contains( "VoiceOverlap" ) ) writer.writeLine( "VoiceOverlap=" + UstEvent.VoiceOverlap ); + if ( ID.LyricHandle != null ) { + writer.writeLine( "LyricHandle=h#" + PortUtil.formatDecimal( "0000", ID.LyricHandle_index ) ); + } + if ( ID.VibratoHandle != null ) { + writer.writeLine( "VibratoHandle=h#" + PortUtil.formatDecimal( "0000", ID.VibratoHandle_index ) ); + writer.writeLine( "VibratoDelay=" + ID.VibratoDelay ); + } + if ( ID.NoteHeadHandle != null ) { + writer.writeLine( "NoteHeadHandle=h#" + PortUtil.formatDecimal( "0000", ID.NoteHeadHandle_index ) ); + } + } else if ( ID.type == VsqIDType.Singer ) { + writer.writeLine( "IconHandle=h#" + PortUtil.formatDecimal( "0000", ID.IconHandle_index ) ); + } + } + /// /// このオブジェクトのコピーを作成します /// @@ -39,21 +121,33 @@ namespace Boare.Lib.Vsq { VsqEvent ret = new VsqEvent( Clock, (VsqID)ID.clone() ); ret.InternalID = InternalID; if ( UstEvent != null ) { - ret.UstEvent = (UstEvent)UstEvent.Clone(); + ret.UstEvent = (UstEvent)UstEvent.clone(); } ret.Tag = Tag; return ret; } +#if !JAVA public object Clone() { return clone(); } +#endif +#if !JAVA public int CompareTo( VsqEvent item ) { + return compareTo( item ); + } +#endif + + public int compareTo( VsqEvent item ) { int ret = this.Clock - item.Clock; if ( ret == 0 ) { if ( this.ID != null && item.ID != null ) { +#if JAVA + return this.ID.type.ordinal() - item.ID.type.ordinal(); +#else return (int)this.ID.type - (int)item.ID.type; +#endif } else { return ret; } @@ -63,15 +157,20 @@ namespace Boare.Lib.Vsq { } public VsqEvent( String line ) { - String[] spl = line.Split( new char[] { '=' } ); - Clock = int.Parse( spl[0] ); + String[] spl = PortUtil.splitString( line, new char[] { '=' } ); + Clock = PortUtil.parseInt( spl[0] ); if ( spl[1].Equals( "EOS" ) ) { ID = VsqID.EOS; } } +#if JAVA + public VsqEvent(){ + this( 0, new VsqID() ); +#else public VsqEvent() : this( 0, new VsqID() ) { +#endif } public VsqEvent( int clock, VsqID id /*, int internal_id*/ ) { @@ -82,4 +181,6 @@ namespace Boare.Lib.Vsq { } } +#if !JAVA } +#endif diff --git a/trunk/Boare.Lib.Vsq/VsqEventList.cs b/trunk/Boare.Lib.Vsq/VsqEventList.cs index 35eb31a..4bdf9cf 100644 --- a/trunk/Boare.Lib.Vsq/VsqEventList.cs +++ b/trunk/Boare.Lib.Vsq/VsqEventList.cs @@ -11,31 +11,42 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */ -using System; -using System.Collections.Generic; +#if JAVA +package org.kbinani.vsq; +import java.io.*; +import java.util.*; +#else +using System; using bocoree; +using bocoree.java.util; namespace Boare.Lib.Vsq { + using Integer = System.Int32; +#endif /// /// 固有ID付きのVsqEventのリストを取り扱う /// +#if JAVA + public class VsqEventList implements Serializable { +#else [Serializable] public class VsqEventList { +#endif public Vector Events; - private Vector m_ids; + private Vector m_ids; /// /// コンストラクタ /// public VsqEventList() { Events = new Vector(); - m_ids = new Vector(); + m_ids = new Vector(); } public VsqEvent findFromID( int internal_id ) { - for ( Iterator itr = Events.iterator(); itr.hasNext(); ){ + for ( Iterator itr = Events.iterator(); itr.hasNext(); ) { VsqEvent item = (VsqEvent)itr.next(); if ( item.InternalID == internal_id ) { return item; @@ -68,17 +79,21 @@ namespace Boare.Lib.Vsq { public Iterator iterator() { updateIDList(); - return new ListIterator( Events ); + return Events.iterator(); } public void add( VsqEvent item ) { + add( item, getNextId( 0 ) ); + } + + public void add( VsqEvent item, int internal_id ) { updateIDList(); - int new_id = getNextId( 0 ); - item.InternalID = new_id; + item.InternalID = internal_id; Events.add( item ); - m_ids.add( new_id ); + m_ids.add( internal_id ); Collections.sort( Events ); - for ( int i = 0; i < Events.size(); i++ ) { + int count = Events.size(); + for ( int i = 0; i < count; i++ ) { m_ids.set( i, Events.get( i ).InternalID ); } } @@ -92,7 +107,7 @@ namespace Boare.Lib.Vsq { private int getNextId( int next ) { updateIDList(); int index = -1; - Vector current = new Vector( m_ids ); + Vector current = new Vector( m_ids ); int nfound = 0; while ( true ) { index++; @@ -116,21 +131,26 @@ namespace Boare.Lib.Vsq { } public void setElement( int index, VsqEvent value ) { + value.InternalID = Events.get( index ).InternalID; Events.set( index, value ); } public void updateIDList() { if ( m_ids.size() != Events.size() ) { m_ids.clear(); - for ( int i = 0; i < Events.size(); i++ ) { + int count = Events.size(); + for ( int i = 0; i < count; i++ ) { m_ids.add( Events.get( i ).InternalID ); } } else { - for ( int i = 0; i < Events.size(); i++ ) { + int count = Events.size(); + for ( int i = 0; i < count; i++ ) { m_ids.set( i, Events.get( i ).InternalID ); } } } } +#if !JAVA } +#endif diff --git a/trunk/Boare.Lib.Vsq/VsqFile.cs b/trunk/Boare.Lib.Vsq/VsqFile.cs index eb49640..87b0b91 100644 --- a/trunk/Boare.Lib.Vsq/VsqFile.cs +++ b/trunk/Boare.Lib.Vsq/VsqFile.cs @@ -11,24 +11,34 @@ * 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.IO; -using System.Text; +#define NEW_IMPL +#if JAVA +package org.kbinani.vsq; +import java.util.*; +import java.io.*; +import org.kbinani.*; +#else +using System; using bocoree; +using bocoree.java.util; +using bocoree.java.io; namespace Boare.Lib.Vsq { - using boolean = System.Boolean; using Integer = Int32; - using Long = Int64; + using Long = System.Int64; +#endif /// /// VSQファイルの内容を保持するクラス /// +#if JAVA + public class VsqFile implements Cloneable, Serializable{ +#else [Serializable] public class VsqFile : ICloneable { +#endif /// /// トラックのリスト.最初のトラックはMasterTrackであり,通常の音符が格納されるトラックはインデックス1以降となる /// @@ -36,11 +46,7 @@ namespace Boare.Lib.Vsq { /// /// テンポ情報を保持したテーブル /// -#if USE_TEMPO_LIST - protected TempoTable m_tempo_table; -#else public Vector TempoTable; -#endif public Vector TimesigTable; protected int m_tpq; /// @@ -50,19 +56,151 @@ namespace Boare.Lib.Vsq { protected int m_base_tempo; public VsqMaster Master; // VsqMaster, VsqMixerは通常,最初の非Master Trackに記述されるが,可搬性のため, public VsqMixer Mixer; // ここではVsqFileに直属するものとして取り扱う. - public object Tag; + public Object Tag; - static readonly byte[] _MTRK = new byte[] { 0x4d, 0x54, 0x72, 0x6b }; - static readonly byte[] _MTHD = new byte[] { 0x4d, 0x54, 0x68, 0x64 }; - static readonly byte[] _MASTER_TRACK = new byte[] { 0x4D, 0x61, 0x73, 0x74, 0x65, 0x72, 0x20, 0x54, 0x72, 0x61, 0x63, 0x6B, }; + static readonly byte[] _MTRK = new byte[] { (byte)0x4d, (byte)0x54, (byte)0x72, (byte)0x6b }; + static readonly byte[] _MTHD = new byte[] { (byte)0x4d, (byte)0x54, (byte)0x68, (byte)0x64 }; + static readonly byte[] _MASTER_TRACK = new byte[] { (byte)0x4D, (byte)0x61, (byte)0x73, (byte)0x74, (byte)0x65, (byte)0x72, (byte)0x20, (byte)0x54, (byte)0x72, (byte)0x61, (byte)0x63, (byte)0x6B, }; static readonly String[] _CURVES = new String[] { "VEL", "DYN", "BRE", "BRI", "CLE", "OPE", "GEN", "POR", "PIT", "PBS" }; +#if JAVA + public VsqFile( UstFile ust ){ + this( "Miku", 1, 4, 4, ust.getBaseTempo() ); +#else + public VsqFile( UstFile ust ) + : this( "Miku", 1, 4, 4, ust.getBaseTempo() ) { +#endif + int clock_count = 480 * 4; //pre measure = 1、4分の4拍子としたので + VsqBPList pitch = new VsqBPList( 0, -2400, 2400 ); // ノートナンバー×100 + for ( Iterator itr = ust.getTrack( 0 ).getNoteEventIterator(); itr.hasNext(); ) { + UstEvent ue = (UstEvent)itr.next(); + if ( ue.Lyric != "R" ) { + VsqID id = new VsqID( 0 ); + id.setLength( ue.getLength() ); + ByRef psymbol = new ByRef( "a" ); + if ( !SymbolTable.attatch( ue.Lyric, psymbol ) ) { + psymbol.value = "a"; + } + id.LyricHandle = new LyricHandle( ue.Lyric, psymbol.value ); + id.Note = ue.Note; + id.type = VsqIDType.Anote; + VsqEvent ve = new VsqEvent( clock_count, id ); + ve.UstEvent = (UstEvent)ue.clone(); + Track.get( 1 ).addEvent( ve ); + + if ( ue.Pitches != null ) { + // PBTypeクロックごとにデータポイントがある + int clock = clock_count - ue.PBType; + for ( int i = 0; i < ue.Pitches.Length; i++ ) { + clock += ue.PBType; + pitch.add( clock, (int)ue.Pitches[i] ); + } + } + } + if ( ue.Tempo > 0.0f ) { + TempoTable.add( new TempoTableEntry( clock_count, (int)(60e6 / ue.Tempo), 0.0 ) ); + } + clock_count += ue.getLength(); + } + updateTempoInfo(); + updateTotalClocks(); + updateTimesigInfo(); + reflectPitch( this, 1, pitch ); + } + + /// + /// master==MasterPitchControl.Pitchの場合、m_pitchからPITとPBSを再構成。 + /// master==MasterPitchControl.PITandPBSの場合、PITとPBSからm_pitchを再構成 + /// + private static void reflectPitch( VsqFile vsq, int track, VsqBPList pitch ) { + //double offset = AttachedCurves[track - 1].MasterTuningInCent * 100; + //Vector keyclocks = new Vector( pitch.getKeys() ); + int keyclock_size = pitch.size(); + VsqBPList pit = new VsqBPList( 0, -8192, 8191 ); + VsqBPList pbs = new VsqBPList( 2, 0, 24 ); + int premeasure_clock = vsq.getPreMeasureClocks(); + int lastpit = pit.getDefault(); + int lastpbs = pbs.getDefault(); + int vpbs = 24; + int vpit = 0; + + Vector parts = new Vector(); // 連続した音符ブロックの先頭音符のクロック位置。のリスト + parts.add( premeasure_clock ); + int lastclock = premeasure_clock; + for ( Iterator itr = vsq.Track.get( track ).getNoteEventIterator(); itr.hasNext(); ) { + VsqEvent ve = (VsqEvent)itr.next(); + if ( ve.Clock <= lastclock ) { + lastclock = Math.Max( lastclock, ve.Clock + ve.ID.getLength() ); + } else { + parts.add( ve.Clock ); + lastclock = ve.Clock + ve.ID.getLength(); + } + } + + int parts_size = parts.size(); + for ( int i = 0; i < parts_size; i++ ) { + int partstart = parts.get( i ); + int partend = int.MaxValue; + if ( i + 1 < parts.size() ) { + partend = parts.get( i + 1 ); + } + + // まず、区間内の最大ピッチベンド幅を調べる + double max = 0; + for ( int j = 0; j < keyclock_size; j++ ) { + int clock = pitch.getKeyClock( j ); + if ( clock < partstart ) { + continue; + } + if ( partend <= clock ) { + break; + } + max = Math.Max( max, Math.Abs( pitch.getValue( clock ) / 100.0 ) ); + } + + // 最大ピッチベンド幅を表現できる最小のPBSを計算 + vpbs = (int)(Math.Ceiling( max * 8192.0 / 8191.0 ) + 0.1); + if ( vpbs <= 0 ) { + vpbs = 1; + } + double pitch2 = pitch.getValue( partstart ) / 100.0; + if ( lastpbs != vpbs ) { + pbs.add( partstart, vpbs ); + lastpbs = vpbs; + } + vpit = (int)(pitch2 * 8192 / (double)vpbs); + if ( lastpit != vpit ) { + pit.add( partstart, vpit ); + lastpit = vpit; + } + for ( int j = 0; j < keyclock_size; j++ ) { + int clock = pitch.getKeyClock( j ); + if ( clock < partstart ) { + continue; + } + if ( partend <= clock ) { + break; + } + if ( clock != partstart ) { + pitch2 = pitch.getElement( j ) / 100.0; + vpit = (int)(pitch2 * 8192 / (double)vpbs); + if ( lastpit != vpit ) { + pit.add( clock, vpit ); + lastpit = vpit; + } + } + } + } + vsq.Track.get( track ).setCurve( "pit", pit ); + vsq.Track.get( track ).setCurve( "pbs", pbs ); + } + /// /// プリセンドタイムの妥当性を判定します /// /// /// - public bool checkPreSendTimeValidity( int ms_pre_send_time ) { + public boolean checkPreSendTimeValidity( int ms_pre_send_time ) { int track_count = Track.size(); for ( int i = 1; i < track_count; i++ ) { VsqTrack track = Track.get( i ); @@ -99,38 +237,38 @@ namespace Boare.Lib.Vsq { /// 編集結果を元に戻すためのコマンドを返します public VsqCommand executeCommand( VsqCommand command ) { #if DEBUG - Console.WriteLine( "VsqFile.Execute(VsqCommand)" ); - Console.WriteLine( " type=" + command.Type ); + PortUtil.println( "VsqFile.Execute(VsqCommand)" ); + PortUtil.println( " type=" + command.Type ); #endif VsqCommandType type = command.Type; if ( type == VsqCommandType.CHANGE_PRE_MEASURE ) { - #region ChangePreMeasure + #region CHANGE_PRE_MEASURE VsqCommand ret = VsqCommand.generateCommandChangePreMeasure( Master.PreMeasure ); - int value = (int)command.Args[0]; + int value = (Integer)command.Args[0]; Master.PreMeasure = value; updateTimesigInfo(); return ret; #endregion } else if ( type == VsqCommandType.TRACK_ADD ) { - #region AddTrack + #region TRACK_ADD #if DEBUG System.Diagnostics.Debug.WriteLine( " AddTrack" ); #endif VsqTrack track = (VsqTrack)command.Args[0]; VsqMixerEntry mixer = (VsqMixerEntry)command.Args[1]; - int position = (int)command.Args[2]; + int position = (Integer)command.Args[2]; VsqCommand ret = VsqCommand.generateCommandDeleteTrack( position ); if ( Track.size() <= 17 ) { - Track.insertElementAt( (VsqTrack)track.Clone(), position ); - Mixer.Slave.add( (VsqMixerEntry)mixer.Clone() ); + Track.insertElementAt( (VsqTrack)track.clone(), position ); + Mixer.Slave.add( (VsqMixerEntry)mixer.clone() ); return ret; } else { return null; } #endregion } else if ( type == VsqCommandType.TRACK_DELETE ) { - #region DeleteTrack - int track = (int)command.Args[0]; + #region TRACK_DELETE + int track = (Integer)command.Args[0]; VsqCommand ret = VsqCommand.generateCommandAddTrack( Track.get( track ), Mixer.Slave.get( track - 1 ), track ); Track.removeElementAt( track ); Mixer.Slave.removeElementAt( track - 1 ); @@ -138,10 +276,10 @@ namespace Boare.Lib.Vsq { return ret; #endregion } else if ( type == VsqCommandType.UPDATE_TEMPO ) { - #region UpdateTempo - int clock = (int)command.Args[0]; - int tempo = (int)command.Args[1]; - int new_clock = (int)command.Args[2]; + #region UPDATE_TEMPO + int clock = (Integer)command.Args[0]; + int tempo = (Integer)command.Args[1]; + int new_clock = (Integer)command.Args[2]; int index = -1; int c = TempoTable.size(); @@ -158,8 +296,8 @@ namespace Boare.Lib.Vsq { TempoTable.removeElementAt( index ); } else { ret = VsqCommand.generateCommandUpdateTempo( new_clock, clock, TempoTable.get( index ).Tempo ); - TempoTable.get( index ).Tempo= tempo ; - TempoTable.get( index ).Clock= new_clock ; + TempoTable.get( index ).Tempo = tempo; + TempoTable.get( index ).Clock = new_clock; } } else { ret = VsqCommand.generateCommandUpdateTempo( clock, clock, -1 ); @@ -180,7 +318,7 @@ namespace Boare.Lib.Vsq { return ret; #endregion } else if ( type == VsqCommandType.UPDATE_TEMPO_RANGE ) { - #region UpdateTempoRange + #region UPDATE_TEMPO_RANGE int[] clocks = (int[])command.Args[0]; int[] tempos = (int[])command.Args[1]; int[] new_clocks = (int[])command.Args[2]; @@ -222,11 +360,11 @@ namespace Boare.Lib.Vsq { return VsqCommand.generateCommandUpdateTempoRange( new_clocks, clocks, new_tempos ); #endregion } else if ( type == VsqCommandType.UPDATE_TIMESIG ) { - #region UpdateTimesig - int barcount = (int)command.Args[0]; - int numerator = (int)command.Args[1]; - int denominator = (int)command.Args[2]; - int new_barcount = (int)command.Args[3]; + #region UPDATE_TIMESIG + int barcount = (Integer)command.Args[0]; + int numerator = (Integer)command.Args[1]; + int denominator = (Integer)command.Args[2]; + int new_barcount = (Integer)command.Args[3]; int index = -1; int timesig_table_count = TimesigTable.size(); for ( int i = 0; i < timesig_table_count; i++ ) { @@ -255,7 +393,7 @@ namespace Boare.Lib.Vsq { return ret; #endregion } else if ( type == VsqCommandType.UPDATE_TIMESIG_RANGE ) { - #region UpdateTimesigRange + #region UPDATE_TIMESIG_RANGE int[] barcounts = (int[])command.Args[0]; int[] numerators = (int[])command.Args[1]; int[] denominators = (int[])command.Args[2]; @@ -295,39 +433,37 @@ namespace Boare.Lib.Vsq { return VsqCommand.generateCommandUpdateTimesigRange( new_barcounts, barcounts, new_numerators, new_denominators ); #endregion } else if ( type == VsqCommandType.REPLACE ) { - #region Replace + #region REPLACE VsqFile vsq = (VsqFile)command.Args[0]; - VsqFile inv = (VsqFile)this.Clone(); + VsqFile inv = (VsqFile)this.clone(); Track.clear(); int track_count = vsq.Track.size(); for ( int i = 0; i < track_count; i++ ) { - Track.add( (VsqTrack)vsq.Track.get( i ).Clone() ); + Track.add( (VsqTrack)vsq.Track.get( i ).clone() ); } -#if USE_TEMPO_LIST - m_tempo_table = (TempoTable)vsq.m_tempo_table.Clone(); -#else + TempoTable.clear(); int tempo_table_count = vsq.TempoTable.size(); for ( int i = 0; i < tempo_table_count; i++ ) { - TempoTable.add( (TempoTableEntry)vsq.TempoTable.get( i ).Clone() ); + TempoTable.add( (TempoTableEntry)vsq.TempoTable.get( i ).clone() ); } -#endif + TimesigTable.clear(); int timesig_table_count = vsq.TimesigTable.size(); for ( int i = 0; i < timesig_table_count; i++ ) { - TimesigTable.add( (TimeSigTableEntry)vsq.TimesigTable.get( i ).Clone() ); + TimesigTable.add( (TimeSigTableEntry)vsq.TimesigTable.get( i ).clone() ); } m_tpq = vsq.m_tpq; TotalClocks = vsq.TotalClocks; m_base_tempo = vsq.m_base_tempo; - Master = (VsqMaster)vsq.Master.Clone(); - Mixer = (VsqMixer)vsq.Mixer.Clone(); + Master = (VsqMaster)vsq.Master.clone(); + Mixer = (VsqMixer)vsq.Mixer.clone(); updateTotalClocks(); return VsqCommand.generateCommandReplace( inv ); #endregion } else if ( type == VsqCommandType.EVENT_ADD ) { - #region EventAdd - int track = (int)command.Args[0]; + #region EVENT_ADD + int track = (Integer)command.Args[0]; VsqEvent item = (VsqEvent)command.Args[1]; Track.get( track ).addEvent( item ); VsqCommand ret = VsqCommand.generateCommandEventDelete( track, item.InternalID ); @@ -335,49 +471,50 @@ namespace Boare.Lib.Vsq { if ( item.Clock < Track.get( track ).getEditedStart() ) { Track.get( track ).setEditedStart( item.Clock ); } - if ( Track.get( track ).getEditedEnd() < item.Clock + item.ID.Length ) { - Track.get( track ).setEditedEnd( item.Clock + item.ID.Length ); + if ( Track.get( track ).getEditedEnd() < item.Clock + item.ID.getLength() ) { + Track.get( track ).setEditedEnd( item.Clock + item.ID.getLength() ); } Track.get( track ).sortEvent(); return ret; #endregion } else if ( type == VsqCommandType.EVENT_ADD_RANGE ) { - #region TrackAddNoteRange + #region EVENT_ADD_RANGE #if DEBUG - Console.WriteLine( " TrackAddNoteRange" ); + PortUtil.println( " TrackAddNoteRange" ); #endif - int track = (int)command.Args[0]; + int track = (Integer)command.Args[0]; VsqEvent[] items = (VsqEvent[])command.Args[1]; - Vector inv_ids = new Vector(); + Vector inv_ids = new Vector(); int min_clock = (int)TotalClocks; int max_clock = 0; + VsqTrack target = Track.get( track ); for ( int i = 0; i < items.Length; i++ ) { VsqEvent item = (VsqEvent)items[i].clone(); min_clock = Math.Min( min_clock, item.Clock ); - max_clock = Math.Max( max_clock, item.Clock + item.ID.Length ); + max_clock = Math.Max( max_clock, item.Clock + item.ID.getLength() ); #if DEBUG Console.Write( " i=" + i + "; item.InternalID=" + item.InternalID ); #endif - Track.get( track ).addEvent( item ); + target.addEvent( item ); inv_ids.add( item.InternalID ); #if DEBUG - Console.WriteLine( " => " + item.InternalID ); + PortUtil.println( " => " + item.InternalID ); #endif } updateTotalClocks(); - if ( min_clock < Track.get( track ).getEditedStart() ) { - Track.get( track ).setEditedStart( min_clock ); + if ( min_clock < target.getEditedStart() ) { + target.setEditedStart( min_clock ); } - if ( Track.get( track ).getEditedEnd() < max_clock ) { - Track.get( track ).setEditedEnd( max_clock ); + if ( target.getEditedEnd() < max_clock ) { + target.setEditedEnd( max_clock ); } - Track.get( track ).sortEvent(); - return VsqCommand.generateCommandEventDeleteRange( track, inv_ids.toArray( new Integer[]{} ) ); + target.sortEvent(); + return VsqCommand.generateCommandEventDeleteRange( track, inv_ids ); #endregion } else if ( type == VsqCommandType.EVENT_DELETE ) { - #region TrackDeleteNote - int internal_id = (int)command.Args[0]; - int track = (int)command.Args[1]; + #region EVENT_DELETE + int track = (Integer)command.Args[0]; + int internal_id = (Integer)command.Args[1]; VsqEvent[] original = new VsqEvent[1]; VsqTrack target = Track.get( track ); for ( Iterator itr = target.getEventIterator(); itr.hasNext(); ) { @@ -390,8 +527,8 @@ namespace Boare.Lib.Vsq { if ( original[0].Clock < target.getEditedStart() ) { target.setEditedStart( original[0].Clock ); } - if ( target.getEditedEnd() < original[0].Clock + original[0].ID.Length ) { - target.setEditedEnd( original[0].Clock + original[0].ID.Length ); + if ( target.getEditedEnd() < original[0].Clock + original[0].ID.getLength() ) { + target.setEditedEnd( original[0].Clock + original[0].ID.getLength() ); } VsqCommand ret = VsqCommand.generateCommandEventAddRange( track, original ); int count = target.getEventCount(); @@ -405,20 +542,21 @@ namespace Boare.Lib.Vsq { return ret; #endregion } else if ( type == VsqCommandType.EVENT_DELETE_RANGE ) { - #region TrackDeleteNoteRange - int[] internal_ids = (int[])command.Args[0]; - int track = (int)command.Args[1]; + #region EVENT_DELETE_RANGE + Vector internal_ids = (Vector)command.Args[1]; + int track = (Integer)command.Args[0]; Vector inv = new Vector(); int min_clock = int.MaxValue; int max_clock = int.MinValue; VsqTrack target = this.Track.get( track ); - for ( int j = 0; j < internal_ids.Length; j++ ) { + int count = internal_ids.size(); + for ( int j = 0; j < count; j++ ) { for ( int i = 0; i < target.getEventCount(); i++ ) { VsqEvent item = target.getEvent( i ); - if ( internal_ids[j] == item.InternalID ) { + if ( internal_ids.get( j ) == item.InternalID ) { inv.add( (VsqEvent)item.clone() ); min_clock = Math.Min( min_clock, item.Clock ); - max_clock = Math.Max( max_clock, item.Clock + item.ID.Length ); + max_clock = Math.Max( max_clock, item.Clock + item.ID.getLength() ); target.removeEvent( i ); break; } @@ -427,36 +565,37 @@ namespace Boare.Lib.Vsq { updateTotalClocks(); target.setEditedStart( min_clock ); target.setEditedEnd( max_clock ); - return VsqCommand.generateCommandEventAddRange( track, inv.toArray( new VsqEvent[]{} ) ); + return VsqCommand.generateCommandEventAddRange( track, inv.toArray( new VsqEvent[] { } ) ); #endregion } else if ( type == VsqCommandType.EVENT_CHANGE_CLOCK ) { - #region TrackChangeClock - int track = (int)command.Args[0]; - int internal_id = (int)command.Args[1]; - int value = (int)command.Args[2]; + #region EVENT_CHANGE_CLOCK + int track = (Integer)command.Args[0]; + int internal_id = (Integer)command.Args[1]; + int value = (Integer)command.Args[2]; VsqTrack target = this.Track.get( track ); for ( Iterator itr = target.getEventIterator(); itr.hasNext(); ) { VsqEvent item = (VsqEvent)itr.next(); if ( item.InternalID == internal_id ) { VsqCommand ret = VsqCommand.generateCommandEventChangeClock( track, internal_id, item.Clock ); int min = Math.Min( item.Clock, value ); - int max = Math.Max( item.Clock + item.ID.Length, value + item.ID.Length ); + int max = Math.Max( item.Clock + item.ID.getLength(), value + item.ID.getLength() ); target.setEditedStart( min ); target.setEditedEnd( max ); item.Clock = value; updateTotalClocks(); + target.sortEvent(); return ret; } } return null; #endregion } else if ( type == VsqCommandType.EVENT_CHANGE_LYRIC ) { - #region TrackChangeLyric - int track = (int)command.Args[0]; - int internal_id = (int)command.Args[1]; + #region EVENT_CHANGE_LYRIC + int track = (Integer)command.Args[0]; + int internal_id = (Integer)command.Args[1]; String phrase = (String)command.Args[2]; String phonetic_symbol = (String)command.Args[3]; - boolean protect_symbol = (boolean)command.Args[4]; + boolean protect_symbol = (Boolean)command.Args[4]; VsqTrack target = this.Track.get( track ); for ( Iterator itr = target.getEventIterator(); itr.hasNext(); ) { VsqEvent item = (VsqEvent)itr.next(); @@ -467,7 +606,7 @@ namespace Boare.Lib.Vsq { item.ID.LyricHandle.L0.setPhoneticSymbol( phonetic_symbol ); item.ID.LyricHandle.L0.PhoneticSymbolProtected = protect_symbol; target.setEditedStart( item.Clock ); - target.setEditedEnd( item.Clock + item.ID.Length ); + target.setEditedEnd( item.Clock + item.ID.getLength() ); updateTotalClocks(); return ret; } @@ -476,10 +615,10 @@ namespace Boare.Lib.Vsq { return null; #endregion } else if ( type == VsqCommandType.EVENT_CHANGE_NOTE ) { - #region TrackChangeNote - int track = (int)command.Args[0]; - int internal_id = (int)command.Args[1]; - int note = (int)command.Args[2]; + #region EVENT_CHANGE_NOTE + int track = (Integer)command.Args[0]; + int internal_id = (Integer)command.Args[1]; + int note = (Integer)command.Args[2]; VsqTrack target = this.Track.get( track ); for ( Iterator itr = target.getEventIterator(); itr.hasNext(); ) { VsqEvent item = (VsqEvent)itr.next(); @@ -488,29 +627,30 @@ namespace Boare.Lib.Vsq { item.ID.Note = note; updateTotalClocks(); target.setEditedStart( item.Clock ); - target.setEditedEnd( item.Clock + item.ID.Length ); + target.setEditedEnd( item.Clock + item.ID.getLength() ); return ret; } } return null; #endregion } else if ( type == VsqCommandType.EVENT_CHANGE_CLOCK_AND_NOTE ) { - #region TrackChangeClockAndNote - int track = (int)command.Args[0]; - int internal_id = (int)command.Args[1]; - int clock = (int)command.Args[2]; - int note = (int)command.Args[3]; + #region EVENT_CHANGE_CLOCK_AND_NOTE + int track = (Integer)command.Args[0]; + int internal_id = (Integer)command.Args[1]; + int clock = (Integer)command.Args[2]; + int note = (Integer)command.Args[3]; VsqTrack target = this.Track.get( track ); for ( Iterator itr = target.getEventIterator(); itr.hasNext(); ) { VsqEvent item = (VsqEvent)itr.next(); if ( item.InternalID == internal_id ) { VsqCommand ret = VsqCommand.generateCommandEventChangeClockAndNote( track, internal_id, item.Clock, item.ID.Note ); int min = Math.Min( item.Clock, clock ); - int max = Math.Max( item.Clock + item.ID.Length, clock + item.ID.Length ); + int max = Math.Max( item.Clock + item.ID.getLength(), clock + item.ID.getLength() ); target.setEditedStart( min ); target.setEditedEnd( max ); item.Clock = clock; item.ID.Note = note; + target.sortEvent(); updateTotalClocks(); return ret; } @@ -519,7 +659,7 @@ namespace Boare.Lib.Vsq { #endregion } else if ( type == VsqCommandType.TRACK_CURVE_EDIT ) { #region TRACK_CURVE_EDIT - int track = (int)command.Args[0]; + int track = (Integer)command.Args[0]; String curve = (String)command.Args[1]; Vector com = (Vector)command.Args[2]; VsqCommand inv = null; @@ -529,7 +669,7 @@ namespace Boare.Lib.Vsq { if ( com.size() > 0 ) { int start_clock = com.get( 0 ).Clock; int end_clock = com.get( 0 ).Clock; - for ( Iterator itr = com.iterator(); itr.hasNext(); ){ + for ( Iterator itr = com.iterator(); itr.hasNext(); ) { BPPair item = (BPPair)itr.next(); start_clock = Math.Min( start_clock, item.Clock ); end_clock = Math.Max( end_clock, item.Clock ); @@ -538,8 +678,8 @@ namespace Boare.Lib.Vsq { Track.get( track ).setEditedEnd( end_clock ); int start_value = target_list.getValue( start_clock ); int end_value = target_list.getValue( end_clock ); - for ( Iterator i = target_list.keyClockIterator(); i.hasNext(); ){ - int clock = (int)i.next(); + for ( Iterator i = target_list.keyClockIterator(); i.hasNext(); ) { + int clock = (Integer)i.next(); if ( start_clock <= clock && clock <= end_clock ) { edit.add( new BPPair( clock, target_list.getValue( clock ) ) ); } @@ -583,8 +723,8 @@ namespace Boare.Lib.Vsq { return inv; } else if ( com.size() == 1 ) { boolean found = false; - for ( Iterator itr = target_list.keyClockIterator(); itr.hasNext(); ){ - int clock = (int)itr.next(); + for ( Iterator itr = target_list.keyClockIterator(); itr.hasNext(); ) { + int clock = (Integer)itr.next(); if ( clock == com.get( 0 ).Clock ) { found = true; target_list.add( clock, com.get( 0 ).Value ); @@ -601,7 +741,7 @@ namespace Boare.Lib.Vsq { while ( removed ) { removed = false; for ( Iterator itr = target_list.keyClockIterator(); itr.hasNext(); ) { - int clock = (int)itr.next(); + int clock = (Integer)itr.next(); if ( start_clock <= clock && clock <= end_clock ) { target_list.remove( clock ); removed = true; @@ -609,16 +749,51 @@ namespace Boare.Lib.Vsq { } } } - for ( Iterator itr = com.iterator(); itr.hasNext(); ){ + for ( Iterator itr = com.iterator(); itr.hasNext(); ) { BPPair item = (BPPair)itr.next(); target_list.add( item.Clock, item.Value ); } } return inv; #endregion + } else if ( type == VsqCommandType.TRACK_CURVE_EDIT2 ) { + #region TRACK_CURVE_EDIT2 + int track = (Integer)command.Args[0]; + String curve = (String)command.Args[1]; + Vector delete = (Vector)command.Args[2]; + TreeMap add = (TreeMap)command.Args[3]; + + Vector inv_delete = new Vector(); + TreeMap inv_add = new TreeMap(); + processTrackCurveEdit( track, curve, delete, add, inv_delete, inv_add ); + updateTotalClocks(); + + return VsqCommand.generateCommandTrackCurveEdit2( track, curve, inv_delete, inv_add ); + #endregion + } else if ( type == VsqCommandType.TRACK_CURVE_EDIT2_ALL ) { + #region TRACK_CURVE_EDIT2_ALL + int track = (Integer)command.Args[0]; + Vector curve = (Vector)command.Args[1]; + Vector> delete = (Vector>)command.Args[2]; + Vector> add = (Vector>)command.Args[3]; + + int c = curve.size(); + Vector> inv_delete = new Vector>(); + Vector> inv_add = new Vector>(); + for ( int i = 0; i < c; i++ ) { + Vector part_inv_delete = new Vector(); + TreeMap part_inv_add = new TreeMap(); + processTrackCurveEdit( track, curve.get( i ), delete.get( i ), add.get( i ), part_inv_delete, part_inv_add ); + inv_delete.add( part_inv_delete ); + inv_add.add( part_inv_add ); + } + updateTotalClocks(); + + return VsqCommand.generateCommandTrackCurveEdit2All( track, curve, inv_delete, inv_add ); + #endregion } else if ( type == VsqCommandType.TRACK_CURVE_REPLACE ) { #region TRACK_CURVE_REPLACE - int track = (int)command.Args[0]; + int track = (Integer)command.Args[0]; String target_curve = (String)command.Args[1]; VsqBPList bplist = (VsqBPList)command.Args[2]; VsqCommand inv = VsqCommand.generateCommandTrackCurveReplace( track, target_curve, Track.get( track ).getCurve( target_curve ) ); @@ -627,7 +802,7 @@ namespace Boare.Lib.Vsq { #endregion } else if ( type == VsqCommandType.TRACK_CURVE_REPLACE_RANGE ) { #region TRACK_CURVE_REPLACE_RANGE - int track = (int)command.Args[0]; + int track = (Integer)command.Args[0]; String[] target_curve = (String[])command.Args[1]; VsqBPList[] bplist = (VsqBPList[])command.Args[2]; VsqBPList[] inv_bplist = new VsqBPList[bplist.Length]; @@ -642,23 +817,24 @@ namespace Boare.Lib.Vsq { return inv; #endregion } else if ( type == VsqCommandType.TRACK_CURVE_EDIT_RANGE ) { - #region TrackEditCurveRange - int track = (int)command.Args[0]; - String[] curves = (String[])command.Args[1]; - Vector[] coms = (Vector[])command.Args[2]; - Vector[] inv_coms = new Vector[curves.Length]; + #region TRACK_CURVE_EDIT_RANGE + int track = (Integer)command.Args[0]; + Vector curves = (Vector)command.Args[1]; + Vector> coms = (Vector>)command.Args[2]; + Vector> inv_coms = new Vector>(); VsqCommand inv = null; - for ( int k = 0; k < curves.Length; k++ ) { - String curve = curves[k]; - Vector com = coms[k]; + int count = curves.size(); + for ( int k = 0; k < count; k++ ) { + String curve = curves.get( k ); + Vector com = coms.get( k ); //SortedList list = Tracks[track][curve].List; Vector edit = new Vector(); if ( com != null ) { if ( com.size() > 0 ) { int start_clock = com.get( 0 ).Clock; int end_clock = com.get( 0 ).Clock; - for ( Iterator itr = com.iterator(); itr.hasNext(); ){ + for ( Iterator itr = com.iterator(); itr.hasNext(); ) { BPPair item = (BPPair)itr.next(); start_clock = Math.Min( start_clock, item.Clock ); end_clock = Math.Max( end_clock, item.Clock ); @@ -668,7 +844,7 @@ namespace Boare.Lib.Vsq { int start_value = Track.get( track ).getCurve( curve ).getValue( start_clock ); int end_value = Track.get( track ).getCurve( curve ).getValue( end_clock ); for ( Iterator itr = Track.get( track ).getCurve( curve ).keyClockIterator(); itr.hasNext(); ) { - int clock = (int)itr.next(); + int clock = (Integer)itr.next(); if ( start_clock <= clock && clock <= end_clock ) { edit.add( new BPPair( clock, Track.get( track ).getCurve( curve ).getValue( clock ) ) ); } @@ -700,11 +876,11 @@ namespace Boare.Lib.Vsq { // 並べ替え Collections.sort( edit ); - inv_coms[k] = edit; + inv_coms.add( edit ); //inv = generateCommandTrackEditCurve( track, curve, edit ); } else if ( com.size() == 0 ) { //inv = generateCommandTrackEditCurve( track, curve, new Vector() ); - inv_coms[k] = new Vector(); + inv_coms.add( new Vector() ); } } @@ -714,7 +890,7 @@ namespace Boare.Lib.Vsq { } else if ( com.size() == 1 ) { boolean found = false; for ( Iterator itr = Track.get( track ).getCurve( curve ).keyClockIterator(); itr.hasNext(); ) { - int clock = (int)itr.next(); + int clock = (Integer)itr.next(); if ( clock == com.get( 0 ).Clock ) { found = true; Track.get( track ).getCurve( curve ).add( clock, com.get( 0 ).Value ); @@ -731,7 +907,7 @@ namespace Boare.Lib.Vsq { while ( removed ) { removed = false; for ( Iterator itr = Track.get( track ).getCurve( curve ).keyClockIterator(); itr.hasNext(); ) { - int clock = (int)itr.next(); + int clock = (Integer)itr.next(); if ( start_clock <= clock && clock <= end_clock ) { Track.get( track ).getCurve( curve ).remove( clock ); removed = true; @@ -739,7 +915,7 @@ namespace Boare.Lib.Vsq { } } } - for ( Iterator itr = com.iterator(); itr.hasNext(); ){ + for ( Iterator itr = com.iterator(); itr.hasNext(); ) { BPPair item = (BPPair)itr.next(); Track.get( track ).getCurve( curve ).add( item.Clock, item.Value ); } @@ -747,26 +923,20 @@ namespace Boare.Lib.Vsq { } return VsqCommand.generateCommandTrackCurveEditRange( track, curves, inv_coms ); #endregion - /*} else if ( type == VsqCommandType.TRACK_CURVE_REMOVE_POINTS ) { - #region TRACK_CURVE_REMOVE_POINTS - int track = (int)command.Args[0]; - String curve = (String)command.Args[1]; - Vector ids = (Vector)command.Args[2]; - #endregion*/ } else if ( type == VsqCommandType.EVENT_CHANGE_VELOCITY ) { - #region TrackChangeVelocity - int track = (int)command.Args[0]; - Vector> veloc = (Vector>)command.Args[1]; - Vector> inv = new Vector>(); + #region EVENT_CHANGE_VELOCITY + int track = (Integer)command.Args[0]; + Vector> veloc = (Vector>)command.Args[1]; + Vector> inv = new Vector>(); for ( Iterator itr = Track.get( track ).getEventIterator(); itr.hasNext(); ) { VsqEvent ev = (VsqEvent)itr.next(); - for ( Iterator itr2 = veloc.iterator(); itr2.hasNext(); ){ - KeyValuePair add = (KeyValuePair)itr2.next(); - if ( ev.InternalID == add.Key ) { - inv.add( new KeyValuePair( ev.InternalID, ev.ID.Dynamics ) ); - ev.ID.Dynamics = add.Value; + for ( Iterator itr2 = veloc.iterator(); itr2.hasNext(); ) { + ValuePair add = (ValuePair)itr2.next(); + if ( ev.InternalID == add.getKey() ) { + inv.add( new ValuePair( ev.InternalID, ev.ID.Dynamics ) ); + ev.ID.Dynamics = add.getValue(); Track.get( track ).setEditedStart( ev.Clock ); - Track.get( track ).setEditedEnd( ev.Clock + ev.ID.Length ); + Track.get( track ).setEditedEnd( ev.Clock + ev.ID.getLength() ); break; } } @@ -774,19 +944,19 @@ namespace Boare.Lib.Vsq { return VsqCommand.generateCommandEventChangeVelocity( track, inv ); #endregion } else if ( type == VsqCommandType.EVENT_CHANGE_ACCENT ) { - #region TrackChangeAccent - int track = (int)command.Args[0]; - Vector> veloc = (Vector>)command.Args[1]; - Vector> inv = new Vector>(); + #region EVENT_CHANGE_ACCENT + int track = (Integer)command.Args[0]; + Vector> veloc = (Vector>)command.Args[1]; + Vector> inv = new Vector>(); for ( Iterator itr = Track.get( track ).getEventIterator(); itr.hasNext(); ) { VsqEvent ev = (VsqEvent)itr.next(); - for ( Iterator itr2 = veloc.iterator(); itr2.hasNext(); ){ - KeyValuePair add = (KeyValuePair)itr2.next(); - if ( ev.InternalID == add.Key ) { - inv.add( new KeyValuePair( ev.InternalID, ev.ID.DEMaccent ) ); - ev.ID.DEMaccent = add.Value; + for ( Iterator itr2 = veloc.iterator(); itr2.hasNext(); ) { + ValuePair add = (ValuePair)itr2.next(); + if ( ev.InternalID == add.getKey() ) { + inv.add( new ValuePair( ev.InternalID, ev.ID.DEMaccent ) ); + ev.ID.DEMaccent = add.getValue(); Track.get( track ).setEditedStart( ev.Clock ); - Track.get( track ).setEditedEnd( ev.Clock + ev.ID.Length ); + Track.get( track ).setEditedEnd( ev.Clock + ev.ID.getLength() ); break; } } @@ -794,19 +964,19 @@ namespace Boare.Lib.Vsq { return VsqCommand.generateCommandEventChangeAccent( track, inv ); #endregion } else if ( type == VsqCommandType.EVENT_CHANGE_DECAY ) { - #region TrackChangeDecay - int track = (int)command.Args[0]; - Vector> veloc = (Vector>)command.Args[1]; - Vector> inv = new Vector>(); + #region EVENT_CHANGE_DECAY + int track = (Integer)command.Args[0]; + Vector> veloc = (Vector>)command.Args[1]; + Vector> inv = new Vector>(); for ( Iterator itr = Track.get( track ).getEventIterator(); itr.hasNext(); ) { VsqEvent ev = (VsqEvent)itr.next(); - for ( Iterator itr2 = veloc.iterator(); itr2.hasNext(); ){ - KeyValuePair add = (KeyValuePair)itr.next(); - if ( ev.InternalID == add.Key ) { - inv.add( new KeyValuePair( ev.InternalID, ev.ID.DEMdecGainRate ) ); - ev.ID.DEMdecGainRate = add.Value; + for ( Iterator itr2 = veloc.iterator(); itr2.hasNext(); ) { + ValuePair add = (ValuePair)itr2.next(); + if ( ev.InternalID == add.getKey() ) { + inv.add( new ValuePair( ev.InternalID, ev.ID.DEMdecGainRate ) ); + ev.ID.DEMdecGainRate = add.getValue(); Track.get( track ).setEditedStart( ev.Clock ); - Track.get( track ).setEditedEnd( ev.Clock + ev.ID.Length ); + Track.get( track ).setEditedEnd( ev.Clock + ev.ID.getLength() ); break; } } @@ -814,18 +984,18 @@ namespace Boare.Lib.Vsq { return VsqCommand.generateCommandEventChangeDecay( track, inv ); #endregion } else if ( type == VsqCommandType.EVENT_CHANGE_LENGTH ) { - #region TrackChangeLength - int track = (int)command.Args[0]; - int internal_id = (int)command.Args[1]; - int new_length = (int)command.Args[2]; + #region EVENT_CHANGE_LENGTH + int track = (Integer)command.Args[0]; + int internal_id = (Integer)command.Args[1]; + int new_length = (Integer)command.Args[2]; for ( Iterator itr = Track.get( track ).getEventIterator(); itr.hasNext(); ) { VsqEvent item = (VsqEvent)itr.next(); if ( item.InternalID == internal_id ) { - VsqCommand ret = VsqCommand.generateCommandEventChangeLength( track, internal_id, item.ID.Length ); + VsqCommand ret = VsqCommand.generateCommandEventChangeLength( track, internal_id, item.ID.getLength() ); Track.get( track ).setEditedStart( item.Clock ); - int max = Math.Max( item.Clock + item.ID.Length, item.Clock + new_length ); + int max = Math.Max( item.Clock + item.ID.getLength(), item.Clock + new_length ); Track.get( track ).setEditedEnd( max ); - item.ID.Length = new_length; + item.ID.setLength( new_length ); updateTotalClocks(); return ret; } @@ -833,21 +1003,21 @@ namespace Boare.Lib.Vsq { return null; #endregion } else if ( type == VsqCommandType.EVENT_CHANGE_CLOCK_AND_LENGTH ) { - #region TrackChangeClockAndLength - int track = (int)command.Args[0]; - int internal_id = (int)command.Args[1]; - int new_clock = (int)command.Args[2]; - int new_length = (int)command.Args[3]; + #region EVENT_CHANGE_CLOCK_AND_LENGTH + int track = (Integer)command.Args[0]; + int internal_id = (Integer)command.Args[1]; + int new_clock = (Integer)command.Args[2]; + int new_length = (Integer)command.Args[3]; for ( Iterator itr = Track.get( track ).getEventIterator(); itr.hasNext(); ) { VsqEvent item = (VsqEvent)itr.next(); if ( item.InternalID == internal_id ) { - VsqCommand ret = VsqCommand.generateCommandEventChangeClockAndLength( track, internal_id, item.Clock, item.ID.Length ); + VsqCommand ret = VsqCommand.generateCommandEventChangeClockAndLength( track, internal_id, item.Clock, item.ID.getLength() ); int min = Math.Min( item.Clock, new_clock ); - int max_length = Math.Max( item.ID.Length, new_length ); + int max_length = Math.Max( item.ID.getLength(), new_length ); int max = Math.Max( item.Clock + max_length, new_clock + max_length ); Track.get( track ).setEditedStart( min ); Track.get( track ).setEditedEnd( max ); - item.ID.Length = new_length; + item.ID.setLength( new_length ); item.Clock = new_clock; Track.get( track ).sortEvent(); updateTotalClocks(); @@ -857,21 +1027,21 @@ namespace Boare.Lib.Vsq { return null; #endregion } else if ( type == VsqCommandType.EVENT_CHANGE_ID_CONTAINTS ) { - #region TrackChangeIDContaints - int track = (int)command.Args[0]; - int internal_id = (int)command.Args[1]; + #region EVENT_CHANGE_ID_CONTAINTS + int track = (Integer)command.Args[0]; + int internal_id = (Integer)command.Args[1]; VsqID value = (VsqID)command.Args[2]; for ( Iterator itr = Track.get( track ).getEventIterator(); itr.hasNext(); ) { VsqEvent item = (VsqEvent)itr.next(); if ( item.InternalID == internal_id ) { VsqCommand ret = VsqCommand.generateCommandEventChangeIDContaints( track, internal_id, item.ID ); - int max_length = Math.Max( item.ID.Length, value.Length ); + int max_length = Math.Max( item.ID.getLength(), value.getLength() ); Track.get( track ).setEditedStart( item.Clock ); Track.get( track ).setEditedEnd( item.Clock + max_length ); item.ID = (VsqID)value.clone(); if ( item.ID.type == VsqIDType.Singer ) { #if DEBUG - Console.WriteLine( " EventChangeIDContaints" ); + PortUtil.println( " EventChangeIDContaints" ); #endif // 歌手変更の場合、次に現れる歌手変更の位置まで編集の影響が及ぶ boolean found = false; @@ -887,11 +1057,11 @@ namespace Boare.Lib.Vsq { // 変更対象が、該当トラック最後の歌手変更イベントだった場合 if ( Track.get( track ).getEventCount() >= 1 ) { VsqEvent last_event = Track.get( track ).getEvent( Track.get( track ).getEventCount() - 1 ); - Track.get( track ).setEditedEnd( last_event.Clock + last_event.ID.Length ); + Track.get( track ).setEditedEnd( last_event.Clock + last_event.ID.getLength() ); } } #if DEBUG - Console.WriteLine( " EditedStart,EditedEnd=" + Track.get( track ).getEditedStart() + "," + Track.get( track ).getEditedEnd() ); + PortUtil.println( " EditedStart,EditedEnd=" + Track.get( track ).getEditedStart() + "," + Track.get( track ).getEditedEnd() ); #endif } updateTotalClocks(); @@ -901,8 +1071,8 @@ namespace Boare.Lib.Vsq { return null; #endregion } else if ( type == VsqCommandType.EVENT_CHANGE_ID_CONTAINTS_RANGE ) { - #region TrackChangeIDContaintsRange - int track = (int)command.Args[0]; + #region EVENT_CHANGE_ID_CONTAINTS_RANGE + int track = (Integer)command.Args[0]; int[] internal_ids = (int[])command.Args[1]; VsqID[] values = (VsqID[])command.Args[2]; VsqID[] inv_values = new VsqID[values.Length]; @@ -911,7 +1081,7 @@ namespace Boare.Lib.Vsq { VsqEvent item = (VsqEvent)itr.next(); if ( item.InternalID == internal_ids[i] ) { inv_values[i] = (VsqID)item.ID.clone(); - int max_length = Math.Max( item.ID.Length, values[i].Length ); + int max_length = Math.Max( item.ID.getLength(), values[i].getLength() ); Track.get( track ).setEditedStart( item.Clock ); Track.get( track ).setEditedEnd( item.Clock + max_length ); item.ID = (VsqID)values[i].clone(); @@ -930,7 +1100,7 @@ namespace Boare.Lib.Vsq { // 変更対象が、該当トラック最後の歌手変更イベントだった場合 if ( Track.get( track ).getEventCount() >= 1 ) { VsqEvent last_event = Track.get( track ).getEvent( Track.get( track ).getEventCount() - 1 ); - Track.get( track ).setEditedEnd( last_event.Clock + last_event.ID.Length ); + Track.get( track ).setEditedEnd( last_event.Clock + last_event.ID.getLength() ); } } } @@ -942,23 +1112,24 @@ namespace Boare.Lib.Vsq { return VsqCommand.generateCommandEventChangeIDContaintsRange( track, internal_ids, inv_values ); #endregion } else if ( type == VsqCommandType.EVENT_CHANGE_CLOCK_AND_ID_CONTAINTS ) { - #region TrackChangeClockAndIDContaints - int track = (int)command.Args[0]; - int internal_id = (int)command.Args[1]; - int new_clock = (int)command.Args[2]; + #region EVENT_CHANGE_CLOCK_AND_ID_CONTAINTS + int track = (Integer)command.Args[0]; + int internal_id = (Integer)command.Args[1]; + int new_clock = (Integer)command.Args[2]; VsqID value = (VsqID)command.Args[3]; - for ( Iterator itr = Track.get( track ).getEventIterator(); itr.hasNext(); ) { + VsqTrack target = Track.get( track ); + for ( Iterator itr = target.getEventIterator(); itr.hasNext(); ) { VsqEvent item = (VsqEvent)itr.next(); if ( item.InternalID == internal_id ) { VsqCommand ret = VsqCommand.generateCommandEventChangeClockAndIDContaints( track, internal_id, item.Clock, item.ID ); - int max_length = Math.Max( item.ID.Length, value.Length ); + int max_length = Math.Max( item.ID.getLength(), value.getLength() ); int min = Math.Min( item.Clock, new_clock ); int max = Math.Max( item.Clock + max_length, new_clock + max_length ); item.ID = (VsqID)value.clone(); item.Clock = new_clock; - Track.get( track ).setEditedStart( min ); - Track.get( track ).setEditedEnd( max ); - Track.get( track ).sortEvent(); + target.setEditedStart( min ); + target.setEditedEnd( max ); + target.sortEvent(); updateTotalClocks(); return ret; } @@ -966,20 +1137,20 @@ namespace Boare.Lib.Vsq { return null; #endregion } else if ( type == VsqCommandType.EVENT_CHANGE_CLOCK_AND_ID_CONTAINTS_RANGE ) { - #region TrackChangeClockAndIDContaintsRange - int track = (int)command.Args[0]; + #region EVENT_CHANGE_CLOCK_AND_ID_CONTAINTS_RANGE + int track = (Integer)command.Args[0]; int[] internal_ids = (int[])command.Args[1]; int[] clocks = (int[])command.Args[2]; VsqID[] values = (VsqID[])command.Args[3]; Vector inv_id = new Vector(); - Vector inv_clock = new Vector(); + Vector inv_clock = new Vector(); for ( int i = 0; i < internal_ids.Length; i++ ) { for ( Iterator itr = Track.get( track ).getEventIterator(); itr.hasNext(); ) { VsqEvent item = (VsqEvent)itr.next(); if ( item.InternalID == internal_ids[i] ) { inv_id.add( (VsqID)item.ID.clone() ); inv_clock.add( item.Clock ); - int max_length = Math.Max( item.ID.Length, values[i].Length ); + int max_length = Math.Max( item.ID.getLength(), values[i].getLength() ); int min = Math.Min( item.Clock, clocks[i] ); int max = Math.Max( item.Clock + max_length, clocks[i] + max_length ); Track.get( track ).setEditedStart( min ); @@ -995,27 +1166,27 @@ namespace Boare.Lib.Vsq { return VsqCommand.generateCommandEventChangeClockAndIDContaintsRange( track, internal_ids, - inv_clock.toArray( new Integer[]{} ), - inv_id.toArray( new VsqID[]{} ) ); + PortUtil.convertIntArray( inv_clock.toArray( new Integer[] { } ) ), + inv_id.toArray( new VsqID[] { } ) ); #if DEBUG - Console.WriteLine( " TrackChangeClockAndIDContaintsRange" ); - Console.WriteLine( " track=" + track ); + PortUtil.println( " TrackChangeClockAndIDContaintsRange" ); + PortUtil.println( " track=" + track ); for ( int i = 0; i < internal_ids.Length; i++ ) { - Console.WriteLine( " id=" + internal_ids[i] + "; clock=" + clocks[i] + "; ID=" + values[i].ToString() ); + PortUtil.println( " id=" + internal_ids[i] + "; clock=" + clocks[i] + "; ID=" + values[i].ToString() ); } #endif #endregion } else if ( type == VsqCommandType.TRACK_CHANGE_NAME ) { - #region TrackCangeName - int track = (int)command.Args[0]; + #region TRACK_CHANGE_NAME + int track = (Integer)command.Args[0]; String new_name = (String)command.Args[1]; VsqCommand ret = VsqCommand.generateCommandTrackChangeName( track, Track.get( track ).getName() ); Track.get( track ).setName( new_name ); return ret; #endregion } else if ( type == VsqCommandType.TRACK_REPLACE ) { - #region TrackReplace - int track = (int)command.Args[0]; + #region TRACK_REPLACE + int track = (Integer)command.Args[0]; VsqTrack item = (VsqTrack)command.Args[1]; VsqCommand ret = VsqCommand.generateCommandTrackReplace( track, Track.get( track ) ); Track.set( track, item ); @@ -1023,16 +1194,16 @@ namespace Boare.Lib.Vsq { return ret; #endregion } else if ( type == VsqCommandType.TRACK_CHANGE_PLAY_MODE ) { - #region TrackChangePlayMode - int track = (int)command.Args[0]; - int play_mode = (int)command.Args[1]; + #region TRACK_CHANGE_PLAY_MODE + int track = (Integer)command.Args[0]; + int play_mode = (Integer)command.Args[1]; VsqCommand ret = VsqCommand.generateCommandTrackChangePlayMode( track, Track.get( track ).getCommon().PlayMode ); Track.get( track ).getCommon().PlayMode = play_mode; return ret; #endregion } else if ( type == VsqCommandType.EVENT_REPLACE ) { - #region EventReplace - int track = (int)command.Args[0]; + #region EVENT_REPLACE + int track = (Integer)command.Args[0]; VsqEvent item = (VsqEvent)command.Args[1]; VsqCommand ret = null; for ( int i = 0; i < Track.get( track ).getEventCount(); i++ ) { @@ -1048,18 +1219,18 @@ namespace Boare.Lib.Vsq { return ret; #endregion } else if ( type == VsqCommandType.EVENT_REPLACE_RANGE ) { - #region EventReplaceRange - int track = (int)command.Args[0]; - object[] items = (object[])command.Args[1]; + #region EVENT_REPLACE_RANGE + int track = (Integer)command.Args[0]; + VsqEvent[] items = (VsqEvent[])command.Args[1]; VsqCommand ret = null; VsqEvent[] reverse = new VsqEvent[items.Length]; for ( int i = 0; i < items.Length; i++ ) { - VsqEvent ve = (VsqEvent)items[i]; + VsqEvent ve = items[i]; for ( int j = 0; j < Track.get( track ).getEventCount(); j++ ) { VsqEvent ve2 = (VsqEvent)Track.get( track ).getEvent( j ); if ( ve2.InternalID == ve.InternalID ) { reverse[i] = (VsqEvent)ve2.clone(); - Track.get( track ).setEvent( j, (VsqEvent)items[i] ); + Track.get( track ).setEvent( j, items[i] ); break; } } @@ -1074,13 +1245,57 @@ namespace Boare.Lib.Vsq { return null; } + private void processTrackCurveEdit( int track, + String curve, + Vector delete, + TreeMap add, + Vector inv_delete, + TreeMap inv_add ){ + VsqBPList list = Track.get( track ).getCurve( curve ); + + // 現在の編集範囲を取得 + int edited_start = Track.get( track ).getEditedStart(); + int edited_end = Track.get( track ).getEditedEnd(); + + // 逆コマンド発行用 + inv_delete.clear(); + inv_add.clear(); + + // 最初に削除コマンドを実行 + for ( Iterator itr = delete.iterator(); itr.hasNext(); ) { + long id = (Long)itr.next(); + VsqBPPairSearchContext item = list.findElement( id ); + if ( item.index >= 0 ) { + int clock = item.clock; + list.removeElementAt( item.index ); + inv_add.put( clock, new VsqBPPair( item.point.value, item.point.id ) ); + edited_start = Math.Min( edited_start, clock ); + edited_end = Math.Max( edited_end, clock ); + } + } + + // 追加コマンドを実行 + for ( Iterator itr = add.keySet().iterator(); itr.hasNext(); ) { + int clock = (Integer)itr.next(); + VsqBPPair item = add.get( clock ); + list.addWithID( clock, item.value, item.id ); + inv_delete.add( item.id ); + edited_start = Math.Min( edited_start, clock ); + edited_end = Math.Max( edited_end, clock ); + } + + // 編集範囲の更新 + Track.get( track ).setEditedStart( edited_start ); + Track.get( track ).setEditedEnd( edited_end ); + } + /// /// VSQファイルの指定されたクロック範囲のイベント等を削除します /// /// 編集対象のVsqFileインスタンス /// 削除を行う範囲の開始クロック /// 削除を行う範囲の終了クロック - public virtual void removePart( int clock_start, int clock_end ) { + public void removePart( int clock_start, int clock_end ) { int dclock = clock_end - clock_start; // テンポ情報の削除、シフト @@ -1092,9 +1307,9 @@ namespace Boare.Lib.Vsq { boolean just_on_clock_end_added = false; for ( int i = 0; i < buf.size(); i++ ) { if ( buf.get( i ).Clock < clock_start ) { - TempoTable.add( (TempoTableEntry)buf.get( i ).Clone() ); + TempoTable.add( (TempoTableEntry)buf.get( i ).clone() ); } else if ( clock_end <= buf.get( i ).Clock ) { - TempoTableEntry tte = (TempoTableEntry)buf.get( i ).Clone(); + TempoTableEntry tte = (TempoTableEntry)buf.get( i ).clone(); tte.Clock = tte.Clock - dclock; if ( clock_end == buf.get( i ).Clock ) { TempoTable.add( tte ); @@ -1156,16 +1371,17 @@ namespace Boare.Lib.Vsq { } } - foreach ( String curve in _CURVES ) { + for ( int i = 0; i < _CURVES.Length; i++ ) { + String curve = _CURVES[i]; if ( curve.Equals( "VEL" ) ) { continue; } - VsqBPList buf_bplist = (VsqBPList)Track.get( track ).getCurve( curve ).Clone(); + VsqBPList buf_bplist = (VsqBPList)Track.get( track ).getCurve( curve ).clone(); Track.get( track ).getCurve( curve ).clear(); int value_at_end = buf_bplist.getValue( clock_end ); boolean at_end_added = false; for ( Iterator itr = buf_bplist.keyClockIterator(); itr.hasNext(); ) { - int key = (int)itr.next(); + int key = (Integer)itr.next(); if ( key < clock_start ) { Track.get( track ).getCurve( curve ).add( key, buf_bplist.getValue( key ) ); } else if ( clock_end <= key ) { @@ -1188,14 +1404,14 @@ namespace Boare.Lib.Vsq { /// この操作を行うことで,TimesigTableの情報は破綻します(仕様です). /// /// - public static void shift( VsqFile vsq, uint delta_clock ) { + public static void shift( VsqFile vsq, int delta_clock ) { if ( delta_clock == 0 ) { return; } int dclock = (int)delta_clock; for ( int i = 0; i < vsq.TempoTable.size(); i++ ) { if ( vsq.TempoTable.get( i ).Clock > 0 ) { - vsq.TempoTable.get( i ).Clock =vsq.TempoTable.get( i ).Clock + dclock; + vsq.TempoTable.get( i ).Clock = vsq.TempoTable.get( i ).Clock + dclock; } } vsq.updateTempoInfo(); @@ -1205,15 +1421,17 @@ namespace Boare.Lib.Vsq { vsq.Track.get( track ).getEvent( i ).Clock += dclock; } } - foreach ( String curve in _CURVES ) { + for ( int i = 0; i < _CURVES.Length; i++ ) { + String curve = _CURVES[i]; if ( curve.Equals( "VEL" ) ) { continue; - + } // 順番に+=dclockしていくとVsqBPList内部のSortedListの値がかぶる可能性がある. VsqBPList edit = vsq.Track.get( track ).getCurve( curve ); VsqBPList new_one = new VsqBPList( edit.getDefault(), edit.getMinimum(), edit.getMaximum() ); - foreach( int key in edit.getKeys() ){ + for ( Iterator itr2 = edit.keyClockIterator(); itr2.hasNext(); ) { + int key = (Integer)itr2.next(); new_one.add( key + dclock, edit.getValue( key ) ); } vsq.Track.get( track ).setCurve( curve, new_one ); @@ -1226,37 +1444,45 @@ namespace Boare.Lib.Vsq { /// このインスタンスのコピーを作成します /// /// このインスタンスのコピー - public virtual object Clone() { + public Object clone() { VsqFile ret = new VsqFile(); ret.Track = new Vector(); for ( int i = 0; i < Track.size(); i++ ) { - ret.Track.add( (VsqTrack)Track.get( i ).Clone() ); + ret.Track.add( (VsqTrack)Track.get( i ).clone() ); } -#if USE_TEMPO_LIST - ret.m_tempo_table = (TempoTable)m_tempo_table.Clone(); -#else + ret.TempoTable = new Vector(); for ( int i = 0; i < TempoTable.size(); i++ ) { - ret.TempoTable.add( (TempoTableEntry)TempoTable.get( i ).Clone() ); + ret.TempoTable.add( (TempoTableEntry)TempoTable.get( i ).clone() ); } -#endif + ret.TimesigTable = new Vector(); for ( int i = 0; i < TimesigTable.size(); i++ ) { - ret.TimesigTable.add( (TimeSigTableEntry)TimesigTable.get( i ).Clone() ); + ret.TimesigTable.add( (TimeSigTableEntry)TimesigTable.get( i ).clone() ); } ret.m_tpq = m_tpq; ret.TotalClocks = TotalClocks; ret.m_base_tempo = m_base_tempo; - ret.Master = (VsqMaster)Master.Clone(); - ret.Mixer = (VsqMixer)Mixer.Clone(); + ret.Master = (VsqMaster)Master.clone(); + ret.Mixer = (VsqMixer)Mixer.clone(); //ret.m_premeasure_clocks = m_premeasure_clocks; return ret; } +#if !JAVA + public object Clone() { + return clone(); + } +#endif + private VsqFile() { } +#if JAVA + private class BarLineIterator implements Iterator{ +#else private class BarLineIterator : Iterator { +#endif private Vector m_list; private int m_end_clock; private int i; @@ -1269,12 +1495,6 @@ namespace Boare.Lib.Vsq { int bar_counter; public BarLineIterator( Vector list, int end_clock ) { - /*lock ( list ) { - m_list = new Vector(); - for ( int j = 0; j < list.Count; j++ ) { - m_list.Add( (TimeSigTableEntry)list[j].Clone() ); - } - }*/ m_list = list; m_end_clock = end_clock; i = 0; @@ -1297,7 +1517,7 @@ namespace Boare.Lib.Vsq { } } - if( i < m_list.size() ) { + if ( i < m_list.size() ) { local_denominator = m_list.get( i ).Denominator; local_numerator = m_list.get( i ).Numerator; local_clock = m_list.get( i ).Clock; @@ -1311,7 +1531,7 @@ namespace Boare.Lib.Vsq { } i++; clock = local_clock; - if( clock < t_end ){ + if ( clock < t_end ) { if ( (clock - local_clock) % mod == 0 ) { bar_counter++; VsqBarLineType ret = new VsqBarLineType( clock, true, local_denominator, local_numerator, bar_counter ); @@ -1328,10 +1548,10 @@ namespace Boare.Lib.Vsq { } public void remove() { - throw new NotImplementedException(); + //throw new Exception( "com.boare.vsq.VsqFile.BarLineIterator#remove; not implemented" ); } - public Boolean hasNext() { + public boolean hasNext() { if ( clock < m_end_clock ) { return true; } else { @@ -1345,7 +1565,7 @@ namespace Boare.Lib.Vsq { /// /// public Iterator getBarLineIterator( int end_clock ) { - return new BarLineIterator( TimesigTable, end_clock ); + return new BarLineIterator( TimesigTable, end_clock ); } /// @@ -1421,9 +1641,6 @@ namespace Boare.Lib.Vsq { /// public double getClockFromSec( double time ) { // timeにおけるテンポを取得 -#if USE_TEMPO_LIST - return m_tempo_table.getClockFromSec( time ); -#else int tempo = m_base_tempo; double base_clock = 0; double base_time = 0f; @@ -1446,7 +1663,6 @@ namespace Boare.Lib.Vsq { } double dt = time - base_time; return base_clock + dt * m_tpq * 1000000.0 / (double)tempo; -#endif } /// @@ -1455,7 +1671,10 @@ namespace Boare.Lib.Vsq { /// /// /// - public void getTimesigAt( int clock, out int numerator, out int denominator ) { + public Timesig getTimesigAt( int clock ) { + Timesig ret = new Timesig(); + ret.numerator = 4; + ret.denominator = 4; int index = 0; int c = TimesigTable.size(); for ( int i = c - 1; i >= 0; i-- ) { @@ -1464,11 +1683,12 @@ namespace Boare.Lib.Vsq { break; } } - numerator = TimesigTable.get( index ).Numerator; - denominator = TimesigTable.get( index ).Denominator; + ret.numerator = TimesigTable.get( index ).Numerator; + ret.denominator = TimesigTable.get( index ).Denominator; + return ret; } - public void getTimesigAt( int clock, out int numerator, out int denominator, out int bar_count ) { + public Timesig getTimesigAt( int clock, ByRef bar_count ) { int index = 0; int c = TimesigTable.size(); for ( int i = c - 1; i >= 0; i-- ) { @@ -1478,11 +1698,13 @@ namespace Boare.Lib.Vsq { } } TimeSigTableEntry item = TimesigTable.get( index ); - numerator = item.Numerator; - denominator = item.Denominator; + Timesig ret = new Timesig(); + ret.numerator = item.Numerator; + ret.denominator = item.Denominator; int diff = clock - item.Clock; - int clock_per_bar = 480 * 4 / denominator * numerator; - bar_count = item.BarCount + diff / clock_per_bar; + int clock_per_bar = 480 * 4 / ret.denominator * ret.numerator; + bar_count.value = item.BarCount + diff / clock_per_bar; + return ret; } /// @@ -1558,34 +1780,6 @@ namespace Boare.Lib.Vsq { return m_tpq; } -#if USE_TEMPO_LIST - public TempoTable TempoTable { - return m_tempo_table; - } -#else - /*/// - /// テンポの変更情報を格納したテーブルを取得します - /// - public Vector getTempoList() { - return TempoTable; - }*/ -#endif - - /*/// - /// 拍子の変更情報を格納したテーブルを取得します - /// - public Vector getTimeSigList() { - return TimesigTable; - }*/ - - /*public VsqTrack Track( int track ) { - return Track.get( track ); - }*/ - - /*public int getTrackCount() { - return Tracks.Count; - }*/ - /// /// 空のvsqファイルを構築します /// @@ -1602,7 +1796,7 @@ namespace Boare.Lib.Vsq { Track.add( new VsqTrack( "Voice1", singer ) ); Master = new VsqMaster( pre_measure ); #if DEBUG - Console.WriteLine( "VsqFile.ctor()" ); + PortUtil.println( "VsqFile.ctor()" ); #endif Mixer = new VsqMixer( 0, 0, 0, 0 ); Mixer.Slave.add( new VsqMixerEntry( 0, 0, 0, 0 ) ); @@ -1618,23 +1812,28 @@ namespace Boare.Lib.Vsq { /// vsqファイルからのコンストラクタ /// /// - public VsqFile( String _fpath, Encoding encoding ) { + public VsqFile( String _fpath, String encoding ) +#if JAVA + throws FileNotFoundException +#endif + { TempoTable = new Vector(); TimesigTable = new Vector(); m_tpq = 480; // SMFをコンバートしたテキストファイルを作成 - //using ( TextMemoryStream tms = new TextMemoryStream( FileAccess.ReadWrite ) ) { - MidiFile mf = new MidiFile( _fpath ); - Track = new Vector(); - int num_track = mf.getTrackCount(); - for ( int i = 0; i < num_track; i++ ) { - Track.add( new VsqTrack( mf.getMidiEventList( i ), encoding ) ); - } - //} + MidiFile mf = new MidiFile( _fpath ); + Track = new Vector(); + int num_track = mf.getTrackCount(); +#if DEBUG + PortUtil.println( "VsqFile#.ctor; num_track=" + num_track ); +#endif + for ( int i = 0; i < num_track; i++ ) { + Track.add( new VsqTrack( mf.getMidiEventList( i ), encoding ) ); + } - Master = (VsqMaster)Track.get( 1 ).getMaster().Clone(); - Mixer = (VsqMixer)Track.get( 1 ).getMixer().Clone(); + Master = (VsqMaster)Track.get( 1 ).getMaster().clone(); + Mixer = (VsqMixer)Track.get( 1 ).getMixer().clone(); Track.get( 1 ).setMaster( null ); Track.get( 1 ).setMixer( null ); @@ -1666,15 +1865,17 @@ namespace Boare.Lib.Vsq { double thistime; prev_time = 0.0; int count = -1; - for ( int j = 0; j < midi_event.size(); j++ ) { - if ( midi_event.get( j ).firstByte == 0xff && midi_event.get( j ).data.Length >= 4 && midi_event.get( j ).data[0] == 0x51 ) { + int midi_event_size = midi_event.size(); + for ( int j = 0; j < midi_event_size; j++ ) { + MidiEvent itemj = midi_event.get( j ); + if ( itemj.firstByte == (byte)0xff && itemj.data.Length >= 4 && itemj.data[0] == (byte)0x51 ) { count++; - if ( count == 0 && midi_event.get( j ).clock != 0 ) { + if ( count == 0 && itemj.clock != 0 ) { TempoTable.add( new TempoTableEntry( 0, 500000, 0.0 ) ); m_base_tempo = 500000; prev_tempo = 500000; } - int current_tempo = midi_event.get( j ).data[1] << 16 | midi_event.get( j ).data[2] << 8 | midi_event.get( j ).data[3]; + int current_tempo = itemj.data[1] << 16 | itemj.data[2] << 8 | itemj.data[3]; int current_index = (int)midi_event.get( j ).clock; thistime = prev_time + (double)(prev_tempo) * (double)(current_index - prev_index) / (m_tpq * 1000000.0); TempoTable.add( new TempoTableEntry( current_index, current_tempo, thistime ) ); @@ -1696,14 +1897,14 @@ namespace Boare.Lib.Vsq { //m_timesig_table.Add( new TimeSigTableEntry( 0, numer, dnomi, 0 ) ); count = -1; for ( int j = 0; j < midi_event.size(); j++ ) { - if ( midi_event.get( j ).firstByte == 0xff && midi_event.get( j ).data.Length >= 5 && midi_event.get( j ).data[0] == 0x58 ) { + if ( midi_event.get( j ).firstByte == (byte)0xff && midi_event.get( j ).data.Length >= 5 && midi_event.get( j ).data[0] == (byte)0x58 ) { count++; numer = midi_event.get( j ).data[1]; dnomi = 1; for ( int i = 0; i < midi_event.get( j ).data[2]; i++ ) { dnomi = dnomi * 2; } - if ( count == 0 ){ + if ( count == 0 ) { int numerator = 4; int denominator = 4; int clock = 0; @@ -1744,26 +1945,28 @@ namespace Boare.Lib.Vsq { /// public void updateTimesigInfo() { #if DEBUG - Console.WriteLine( "VsqFile.UpdateTimesigInfo()" ); + PortUtil.println( "VsqFile.UpdateTimesigInfo()" ); #endif if ( TimesigTable.get( 0 ).Clock != 0 ) { - throw new ApplicationException( "initial timesig does not found" ); + return; } TimesigTable.get( 0 ).Clock = 0; Collections.sort( TimesigTable ); - for ( int j = 1; j < TimesigTable.size(); j++ ) { - int numerator = TimesigTable.get( j - 1 ).Numerator; - int denominator = TimesigTable.get( j - 1 ).Denominator; - int clock = TimesigTable.get( j - 1 ).Clock; - int bar_count = TimesigTable.get( j - 1 ).BarCount; + int count = TimesigTable.size(); + for ( int j = 1; j < count; j++ ) { + TimeSigTableEntry item = TimesigTable.get( j - 1 ); + int numerator = item.Numerator; + int denominator = item.Denominator; + int clock = item.Clock; + int bar_count = item.BarCount; int dif = 480 * 4 / denominator * numerator;//1小節が何クロックか? clock += (TimesigTable.get( j ).BarCount - bar_count) * dif; TimesigTable.get( j ).Clock = clock; } #if DEBUG - Console.WriteLine( "TimesigTable;" ); + PortUtil.println( "TimesigTable;" ); for ( int i = 0; i < TimesigTable.size(); i++ ) { - Console.WriteLine( " " + TimesigTable.get( i ).Clock + " " + TimesigTable.get( i ).Numerator + "/" + TimesigTable.get( i ).Denominator ); + PortUtil.println( " " + TimesigTable.get( i ).Clock + " " + TimesigTable.get( i ).Numerator + "/" + TimesigTable.get( i ).Denominator ); } #endif } @@ -1798,20 +2001,21 @@ namespace Boare.Lib.Vsq { /// public void updateTotalClocks() { int max = getPreMeasureClocks(); - for( int i = 1; i < Track.size(); i++ ){ + for ( int i = 1; i < Track.size(); i++ ) { VsqTrack track = Track.get( i ); for ( Iterator itr = track.getEventIterator(); itr.hasNext(); ) { VsqEvent ve = (VsqEvent)itr.next(); - max = Math.Max( max, ve.Clock + ve.ID.Length ); + max = Math.Max( max, ve.Clock + ve.ID.getLength() ); } - foreach ( String vct in _CURVES ) { + for ( int j = 0; j < _CURVES.Length; j++ ) { + String vct = _CURVES[j]; if ( vct.Equals( "VEL" ) ) { continue; } VsqBPList list = track.getCurve( vct ); if ( list != null && list.size() > 0 ) { int keys = list.size(); - int last_key = list.getKeys()[keys - 1]; + int last_key = list.getKeyClock( keys - 1 ); max = Math.Max( max, last_key ); } } @@ -1832,7 +2036,9 @@ namespace Boare.Lib.Vsq { /// /// public void printLyricTable( int track, String fpath ) { - using ( StreamWriter sw = new StreamWriter( fpath ) ) { + BufferedWriter sw = null; + try { + sw = new BufferedWriter( new FileWriter( fpath ) ); for ( int i = 0; i < Track.get( track ).getEventCount(); i++ ) { int Length; // timesignal @@ -1840,7 +2046,7 @@ namespace Boare.Lib.Vsq { // イベントで指定されたIDがLyricであった場合 if ( Track.get( track ).getEvent( i ).ID.type == VsqIDType.Anote ) { // 発音長を取得 - Length = Track.get( track ).getEvent( i ).ID.Length; + Length = Track.get( track ).getEvent( i ).ID.getLength(); // tempo_tableから、発音開始時のtempoを取得 int last = TempoTable.size() - 1; @@ -1859,47 +2065,123 @@ namespace Boare.Lib.Vsq { double start_time = prev_time + (double)(current_index - prev_index) * (double)tempo / (m_tpq * 1000000.0); // TODO: 単純に + Lengthしただけではまずいはず。要検討 double end_time = start_time + ((double)Length) * ((double)tempo) / (m_tpq * 1000000.0); - sw.WriteLine( Track.get( track ).getEvent( i ).Clock + "," + - start_time.ToString( "0.000000" ) + "," + - end_time.ToString( "0.000000" ) + "," + - Track.get( track ).getEvent( i ).ID.LyricHandle.L0.Phrase + "," + - Track.get( track ).getEvent( i ).ID.LyricHandle.L0.getPhoneticSymbol() ); + sw.write( Track.get( track ).getEvent( i ).Clock + "," + + PortUtil.formatDecimal( "0.000000", start_time ) + "," + + PortUtil.formatDecimal( "0.000000", end_time ) + "," + + Track.get( track ).getEvent( i ).ID.LyricHandle.L0.Phrase + "," + + Track.get( track ).getEvent( i ).ID.LyricHandle.L0.getPhoneticSymbol() ); + sw.newLine(); } } + } catch ( Exception ex ) { + } finally { + if ( sw != null ) { + try { + sw.close(); + } catch ( Exception ex2 ) { + } + } } } - public Vector generateMetaTextEvent( int track, Encoding encoding ) { - String _NL = "" + (char)0x0a; + public Vector generateMetaTextEvent( int track, String encoding ) { + String _NL = "" + (char)(byte)0x0a; Vector ret = new Vector(); - using ( TextMemoryStream sr = new TextMemoryStream() ) { + TextMemoryStream sr = null; + try { + sr = new TextMemoryStream(); Track.get( track ).printMetaText( sr, TotalClocks + 120, calculatePreMeasureInClock() ); sr.rewind(); int line_count = -1; String tmp = ""; if ( sr.peek() >= 0 ) { +#if NEW_IMPL + Vector buffer = new Vector(); + boolean first = true; + while ( sr.peek() >= 0 ) { + if ( first ) { + tmp = sr.readLine(); + first = false; + } else { + tmp = _NL + sr.readLine(); + } + Byte[] linebytes = PortUtil.convertByteArray( PortUtil.getEncodedByte( encoding, tmp ) ); + buffer.addAll( Arrays.asList( linebytes ) ); + while ( getLinePrefixBytes( line_count + 1 ).Length + buffer.size() >= 127 ) { + line_count++; + byte[] prefix = getLinePrefixBytes( line_count ); + MidiEvent add = new MidiEvent(); + add.clock = 0; + add.firstByte = (byte)0xff; + add.data = new byte[128]; + add.data[0] = (byte)0x01; + int remain = 127; + for ( int i = 0; i < prefix.Length; i++ ) { + add.data[i + 1] = prefix[i]; + } + for ( int i = prefix.Length; i < remain; i++ ) { + byte d = buffer.get( 0 ); + add.data[i + 1] = d; + buffer.removeElementAt( 0 ); + } + ret.add( add ); + } + } + if ( buffer.size() > 0 ) { + while ( getLinePrefixBytes( line_count + 1 ).Length + buffer.size() >= 127 ) { + line_count++; + byte[] prefix = getLinePrefixBytes( line_count ); + MidiEvent add = new MidiEvent(); + add.clock = 0; + add.firstByte = (byte)0xff; + add.data = new byte[128]; + add.data[0] = (byte)0x01; + int remain = 127; + for ( int i = 0; i < prefix.Length; i++ ) { + add.data[i + 1] = prefix[i]; + } + for ( int i = prefix.Length; i < remain; i++ ) { + add.data[i + 1] = buffer.get( 0 ); + buffer.removeElementAt( 0 ); + } + ret.add( add ); + } + if ( buffer.size() > 0 ) { + line_count++; + byte[] prefix = getLinePrefixBytes( line_count ); + MidiEvent add = new MidiEvent(); + add.clock = 0; + add.firstByte = (byte)0xff; + int remain = prefix.Length + buffer.size(); + add.data = new byte[remain + 1]; + add.data[0] = (byte)0x01; + for ( int i = 0; i < prefix.Length; i++ ) { + add.data[i + 1] = prefix[i]; + } + for ( int i = prefix.Length; i < remain; i++ ) { + add.data[i + 1] = buffer.get( 0 ); + buffer.removeElementAt( 0 ); + } + ret.add( add ); + } + } +#else tmp = sr.readLine(); byte[] line_bytes; while ( sr.peek() >= 0 ) { tmp += _NL + sr.readLine(); - while ( encoding.GetByteCount( tmp + getLinePrefix( line_count + 1 ) ) >= 127 ) { + while ( PortUtil.getEncodedByteCount( encoding, tmp + getLinePrefix( line_count + 1 ) ) >= 127 ) { line_count++; tmp = getLinePrefix( line_count ) + tmp; String work = substring127Bytes( tmp, encoding );// tmp.Substring( 0, 127 ); -#if DEBUG - Console.WriteLine( "VsqFile#generateMetaTextEvent; tmp=" + tmp + "; work=" + work ); -#endif - tmp = tmp.Substring( work.Length ); -#if DEBUG - Console.WriteLine( "VsqFile#generateMetaTextEvent; new tmp=" + tmp ); -#endif - line_bytes = encoding.GetBytes( work ); + tmp = tmp.Substring( PortUtil.getStringLength( work ) ); + line_bytes = PortUtil.getEecodedByte( encoding, work ); MidiEvent add = new MidiEvent(); add.clock = 0; - add.firstByte = 0xff; //ステータス メタ* + add.firstByte = (byte)0xff; //ステータス メタ* add.data = new byte[line_bytes.Length + 1]; - add.data[0] = 0x01; //メタテキスト + add.data[0] = (byte)0x01; //メタテキスト for ( int i = 0; i < line_bytes.Length; i++ ) { add.data[i + 1] = line_bytes[i]; } @@ -1909,15 +2191,15 @@ namespace Boare.Lib.Vsq { // 残りを出力 line_count++; tmp = getLinePrefix( line_count ) + tmp + _NL; - while ( encoding.GetByteCount( tmp ) > 127 ) { + while ( PortUtil.getEncodedByteCount( encoding, tmp ) > 127 ) { String work = substring127Bytes( tmp, encoding ); - tmp = tmp.Substring( work.Length ); - line_bytes = encoding.GetBytes( work ); + tmp = tmp.Substring( PortUtil.getStringLength( work ) ); + line_bytes = PortUtil.getEecodedByte( encoding, work ); MidiEvent add = new MidiEvent(); add.clock = 0; - add.firstByte = 0xff; + add.firstByte = (byte)0xff; add.data = new byte[line_bytes.Length + 1]; - add.data[0] = 0x01; + add.data[0] = (byte)0x01; for ( int i = 0; i < line_bytes.Length; i++ ) { add.data[i + 1] = line_bytes[i]; } @@ -1925,17 +2207,29 @@ namespace Boare.Lib.Vsq { line_count++; tmp = getLinePrefix( line_count ); } - line_bytes = encoding.GetBytes( tmp ); + line_bytes = PortUtil.getEecodedByte( encoding, tmp ); MidiEvent add0 = new MidiEvent(); - add0.firstByte = 0xff; + add0.firstByte = (byte)0xff; add0.data = new byte[line_bytes.Length + 1]; - add0.data[0] = 0x01; + add0.data[0] = (byte)0x01; for ( int i = 0; i < line_bytes.Length; i++ ) { add0.data[i + 1] = line_bytes[i]; } ret.add( add0 ); +#endif + } + } catch ( Exception ex ) { + } finally { + if ( sr != null ) { + try { + sr.close(); + } catch ( Exception ex2 ) { + } } } +#if DEBUG + Console.WriteLine( "VsqFile#generateMetaTextEvent; ret.size()=" + ret.size() ); +#endif return ret; } @@ -1945,9 +2239,9 @@ namespace Boare.Lib.Vsq { /// /// /// - private static String substring127Bytes( String s, Encoding encoding ) { - int count = Math.Min( 127, s.Length ); - int c = encoding.GetByteCount( s.Substring( 0, count ) ); + private static String substring127Bytes( String s, String encoding ) { + int count = Math.Min( 127, PortUtil.getStringLength( s ) ); + int c = PortUtil.getEncodedByteCount( encoding, s.Substring( 0, count ) ); if ( c == 127 ) { return s.Substring( 0, count ); } @@ -1956,38 +2250,42 @@ namespace Boare.Lib.Vsq { count += delta; if ( delta == -1 && count == 0 ) { break; - } else if ( delta == 1 && count == s.Length ) { + } else if ( delta == 1 && count == PortUtil.getStringLength( s ) ) { break; } - c = encoding.GetByteCount( s.Substring( 0, count ) ); + c = PortUtil.getEncodedByteCount( encoding, s.Substring( 0, count ) ); } return s.Substring( 0, count ); } - private static void printTrack( VsqFile vsq, int track, FileStream fs, int msPreSend, Encoding encoding ) { + private static void printTrack( VsqFile vsq, int track, RandomAccessFile fs, int msPreSend, String encoding ) +#if JAVA + throws IOException +#endif + { #if DEBUG - Console.WriteLine( "PrintTrack" ); + PortUtil.println( "PrintTrack" ); #endif //VsqTrack item = Tracks[track]; - String _NL = "" + (char)0x0a; + String _NL = "" + (char)(byte)0x0a; //ヘッダ - fs.Write( _MTRK, 0, 4 ); + fs.write( _MTRK, 0, 4 ); //データ長。とりあえず0 - fs.Write( new byte[] { 0x00, 0x00, 0x00, 0x00 }, 0, 4 ); - long first_position = fs.Position; + fs.write( new byte[] { (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00 }, 0, 4 ); + long first_position = fs.getFilePointer(); //トラック名 - writeFlexibleLengthUnsignedLong( fs, 0x00 );//デルタタイム - fs.WriteByte( 0xff );//ステータスタイプ - fs.WriteByte( 0x03 );//イベントタイプSequence/Track Name - byte[] seq_name = encoding.GetBytes( vsq.Track.get( track ).getName() ); - writeFlexibleLengthUnsignedLong( fs, (ulong)seq_name.Length );//seq_nameの文字数 - fs.Write( seq_name, 0, seq_name.Length ); - + writeFlexibleLengthUnsignedLong( fs, (byte)0x00 );//デルタタイム + fs.write( (byte)0xff );//ステータスタイプ + fs.write( (byte)0x03 );//イベントタイプSequence/Track Name + byte[] seq_name = PortUtil.getEncodedByte( encoding, vsq.Track.get( track ).getName() ); + writeFlexibleLengthUnsignedLong( fs, (long)seq_name.Length );//seq_nameの文字数 + fs.write( seq_name, 0, seq_name.Length ); + //Meta Textを準備 Vector meta = vsq.generateMetaTextEvent( track, encoding ); long lastclock = 0; for ( int i = 0; i < meta.size(); i++ ) { - writeFlexibleLengthUnsignedLong( fs, (ulong)(meta.get( i ).clock - lastclock) ); + writeFlexibleLengthUnsignedLong( fs, (long)(meta.get( i ).clock - lastclock) ); meta.get( i ).writeData( fs ); lastclock = meta.get( i ).clock; } @@ -1996,24 +2294,24 @@ namespace Boare.Lib.Vsq { VsqNrpn[] data = generateNRPN( vsq, track, msPreSend ); NrpnData[] nrpns = VsqNrpn.convert( data ); for ( int i = 0; i < nrpns.Length; i++ ) { - writeFlexibleLengthUnsignedLong( fs, (ulong)(nrpns[i].getClock() - last) ); - fs.WriteByte( 0xb0 ); - fs.WriteByte( nrpns[i].getParameter() ); - fs.WriteByte( nrpns[i].Value ); + writeFlexibleLengthUnsignedLong( fs, (long)(nrpns[i].getClock() - last) ); + fs.write( (byte)0xb0 ); + fs.write( nrpns[i].getParameter() ); + fs.write( nrpns[i].Value ); last = nrpns[i].getClock(); } //トラックエンド VsqEvent last_event = vsq.Track.get( track ).getEvent( vsq.Track.get( track ).getEventCount() - 1 ); - int last_clock = last_event.Clock + last_event.ID.Length; - writeFlexibleLengthUnsignedLong( fs, (ulong)last_clock ); - fs.WriteByte( 0xff ); - fs.WriteByte( 0x2f ); - fs.WriteByte( 0x00 ); - long pos = fs.Position; - fs.Seek( first_position - 4, SeekOrigin.Begin ); - writeUnsignedInt( fs, (uint)(pos - first_position) ); - fs.Seek( pos, SeekOrigin.Begin ); + int last_clock = last_event.Clock + last_event.ID.getLength(); + writeFlexibleLengthUnsignedLong( fs, (long)last_clock ); + fs.write( (byte)0xff ); + fs.write( (byte)0x2f ); + fs.write( (byte)0x00 ); + long pos = fs.getFilePointer(); + fs.seek( first_position - 4 ); + writeUnsignedInt( fs, (long)(pos - first_position) ); + fs.seek( pos ); } /// @@ -2042,14 +2340,14 @@ namespace Boare.Lib.Vsq { for ( int i = 0; i < count; i++ ) { int clock = dyn.getKeyClock( i ); int c = clock - vsq.getPresendClockAt( clock, msPreSend ); - if ( c >= 0 ){ - VsqNrpn add = new VsqNrpn( c, + if ( c >= 0 ) { + VsqNrpn add = new VsqNrpn( c, NRPN.CC_E_EXPRESSION, (byte)dyn.getElement( i ) ); ret.add( add ); } } - return ret.toArray( new VsqNrpn[]{} ); + return ret.toArray( new VsqNrpn[] { } ); } public static VsqNrpn[] generateFx2DepthNRPN( VsqFile vsq, int track, int msPreSend ) { @@ -2066,7 +2364,7 @@ namespace Boare.Lib.Vsq { ret.add( add ); } } - return ret.toArray( new VsqNrpn[]{} ); + return ret.toArray( new VsqNrpn[] { } ); } /// @@ -2074,9 +2372,9 @@ namespace Boare.Lib.Vsq { /// /// public static VsqNrpn generateHeaderNRPN() { - VsqNrpn ret = new VsqNrpn( 0, (ushort)NRPN.CC_BS_VERSION_AND_DEVICE, 0x00, 0x00 ); - ret.append( NRPN.CC_BS_DELAY, 0x00, 0x00 ); - ret.append( NRPN.CC_BS_LANGUAGE_TYPE, 0x00 ); + VsqNrpn ret = new VsqNrpn( 0, NRPN.CC_BS_VERSION_AND_DEVICE, (byte)0x00, (byte)0x00 ); + ret.append( NRPN.CC_BS_DELAY, (byte)0x00, (byte)0x00 ); + ret.append( NRPN.CC_BS_LANGUAGE_TYPE, (byte)0x00 ); return ret; } @@ -2095,20 +2393,22 @@ namespace Boare.Lib.Vsq { int ttempo = vsq.getTempoAt( clock ); double tempo = 6e7 / ttempo; //double sStart = SecFromClock( ve.Clock ); - double msEnd = vsq.getSecFromClock( ve.Clock + ve.ID.Length ) * 1000.0; - ushort duration = (ushort)Math.Ceiling( msEnd - clock_msec ); + double msEnd = vsq.getSecFromClock( ve.Clock + ve.ID.getLength() ) * 1000.0; + int duration = (int)Math.Ceiling( msEnd - clock_msec ); #if DEBUG - Console.WriteLine( "GenerateNoteNRPN" ); - Console.WriteLine( " duration=" + duration ); + PortUtil.println( "GenerateNoteNRPN" ); + PortUtil.println( " duration=" + duration ); #endif - byte duration0, duration1; - getMsbAndLsb( duration, out duration0, out duration1 ); - byte delay0, delay1; - getMsbAndLsb( (ushort)msPreSend, out delay0, out delay1 ); + ValuePair d = getMsbAndLsb( duration ); + byte duration0 = d.getKey(); + byte duration1 = d.getValue(); + ValuePair d2 = getMsbAndLsb( msPreSend ); + byte delay0 = d2.getKey(); + byte delay1 = d2.getValue(); Vector ret = new Vector(); int i = clock - vsq.getPresendClockAt( clock, msPreSend ); - VsqNrpn add = new VsqNrpn( i, (ushort)NRPN.CC_BS_VERSION_AND_DEVICE, 0x00, 0x00 ); + VsqNrpn add = new VsqNrpn( i, NRPN.CC_BS_VERSION_AND_DEVICE, (byte)0x00, (byte)0x00 ); add.append( NRPN.CC_BS_DELAY, delay0, delay1, true ); add.append( NRPN.CC_BS_LANGUAGE_TYPE, (byte)ve.ID.IconHandle.Language, true ); add.append( NRPN.PC_VOICE_TYPE, (byte)ve.ID.IconHandle.Program ); @@ -2130,16 +2430,18 @@ namespace Boare.Lib.Vsq { int ttempo = vsq.getTempoAt( clock ); double tempo = 6e7 / ttempo; - double msEnd = vsq.getSecFromClock( ve.Clock + ve.ID.Length ) * 1000.0; - ushort duration = (ushort)(msEnd - clock_msec); - byte duration0, duration1; - getMsbAndLsb( duration, out duration0, out duration1 ); + double msEnd = vsq.getSecFromClock( ve.Clock + ve.ID.getLength() ) * 1000.0; + int duration = (int)(msEnd - clock_msec); + ValuePair dur = getMsbAndLsb( duration ); + byte duration0 = dur.getKey(); + byte duration1 = dur.getValue(); VsqNrpn add; if ( add_delay_sign ) { - byte delay0, delay1; - getMsbAndLsb( (ushort)msPreSend, out delay0, out delay1 ); - add = new VsqNrpn( clock - vsq.getPresendClockAt( clock, msPreSend ), NRPN.CVM_NM_VERSION_AND_DEVICE, 0x00, 0x00 ); + ValuePair msp = getMsbAndLsb( msPreSend ); + byte delay0 = msp.getKey(); + byte delay1 = msp.getValue(); + add = new VsqNrpn( clock - vsq.getPresendClockAt( clock, msPreSend ), NRPN.CVM_NM_VERSION_AND_DEVICE, (byte)0x00, (byte)0x00 ); add.append( NRPN.CVM_NM_DELAY, delay0, delay1, true ); add.append( NRPN.CVM_NM_NOTE_NUMBER, (byte)ve.ID.Note, true ); // Note number } else { @@ -2150,12 +2452,14 @@ namespace Boare.Lib.Vsq { add.append( NRPN.CVM_NM_NOTE_LOCATION, note_loc, true ); // Note Location if ( ve.ID.VibratoHandle != null ) { - add.append( NRPN.CVM_NM_INDEX_OF_VIBRATO_DB, 0x00, 0x00, true ); - int vibrato_type = (int)VibratoTypeUtil.getVibratoTypeFromIconID( ve.ID.VibratoHandle.IconID ); - int note_length = ve.ID.Length; + add.append( NRPN.CVM_NM_INDEX_OF_VIBRATO_DB, (byte)0x00, (byte)0x00, true ); + String icon_id = ve.ID.VibratoHandle.IconID; + String num = icon_id.Substring( PortUtil.getStringLength( icon_id ) - 4 ); + int vibrato_type = (int)PortUtil.fromHexString( num ); + int note_length = ve.ID.getLength(); int vibrato_delay = ve.ID.VibratoDelay; byte bVibratoDuration = (byte)((float)(note_length - vibrato_delay) / (float)note_length * 127); - byte bVibratoDelay = (byte)(0x7f - bVibratoDuration); + byte bVibratoDelay = (byte)((byte)0x7f - bVibratoDuration); add.append( NRPN.CVM_NM_VIBRATO_CONFIG, (byte)vibrato_type, bVibratoDuration, true ); add.append( NRPN.CVM_NM_VIBRATO_DELAY, bVibratoDelay, true ); } @@ -2167,23 +2471,23 @@ namespace Boare.Lib.Vsq { } char[] symbols = s.ToCharArray(); if ( renderer.StartsWith( "DSB2" ) ) { - add.append( 0x5011, (byte)0x01, true );//TODO: 0x5011の意味は解析中 + add.append( 0x5011, (byte)0x01, true );//TODO: (byte)0x5011の意味は解析中 } - add.append( NRPN.CVM_NM_PHONETIC_SYMBOL_BYTES, (byte)symbols.Length, true );// 0x12(Number of phonetic symbols in bytes) + add.append( NRPN.CVM_NM_PHONETIC_SYMBOL_BYTES, (byte)symbols.Length, true );// (byte)0x12(Number of phonetic symbols in bytes) int count = -1; for ( int j = 0; j < spl.Length; j++ ) { char[] chars = spl[j].ToCharArray(); for ( int k = 0; k < chars.Length; k++ ) { count++; if ( k == 0 ) { - add.append( (ushort)((0x50 << 8) | (byte)(0x13 + count)), (byte)chars[k], (byte)ve.ID.LyricHandle.L0.getConsonantAdjustment()[j], true ); // Phonetic symbol j + add.append( (0x50 << 8) | (0x13 + count), (byte)chars[k], (byte)ve.ID.LyricHandle.L0.getConsonantAdjustment()[j], true ); // Phonetic symbol j } else { - add.append( (ushort)((0x50 << 8) | (byte)(0x13 + count)), (byte)chars[k], true ); // Phonetic symbol j + add.append( (0x50 << 8) | (0x13 + count), (byte)chars[k], true ); // Phonetic symbol j } } } if ( !renderer.StartsWith( "DSB2" ) ) { - add.append( NRPN.CVM_NM_PHONETIC_SYMBOL_CONTINUATION, 0x7f, true ); // End of phonetic symbols + add.append( NRPN.CVM_NM_PHONETIC_SYMBOL_CONTINUATION, (byte)0x7f, true ); // End of phonetic symbols } if ( renderer.StartsWith( "DSB3" ) ) { int v1mean = ve.ID.PMBendDepth * 60 / 100; @@ -2195,19 +2499,19 @@ namespace Boare.Lib.Vsq { } int d1mean = (int)(0.3196 * ve.ID.PMBendLength + 8.0); int d2mean = (int)(0.92 * ve.ID.PMBendLength + 28.0); - add.append( NRPN.CVM_NM_V1MEAN, (byte)v1mean, true );// 0x50(v1mean) - add.append( NRPN.CVM_NM_D1MEAN, (byte)d1mean, true );// 0x51(d1mean) - add.append( NRPN.CVM_NM_D1MEAN_FIRST_NOTE, 0x14, true );// 0x52(d1meanFirstNote) - add.append( NRPN.CVM_NM_D2MEAN, (byte)d2mean, true );// 0x53(d2mean) - add.append( NRPN.CVM_NM_D4MEAN, (byte)ve.ID.d4mean, true );// 0x54(d4mean) + add.append( NRPN.CVM_NM_V1MEAN, (byte)v1mean, true );// (byte)0x50(v1mean) + add.append( NRPN.CVM_NM_D1MEAN, (byte)d1mean, true );// (byte)0x51(d1mean) + add.append( NRPN.CVM_NM_D1MEAN_FIRST_NOTE, (byte)0x14, true );// (byte)0x52(d1meanFirstNote) + add.append( NRPN.CVM_NM_D2MEAN, (byte)d2mean, true );// (byte)0x53(d2mean) + add.append( NRPN.CVM_NM_D4MEAN, (byte)ve.ID.d4mean, true );// (byte)0x54(d4mean) add.append( NRPN.CVM_NM_PMEAN_ONSET_FIRST_NOTE, (byte)ve.ID.pMeanOnsetFirstNote, true ); // 055(pMeanOnsetFirstNote) - add.append( NRPN.CVM_NM_VMEAN_NOTE_TRNSITION, (byte)ve.ID.vMeanNoteTransition, true ); // 0x56(vMeanNoteTransition) - add.append( NRPN.CVM_NM_PMEAN_ENDING_NOTE, (byte)ve.ID.pMeanEndingNote, true );// 0x57(pMeanEndingNote) - add.append( NRPN.CVM_NM_ADD_PORTAMENTO, (byte)ve.ID.PMbPortamentoUse, true );// 0x58(AddScoopToUpInternals&AddPortamentoToDownIntervals) - byte decay = (byte)(ve.ID.DEMdecGainRate / 100.0 * 0x64); - add.append( NRPN.CVM_NM_CHANGE_AFTER_PEAK, decay, true );// 0x59(changeAfterPeak) - byte accent = (byte)(0x64 * ve.ID.DEMaccent / 100.0); - add.append( NRPN.CVM_NM_ACCENT, accent, true );// 0x5a(Accent) + add.append( NRPN.CVM_NM_VMEAN_NOTE_TRNSITION, (byte)ve.ID.vMeanNoteTransition, true ); // (byte)0x56(vMeanNoteTransition) + add.append( NRPN.CVM_NM_PMEAN_ENDING_NOTE, (byte)ve.ID.pMeanEndingNote, true );// (byte)0x57(pMeanEndingNote) + add.append( NRPN.CVM_NM_ADD_PORTAMENTO, (byte)ve.ID.PMbPortamentoUse, true );// (byte)0x58(AddScoopToUpInternals&AddPortamentoToDownIntervals) + byte decay = (byte)(ve.ID.DEMdecGainRate / 100.0 * (byte)0x64); + add.append( NRPN.CVM_NM_CHANGE_AFTER_PEAK, decay, true );// (byte)0x59(changeAfterPeak) + byte accent = (byte)((byte)0x64 * ve.ID.DEMaccent / 100.0); + add.append( NRPN.CVM_NM_ACCENT, accent, true );// (byte)0x5a(Accent) } if ( renderer.StartsWith( "UTU0" ) ) { // エンベロープ @@ -2219,7 +2523,7 @@ namespace Boare.Lib.Vsq { env = new UstEnvelope(); } int[] vals = null; - vals = new int[10]; + vals = new int[10]; vals[0] = env.p1; vals[1] = env.p2; vals[2] = env.p3; @@ -2231,36 +2535,36 @@ namespace Boare.Lib.Vsq { vals[8] = env.p5; vals[9] = env.v5; for ( int i = 0; i < vals.Length; i++ ) { - //(value3.msb & 0xf) << 28 | (value2.msb & 0x7f) << 21 | (value2.lsb & 0x7f) << 14 | (value1.msb & 0x7f) << 7 | (value1.lsb & 0x7f) + //(value3.msb & (byte)0xf) << 28 | (value2.msb & (byte)0x7f) << 21 | (value2.lsb & (byte)0x7f) << 14 | (value1.msb & (byte)0x7f) << 7 | (value1.lsb & (byte)0x7f) byte msb, lsb; int v = vals[i]; - lsb = (byte)(v & 0x7f); + lsb = (byte)(v & (byte)0x7f); v = v >> 7; - msb = (byte)(v & 0x7f); + msb = (byte)(v & (byte)0x7f); v = v >> 7; add.append( NRPN.CVM_EXNM_ENV_DATA1, msb, lsb ); - lsb = (byte)(v & 0x7f); + lsb = (byte)(v & (byte)0x7f); v = v >> 7; - msb = (byte)(v & 0x7f); + msb = (byte)(v & (byte)0x7f); v = v >> 7; add.append( NRPN.CVM_EXNM_ENV_DATA2, msb, lsb ); - msb = (byte)(v & 0xf); + msb = (byte)(v & (byte)0xf); add.append( NRPN.CVM_EXNM_ENV_DATA3, msb ); - add.append( NRPN.CVM_EXNM_ENV_DATA_CONTINUATION, 0x00 ); + add.append( NRPN.CVM_EXNM_ENV_DATA_CONTINUATION, (byte)0x00 ); } - add.append( NRPN.CVM_EXNM_ENV_DATA_CONTINUATION, 0x7f ); + add.append( NRPN.CVM_EXNM_ENV_DATA_CONTINUATION, (byte)0x7f ); // モジュレーション - byte m, l; + ValuePair m; if ( -100 <= ve.UstEvent.Moduration && ve.UstEvent.Moduration <= 100 ) { - getMsbAndLsb( (ushort)(ve.UstEvent.Moduration + 100), out m, out l ); - add.append( NRPN.CVM_EXNM_MODURATION, m, l ); + m = getMsbAndLsb( ve.UstEvent.Moduration + 100 ); + add.append( NRPN.CVM_EXNM_MODURATION, m.getKey(), m.getValue() ); } // 先行発声 if ( ve.UstEvent.PreUtterance != 0 ) { - getMsbAndLsb( (ushort)(ve.UstEvent.PreUtterance + 8192), out m, out l ); - add.append( NRPN.CVM_EXNM_PRE_UTTERANCE, m, l ); + m = getMsbAndLsb( ve.UstEvent.PreUtterance + 8192 ); + add.append( NRPN.CVM_EXNM_PRE_UTTERANCE, m.getKey(), m.getValue() ); } // Flags @@ -2271,17 +2575,17 @@ namespace Boare.Lib.Vsq { byte b = (byte)arr[i]; add.append( NRPN.CVM_EXNM_FLAGS, b ); } - add.append( NRPN.CVM_EXNM_FLAGS_CONINUATION, 0x7f ); + add.append( NRPN.CVM_EXNM_FLAGS_CONINUATION, (byte)0x7f ); } // オーバーラップ if ( ve.UstEvent.VoiceOverlap != 0 ) { - getMsbAndLsb( (ushort)(ve.UstEvent.VoiceOverlap + 8192), out m, out l ); - add.append( NRPN.CVM_EXNM_VOICE_OVERLAP, m, l ); + m = getMsbAndLsb( ve.UstEvent.VoiceOverlap + 8192 ); + add.append( NRPN.CVM_EXNM_VOICE_OVERLAP, m.getKey(), m.getValue() ); } } } - add.append( NRPN.CVM_NM_NOTE_MESSAGE_CONTINUATION, 0x7f, true );// 0x7f(Note message continuation) + add.append( NRPN.CVM_NM_NOTE_MESSAGE_CONTINUATION, (byte)0x7f, true );// (byte)0x7f(Note message continuation) return add; } @@ -2295,7 +2599,7 @@ namespace Boare.Lib.Vsq { /// /// public static VsqNrpn[] generateNRPN( VsqFile vsq, int track, int msPreSend, int clock_start, int clock_end ) { - VsqFile temp = (VsqFile)vsq.Clone(); + VsqFile temp = (VsqFile)vsq.clone(); temp.removePart( clock_end, vsq.TotalClocks ); if ( 0 < clock_start ) { temp.removePart( 0, clock_start ); @@ -2316,7 +2620,7 @@ namespace Boare.Lib.Vsq { /// public static VsqNrpn[] generateNRPN( VsqFile vsq, int track, int msPreSend ) { #if DEBUG - Console.WriteLine( "GenerateNRPN(VsqTrack,int,int,int,int)" ); + PortUtil.println( "GenerateNRPN(VsqTrack,int,int,int,int)" ); #endif Vector list = new Vector(); @@ -2326,7 +2630,7 @@ namespace Boare.Lib.Vsq { int count = target.getEventCount(); int note_start = 0; int note_end = target.getEventCount() - 1; - for ( int i = 0; i < target.getEventCount(); i++ ) { + for ( int i = 0; i < count; i++ ) { if ( 0 <= target.getEvent( i ).Clock ) { note_start = i; break; @@ -2349,16 +2653,16 @@ namespace Boare.Lib.Vsq { } } if ( singer_event >= 0 ) { //見つかった場合 - list.addAll( generateSingerNRPN( vsq, target.getEvent( singer_event ), 0 ) ); + list.addAll( Arrays.asList( generateSingerNRPN( vsq, target.getEvent( singer_event ), 0 ) ) ); } else { //多分ありえないと思うが、歌手が不明の場合。 - throw new ApplicationException( "first singer was not specified" ); - list.add( new VsqNrpn( 0, NRPN.CC_BS_LANGUAGE_TYPE, 0 ) ); - list.add( new VsqNrpn( 0, NRPN.PC_VOICE_TYPE, 0 ) ); + //throw new Exception( "first singer was not specified" ); + list.add( new VsqNrpn( 0, NRPN.CC_BS_LANGUAGE_TYPE, (byte)0x0 ) ); + list.add( new VsqNrpn( 0, NRPN.PC_VOICE_TYPE, (byte)0x0 ) ); } - list.addAll( generateVoiceChangeParameterNRPN( vsq, track, msPreSend ) ); + list.addAll( Arrays.asList( generateVoiceChangeParameterNRPN( vsq, track, msPreSend ) ) ); if ( version.StartsWith( "DSB2" ) ) { - list.addAll( generateFx2DepthNRPN( vsq, track, msPreSend ) ); + list.addAll( Arrays.asList( generateFx2DepthNRPN( vsq, track, msPreSend ) ) ); } int ms_presend = msPreSend; @@ -2366,28 +2670,28 @@ namespace Boare.Lib.Vsq { double sec_maxlen = 0.0; for ( Iterator itr = target.getNoteEventIterator(); itr.hasNext(); ) { VsqEvent ve = (VsqEvent)itr.next(); - double len = vsq.getSecFromClock( ve.Clock + ve.ID.Length ) - vsq.getSecFromClock( ve.Clock ); + double len = vsq.getSecFromClock( ve.Clock + ve.ID.getLength() ) - vsq.getSecFromClock( ve.Clock ); sec_maxlen = Math.Max( sec_maxlen, len ); } ms_presend += (int)(sec_maxlen * 1000.0); } VsqBPList dyn = target.getCurve( "dyn" ); if ( dyn.size() > 0 ) { - Vector listdyn = new Vector( generateExpressionNRPN( vsq, track, ms_presend ) ); + Vector listdyn = new Vector( Arrays.asList( generateExpressionNRPN( vsq, track, ms_presend ) ) ); if ( listdyn.size() > 0 ) { list.addAll( listdyn ); } } VsqBPList pbs = target.getCurve( "pbs" ); if ( pbs.size() > 0 ) { - Vector listpbs = new Vector( generatePitchBendSensitivityNRPN( vsq, track, ms_presend ) ); + Vector listpbs = new Vector( Arrays.asList( generatePitchBendSensitivityNRPN( vsq, track, ms_presend ) ) ); if ( listpbs.size() > 0 ) { list.addAll( listpbs ); } } VsqBPList pit = target.getCurve( "pit" ); if ( pit.size() > 0 ) { - Vector listpit = new Vector( generatePitchBendNRPN( vsq, track, ms_presend ) ); + Vector listpit = new Vector( Arrays.asList( generatePitchBendNRPN( vsq, track, ms_presend ) ) ); if ( listpit.size() > 0 ) { list.addAll( listpit ); } @@ -2398,21 +2702,23 @@ namespace Boare.Lib.Vsq { for ( int i = note_start; i <= note_end; i++ ) { VsqEvent item = target.getEvent( i ); if ( item.ID.type == VsqIDType.Anote ) { - byte note_loc = 0x03; + byte note_loc = (byte)0x03; if ( item.Clock == last_note_end ) { - note_loc -= 0x02; + note_loc -= (byte)0x02; } // 次に現れる音符イベントを探す - int nextclock = item.Clock + item.ID.Length + 1; - for ( int j = i + 1; j < target.getEventCount(); j++ ) { - if ( target.getEvent( j ).ID.type == VsqIDType.Anote ) { - nextclock = target.getEvent( j ).Clock; + int nextclock = item.Clock + item.ID.getLength() + 1; + int event_count = target.getEventCount(); + for ( int j = i + 1; j < event_count; j++ ) { + VsqEvent itemj = target.getEvent( j ); + if ( itemj.ID.type == VsqIDType.Anote ) { + nextclock = itemj.Clock; break; } } - if ( item.Clock + item.ID.Length == nextclock ) { - note_loc -= 0x01; + if ( item.Clock + item.ID.getLength() == nextclock ) { + note_loc -= (byte)0x01; } list.add( generateNoteNRPN( vsq, @@ -2422,13 +2728,13 @@ namespace Boare.Lib.Vsq { note_loc, first ) ); first = false; - list.addAll( generateVibratoNRPN( vsq, - item, - msPreSend ) ); - last_note_end = item.Clock + item.ID.Length; + list.addAll( Arrays.asList( generateVibratoNRPN( vsq, + item, + msPreSend ) ) ); + last_note_end = item.Clock + item.ID.getLength(); } else if ( item.ID.type == VsqIDType.Singer ) { if ( i > note_start && i != singer_event ) { - list.addAll( generateSingerNRPN( vsq, item, msPreSend ) ); + list.addAll( Arrays.asList( generateSingerNRPN( vsq, item, msPreSend ) ) ); } } } @@ -2436,9 +2742,9 @@ namespace Boare.Lib.Vsq { list = VsqNrpn.sort( list ); Vector merged = new Vector(); for ( int i = 0; i < list.size(); i++ ) { - merged.addAll( list.get( i ).expand() ); + merged.addAll( Arrays.asList( list.get( i ).expand() ) ); } - return merged.toArray( new VsqNrpn[]{} ); + return merged.toArray( new VsqNrpn[] { } ); } /// @@ -2454,19 +2760,19 @@ namespace Boare.Lib.Vsq { int count = pit.size(); for ( int i = 0; i < count; i++ ) { int clock = pit.getKeyClock( i ); - ushort value = (ushort)(pit.getElement( i ) + 0x2000); - byte value0, value1; - getMsbAndLsb( value, out value0, out value1 ); + int value = pit.getElement( i ) + 0x2000; + + ValuePair val = getMsbAndLsb( value ); int c = clock - vsq.getPresendClockAt( clock, msPreSend ); if ( c >= 0 ) { VsqNrpn add = new VsqNrpn( c, NRPN.PB_PITCH_BEND, - value0, - value1 ); + val.getKey(), + val.getValue() ); ret.add( add ); } } - return ret.toArray( new VsqNrpn[]{} ); + return ret.toArray( new VsqNrpn[] { } ); } /// @@ -2487,11 +2793,11 @@ namespace Boare.Lib.Vsq { VsqNrpn add = new VsqNrpn( c, NRPN.CC_PBS_PITCH_BEND_SENSITIVITY, (byte)pbs.getElement( i ), - 0x00 ); + (byte)0x00 ); ret.add( add ); } } - return ret.toArray( new VsqNrpn[]{} ); + return ret.toArray( new VsqNrpn[] { } ); } /// @@ -2503,36 +2809,41 @@ namespace Boare.Lib.Vsq { /// public static VsqNrpn[] generateVibratoNRPN( VsqFile vsq, VsqEvent ve, int msPreSend ) { Vector ret = new Vector(); - if ( ve.ID.VibratoHandle != null ){ + if ( ve.ID.VibratoHandle != null ) { int vclock = ve.Clock + ve.ID.VibratoDelay; - byte delay0, delay1; - getMsbAndLsb( (ushort)msPreSend, out delay0, out delay1 ); + ValuePair del = getMsbAndLsb( msPreSend ); VsqNrpn add2 = new VsqNrpn( vclock - vsq.getPresendClockAt( vclock, msPreSend ), NRPN.CC_VD_VERSION_AND_DEVICE, - 0x00, - 0x00 ); - add2.append( NRPN.CC_VD_DELAY, delay0, delay1, true ); + (byte)0x00, + (byte)0x00 ); + add2.append( NRPN.CC_VD_DELAY, del.getKey(), del.getValue(), true ); add2.append( NRPN.CC_VD_VIBRATO_DEPTH, (byte)ve.ID.VibratoHandle.StartDepth, true ); add2.append( NRPN.CC_VR_VIBRATO_RATE, (byte)ve.ID.VibratoHandle.StartRate ); ret.add( add2 ); - int vlength = ve.ID.Length - ve.ID.VibratoDelay; - if ( ve.ID.VibratoHandle.RateBP.getCount() > 0 ) { - for ( int i = 0; i < ve.ID.VibratoHandle.RateBP.getCount(); i++ ) { + int vlength = ve.ID.getLength() - ve.ID.VibratoDelay; + int count = ve.ID.VibratoHandle.RateBP.getCount(); + if ( count > 0 ) { + for ( int i = 0; i < count; i++ ) { float percent = ve.ID.VibratoHandle.RateBP.getElement( i ).X; int cl = vclock + (int)(percent * vlength); - ret.add( new VsqNrpn( cl - vsq.getPresendClockAt( cl, msPreSend ), NRPN.CC_VR_VIBRATO_RATE, (byte)ve.ID.VibratoHandle.RateBP.getElement( i ).Y ) ); + ret.add( new VsqNrpn( cl - vsq.getPresendClockAt( cl, msPreSend ), + NRPN.CC_VR_VIBRATO_RATE, + (byte)ve.ID.VibratoHandle.RateBP.getElement( i ).Y ) ); } } - if ( ve.ID.VibratoHandle.DepthBP.getCount() > 0 ) { - for ( int i = 0; i < ve.ID.VibratoHandle.DepthBP.getCount(); i++ ) { + count = ve.ID.VibratoHandle.DepthBP.getCount(); + if ( count > 0 ) { + for ( int i = 0; i < count; i++ ) { float percent = ve.ID.VibratoHandle.DepthBP.getElement( i ).X; int cl = vclock + (int)(percent * vlength); - ret.add( new VsqNrpn( cl - vsq.getPresendClockAt( cl, msPreSend ), NRPN.CC_VD_VIBRATO_DEPTH, (byte)ve.ID.VibratoHandle.DepthBP.getElement( i ).Y ) ); + ret.add( new VsqNrpn( cl - vsq.getPresendClockAt( cl, msPreSend ), + NRPN.CC_VD_VIBRATO_DEPTH, + (byte)ve.ID.VibratoHandle.DepthBP.getElement( i ).Y ) ); } } } Collections.sort( ret ); - return ret.toArray( new VsqNrpn[]{} ); + return ret.toArray( new VsqNrpn[] { } ); } /// @@ -2568,7 +2879,7 @@ namespace Boare.Lib.Vsq { for ( int j = 0; j < count; j++ ) { int clock = vbpl.getKeyClock( j ); int c = clock - vsq.getPresendClockAt( clock, msPreSend ); - if ( c >= 0 ){ + if ( c >= 0 ) { VsqNrpn add = new VsqNrpn( c, NRPN.VCP_VOICE_CHANGE_PARAMETER_ID, lsb ); @@ -2579,22 +2890,25 @@ namespace Boare.Lib.Vsq { } } Collections.sort( res ); - return res.toArray( new VsqNrpn[]{} ); + return res.toArray( new VsqNrpn[] { } ); } - private static void getMsbAndLsb( ushort value, out byte msb, out byte lsb ) { + private static ValuePair getMsbAndLsb( int value ) { + ValuePair ret = new ValuePair(); if ( 0x3fff < value ) { - msb = 0x7f; - lsb = 0x7f; + ret.setKey( (byte)0x7f ); + ret.setValue( (byte)0x7f ); } else { - msb = (byte)(value >> 7); - lsb = (byte)(value - (msb << 7)); + byte msb = (byte)(value >> 7); + ret.setKey( msb ); + ret.setValue( (byte)(value - (msb << 7)) ); } + return ret; } public Vector generateTimeSig() { Vector events = new Vector(); - for ( Iterator itr = TimesigTable.iterator(); itr.hasNext(); ){ + for ( Iterator itr = TimesigTable.iterator(); itr.hasNext(); ) { TimeSigTableEntry entry = (TimeSigTableEntry)itr.next(); events.add( MidiEvent.generateTimeSigEvent( entry.Clock, entry.Numerator, entry.Denominator ) ); } @@ -2603,7 +2917,7 @@ namespace Boare.Lib.Vsq { public Vector generateTempoChange() { Vector events = new Vector(); - for( Iterator itr = TempoTable.iterator(); itr.hasNext(); ){ + for ( Iterator itr = TempoTable.iterator(); itr.hasNext(); ) { TempoTableEntry entry = (TempoTableEntry)itr.next(); events.add( MidiEvent.generateTempoChangeEvent( entry.Clock, entry.Tempo ) ); //last_clock = Math.Max( last_clock, entry.Clock ); @@ -2615,8 +2929,8 @@ namespace Boare.Lib.Vsq { /// このインスタンスをファイルに出力します /// /// - public virtual void write( String file ) { - write( file, 500, Encoding.GetEncoding( "Shift_JIS" ) ); + public void write( String file ) { + write( file, 500, "Shift_JIS" ); } /// @@ -2624,52 +2938,62 @@ namespace Boare.Lib.Vsq { /// /// /// プリセンドタイム(msec) - public virtual void write( String file, int msPreSend, Encoding encoding ) { + public void write( String file, int msPreSend, String encoding ) { #if DEBUG - Console.WriteLine( "VsqFile.Write(String)" ); + PortUtil.println( "VsqFile.Write(String)" ); #endif int last_clock = 0; - for ( int track = 1; track < Track.size(); track++ ) { + int track_size = Track.size(); + for ( int track = 1; track < track_size; track++ ) { if ( Track.get( track ).getEventCount() > 0 ) { int index = Track.get( track ).getEventCount() - 1; VsqEvent last = Track.get( track ).getEvent( index ); - last_clock = Math.Max( last_clock, last.Clock + last.ID.Length ); + last_clock = Math.Max( last_clock, last.Clock + last.ID.getLength() ); } } - using ( FileStream fs = new FileStream( file, FileMode.Create ) ) { + if ( PortUtil.isFileExists( file ) ) { + try { + PortUtil.deleteFile( file ); + } catch ( Exception ex ) { + } + } + + RandomAccessFile fs = null; + try { + fs = new RandomAccessFile( file, "rw" ); long first_position;//チャンクの先頭のファイル位置 #region ヘッダ //チャンクタイプ - fs.Write( _MTHD, 0, 4 ); + fs.write( _MTHD, 0, 4 ); //データ長 - fs.WriteByte( 0x00 ); - fs.WriteByte( 0x00 ); - fs.WriteByte( 0x00 ); - fs.WriteByte( 0x06 ); + fs.write( (byte)0x00 ); + fs.write( (byte)0x00 ); + fs.write( (byte)0x00 ); + fs.write( (byte)0x06 ); //フォーマット - fs.WriteByte( 0x00 ); - fs.WriteByte( 0x01 ); + fs.write( (byte)0x00 ); + fs.write( (byte)0x01 ); //トラック数 - writeUnsignedShort( fs, (ushort)this.Track.size() ); + writeUnsignedShort( fs, Track.size() ); //時間単位 - fs.WriteByte( 0x01 ); - fs.WriteByte( 0xe0 ); + fs.write( (byte)0x01 ); + fs.write( (byte)0xe0 ); #endregion #region Master Track //チャンクタイプ - fs.Write( _MTRK, 0, 4 ); + fs.write( _MTRK, 0, 4 ); //データ長。とりあえず0を入れておく - fs.Write( new byte[] { 0x00, 0x00, 0x00, 0x00 }, 0, 4 ); - first_position = fs.Position; + fs.write( new byte[] { (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00 }, 0, 4 ); + first_position = fs.getFilePointer(); //トラック名 writeFlexibleLengthUnsignedLong( fs, 0 );//デルタタイム - fs.WriteByte( 0xff );//ステータスタイプ - fs.WriteByte( 0x03 );//イベントタイプSequence/Track Name - fs.WriteByte( (byte)_MASTER_TRACK.Length );//トラック名の文字数。これは固定 - fs.Write( _MASTER_TRACK, 0, _MASTER_TRACK.Length ); + fs.write( (byte)0xff );//ステータスタイプ + fs.write( (byte)0x03 );//イベントタイプSequence/Track Name + fs.write( (byte)_MASTER_TRACK.Length );//トラック名の文字数。これは固定 + fs.write( _MASTER_TRACK, 0, _MASTER_TRACK.Length ); Vector events = new Vector(); for ( Iterator itr = TimesigTable.iterator(); itr.hasNext(); ) { @@ -2677,47 +3001,55 @@ namespace Boare.Lib.Vsq { events.add( MidiEvent.generateTimeSigEvent( entry.Clock, entry.Numerator, entry.Denominator ) ); last_clock = Math.Max( last_clock, entry.Clock ); } - for( Iterator itr = TempoTable.iterator(); itr.hasNext(); ){ + for ( Iterator itr = TempoTable.iterator(); itr.hasNext(); ) { TempoTableEntry entry = (TempoTableEntry)itr.next(); events.add( MidiEvent.generateTempoChangeEvent( entry.Clock, entry.Tempo ) ); last_clock = Math.Max( last_clock, entry.Clock ); } #if DEBUG - Console.WriteLine( " events.Count=" + events.size() ); + PortUtil.println( " events.Count=" + events.size() ); #endif Collections.sort( events ); long last = 0; - for ( Iterator itr = events.iterator(); itr.hasNext(); ){ + for ( Iterator itr = events.iterator(); itr.hasNext(); ) { MidiEvent me = (MidiEvent)itr.next(); #if DEBUG - Console.WriteLine( "me.Clock=" + me.clock ); + PortUtil.println( "me.Clock=" + me.clock ); #endif - writeFlexibleLengthUnsignedLong( fs, (ulong)(me.clock - last) ); + writeFlexibleLengthUnsignedLong( fs, (long)(me.clock - last) ); me.writeData( fs ); last = me.clock; } //WriteFlexibleLengthUnsignedLong( fs, (ulong)(last_clock + 120 - last) ); writeFlexibleLengthUnsignedLong( fs, 0 ); - fs.WriteByte( 0xff ); - fs.WriteByte( 0x2f );//イベントタイプEnd of Track - fs.WriteByte( 0x00 ); - long pos = fs.Position; - fs.Seek( first_position - 4, SeekOrigin.Begin ); - writeUnsignedInt( fs, (uint)(pos - first_position) ); - fs.Seek( pos, SeekOrigin.Begin ); + fs.write( (byte)0xff ); + fs.write( (byte)0x2f );//イベントタイプEnd of Track + fs.write( (byte)0x00 ); + long pos = fs.getFilePointer(); + fs.seek( first_position - 4 ); + writeUnsignedInt( fs, pos - first_position ); + fs.seek( pos ); #endregion #region トラック - VsqFile temp = (VsqFile)this.Clone(); - temp.Track.get( 1 ).setMaster( (VsqMaster)Master.Clone() ); - temp.Track.get( 1 ).setMixer( (VsqMixer)Mixer.Clone() ); + VsqFile temp = (VsqFile)this.clone(); + temp.Track.get( 1 ).setMaster( (VsqMaster)Master.clone() ); + temp.Track.get( 1 ).setMixer( (VsqMixer)Mixer.clone() ); printTrack( temp, 1, fs, msPreSend, encoding ); - for ( int track = 2; track < Track.size(); track++ ) { + int count = Track.size(); + for ( int track = 2; track < count; track++ ) { printTrack( this, track, fs, msPreSend, encoding ); } #endregion - + } catch ( Exception ex ) { + } finally { + if ( fs != null ) { + try { + fs.close(); + } catch ( Exception ex2 ) { + } + } } } @@ -2733,7 +3065,19 @@ namespace Boare.Lib.Vsq { for ( int i = 0; i < c; i++ ) { format += "0000"; } - return "DM:" + count.ToString( format ) + ":"; + return "DM:" + PortUtil.formatDecimal( format, count ) + ":"; + } + + public static byte[] getLinePrefixBytes( int count ) { + int digits = getHowManyDigits( count ); + int c = (digits - 1) / 4 + 1; + String format = ""; + for ( int i = 0; i < c; i++ ) { + format += "0000"; + } + String str = "DM:" + PortUtil.formatDecimal( format, count ) + ":"; + byte[] ret = PortUtil.getEncodedByte( "ASCII", str ); + return ret; } /// @@ -2764,9 +3108,13 @@ namespace Boare.Lib.Vsq { /// /// /// - public static void writeCharArray( FileStream fs, char[] item ) { + public static void writeCharArray( RandomAccessFile fs, char[] item ) +#if JAVA + throws IOException +#endif + { for ( int i = 0; i < item.Length; i++ ) { - fs.WriteByte( (byte)item[i] ); + fs.write( (byte)item[i] ); } } @@ -2774,33 +3122,35 @@ namespace Boare.Lib.Vsq { /// ushort値をビッグエンディアンでfsに書き込みます /// /// - public static void writeUnsignedShort( FileStream fs, ushort data ) { - byte[] dat = BitConverter.GetBytes( data ); - if ( BitConverter.IsLittleEndian ) { - Array.Reverse( dat ); - } - fs.Write( dat, 0, dat.Length ); + public static void writeUnsignedShort( RandomAccessFile fs, int data ) +#if JAVA + throws IOException +#endif + { + byte[] dat = PortUtil.getbytes_uint16_be( data ); + fs.write( dat, 0, dat.Length ); } /// /// uint値をビッグエンディアンでfsに書き込みます /// /// - public static void writeUnsignedInt( FileStream fs, uint data ) { - byte[] dat = BitConverter.GetBytes( data ); - if ( BitConverter.IsLittleEndian ) { - Array.Reverse( dat ); - } - fs.Write( dat, 0, dat.Length ); + public static void writeUnsignedInt( RandomAccessFile fs, long data ) +#if JAVA + throws IOException +#endif + { + byte[] dat = PortUtil.getbytes_uint32_be( data ); + fs.write( dat, 0, dat.Length ); } /// /// SMFの可変長数値表現を使って、ulongをbyte[]に変換します /// /// - public static byte[] getBytesFlexibleLengthUnsignedLong( ulong number ) { + public static byte[] getBytesFlexibleLengthUnsignedLong( long number ) { boolean[] bits = new boolean[64]; - ulong val = 0x1; + long val = (byte)0x1; bits[0] = (number & val) == val; for ( int i = 1; i < 64; i++ ) { val = val << 1; @@ -2817,8 +3167,8 @@ namespace Boare.Lib.Vsq { int bytes = first / 7 + 1; byte[] ret = new byte[bytes]; for ( int i = 1; i <= bytes; i++ ) { - uint num = 0; - uint count = 0x80; + int num = 0; + int count = (byte)0x80; for ( int j = (bytes - i + 1) * 7 - 1; j >= (bytes - i + 1) * 7 - 6 - 1; j-- ) { count = count >> 1; if ( bits[j] ) { @@ -2826,7 +3176,7 @@ namespace Boare.Lib.Vsq { } } if ( i != bytes ) { - num += 0x80; + num += (byte)0x80; } ret[i - 1] = (byte)num; } @@ -2838,10 +3188,16 @@ namespace Boare.Lib.Vsq { /// /// /// - public static void writeFlexibleLengthUnsignedLong( Stream fs, ulong number ) { + public static void writeFlexibleLengthUnsignedLong( RandomAccessFile fs, long number ) +#if JAVA + throws IOException +#endif + { byte[] bytes = getBytesFlexibleLengthUnsignedLong( number ); - fs.Write( bytes, 0, bytes.Length ); + fs.write( bytes, 0, bytes.Length ); } } +#if !JAVA } +#endif diff --git a/trunk/Boare.Lib.Vsq/VsqHandle.cs b/trunk/Boare.Lib.Vsq/VsqHandle.cs new file mode 100644 index 0000000..7bf5030 --- /dev/null +++ b/trunk/Boare.Lib.Vsq/VsqHandle.cs @@ -0,0 +1,406 @@ +/* +* VsqHandle.cs +* Copyright (c) 2008-2009 kbinani +* +* This file is part of Boare.Lib.Vsq. +* +* Boare.Lib.Vsq is free software; you can redistribute it and/or +* modify it under the terms of the BSD License. +* +* Boare.Lib.Vsq 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. +*/ +#if JAVA +package org.kbinani.vsq; + +import java.io.*; +import java.util.*; +import org.kbinani.*; +#else +using System; +using bocoree; +using bocoree.java.io; +using bocoree.java.util; + +namespace Boare.Lib.Vsq { + using boolean = System.Boolean; + using Integer = System.Int32; +#endif + + /// + /// ハンドルを取り扱います。ハンドルにはLyricHandle、VibratoHandle、IconHandleおよびNoteHeadHandleがある + /// +#if JAVA + public class VsqHandle implements Serializable { +#else + [Serializable] + public class VsqHandle { +#endif + public VsqHandleType m_type; + public int Index; + public String IconID = ""; + public String IDS = ""; + public Lyric L0; + public Vector Trailing = new Vector(); + public int Original; + public String Caption = ""; + public int Length; + public int StartDepth; + public VibratoBPList DepthBP; + public int StartRate; + public VibratoBPList RateBP; + public int Language; + public int Program; + public int Duration; + public int Depth; + + public VsqHandle() { + } + + public int getLength() { + return Length; + } + + public void setLength( int value ) { + Length = value; + } + + public LyricHandle castToLyricHandle() { + LyricHandle ret = new LyricHandle(); + ret.L0 = L0; + ret.Index = Index; + ret.Trailing = Trailing; + return ret; + } + + public VibratoHandle castToVibratoHandle() { + VibratoHandle ret = new VibratoHandle(); + ret.Index = Index; + ret.Caption = Caption; + ret.DepthBP = (VibratoBPList)DepthBP.clone(); + ret.IconID = IconID; + ret.IDS = IDS; + ret.Index = Index; + ret.setLength( Length ); + ret.Original = Original; + ret.RateBP = (VibratoBPList)RateBP.clone(); + ret.StartDepth = StartDepth; + ret.StartRate = StartRate; + return ret; + } + + public IconHandle castToIconHandle() { + IconHandle ret = new IconHandle(); + ret.Index = Index; + ret.Caption = Caption; + ret.IconID = IconID; + ret.IDS = IDS; + ret.Index = Index; + ret.Language = Language; + ret.setLength( Length ); + ret.Original = Original; + ret.Program = Program; + return ret; + } + + public NoteHeadHandle castToNoteHeadHandle() { + NoteHeadHandle ret = new NoteHeadHandle(); + ret.Caption = Caption; + ret.Depth = Depth; + ret.Duration = Duration; + ret.IconID = IconID; + ret.IDS = IDS; + ret.setLength( Length ); + ret.Original = Original; + return ret; + } + + /// + /// インスタンスをストリームに書き込みます。 + /// encode=trueの場合、2バイト文字をエンコードして出力します。 + /// + /// 書き込み対象 + private void writeCor( ITextWriter sw ) +#if JAVA + throws IOException +#endif + { + sw.writeLine( this.toString() ); + } + + public void write( TextMemoryStream sw ) +#if JAVA + throws IOException +#endif + { + writeCor( sw ); + } + + public void write( BufferedWriter sw ) +#if JAVA + throws IOException +#endif + { + writeCor( new WrappedStreamWriter( sw ) ); + } + + /// + /// FileStreamから読み込みながらコンストラクト + /// + /// 読み込み対象 + public VsqHandle( TextMemoryStream sr, int value, ByRef last_line ) { + this.Index = value; + String[] spl; + String[] spl2; + + // default値で梅 + m_type = VsqHandleType.Vibrato; + IconID = ""; + IDS = "normal"; + L0 = new Lyric( "" ); + Original = 0; + Caption = ""; + Length = 0; + StartDepth = 0; + DepthBP = null; + int depth_bp_num = 0; + StartRate = 0; + RateBP = null; + int rate_bp_num = 0; + Language = 0; + Program = 0; + Duration = 0; + Depth = 64; + + String tmpDepthBPX = ""; + String tmpDepthBPY = ""; + String tmpRateBPX = ""; + String tmpRateBPY = ""; + + // "["にぶち当たるまで読込む + last_line.value = sr.readLine(); + while ( !last_line.value.StartsWith( "[" ) ) { + spl = PortUtil.splitString( last_line.value, new char[] { '=' } ); + String search = spl[0]; + if ( search.Equals( "Language" ) ) { + m_type = VsqHandleType.Singer; + Language = PortUtil.parseInt( spl[1] ); + } else if ( search.Equals( "Program" ) ) { + Program = PortUtil.parseInt( spl[1] ); + } else if ( search.Equals( "IconID" ) ) { + IconID = spl[1]; + } else if ( search.Equals( "IDS" ) ) { + IDS = spl[1]; + } else if ( search.Equals( "Original" ) ) { + Original = PortUtil.parseInt( spl[1] ); + } else if ( search.Equals( "Caption" ) ) { + Caption = spl[1]; + for ( int i = 2; i < spl.Length; i++ ) { + Caption += "=" + spl[i]; + } + } else if ( search.Equals( "Length" ) ) { + Length = PortUtil.parseInt( spl[1] ); + } else if ( search.Equals( "StartDepth" ) ) { + StartDepth = PortUtil.parseInt( spl[1] ); + } else if ( search.Equals( "DepthBPNum" ) ) { + depth_bp_num = PortUtil.parseInt( spl[1] ); + } else if ( search.Equals( "DepthBPX" ) ) { + tmpDepthBPX = spl[1]; + } else if ( search.Equals( "DepthBPY" ) ) { + tmpDepthBPY = spl[1]; + } else if ( search.Equals( "StartRate" ) ) { + m_type = VsqHandleType.Vibrato; + StartRate = PortUtil.parseInt( spl[1] ); + } else if ( search.Equals( "RateBPNum" ) ) { + rate_bp_num = PortUtil.parseInt( spl[1] ); + } else if ( search.Equals( "RateBPX" ) ) { + tmpRateBPX = spl[1]; + } else if ( search.Equals( "RateBPY" ) ) { + tmpRateBPY = spl[1]; + } else if ( search.Equals( "Duration" ) ) { + m_type = VsqHandleType.NoteHeadHandle; + Duration = PortUtil.parseInt( spl[1] ); + } else if ( search.Equals( "Depth" ) ) { + Duration = PortUtil.parseInt( spl[1] ); + } else if ( search.StartsWith( "L" ) && PortUtil.getStringLength( search ) >= 2 ){ + String num = search.Substring( 1 ); + ByRef vals = new ByRef( 0 ); + if( PortUtil.tryParseInt( num, vals ) ){ + Lyric lyric = new Lyric( spl[1] ); + m_type = VsqHandleType.Lyric; + int index = vals.value; + if( index == 0 ){ + L0 = lyric; + }else{ + Trailing.set( index - 1, lyric ); + } + } + } + if ( sr.peek() < 0 ) { + break; + } + last_line.value = sr.readLine(); + } + /*if ( IDS != "normal" ) { + m_type = VsqHandleType.Singer; + } else if ( IconID != "" ) { + m_type = VsqHandleType.Vibrato; + } else { + m_type = VsqHandleType.Lyric; + }*/ + + // RateBPX, RateBPYの設定 + if ( m_type == VsqHandleType.Vibrato ) { + if ( rate_bp_num > 0 ) { + float[] rate_bp_x = new float[rate_bp_num]; + spl2 = PortUtil.splitString( tmpRateBPX, new char[] { ',' } ); + for ( int i = 0; i < rate_bp_num; i++ ) { + rate_bp_x[i] = PortUtil.parseFloat( spl2[i] ); + } + + int[] rate_bp_y = new int[rate_bp_num]; + spl2 = PortUtil.splitString( tmpRateBPY, new char[] { ',' } ); + for ( int i = 0; i < rate_bp_num; i++ ) { + rate_bp_y[i] = PortUtil.parseInt( spl2[i] ); + } + RateBP = new VibratoBPList( rate_bp_x, rate_bp_y ); + } else { + //m_rate_bp_x = null; + //m_rate_bp_y = null; + RateBP = new VibratoBPList(); + } + + // DepthBPX, DepthBPYの設定 + if ( depth_bp_num > 0 ) { + float[] depth_bp_x = new float[depth_bp_num]; + spl2 = PortUtil.splitString( tmpDepthBPX, new char[] { ',' } ); + for ( int i = 0; i < depth_bp_num; i++ ) { + depth_bp_x[i] = PortUtil.parseFloat( spl2[i] ); + } + + int[] depth_bp_y = new int[depth_bp_num]; + spl2 = PortUtil.splitString( tmpDepthBPY, new char[] { ',' } ); + for ( int i = 0; i < depth_bp_num; i++ ) { + depth_bp_y[i] = PortUtil.parseInt( spl2[i] ); + } + DepthBP = new VibratoBPList( depth_bp_x, depth_bp_y ); + } else { + DepthBP = new VibratoBPList(); + //m_depth_bp_x = null; + //m_depth_bp_y = null; + } + } else { + DepthBP = new VibratoBPList(); + RateBP = new VibratoBPList(); + } + } + + /// + /// ハンドル指定子(例えば"h#0123"という文字列)からハンドル番号を取得します + /// + /// ハンドル指定子 + /// ハンドル番号 + public static int HandleIndexFromString( String _string ) { + String[] spl = PortUtil.splitString( _string, new char[] { '#' } ); + return PortUtil.parseInt( spl[1] ); + } + + /// + /// インスタンスをテキストファイルに出力します + /// + /// 出力先 + public void print( BufferedWriter sw ) +#if JAVA + throws IOException +#endif + { + String result = this.ToString(); + sw.write( result ); + sw.newLine(); + } + + /// + /// インスタンスをコンソール画面に出力します + /// + private void print() { + String result = this.ToString(); + PortUtil.println( result ); + } + + /// + /// インスタンスを文字列に変換します + /// + /// 2バイト文字をエンコードするか否かを指定するフラグ + /// インスタンスを変換した文字列 + public String toString() { + String result = ""; + result += "[h#" + PortUtil.formatDecimal( "0000", Index ) + "]"; + if ( m_type == VsqHandleType.Lyric ) { + result += "\n" + "L0=" + L0.toString(); + int c = Trailing.size(); + for( int i = 0; i < c; i++ ){ + result += "\n" + "L" + (i + 1) + Trailing.get( i ).toString(); + } + } else if ( m_type == VsqHandleType.Vibrato ) { + result += "\n" + "IconID=" + IconID + "\n"; + result += "IDS=" + IDS + "\n"; + result += "Original=" + Original + "\n"; + result += "Caption=" + Caption + "\n"; + result += "Length=" + Length + "\n"; + result += "StartDepth=" + StartDepth + "\n"; + result += "DepthBPNum=" + DepthBP.getCount() + "\n"; + if ( DepthBP.getCount() > 0 ) { + result += "DepthBPX=" + PortUtil.formatDecimal( "0.000000", DepthBP.getElement( 0 ).X ); + for ( int i = 1; i < DepthBP.getCount(); i++ ) { + result += "," + PortUtil.formatDecimal( "0.000000", DepthBP.getElement( i ).X ); + } + result += "\n" + "DepthBPY=" + DepthBP.getElement( 0 ).Y; + for ( int i = 1; i < DepthBP.getCount(); i++ ) { + result += "," + DepthBP.getElement( i ).Y; + } + result += "\n"; + } + result += "StartRate=" + StartRate + "\n"; + result += "RateBPNum=" + RateBP.getCount(); + if ( RateBP.getCount() > 0 ) { + result += "\n" + "RateBPX=" + PortUtil.formatDecimal( "0.000000", RateBP.getElement( 0 ).X ); + for ( int i = 1; i < RateBP.getCount(); i++ ) { + result += "," + PortUtil.formatDecimal( "0.000000", RateBP.getElement( i ).X ); + } + result += "\n" + "RateBPY=" + RateBP.getElement( 0 ).Y; + for ( int i = 1; i < RateBP.getCount(); i++ ) { + result += "," + RateBP.getElement( i ).Y; + } + } + } else if ( m_type == VsqHandleType.Singer ) { + result += "\n" + "IconID=" + IconID + "\n"; + result += "IDS=" + IDS + "\n"; + result += "Original=" + Original + "\n"; + result += "Caption=" + Caption + "\n"; + result += "Length=" + Length + "\n"; + result += "Language=" + Language + "\n"; + result += "Program=" + Program; + } else if ( m_type == VsqHandleType.NoteHeadHandle ) { + result += "\n" + "IconID=" + IconID + "\n"; + result += "IDS=" + IDS + "\n"; + result += "Original=" + Original + "\n"; + result += "Caption=" + Caption + "\n"; + result += "Length=" + Length + "\n"; + result += "Duration=" + Duration + "\n"; + result += "Depth=" + Depth; + } + return result; + } + +#if !JAVA + public override string ToString() { + return toString(); + } +#endif + + } + +#if !JAVA +} +#endif diff --git a/trunk/Boare.Lib.Vsq/VsqHandleType.cs b/trunk/Boare.Lib.Vsq/VsqHandleType.cs new file mode 100644 index 0000000..82e2aea --- /dev/null +++ b/trunk/Boare.Lib.Vsq/VsqHandleType.cs @@ -0,0 +1,29 @@ +/* +* VsqHandleType.cs +* Copyright (c) 2008-2009 kbinani +* +* This file is part of Boare.Lib.Vsq. +* +* Boare.Lib.Vsq is free software; you can redistribute it and/or +* modify it under the terms of the BSD License. +* +* Boare.Lib.Vsq 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. +*/ +#if JAVA +package org.kbinani.vsq; +#else +namespace Boare.Lib.Vsq { +#endif + + public enum VsqHandleType { + Lyric, + Vibrato, + Singer, + NoteHeadHandle, + } + +#if !JAVA +} +#endif diff --git a/trunk/Boare.Lib.Vsq/VsqID.cs b/trunk/Boare.Lib.Vsq/VsqID.cs new file mode 100644 index 0000000..2530350 --- /dev/null +++ b/trunk/Boare.Lib.Vsq/VsqID.cs @@ -0,0 +1,334 @@ +/* +* VsqID.cs +* Copyright (c) 2008-2009 kbinani +* +* This file is part of Boare.Lib.Vsq. +* +* Boare.Lib.Vsq is free software; you can redistribute it and/or +* modify it under the terms of the BSD License. +* +* Boare.Lib.Vsq 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. +*/ +#if JAVA +package org.kbinani.vsq; + +import java.io.*; +import org.kbinani.*; +#else +using System; +using bocoree; +using bocoree.java.io; + +namespace Boare.Lib.Vsq { + using boolean = System.Boolean; +#endif + + /// + /// メタテキストに埋め込まれるIDを表すクラス。 + /// +#if JAVA + public class VsqID implements Cloneable, Serializable { +#else + [Serializable] + public class VsqID : ICloneable { +#endif + public const int MAX_NOTE_LENGTH = 16383; +#if JAVA + public int value; + public int IconHandle_index; + public int LyricHandle_index; + public int VibratoHandle_index; + public int NoteHeadHandle_index; +#else + internal int value; + internal int IconHandle_index; + internal int LyricHandle_index; + internal int VibratoHandle_index; + internal int NoteHeadHandle_index; +#endif + public VsqIDType type; + public IconHandle IconHandle; + public int Length; + public int Note; + public int Dynamics; + public int PMBendDepth; + public int PMBendLength; + public int PMbPortamentoUse; + public int DEMdecGainRate; + public int DEMaccent; + public LyricHandle LyricHandle; + public VibratoHandle VibratoHandle; + public int VibratoDelay; + public NoteHeadHandle NoteHeadHandle; + public int pMeanOnsetFirstNote = 0x0a; + public int vMeanNoteTransition = 0x0c; + public int d4mean = 0x18; + public int pMeanEndingNote = 0x0c; + + public static VsqID EOS = new VsqID( -1 ); + + public int getLength() { + return Length; + } + + public void setLength( int value ) { + Length = value; + } + +#if JAVA + public static boolean isXmlIgnored( String name ){ + if( name.equals( "IconHandle_index" ) ){ + return true; + }else if( name.equals( "value" ) ){ + return true; + }else if( name.equals( "LyricHandle_index" ) ){ + return true; + }else if( name.equals( "NoteHeadHandle_index" ) ){ + return true; + }else if( name.equals( "VibratoHandle_index" ) ){ + return true; + } + return false; + } + + public static String getXmlElementName( String name ){ + return name; + } +#endif + + /// + /// このインスタンスの簡易コピーを取得します。 + /// + /// このインスタンスの簡易コピー + public Object clone() { + VsqID result = new VsqID( this.value ); + result.type = this.type; + if ( this.IconHandle != null ) { + result.IconHandle = (IconHandle)this.IconHandle.clone(); + } + result.setLength( Length ); + result.Note = this.Note; + result.Dynamics = this.Dynamics; + result.PMBendDepth = this.PMBendDepth; + result.PMBendLength = this.PMBendLength; + result.PMbPortamentoUse = this.PMbPortamentoUse; + result.DEMdecGainRate = this.DEMdecGainRate; + result.DEMaccent = this.DEMaccent; + result.d4mean = this.d4mean; + result.pMeanOnsetFirstNote = this.pMeanOnsetFirstNote; + result.vMeanNoteTransition = this.vMeanNoteTransition; + result.pMeanEndingNote = this.pMeanEndingNote; + if ( this.LyricHandle != null ) { + result.LyricHandle = (LyricHandle)this.LyricHandle.clone(); + } + if ( this.VibratoHandle != null ) { + result.VibratoHandle = (VibratoHandle)this.VibratoHandle.clone(); + } + result.VibratoDelay = this.VibratoDelay; + if ( NoteHeadHandle != null ) { + result.NoteHeadHandle = (NoteHeadHandle)NoteHeadHandle.clone(); + } + return result; + } + +#if !JAVA + public object Clone() { + return clone(); + } +#endif + + /// + /// IDの番号(ID#****の****)を指定したコンストラクタ。 + /// + /// IDの番号 + public VsqID( int a_value ) { + value = a_value; + } + +#if JAVA + public VsqID(){ + this( 0 ); +#else + public VsqID() + : this( 0 ) { +#endif + } + + /// + /// テキストファイルからのコンストラクタ + /// + /// 読み込み対象 + /// + /// 読み込んだ最後の行が返されます + public VsqID( TextMemoryStream sr, int value, ByRef last_line ) { + String[] spl; + this.value = value; + this.type = VsqIDType.Unknown; + this.IconHandle_index = -2; + this.LyricHandle_index = -1; + this.VibratoHandle_index = -1; + this.NoteHeadHandle_index = -1; + this.setLength( 0 ); + this.Note = 0; + this.Dynamics = 64; + this.PMBendDepth = 8; + this.PMBendLength = 0; + this.PMbPortamentoUse = 0; + this.DEMdecGainRate = 50; + this.DEMaccent = 50; + //this.LyricHandle_index = -2; + //this.VibratoHandle_index = -2; + this.VibratoDelay = 0; + last_line.value = sr.readLine(); + while ( !last_line.value.StartsWith( "[" ) ) { + spl = PortUtil.splitString( last_line.value, new char[] { '=' } ); + String search = spl[0]; + if ( search.Equals( "Type" ) ) { + if ( spl[1].Equals( "Anote" ) ) { + type = VsqIDType.Anote; + } else if ( spl[1].Equals( "Singer" ) ) { + type = VsqIDType.Singer; + } else { + type = VsqIDType.Unknown; + } + } else if ( search.Equals( "Length" ) ) { + this.setLength( PortUtil.parseInt( spl[1] ) ); + } else if ( search.Equals( "Note#" ) ) { + this.Note = PortUtil.parseInt( spl[1] ); + } else if ( search.Equals( "Dynamics" ) ) { + this.Dynamics = PortUtil.parseInt( spl[1] ); + } else if ( search.Equals( "PMBendDepth" ) ) { + this.PMBendDepth = PortUtil.parseInt( spl[1] ); + } else if ( search.Equals( "PMBendLength" ) ) { + this.PMBendLength = PortUtil.parseInt( spl[1] ); + } else if ( search.Equals( "DEMdecGainRate" ) ) { + this.DEMdecGainRate = PortUtil.parseInt( spl[1] ); + } else if ( search.Equals( "DEMaccent" ) ) { + this.DEMaccent = PortUtil.parseInt( spl[1] ); + } else if ( search.Equals( "LyricHandle" ) ) { + this.LyricHandle_index = VsqHandle.HandleIndexFromString( spl[1] ); + } else if ( search.Equals( "IconHandle" ) ) { + this.IconHandle_index = VsqHandle.HandleIndexFromString( spl[1] ); + } else if ( search.Equals( "VibratoHandle" ) ) { + this.VibratoHandle_index = VsqHandle.HandleIndexFromString( spl[1] ); + } else if ( search.Equals( "VibratoDelay" ) ) { + this.VibratoDelay = PortUtil.parseInt( spl[1] ); + } else if ( search.Equals( "PMbPortamentoUse" ) ) { + PMbPortamentoUse = PortUtil.parseInt( spl[1] ); + } else if ( search.Equals( "NoteHeadHandle" ) ) { + NoteHeadHandle_index = VsqHandle.HandleIndexFromString( spl[1] ); + } + if ( sr.peek() < 0 ) { + break; + } + last_line.value = sr.readLine(); + } + } + + public override String ToString() { + String ret = "{Type=" + type; + if ( type == VsqIDType.Anote ) { + ret += ", Length=" + Length; + ret += ", Note#=" + Note; + ret += ", Dynamics=" + Dynamics; + ret += ", PMBendDepth=" + PMBendDepth; + ret += ", PMBendLength=" + PMBendLength; + ret += ", PMbPortamentoUse=" + PMbPortamentoUse; + ret += ", DEMdecGainRate=" + DEMdecGainRate; + ret += ", DEMaccent=" + DEMaccent; + if ( LyricHandle != null ) { + ret += ", LyricHandle=h#" + PortUtil.formatDecimal( "0000", LyricHandle_index ); + } + if ( VibratoHandle != null ) { + ret += ", VibratoHandle=h#" + PortUtil.formatDecimal( "0000", VibratoHandle_index ); + ret += ", VibratoDelay=" + VibratoDelay; + } + } else if ( type == VsqIDType.Singer ) { + ret += ", IconHandle=h#" + PortUtil.formatDecimal( "0000", IconHandle_index ); + } + ret += "}"; + return ret; + } + + /// + /// VsqIDを構築するテストを行います。 + /// + /// テストに成功すればtrue、そうでなければfalseを返します + public static boolean test() { + String fpath = PortUtil.createTempFile(); + BufferedWriter sw = null; + try { + sw = new BufferedWriter( new OutputStreamWriter( new FileOutputStream( fpath ), "UTF-8" ) ); + sw.write( "Type=Anote" ); + sw.newLine(); + sw.write( "Length=320" ); + sw.newLine(); + sw.write( "Note#=67" ); + sw.newLine(); + sw.write( "Dynamics=64" ); + sw.newLine(); + sw.write( "PMBendDepth=8" ); + sw.newLine(); + sw.write( "PMBendLength=1" ); + sw.newLine(); + sw.write( "PMbPortamentoUse=1" ); + sw.newLine(); + sw.write( "DEMdecGainRate=50" ); + sw.newLine(); + sw.write( "DEMaccent=50" ); + sw.newLine(); + sw.write( "LyricHandle=h#0111" ); + sw.newLine(); + sw.write( "[ID#0104]" ); + sw.newLine(); + } catch ( Exception ex ) { + } finally { + if ( sw != null ) { + try { + sw.close(); + } catch ( Exception ex2 ) { + } + } + } + + ByRef last_line = new ByRef( "" ); + boolean result = false; + TextMemoryStream sr = null; + try { + sr = new TextMemoryStream( fpath, "UTF8" ); + VsqID vsqID = new VsqID( sr, 103, last_line ); + if ( vsqID.type == VsqIDType.Anote && + vsqID.getLength() == 320 && + vsqID.Note == 67 && + vsqID.Dynamics == 64 && + vsqID.PMBendDepth == 8 && + vsqID.PMBendLength == 1 && + vsqID.PMbPortamentoUse == 1 && + vsqID.DEMdecGainRate == 50 && + vsqID.DEMaccent == 50 && + vsqID.LyricHandle_index == 111 && + last_line.Equals( "[ID#0104]" ) ) { + result = true; + } else { + result = false; + } + } catch ( Exception ex ) { + } finally { + if ( sr != null ) { + try { + sr.close(); + } catch ( Exception ex2 ) { + } + } + } + PortUtil.deleteFile( fpath ); + return result; + } + + } + +#if !JAVA +} +#endif diff --git a/trunk/Boare.Lib.Vsq/VsqIDType.cs b/trunk/Boare.Lib.Vsq/VsqIDType.cs new file mode 100644 index 0000000..fe3783e --- /dev/null +++ b/trunk/Boare.Lib.Vsq/VsqIDType.cs @@ -0,0 +1,28 @@ +/* +* VsqIDType.cs +* Copyright (c) 2008-2009 kbinani +* +* This file is part of Boare.Lib.Vsq. +* +* Boare.Lib.Vsq is free software; you can redistribute it and/or +* modify it under the terms of the BSD License. +* +* Boare.Lib.Vsq 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. +*/ +#if JAVA +package org.kbinani.vsq; +#else +namespace Boare.Lib.Vsq { +#endif + + public enum VsqIDType { + Singer, + Anote, + Unknown + } + +#if !JAVA +} +#endif diff --git a/trunk/Boare.Lib.Vsq/VsqMaster.cs b/trunk/Boare.Lib.Vsq/VsqMaster.cs new file mode 100644 index 0000000..5be9212 --- /dev/null +++ b/trunk/Boare.Lib.Vsq/VsqMaster.cs @@ -0,0 +1,148 @@ +/* +* VsqMaster.cs +* Copyright (c) 2008-2009 kbinani +* +* This file is part of Boare.Lib.Vsq. +* +* Boare.Lib.Vsq is free software; you can redistribute it and/or +* modify it under the terms of the BSD License. +* +* Boare.Lib.Vsq 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. +*/ +#if JAVA +package org.kbinani.vsq; + +import java.io.*; +import org.kbinani.*; +#else +using System; +using bocoree; +using bocoree.java.io; + +namespace Boare.Lib.Vsq { + using boolean = System.Boolean; +#endif + + /// + /// vsqファイルのメタテキストの[Master]に記録される内容を取り扱う + /// +#if JAVA + public class VsqMaster implements Cloneable, Serializable { +#else + [Serializable] + public class VsqMaster : ICloneable { +#endif + public int PreMeasure; + + public Object clone() { + VsqMaster res = new VsqMaster( PreMeasure ); + return res; + } + +#if !JAVA + public object Clone() { + return clone(); + } +#endif + +#if JAVA + public VsqMaster(){ + this( 1 ); +#else + public VsqMaster() + : this( 1 ) { +#endif + } + + /// + /// プリメジャー値を指定したコンストラクタ + /// + /// + public VsqMaster( int pre_measure ) { + this.PreMeasure = pre_measure; + } + + /// + /// テキストファイルからのコンストラクタ + /// + /// 読み込み元 + /// 最後に読み込んだ行が返されます + public VsqMaster( TextMemoryStream sr, ByRef last_line ) { + PreMeasure = 0; + String[] spl; + last_line.value = sr.readLine(); + while ( !last_line.value.StartsWith( "[" ) ) { + spl = PortUtil.splitString( last_line.value, new char[] { '=' } ); + if ( spl[0].Equals( "PreMeasure" ) ) { + this.PreMeasure = PortUtil.parseInt( spl[1] ); + } + if ( sr.peek() < 0 ) { + break; + } + last_line.value = sr.readLine(); + } + } + + /// + /// インスタンスの内容をテキストファイルに出力します + /// + /// 出力先 + public void write( TextMemoryStream sw ) { + sw.writeLine( "[Master]" ); + sw.writeLine( "PreMeasure=" + PreMeasure ); + } + + /// + /// VsqMasterのインスタンスを構築するテストを行います + /// + /// テストに成功すればtrue、そうでなければfalseを返します + public static boolean test() { + String fpath = PortUtil.createTempFile(); + BufferedWriter sw = null; + try { + sw = new BufferedWriter( new OutputStreamWriter( new FileOutputStream( fpath ), "UTF8" ) ); + sw.write( "PreMeasure=2" ); + sw.newLine(); + sw.write( "[Mixer]" ); + sw.newLine(); + } catch ( Exception ex ) { + } finally { + if ( sw != null ) { + try { + sw.close(); + } catch ( Exception ex2 ) { + } + } + } + + boolean result = false; + TextMemoryStream sr = null; + try { + sr = new TextMemoryStream( fpath, "UTF8" ); + ByRef last_line = new ByRef( "" ); + VsqMaster vsqMaster = new VsqMaster( sr, last_line ); + if ( vsqMaster.PreMeasure == 2 && + last_line.value.Equals( "[Mixer]" ) ) { + result = true; + } else { + result = false; + } + } catch ( Exception ex ) { + } finally { + if ( sr != null ) { + try { + sr.close(); + } catch ( Exception ex2 ) { + } + } + } + PortUtil.deleteFile( fpath ); + return result; + } + } + +#if !JAVA +} +#endif diff --git a/trunk/Boare.Lib.Vsq/VsqMetaText/VsqMetaText.cs b/trunk/Boare.Lib.Vsq/VsqMetaText.cs similarity index 55% rename from trunk/Boare.Lib.Vsq/VsqMetaText/VsqMetaText.cs rename to trunk/Boare.Lib.Vsq/VsqMetaText.cs index 58626f7..664cf84 100644 --- a/trunk/Boare.Lib.Vsq/VsqMetaText/VsqMetaText.cs +++ b/trunk/Boare.Lib.Vsq/VsqMetaText.cs @@ -1,34 +1,42 @@ /* - * VsqMetaText/VsqMetaText.cs - * Copyright (c) 2008-2009 kbinani - * - * This file is part of Boare.Lib.Vsq. - * - * Boare.Lib.Vsq is free software; you can redistribute it and/or - * modify it under the terms of the BSD License. - * - * Boare.Lib.Vsq 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.Drawing; -using System.IO; -using System.Text; +* VsqMetaText.cs +* Copyright (c) 2008-2009 kbinani +* +* This file is part of Boare.Lib.Vsq. +* +* Boare.Lib.Vsq is free software; you can redistribute it and/or +* modify it under the terms of the BSD License. +* +* Boare.Lib.Vsq 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. +*/ +#if JAVA +package org.kbinani.vsq; +import java.util.*; +import java.io.*; +import org.kbinani.*; +#else +using System; using bocoree; +using bocoree.java.util; +using bocoree.java.io; namespace Boare.Lib.Vsq { - using boolean = System.Boolean; using Integer = System.Int32; +#endif /// /// vsqのメタテキストの中身を処理するためのクラス /// +#if JAVA + public class VsqMetaText implements Cloneable, Serializable { +#else [Serializable] public class VsqMetaText : ICloneable { +#endif public VsqCommon Common; public VsqMaster master; public VsqMixer mixer; @@ -90,228 +98,211 @@ namespace Boare.Lib.Vsq { /// public VsqBPList OPE; - public object Clone() { + public Object clone() { VsqMetaText res = new VsqMetaText(); if ( Common != null ) { - res.Common = (VsqCommon)Common.Clone(); + res.Common = (VsqCommon)Common.clone(); } if ( master != null ) { - res.master = (VsqMaster)master.Clone(); + res.master = (VsqMaster)master.clone(); } if ( mixer != null ) { - res.mixer = (VsqMixer)mixer.Clone(); + res.mixer = (VsqMixer)mixer.clone(); } if ( Events != null ) { res.Events = new VsqEventList(); for ( Iterator itr = Events.iterator(); itr.hasNext(); ) { - res.Events.add( (VsqEvent)((VsqEvent)itr.next()).clone() ); + VsqEvent item = (VsqEvent)itr.next(); + res.Events.add( (VsqEvent)item.clone(), item.InternalID ); } } if ( PIT != null ) { - res.PIT = (VsqBPList)PIT.Clone(); + res.PIT = (VsqBPList)PIT.clone(); } if ( PBS != null ) { - res.PBS = (VsqBPList)PBS.Clone(); + res.PBS = (VsqBPList)PBS.clone(); } if ( DYN != null ) { - res.DYN = (VsqBPList)DYN.Clone(); + res.DYN = (VsqBPList)DYN.clone(); } if ( BRE != null ) { - res.BRE = (VsqBPList)BRE.Clone(); + res.BRE = (VsqBPList)BRE.clone(); } if ( BRI != null ) { - res.BRI = (VsqBPList)BRI.Clone(); + res.BRI = (VsqBPList)BRI.clone(); } if ( CLE != null ) { - res.CLE = (VsqBPList)CLE.Clone(); + res.CLE = (VsqBPList)CLE.clone(); } if ( reso1FreqBPList != null ) { - res.reso1FreqBPList = (VsqBPList)reso1FreqBPList.Clone(); + res.reso1FreqBPList = (VsqBPList)reso1FreqBPList.clone(); } if ( reso2FreqBPList != null ) { - res.reso2FreqBPList = (VsqBPList)reso2FreqBPList.Clone(); + res.reso2FreqBPList = (VsqBPList)reso2FreqBPList.clone(); } if ( reso3FreqBPList != null ) { - res.reso3FreqBPList = (VsqBPList)reso3FreqBPList.Clone(); + res.reso3FreqBPList = (VsqBPList)reso3FreqBPList.clone(); } if ( reso4FreqBPList != null ) { - res.reso4FreqBPList = (VsqBPList)reso4FreqBPList.Clone(); + res.reso4FreqBPList = (VsqBPList)reso4FreqBPList.clone(); } if ( reso1BWBPList != null ) { - res.reso1BWBPList = (VsqBPList)reso1BWBPList.Clone(); + res.reso1BWBPList = (VsqBPList)reso1BWBPList.clone(); } if ( reso2BWBPList != null ) { - res.reso2BWBPList = (VsqBPList)reso2BWBPList.Clone(); + res.reso2BWBPList = (VsqBPList)reso2BWBPList.clone(); } if ( reso3BWBPList != null ) { - res.reso3BWBPList = (VsqBPList)reso3BWBPList.Clone(); + res.reso3BWBPList = (VsqBPList)reso3BWBPList.clone(); } if ( reso4BWBPList != null ) { - res.reso4BWBPList = (VsqBPList)reso4BWBPList.Clone(); + res.reso4BWBPList = (VsqBPList)reso4BWBPList.clone(); } if ( reso1AmpBPList != null ) { - res.reso1AmpBPList = (VsqBPList)reso1AmpBPList.Clone(); + res.reso1AmpBPList = (VsqBPList)reso1AmpBPList.clone(); } if ( reso2AmpBPList != null ) { - res.reso2AmpBPList = (VsqBPList)reso2AmpBPList.Clone(); + res.reso2AmpBPList = (VsqBPList)reso2AmpBPList.clone(); } if ( reso3AmpBPList != null ) { - res.reso3AmpBPList = (VsqBPList)reso3AmpBPList.Clone(); + res.reso3AmpBPList = (VsqBPList)reso3AmpBPList.clone(); } if ( reso4AmpBPList != null ) { - res.reso4AmpBPList = (VsqBPList)reso4AmpBPList.Clone(); + res.reso4AmpBPList = (VsqBPList)reso4AmpBPList.clone(); } if ( harmonics != null ) { - res.harmonics = (VsqBPList)harmonics.Clone(); + res.harmonics = (VsqBPList)harmonics.clone(); } if ( fx2depth != null ) { - res.fx2depth = (VsqBPList)fx2depth.Clone(); + res.fx2depth = (VsqBPList)fx2depth.clone(); } if ( GEN != null ) { - res.GEN = (VsqBPList)GEN.Clone(); + res.GEN = (VsqBPList)GEN.clone(); } if ( POR != null ) { - res.POR = (VsqBPList)POR.Clone(); + res.POR = (VsqBPList)POR.clone(); } if ( OPE != null ) { - res.OPE = (VsqBPList)OPE.Clone(); + res.OPE = (VsqBPList)OPE.clone(); } return res; } +#if !JAVA + public object Clone() { + return clone(); + } +#endif + public VsqEventList getEventList() { return Events; } - internal VsqBPList getElement( String curve ) { - switch ( curve.Trim().ToLower() ) { - case "bre": - return this.BRE; - case "bri": - return this.BRI; - case "cle": - return this.CLE; - case "dyn": - return this.DYN; - case "gen": - return this.GEN; - case "ope": - return this.OPE; - case "pbs": - return this.PBS; - case "pit": - return this.PIT; - case "por": - return this.POR; - case "harmonics": - return this.harmonics; - case "fx2depth": - return this.fx2depth; - case "reso1amp": - return this.reso1AmpBPList; - case "reso1bw": - return this.reso1BWBPList; - case "reso1freq": - return this.reso1FreqBPList; - case "reso2amp": - return this.reso2AmpBPList; - case "reso2bw": - return this.reso2BWBPList; - case "reso2freq": - return this.reso2FreqBPList; - case "reso3amp": - return this.reso3AmpBPList; - case "reso3bw": - return this.reso3BWBPList; - case "reso3freq": - return this.reso3FreqBPList; - case "reso4amp": - return this.reso4AmpBPList; - case "reso4bw": - return this.reso4BWBPList; - case "reso4freq": - return this.reso4FreqBPList; - default: - return null; + public VsqBPList getElement( String curve ) { + String search = curve.Trim().ToLower(); + if ( search.Equals( "bre" ) ) { + return this.BRE; + } else if ( search.Equals( "bri" ) ) { + return this.BRI; + } else if ( search.Equals( "cle" ) ) { + return this.CLE; + } else if ( search.Equals( "dyn" ) ) { + return this.DYN; + } else if ( search.Equals( "gen" ) ) { + return this.GEN; + } else if ( search.Equals( "ope" ) ) { + return this.OPE; + } else if ( search.Equals( "pbs" ) ) { + return this.PBS; + } else if ( search.Equals( "pit" ) ) { + return this.PIT; + } else if ( search.Equals( "por" ) ) { + return this.POR; + } else if ( search.Equals( "harmonics" ) ) { + return this.harmonics; + } else if ( search.Equals( "fx2depth" ) ) { + return this.fx2depth; + } else if ( search.Equals( "reso1amp" ) ) { + return this.reso1AmpBPList; + } else if ( search.Equals( "reso1bw" ) ) { + return this.reso1BWBPList; + } else if ( search.Equals( "reso1freq" ) ) { + return this.reso1FreqBPList; + } else if ( search.Equals( "reso2amp" ) ) { + return this.reso2AmpBPList; + } else if ( search.Equals( "reso2bw" ) ) { + return this.reso2BWBPList; + } else if ( search.Equals( "reso2freq" ) ) { + return this.reso2FreqBPList; + } else if ( search.Equals( "reso3amp" ) ) { + return this.reso3AmpBPList; + } else if ( search.Equals( "reso3bw" ) ) { + return this.reso3BWBPList; + } else if ( search.Equals( "reso3freq" ) ) { + return this.reso3FreqBPList; + } else if ( search.Equals( "reso4amp" ) ) { + return this.reso4AmpBPList; + } else if ( search.Equals( "reso4bw" ) ) { + return this.reso4BWBPList; + } else if ( search.Equals( "reso4freq" ) ) { + return this.reso4FreqBPList; + } else { + return null; } } - internal void setElement( String curve, VsqBPList value ) { - switch ( curve.Trim().ToLower() ) { - case "bre": - this.BRE = value; - break; - case "bri": - this.BRI = value; - break; - case "cle": - this.CLE = value; - break; - case "dyn": - this.DYN = value; - break; - case "gen": - this.GEN = value; - break; - case "ope": - this.OPE = value; - break; - case "pbs": - this.PBS = value; - break; - case "pit": - this.PIT = value; - break; - case "por": - this.POR = value; - break; - case "harmonics": - this.harmonics = value; - break; - case "fx2depth": - this.fx2depth = value; - break; - case "reso1amp": - this.reso1AmpBPList = value; - break; - case "reso1bw": - this.reso1BWBPList = value; - break; - case "reso1freq": - this.reso1FreqBPList = value; - break; - case "reso2amp": - this.reso2AmpBPList = value; - break; - case "reso2bw": - this.reso2BWBPList = value; - break; - case "reso2freq": - this.reso2FreqBPList = value; - break; - case "reso3amp": - this.reso3AmpBPList = value; - break; - case "reso3bw": - this.reso3BWBPList = value; - break; - case "reso3freq": - this.reso3FreqBPList = value; - break; - case "reso4amp": - this.reso4AmpBPList = value; - break; - case "reso4bw": - this.reso4BWBPList = value; - break; - case "reso4freq": - this.reso4FreqBPList = value; - break; - default: + public void setElement( String curve, VsqBPList value ) { + String search = curve.Trim().ToLower(); + if ( search.Equals( "bre" ) ) { + this.BRE = value; + } else if ( search.Equals( "bri" ) ) { + this.BRI = value; + } else if ( search.Equals( "cle" ) ) { + this.CLE = value; + } else if ( search.Equals( "dyn" ) ) { + this.DYN = value; + } else if ( search.Equals( "gen" ) ) { + this.GEN = value; + } else if ( search.Equals( "ope" ) ) { + this.OPE = value; + } else if ( search.Equals( "pbs" ) ) { + this.PBS = value; + } else if ( search.Equals( "pit" ) ) { + this.PIT = value; + } else if ( search.Equals( "por" ) ) { + this.POR = value; + } else if ( search.Equals( "harmonics" ) ) { + this.harmonics = value; + } else if ( search.Equals( "fx2depth" ) ) { + this.fx2depth = value; + } else if ( search.Equals( "reso1amp" ) ) { + this.reso1AmpBPList = value; + } else if ( search.Equals( "reso1bw" ) ) { + this.reso1BWBPList = value; + } else if ( search.Equals( "reso1freq" ) ) { + this.reso1FreqBPList = value; + } else if ( search.Equals( "reso2amp" ) ) { + this.reso2AmpBPList = value; + } else if ( search.Equals( "reso2bw" ) ) { + this.reso2BWBPList = value; + } else if ( search.Equals( "reso2freq" ) ) { + this.reso2FreqBPList = value; + } else if ( search.Equals( "reso3amp" ) ) { + this.reso3AmpBPList = value; + } else if ( search.Equals( "reso3bw" ) ) { + this.reso3BWBPList = value; + } else if ( search.Equals( "reso3freq" ) ) { + this.reso3FreqBPList = value; + } else if ( search.Equals( "reso4amp" ) ) { + this.reso4AmpBPList = value; + } else if ( search.Equals( "reso4bw" ) ) { + this.reso4BWBPList = value; + } else if ( search.Equals( "reso4freq" ) ) { + this.reso4FreqBPList = value; + } else { #if DEBUG - Console.WriteLine( "VsqMetaText#setElement; warning:unknown curve; curve=" + curve ); + PortUtil.println( "VsqMetaText#setElement; warning:unknown curve; curve=" + curve ); #endif - break; } } @@ -417,33 +408,24 @@ namespace Boare.Lib.Vsq { } /// - /// このインスタンスから、IDとHandleのリストを構築します + /// このインスタンスから、Handleのリストを作成すると同時に、Eventsに登録されているVsqEventのvalue値および各ハンドルのvalue値を更新します /// - /// - /// - void BuildIDHandleList( out Vector id, out Vector handle ) { - id = new Vector(); - handle = new Vector(); + /// + private Vector buildHandleList() { + Vector handle = new Vector(); int current_id = -1; int current_handle = -1; - Vector events = new Vector(); for ( Iterator itr = Events.iterator(); itr.hasNext(); ) { - events.add( (VsqEvent)itr.next() ); - } - Collections.sort( events ); - for ( int i = 0; i < events.size(); i++ ) { - VsqEvent item = events.get( i ); - VsqID id_item = (VsqID)item.ID.clone(); + VsqEvent item = (VsqEvent)itr.next(); current_id++; item.ID.value = current_id; - id_item.value = current_id; // IconHandle if ( item.ID.IconHandle != null ) { current_handle++; VsqHandle handle_item = item.ID.IconHandle.castToVsqHandle(); handle_item.Index = current_handle; handle.add( handle_item ); - id_item.IconHandle_index = current_handle; + item.ID.IconHandle_index = current_handle; } // LyricHandle if ( item.ID.LyricHandle != null ) { @@ -451,7 +433,7 @@ namespace Boare.Lib.Vsq { VsqHandle handle_item = item.ID.LyricHandle.castToVsqHandle(); handle_item.Index = current_handle; handle.add( handle_item ); - id_item.LyricHandle_index = current_handle; + item.ID.LyricHandle_index = current_handle; } // VibratoHandle if ( item.ID.VibratoHandle != null ) { @@ -459,7 +441,7 @@ namespace Boare.Lib.Vsq { VsqHandle handle_item = item.ID.VibratoHandle.castToVsqHandle(); handle_item.Index = current_handle; handle.add( handle_item ); - id_item.VibratoHandle_index = current_handle; + item.ID.VibratoHandle_index = current_handle; } // NoteHeadHandle if ( item.ID.NoteHeadHandle != null ) { @@ -467,10 +449,10 @@ namespace Boare.Lib.Vsq { VsqHandle handle_item = item.ID.NoteHeadHandle.castToVsqHandle(); handle_item.Index = current_handle; handle.add( handle_item ); - id_item.NoteHeadHandle_index = current_handle; + item.ID.NoteHeadHandle_index = current_handle; } - id.add( id_item ); } + return handle; } /// @@ -478,7 +460,11 @@ namespace Boare.Lib.Vsq { /// /// /// - public void print( TextMemoryStream sw, boolean encode, int eos, int start ) { + public void print( TextMemoryStream sw, int eos, int start ) +#if JAVA + throws IOException +#endif + { if ( Common != null ) { Common.write( sw ); } @@ -488,16 +474,13 @@ namespace Boare.Lib.Vsq { if ( mixer != null ) { mixer.write( sw ); } - Vector id; - Vector handle; - BuildIDHandleList( out id, out handle ); - writeEventList( sw, eos ); - int i; - for ( i = 0; i < id.size(); i++ ) { - id.get( i ).write( sw ); + Vector handle = writeEventList( sw, eos ); + for ( Iterator itr = Events.iterator(); itr.hasNext(); ) { + VsqEvent item = (VsqEvent)itr.next(); + item.write( sw ); } - for ( i = 0; i < handle.size(); i++ ) { - handle.get( i ).write( sw, encode ); + for ( int i = 0; i < handle.size(); i++ ) { + handle.get( i ).write( sw ); } String version = Common.Version; if ( PIT.size() > 0 ) { @@ -579,8 +562,13 @@ namespace Boare.Lib.Vsq { } } - private void writeEventList( TextMemoryStream sw, int eos ) { - sw.writeLine( "[EventList]" ); + private Vector writeEventListCor( ITextWriter writer, int eos ) +#if JAVA + throws IOException +#endif + { + Vector handles = buildHandleList(); + writer.writeLine( "[EventList]" ); Vector temp = new Vector(); for ( Iterator itr = Events.iterator(); itr.hasNext(); ) { temp.add( (VsqEvent)itr.next() ); @@ -590,17 +578,34 @@ namespace Boare.Lib.Vsq { while ( i < temp.size() ) { VsqEvent item = temp.get( i ); if ( !item.ID.Equals( VsqID.EOS ) ) { - String ids = "ID#" + i.ToString( "0000" ); + String ids = "ID#" + PortUtil.formatDecimal( "0000", item.ID.value ); int clock = temp.get( i ).Clock; while ( i + 1 < temp.size() && clock == temp.get( i + 1 ).Clock ) { i++; - ids += ",ID#" + i.ToString( "0000" ); + ids += ",ID#" + PortUtil.formatDecimal( "0000", temp.get( i + 1 ).ID.value ); } - sw.writeLine( clock + "=" + ids ); + writer.writeLine( clock + "=" + ids ); } i++; } - sw.writeLine( eos + "=EOS" ); + writer.writeLine( eos + "=EOS" ); + return handles; + } + + public Vector writeEventList( TextMemoryStream sw, int eos ) +#if JAVA + throws IOException +#endif + { + return writeEventListCor( sw, eos ); + } + + public Vector writeEventList( BufferedWriter stream_writer, int eos ) +#if JAVA + throws IOException +#endif + { + return writeEventListCor( new WrappedStreamWriter( stream_writer ), eos ); } /// @@ -612,20 +617,30 @@ namespace Boare.Lib.Vsq { /// /// 最初のトラック以外の一般のメタテキストを構築。(Masterが作られない) /// +#if JAVA + public VsqMetaText( String name, String singer ){ + this( name, 0, singer, false ); +#else public VsqMetaText( String name, String singer ) : this( name, 0, singer, false ) { +#endif } /// /// 最初のトラックのメタテキストを構築。(Masterが作られる) /// /// +#if JAVA + public VsqMetaText( String name, String singer, int pre_measure ){ + this( name, pre_measure, singer, true ); +#else public VsqMetaText( String name, String singer, int pre_measure ) : this( name, pre_measure, singer, true ) { +#endif } private VsqMetaText( String name, int pre_measure, String singer, boolean is_first_track ) { - Common = new VsqCommon( name, Color.FromArgb( 179, 181, 123 ), 1, 1 ); + Common = new VsqCommon( name, 179, 181, 123, 1, 1 ); PIT = new VsqBPList( 0, -8192, 8191 ); //PIT.add( 0, PIT.getDefault() ); @@ -707,20 +722,20 @@ namespace Boare.Lib.Vsq { id.IconHandle.IDS = singer; id.IconHandle.Original = 0; id.IconHandle.Caption = ""; - id.IconHandle.Length = 1; + id.IconHandle.setLength( 1 ); id.IconHandle.Language = 0; id.IconHandle.Program = 0; Events.add( new VsqEvent( 0, id ) ); } - + public VsqMetaText( TextMemoryStream sr ) { - Vector> t_event_list = new Vector>(); + Vector> t_event_list = new Vector>(); TreeMap __id = new TreeMap(); TreeMap __handle = new TreeMap(); PIT = new VsqBPList( 0, -8192, 8191 ); PBS = new VsqBPList( 2, 0, 24 ); DYN = new VsqBPList( 64, 0, 127 ); - BRE = new VsqBPList( 0 , 0, 127); + BRE = new VsqBPList( 0, 0, 127 ); BRI = new VsqBPList( 64, 0, 127 ); CLE = new VsqBPList( 0, 0, 127 ); reso1FreqBPList = new VsqBPList( 64, 0, 127 ); @@ -741,126 +756,102 @@ namespace Boare.Lib.Vsq { POR = new VsqBPList( 64, 0, 127 ); OPE = new VsqBPList( 127, 0, 127 ); - String last_line = sr.readLine(); + ByRef last_line = new ByRef( sr.readLine() ); while ( true ) { #region "TextMemoryStreamから順次読込み" - if ( last_line.Length == 0 ) { + if ( PortUtil.getStringLength( last_line.value ) == 0 ) { break; } - switch ( last_line ) { - case "[Common]": - Common = new VsqCommon( sr, ref last_line ); - break; - case "[Master]": - master = new VsqMaster( sr, ref last_line ); - break; - case "[Mixer]": - mixer = new VsqMixer( sr, ref last_line ); - break; - case "[EventList]": - last_line = sr.readLine(); - while ( !last_line.StartsWith( "[" ) ) { - String[] spl2 = last_line.Split( new char[] { '=' } ); - int clock = int.Parse( spl2[0] ); - int id_number = -1; - if ( spl2[1] != "EOS" ) { - String[] ids = spl2[1].Split( ",".ToCharArray() ); - for ( int i = 0; i < ids.Length; i++ ) { - String[] spl3 = ids[i].Split( new char[] { '#' } ); - id_number = int.Parse( spl3[1] ); - t_event_list.add( new KeyValuePair( clock, id_number ) ); - } - } else { - t_event_list.add( new KeyValuePair( clock, -1) ); - } - if ( sr.peek() < 0 ) { - break; - } else { - last_line = sr.readLine(); + if ( last_line.value.Equals( "[Common]" ) ) { + Common = new VsqCommon( sr, last_line ); + } else if ( last_line.value.Equals( "[Master]" ) ) { + master = new VsqMaster( sr, last_line ); + } else if ( last_line.value.Equals( "[Mixer]" ) ) { + mixer = new VsqMixer( sr, last_line ); + } else if ( last_line.value.Equals( "[EventList]" ) ) { + last_line.value = sr.readLine(); + while ( !last_line.value.StartsWith( "[" ) ) { + String[] spl2 = PortUtil.splitString( last_line.value, new char[] { '=' } ); + int clock = PortUtil.parseInt( spl2[0] ); + int id_number = -1; + if ( spl2[1] != "EOS" ) { + String[] ids = PortUtil.splitString( spl2[1], ',' ); + for ( int i = 0; i < ids.Length; i++ ) { + String[] spl3 = PortUtil.splitString( ids[i], new char[] { '#' } ); + id_number = PortUtil.parseInt( spl3[1] ); + t_event_list.add( new ValuePair( clock, id_number ) ); } + } else { + t_event_list.add( new ValuePair( clock, -1 ) ); } - break; - case "[PitchBendBPList]": - last_line = PIT.appendFromText( sr ); - break; - case "[PitchBendSensBPList]": - last_line = PBS.appendFromText( sr ); - break; - case "[DynamicsBPList]": - last_line = DYN.appendFromText( sr ); - break; - case "[EpRResidualBPList]": - last_line = BRE.appendFromText( sr ); - break; - case "[EpRESlopeBPList]": - last_line = BRI.appendFromText( sr ); - break; - case "[EpRESlopeDepthBPList]": - last_line = CLE.appendFromText( sr ); - break; - case "[EpRSineBPList]": - last_line = harmonics.appendFromText( sr ); - break; - case "[VibTremDepthBPList]": - last_line = fx2depth.appendFromText( sr ); - break; - case "[Reso1FreqBPList]": - last_line = reso1FreqBPList.appendFromText( sr ); - break; - case "[Reso2FreqBPList]": - last_line = reso2FreqBPList.appendFromText( sr ); - break; - case "[Reso3FreqBPList]": - last_line = reso3FreqBPList.appendFromText( sr ); - break; - case "[Reso4FreqBPList]": - last_line = reso4FreqBPList.appendFromText( sr ); - break; - case "[Reso1BWBPList]": - last_line = reso1BWBPList.appendFromText( sr ); - break; - case "[Reso2BWBPList]": - last_line = reso2BWBPList.appendFromText( sr ); - break; - case "[Reso3BWBPList]": - last_line = reso3BWBPList.appendFromText( sr ); - break; - case "[Reso4BWBPList]": - last_line = reso4BWBPList.appendFromText( sr ); - break; - case "[Reso1AmpBPList]": - last_line = reso1AmpBPList.appendFromText( sr ); - break; - case "[Reso2AmpBPList]": - last_line = reso2AmpBPList.appendFromText( sr ); - break; - case "[Reso3AmpBPList]": - last_line = reso3AmpBPList.appendFromText( sr ); - break; - case "[Reso4AmpBPList]": - last_line = reso4AmpBPList.appendFromText( sr ); - break; - case "[GenderFactorBPList]": - last_line = GEN.appendFromText( sr ); - break; - case "[PortamentoTimingBPList]": - last_line = POR.appendFromText( sr ); - break; - case "[OpeningBPList]": - last_line = OPE.appendFromText( sr ); - break; - default: - String buffer = last_line; - buffer = buffer.Replace( "[", "" ); - buffer = buffer.Replace( "]", "" ); - String[] spl = buffer.Split( new char[] { '#' } ); - int index = int.Parse( spl[1] ); - if ( last_line.StartsWith( "[ID#" ) ) { - __id.put( index, new VsqID( sr, index, ref last_line ) ); - } else if ( last_line.StartsWith( "[h#" ) ) { - __handle.put( index, new VsqHandle( sr, index, ref last_line ) ); + if ( sr.peek() < 0 ) { + break; + } else { + last_line.value = sr.readLine(); } - break; + } + } else if ( last_line.value.Equals( "[PitchBendBPList]" ) ) { + last_line.value = PIT.appendFromText( sr ); + } else if ( last_line.value.Equals( "[PitchBendSensBPList]" ) ) { + last_line.value = PBS.appendFromText( sr ); + } else if ( last_line.value.Equals( "[DynamicsBPList]" ) ) { + last_line.value = DYN.appendFromText( sr ); + } else if ( last_line.value.Equals( "[EpRResidualBPList]" ) ) { + last_line.value = BRE.appendFromText( sr ); + } else if ( last_line.value.Equals( "[EpRESlopeBPList]" ) ) { + last_line.value = BRI.appendFromText( sr ); + } else if ( last_line.value.Equals( "[EpRESlopeDepthBPList]" ) ) { + last_line.value = CLE.appendFromText( sr ); + } else if ( last_line.value.Equals( "[EpRSineBPList]" ) ) { + last_line.value = harmonics.appendFromText( sr ); + } else if ( last_line.value.Equals( "[VibTremDepthBPList]" ) ) { + last_line.value = fx2depth.appendFromText( sr ); + } else if ( last_line.value.Equals( "[Reso1FreqBPList]" ) ) { + last_line.value = reso1FreqBPList.appendFromText( sr ); + } else if ( last_line.value.Equals( "[Reso2FreqBPList]" ) ) { + last_line.value = reso2FreqBPList.appendFromText( sr ); + } else if ( last_line.value.Equals( "[Reso3FreqBPList]" ) ) { + last_line.value = reso3FreqBPList.appendFromText( sr ); + } else if ( last_line.value.Equals( "[Reso4FreqBPList]" ) ) { + last_line.value = reso4FreqBPList.appendFromText( sr ); + } else if ( last_line.value.Equals( "[Reso1BWBPList]" ) ) { + last_line.value = reso1BWBPList.appendFromText( sr ); + } else if ( last_line.value.Equals( "[Reso2BWBPList]" ) ) { + last_line.value = reso2BWBPList.appendFromText( sr ); + } else if ( last_line.value.Equals( "[Reso3BWBPList]" ) ) { + last_line.value = reso3BWBPList.appendFromText( sr ); + } else if ( last_line.value.Equals( "[Reso4BWBPList]" ) ) { + last_line.value = reso4BWBPList.appendFromText( sr ); + } else if ( last_line.value.Equals( "[Reso1AmpBPList]" ) ) { + last_line.value = reso1AmpBPList.appendFromText( sr ); + } else if ( last_line.value.Equals( "[Reso2AmpBPList]" ) ) { + last_line.value = reso2AmpBPList.appendFromText( sr ); + } else if ( last_line.value.Equals( "[Reso3AmpBPList]" ) ) { + last_line.value = reso3AmpBPList.appendFromText( sr ); + } else if ( last_line.value.Equals( "[Reso4AmpBPList]" ) ) { + last_line.value = reso4AmpBPList.appendFromText( sr ); + } else if ( last_line.value.Equals( "[GenderFactorBPList]" ) ) { + last_line.value = GEN.appendFromText( sr ); + } else if ( last_line.value.Equals( "[PortamentoTimingBPList]" ) ) { + last_line.value = POR.appendFromText( sr ); + } else if ( last_line.value.Equals( "[OpeningBPList]" ) ) { + last_line.value = OPE.appendFromText( sr ); + } else { + String buffer = last_line.value; + buffer = buffer.Replace( "[", "" ); + buffer = buffer.Replace( "]", "" ); + String[] spl = PortUtil.splitString( buffer, new char[] { '#' } ); +#if DEBUG + if ( spl.Length < 2 ) { + PortUtil.println( "VsqMetaText#.ctor; spl.Length=" + spl.Length + "; buffer=" + buffer ); + } +#endif + int index = PortUtil.parseInt( spl[1] ); + if ( last_line.value.StartsWith( "[ID#" ) ) { + __id.put( index, new VsqID( sr, index, last_line ) ); + } else if ( last_line.value.StartsWith( "[h#" ) ) { + __handle.put( index, new VsqHandle( sr, index, last_line ) ); + } #endregion } @@ -888,53 +879,19 @@ namespace Boare.Lib.Vsq { // idをeventListに埋め込み Events = new VsqEventList(); for ( int i = 0; i < t_event_list.size(); i++ ) { - int clock = t_event_list.get( i ).Key; - int id_number = t_event_list.get( i ).Value; + int clock = t_event_list.get( i ).getKey(); + int id_number = t_event_list.get( i ).getValue(); if ( __id.containsKey( id_number ) ) { Events.add( new VsqEvent( clock, (VsqID)__id.get( id_number ).clone() ) ); } } - } - public static boolean test( String fpath ) { - /*VsqMetaText metaText; - using ( TextMemoryStream sr = new TextMemoryStream( fpath, Encoding.Unicode ) ) { - metaText = new VsqMetaText( sr ); - }*/ - String result = "test.txt"; - - StreamReader honmono = new StreamReader( fpath ); - TextMemoryStream copy = new TextMemoryStream(); - //metaText.print( copy, true, 1000, 100 ); - copy.rewind(); - while ( honmono.Peek() >= 0 && copy.peek() >= 0 ) { - String hon = honmono.ReadLine(); - String cop = copy.readLine(); - if ( hon != cop ) { - Console.WriteLine( "honmono,copy=" + hon + "," + cop ); - honmono.Close(); - copy.close(); - return false; - } + if ( Common == null ) { + Common = new VsqCommon(); } - honmono.Close(); - copy.close(); - - return true; } } - public enum VsqIDType { - Singer, - Anote, - Unknown - } - - public enum VsqHandleType { - Lyric, - Vibrato, - Singer, - NoteHeadHandle, - } - +#if !JAVA } +#endif diff --git a/trunk/Boare.Lib.Vsq/VsqMetaText/Common.cs b/trunk/Boare.Lib.Vsq/VsqMetaText/Common.cs deleted file mode 100644 index 1787656..0000000 --- a/trunk/Boare.Lib.Vsq/VsqMetaText/Common.cs +++ /dev/null @@ -1,157 +0,0 @@ -/* - * VsqMetaText/Common.cs - * Copyright (c) 2008-2009 kbinani - * - * This file is part of Boare.Lib.Vsq. - * - * Boare.Lib.Vsq is free software; you can redistribute it and/or - * modify it under the terms of the BSD License. - * - * Boare.Lib.Vsq 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.IO; -using System.Drawing; - -using bocoree; - -namespace Boare.Lib.Vsq { - - using boolean = System.Boolean; - - /// - /// vsqファイルのメタテキストの[Common]セクションに記録される内容を取り扱う - /// - [Serializable] - public class VsqCommon : ICloneable { - public String Version; - public String Name; - public String Color; - public int DynamicsMode; - public int PlayMode; - - public object Clone() { - String[] spl = Color.Split( ",".ToCharArray(), 3 ); - int r = int.Parse( spl[0] ); - int g = int.Parse( spl[1] ); - int b = int.Parse( spl[2] ); - System.Drawing.Color color = System.Drawing.Color.FromArgb( r, g, b ); - VsqCommon res = new VsqCommon( Name, color, DynamicsMode, PlayMode ); - res.Version = Version; - return res; - } - - /// - /// 各パラメータを指定したコンストラクタ - /// - /// トラック名 - /// Color値(意味は不明) - /// DynamicsMode(デフォルトは1) - /// PlayMode(デフォルトは1) - public VsqCommon( String name, Color color, int dynamics_mode, int play_mode ) { - this.Version = "DSB301"; - this.Name = name; - this.Color = color.R + "," + color.G + "," + color.B; - this.DynamicsMode = dynamics_mode; - this.PlayMode = play_mode; - } - - public VsqCommon() - : this( "Miku", System.Drawing.Color.FromArgb( 179, 181, 123 ), 1, 1 ) { - } - - /// - /// MetaTextのテキストファイルからのコンストラクタ - /// - /// 読み込むテキストファイル - /// 読み込んだ最後の行が返される - public VsqCommon( TextMemoryStream sr, ref String last_line ) { - Version = ""; - Name = ""; - Color = "0,0,0"; - DynamicsMode = 0; - PlayMode = 0; - last_line = sr.readLine(); - String[] spl; - while ( !last_line.StartsWith( "[" ) ) { - spl = last_line.Split( new char[] { '=' } ); - switch ( spl[0] ) { - case "Version": - this.Version = spl[1]; - break; - case "Name": - this.Name = spl[1]; - break; - case "Color": - this.Color = spl[1]; - break; - case "DynamicsMode": - this.DynamicsMode = int.Parse( spl[1] ); - break; - case "PlayMode": - this.PlayMode = int.Parse( spl[1] ); - break; - } - if ( sr.peek() < 0 ) { - break; - } - last_line = sr.readLine(); - } - } - - /// - /// インスタンスの内容をテキストファイルに出力します - /// - /// 出力先 - public void write( TextMemoryStream sw ) { - sw.writeLine( "[Common]" ); - sw.writeLine( "Version=" + Version ); - sw.writeLine( "Name=" + Name ); - sw.writeLine( "Color=" + Color ); - sw.writeLine( "DynamicsMode=" + DynamicsMode ); - sw.writeLine( "PlayMode=" + PlayMode ); - } - - /// - /// VsqCommon構造体を構築するテストを行います - /// - /// テストに成功すればtrue、そうでなければfalse - public static boolean test() { - String fpath = Path.GetTempFileName(); - StreamWriter sw = new StreamWriter( fpath, false, Encoding.Unicode ); - sw.WriteLine( "Version=DSB301" ); - sw.WriteLine( "Name=Voice1" ); - sw.WriteLine( "Color=181,162,123" ); - sw.WriteLine( "DynamicsMode=1" ); - sw.WriteLine( "PlayMode=1" ); - sw.WriteLine( "[Master]" ); - sw.Close(); - - VsqCommon vsqCommon; - String last_line = ""; - using ( TextMemoryStream sr = new TextMemoryStream( fpath, Encoding.Unicode ) ) { - vsqCommon = new VsqCommon( sr, ref last_line ); - } - - boolean result; - if ( vsqCommon.Version.Equals( "DSB301" ) && - vsqCommon.Name.Equals( "Voice1" ) && - vsqCommon.Color.Equals( "181,162,123" ) && - vsqCommon.DynamicsMode == 1 && - vsqCommon.PlayMode == 1 && - last_line.Equals( "[Master]" ) ) { - result = true; - } else { - result = false; - } - - File.Delete( fpath ); - return result; - } - } - -} diff --git a/trunk/Boare.Lib.Vsq/VsqMetaText/Common.java b/trunk/Boare.Lib.Vsq/VsqMetaText/Common.java deleted file mode 100644 index 43a924b..0000000 --- a/trunk/Boare.Lib.Vsq/VsqMetaText/Common.java +++ /dev/null @@ -1,151 +0,0 @@ -/* - * VsqMetaText/Common.cs - * Copyright (c) 2008 kbinani - * - * This file is part of Boare.Lib.Vsq. - * - * Boare.Lib.Vsq is free software; you can redistribute it and/or - * modify it under the terms of the BSD License. - * - * Boare.Lib.Vsq 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.IO; -using System.Drawing;*/ - -package com.boare.vsq; - -/// -/// vsqt@C̃^eLXg[Common]ZNVɋL^e舵 -/// -public class VsqCommon implements Cloneable { - public String Version; - public String Name; - public String Color; - public int DynamicsMode; - public int PlayMode; - - public Object clone() { - String[] spl = Color.Split( ",".ToCharArray(), 3 ); - int r = Integer.parseInt( spl[0] ); - int g = Integer.parseInt( spl[1] ); - int b = Integer.parseInt( spl[2] ); - System.Drawing.Color color = System.Drawing.Color.FromArgb( r, g, b ); - VsqCommon res = new VsqCommon( Name, color, DynamicsMode, PlayMode ); - res.Version = Version; - return res; - } - - - /// - /// ep[^w肵RXgN^ - /// - /// gbN - /// ColorliӖ͕sj - /// DynamicsModeiftHg1j - /// PlayModeiftHg1j - public VsqCommon( string name, Color color, int dynamics_mode, int play_mode ) { - this.Version = "DSB301"; - this.Name = name; - this.Color = color.R + "," + color.G + "," + color.B; - this.DynamicsMode = dynamics_mode; - this.PlayMode = play_mode; - } - - - /// - /// MetaText̃eLXgt@C̃RXgN^ - /// - /// ǂݍރeLXgt@C - /// ǂݍ񂾍Ō̍sԂ - public VsqCommon( TextMemoryStream sr, ref string last_line ) { - Version = ""; - Name = ""; - Color = "0,0,0"; - DynamicsMode = 0; - PlayMode = 0; - last_line = sr.ReadLine(); - string[] spl; - while ( !last_line.StartsWith( "[" ) ) { - spl = last_line.Split( new char[] { '=' } ); - switch ( spl[0] ) { - case "Version": - this.Version = spl[1]; - break; - case "Name": - this.Name = spl[1]; - break; - case "Color": - this.Color = spl[1]; - break; - case "DynamicsMode": - this.DynamicsMode = Integer.parseInt( spl[1] ); - break; - case "PlayMode": - this.PlayMode = Integer.parseInt( spl[1] ); - break; - } - if ( sr.Peek() < 0 ) { - break; - } - last_line = sr.ReadLine(); - } - } - - - /// - /// CX^X̓eeLXgt@Cɏo͂܂ - /// - /// o͐ - public void write( TextMemoryStream sw ) { - sw.WriteLine( "[Common]" ); - sw.WriteLine( "Version=" + Version ); - sw.WriteLine( "Name=" + Name ); - sw.WriteLine( "Color=" + Color ); - sw.WriteLine( "DynamicsMode=" + DynamicsMode ); - sw.WriteLine( "PlayMode=" + PlayMode ); - } - - - /// - /// VsqCommon\̂\zeXgs܂ - /// - /// eXgɐtrueAłȂfalse - public static bool test() { - string fpath = Path.GetTempFileName(); - StreamWriter sw = new StreamWriter( fpath, false, Encoding.Unicode ); - sw.WriteLine( "Version=DSB301" ); - sw.WriteLine( "Name=Voice1" ); - sw.WriteLine( "Color=181,162,123" ); - sw.WriteLine( "DynamicsMode=1" ); - sw.WriteLine( "PlayMode=1" ); - sw.WriteLine( "[Master]" ); - sw.Close(); - - VsqCommon vsqCommon; - string last_line = ""; - using ( TextMemoryStream sr = new TextMemoryStream( fpath, Encoding.Unicode ) ) { - vsqCommon = new VsqCommon( sr, ref last_line ); - } - - bool result; - if ( vsqCommon.Version == "DSB301" && - vsqCommon.Name == "Voice1" && - vsqCommon.Color == "181,162,123" && - vsqCommon.DynamicsMode == 1 && - vsqCommon.PlayMode == 1 && - last_line == "[Master]" ) { - result = true; - } else { - result = false; - } - - File.Delete( fpath ); - return result; - } - -} diff --git a/trunk/Boare.Lib.Vsq/VsqMetaText/Handle.cs b/trunk/Boare.Lib.Vsq/VsqMetaText/Handle.cs deleted file mode 100644 index 6d24b85..0000000 --- a/trunk/Boare.Lib.Vsq/VsqMetaText/Handle.cs +++ /dev/null @@ -1,537 +0,0 @@ -/* - * VsqMetaText/Handle.cs - * Copyright (c) 2008-2009 kbinani - * - * This file is part of Boare.Lib.Vsq. - * - * Boare.Lib.Vsq is free software; you can redistribute it and/or - * modify it under the terms of the BSD License. - * - * Boare.Lib.Vsq 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.IO; - -using bocoree; - -namespace Boare.Lib.Vsq { - - using boolean = System.Boolean; - - [Serializable] - public class IconHandle : ICloneable { - public String Caption; - public String IconID; - public String IDS; - public int Index; - public int Length; - public int Original; - public int Program; - public int Language; - - public IconHandle() { - } - - public object Clone() { - IconHandle ret = new IconHandle(); - ret.Caption = Caption; - ret.IconID = IconID; - ret.IDS = IDS; - ret.Index = Index; - ret.Language = Language; - ret.Length = Length; - ret.Original = Original; - ret.Program = Program; - return ret; - } - - public VsqHandle castToVsqHandle() { - VsqHandle ret = new VsqHandle(); - ret.m_type = VsqHandleType.Singer; - ret.Caption = Caption; - ret.IconID = IconID; - ret.IDS = IDS; - ret.Index = Index; - ret.Language = Language; - ret.Length = Length; - ret.Program = Program; - return ret; - } - } - - [Serializable] - public class LyricHandle : ICloneable { - public Lyric L0; - public int Index; - - public LyricHandle() { - } - - /// - /// type = Lyric用のhandleのコンストラクタ - /// - /// 歌詞 - /// 発音記号 - public LyricHandle( String phrase, String phonetic_symbol ) { - L0 = new Lyric( phrase, phonetic_symbol ); - } - - public object Clone() { - LyricHandle ret = new LyricHandle(); - ret.Index = Index; - ret.L0 = (Lyric)L0.Clone(); - return ret; - } - - public VsqHandle castToVsqHandle() { - VsqHandle ret = new VsqHandle(); - ret.m_type = VsqHandleType.Lyric; - ret.L0 = (Lyric)L0.Clone(); - ret.Index = Index; - return ret; - } - } - - - [Serializable] - public class VibratoHandle : ICloneable { - public int StartDepth; - public VibratoBPList DepthBP; - public int StartRate; - public VibratoBPList RateBP; - public int Index; - public String IconID; - public String IDS; - public int Original; - public String Caption; - public int Length; - - public VibratoHandle(){ - StartRate = 64; - StartDepth = 64; - RateBP = new VibratoBPList(); - DepthBP = new VibratoBPList(); - } - - /*public static VibratoHandle[] fromVED( String ved_file, int original ){ - - }*/ - - public object Clone() { - VibratoHandle result = new VibratoHandle(); - result.Index = Index; - result.IconID = IconID; - result.IDS = this.IDS; - result.Original = this.Original; - result.Caption = this.Caption; - result.Length = this.Length; - result.StartDepth = this.StartDepth; - result.DepthBP = (VibratoBPList)DepthBP.Clone(); - result.StartRate = this.StartRate; - result.RateBP = (VibratoBPList)RateBP.Clone(); - return result; - } - - public VsqHandle castToVsqHandle() { - VsqHandle ret = new VsqHandle(); - ret.m_type = VsqHandleType.Vibrato; - ret.Index = Index; - ret.IconID = IconID; - ret.IDS = IDS; - ret.Original = Original; - ret.Caption = Caption; - ret.Length = Length; - ret.StartDepth = StartDepth; - ret.StartRate = StartRate; - ret.DepthBP = (VibratoBPList)DepthBP.Clone(); - ret.RateBP = (VibratoBPList)RateBP.Clone(); - return ret; - } - } - - [Serializable] - public class NoteHeadHandle : ICloneable { - public int Index; - public String IconID; - public String IDS; - public int Original; - public String Caption; - public int Length; - public int Duration; - public int Depth; - - public NoteHeadHandle() { - } - - public object Clone() { - NoteHeadHandle result = new NoteHeadHandle(); - result.Index = Index; - result.IconID = IconID; - result.IDS = this.IDS; - result.Original = this.Original; - result.Caption = this.Caption; - result.Length = this.Length; - result.Duration = Duration; - result.Depth = Depth; - return result; - } - - public VsqHandle castToVsqHandle() { - VsqHandle ret = new VsqHandle(); - ret.m_type = VsqHandleType.NoteHeadHandle; - ret.Index = Index; - ret.IconID = IconID; - ret.IDS = IDS; - ret.Original = Original; - ret.Caption = Caption; - ret.Length = Length; - ret.Duration = Duration; - ret.Depth = Depth; - return ret; - } - } - - /// - /// ハンドルを取り扱います。ハンドルにはLyricHandle、VibratoHandle、IconHandleおよびNoteHeadHandleがある - /// - [Serializable] - public class VsqHandle { - public VsqHandleType m_type; - public int Index; - public String IconID; - public String IDS; - public Lyric L0; - public int Original; - public String Caption; - public int Length; - public int StartDepth; - public VibratoBPList DepthBP; - public int StartRate; - public VibratoBPList RateBP; - public int Language; - public int Program; - public int Duration; - public int Depth; - - public LyricHandle castToLyricHandle() { - LyricHandle ret = new LyricHandle(); - ret.L0 = (Lyric)L0; - ret.Index = Index; - return ret; - } - - public VibratoHandle castToVibratoHandle() { - VibratoHandle ret = new VibratoHandle(); - ret.Index = Index; - ret.Caption = Caption; - ret.DepthBP = (VibratoBPList)DepthBP.Clone(); - ret.IconID = IconID; - ret.IDS = IDS; - ret.Index = Index; - ret.Length = Length; - ret.Original = Original; - ret.RateBP = (VibratoBPList)RateBP.Clone(); - ret.StartDepth = StartDepth; - ret.StartRate = StartRate; - return ret; - } - - public IconHandle castToIconHandle() { - IconHandle ret = new IconHandle(); - ret.Index = Index; - ret.Caption = Caption; - ret.IconID = IconID; - ret.IDS = IDS; - ret.Index = Index; - ret.Language = Language; - ret.Length = Length; - ret.Original = Original; - ret.Program = Program; - return ret; - } - - public NoteHeadHandle castToNoteHeadHandle() { - NoteHeadHandle ret = new NoteHeadHandle(); - ret.Caption = Caption; - ret.Depth = Depth; - ret.Duration = Duration; - ret.IconID = IconID; - ret.IDS = IDS; - ret.Length = Length; - ret.Original = Original; - return ret; - } - - internal VsqHandle() { - } - - /// - /// インスタンスをストリームに書き込みます。 - /// encode=trueの場合、2バイト文字をエンコードして出力します。 - /// - /// 書き込み対象 - /// 2バイト文字をエンコードするか否かを指定するフラグ - public void write( TextMemoryStream sw, boolean encode ) { - sw.writeLine( this.ToString( encode ) ); - } - - /// - /// FileStreamから読み込みながらコンストラクト - /// - /// 読み込み対象 - public VsqHandle( TextMemoryStream sr, int value, ref String last_line ) { - this.Index = value; - String[] spl; - String[] spl2; - - // default値で梅 - m_type = VsqHandleType.Vibrato; - IconID = ""; - IDS = "normal"; - L0 = new Lyric( "" ); - Original = 0; - Caption = ""; - Length = 0; - StartDepth = 0; - DepthBP = null; - int depth_bp_num = 0; - StartRate = 0; - RateBP = null; - int rate_bp_num = 0; - Language = 0; - Program = 0; - Duration = 0; - Depth = 64; - - String tmpDepthBPX = ""; - String tmpDepthBPY = ""; - String tmpRateBPX = ""; - String tmpRateBPY = ""; - - // "["にぶち当たるまで読込む - last_line = sr.readLine(); - while ( !last_line.StartsWith( "[" ) ) { - spl = last_line.Split( new char[] { '=' } ); - switch ( spl[0] ) { - case "Language": - m_type = VsqHandleType.Singer; - Language = int.Parse( spl[1] ); - break; - case "Program": - Program = int.Parse( spl[1] ); - break; - case "IconID": - IconID = spl[1]; - break; - case "IDS": - IDS = spl[1]; - break; - case "Original": - Original = int.Parse( spl[1] ); - break; - case "Caption": - Caption = spl[1]; - for ( int i = 2; i < spl.Length; i++ ) { - Caption += "=" + spl[i]; - } - break; - case "Length": - Length = int.Parse( spl[1] ); - break; - case "StartDepth": - StartDepth = int.Parse( spl[1] ); - break; - case "DepthBPNum": - depth_bp_num = int.Parse( spl[1] ); - break; - case "DepthBPX": - tmpDepthBPX = spl[1]; - break; - case "DepthBPY": - tmpDepthBPY = spl[1]; - break; - case "StartRate": - m_type = VsqHandleType.Vibrato; - StartRate = int.Parse( spl[1] ); - break; - case "RateBPNum": - rate_bp_num = int.Parse( spl[1] ); - break; - case "RateBPX": - tmpRateBPX = spl[1]; - break; - case "RateBPY": - tmpRateBPY = spl[1]; - break; - case "L0": - m_type = VsqHandleType.Lyric; - L0 = new Lyric( spl[1] ); - break; - case "Duration": - m_type = VsqHandleType.NoteHeadHandle; - Duration = int.Parse( spl[1] ); - break; - case "Depth": - Duration = int.Parse( spl[1] ); - break; - } - if ( sr.peek() < 0 ) { - break; - } - last_line = sr.readLine(); - } - /*if ( IDS != "normal" ) { - m_type = VsqHandleType.Singer; - } else if ( IconID != "" ) { - m_type = VsqHandleType.Vibrato; - } else { - m_type = VsqHandleType.Lyric; - }*/ - - // RateBPX, RateBPYの設定 - if ( m_type == VsqHandleType.Vibrato ) { - if ( rate_bp_num > 0 ) { - float[] rate_bp_x = new float[rate_bp_num]; - spl2 = tmpRateBPX.Split( new char[] { ',' } ); - for ( int i = 0; i < rate_bp_num; i++ ) { - rate_bp_x[i] = float.Parse( spl2[i] ); - } - - int[] rate_bp_y = new int[rate_bp_num]; - spl2 = tmpRateBPY.Split( new char[] { ',' } ); - for ( int i = 0; i < rate_bp_num; i++ ) { - rate_bp_y[i] = int.Parse( spl2[i] ); - } - RateBP = new VibratoBPList( rate_bp_x, rate_bp_y ); - } else { - //m_rate_bp_x = null; - //m_rate_bp_y = null; - RateBP = new VibratoBPList(); - } - - // DepthBPX, DepthBPYの設定 - if ( depth_bp_num > 0 ) { - float[] depth_bp_x = new float[depth_bp_num]; - spl2 = tmpDepthBPX.Split( new char[] { ',' } ); - for ( int i = 0; i < depth_bp_num; i++ ) { - depth_bp_x[i] = float.Parse( spl2[i] ); - } - - int[] depth_bp_y = new int[depth_bp_num]; - spl2 = tmpDepthBPY.Split( new char[] { ',' } ); - for ( int i = 0; i < depth_bp_num; i++ ) { - depth_bp_y[i] = int.Parse( spl2[i] ); - } - DepthBP = new VibratoBPList( depth_bp_x, depth_bp_y ); - } else { - DepthBP = new VibratoBPList(); - //m_depth_bp_x = null; - //m_depth_bp_y = null; - } - } else { - DepthBP = new VibratoBPList(); - RateBP = new VibratoBPList(); - } - } - - /// - /// ハンドル指定子(例えば"h#0123"という文字列)からハンドル番号を取得します - /// - /// ハンドル指定子 - /// ハンドル番号 - public static int HandleIndexFromString( String _string ) { - String[] spl = _string.Split( new char[] { '#' } ); - return int.Parse( spl[1] ); - } - - /// - /// インスタンスをテキストファイルに出力します - /// - /// 出力先 - public void Print( StreamWriter sw ) { - String result = this.ToString(); - sw.WriteLine( result ); - } - - /// - /// インスタンスをコンソール画面に出力します - /// - private void Print() { - String result = this.ToString(); - Console.WriteLine( result ); - } - - /// - /// インスタンスを文字列に変換します - /// - /// 2バイト文字をエンコードするか否かを指定するフラグ - /// インスタンスを変換した文字列 - public String ToString( boolean encode ) { - String result = ""; - result += "[h#" + Index.ToString( "0000" ) + "]"; - switch ( m_type ) { - case VsqHandleType.Lyric: - result += Environment.NewLine + "L0=" + L0.ToString( encode ); - break; - case VsqHandleType.Vibrato: - result += Environment.NewLine + "IconID=" + IconID + Environment.NewLine; - result += "IDS=" + IDS + Environment.NewLine; - result += "Original=" + Original + Environment.NewLine; - result += "Caption=" + Caption + Environment.NewLine; - result += "Length=" + Length + Environment.NewLine; - result += "StartDepth=" + StartDepth + Environment.NewLine; - result += "DepthBPNum=" + DepthBP.getCount() + Environment.NewLine; - if ( DepthBP.getCount() > 0 ) { - result += "DepthBPX=" + DepthBP.getElement( 0 ).X.ToString( "0.000000" ); - for ( int i = 1; i < DepthBP.getCount(); i++ ) { - result += "," + DepthBP.getElement( i ).X.ToString( "0.000000" ); - } - result += Environment.NewLine + "DepthBPY=" + DepthBP.getElement( 0 ).Y; - for ( int i = 1; i < DepthBP.getCount(); i++ ) { - result += "," + DepthBP.getElement( i ).Y; - } - result += Environment.NewLine; - } - result += "StartRate=" + StartRate + Environment.NewLine; - result += "RateBPNum=" + RateBP.getCount(); - if ( RateBP.getCount() > 0 ) { - result += Environment.NewLine + "RateBPX=" + RateBP.getElement( 0 ).X.ToString( "0.000000" ); - for ( int i = 1; i < RateBP.getCount(); i++ ) { - result += "," + RateBP.getElement( i ).X.ToString( "0.000000" ); - } - result += Environment.NewLine + "RateBPY=" + RateBP.getElement( 0 ).Y; - for ( int i = 1; i < RateBP.getCount(); i++ ) { - result += "," + RateBP.getElement( i ).Y; - } - } - break; - case VsqHandleType.Singer: - result += Environment.NewLine + "IconID=" + IconID + Environment.NewLine; - result += "IDS=" + IDS + Environment.NewLine; - result += "Original=" + Original + Environment.NewLine; - result += "Caption=" + Caption + Environment.NewLine; - result += "Length=" + Length + Environment.NewLine; - result += "Language=" + Language + Environment.NewLine; - result += "Program=" + Program; - break; - case VsqHandleType.NoteHeadHandle: - result += Environment.NewLine + "IconID=" + IconID + Environment.NewLine; - result += "IDS=" + IDS + Environment.NewLine; - result += "Original=" + Original + Environment.NewLine; - result += "Caption=" + Caption + Environment.NewLine; - result += "Length=" + Length + Environment.NewLine; - result += "Duration=" + Duration + Environment.NewLine; - result += "Depth=" + Depth; - break; - default: - break; - } - return result; - } - } - -} diff --git a/trunk/Boare.Lib.Vsq/VsqMetaText/ID.cs b/trunk/Boare.Lib.Vsq/VsqMetaText/ID.cs deleted file mode 100644 index 0bc9727..0000000 --- a/trunk/Boare.Lib.Vsq/VsqMetaText/ID.cs +++ /dev/null @@ -1,311 +0,0 @@ -/* - * VsqMetaText/ID.cs - * Copyright (c) 2008-2009 kbinani - * - * This file is part of Boare.Lib.Vsq. - * - * Boare.Lib.Vsq is free software; you can redistribute it and/or - * modify it under the terms of the BSD License. - * - * Boare.Lib.Vsq 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.IO; - -using bocoree; - -namespace Boare.Lib.Vsq { - - using boolean = System.Boolean; - - /// - /// メタテキストに埋め込まれるIDを表すクラス。 - /// - [Serializable] - public class VsqID : ICloneable { - public const int MAX_NOTE_LENGTH = 16383; - internal int value; - public VsqIDType type; - internal int IconHandle_index; - public IconHandle IconHandle; - private int m_length; - public int Note; - public int Dynamics; - public int PMBendDepth; - public int PMBendLength; - public int PMbPortamentoUse; - public int DEMdecGainRate; - public int DEMaccent; - internal int LyricHandle_index; - public LyricHandle LyricHandle; - internal int VibratoHandle_index; - public VibratoHandle VibratoHandle; - public int VibratoDelay; - internal int NoteHeadHandle_index; - public NoteHeadHandle NoteHeadHandle; - public int pMeanOnsetFirstNote = 0x0a; - public int vMeanNoteTransition = 0x0c; - public int d4mean = 0x18; - public int pMeanEndingNote = 0x0c; - - public static VsqID EOS = new VsqID( -1 ); - - public int Length { - get { - return m_length; - } - set { - m_length = value; - } - } - - /// - /// このインスタンスの簡易コピーを取得します。 - /// - /// このインスタンスの簡易コピー - public Object clone() { - VsqID result = new VsqID( this.value ); - result.type = this.type; - if ( this.IconHandle != null ) { - result.IconHandle = (IconHandle)this.IconHandle.Clone(); - } - result.Length = this.Length; - result.Note = this.Note; - result.Dynamics = this.Dynamics; - result.PMBendDepth = this.PMBendDepth; - result.PMBendLength = this.PMBendLength; - result.PMbPortamentoUse = this.PMbPortamentoUse; - result.DEMdecGainRate = this.DEMdecGainRate; - result.DEMaccent = this.DEMaccent; - result.d4mean = this.d4mean; - result.pMeanOnsetFirstNote = this.pMeanOnsetFirstNote; - result.vMeanNoteTransition = this.vMeanNoteTransition; - result.pMeanEndingNote = this.pMeanEndingNote; - if ( this.LyricHandle != null ) { - result.LyricHandle = (LyricHandle)this.LyricHandle.Clone(); - } - if ( this.VibratoHandle != null ) { - result.VibratoHandle = (VibratoHandle)this.VibratoHandle.Clone(); - } - result.VibratoDelay = this.VibratoDelay; - if ( NoteHeadHandle != null ) { - result.NoteHeadHandle = (NoteHeadHandle)NoteHeadHandle.Clone(); - } - return result; - } - - public object Clone() { - return clone(); - } - - /// - /// IDの番号(ID#****の****)を指定したコンストラクタ。 - /// - /// IDの番号 - public VsqID( int a_value ) { - value = a_value; - } - - public VsqID() - : this( 0 ) { - } - - /// - /// テキストファイルからのコンストラクタ - /// - /// 読み込み対象 - /// - /// 読み込んだ最後の行が返されます - public VsqID( TextMemoryStream sr, int value, ref String last_line ) { - String[] spl; - this.value = value; - this.type = VsqIDType.Unknown; - this.IconHandle_index = -2; - this.LyricHandle_index = -1; - this.VibratoHandle_index = -1; - this.NoteHeadHandle_index = -1; - this.Length = 0; - this.Note = 0; - this.Dynamics = 0; - this.PMBendDepth = 0; - this.PMBendLength = 0; - this.PMbPortamentoUse = 0; - this.DEMdecGainRate = 0; - this.DEMaccent = 0; - //this.LyricHandle_index = -2; - //this.VibratoHandle_index = -2; - this.VibratoDelay = 0; - last_line = sr.readLine(); - while ( !last_line.StartsWith( "[" ) ) { - spl = last_line.Split( new char[] { '=' } ); - switch ( spl[0] ) { - case "Type": - if ( spl[1].Equals( "Anote" ) ) { - type = VsqIDType.Anote; - } else if ( spl[1].Equals( "Singer" ) ) { - type = VsqIDType.Singer; - } else { - type = VsqIDType.Unknown; - } - break; - case "Length": - this.Length = int.Parse( spl[1] ); - break; - case "Note#": - this.Note = int.Parse( spl[1] ); - break; - case "Dynamics": - this.Dynamics = int.Parse( spl[1] ); - break; - case "PMBendDepth": - this.PMBendDepth = int.Parse( spl[1] ); - break; - case "PMBendLength": - this.PMBendLength = int.Parse( spl[1] ); - break; - case "DEMdecGainRate": - this.DEMdecGainRate = int.Parse( spl[1] ); - break; - case "DEMaccent": - this.DEMaccent = int.Parse( spl[1] ); - break; - case "LyricHandle": - this.LyricHandle_index = VsqHandle.HandleIndexFromString( spl[1] ); - break; - case "IconHandle": - this.IconHandle_index = VsqHandle.HandleIndexFromString( spl[1] ); - break; - case "VibratoHandle": - this.VibratoHandle_index = VsqHandle.HandleIndexFromString( spl[1] ); - break; - case "VibratoDelay": - this.VibratoDelay = int.Parse( spl[1] ); - break; - case "PMbPortamentoUse": - PMbPortamentoUse = int.Parse( spl[1] ); - break; - case "NoteHeadHandle": - NoteHeadHandle_index = VsqHandle.HandleIndexFromString( spl[1] ); - break; - - } - if ( sr.peek() < 0 ) { - break; - } - last_line = sr.readLine(); - } - } - - public override String ToString() { - String ret = "{Type=" + type; - switch ( type ) { - case VsqIDType.Anote: - ret += ", Length=" + Length; - ret += ", Note#=" + Note; - ret += ", Dynamics=" + Dynamics; - ret += ", PMBendDepth=" + PMBendDepth ; - ret += ", PMBendLength=" + PMBendLength ; - ret += ", PMbPortamentoUse=" + PMbPortamentoUse ; - ret += ", DEMdecGainRate=" + DEMdecGainRate ; - ret += ", DEMaccent=" + DEMaccent ; - if ( LyricHandle != null ) { - ret += ", LyricHandle=h#" + LyricHandle_index.ToString( "0000" ) ; - } - if ( VibratoHandle != null ) { - ret += ", VibratoHandle=h#" + VibratoHandle_index.ToString( "0000" ); - ret += ", VibratoDelay=" + VibratoDelay ; - } - break; - case VsqIDType.Singer: - ret += ", IconHandle=h#" + IconHandle_index.ToString( "0000" ); - break; - } - ret += "}"; - return ret; - } - - /// - /// インスタンスをテキストファイルに出力します - /// - /// 出力先 - public void write( TextMemoryStream sw ) { - sw.writeLine( "[ID#" + value.ToString( "0000" ) + "]" ); - sw.writeLine( "Type=" + type ); - switch( type ){ - case VsqIDType.Anote: - sw.writeLine( "Length=" + Length ); - sw.writeLine( "Note#=" + Note ); - sw.writeLine( "Dynamics=" + Dynamics ); - sw.writeLine( "PMBendDepth=" + PMBendDepth ); - sw.writeLine( "PMBendLength=" + PMBendLength ); - sw.writeLine( "PMbPortamentoUse=" + PMbPortamentoUse ); - sw.writeLine( "DEMdecGainRate=" + DEMdecGainRate ); - sw.writeLine( "DEMaccent=" + DEMaccent ); - if ( LyricHandle != null ) { - sw.writeLine( "LyricHandle=h#" + LyricHandle_index.ToString( "0000" ) ); - } - if ( VibratoHandle != null ) { - sw.writeLine( "VibratoHandle=h#" + VibratoHandle_index.ToString( "0000" ) ); - sw.writeLine( "VibratoDelay=" + VibratoDelay ); - } - if ( NoteHeadHandle != null ) { - sw.writeLine( "NoteHeadHandle=h#" + NoteHeadHandle_index.ToString( "0000" ) ); - } - break; - case VsqIDType.Singer: - sw.writeLine( "IconHandle=h#" + IconHandle_index.ToString( "0000" ) ); - break; - } - } - - - /// - /// VsqIDを構築するテストを行います。 - /// - /// テストに成功すればtrue、そうでなければfalseを返します - public static boolean test() { - String fpath = Path.GetTempFileName(); - using ( StreamWriter sw = new StreamWriter( fpath, false, Encoding.Unicode ) ) { - sw.WriteLine( "Type=Anote" ); - sw.WriteLine( "Length=320" ); - sw.WriteLine( "Note#=67" ); - sw.WriteLine( "Dynamics=64" ); - sw.WriteLine( "PMBendDepth=8" ); - sw.WriteLine( "PMBendLength=1" ); - sw.WriteLine( "PMbPortamentoUse=1" ); - sw.WriteLine( "DEMdecGainRate=50" ); - sw.WriteLine( "DEMaccent=50" ); - sw.WriteLine( "LyricHandle=h#0111" ); - sw.WriteLine( "[ID#0104]" ); - } - - String last_line = ""; - boolean result; - using ( TextMemoryStream sr = new TextMemoryStream( fpath, Encoding.Unicode ) ) { - VsqID vsqID = new VsqID( sr, 103, ref last_line ); - if ( vsqID.type == VsqIDType.Anote && - vsqID.Length == 320 && - vsqID.Note == 67 && - vsqID.Dynamics == 64 && - vsqID.PMBendDepth == 8 && - vsqID.PMBendLength == 1 && - vsqID.PMbPortamentoUse == 1 && - vsqID.DEMdecGainRate == 50 && - vsqID.DEMaccent == 50 && - vsqID.LyricHandle_index == 111 && - last_line.Equals( "[ID#0104]" ) ) { - result = true; - } else { - result = false; - } - } - File.Delete( fpath ); - return result; - } - - } -} diff --git a/trunk/Boare.Lib.Vsq/VsqMetaText/Master.cs b/trunk/Boare.Lib.Vsq/VsqMetaText/Master.cs deleted file mode 100644 index 7f3a0bd..0000000 --- a/trunk/Boare.Lib.Vsq/VsqMetaText/Master.cs +++ /dev/null @@ -1,107 +0,0 @@ -/* - * VsqMetaText/Master.cs - * Copyright (c) 2008-2009 kbinani - * - * This file is part of Boare.Lib.Vsq. - * - * Boare.Lib.Vsq is free software; you can redistribute it and/or - * modify it under the terms of the BSD License. - * - * Boare.Lib.Vsq 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.IO; -using System.Text; - -using bocoree; - -namespace Boare.Lib.Vsq { - - using boolean = System.Boolean; - - /// - /// vsqファイルのメタテキストの[Master]に記録される内容を取り扱う - /// - [Serializable] - public class VsqMaster : ICloneable { - public int PreMeasure; - - public object Clone() { - VsqMaster res = new VsqMaster( PreMeasure ); - return res; - } - - public VsqMaster() - : this( 1 ) { - } - - /// - /// プリメジャー値を指定したコンストラクタ - /// - /// - public VsqMaster( int pre_measure ) { - this.PreMeasure = pre_measure; - } - - /// - /// テキストファイルからのコンストラクタ - /// - /// 読み込み元 - /// 最後に読み込んだ行が返されます - public VsqMaster( TextMemoryStream sr, ref String last_line ) { - PreMeasure = 0; - String[] spl; - last_line = sr.readLine(); - while ( !last_line.StartsWith( "[" ) ) { - spl = last_line.Split( new char[] { '=' } ); - switch ( spl[0] ) { - case "PreMeasure": - this.PreMeasure = int.Parse( spl[1] ); - break; - } - if ( sr.peek() < 0 ) { - break; - } - last_line = sr.readLine(); - } - } - - /// - /// インスタンスの内容をテキストファイルに出力します - /// - /// 出力先 - public void write( TextMemoryStream sw ) { - sw.writeLine( "[Master]" ); - sw.writeLine( "PreMeasure=" + PreMeasure ); - } - - /// - /// VsqMasterのインスタンスを構築するテストを行います - /// - /// テストに成功すればtrue、そうでなければfalseを返します - public static boolean test() { - String fpath = Path.GetTempFileName(); - using ( StreamWriter sw = new StreamWriter( fpath, false, Encoding.Unicode ) ) { - sw.WriteLine( "PreMeasure=2" ); - sw.WriteLine( "[Mixer]" ); - } - - boolean result; - using ( TextMemoryStream sr = new TextMemoryStream( fpath, Encoding.Unicode ) ) { - String last_line = ""; - VsqMaster vsqMaster = new VsqMaster( sr, ref last_line ); - if ( vsqMaster.PreMeasure == 2 && - last_line.Equals( "[Mixer]" ) ) { - result = true; - } else { - result = false; - } - } - File.Delete( fpath ); - return result; - } - } - -} diff --git a/trunk/Boare.Lib.Vsq/VsqMetaText/Mixer.cs b/trunk/Boare.Lib.Vsq/VsqMetaText/Mixer.cs deleted file mode 100644 index dc70232..0000000 --- a/trunk/Boare.Lib.Vsq/VsqMetaText/Mixer.cs +++ /dev/null @@ -1,279 +0,0 @@ -/* - * VsqMetaText/Mixer.cs - * Copyright (c) 2008-2009 kbinani - * - * This file is part of Boare.Lib.Vsq. - * - * Boare.Lib.Vsq is free software; you can redistribute it and/or - * modify it under the terms of the BSD License. - * - * Boare.Lib.Vsq 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.IO; -using System.Text; - -using bocoree; - -namespace Boare.Lib.Vsq { - - using boolean = System.Boolean; - - /// - /// vsqファイルのメタテキストの[Mixer]セクションに記録される内容を取り扱う - /// - [Serializable] - public class VsqMixer : ICloneable { - public int MasterFeder; - public int MasterPanpot; - public int MasterMute; - public int OutputMode; - - /// - /// vsqファイルの各トラックのfader, panpot, muteおよびoutputmode値を保持します - /// - public Vector Slave = new Vector(); - - public object Clone() { - VsqMixer res = new VsqMixer( MasterFeder, MasterPanpot, MasterMute, OutputMode ); - res.Slave = new Vector(); - for ( Iterator itr = Slave.iterator(); itr.hasNext(); ){ - VsqMixerEntry item = (VsqMixerEntry)itr.next(); - res.Slave.add( (VsqMixerEntry)item.Clone() ); - } - return res; - } - - /// - /// 各パラメータを指定したコンストラクタ - /// - /// MasterFader値 - /// MasterPanpot値 - /// MasterMute値 - /// OutputMode値 - public VsqMixer( int master_fader, int master_panpot, int master_mute, int output_mode ) { - this.MasterFeder = master_fader; - this.MasterMute = master_mute; - this.MasterPanpot = master_panpot; - this.OutputMode = output_mode; - Slave = new Vector(); - } - - public VsqMixer() - : this( 0, 0, 0, 0 ) { - } - - /// - /// テキストファイルからのコンストラクタ - /// - /// 読み込み対象 - /// 最後に読み込んだ行が返されます - public VsqMixer( TextMemoryStream sr, ref String last_line ) { - MasterFeder = 0; - MasterPanpot = 0; - MasterMute = 0; - OutputMode = 0; - //Tracks = 1; - int tracks = 0; - String[] spl; - String buffer = ""; - last_line = sr.readLine(); - while ( !last_line.StartsWith( "[" ) ) { - spl = last_line.Split( new char[] { '=' } ); - switch ( spl[0] ) { - case "MasterFeder": - MasterFeder = int.Parse( spl[1] ); - break; - case "MasterPanpot": - MasterPanpot = int.Parse( spl[1] ); - break; - case "MasterMute": - MasterMute = int.Parse( spl[1] ); - break; - case "OutputMode": - OutputMode = int.Parse( spl[1] ); - break; - case "Tracks": - tracks = int.Parse( spl[1] ); - break; - default: - if ( spl[0].StartsWith( "Feder" ) || - spl[0].StartsWith( "Panpot" ) || - spl[0].StartsWith( "Mute" ) || - spl[0].StartsWith( "Solo" ) ) { - buffer += spl[0] + "=" + spl[1] + Environment.NewLine; - } - break; - } - if ( sr.peek() < 0 ) { - break; - } - last_line = sr.readLine(); - } - - Slave = new Vector(); - for ( int i = 0; i < tracks; i++ ) { - Slave.add( new VsqMixerEntry( 0, 0, 0, 0 ) ); - } - spl = buffer.Split( new String[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries ); - String[] spl2; - for ( int i = 0; i < spl.Length; i++ ) { - String ind = ""; - int index; - spl2 = spl[i].Split( new char[] { '=' } ); - if ( spl2[0].StartsWith( "Feder" ) ) { - ind = spl2[0].Replace( "Feder", "" ); - index = int.Parse( ind ); - Slave.get( index ).Feder = int.Parse( spl2[1] ); - } else if ( spl2[0].StartsWith( "Panpot" ) ) { - ind = spl2[0].Replace( "Panpot", "" ); - index = int.Parse( ind ); - Slave.get( index ).Panpot = int.Parse( spl2[1] ); - } else if ( spl2[0].StartsWith( "Mute" ) ) { - ind = spl2[0].Replace( "Mute", "" ); - index = int.Parse( ind ); - Slave.get( index ).Mute = int.Parse( spl2[1] ); - } else if ( spl2[0].StartsWith( "Solo" ) ) { - ind = spl2[0].Replace( "Solo", "" ); - index = int.Parse( ind ); - Slave.get( index ).Solo = int.Parse( spl2[1] ); - } - - } - } - - /// - /// このインスタンスをテキストファイルに出力します - /// - /// 出力対象 - public void write( TextMemoryStream sw ) { - sw.writeLine( "[Mixer]" ); - sw.writeLine( "MasterFeder=" + MasterFeder ); - sw.writeLine( "MasterPanpot=" + MasterPanpot ); - sw.writeLine( "MasterMute=" + MasterMute ); - sw.writeLine( "OutputMode=" + OutputMode ); - sw.writeLine( "Tracks=" + Slave.size() ); - for ( int i = 0; i < Slave.size(); i++ ) { - sw.writeLine( "Feder" + i + "=" + Slave.get( i ).Feder ); - sw.writeLine( "Panpot" + i + "=" + Slave.get( i ).Panpot ); - sw.writeLine( "Mute" + i + "=" + Slave.get( i ).Mute ); - sw.writeLine( "Solo" + i + "=" + Slave.get( i ).Solo ); - } - } - - /// - /// VsqMixerのインスタンスを構築するテストを行います - /// - /// テストに成功すればtrue、そうでなければfalseを返します - public static boolean test() { - String fpath = Path.GetTempFileName(); - StreamWriter sw = new StreamWriter( fpath, false, Encoding.Unicode ); - sw.WriteLine( "MasterFeder=12" ); - sw.WriteLine( "MasterPanpot=13" ); - sw.WriteLine( "MasterMute=14" ); - sw.WriteLine( "OutputMode=15" ); - sw.WriteLine( "Tracks=8" ); - sw.WriteLine( "Feder0=1" ); - sw.WriteLine( "Panpot0=2" ); - sw.WriteLine( "Mute0=3" ); - sw.WriteLine( "Solo0=4" ); - sw.WriteLine( "Feder1=5" ); - sw.WriteLine( "Panpot1=6" ); - sw.WriteLine( "Mute1=7" ); - sw.WriteLine( "Solo1=8" ); - sw.WriteLine( "Feder2=9" ); - sw.WriteLine( "Panpot2=10" ); - sw.WriteLine( "Mute2=11" ); - sw.WriteLine( "Solo2=12" ); - sw.WriteLine( "Feder3=13" ); - sw.WriteLine( "Panpot3=14" ); - sw.WriteLine( "Mute3=15" ); - sw.WriteLine( "Solo3=16" ); - sw.WriteLine( "Feder4=17" ); - sw.WriteLine( "Panpot4=18" ); - sw.WriteLine( "Mute4=19" ); - sw.WriteLine( "Solo4=20" ); - sw.WriteLine( "Feder5=21" ); - sw.WriteLine( "Panpot5=22" ); - sw.WriteLine( "Mute5=23" ); - sw.WriteLine( "Solo5=24" ); - sw.WriteLine( "Feder6=25" ); - sw.WriteLine( "Panpot6=26" ); - sw.WriteLine( "Mute6=27" ); - sw.WriteLine( "Solo6=28" ); - sw.WriteLine( "Feder7=29" ); - sw.WriteLine( "Panpot7=30" ); - sw.WriteLine( "Mute7=31" ); - sw.WriteLine( "Solo7=32" ); - sw.WriteLine( "[EventList]" ); - sw.Close(); - - TextMemoryStream sr = new TextMemoryStream( fpath, Encoding.Unicode ); - String last_line = ""; - VsqMixer vsqMixer = new VsqMixer( sr, ref last_line ); - - if( vsqMixer.MasterFeder == 12 && - vsqMixer.MasterPanpot == 13 && - vsqMixer.MasterMute == 14 && - vsqMixer.OutputMode == 15 && - vsqMixer.Slave.size() == 8 ){ - for( int i = 0; i < vsqMixer.Slave.size(); i++ ){ - int start = 4 * i; - if ( vsqMixer.Slave.get( i ).Feder != start + 1 || - vsqMixer.Slave.get( i ).Panpot != start + 2 || - vsqMixer.Slave.get( i ).Mute != start + 3 || - vsqMixer.Slave.get( i ).Solo != start + 4 ) { - sr.close(); - File.Delete( fpath ); - return false; - } - } - }else{ - sr.close(); - File.Delete( fpath ); - return false; - } - sr.close(); - File.Delete( fpath ); - return true; - } - } - - /// - /// VsqMixerのSlave要素に格納される各エントリ - /// - [Serializable] - public class VsqMixerEntry : ICloneable { - public int Feder; - public int Panpot; - public int Mute; - public int Solo; - - public object Clone() { - VsqMixerEntry res = new VsqMixerEntry( Feder, Panpot, Mute, Solo ); - return res; - } - - /// - /// 各パラメータを指定したコンストラクタ - /// - /// Feder値 - /// Panpot値 - /// Mute値 - /// Solo値 - public VsqMixerEntry( int feder, int panpot, int mute, int solo ) { - this.Feder = feder; - this.Panpot = panpot; - this.Mute = mute; - this.Solo = solo; - } - - public VsqMixerEntry() - : this( 0, 0, 0, 0 ) { - } - } - -} diff --git a/trunk/Boare.Lib.Vsq/VsqMixer.cs b/trunk/Boare.Lib.Vsq/VsqMixer.cs new file mode 100644 index 0000000..2271695 --- /dev/null +++ b/trunk/Boare.Lib.Vsq/VsqMixer.cs @@ -0,0 +1,183 @@ +/* +* VsqMixer.cs +* Copyright (c) 2008-2009 kbinani +* +* This file is part of Boare.Lib.Vsq. +* +* Boare.Lib.Vsq is free software; you can redistribute it and/or +* modify it under the terms of the BSD License. +* +* Boare.Lib.Vsq 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. +*/ +#if JAVA +package org.kbinani.vsq; + +import java.io.*; +import java.util.*; +import org.kbinani.*; +#else +using System; +using bocoree; +using bocoree.java.util; + +namespace Boare.Lib.Vsq { +#endif + + /// + /// vsqファイルのメタテキストの[Mixer]セクションに記録される内容を取り扱う + /// +#if JAVA + public class VsqMixer implements Cloneable, Serializable { +#else + [Serializable] + public class VsqMixer : ICloneable { +#endif + public int MasterFeder; + public int MasterPanpot; + public int MasterMute; + public int OutputMode; + + /// + /// vsqファイルの各トラックのfader, panpot, muteおよびoutputmode値を保持します + /// + public Vector Slave = new Vector(); + + public Object clone() { + VsqMixer res = new VsqMixer( MasterFeder, MasterPanpot, MasterMute, OutputMode ); + res.Slave = new Vector(); + for ( Iterator itr = Slave.iterator(); itr.hasNext(); ) { + VsqMixerEntry item = (VsqMixerEntry)itr.next(); + res.Slave.add( (VsqMixerEntry)item.clone() ); + } + return res; + } + +#if !JAVA + public object Clone() { + return clone(); + } +#endif + + /// + /// 各パラメータを指定したコンストラクタ + /// + /// MasterFader値 + /// MasterPanpot値 + /// MasterMute値 + /// OutputMode値 + public VsqMixer( int master_fader, int master_panpot, int master_mute, int output_mode ) { + this.MasterFeder = master_fader; + this.MasterMute = master_mute; + this.MasterPanpot = master_panpot; + this.OutputMode = output_mode; + Slave = new Vector(); + } + +#if JAVA + public VsqMixer(){ + this( 0, 0, 0, 0 ); +#else + public VsqMixer() + : this( 0, 0, 0, 0 ) { +#endif + } + + /// + /// テキストファイルからのコンストラクタ + /// + /// 読み込み対象 + /// 最後に読み込んだ行が返されます + public VsqMixer( TextMemoryStream sr, ByRef last_line ) { + MasterFeder = 0; + MasterPanpot = 0; + MasterMute = 0; + OutputMode = 0; + //Tracks = 1; + int tracks = 0; + String[] spl; + String buffer = ""; + last_line.value = sr.readLine(); + while ( !last_line.value.StartsWith( "[" ) ) { + spl = PortUtil.splitString( last_line.value, new char[] { '=' } ); + if ( spl[0].Equals( "MasterFeder" ) ) { + MasterFeder = PortUtil.parseInt( spl[1] ); + } else if ( spl[0].Equals( "MasterPanpot" ) ) { + MasterPanpot = PortUtil.parseInt( spl[1] ); + } else if ( spl[0].Equals( "MasterMute" ) ) { + MasterMute = PortUtil.parseInt( spl[1] ); + } else if ( spl[0].Equals( "OutputMode" ) ) { + OutputMode = PortUtil.parseInt( spl[1] ); + } else if ( spl[0].Equals( "Tracks" ) ) { + tracks = PortUtil.parseInt( spl[1] ); + } else { + if ( spl[0].StartsWith( "Feder" ) || + spl[0].StartsWith( "Panpot" ) || + spl[0].StartsWith( "Mute" ) || + spl[0].StartsWith( "Solo" ) ) { + buffer += spl[0] + "=" + spl[1] + "\n"; + } + } + if ( sr.peek() < 0 ) { + break; + } + last_line.value = sr.readLine(); + } + + Slave = new Vector(); + for ( int i = 0; i < tracks; i++ ) { + Slave.add( new VsqMixerEntry( 0, 0, 0, 0 ) ); + } + spl = PortUtil.splitString( buffer, new String[] { "\n" }, true ); + String[] spl2; + for ( int i = 0; i < spl.Length; i++ ) { + String ind = ""; + int index; + spl2 = PortUtil.splitString( spl[i], new char[] { '=' } ); + if ( spl2[0].StartsWith( "Feder" ) ) { + ind = spl2[0].Replace( "Feder", "" ); + index = PortUtil.parseInt( ind ); + Slave.get( index ).Feder = PortUtil.parseInt( spl2[1] ); + } else if ( spl2[0].StartsWith( "Panpot" ) ) { + ind = spl2[0].Replace( "Panpot", "" ); + index = PortUtil.parseInt( ind ); + Slave.get( index ).Panpot = PortUtil.parseInt( spl2[1] ); + } else if ( spl2[0].StartsWith( "Mute" ) ) { + ind = spl2[0].Replace( "Mute", "" ); + index = PortUtil.parseInt( ind ); + Slave.get( index ).Mute = PortUtil.parseInt( spl2[1] ); + } else if ( spl2[0].StartsWith( "Solo" ) ) { + ind = spl2[0].Replace( "Solo", "" ); + index = PortUtil.parseInt( ind ); + Slave.get( index ).Solo = PortUtil.parseInt( spl2[1] ); + } + + } + } + + /// + /// このインスタンスをテキストファイルに出力します + /// + /// 出力対象 + public void write( TextMemoryStream sw ) { + sw.writeLine( "[Mixer]" ); + sw.writeLine( "MasterFeder=" + MasterFeder ); + sw.writeLine( "MasterPanpot=" + MasterPanpot ); + sw.writeLine( "MasterMute=" + MasterMute ); + sw.writeLine( "OutputMode=" + OutputMode ); + int count = Slave.size(); + sw.writeLine( "Tracks=" + count ); + for ( int i = 0; i < count; i++ ) { + VsqMixerEntry item = Slave.get( i ); + sw.writeLine( "Feder" + i + "=" + item.Feder ); + sw.writeLine( "Panpot" + i + "=" + item.Panpot ); + sw.writeLine( "Mute" + i + "=" + item.Mute ); + sw.writeLine( "Solo" + i + "=" + item.Solo ); + } + } + } + +#if !JAVA +} +#endif diff --git a/trunk/Boare.Lib.Vsq/VsqMixerEntry.cs b/trunk/Boare.Lib.Vsq/VsqMixerEntry.cs new file mode 100644 index 0000000..8ed7428 --- /dev/null +++ b/trunk/Boare.Lib.Vsq/VsqMixerEntry.cs @@ -0,0 +1,75 @@ +/* +* VsqMixerEntry.cs +* Copyright (c) 2008-2009 kbinani +* +* This file is part of Boare.Lib.Vsq. +* +* Boare.Lib.Vsq is free software; you can redistribute it and/or +* modify it under the terms of the BSD License. +* +* Boare.Lib.Vsq 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. +*/ +#if JAVA +package org.kbinani.vsq; + +import java.io.*; +#else +using System; + +namespace Boare.Lib.Vsq { +#endif + + /// + /// VsqMixerのSlave要素に格納される各エントリ + /// +#if JAVA + public class VsqMixerEntry implements Cloneable, Serializable { +#else + [Serializable] + public class VsqMixerEntry : ICloneable { +#endif + public int Feder; + public int Panpot; + public int Mute; + public int Solo; + + public Object clone() { + VsqMixerEntry res = new VsqMixerEntry( Feder, Panpot, Mute, Solo ); + return res; + } + +#if !JAVA + public object Clone() { + return clone(); + } +#endif + + /// + /// 各パラメータを指定したコンストラクタ + /// + /// Feder値 + /// Panpot値 + /// Mute値 + /// Solo値 + public VsqMixerEntry( int feder, int panpot, int mute, int solo ) { + this.Feder = feder; + this.Panpot = panpot; + this.Mute = mute; + this.Solo = solo; + } + +#if JAVA + public VsqMixerEntry(){ + this( 0, 0, 0, 0 ); +#else + public VsqMixerEntry() + : this( 0, 0, 0, 0 ) { +#endif + } + } + +#if !JAVA +} +#endif diff --git a/trunk/Boare.Lib.Vsq/VsqNote.cs b/trunk/Boare.Lib.Vsq/VsqNote.cs index 75eb01c..4a8516b 100644 --- a/trunk/Boare.Lib.Vsq/VsqNote.cs +++ b/trunk/Boare.Lib.Vsq/VsqNote.cs @@ -11,26 +11,31 @@ * 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; +#if JAVA +package org.kbinani.vsq; -using bocoree; +import java.io.*; +#else +using System; namespace Boare.Lib.Vsq { - using boolean = System.Boolean; +#endif /// /// 音階を表現するためのクラス /// +#if JAVA + public class VsqNote implements Serializable { +#else [Serializable] public class VsqNote { +#endif /// /// このインスタンスが表す音階のノート値 /// public int Value; - private static readonly boolean[] _KEY_TYPE = new boolean[128] { + private static readonly boolean[] _KEY_TYPE = new boolean[] { true, false, true, @@ -232,9 +237,17 @@ namespace Boare.Lib.Vsq { } } - override public String ToString() { +#if !JAVA + public override string ToString() { + return toString(); + } +#endif + + public String toString() { return getNoteString( Value ); } } +#if !JAVA } +#endif diff --git a/trunk/Boare.Lib.Vsq/VsqNrpn.cs b/trunk/Boare.Lib.Vsq/VsqNrpn.cs index b8b1b49..ac3e77b 100644 --- a/trunk/Boare.Lib.Vsq/VsqNrpn.cs +++ b/trunk/Boare.Lib.Vsq/VsqNrpn.cs @@ -11,25 +11,33 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */ -using System; -using System.Collections.Generic; +#if JAVA +package org.kbinani.vsq; +import java.util.*; +#else +using System; using bocoree; +using bocoree.java.util; namespace Boare.Lib.Vsq { - using boolean = System.Boolean; +#endif +#if JAVA + public class VsqNrpn implements Comparable { +#else public struct VsqNrpn : IComparable { +#endif public int Clock; - public ushort Nrpn; + public int Nrpn; public byte DataMsb; public byte DataLsb; public boolean DataLsbSpecified; public boolean msbOmitRequired; private Vector m_list; - public VsqNrpn( int clock, ushort nrpn, byte data_msb ) { + public VsqNrpn( int clock, int nrpn, byte data_msb ) { Clock = clock; Nrpn = nrpn; DataMsb = data_msb; @@ -39,7 +47,7 @@ namespace Boare.Lib.Vsq { m_list = new Vector(); } - public VsqNrpn( int clock, ushort nrpn, byte data_msb, byte data_lsb ) { + public VsqNrpn( int clock, int nrpn, byte data_msb, byte data_lsb ) { Clock = clock; Nrpn = nrpn; DataMsb = data_msb; @@ -61,9 +69,9 @@ namespace Boare.Lib.Vsq { ret.add( v ); } for ( int i = 0; i < m_list.size(); i++ ) { - ret.addAll( m_list.get( i ).expand() ); + ret.addAll( Arrays.asList( m_list.get( i ).expand() ) ); } - return ret.toArray( new VsqNrpn[]{} ); + return ret.toArray( new VsqNrpn[] { } ); } public static Vector sort( Vector list ) { @@ -120,66 +128,74 @@ namespace Boare.Lib.Vsq { ret.add( src2[i] ); } Collections.sort( ret ); - return ret.toArray( new VsqNrpn[]{} ); + return ret.toArray( new VsqNrpn[] { } ); } public static NrpnData[] convert( VsqNrpn[] source ) { - ushort nrpn = (ushort)source[0].Nrpn; + int nrpn = source[0].Nrpn; byte msb = (byte)(nrpn >> 8); byte lsb = (byte)(nrpn - (nrpn << 8)); Vector ret = new Vector(); - ret.add( new NrpnData( source[0].Clock, 0x63, msb ) ); - ret.add( new NrpnData( source[0].Clock, 0x62, lsb ) ); - ret.add( new NrpnData( source[0].Clock, 0x06, source[0].DataMsb ) ); + ret.add( new NrpnData( source[0].Clock, (byte)0x63, msb ) ); + ret.add( new NrpnData( source[0].Clock, (byte)0x62, lsb ) ); + ret.add( new NrpnData( source[0].Clock, (byte)0x06, source[0].DataMsb ) ); if ( source[0].DataLsbSpecified ) { - ret.add( new NrpnData( source[0].Clock, 0x26, source[0].DataLsb ) ); + ret.add( new NrpnData( source[0].Clock, (byte)0x26, source[0].DataLsb ) ); } for ( int i = 1; i < source.Length; i++ ) { VsqNrpn item = source[i]; - ushort tnrpn = item.Nrpn; + int tnrpn = item.Nrpn; msb = (byte)(tnrpn >> 8); lsb = (byte)(tnrpn - (tnrpn << 8)); if ( item.msbOmitRequired ) { - ret.add( new NrpnData( item.Clock, 0x62, lsb ) ); - ret.add( new NrpnData( item.Clock, 0x06, item.DataMsb ) ); + ret.add( new NrpnData( item.Clock, (byte)0x62, lsb ) ); + ret.add( new NrpnData( item.Clock, (byte)0x06, item.DataMsb ) ); if ( item.DataLsbSpecified ) { - ret.add( new NrpnData( item.Clock, 0x26, item.DataLsb ) ); + ret.add( new NrpnData( item.Clock, (byte)0x26, item.DataLsb ) ); } } else { - ret.add( new NrpnData( item.Clock, 0x63, msb ) ); - ret.add( new NrpnData( item.Clock, 0x62, lsb ) ); - ret.add( new NrpnData( item.Clock, 0x06, item.DataMsb ) ); + ret.add( new NrpnData( item.Clock, (byte)0x63, msb ) ); + ret.add( new NrpnData( item.Clock, (byte)0x62, lsb ) ); + ret.add( new NrpnData( item.Clock, (byte)0x06, item.DataMsb ) ); if ( item.DataLsbSpecified ) { - ret.add( new NrpnData( item.Clock, 0x26, item.DataLsb ) ); + ret.add( new NrpnData( item.Clock, (byte)0x26, item.DataLsb ) ); } } } - return ret.toArray( new NrpnData[]{} ); + return ret.toArray( new NrpnData[] { } ); } - public int CompareTo( VsqNrpn item ) { + public int compareTo( VsqNrpn item ) { return Clock - item.Clock; } - public void append( ushort nrpn, byte data_msb ) { +#if !JAVA + public int CompareTo( VsqNrpn item ) { + return compareTo( item ); + } +#endif + + public void append( int nrpn, byte data_msb ) { m_list.add( new VsqNrpn( Clock, nrpn, data_msb ) ); } - public void append( ushort nrpn, byte data_msb, byte data_lsb ) { + public void append( int nrpn, byte data_msb, byte data_lsb ) { m_list.add( new VsqNrpn( Clock, nrpn, data_msb, data_lsb ) ); } - public void append( ushort nrpn, byte data_msb, boolean msb_omit_required ) { + public void append( int nrpn, byte data_msb, boolean msb_omit_required ) { VsqNrpn v = new VsqNrpn( Clock, nrpn, data_msb ); v.msbOmitRequired = msb_omit_required; m_list.add( v ); } - public void append( ushort nrpn, byte data_msb, byte data_lsb, boolean msb_omit_required ) { + public void append( int nrpn, byte data_msb, byte data_lsb, boolean msb_omit_required ) { VsqNrpn v = new VsqNrpn( Clock, nrpn, data_msb, data_lsb ); v.msbOmitRequired = msb_omit_required; m_list.add( v ); } } +#if !JAVA } +#endif diff --git a/trunk/Boare.Lib.Vsq/VsqPhoneticSymbol.cs b/trunk/Boare.Lib.Vsq/VsqPhoneticSymbol.cs index 2e5f237..1603a51 100644 --- a/trunk/Boare.Lib.Vsq/VsqPhoneticSymbol.cs +++ b/trunk/Boare.Lib.Vsq/VsqPhoneticSymbol.cs @@ -11,118 +11,120 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */ +#if JAVA +package org.kbinani.vsq; +#else using System; - using bocoree; namespace Boare.Lib.Vsq { - using boolean = System.Boolean; +#endif public class VsqPhoneticSymbol { private static String[] _SYMBOL_VOWEL_JP = new String[]{ - @"a", - @"i", - @"M", - @"e", - @"o", + "a", + "i", + "M", + "e", + "o", }; private static String[] _SYMBOL_CONSONANT_JP = new String[]{ - @"k", - @"k'", - @"g", - @"g'", - @"N", - @"N'", - @"s", - @"S", - @"z", - @"Z", - @"dz", - @"dZ", - @"t", - @"t'", - @"ts", - @"tS", - @"d", - @"d'", - @"n", - @"J", - @"h", - @"h\", - @"C", - @"p\", - @"p\'", - @"b", - @"b'", - @"p", - @"p'", - @"m", - @"m'", - @"j", - @"4", - @"4'", - @"w", - @"N\", + "k", + "k'", + "g", + "g'", + "N", + "N'", + "s", + "S", + "z", + "Z", + "dz", + "dZ", + "t", + "t'", + "ts", + "tS", + "d", + "d'", + "n", + "J", + "h", + "h\\", + "C", + "p\\", + "p\\'", + "b", + "b'", + "p", + "p'", + "m", + "m'", + "j", + "4", + "4'", + "w", + "N\\", }; private static String[] _SYMBOL_EN = new String[]{ - @"@", - @"V", - @"e", - @"e", - @"I", - @"i:", - @"{", - @"O:", - @"Q", - @"U", - @"u:", - @"@r", - @"eI", - @"aI", - @"OI", - @"@U", - @"aU", - @"I@", - @"e@", - @"U@", - @"O@", - @"Q@", - @"w", - @"j", - @"b", - @"d", - @"g", - @"bh", - @"dh", - @"gh", - @"dZ", - @"v", - @"D", - @"z", - @"Z", - @"m", - @"n", - @"N", - @"r", - @"l", - @"l0", - @"p", - @"t", - @"k", - @"ph", - @"th", - @"kh", - @"tS", - @"f", - @"T", - @"s", - @"S", - @"h", + "@", + "V", + "e", + "e", + "I", + "i:", + "{", + "O:", + "Q", + "U", + "u:", + "@r", + "eI", + "aI", + "OI", + "@U", + "aU", + "I@", + "e@", + "U@", + "O@", + "Q@", + "w", + "j", + "b", + "d", + "g", + "bh", + "dh", + "gh", + "dZ", + "v", + "D", + "z", + "Z", + "m", + "n", + "N", + "r", + "l", + "l0", + "p", + "t", + "k", + "ph", + "th", + "kh", + "tS", + "f", + "T", + "s", + "S", + "h", }; public static boolean isConsonant( String symbol ) { - for ( int i = 0; i < _SYMBOL_CONSONANT_JP.Length; i++ ){ + for ( int i = 0; i < _SYMBOL_CONSONANT_JP.Length; i++ ) { String s = _SYMBOL_CONSONANT_JP[i]; if ( s.Equals( symbol ) ) { return true; @@ -132,19 +134,19 @@ namespace Boare.Lib.Vsq { } public static boolean isValidSymbol( String symbol ) { - for ( int i = 0; i < _SYMBOL_VOWEL_JP.Length; i++ ){ + for ( int i = 0; i < _SYMBOL_VOWEL_JP.Length; i++ ) { String s = _SYMBOL_VOWEL_JP[i]; if ( s.Equals( symbol ) ) { return true; } } - for ( int i = 0; i < _SYMBOL_CONSONANT_JP.Length; i++ ){ + for ( int i = 0; i < _SYMBOL_CONSONANT_JP.Length; i++ ) { String s = _SYMBOL_CONSONANT_JP[i]; if ( s.Equals( symbol ) ) { return true; } } - for ( int i = 0; i < _SYMBOL_EN.Length; i++ ){ + for ( int i = 0; i < _SYMBOL_EN.Length; i++ ) { String s = _SYMBOL_EN[i]; if ( s.Equals( symbol ) ) { return true; @@ -154,4 +156,6 @@ namespace Boare.Lib.Vsq { } } +#if !JAVA } +#endif diff --git a/trunk/Boare.Lib.Vsq/VsqTrack.cs b/trunk/Boare.Lib.Vsq/VsqTrack.cs index 1a99da6..bfc2b04 100644 --- a/trunk/Boare.Lib.Vsq/VsqTrack.cs +++ b/trunk/Boare.Lib.Vsq/VsqTrack.cs @@ -11,22 +11,31 @@ * 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.IO; -using System.Text; +#if JAVA +package org.kbinani.vsq; +import java.io.*; +import java.util.*; +import org.kbinani.*; +#else +using System; using bocoree; +using bocoree.java.util; +using bocoree.java.io; namespace Boare.Lib.Vsq { - using boolean = System.Boolean; +#endif /// /// Stores the data of a vsq track. /// +#if JAVA + public class VsqTrack implements Cloneable, Serializable { +#else [Serializable] - public partial class VsqTrack : ICloneable { + public class VsqTrack : ICloneable { +#endif public String Tag; /// /// トラックの名前。 @@ -36,7 +45,11 @@ namespace Boare.Lib.Vsq { private int m_edited_start = int.MaxValue; private int m_edited_end = int.MinValue; +#if JAVA + private class SingerEventIterator implements Iterator{ +#else private class SingerEventIterator : Iterator { +#endif VsqEventList m_list; int m_pos; @@ -54,7 +67,7 @@ namespace Boare.Lib.Vsq { return false; } - public object next() { + public Object next() { for ( int i = m_pos + 1; i < m_list.getCount(); i++ ) { VsqEvent item = m_list.getElement( i ); if ( item.ID.type == VsqIDType.Singer ) { @@ -72,7 +85,11 @@ namespace Boare.Lib.Vsq { } } +#if JAVA + private class NoteEventIterator implements Iterator{ +#else private class NoteEventIterator : Iterator { +#endif VsqEventList m_list; int m_pos; @@ -82,7 +99,8 @@ namespace Boare.Lib.Vsq { } public boolean hasNext() { - for ( int i = m_pos + 1; i < m_list.getCount(); i++ ) { + int count = m_list.getCount(); + for ( int i = m_pos + 1; i < count; i++ ) { if ( m_list.getElement( i ).ID.type == VsqIDType.Anote ) { return true; } @@ -90,8 +108,9 @@ namespace Boare.Lib.Vsq { return false; } - public object next() { - for ( int i = m_pos + 1; i < m_list.getCount(); i++ ) { + public Object next() { + int count = m_list.getCount(); + for ( int i = m_pos + 1; i < count; i++ ) { VsqEvent item = m_list.getElement( i ); if ( item.ID.type == VsqIDType.Anote ) { m_pos = i; @@ -108,7 +127,11 @@ namespace Boare.Lib.Vsq { } } - private class EventIterator : Iterator{ +#if JAVA + private class EventIterator implements Iterator{ +#else + private class EventIterator : Iterator { +#endif private VsqEventList m_list; private int m_pos; @@ -117,7 +140,7 @@ namespace Boare.Lib.Vsq { m_pos = -1; } - public Boolean hasNext() { + public boolean hasNext() { if ( 0 <= m_pos + 1 && m_pos + 1 < m_list.getCount() ) { return true; } @@ -137,7 +160,7 @@ namespace Boare.Lib.Vsq { } public String getName() { - if ( MetaText == null ) { + if ( MetaText == null || (MetaText != null && MetaText.Common == null) ) { return "Master Track"; } else { return MetaText.Common.Name; @@ -146,10 +169,14 @@ namespace Boare.Lib.Vsq { public void setName( String value ) { if ( MetaText != null ) { + if ( MetaText.Common == null ) { + MetaText.Common = new VsqCommon(); + } MetaText.Common.Name = value; } } +#if !JAVA [Obsolete] public String Name { get { @@ -159,6 +186,7 @@ namespace Boare.Lib.Vsq { setName( value ); } } +#endif /// /// ピッチベンド。Cent単位 @@ -220,24 +248,43 @@ namespace Boare.Lib.Vsq { /// /// /// - public void printMetaText( TextMemoryStream sw, int eos, int start ) { - MetaText.print( sw, false, eos, start ); + public void printMetaText( TextMemoryStream sw, int eos, int start ) +#if JAVA + throws IOException +#endif + { + MetaText.print( sw, eos, start ); } /// /// メタテキストを,指定されたファイルに出力します /// /// - public void printMetaText( String file ) { + public void printMetaText( String file ) +#if JAVA + throws IOException +#endif + { TextMemoryStream tms = new TextMemoryStream(); int count = MetaText.getEventList().getCount(); int clLast = MetaText.getEventList().getElement( count - 1 ).Clock + 480; - MetaText.print( tms, true, clLast, 0 ); - using ( StreamWriter sw = new StreamWriter( file ) ) { + MetaText.print( tms, clLast, 0 ); + BufferedWriter sw = null; + try { + sw = new BufferedWriter( new FileWriter( file ) ); tms.rewind(); while ( tms.peek() >= 0 ) { String line = tms.readLine(); - sw.WriteLine( line ); + sw.write( line ); + sw.newLine(); + } + } catch ( Exception ex ) { + } finally { + if ( sw != null ) { + try { + sw.close(); + } catch ( Exception ex2 ) { + } } } } @@ -249,7 +296,7 @@ namespace Boare.Lib.Vsq { return MetaText.master; } - internal void setMaster( VsqMaster value ) { + public void setMaster( VsqMaster value ) { MetaText.master = value; } @@ -260,7 +307,7 @@ namespace Boare.Lib.Vsq { return MetaText.mixer; } - internal void setMixer( VsqMixer value ) { + public void setMixer( VsqMixer value ) { MetaText.mixer = value; } @@ -280,28 +327,31 @@ namespace Boare.Lib.Vsq { /// public void changeRenderer( String new_renderer, Vector singers ) { VsqID default_id = null; - if ( singers.size() <= 0 ) { + int singers_size = singers.size(); + if ( singers_size <= 0 ) { default_id = new VsqID(); default_id.type = VsqIDType.Singer; default_id.IconHandle = new IconHandle(); - default_id.IconHandle.IconID = "$0701" + 0.ToString( "0000" ); + default_id.IconHandle.IconID = "$0701" + PortUtil.toHexString( 0, 4 ); default_id.IconHandle.IDS = "Unknown"; default_id.IconHandle.Index = 0; default_id.IconHandle.Language = 0; - default_id.IconHandle.Length = 1; + default_id.IconHandle.setLength( 1 ); default_id.IconHandle.Original = 0; default_id.IconHandle.Program = 0; default_id.IconHandle.Caption = ""; } else { default_id = singers.get( 0 ); } + for ( Iterator itr = getSingerEventIterator(); itr.hasNext(); ) { VsqEvent ve = (VsqEvent)itr.next(); int program = ve.ID.IconHandle.Program; boolean found = false; - for ( int i = 0; i < singers.size(); i++ ) { - if ( program == singers.get( i ).IconHandle.Program ) { - ve.ID = (VsqID)singers.get( i ).clone(); + for ( int i = 0; i < singers_size; i++ ) { + VsqID id = singers.get( i ); + if ( program == id.IconHandle.Program ) { + ve.ID = (VsqID)id.clone(); found = true; break; } @@ -398,7 +448,7 @@ namespace Boare.Lib.Vsq { VsqTrack res = new VsqTrack(); res.setName( getName() ); if ( MetaText != null ) { - res.MetaText = (VsqMetaText)MetaText.Clone(); + res.MetaText = (VsqMetaText)MetaText.clone(); } res.m_edited_start = m_edited_start; res.m_edited_end = m_edited_end; @@ -406,9 +456,11 @@ namespace Boare.Lib.Vsq { return res; } +#if !JAVA public object Clone() { return clone(); } +#endif /// /// Master Trackを構築 @@ -431,8 +483,13 @@ namespace Boare.Lib.Vsq { MetaText = new VsqMetaText( name, singer ); } +#if JAVA + public VsqTrack(){ + this( "Voice1", "Miku" ); +#else public VsqTrack() : this( "Voice1", "Miku" ) { +#endif } /// @@ -449,31 +506,57 @@ namespace Boare.Lib.Vsq { return counter; } - public VsqTrack( Vector midi_event, Encoding encoding ) { + public VsqTrack( Vector midi_event, String encoding ) { #if DEBUG bocoree.debug.push_log( "VsqTrack..ctor" ); #endif String track_name = ""; - using ( TextMemoryStream sw = new TextMemoryStream() ) { - for ( int i = 0; i < midi_event.size(); i++ ) { - if ( midi_event.get( i ).firstByte == 0xff && midi_event.get( i ).data.Length > 0 ) { + + TextMemoryStream sw = null; + try { + sw = new TextMemoryStream(); + int count = midi_event.size(); + Vector buffer = new Vector(); + for ( int i = 0; i < count; i++ ) { + MidiEvent item = midi_event.get( i ); + if ( item.firstByte == 0xff && item.data.Length > 0 ) { // meta textを抽出 - byte type = midi_event.get( i ).data[0]; + byte type = item.data[0]; if ( type == 0x01 || type == 0x03 ) { - /*char[] ch = new char[midi_event.get( i ).data.Length - 1]; - for ( int j = 1; j < midi_event.get( i ).data.Length; j++ ) { - ch[j - 1] = (char)midi_event.get( i ).data[j]; - } - - String line = new String( ch );*/ - byte[] dat = midi_event.get( i ).data; - String line = encoding.GetString( dat, 1, dat.Length - 1 ); + //String line = PortUtil.getDecodedString( encoding, dat, 1, dat.Length - 1 ); if ( type == 0x01 ) { - int second_colon = line.IndexOf( ':', 3 ); + int colon_count = 0; + for ( int j = 0; j < item.data.Length - 1; j++ ) { + byte d = item.data[j + 1]; + if ( d == 0x3a ) { + colon_count++; + if ( colon_count <= 2 ) { + continue; + } + } + if ( colon_count < 2 ) { + continue; + } + buffer.add( d ); + } + + int index_0x0a = buffer.indexOf( 0x0a ); + while ( index_0x0a >= 0 ) { + byte[] cpy = new byte[index_0x0a]; + for ( int j = 0; j < index_0x0a; j++ ) { + cpy[j] = buffer.get( 0 ); + buffer.removeElementAt( 0 ); + } + + String line = PortUtil.getDecodedString( encoding, cpy ); + sw.writeLine( line ); + buffer.removeElementAt( 0 ); + index_0x0a = buffer.indexOf( 0x0a ); + } + /*int second_colon = line.IndexOf( ':', 3 ); line = line.Substring( second_colon + 1 ); line = line.Replace( "\\n", "\n" ); - //line = line.Replace( "\n", Environment.NewLine ); - String[] lines = line.Split( '\n' ); + String[] lines = PortUtil.splitString( line, '\n' ); int c = lines.Length; for ( int j = 0; j < c; j++ ) { if ( j < c - 1 ) { @@ -481,10 +564,17 @@ namespace Boare.Lib.Vsq { } else { sw.write( lines[j] ); } - } - //sw.write( line ); + }*/ } else { - track_name = line; + for ( int j = 0; j < item.data.Length - 1; j++ ) { + buffer.add( item.data[j + 1] ); + } + track_name = PortUtil.getDecodedString( encoding, + PortUtil.convertByteArray( buffer.toArray( new Byte[] { } ) ) ); +#if DEBUG + Console.WriteLine( "VsqTrack#.ctor; track_name=" + track_name ); +#endif + buffer.clear(); } } } else { @@ -494,8 +584,19 @@ namespace Boare.Lib.Vsq { sw.rewind(); MetaText = new VsqMetaText( sw ); setName( track_name ); + } catch ( Exception ex ) { + PortUtil.println( "com.boare.vsq.VsqTrack#.ctor; ex=" + ex ); + } finally { + if ( sw != null ) { + try { + sw.close(); + } catch ( Exception ex2 ) { + } + } } } } +#if !JAVA } +#endif diff --git a/trunk/Boare.Lib.Vsq/VsqVoiceLanguage.cs b/trunk/Boare.Lib.Vsq/VsqVoiceLanguage.cs index 8916e77..60f023a 100644 --- a/trunk/Boare.Lib.Vsq/VsqVoiceLanguage.cs +++ b/trunk/Boare.Lib.Vsq/VsqVoiceLanguage.cs @@ -11,24 +11,26 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */ +#if JAVA +package org.kbinani.vsq; +#else namespace Boare.Lib.Vsq { +#endif /// /// Represents the voice language of singer. /// - public enum VsqVoiceLanguage : int { - /// - /// Default value, equivalent to "Japanese". - /// - Default = 0, + public enum VsqVoiceLanguage { /// /// Japanese /// - Japanese = 0, + Japanese, /// /// English /// - English = 1, + English, } +#if !JAVA } +#endif diff --git a/trunk/Boare.Lib.Vsq/WrappedStreamWriter.cs b/trunk/Boare.Lib.Vsq/WrappedStreamWriter.cs new file mode 100644 index 0000000..5290e2d --- /dev/null +++ b/trunk/Boare.Lib.Vsq/WrappedStreamWriter.cs @@ -0,0 +1,65 @@ +/* + * WrappedStreamWriter.cs + * Copyright (c) 2009 kbinani + * + * This file is part of Boare.Lib.Vsq. + * + * Boare.Lib.Vsq is free software; you can redistribute it and/or + * modify it under the terms of the BSD License. + * + * Boare.Lib.Vsq 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. + */ +#if JAVA +package org.kbinani.vsq; + +import java.io.*; +#else +using System; +using bocoree; +using bocoree.java.io; + +namespace Boare.Lib.Vsq { +#endif + +#if JAVA + public class WrappedStreamWriter implements ITextWriter { +#else + public class WrappedStreamWriter : ITextWriter { +#endif + BufferedWriter m_writer; + + public WrappedStreamWriter( BufferedWriter stream_writer ) { + m_writer = stream_writer; + } + + public void write( String value ) +#if JAVA + throws IOException +#endif + { + m_writer.write( value ); + } + + public void writeLine( String value ) +#if JAVA + throws IOException +#endif + { + m_writer.write( value ); + m_writer.newLine(); + } + + public void close() +#if JAVA + throws IOException +#endif + { + m_writer.close(); + } + } + +#if !JAVA +} +#endif diff --git a/trunk/Boare.Lib.Vsq/port_cpp/Boare.Lib.Vsq.sln b/trunk/Boare.Lib.Vsq/port_cpp/Boare.Lib.Vsq.sln deleted file mode 100644 index 08c9bdc..0000000 --- a/trunk/Boare.Lib.Vsq/port_cpp/Boare.Lib.Vsq.sln +++ /dev/null @@ -1,20 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 10.00 -# Visual C++ Express 2008 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Boare.Lib.Vsq", "Boare.Lib.Vsq.vcproj", "{19B6B5B7-6ADD-42D9-9F1E-426417DF4827}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Release|Win32 = Release|Win32 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {19B6B5B7-6ADD-42D9-9F1E-426417DF4827}.Debug|Win32.ActiveCfg = Debug|Win32 - {19B6B5B7-6ADD-42D9-9F1E-426417DF4827}.Debug|Win32.Build.0 = Debug|Win32 - {19B6B5B7-6ADD-42D9-9F1E-426417DF4827}.Release|Win32.ActiveCfg = Release|Win32 - {19B6B5B7-6ADD-42D9-9F1E-426417DF4827}.Release|Win32.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/trunk/Boare.Lib.Vsq/port_cpp/Boare.Lib.Vsq.vcproj b/trunk/Boare.Lib.Vsq/port_cpp/Boare.Lib.Vsq.vcproj deleted file mode 100644 index 5e24423..0000000 --- a/trunk/Boare.Lib.Vsq/port_cpp/Boare.Lib.Vsq.vcproj +++ /dev/null @@ -1,187 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/trunk/Boare.Lib.Vsq/port_cpp/cp932.cpp b/trunk/Boare.Lib.Vsq/port_cpp/cp932.cpp deleted file mode 100644 index 23903eb..0000000 --- a/trunk/Boare.Lib.Vsq/port_cpp/cp932.cpp +++ /dev/null @@ -1,9579 +0,0 @@ -/* - * cp932.cpp - * Copyright (c) 2008-2009 kbinani - * - * This file is part of utauvsti - * - * utauvsti is free software; you can redistribute it and/or - * modify it under the terms of the BSD License. - * - * utauvsti 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. - */ -#include "cp932.h" - -static bool cp932_initialized = false; -const int _LEN_DICT = 9484; -static int _DICT_SRC[_LEN_DICT][2]; -static std::map _DICT; - -void cp932_init_cor(){ - int n[_LEN_DICT][2] = { - { 0, 0 }, - { 1, 1 }, - { 2, 2 }, - { 3, 3 }, - { 4, 4 }, - { 5, 5 }, - { 6, 6 }, - { 7, 7 }, - { 8, 8 }, - { 9, 9 }, - { 10, 10 }, - { 11, 11 }, - { 12, 12 }, - { 13, 13 }, - { 14, 14 }, - { 15, 15 }, - { 16, 16 }, - { 17, 17 }, - { 18, 18 }, - { 19, 19 }, - { 20, 20 }, - { 21, 21 }, - { 22, 22 }, - { 23, 23 }, - { 24, 24 }, - { 25, 25 }, - { 26, 26 }, - { 27, 27 }, - { 28, 28 }, - { 29, 29 }, - { 30, 30 }, - { 31, 31 }, - { 32, 32 }, - { 33, 33 }, - { 34, 34 }, - { 35, 35 }, - { 36, 36 }, - { 37, 37 }, - { 38, 38 }, - { 39, 39 }, - { 40, 40 }, - { 41, 41 }, - { 42, 42 }, - { 43, 43 }, - { 44, 44 }, - { 45, 45 }, - { 46, 46 }, - { 47, 47 }, - { 48, 48 }, - { 49, 49 }, - { 50, 50 }, - { 51, 51 }, - { 52, 52 }, - { 53, 53 }, - { 54, 54 }, - { 55, 55 }, - { 56, 56 }, - { 57, 57 }, - { 58, 58 }, - { 59, 59 }, - { 60, 60 }, - { 61, 61 }, - { 62, 62 }, - { 64, 64 }, - { 65, 65 }, - { 66, 66 }, - { 67, 67 }, - { 68, 68 }, - { 69, 69 }, - { 70, 70 }, - { 71, 71 }, - { 72, 72 }, - { 73, 73 }, - { 74, 74 }, - { 75, 75 }, - { 76, 76 }, - { 77, 77 }, - { 78, 78 }, - { 79, 79 }, - { 80, 80 }, - { 81, 81 }, - { 82, 82 }, - { 83, 83 }, - { 84, 84 }, - { 85, 85 }, - { 86, 86 }, - { 87, 87 }, - { 88, 88 }, - { 89, 89 }, - { 90, 90 }, - { 91, 91 }, - { 92, 92 }, - { 93, 93 }, - { 94, 94 }, - { 95, 95 }, - { 96, 96 }, - { 97, 97 }, - { 98, 98 }, - { 99, 99 }, - { 100, 100 }, - { 101, 101 }, - { 102, 102 }, - { 103, 103 }, - { 104, 104 }, - { 105, 105 }, - { 106, 106 }, - { 107, 107 }, - { 108, 108 }, - { 109, 109 }, - { 110, 110 }, - { 111, 111 }, - { 112, 112 }, - { 113, 113 }, - { 114, 114 }, - { 115, 115 }, - { 116, 116 }, - { 117, 117 }, - { 118, 118 }, - { 119, 119 }, - { 120, 120 }, - { 121, 121 }, - { 122, 122 }, - { 123, 123 }, - { 124, 124 }, - { 125, 125 }, - { 126, 126 }, - { 127, 127 }, - { 128, 128 }, - { 161, 33 }, - { 162, 33169 }, - { 163, 33170 }, - { 165, 92 }, - { 166, 124 }, - { 167, 33176 }, - { 168, 33102 }, - { 169, 99 }, - { 170, 97 }, - { 171, 33249 }, - { 172, 33226 }, - { 173, 45 }, - { 174, 82 }, - { 175, 33104 }, - { 176, 33163 }, - { 177, 33149 }, - { 178, 50 }, - { 179, 51 }, - { 180, 33100 }, - { 181, 33738 }, - { 182, 33271 }, - { 183, 33093 }, - { 184, 33091 }, - { 185, 49 }, - { 186, 111 }, - { 187, 33250 }, - { 192, 65 }, - { 193, 65 }, - { 194, 65 }, - { 195, 65 }, - { 196, 65 }, - { 197, 65 }, - { 198, 65 }, - { 199, 67 }, - { 200, 69 }, - { 201, 69 }, - { 202, 69 }, - { 203, 69 }, - { 204, 73 }, - { 205, 73 }, - { 206, 73 }, - { 207, 73 }, - { 208, 68 }, - { 209, 78 }, - { 210, 79 }, - { 211, 79 }, - { 212, 79 }, - { 213, 79 }, - { 214, 79 }, - { 215, 33150 }, - { 216, 79 }, - { 217, 85 }, - { 218, 85 }, - { 219, 85 }, - { 220, 85 }, - { 221, 89 }, - { 222, 84 }, - { 223, 115 }, - { 224, 97 }, - { 225, 97 }, - { 226, 97 }, - { 227, 97 }, - { 228, 97 }, - { 229, 97 }, - { 230, 97 }, - { 231, 99 }, - { 232, 101 }, - { 233, 101 }, - { 234, 101 }, - { 235, 101 }, - { 236, 105 }, - { 237, 105 }, - { 238, 105 }, - { 239, 105 }, - { 240, 100 }, - { 241, 110 }, - { 242, 111 }, - { 243, 111 }, - { 244, 111 }, - { 245, 111 }, - { 246, 111 }, - { 247, 33152 }, - { 248, 111 }, - { 249, 117 }, - { 250, 117 }, - { 251, 117 }, - { 252, 117 }, - { 253, 121 }, - { 254, 116 }, - { 255, 121 }, - { 913, 33695 }, - { 914, 33696 }, - { 915, 33697 }, - { 916, 33698 }, - { 917, 33699 }, - { 918, 33700 }, - { 919, 33701 }, - { 920, 33702 }, - { 921, 33703 }, - { 922, 33704 }, - { 923, 33705 }, - { 924, 33706 }, - { 925, 33707 }, - { 926, 33708 }, - { 927, 33709 }, - { 928, 33710 }, - { 929, 33711 }, - { 931, 33712 }, - { 932, 33713 }, - { 933, 33714 }, - { 934, 33715 }, - { 935, 33716 }, - { 936, 33717 }, - { 937, 33718 }, - { 945, 33727 }, - { 946, 33728 }, - { 947, 33729 }, - { 948, 33730 }, - { 949, 33731 }, - { 950, 33732 }, - { 951, 33733 }, - { 952, 33734 }, - { 953, 33735 }, - { 954, 33736 }, - { 955, 33737 }, - { 956, 33738 }, - { 957, 33739 }, - { 958, 33740 }, - { 959, 33741 }, - { 960, 33742 }, - { 961, 33743 }, - { 963, 33744 }, - { 964, 33745 }, - { 965, 33746 }, - { 966, 33747 }, - { 967, 33748 }, - { 968, 33749 }, - { 969, 33750 }, - { 1025, 33862 }, - { 1040, 33856 }, - { 1041, 33857 }, - { 1042, 33858 }, - { 1043, 33859 }, - { 1044, 33860 }, - { 1045, 33861 }, - { 1046, 33863 }, - { 1047, 33864 }, - { 1048, 33865 }, - { 1049, 33866 }, - { 1050, 33867 }, - { 1051, 33868 }, - { 1052, 33869 }, - { 1053, 33870 }, - { 1054, 33871 }, - { 1055, 33872 }, - { 1056, 33873 }, - { 1057, 33874 }, - { 1058, 33875 }, - { 1059, 33876 }, - { 1060, 33877 }, - { 1061, 33878 }, - { 1062, 33879 }, - { 1063, 33880 }, - { 1064, 33881 }, - { 1065, 33882 }, - { 1066, 33883 }, - { 1067, 33884 }, - { 1068, 33885 }, - { 1069, 33886 }, - { 1070, 33887 }, - { 1071, 33888 }, - { 1072, 33904 }, - { 1073, 33905 }, - { 1074, 33906 }, - { 1075, 33907 }, - { 1076, 33908 }, - { 1077, 33909 }, - { 1078, 33911 }, - { 1079, 33912 }, - { 1080, 33913 }, - { 1081, 33914 }, - { 1082, 33915 }, - { 1083, 33916 }, - { 1084, 33917 }, - { 1085, 33918 }, - { 1086, 33920 }, - { 1087, 33921 }, - { 1088, 33922 }, - { 1089, 33923 }, - { 1090, 33924 }, - { 1091, 33925 }, - { 1092, 33926 }, - { 1093, 33927 }, - { 1094, 33928 }, - { 1095, 33929 }, - { 1096, 33930 }, - { 1097, 33931 }, - { 1098, 33932 }, - { 1099, 33933 }, - { 1100, 33934 }, - { 1101, 33935 }, - { 1102, 33936 }, - { 1103, 33937 }, - { 1105, 33910 }, - { 8208, 33117 }, - { 8213, 33116 }, - { 8216, 33125 }, - { 8217, 33126 }, - { 8220, 33127 }, - { 8221, 33128 }, - { 8224, 33269 }, - { 8225, 33270 }, - { 8229, 33124 }, - { 8230, 33123 }, - { 8240, 33265 }, - { 8242, 33164 }, - { 8243, 33165 }, - { 8251, 33190 }, - { 8451, 33166 }, - { 8470, 34690 }, - { 8481, 34692 }, - { 8491, 33264 }, - { 8544, 34644 }, - { 8545, 34645 }, - { 8546, 34646 }, - { 8547, 34647 }, - { 8548, 34648 }, - { 8549, 34649 }, - { 8550, 34650 }, - { 8551, 34651 }, - { 8552, 34652 }, - { 8553, 34653 }, - { 8560, 64064 }, - { 8561, 64065 }, - { 8562, 64066 }, - { 8563, 64067 }, - { 8564, 64068 }, - { 8565, 64069 }, - { 8566, 64070 }, - { 8567, 64071 }, - { 8568, 64072 }, - { 8569, 64073 }, - { 8592, 33193 }, - { 8593, 33194 }, - { 8594, 33192 }, - { 8595, 33195 }, - { 8658, 33227 }, - { 8660, 33228 }, - { 8704, 33229 }, - { 8706, 33245 }, - { 8707, 33230 }, - { 8711, 33246 }, - { 8712, 33208 }, - { 8715, 33209 }, - { 8721, 34708 }, - { 8730, 33251 }, - { 8733, 33253 }, - { 8734, 33159 }, - { 8735, 34712 }, - { 8736, 33242 }, - { 8741, 33121 }, - { 8743, 33224 }, - { 8744, 33225 }, - { 8745, 33215 }, - { 8746, 33214 }, - { 8747, 33255 }, - { 8748, 33256 }, - { 8750, 34707 }, - { 8756, 33160 }, - { 8757, 33254 }, - { 8765, 33252 }, - { 8786, 33248 }, - { 8800, 33154 }, - { 8801, 33247 }, - { 8806, 33157 }, - { 8807, 33158 }, - { 8810, 33249 }, - { 8811, 33250 }, - { 8834, 33212 }, - { 8835, 33213 }, - { 8838, 33210 }, - { 8839, 33211 }, - { 8869, 33243 }, - { 8895, 34713 }, - { 8978, 33244 }, - { 9312, 34624 }, - { 9313, 34625 }, - { 9314, 34626 }, - { 9315, 34627 }, - { 9316, 34628 }, - { 9317, 34629 }, - { 9318, 34630 }, - { 9319, 34631 }, - { 9320, 34632 }, - { 9321, 34633 }, - { 9322, 34634 }, - { 9323, 34635 }, - { 9324, 34636 }, - { 9325, 34637 }, - { 9326, 34638 }, - { 9327, 34639 }, - { 9328, 34640 }, - { 9329, 34641 }, - { 9330, 34642 }, - { 9331, 34643 }, - { 9472, 33951 }, - { 9473, 33962 }, - { 9474, 33952 }, - { 9475, 33963 }, - { 9484, 33953 }, - { 9487, 33964 }, - { 9488, 33954 }, - { 9491, 33965 }, - { 9492, 33956 }, - { 9495, 33967 }, - { 9496, 33955 }, - { 9499, 33966 }, - { 9500, 33957 }, - { 9501, 33978 }, - { 9504, 33973 }, - { 9507, 33968 }, - { 9508, 33959 }, - { 9509, 33980 }, - { 9512, 33975 }, - { 9515, 33970 }, - { 9516, 33958 }, - { 9519, 33974 }, - { 9520, 33979 }, - { 9523, 33969 }, - { 9524, 33960 }, - { 9527, 33976 }, - { 9528, 33981 }, - { 9531, 33971 }, - { 9532, 33961 }, - { 9535, 33977 }, - { 9538, 33982 }, - { 9547, 33972 }, - { 9632, 33185 }, - { 9633, 33184 }, - { 9650, 33187 }, - { 9651, 33186 }, - { 9660, 33189 }, - { 9661, 33188 }, - { 9670, 33183 }, - { 9671, 33182 }, - { 9675, 33179 }, - { 9678, 33181 }, - { 9679, 33180 }, - { 9711, 33276 }, - { 9733, 33178 }, - { 9734, 33177 }, - { 9792, 33162 }, - { 9794, 33161 }, - { 9834, 33268 }, - { 9837, 33267 }, - { 9839, 33266 }, - { 12288, 33088 }, - { 12289, 33089 }, - { 12290, 33090 }, - { 12291, 33110 }, - { 12293, 33112 }, - { 12294, 33113 }, - { 12295, 33114 }, - { 12296, 33137 }, - { 12297, 33138 }, - { 12298, 33139 }, - { 12299, 33140 }, - { 12300, 33141 }, - { 12301, 33142 }, - { 12302, 33143 }, - { 12303, 33144 }, - { 12304, 33145 }, - { 12305, 33146 }, - { 12306, 33191 }, - { 12307, 33196 }, - { 12308, 33131 }, - { 12309, 33132 }, - { 12317, 34688 }, - { 12319, 34689 }, - { 12353, 33439 }, - { 12354, 33440 }, - { 12355, 33441 }, - { 12356, 33442 }, - { 12357, 33443 }, - { 12358, 33444 }, - { 12359, 33445 }, - { 12360, 33446 }, - { 12361, 33447 }, - { 12362, 33448 }, - { 12363, 33449 }, - { 12364, 33450 }, - { 12365, 33451 }, - { 12366, 33452 }, - { 12367, 33453 }, - { 12368, 33454 }, - { 12369, 33455 }, - { 12370, 33456 }, - { 12371, 33457 }, - { 12372, 33458 }, - { 12373, 33459 }, - { 12374, 33460 }, - { 12375, 33461 }, - { 12376, 33462 }, - { 12377, 33463 }, - { 12378, 33464 }, - { 12379, 33465 }, - { 12380, 33466 }, - { 12381, 33467 }, - { 12382, 33468 }, - { 12383, 33469 }, - { 12384, 33470 }, - { 12385, 33471 }, - { 12386, 33472 }, - { 12387, 33473 }, - { 12388, 33474 }, - { 12389, 33475 }, - { 12390, 33476 }, - { 12391, 33477 }, - { 12392, 33478 }, - { 12393, 33479 }, - { 12394, 33480 }, - { 12395, 33481 }, - { 12396, 33482 }, - { 12397, 33483 }, - { 12398, 33484 }, - { 12399, 33485 }, - { 12400, 33486 }, - { 12401, 33487 }, - { 12402, 33488 }, - { 12403, 33489 }, - { 12404, 33490 }, - { 12405, 33491 }, - { 12406, 33492 }, - { 12407, 33493 }, - { 12408, 33494 }, - { 12409, 33495 }, - { 12410, 33496 }, - { 12411, 33497 }, - { 12412, 33498 }, - { 12413, 33499 }, - { 12414, 33500 }, - { 12415, 33501 }, - { 12416, 33502 }, - { 12417, 33503 }, - { 12418, 33504 }, - { 12419, 33505 }, - { 12420, 33506 }, - { 12421, 33507 }, - { 12422, 33508 }, - { 12423, 33509 }, - { 12424, 33510 }, - { 12425, 33511 }, - { 12426, 33512 }, - { 12427, 33513 }, - { 12428, 33514 }, - { 12429, 33515 }, - { 12430, 33516 }, - { 12431, 33517 }, - { 12432, 33518 }, - { 12433, 33519 }, - { 12434, 33520 }, - { 12435, 33521 }, - { 12436, 33684 }, - { 12443, 33098 }, - { 12444, 33099 }, - { 12445, 33108 }, - { 12446, 33109 }, - { 12449, 33600 }, - { 12450, 33601 }, - { 12451, 33602 }, - { 12452, 33603 }, - { 12453, 33604 }, - { 12454, 33605 }, - { 12455, 33606 }, - { 12456, 33607 }, - { 12457, 33608 }, - { 12458, 33609 }, - { 12459, 33610 }, - { 12460, 33611 }, - { 12461, 33612 }, - { 12462, 33613 }, - { 12463, 33614 }, - { 12464, 33615 }, - { 12465, 33616 }, - { 12466, 33617 }, - { 12467, 33618 }, - { 12468, 33619 }, - { 12469, 33620 }, - { 12470, 33621 }, - { 12471, 33622 }, - { 12472, 33623 }, - { 12473, 33624 }, - { 12474, 33625 }, - { 12475, 33626 }, - { 12476, 33627 }, - { 12477, 33628 }, - { 12478, 33629 }, - { 12479, 33630 }, - { 12480, 33631 }, - { 12481, 33632 }, - { 12482, 33633 }, - { 12483, 33634 }, - { 12484, 33635 }, - { 12485, 33636 }, - { 12486, 33637 }, - { 12487, 33638 }, - { 12488, 33639 }, - { 12489, 33640 }, - { 12490, 33641 }, - { 12491, 33642 }, - { 12492, 33643 }, - { 12493, 33644 }, - { 12494, 33645 }, - { 12495, 33646 }, - { 12496, 33647 }, - { 12497, 33648 }, - { 12498, 33649 }, - { 12499, 33650 }, - { 12500, 33651 }, - { 12501, 33652 }, - { 12502, 33653 }, - { 12503, 33654 }, - { 12504, 33655 }, - { 12505, 33656 }, - { 12506, 33657 }, - { 12507, 33658 }, - { 12508, 33659 }, - { 12509, 33660 }, - { 12510, 33661 }, - { 12511, 33662 }, - { 12512, 33664 }, - { 12513, 33665 }, - { 12514, 33666 }, - { 12515, 33667 }, - { 12516, 33668 }, - { 12517, 33669 }, - { 12518, 33670 }, - { 12519, 33671 }, - { 12520, 33672 }, - { 12521, 33673 }, - { 12522, 33674 }, - { 12523, 33675 }, - { 12524, 33676 }, - { 12525, 33677 }, - { 12526, 33678 }, - { 12527, 33679 }, - { 12528, 33680 }, - { 12529, 33681 }, - { 12530, 33682 }, - { 12531, 33683 }, - { 12532, 33684 }, - { 12533, 33685 }, - { 12534, 33686 }, - { 12539, 33093 }, - { 12540, 33115 }, - { 12541, 33106 }, - { 12542, 33107 }, - { 12849, 34698 }, - { 12850, 34699 }, - { 12857, 34700 }, - { 12964, 34693 }, - { 12965, 34694 }, - { 12966, 34695 }, - { 12967, 34696 }, - { 12968, 34697 }, - { 13059, 34661 }, - { 13069, 34665 }, - { 13076, 34656 }, - { 13080, 34659 }, - { 13090, 34657 }, - { 13091, 34667 }, - { 13094, 34666 }, - { 13095, 34660 }, - { 13099, 34668 }, - { 13110, 34662 }, - { 13115, 34670 }, - { 13129, 34655 }, - { 13130, 34669 }, - { 13133, 34658 }, - { 13137, 34663 }, - { 13143, 34664 }, - { 13179, 34686 }, - { 13180, 34703 }, - { 13181, 34702 }, - { 13182, 34701 }, - { 13198, 34674 }, - { 13199, 34675 }, - { 13212, 34671 }, - { 13213, 34672 }, - { 13214, 34673 }, - { 13217, 34677 }, - { 13252, 34676 }, - { 13261, 34691 }, - { 19968, 35050 }, - { 19969, 37530 }, - { 19971, 36533 }, - { 19975, 38556 }, - { 19976, 36836 }, - { 19977, 36431 }, - { 19978, 36835 }, - { 19979, 35258 }, - { 19981, 38259 }, - { 19982, 38750 }, - { 19984, 39072 }, - { 19985, 35150 }, - { 19988, 35470 }, - { 19989, 39073 }, - { 19990, 37026 }, - { 19991, 39360 }, - { 19992, 35701 }, - { 19993, 38328 }, - { 19998, 36837 }, - { 20001, 38844 }, - { 20006, 38336 }, - { 20008, 64104 }, - { 20010, 39074 }, - { 20013, 37510 }, - { 20017, 39075 }, - { 20018, 35832 }, - { 20022, 39076 }, - { 20024, 35547 }, - { 20025, 37455 }, - { 20027, 36581 }, - { 20028, 39077 }, - { 20031, 39078 }, - { 20034, 39079 }, - { 20035, 37972 }, - { 20037, 35702 }, - { 20043, 37974 }, - { 20045, 37857 }, - { 20046, 36033 }, - { 20047, 38482 }, - { 20053, 58728 }, - { 20054, 39080 }, - { 20055, 36838 }, - { 20056, 39081 }, - { 20057, 35251 }, - { 20061, 35811 }, - { 20062, 36078 }, - { 20063, 38631 }, - { 20066, 39844 }, - { 20081, 38800 }, - { 20083, 37883 }, - { 20094, 35491 }, - { 20096, 35668 }, - { 20098, 39082 }, - { 20101, 39083 }, - { 20102, 38841 }, - { 20104, 38748 }, - { 20105, 37256 }, - { 20106, 39085 }, - { 20107, 36502 }, - { 20108, 37873 }, - { 20110, 39088 }, - { 20113, 35165 }, - { 20114, 36061 }, - { 20116, 36060 }, - { 20117, 35044 }, - { 20120, 39018 }, - { 20121, 39017 }, - { 20123, 36273 }, - { 20124, 34975 }, - { 20126, 39089 }, - { 20127, 39090 }, - { 20128, 39091 }, - { 20129, 38483 }, - { 20130, 39092 }, - { 20132, 36080 }, - { 20133, 35045 }, - { 20134, 38546 }, - { 20136, 35740 }, - { 20139, 35741 }, - { 20140, 35742 }, - { 20141, 37600 }, - { 20142, 38842 }, - { 20144, 39093 }, - { 20147, 39094 }, - { 20150, 39095 }, - { 20154, 36972 }, - { 20160, 36697 }, - { 20161, 36973 }, - { 20162, 39100 }, - { 20164, 39098 }, - { 20166, 39099 }, - { 20167, 35703 }, - { 20170, 36257 }, - { 20171, 35310 }, - { 20173, 39097 }, - { 20174, 39096 }, - { 20175, 38311 }, - { 20180, 36453 }, - { 20181, 36452 }, - { 20182, 37308 }, - { 20183, 39101 }, - { 20184, 38260 }, - { 20185, 37093 }, - { 20189, 33111 }, - { 20190, 39102 }, - { 20191, 39104 }, - { 20193, 64105 }, - { 20195, 37347 }, - { 20196, 38879 }, - { 20197, 35016 }, - { 20205, 39103 }, - { 20206, 35260 }, - { 20208, 35778 }, - { 20210, 37511 }, - { 20214, 35983 }, - { 20215, 39105 }, - { 20219, 37955 }, - { 20220, 64106 }, - { 20224, 64107 }, - { 20225, 35561 }, - { 20227, 64108 }, - { 20233, 39106 }, - { 20234, 35017 }, - { 20237, 36062 }, - { 20238, 35562 }, - { 20239, 38298 }, - { 20240, 38064 }, - { 20241, 35704 }, - { 20250, 35311 }, - { 20252, 39141 }, - { 20253, 37728 }, - { 20271, 38028 }, - { 20272, 39108 }, - { 20276, 38074 }, - { 20278, 38880 }, - { 20280, 36940 }, - { 20281, 64109 }, - { 20282, 36454 }, - { 20284, 36503 }, - { 20285, 35262 }, - { 20291, 37583 }, - { 20294, 37441 }, - { 20295, 39112 }, - { 20301, 35018 }, - { 20302, 37601 }, - { 20303, 36698 }, - { 20304, 36274 }, - { 20305, 38723 }, - { 20307, 37324 }, - { 20309, 35261 }, - { 20310, 64110 }, - { 20311, 39111 }, - { 20313, 38749 }, - { 20314, 39107 }, - { 20315, 39109 }, - { 20316, 36332 }, - { 20317, 39110 }, - { 20318, 39747 }, - { 20329, 39118 }, - { 20335, 39121 }, - { 20336, 39119 }, - { 20339, 35264 }, - { 20341, 38329 }, - { 20342, 39113 }, - { 20347, 39117 }, - { 20348, 36081 }, - { 20351, 36455 }, - { 20355, 35492 }, - { 20358, 39122 }, - { 20360, 39114 }, - { 20362, 64112 }, - { 20363, 38881 }, - { 20365, 36504 }, - { 20367, 39115 }, - { 20369, 39120 }, - { 20370, 64111 }, - { 20372, 64114 }, - { 20374, 39123 }, - { 20376, 39116 }, - { 20378, 64113 }, - { 20379, 35743 }, - { 20381, 35019 }, - { 20384, 35744 }, - { 20385, 35263 }, - { 20395, 39748 }, - { 20397, 38553 }, - { 20398, 38286 }, - { 20399, 36082 }, - { 20405, 36942 }, - { 20406, 38837 }, - { 20415, 38358 }, - { 20418, 35927 }, - { 20419, 37283 }, - { 20420, 35298 }, - { 20425, 64097 }, - { 20426, 36722 }, - { 20429, 64115 }, - { 20430, 39127 }, - { 20432, 39132 }, - { 20433, 39130 }, - { 20436, 39125 }, - { 20439, 37293 }, - { 20440, 39128 }, - { 20442, 39131 }, - { 20443, 39129 }, - { 20445, 38363 }, - { 20447, 39126 }, - { 20449, 36941 }, - { 20451, 38547 }, - { 20452, 39133 }, - { 20453, 39134 }, - { 20462, 36675 }, - { 20463, 39147 }, - { 20467, 37999 }, - { 20469, 38229 }, - { 20470, 39142 }, - { 20472, 38382 }, - { 20474, 35252 }, - { 20478, 39146 }, - { 20479, 64118 }, - { 20485, 39140 }, - { 20486, 39149 }, - { 20489, 37233 }, - { 20491, 36034 }, - { 20493, 38011 }, - { 20495, 57541 }, - { 20497, 39148 }, - { 20498, 37756 }, - { 20500, 39137 }, - { 20502, 36084 }, - { 20505, 36083 }, - { 20506, 39135 }, - { 20510, 64119 }, - { 20511, 36568 }, - { 20513, 39143 }, - { 20514, 64117 }, - { 20515, 38381 }, - { 20516, 37484 }, - { 20517, 39139 }, - { 20518, 35985 }, - { 20520, 39136 }, - { 20521, 39144 }, - { 20522, 39138 }, - { 20523, 38863 }, - { 20524, 39145 }, - { 20525, 39008 }, - { 20534, 35812 }, - { 20537, 35984 }, - { 20544, 64116 }, - { 20546, 64122 }, - { 20547, 39150 }, - { 20550, 64120 }, - { 20551, 39151 }, - { 20552, 39155 }, - { 20553, 35020 }, - { 20559, 38350 }, - { 20560, 39154 }, - { 20565, 39153 }, - { 20566, 39157 }, - { 20570, 39156 }, - { 20572, 37602 }, - { 20581, 35986 }, - { 20588, 39158 }, - { 20592, 64121 }, - { 20594, 36547 }, - { 20596, 37284 }, - { 20597, 37603 }, - { 20598, 35828 }, - { 20600, 39159 }, - { 20605, 35669 }, - { 20608, 39160 }, - { 20613, 39162 }, - { 20621, 38484 }, - { 20625, 35974 }, - { 20628, 64123 }, - { 20632, 36432 }, - { 20633, 38133 }, - { 20634, 39161 }, - { 20652, 36291 }, - { 20653, 38754 }, - { 20658, 39164 }, - { 20659, 39234 }, - { 20660, 39163 }, - { 20661, 36290 }, - { 20663, 36765 }, - { 20670, 35928 }, - { 20674, 39235 }, - { 20677, 35789 }, - { 20681, 39232 }, - { 20682, 39233 }, - { 20685, 37805 }, - { 20687, 37276 }, - { 20689, 35745 }, - { 20693, 38508 }, - { 20694, 39236 }, - { 20696, 64125 }, - { 20698, 38843 }, - { 20702, 39237 }, - { 20707, 39240 }, - { 20709, 39238 }, - { 20711, 37229 }, - { 20717, 39239 }, - { 20718, 39241 }, - { 20724, 64124 }, - { 20725, 39243 }, - { 20729, 39242 }, - { 20731, 38342 }, - { 20736, 35670 }, - { 20737, 39245 }, - { 20738, 39246 }, - { 20740, 35245 }, - { 20745, 39244 }, - { 20754, 36594 }, - { 20756, 39249 }, - { 20757, 39248 }, - { 20758, 39247 }, - { 20760, 39124 }, - { 20762, 39250 }, - { 20767, 36766 }, - { 20769, 39251 }, - { 20778, 38724 }, - { 20786, 38615 }, - { 20791, 39253 }, - { 20794, 39252 }, - { 20795, 39255 }, - { 20796, 39254 }, - { 20799, 39256 }, - { 20800, 39257 }, - { 20801, 35058 }, - { 20803, 36019 }, - { 20804, 35930 }, - { 20805, 36699 }, - { 20806, 37531 }, - { 20807, 35746 }, - { 20808, 37094 }, - { 20809, 36085 }, - { 20810, 64126 }, - { 20811, 36238 }, - { 20812, 39259 }, - { 20813, 38598 }, - { 20814, 37733 }, - { 20816, 36505 }, - { 20818, 39258 }, - { 20820, 39260 }, - { 20826, 37757 }, - { 20828, 35477 }, - { 20834, 39261 }, - { 20836, 64128 }, - { 20837, 37884 }, - { 20840, 37203 }, - { 20841, 39263 }, - { 20842, 39264 }, - { 20843, 38058 }, - { 20844, 36086 }, - { 20845, 39002 }, - { 20846, 39265 }, - { 20849, 35748 }, - { 20853, 38330 }, - { 20854, 37300 }, - { 20855, 35823 }, - { 20856, 37716 }, - { 20860, 35987 }, - { 20864, 39266 }, - { 20866, 39267 }, - { 20869, 37856 }, - { 20870, 35198 }, - { 20873, 39270 }, - { 20874, 36347 }, - { 20876, 39269 }, - { 20877, 36292 }, - { 20879, 39271 }, - { 20880, 58348 }, - { 20881, 39272 }, - { 20882, 38496 }, - { 20883, 39273 }, - { 20885, 39274 }, - { 20886, 39275 }, - { 20887, 36839 }, - { 20889, 36554 }, - { 20893, 64129 }, - { 20896, 35493 }, - { 20898, 39278 }, - { 20900, 39276 }, - { 20901, 38587 }, - { 20902, 39277 }, - { 20904, 38265 }, - { 20905, 39279 }, - { 20906, 39280 }, - { 20907, 39281 }, - { 20908, 37758 }, - { 20912, 39285 }, - { 20913, 39283 }, - { 20914, 39284 }, - { 20915, 39282 }, - { 20916, 36321 }, - { 20917, 39286 }, - { 20918, 38632 }, - { 20919, 38882 }, - { 20925, 39287 }, - { 20926, 64130 }, - { 20932, 37030 }, - { 20933, 39288 }, - { 20934, 36729 }, - { 20937, 39289 }, - { 20939, 37532 }, - { 20940, 38845 }, - { 20941, 37760 }, - { 20950, 39363 }, - { 20955, 39290 }, - { 20956, 60067 }, - { 20957, 35779 }, - { 20960, 39291 }, - { 20961, 38525 }, - { 20966, 36744 }, - { 20967, 37370 }, - { 20969, 39293 }, - { 20970, 37858 }, - { 20972, 64131 }, - { 20973, 39294 }, - { 20976, 39296 }, - { 20977, 35405 }, - { 20981, 39297 }, - { 20982, 35749 }, - { 20984, 37834 }, - { 20985, 35226 }, - { 20986, 36719 }, - { 20989, 38047 }, - { 20990, 39298 }, - { 20992, 37761 }, - { 20995, 36974 }, - { 20996, 39299 }, - { 20998, 38314 }, - { 20999, 37080 }, - { 21000, 35488 }, - { 21002, 35495 }, - { 21003, 39300 }, - { 21006, 39302 }, - { 21009, 35929 }, - { 21012, 39301 }, - { 21013, 64132 }, - { 21015, 38897 }, - { 21021, 36745 }, - { 21028, 38075 }, - { 21029, 38346 }, - { 21031, 39303 }, - { 21033, 38808 }, - { 21034, 39304 }, - { 21038, 39305 }, - { 21040, 37790 }, - { 21043, 39306 }, - { 21046, 37031 }, - { 21047, 36348 }, - { 21048, 35988 }, - { 21049, 39307 }, - { 21050, 36456 }, - { 21051, 36239 }, - { 21059, 37604 }, - { 21060, 39309 }, - { 21063, 37285 }, - { 21066, 36333 }, - { 21067, 39310 }, - { 21068, 39311 }, - { 21069, 37199 }, - { 21071, 39308 }, - { 21076, 39313 }, - { 21078, 38485 }, - { 21083, 36228 }, - { 21086, 39312 }, - { 21091, 35989 }, - { 21092, 36316 }, - { 21093, 38029 }, - { 21097, 39316 }, - { 21098, 39314 }, - { 21103, 38299 }, - { 21104, 36840 }, - { 21105, 39323 }, - { 21106, 35460 }, - { 21107, 39317 }, - { 21108, 39315 }, - { 21109, 37230 }, - { 21117, 39319 }, - { 21119, 39318 }, - { 21123, 35427 }, - { 21127, 35968 }, - { 21128, 39324 }, - { 21129, 38827 }, - { 21133, 39320 }, - { 21137, 39325 }, - { 21138, 39322 }, - { 21140, 39321 }, - { 21147, 38861 }, - { 21148, 64133 }, - { 21151, 36087 }, - { 21152, 35265 }, - { 21155, 38898 }, - { 21158, 64134 }, - { 21161, 36757 }, - { 21162, 37751 }, - { 21163, 36229 }, - { 21164, 39328 }, - { 21165, 39329 }, - { 21167, 64375 }, - { 21169, 38883 }, - { 21172, 38986 }, - { 21173, 39331 }, - { 21177, 36088 }, - { 21180, 39330 }, - { 21182, 35406 }, - { 21184, 64135 }, - { 21185, 39332 }, - { 21187, 38517 }, - { 21189, 37562 }, - { 21191, 38725 }, - { 21193, 38359 }, - { 21197, 39333 }, - { 21202, 59603 }, - { 21205, 37806 }, - { 21207, 39334 }, - { 21208, 35496 }, - { 21209, 38577 }, - { 21211, 64136 }, - { 21213, 36767 }, - { 21214, 39335 }, - { 21215, 38373 }, - { 21216, 39339 }, - { 21218, 37032 }, - { 21219, 39336 }, - { 21220, 35790 }, - { 21222, 39337 }, - { 21223, 35497 }, - { 21234, 35917 }, - { 21235, 39340 }, - { 21237, 39341 }, - { 21240, 39342 }, - { 21241, 39343 }, - { 21242, 36569 }, - { 21246, 36089 }, - { 21247, 38620 }, - { 21248, 64137 }, - { 21249, 38630 }, - { 21250, 37877 }, - { 21253, 38383 }, - { 21254, 39344 }, - { 21255, 64138 }, - { 21256, 39345 }, - { 21261, 39347 }, - { 21263, 39349 }, - { 21264, 39348 }, - { 21269, 39350 }, - { 21270, 35259 }, - { 21271, 38507 }, - { 21273, 36346 }, - { 21274, 39351 }, - { 21277, 37240 }, - { 21280, 36768 }, - { 21281, 35751 }, - { 21283, 39352 }, - { 21284, 64139 }, - { 21290, 38105 }, - { 21295, 39353 }, - { 21297, 39354 }, - { 21299, 39355 }, - { 21304, 39356 }, - { 21305, 38211 }, - { 21306, 35814 }, - { 21307, 35043 }, - { 21311, 37821 }, - { 21312, 39357 }, - { 21313, 36700 }, - { 21315, 37095 }, - { 21317, 39359 }, - { 21318, 39358 }, - { 21319, 36769 }, - { 21320, 36063 }, - { 21321, 39361 }, - { 21322, 38076 }, - { 21325, 39362 }, - { 21329, 38106 }, - { 21330, 37298 }, - { 21331, 37356 }, - { 21332, 35750 }, - { 21335, 37868 }, - { 21336, 37456 }, - { 21338, 38030 }, - { 21340, 38509 }, - { 21342, 39364 }, - { 21344, 37096 }, - { 21350, 35924 }, - { 21353, 39365 }, - { 21358, 39366 }, - { 21359, 35147 }, - { 21360, 35059 }, - { 21361, 35563 }, - { 21362, 64140 }, - { 21363, 37286 }, - { 21364, 35696 }, - { 21365, 38801 }, - { 21367, 39369 }, - { 21368, 35253 }, - { 21371, 39368 }, - { 21375, 35752 }, - { 21378, 39370 }, - { 21380, 38639 }, - { 21395, 64141 }, - { 21398, 39371 }, - { 21400, 38864 }, - { 21402, 36090 }, - { 21407, 36020 }, - { 21408, 39372 }, - { 21413, 39374 }, - { 21414, 39373 }, - { 21416, 36990 }, - { 21417, 35160 }, - { 21421, 35197 }, - { 21422, 39375 }, - { 21424, 39376 }, - { 21426, 64142 }, - { 21427, 36021 }, - { 21430, 39377 }, - { 21435, 35726 }, - { 21442, 36433 }, - { 21443, 39378 }, - { 21448, 38548 }, - { 21449, 36275 }, - { 21450, 35705 }, - { 21451, 38726 }, - { 21452, 37231 }, - { 21453, 38077 }, - { 21454, 36603 }, - { 21460, 36710 }, - { 21462, 36582 }, - { 21463, 36595 }, - { 21465, 36758 }, - { 21467, 38078 }, - { 21469, 64143 }, - { 21471, 39381 }, - { 21473, 35170 }, - { 21474, 37232 }, - { 21475, 36091 }, - { 21476, 36035 }, - { 21477, 35813 }, - { 21480, 39385 }, - { 21481, 37440 }, - { 21482, 37372 }, - { 21483, 35753 }, - { 21484, 36770 }, - { 21485, 39386 }, - { 21486, 39384 }, - { 21487, 35266 }, - { 21488, 37348 }, - { 21489, 36534 }, - { 21490, 36458 }, - { 21491, 35141 }, - { 21494, 35472 }, - { 21495, 36230 }, - { 21496, 36457 }, - { 21498, 39387 }, - { 21505, 39388 }, - { 21507, 35688 }, - { 21508, 35429 }, - { 21512, 36231 }, - { 21513, 35687 }, - { 21514, 37597 }, - { 21515, 35140 }, - { 21516, 37807 }, - { 21517, 38588 }, - { 21518, 36160 }, - { 21519, 38809 }, - { 21520, 37734 }, - { 21521, 36092 }, - { 21531, 35918 }, - { 21533, 39397 }, - { 21535, 35809 }, - { 21536, 38505 }, - { 21542, 38107 }, - { 21545, 39396 }, - { 21547, 35548 }, - { 21548, 39391 }, - { 21549, 39392 }, - { 21550, 39394 }, - { 21558, 39395 }, - { 21560, 35706 }, - { 21561, 36993 }, - { 21563, 38315 }, - { 21564, 39393 }, - { 21565, 39389 }, - { 21566, 36065 }, - { 21568, 39390 }, - { 21570, 38979 }, - { 21574, 38384 }, - { 21576, 37606 }, - { 21577, 36064 }, - { 21578, 36240 }, - { 21582, 39398 }, - { 21585, 37851 }, - { 21599, 39402 }, - { 21608, 36604 }, - { 21610, 36596 }, - { 21616, 39405 }, - { 21617, 39403 }, - { 21619, 38561 }, - { 21621, 39400 }, - { 21622, 39409 }, - { 21623, 39404 }, - { 21627, 39407 }, - { 21628, 36036 }, - { 21629, 38589 }, - { 21632, 39408 }, - { 21636, 39410 }, - { 21638, 39412 }, - { 21642, 64146 }, - { 21643, 36334 }, - { 21644, 39009 }, - { 21646, 39401 }, - { 21647, 39399 }, - { 21648, 39411 }, - { 21650, 39406 }, - { 21660, 64145 }, - { 21666, 39414 }, - { 21668, 39490 }, - { 21669, 39416 }, - { 21672, 39420 }, - { 21673, 64147 }, - { 21675, 39488 }, - { 21676, 39417 }, - { 21679, 39517 }, - { 21682, 36327 }, - { 21683, 35408 }, - { 21688, 39415 }, - { 21692, 39492 }, - { 21693, 35060 }, - { 21694, 39491 }, - { 21696, 34979 }, - { 21697, 38249 }, - { 21698, 39489 }, - { 21700, 39418 }, - { 21703, 39413 }, - { 21704, 39419 }, - { 21705, 36294 }, - { 21720, 39493 }, - { 21729, 35061 }, - { 21730, 39502 }, - { 21733, 39494 }, - { 21734, 39495 }, - { 21736, 36771 }, - { 21737, 38537 }, - { 21741, 39500 }, - { 21742, 39499 }, - { 21746, 37710 }, - { 21754, 39501 }, - { 21757, 39498 }, - { 21759, 64148 }, - { 21764, 35155 }, - { 21766, 36276 }, - { 21767, 36943 }, - { 21775, 39496 }, - { 21776, 37762 }, - { 21780, 39497 }, - { 21782, 34976 }, - { 21806, 39507 }, - { 21807, 38722 }, - { 21809, 36773 }, - { 21811, 39513 }, - { 21816, 39512 }, - { 21817, 39503 }, - { 21822, 37313 }, - { 21824, 39504 }, - { 21828, 37357 }, - { 21829, 39509 }, - { 21830, 36772 }, - { 21836, 39506 }, - { 21839, 38626 }, - { 21843, 35931 }, - { 21846, 39510 }, - { 21847, 39511 }, - { 21852, 39508 }, - { 21853, 39514 }, - { 21859, 39505 }, - { 21883, 39520 }, - { 21884, 39525 }, - { 21886, 39521 }, - { 21888, 39516 }, - { 21891, 39526 }, - { 21892, 37200 }, - { 21894, 64149 }, - { 21895, 39528 }, - { 21897, 36161 }, - { 21898, 39518 }, - { 21899, 37533 }, - { 21912, 39522 }, - { 21913, 39515 }, - { 21914, 35499 }, - { 21916, 35564 }, - { 21917, 35461 }, - { 21918, 39523 }, - { 21919, 39519 }, - { 21927, 35990 }, - { 21928, 39529 }, - { 21929, 39527 }, - { 21930, 37234 }, - { 21931, 35689 }, - { 21932, 35754 }, - { 21934, 39524 }, - { 21936, 35826 }, - { 21942, 35171 }, - { 21956, 39533 }, - { 21957, 39531 }, - { 21959, 39589 }, - { 21972, 39536 }, - { 21978, 39530 }, - { 21980, 39534 }, - { 21983, 39532 }, - { 21987, 36459 }, - { 21988, 39535 }, - { 22007, 39538 }, - { 22009, 39543 }, - { 22013, 39541 }, - { 22014, 39540 }, - { 22022, 37457 }, - { 22025, 35267 }, - { 22036, 39537 }, - { 22038, 39539 }, - { 22039, 36774 }, - { 22040, 35154 }, - { 22043, 39542 }, - { 22057, 35292 }, - { 22063, 39554 }, - { 22065, 36858 }, - { 22066, 39549 }, - { 22068, 39547 }, - { 22070, 39548 }, - { 22072, 39550 }, - { 22082, 35164 }, - { 22092, 37208 }, - { 22094, 39544 }, - { 22096, 39545 }, - { 22107, 35482 }, - { 22116, 39553 }, - { 22120, 35565 }, - { 22122, 39556 }, - { 22123, 39552 }, - { 22124, 39555 }, - { 22132, 38316 }, - { 22136, 37843 }, - { 22138, 38070 }, - { 22144, 39558 }, - { 22150, 39557 }, - { 22151, 35428 }, - { 22154, 39559 }, - { 22159, 39562 }, - { 22164, 39561 }, - { 22176, 39560 }, - { 22178, 37976 }, - { 22181, 39563 }, - { 22190, 39564 }, - { 22196, 39566 }, - { 22198, 39565 }, - { 22204, 39568 }, - { 22208, 39571 }, - { 22209, 39569 }, - { 22210, 39567 }, - { 22211, 39570 }, - { 22216, 39572 }, - { 22222, 39573 }, - { 22225, 39574 }, - { 22227, 39575 }, - { 22231, 39576 }, - { 22232, 39268 }, - { 22234, 36602 }, - { 22235, 36460 }, - { 22238, 35313 }, - { 22240, 35062 }, - { 22243, 37475 }, - { 22254, 39577 }, - { 22256, 36258 }, - { 22258, 35021 }, - { 22259, 36989 }, - { 22265, 39578 }, - { 22266, 36037 }, - { 22269, 36241 }, - { 22271, 39580 }, - { 22272, 39579 }, - { 22275, 38366 }, - { 22276, 39581 }, - { 22280, 39583 }, - { 22281, 39582 }, - { 22283, 39584 }, - { 22285, 39585 }, - { 22287, 35991 }, - { 22290, 35200 }, - { 22291, 39586 }, - { 22294, 39588 }, - { 22296, 39587 }, - { 22300, 39590 }, - { 22303, 37753 }, - { 22310, 39591 }, - { 22311, 34995 }, - { 22312, 36317 }, - { 22317, 35932 }, - { 22320, 37486 }, - { 22327, 39592 }, - { 22328, 39593 }, - { 22331, 39595 }, - { 22336, 39596 }, - { 22338, 36322 }, - { 22343, 35791 }, - { 22346, 38486 }, - { 22350, 39594 }, - { 22351, 39597 }, - { 22352, 36287 }, - { 22353, 36162 }, - { 22361, 64150 }, - { 22369, 39601 }, - { 22372, 36259 }, - { 22373, 64151 }, - { 22374, 37458 }, - { 22377, 39598 }, - { 22378, 37592 }, - { 22399, 39602 }, - { 22402, 36994 }, - { 22408, 39600 }, - { 22409, 39603 }, - { 22411, 35934 }, - { 22419, 39604 }, - { 22432, 39605 }, - { 22434, 36163 }, - { 22435, 35423 }, - { 22436, 39607 }, - { 22442, 39608 }, - { 22444, 64152 }, - { 22448, 39609 }, - { 22451, 39606 }, - { 22464, 39599 }, - { 22467, 39610 }, - { 22470, 39611 }, - { 22471, 64154 }, - { 22472, 64153 }, - { 22475, 38532 }, - { 22478, 36841 }, - { 22482, 39613 }, - { 22483, 39614 }, - { 22484, 39612 }, - { 22486, 39616 }, - { 22492, 37975 }, - { 22495, 35046 }, - { 22496, 38261 }, - { 22499, 39617 }, - { 22516, 36859 }, - { 22519, 36535 }, - { 22521, 38012 }, - { 22522, 35566 }, - { 22524, 36329 }, - { 22528, 38520 }, - { 22530, 37808 }, - { 22533, 35992 }, - { 22534, 37325 }, - { 22538, 39615 }, - { 22539, 39618 }, - { 22549, 37314 }, - { 22553, 39619 }, - { 22557, 39620 }, - { 22561, 39622 }, - { 22564, 37607 }, - { 22570, 35500 }, - { 22575, 60063 }, - { 22576, 35201 }, - { 22577, 38385 }, - { 22580, 36842 }, - { 22581, 37735 }, - { 22586, 36324 }, - { 22589, 39628 }, - { 22592, 38331 }, - { 22593, 38875 }, - { 22602, 35314 }, - { 22603, 39624 }, - { 22609, 37209 }, - { 22610, 39627 }, - { 22612, 37763 }, - { 22615, 37736 }, - { 22616, 37764 }, - { 22617, 38071 }, - { 22618, 37579 }, - { 22622, 36295 }, - { 22626, 39623 }, - { 22633, 35222 }, - { 22635, 37717 }, - { 22640, 39625 }, - { 22642, 39621 }, - { 22645, 36975 }, - { 22649, 39629 }, - { 22654, 36717 }, - { 22659, 35755 }, - { 22661, 39630 }, - { 22675, 38374 }, - { 22679, 37277 }, - { 22684, 37572 }, - { 22686, 64157 }, - { 22687, 39632 }, - { 22696, 38510 }, - { 22699, 39633 }, - { 22702, 39638 }, - { 22706, 64158 }, - { 22707, 38317 }, - { 22712, 39637 }, - { 22713, 39631 }, - { 22714, 39634 }, - { 22715, 39636 }, - { 22718, 36260 }, - { 22721, 38343 }, - { 22725, 39639 }, - { 22727, 37476 }, - { 22730, 35315 }, - { 22732, 36843 }, - { 22737, 39641 }, - { 22739, 39640 }, - { 22741, 36232 }, - { 22743, 39642 }, - { 22744, 39644 }, - { 22745, 39643 }, - { 22748, 39646 }, - { 22750, 39635 }, - { 22751, 39648 }, - { 22756, 39647 }, - { 22757, 39645 }, - { 22763, 36461 }, - { 22764, 36976 }, - { 22766, 37235 }, - { 22767, 39649 }, - { 22768, 37050 }, - { 22769, 35051 }, - { 22770, 38020 }, - { 22775, 37593 }, - { 22777, 39651 }, - { 22778, 39650 }, - { 22779, 39652 }, - { 22780, 39653 }, - { 22781, 39654 }, - { 22786, 39655 }, - { 22793, 38351 }, - { 22794, 39656 }, - { 22795, 64159 }, - { 22799, 35268 }, - { 22800, 39657 }, - { 22805, 38747 }, - { 22806, 35407 }, - { 22808, 39367 }, - { 22809, 36711 }, - { 22810, 37309 }, - { 22811, 39658 }, - { 22812, 38633 }, - { 22818, 38578 }, - { 22821, 39660 }, - { 22823, 37349 }, - { 22825, 37718 }, - { 22826, 37310 }, - { 22827, 38262 }, - { 22828, 39661 }, - { 22829, 39662 }, - { 22830, 35227 }, - { 22833, 36536 }, - { 22834, 39663 }, - { 22839, 35022 }, - { 22840, 39664 }, - { 22846, 39665 }, - { 22852, 35202 }, - { 22855, 35567 }, - { 22856, 37854 }, - { 22857, 38386 }, - { 22862, 39669 }, - { 22863, 37236 }, - { 22864, 39668 }, - { 22865, 35935 }, - { 22867, 64160 }, - { 22868, 38522 }, - { 22869, 39667 }, - { 22871, 37765 }, - { 22872, 39671 }, - { 22874, 39670 }, - { 22875, 64161 }, - { 22877, 64162 }, - { 22880, 39673 }, - { 22882, 39672 }, - { 22883, 64163 }, - { 22885, 35228 }, - { 22887, 39674 }, - { 22888, 36775 }, - { 22889, 39676 }, - { 22890, 37444 }, - { 22892, 39675 }, - { 22894, 38321 }, - { 22899, 36759 }, - { 22900, 37754 }, - { 22904, 39744 }, - { 22909, 36164 }, - { 22913, 39745 }, - { 22914, 37952 }, - { 22915, 38108 }, - { 22916, 38607 }, - { 22922, 37956 }, - { 22925, 39754 }, - { 22931, 35671 }, - { 22934, 38756 }, - { 22937, 38573 }, - { 22939, 39850 }, - { 22941, 39746 }, - { 22947, 39749 }, - { 22948, 64164 }, - { 22949, 37315 }, - { 22952, 38487 }, - { 22956, 37737 }, - { 22962, 39750 }, - { 22969, 38533 }, - { 22970, 64165 }, - { 22971, 36296 }, - { 22974, 36776 }, - { 22982, 39751 }, - { 22985, 36463 }, - { 22987, 36462 }, - { 22992, 34999 }, - { 22993, 36038 }, - { 22995, 37033 }, - { 22996, 35023 }, - { 23001, 39755 }, - { 23002, 39756 }, - { 23004, 39753 }, - { 23013, 35159 }, - { 23014, 35501 }, - { 23016, 39752 }, - { 23018, 38595 }, - { 23019, 38224 }, - { 23030, 34982 }, - { 23035, 35063 }, - { 23039, 36464 }, - { 23041, 35024 }, - { 23043, 34977 }, - { 23049, 39761 }, - { 23057, 39759 }, - { 23064, 38586 }, - { 23066, 39762 }, - { 23068, 39760 }, - { 23071, 39758 }, - { 23072, 36944 }, - { 23077, 39757 }, - { 23081, 38360 }, - { 23087, 36066 }, - { 23093, 39766 }, - { 23094, 39767 }, - { 23100, 36777 }, - { 23104, 39763 }, - { 23105, 38987 }, - { 23110, 37995 }, - { 23113, 39765 }, - { 23130, 36261 }, - { 23138, 39768 }, - { 23142, 38263 }, - { 23146, 39769 }, - { 23148, 39764 }, - { 23167, 38585 }, - { 23186, 38013 }, - { 23194, 39770 }, - { 23195, 38225 }, - { 23228, 39771 }, - { 23229, 39775 }, - { 23230, 39772 }, - { 23233, 35269 }, - { 23234, 39774 }, - { 23241, 36537 }, - { 23243, 39773 }, - { 23244, 35993 }, - { 23248, 39787 }, - { 23254, 39780 }, - { 23255, 39777 }, - { 23265, 37508 }, - { 23267, 39776 }, - { 23270, 39778 }, - { 23273, 39779 }, - { 23290, 39781 }, - { 23291, 39782 }, - { 23305, 35568 }, - { 23307, 39784 }, - { 23308, 39783 }, - { 23318, 39785 }, - { 23330, 36844 }, - { 23338, 39788 }, - { 23340, 37594 }, - { 23344, 35172 }, - { 23346, 39786 }, - { 23350, 39789 }, - { 23358, 39790 }, - { 23360, 39793 }, - { 23363, 39791 }, - { 23365, 39792 }, - { 23376, 36465 }, - { 23377, 39794 }, - { 23380, 36165 }, - { 23381, 39795 }, - { 23382, 64166 }, - { 23383, 36506 }, - { 23384, 37302 }, - { 23386, 39796 }, - { 23387, 39797 }, - { 23388, 36473 }, - { 23389, 36166 }, - { 23391, 38608 }, - { 23395, 35655 }, - { 23396, 36039 }, - { 23397, 39798 }, - { 23398, 35447 }, - { 23401, 39799 }, - { 23403, 37303 }, - { 23408, 39800 }, - { 23409, 39841 }, - { 23411, 39801 }, - { 23413, 39802 }, - { 23416, 39803 }, - { 23418, 39805 }, - { 23424, 39806 }, - { 23427, 39808 }, - { 23429, 37358 }, - { 23431, 35142 }, - { 23432, 36583 }, - { 23433, 35008 }, - { 23435, 37238 }, - { 23436, 35502 }, - { 23437, 36531 }, - { 23439, 36167 }, - { 23445, 37766 }, - { 23447, 36672 }, - { 23448, 35503 }, - { 23449, 37512 }, - { 23450, 37608 }, - { 23451, 34998 }, - { 23452, 35672 }, - { 23453, 38387 }, - { 23455, 36544 }, - { 23458, 35697 }, - { 23459, 37097 }, - { 23460, 36538 }, - { 23461, 38727 }, - { 23462, 39809 }, - { 23470, 35707 }, - { 23472, 36297 }, - { 23475, 35409 }, - { 23476, 35203 }, - { 23477, 36778 }, - { 23478, 35270 }, - { 23480, 39810 }, - { 23481, 38757 }, - { 23487, 36712 }, - { 23488, 64167 }, - { 23490, 36578 }, - { 23491, 39811 }, - { 23492, 35569 }, - { 23493, 37840 }, - { 23494, 38567 }, - { 23495, 39812 }, - { 23497, 39813 }, - { 23500, 38264 }, - { 23504, 39815 }, - { 23506, 35494 }, - { 23507, 35829 }, - { 23508, 39814 }, - { 23512, 64169 }, - { 23515, 35504 }, - { 23517, 36945 }, - { 23518, 39819 }, - { 23519, 36416 }, - { 23521, 35271 }, - { 23522, 39818 }, - { 23524, 39816 }, - { 23525, 39820 }, - { 23526, 39817 }, - { 23527, 37962 }, - { 23528, 40651 }, - { 23529, 36946 }, - { 23531, 39821 }, - { 23532, 64170 }, - { 23534, 38846 }, - { 23536, 39822 }, - { 23539, 39824 }, - { 23541, 37534 }, - { 23542, 39823 }, - { 23544, 37025 }, - { 23546, 36507 }, - { 23550, 37326 }, - { 23551, 36597 }, - { 23553, 38293 }, - { 23554, 37098 }, - { 23556, 36555 }, - { 23557, 39825 }, - { 23558, 36779 }, - { 23559, 39826 }, - { 23560, 39827 }, - { 23561, 35025 }, - { 23562, 37304 }, - { 23563, 36977 }, - { 23565, 39828 }, - { 23566, 37809 }, - { 23567, 36780 }, - { 23569, 36781 }, - { 23571, 39829 }, - { 23574, 37099 }, - { 23578, 36782 }, - { 23582, 64171 }, - { 23584, 39830 }, - { 23586, 39831 }, - { 23588, 38622 }, - { 23592, 39832 }, - { 23597, 35780 }, - { 23601, 36673 }, - { 23608, 39833 }, - { 23609, 39834 }, - { 23610, 36570 }, - { 23611, 36939 }, - { 23612, 37874 }, - { 23613, 36979 }, - { 23614, 38134 }, - { 23615, 37953 }, - { 23616, 35783 }, - { 23617, 39835 }, - { 23621, 35727 }, - { 23622, 39836 }, - { 23624, 35836 }, - { 23626, 37837 }, - { 23627, 35246 }, - { 23629, 36466 }, - { 23630, 39837 }, - { 23631, 39840 }, - { 23632, 39839 }, - { 23633, 35835 }, - { 23635, 39838 }, - { 23637, 37719 }, - { 23646, 37294 }, - { 23648, 37738 }, - { 23649, 36550 }, - { 23652, 37239 }, - { 23653, 38810 }, - { 23660, 39842 }, - { 23662, 39843 }, - { 23663, 37844 }, - { 23665, 36434 }, - { 23670, 39845 }, - { 23673, 39846 }, - { 23692, 39847 }, - { 23696, 35570 }, - { 23697, 39848 }, - { 23700, 39849 }, - { 23713, 35242 }, - { 23718, 64172 }, - { 23720, 37210 }, - { 23721, 35554 }, - { 23723, 39851 }, - { 23724, 38566 }, - { 23729, 37328 }, - { 23731, 35448 }, - { 23734, 39853 }, - { 23735, 39855 }, - { 23736, 35549 }, - { 23738, 64173 }, - { 23739, 39852 }, - { 23740, 39854 }, - { 23742, 39857 }, - { 23749, 39856 }, - { 23751, 39858 }, - { 23769, 39859 }, - { 23776, 37819 }, - { 23777, 35756 }, - { 23784, 35299 }, - { 23785, 39860 }, - { 23786, 39865 }, - { 23789, 39863 }, - { 23791, 38389 }, - { 23792, 38388 }, - { 23797, 64174 }, - { 23798, 37767 }, - { 23802, 39862 }, - { 23803, 36723 }, - { 23805, 39861 }, - { 23815, 37010 }, - { 23819, 39866 }, - { 23822, 36328 }, - { 23825, 39872 }, - { 23828, 39873 }, - { 23829, 39867 }, - { 23830, 35410 }, - { 23831, 39868 }, - { 23832, 39877 }, - { 23833, 39876 }, - { 23834, 39875 }, - { 23835, 39871 }, - { 23839, 39870 }, - { 23842, 39874 }, - { 23847, 64175 }, - { 23849, 38390 }, - { 23874, 64178 }, - { 23883, 39881 }, - { 23884, 39878 }, - { 23886, 39880 }, - { 23888, 38802 }, - { 23890, 39879 }, - { 23891, 64176 }, - { 23900, 39869 }, - { 23913, 37011 }, - { 23916, 39882 }, - { 23917, 64179 }, - { 23919, 36277 }, - { 23923, 39883 }, - { 23926, 39884 }, - { 23938, 39887 }, - { 23940, 39886 }, - { 23943, 39885 }, - { 23947, 37768 }, - { 23948, 39864 }, - { 23952, 39893 }, - { 23965, 39889 }, - { 23970, 39888 }, - { 23980, 39890 }, - { 23982, 39891 }, - { 23991, 39894 }, - { 23992, 64180 }, - { 23993, 64181 }, - { 23994, 38884 }, - { 23996, 39895 }, - { 23997, 39892 }, - { 24009, 39896 }, - { 24012, 35550 }, - { 24013, 39897 }, - { 24016, 64182 }, - { 24018, 39899 }, - { 24019, 39898 }, - { 24022, 39900 }, - { 24027, 39901 }, - { 24029, 37100 }, - { 24030, 36674 }, - { 24033, 36740 }, - { 24035, 37251 }, - { 24037, 36168 }, - { 24038, 36278 }, - { 24039, 36169 }, - { 24040, 35728 }, - { 24043, 39902 }, - { 24046, 36279 }, - { 24049, 36040 }, - { 24050, 39903 }, - { 24051, 38564 }, - { 24052, 37986 }, - { 24053, 39904 }, - { 24055, 36170 }, - { 24059, 35498 }, - { 24061, 37446 }, - { 24062, 35792 }, - { 24066, 36467 }, - { 24067, 38266 }, - { 24070, 38079 }, - { 24075, 39905 }, - { 24076, 35571 }, - { 24081, 39908 }, - { 24086, 37535 }, - { 24089, 39907 }, - { 24090, 39906 }, - { 24091, 39909 }, - { 24093, 37609 }, - { 24101, 36995 }, - { 24107, 36468 }, - { 24109, 37064 }, - { 24111, 37329 }, - { 24112, 35649 }, - { 24115, 37536 }, - { 24118, 39910 }, - { 24119, 39911 }, - { 24120, 36845 }, - { 24125, 38488 }, - { 24128, 39914 }, - { 24131, 39913 }, - { 24132, 39912 }, - { 24133, 38301 }, - { 24135, 39921 }, - { 24140, 38521 }, - { 24142, 39915 }, - { 24148, 39917 }, - { 24149, 38539 }, - { 24151, 39916 }, - { 24159, 39918 }, - { 24161, 38054 }, - { 24162, 39919 }, - { 24163, 38332 }, - { 24164, 39920 }, - { 24178, 35505 }, - { 24179, 38333 }, - { 24180, 37966 }, - { 24181, 39922 }, - { 24182, 39923 }, - { 24184, 36171 }, - { 24185, 35506 }, - { 24186, 39924 }, - { 24187, 36022 }, - { 24188, 38755 }, - { 24189, 38728 }, - { 24190, 35572 }, - { 24191, 39926 }, - { 24193, 37537 }, - { 24195, 36172 }, - { 24196, 36783 }, - { 24199, 38109 }, - { 24202, 36784 }, - { 24207, 36760 }, - { 24213, 37610 }, - { 24214, 38391 }, - { 24215, 37720 }, - { 24218, 36173 }, - { 24220, 38267 }, - { 24224, 39927 }, - { 24230, 37752 }, - { 24231, 36288 }, - { 24235, 36041 }, - { 24237, 37611 }, - { 24245, 35009 }, - { 24246, 36750 }, - { 24247, 36174 }, - { 24248, 38758 }, - { 24257, 39928 }, - { 24258, 39929 }, - { 24259, 38000 }, - { 24264, 39930 }, - { 24265, 38901 }, - { 24266, 38988 }, - { 24271, 39932 }, - { 24272, 39931 }, - { 24275, 35430 }, - { 24278, 40000 }, - { 24282, 40003 }, - { 24283, 40004 }, - { 24285, 40002 }, - { 24287, 38239 }, - { 24288, 36785 }, - { 24289, 40006 }, - { 24290, 40005 }, - { 24291, 40001 }, - { 24296, 40007 }, - { 24297, 40008 }, - { 24300, 40009 }, - { 24304, 40012 }, - { 24305, 40010 }, - { 24307, 40011 }, - { 24308, 40013 }, - { 24310, 35204 }, - { 24311, 37612 }, - { 24312, 40014 }, - { 24314, 35994 }, - { 24315, 35316 }, - { 24316, 37973 }, - { 24318, 40015 }, - { 24319, 37881 }, - { 24321, 38361 }, - { 24323, 40016 }, - { 24324, 38989 }, - { 24329, 40017 }, - { 24330, 38334 }, - { 24331, 40020 }, - { 24332, 39071 }, - { 24333, 39087 }, - { 24335, 36526 }, - { 24336, 37875 }, - { 24337, 40021 }, - { 24339, 35708 }, - { 24340, 37538 }, - { 24341, 35064 }, - { 24342, 40022 }, - { 24343, 38308 }, - { 24344, 36175 }, - { 24347, 37487 }, - { 24351, 37613 }, - { 24353, 64183 }, - { 24357, 38637 }, - { 24358, 36023 }, - { 24359, 36042 }, - { 24361, 40023 }, - { 24365, 40024 }, - { 24367, 40030 }, - { 24369, 36579 }, - { 24372, 64184 }, - { 24373, 37539 }, - { 24375, 35757 }, - { 24376, 40025 }, - { 24380, 38218 }, - { 24382, 37477 }, - { 24385, 40026 }, - { 24389, 64103 }, - { 24392, 40027 }, - { 24394, 35758 }, - { 24396, 40028 }, - { 24398, 40029 }, - { 24401, 40031 }, - { 24403, 37782 }, - { 24406, 40032 }, - { 24407, 40033 }, - { 24409, 40034 }, - { 24412, 40019 }, - { 24413, 40018 }, - { 24417, 40035 }, - { 24418, 35936 }, - { 24422, 38214 }, - { 24423, 64185 }, - { 24425, 36298 }, - { 24426, 38230 }, - { 24427, 37540 }, - { 24428, 38250 }, - { 24429, 40036 }, - { 24432, 36786 }, - { 24433, 35173 }, - { 24435, 40037 }, - { 24439, 40038 }, - { 24441, 38640 }, - { 24444, 38110 }, - { 24447, 40041 }, - { 24448, 35229 }, - { 24449, 37034 }, - { 24450, 40040 }, - { 24451, 40039 }, - { 24452, 35937 }, - { 24453, 37330 }, - { 24455, 40045 }, - { 24456, 40043 }, - { 24458, 40042 }, - { 24459, 38821 }, - { 24460, 36067 }, - { 24464, 36761 }, - { 24465, 40044 }, - { 24466, 37739 }, - { 24467, 36701 }, - { 24471, 37822 }, - { 24472, 40048 }, - { 24473, 40047 }, - { 24478, 40046 }, - { 24480, 40049 }, - { 24481, 36068 }, - { 24488, 40050 }, - { 24489, 38300 }, - { 24490, 36730 }, - { 24493, 40051 }, - { 24494, 38135 }, - { 24499, 37823 }, - { 24500, 37541 }, - { 24503, 64186 }, - { 24505, 37711 }, - { 24508, 40052 }, - { 24509, 35658 }, - { 24515, 36947 }, - { 24517, 38219 }, - { 24524, 35573 }, - { 24525, 37957 }, - { 24534, 40053 }, - { 24535, 36469 }, - { 24536, 38489 }, - { 24537, 38490 }, - { 24540, 35230 }, - { 24541, 40058 }, - { 24542, 64187 }, - { 24544, 37513 }, - { 24548, 40055 }, - { 24555, 35317 }, - { 24560, 40107 }, - { 24561, 40057 }, - { 24565, 37967 }, - { 24568, 40056 }, - { 24571, 40054 }, - { 24573, 36250 }, - { 24575, 40060 }, - { 24590, 40067 }, - { 24591, 40073 }, - { 24592, 40065 }, - { 24594, 37755 }, - { 24597, 40070 }, - { 24598, 38268 }, - { 24601, 40064 }, - { 24603, 40069 }, - { 24604, 38885 }, - { 24605, 36470 }, - { 24608, 37331 }, - { 24609, 40061 }, - { 24613, 35709 }, - { 24614, 40072 }, - { 24615, 37035 }, - { 24616, 35205 }, - { 24617, 40066 }, - { 24618, 35318 }, - { 24619, 40071 }, - { 24623, 35759 }, - { 24625, 40068 }, - { 24634, 40074 }, - { 24641, 40076 }, - { 24642, 40086 }, - { 24643, 40084 }, - { 24646, 40081 }, - { 24650, 40080 }, - { 24651, 38902 }, - { 24653, 40082 }, - { 24656, 35760 }, - { 24658, 36176 }, - { 24661, 36762 }, - { 24665, 40089 }, - { 24666, 40075 }, - { 24669, 64188 }, - { 24671, 40079 }, - { 24672, 40062 }, - { 24674, 35320 }, - { 24675, 40083 }, - { 24676, 40085 }, - { 24677, 37488 }, - { 24680, 36262 }, - { 24681, 35254 }, - { 24682, 40077 }, - { 24683, 40088 }, - { 24684, 40087 }, - { 24685, 35761 }, - { 24687, 37287 }, - { 24688, 35462 }, - { 24693, 35938 }, - { 24695, 40078 }, - { 24705, 40090 }, - { 24707, 40093 }, - { 24708, 40095 }, - { 24709, 64189 }, - { 24713, 36539 }, - { 24714, 64190 }, - { 24715, 40101 }, - { 24716, 37614 }, - { 24717, 40091 }, - { 24722, 40099 }, - { 24724, 35319 }, - { 24726, 40097 }, - { 24727, 40098 }, - { 24730, 40094 }, - { 24731, 40096 }, - { 24735, 36069 }, - { 24736, 38729 }, - { 24739, 35507 }, - { 24742, 35192 }, - { 24743, 40100 }, - { 24745, 37977 }, - { 24746, 34987 }, - { 24754, 38111 }, - { 24755, 40059 }, - { 24756, 40106 }, - { 24757, 40110 }, - { 24758, 38627 }, - { 24760, 40103 }, - { 24764, 37769 }, - { 24765, 40108 }, - { 24773, 36846 }, - { 24774, 40109 }, - { 24775, 37845 }, - { 24785, 39014 }, - { 24787, 40105 }, - { 24789, 64192 }, - { 24792, 40111 }, - { 24794, 36251 }, - { 24796, 37065 }, - { 24798, 64191 }, - { 24799, 35026 }, - { 24800, 40104 }, - { 24801, 40102 }, - { 24803, 37241 }, - { 24807, 40092 }, - { 24808, 36435 }, - { 24816, 37316 }, - { 24817, 40123 }, - { 24818, 64194 }, - { 24819, 37242 }, - { 24820, 40118 }, - { 24822, 40115 }, - { 24823, 40116 }, - { 24825, 36580 }, - { 24826, 40119 }, - { 24827, 40122 }, - { 24832, 40117 }, - { 24833, 36676 }, - { 24835, 40120 }, - { 24838, 40114 }, - { 24840, 38650 }, - { 24841, 38649 }, - { 24845, 40124 }, - { 24846, 40125 }, - { 24847, 35027 }, - { 24849, 64195 }, - { 24853, 40113 }, - { 24858, 35824 }, - { 24859, 34980 }, - { 24863, 35508 }, - { 24864, 64193 }, - { 24865, 40121 }, - { 24871, 40129 }, - { 24872, 40128 }, - { 24876, 40133 }, - { 24880, 64197 }, - { 24884, 40134 }, - { 24887, 64196 }, - { 24892, 40132 }, - { 24893, 40135 }, - { 24894, 40127 }, - { 24895, 40131 }, - { 24898, 40136 }, - { 24900, 40137 }, - { 24903, 40126 }, - { 24904, 36508 }, - { 24906, 40130 }, - { 24907, 37332 }, - { 24908, 36177 }, - { 24909, 40112 }, - { 24910, 36948 }, - { 24915, 40150 }, - { 24917, 38375 }, - { 24920, 40140 }, - { 24921, 40141 }, - { 24922, 40142 }, - { 24925, 40149 }, - { 24927, 40148 }, - { 24930, 38557 }, - { 24931, 35509 }, - { 24933, 40146 }, - { 24935, 35940 }, - { 24936, 35411 }, - { 24939, 40143 }, - { 24942, 38838 }, - { 24943, 40145 }, - { 24944, 35028 }, - { 24945, 40147 }, - { 24947, 40138 }, - { 24948, 40144 }, - { 24949, 40151 }, - { 24950, 35939 }, - { 24951, 40139 }, - { 24958, 38780 }, - { 24962, 38730 }, - { 24967, 40154 }, - { 24970, 40158 }, - { 24974, 37278 }, - { 24976, 38903 }, - { 24977, 40159 }, - { 24980, 40156 }, - { 24982, 40153 }, - { 24984, 64198 }, - { 24985, 40152 }, - { 24986, 40157 }, - { 24996, 38318 }, - { 24999, 37810 }, - { 25001, 35941 }, - { 25003, 40160 }, - { 25004, 40155 }, - { 25006, 40161 }, - { 25010, 35995 }, - { 25014, 35247 }, - { 25018, 40169 }, - { 25022, 35510 }, - { 25027, 40167 }, - { 25030, 40168 }, - { 25031, 36263 }, - { 25032, 40166 }, - { 25033, 40164 }, - { 25034, 40163 }, - { 25035, 40170 }, - { 25036, 40162 }, - { 25037, 40172 }, - { 25040, 35321 }, - { 25059, 40174 }, - { 25062, 40173 }, - { 25074, 37542 }, - { 25076, 40177 }, - { 25078, 40175 }, - { 25079, 40165 }, - { 25080, 35996 }, - { 25082, 40176 }, - { 25084, 40180 }, - { 25085, 40179 }, - { 25086, 40181 }, - { 25087, 40178 }, - { 25088, 40182 }, - { 25096, 40183 }, - { 25097, 40184 }, - { 25098, 38376 }, - { 25100, 40186 }, - { 25101, 40185 }, - { 25102, 36702 }, - { 25104, 37036 }, - { 25105, 35300 }, - { 25106, 35322 }, - { 25107, 64199 }, - { 25108, 40187 }, - { 25110, 35005 }, - { 25114, 37066 }, - { 25115, 40188 }, - { 25117, 59073 }, - { 25118, 40256 }, - { 25119, 35969 }, - { 25121, 40257 }, - { 25126, 37101 }, - { 25130, 40258 }, - { 25134, 40259 }, - { 25135, 35673 }, - { 25136, 40260 }, - { 25138, 40261 }, - { 25139, 40262 }, - { 25140, 37333 }, - { 25144, 36043 }, - { 25147, 38623 }, - { 25151, 38491 }, - { 25152, 36746 }, - { 25153, 40263 }, - { 25159, 37102 }, - { 25160, 59323 }, - { 25161, 38112 }, - { 25163, 36584 }, - { 25165, 36299 }, - { 25166, 40264 }, - { 25171, 37317 }, - { 25173, 38309 }, - { 25176, 37359 }, - { 25179, 40267 }, - { 25182, 40265 }, - { 25184, 40268 }, - { 25187, 40266 }, - { 25192, 40269 }, - { 25198, 38319 }, - { 25201, 34997 }, - { 25206, 38269 }, - { 25209, 38113 }, - { 25212, 40270 }, - { 25214, 40273 }, - { 25215, 36787 }, - { 25216, 35674 }, - { 25218, 40271 }, - { 25219, 40278 }, - { 25220, 36788 }, - { 25225, 40272 }, - { 25226, 37987 }, - { 25233, 38781 }, - { 25234, 40274 }, - { 25235, 40275 }, - { 25236, 40279 }, - { 25237, 37770 }, - { 25238, 40276 }, - { 25239, 36178 }, - { 25240, 37084 }, - { 25243, 40293 }, - { 25244, 38066 }, - { 25246, 37360 }, - { 25254, 64200 }, - { 25259, 38114 }, - { 25260, 40363 }, - { 25265, 38392 }, - { 25269, 37615 }, - { 25273, 38549 }, - { 25275, 40282 }, - { 25276, 35231 }, - { 25277, 37514 }, - { 25282, 40291 }, - { 25285, 37459 }, - { 25286, 40285 }, - { 25287, 40292 }, - { 25288, 40287 }, - { 25289, 40294 }, - { 25290, 40290 }, - { 25292, 40289 }, - { 25293, 38031 }, - { 25295, 40283 }, - { 25296, 35323 }, - { 25297, 40281 }, - { 25298, 35729 }, - { 25299, 37361 }, - { 25300, 40277 }, - { 25303, 40280 }, - { 25304, 36179 }, - { 25305, 37081 }, - { 25307, 36789 }, - { 25308, 40288 }, - { 25309, 38001 }, - { 25312, 35730 }, - { 25313, 35431 }, - { 25324, 35463 }, - { 25325, 36928 }, - { 25326, 40296 }, - { 25327, 40301 }, - { 25329, 40297 }, - { 25331, 35997 }, - { 25333, 40302 }, - { 25334, 36417 }, - { 25335, 36233 }, - { 25342, 36677 }, - { 25343, 40284 }, - { 25345, 36509 }, - { 25346, 40299 }, - { 25351, 36471 }, - { 25352, 40300 }, - { 25353, 35010 }, - { 25356, 40295 }, - { 25361, 37543 }, - { 25369, 35731 }, - { 25375, 35762 }, - { 25383, 40298 }, - { 25384, 34981 }, - { 25387, 36289 }, - { 25391, 36949 }, - { 25402, 37616 }, - { 25405, 38098 }, - { 25406, 40304 }, - { 25407, 37245 }, - { 25417, 37288 }, - { 25420, 36426 }, - { 25421, 40305 }, - { 25423, 40307 }, - { 25424, 40303 }, - { 25429, 38367 }, - { 25431, 37563 }, - { 25436, 37243 }, - { 25447, 38393 }, - { 25448, 36556 }, - { 25449, 40320 }, - { 25451, 40318 }, - { 25454, 37016 }, - { 25458, 35998 }, - { 25462, 40312 }, - { 25463, 36791 }, - { 25466, 37862 }, - { 25467, 37968 }, - { 25472, 40310 }, - { 25475, 37244 }, - { 25480, 36598 }, - { 25481, 40315 }, - { 25484, 36790 }, - { 25486, 40309 }, - { 25487, 40314 }, - { 25490, 38002 }, - { 25494, 40308 }, - { 25496, 35904 }, - { 25499, 35452 }, - { 25503, 40316 }, - { 25504, 38825 }, - { 25505, 36300 }, - { 25506, 37460 }, - { 25507, 40313 }, - { 25509, 37082 }, - { 25511, 36180 }, - { 25512, 36996 }, - { 25513, 35206 }, - { 25514, 37211 }, - { 25515, 40311 }, - { 25516, 35684 }, - { 25522, 35942 }, - { 25524, 37581 }, - { 25525, 40317 }, - { 25531, 37246 }, - { 25534, 40321 }, - { 25536, 40323 }, - { 25539, 37301 }, - { 25540, 40329 }, - { 25542, 40324 }, - { 25545, 40326 }, - { 25551, 38240 }, - { 25552, 37617 }, - { 25554, 40327 }, - { 25558, 38731 }, - { 25562, 38759 }, - { 25563, 35511 }, - { 25569, 34988 }, - { 25571, 40325 }, - { 25577, 40322 }, - { 25582, 35574 }, - { 25588, 35207 }, - { 25589, 64201 }, - { 25590, 40328 }, - { 25594, 38760 }, - { 25606, 40332 }, - { 25613, 37305 }, - { 25615, 40339 }, - { 25619, 40333 }, - { 25622, 40330 }, - { 25623, 40337 }, - { 25628, 40306 }, - { 25638, 40334 }, - { 25640, 40338 }, - { 25644, 38080 }, - { 25645, 37771 }, - { 25652, 40331 }, - { 25654, 40335 }, - { 25658, 35943 }, - { 25662, 36335 }, - { 25666, 37083 }, - { 25678, 40343 }, - { 25688, 37701 }, - { 25696, 64202 }, - { 25703, 40340 }, - { 25705, 38528 }, - { 25711, 40341 }, - { 25718, 40342 }, - { 25720, 38604 }, - { 25722, 37024 }, - { 25731, 35970 }, - { 25736, 40349 }, - { 25746, 36436 }, - { 25747, 40346 }, - { 25749, 40345 }, - { 25754, 37969 }, - { 25757, 64203 }, - { 25758, 37811 }, - { 25764, 37712 }, - { 25765, 40347 }, - { 25769, 40348 }, - { 25771, 38287 }, - { 25773, 37988 }, - { 25774, 36418 }, - { 25776, 37103 }, - { 25778, 38511 }, - { 25785, 35432 }, - { 25787, 40355 }, - { 25788, 40350 }, - { 25793, 38761 }, - { 25794, 40357 }, - { 25797, 40353 }, - { 25799, 40354 }, - { 25805, 37248 }, - { 25806, 64204 }, - { 25810, 40352 }, - { 25812, 40286 }, - { 25816, 40356 }, - { 25818, 40351 }, - { 25824, 40361 }, - { 25825, 40362 }, - { 25826, 37702 }, - { 25827, 40364 }, - { 25830, 36419 }, - { 25831, 40359 }, - { 25836, 35675 }, - { 25839, 40365 }, - { 25841, 40358 }, - { 25842, 40369 }, - { 25844, 40368 }, - { 25846, 40367 }, - { 25850, 40370 }, - { 25853, 40372 }, - { 25854, 36847 }, - { 25856, 40371 }, - { 25861, 40375 }, - { 25880, 40373 }, - { 25884, 40374 }, - { 25885, 40336 }, - { 25891, 40377 }, - { 25892, 40376 }, - { 25898, 40344 }, - { 25899, 40378 }, - { 25900, 40366 }, - { 25903, 36472 }, - { 25908, 40379 }, - { 25909, 40380 }, - { 25910, 40382 }, - { 25911, 40381 }, - { 25912, 40383 }, - { 25913, 35324 }, - { 25915, 36181 }, - { 25918, 38394 }, - { 25919, 37037 }, - { 25925, 36044 }, - { 25928, 40385 }, - { 25933, 40388 }, - { 25934, 64205 }, - { 25935, 38257 }, - { 25937, 35710 }, - { 25941, 40387 }, - { 25942, 40386 }, - { 25943, 38003 }, - { 25944, 40389 }, - { 25945, 35763 }, - { 25949, 40391 }, - { 25950, 40390 }, - { 25954, 35512 }, - { 25955, 36437 }, - { 25958, 37846 }, - { 25964, 35944 }, - { 25968, 37012 }, - { 25970, 40392 }, - { 25972, 37038 }, - { 25973, 37703 }, - { 25975, 38270 }, - { 25976, 40393 }, - { 25986, 40394 }, - { 25987, 40395 }, - { 25991, 38326 }, - { 25992, 39804 }, - { 25993, 37060 }, - { 25996, 38251 }, - { 25998, 36310 }, - { 26000, 38115 }, - { 26001, 38081 }, - { 26007, 37740 }, - { 26009, 38847 }, - { 26011, 40397 }, - { 26012, 36558 }, - { 26015, 40398 }, - { 26017, 34996 }, - { 26020, 35794 }, - { 26021, 37067 }, - { 26023, 38272 }, - { 26027, 40399 }, - { 26028, 36449 }, - { 26029, 37478 }, - { 26031, 36474 }, - { 26032, 36950 }, - { 26039, 40400 }, - { 26041, 38395 }, - { 26044, 35223 }, - { 26045, 36475 }, - { 26049, 40403 }, - { 26051, 40401 }, - { 26052, 40404 }, - { 26053, 38839 }, - { 26054, 40402 }, - { 26059, 37113 }, - { 26060, 40405 }, - { 26063, 37296 }, - { 26066, 40406 }, - { 26071, 35576 }, - { 26073, 40408 }, - { 26075, 40407 }, - { 26080, 40409 }, - { 26081, 40410 }, - { 26082, 35577 }, - { 26085, 37882 }, - { 26086, 37461 }, - { 26087, 35724 }, - { 26088, 36476 }, - { 26089, 37249 }, - { 26092, 36731 }, - { 26093, 34990 }, - { 26097, 40411 }, - { 26106, 35232 }, - { 26107, 40415 }, - { 26112, 64206 }, - { 26114, 36182 }, - { 26115, 40414 }, - { 26118, 36265 }, - { 26119, 36792 }, - { 26121, 64209 }, - { 26122, 40413 }, - { 26124, 36793 }, - { 26126, 38590 }, - { 26127, 36264 }, - { 26131, 35029 }, - { 26132, 37068 }, - { 26133, 64207 }, - { 26140, 40420 }, - { 26142, 64211 }, - { 26143, 37039 }, - { 26144, 35174 }, - { 26148, 64212 }, - { 26149, 36724 }, - { 26151, 38534 }, - { 26152, 36336 }, - { 26157, 36794 }, - { 26158, 64210 }, - { 26159, 37029 }, - { 26161, 64099 }, - { 26164, 40419 }, - { 26165, 40417 }, - { 26166, 40418 }, - { 26171, 64208 }, - { 26172, 37515 }, - { 26175, 40517 }, - { 26177, 40424 }, - { 26178, 36510 }, - { 26179, 36183 }, - { 26180, 40422 }, - { 26185, 40423 }, - { 26187, 36951 }, - { 26191, 40421 }, - { 26194, 36430 }, - { 26199, 64214 }, - { 26201, 64215 }, - { 26205, 40426 }, - { 26206, 40425 }, - { 26207, 40430 }, - { 26210, 40431 }, - { 26212, 40427 }, - { 26213, 64213 }, - { 26214, 35393 }, - { 26215, 40428 }, - { 26216, 40429 }, - { 26217, 38099 }, - { 26222, 38273 }, - { 26223, 35945 }, - { 26224, 40432 }, - { 26227, 64217 }, - { 26228, 37040 }, - { 26230, 36795 }, - { 26234, 37489 }, - { 26241, 35781 }, - { 26243, 40433 }, - { 26244, 40437 }, - { 26247, 35273 }, - { 26248, 40434 }, - { 26249, 40436 }, - { 26254, 40435 }, - { 26257, 36747 }, - { 26262, 37479 }, - { 26263, 35011 }, - { 26264, 40438 }, - { 26265, 64218 }, - { 26269, 40439 }, - { 26272, 64219 }, - { 26274, 37544 }, - { 26278, 38895 }, - { 26283, 36450 }, - { 26286, 38377 }, - { 26290, 64220 }, - { 26292, 38492 }, - { 26296, 40513 }, - { 26297, 40441 }, - { 26300, 40444 }, - { 26302, 40443 }, - { 26303, 64221 }, - { 26305, 40440 }, - { 26308, 40512 }, - { 26311, 37852 }, - { 26313, 40442 }, - { 26326, 40514 }, - { 26329, 36748 }, - { 26330, 40515 }, - { 26332, 38762 }, - { 26333, 38040 }, - { 26336, 40516 }, - { 26342, 40518 }, - { 26345, 40519 }, - { 26352, 40520 }, - { 26354, 35784 }, - { 26355, 35175 }, - { 26356, 36184 }, - { 26357, 40521 }, - { 26359, 40522 }, - { 26360, 36753 }, - { 26361, 37250 }, - { 26362, 64222 }, - { 26363, 64102 }, - { 26364, 39382 }, - { 26365, 37213 }, - { 26366, 37212 }, - { 26367, 37334 }, - { 26368, 36293 }, - { 26371, 39152 }, - { 26376, 35982 }, - { 26377, 38732 }, - { 26379, 38396 }, - { 26381, 38302 }, - { 26382, 64223 }, - { 26383, 40523 }, - { 26388, 36337 }, - { 26389, 37565 }, - { 26390, 40524 }, - { 26391, 38990 }, - { 26395, 38493 }, - { 26397, 37545 }, - { 26398, 40525 }, - { 26399, 35578 }, - { 26406, 40526 }, - { 26407, 40527 }, - { 26408, 38616 }, - { 26410, 38562 }, - { 26411, 38550 }, - { 26412, 38523 }, - { 26413, 36420 }, - { 26414, 40529 }, - { 26417, 36585 }, - { 26420, 38512 }, - { 26422, 40531 }, - { 26423, 40534 }, - { 26424, 40533 }, - { 26426, 35575 }, - { 26429, 35712 }, - { 26431, 40530 }, - { 26433, 40532 }, - { 26438, 40535 }, - { 26441, 37017 }, - { 26446, 38811 }, - { 26447, 35015 }, - { 26448, 36318 }, - { 26449, 37306 }, - { 26451, 36571 }, - { 26454, 36849 }, - { 26457, 40538 }, - { 26460, 37741 }, - { 26462, 40536 }, - { 26463, 37289 }, - { 26464, 40537 }, - { 26465, 36848 }, - { 26466, 38619 }, - { 26467, 40539 }, - { 26468, 40540 }, - { 26469, 38792 }, - { 26470, 64225 }, - { 26474, 40545 }, - { 26477, 36185 }, - { 26479, 38004 }, - { 26480, 40542 }, - { 26481, 37772 }, - { 26482, 40412 }, - { 26483, 40416 }, - { 26485, 35694 }, - { 26487, 37990 }, - { 26492, 40544 }, - { 26494, 36796 }, - { 26495, 38082 }, - { 26501, 40550 }, - { 26503, 38136 }, - { 26505, 40541 }, - { 26507, 40547 }, - { 26508, 40546 }, - { 26512, 37069 }, - { 26517, 38541 }, - { 26519, 38865 }, - { 26522, 38535 }, - { 26524, 35274 }, - { 26525, 36477 }, - { 26528, 39015 }, - { 26529, 40549 }, - { 26530, 37013 }, - { 26534, 40548 }, - { 26537, 40543 }, - { 26543, 36045 }, - { 26547, 40555 }, - { 26548, 40553 }, - { 26550, 35275 }, - { 26551, 40551 }, - { 26552, 40557 }, - { 26553, 40563 }, - { 26555, 64226 }, - { 26560, 64228 }, - { 26561, 37318 }, - { 26564, 38335 }, - { 26566, 40565 }, - { 26570, 38209 }, - { 26574, 40564 }, - { 26575, 38032 }, - { 26576, 38494 }, - { 26577, 35513 }, - { 26579, 37109 }, - { 26580, 36703 }, - { 26584, 37585 }, - { 26586, 38733 }, - { 26589, 40560 }, - { 26590, 40559 }, - { 26594, 40561 }, - { 26596, 40558 }, - { 26599, 40566 }, - { 26601, 40556 }, - { 26604, 40554 }, - { 26606, 40562 }, - { 26607, 40552 }, - { 26609, 37516 }, - { 26611, 38646 }, - { 26612, 36548 }, - { 26613, 36338 }, - { 26619, 36280 }, - { 26622, 38543 }, - { 26623, 35424 }, - { 26625, 64229 }, - { 26626, 37580 }, - { 26627, 37832 }, - { 26628, 35176 }, - { 26643, 37104 }, - { 26646, 37042 }, - { 26647, 35913 }, - { 26654, 40568 }, - { 26657, 36186 }, - { 26658, 35484 }, - { 26665, 40570 }, - { 26666, 35476 }, - { 26667, 40577 }, - { 26674, 40573 }, - { 26676, 37105 }, - { 26680, 35434 }, - { 26681, 36266 }, - { 26684, 35433 }, - { 26685, 36301 }, - { 26688, 40571 }, - { 26689, 35973 }, - { 26690, 35946 }, - { 26691, 37773 }, - { 26692, 64230 }, - { 26694, 40569 }, - { 26696, 35012 }, - { 26701, 40572 }, - { 26702, 40574 }, - { 26704, 35787 }, - { 26705, 35915 }, - { 26706, 64227 }, - { 26707, 35514 }, - { 26708, 35690 }, - { 26713, 40578 }, - { 26716, 36343 }, - { 26717, 38545 }, - { 26719, 36438 }, - { 26723, 40579 }, - { 26727, 38223 }, - { 26740, 40591 }, - { 26742, 35249 }, - { 26743, 40580 }, - { 26750, 40597 }, - { 26751, 40581 }, - { 26753, 38848 }, - { 26755, 40588 }, - { 26757, 38014 }, - { 26765, 40596 }, - { 26767, 40583 }, - { 26771, 34994 }, - { 26772, 40585 }, - { 26775, 36187 }, - { 26779, 40587 }, - { 26781, 40586 }, - { 26783, 40582 }, - { 26784, 40593 }, - { 26786, 36797 }, - { 26790, 39659 }, - { 26791, 36070 }, - { 26792, 38812 }, - { 26797, 40584 }, - { 26799, 37618 }, - { 26800, 35394 }, - { 26801, 36267 }, - { 26803, 40576 }, - { 26805, 40592 }, - { 26806, 35457 }, - { 26809, 40590 }, - { 26810, 40594 }, - { 26812, 37774 }, - { 26820, 35580 }, - { 26822, 40624 }, - { 26824, 64100 }, - { 26825, 38599 }, - { 26826, 40599 }, - { 26827, 35579 }, - { 26829, 40606 }, - { 26831, 64231 }, - { 26834, 38495 }, - { 26836, 40607 }, - { 26837, 40609 }, - { 26839, 40613 }, - { 26840, 40601 }, - { 26842, 37449 }, - { 26847, 37775 }, - { 26848, 40617 }, - { 26849, 40604 }, - { 26851, 40614 }, - { 26855, 40608 }, - { 26862, 36952 }, - { 26863, 40618 }, - { 26866, 37041 }, - { 26873, 40616 }, - { 26874, 35515 }, - { 26880, 39023 }, - { 26881, 40598 }, - { 26884, 40612 }, - { 26885, 35030 }, - { 26888, 40600 }, - { 26891, 38584 }, - { 26892, 40605 }, - { 26893, 36929 }, - { 26894, 37573 }, - { 26895, 40595 }, - { 26898, 40611 }, - { 26905, 37018 }, - { 26906, 40621 }, - { 26907, 35473 }, - { 26908, 35999 }, - { 26913, 40623 }, - { 26914, 40602 }, - { 26915, 40622 }, - { 26917, 40615 }, - { 26918, 40603 }, - { 26920, 40619 }, - { 26922, 40620 }, - { 26928, 40637 }, - { 26932, 37836 }, - { 26934, 40610 }, - { 26937, 40633 }, - { 26941, 40635 }, - { 26943, 37590 }, - { 26954, 38763 }, - { 26963, 38294 }, - { 26964, 40630 }, - { 26965, 37320 }, - { 26969, 40636 }, - { 26970, 37214 }, - { 26972, 40627 }, - { 26973, 40640 }, - { 26974, 40639 }, - { 26976, 37869 }, - { 26977, 40638 }, - { 26978, 37864 }, - { 26984, 64233 }, - { 26986, 40642 }, - { 26987, 40629 }, - { 26989, 35782 }, - { 26990, 40632 }, - { 26991, 36732 }, - { 26995, 38016 }, - { 26996, 40634 }, - { 26997, 35785 }, - { 26999, 40626 }, - { 27000, 40628 }, - { 27001, 40625 }, - { 27004, 38991 }, - { 27005, 35449 }, - { 27006, 40631 }, - { 27009, 40641 }, - { 27010, 35412 }, - { 27018, 36325 }, - { 27022, 35196 }, - { 27025, 40658 }, - { 27028, 38992 }, - { 27029, 40661 }, - { 27032, 64235 }, - { 27035, 36953 }, - { 27036, 40660 }, - { 27040, 40659 }, - { 27047, 40656 }, - { 27054, 40644 }, - { 27057, 40673 }, - { 27058, 40643 }, - { 27060, 40662 }, - { 27067, 40654 }, - { 27070, 40649 }, - { 27071, 40646 }, - { 27073, 40647 }, - { 27075, 40655 }, - { 27079, 60064 }, - { 27082, 40652 }, - { 27083, 36188 }, - { 27084, 37574 }, - { 27085, 37252 }, - { 27086, 40650 }, - { 27088, 40645 }, - { 27091, 40648 }, - { 27096, 38764 }, - { 27097, 38538 }, - { 27101, 40653 }, - { 27102, 40663 }, - { 27106, 64236 }, - { 27111, 40671 }, - { 27112, 40664 }, - { 27115, 40677 }, - { 27117, 40675 }, - { 27122, 40670 }, - { 27129, 40669 }, - { 27131, 37582 }, - { 27133, 37253 }, - { 27135, 40667 }, - { 27138, 40665 }, - { 27141, 40672 }, - { 27146, 40678 }, - { 27147, 38131 }, - { 27148, 40684 }, - { 27154, 40679 }, - { 27155, 40682 }, - { 27156, 40676 }, - { 27159, 37524 }, - { 27161, 38231 }, - { 27163, 40666 }, - { 27166, 40674 }, - { 27167, 36798 }, - { 27169, 38605 }, - { 27170, 40694 }, - { 27171, 40681 }, - { 27177, 36000 }, - { 27178, 35233 }, - { 27179, 35454 }, - { 27182, 40657 }, - { 27184, 64237 }, - { 27189, 36799 }, - { 27190, 40686 }, - { 27192, 40693 }, - { 27193, 36599 }, - { 27194, 35474 }, - { 27197, 37453 }, - { 27204, 40683 }, - { 27206, 64239 }, - { 27207, 40688 }, - { 27208, 40692 }, - { 27211, 35764 }, - { 27224, 35691 }, - { 27225, 40690 }, - { 27231, 35648 }, - { 27233, 37833 }, - { 27234, 40689 }, - { 27238, 40691 }, - { 27243, 64238 }, - { 27250, 40685 }, - { 27251, 64240 }, - { 27256, 40687 }, - { 27262, 64241 }, - { 27263, 35456 }, - { 27264, 37480 }, - { 27268, 40698 }, - { 27277, 40696 }, - { 27278, 36071 }, - { 27280, 40695 }, - { 27287, 40768 }, - { 27292, 40567 }, - { 27296, 40697 }, - { 27298, 40699 }, - { 27299, 40700 }, - { 27306, 40779 }, - { 27308, 40775 }, - { 27310, 40589 }, - { 27315, 40774 }, - { 27320, 40773 }, - { 27323, 40770 }, - { 27329, 40680 }, - { 27330, 40772 }, - { 27331, 40771 }, - { 27345, 40777 }, - { 27347, 38981 }, - { 27354, 40780 }, - { 27355, 35833 }, - { 27358, 40776 }, - { 27359, 40778 }, - { 27362, 64242 }, - { 27364, 64243 }, - { 27368, 38053 }, - { 27370, 40781 }, - { 27386, 40785 }, - { 27387, 40782 }, - { 27396, 38803 }, - { 27397, 40783 }, - { 27402, 40668 }, - { 27410, 40786 }, - { 27414, 40787 }, - { 27421, 35156 }, - { 27423, 40789 }, - { 27424, 35975 }, - { 27425, 36511 }, - { 27427, 35795 }, - { 27431, 35234 }, - { 27442, 38782 }, - { 27447, 40791 }, - { 27448, 40790 }, - { 27449, 40793 }, - { 27450, 35676 }, - { 27453, 35796 }, - { 27454, 35516 }, - { 27459, 40796 }, - { 27463, 40795 }, - { 27465, 40797 }, - { 27468, 35276 }, - { 27470, 37462 }, - { 27472, 40798 }, - { 27475, 35517 }, - { 27476, 40800 }, - { 27481, 40799 }, - { 27483, 40801 }, - { 27487, 40802 }, - { 27489, 40803 }, - { 27490, 36478 }, - { 27491, 37043 }, - { 27492, 36255 }, - { 27494, 38288 }, - { 27497, 38368 }, - { 27498, 39011 }, - { 27503, 36501 }, - { 27507, 36302 }, - { 27508, 38896 }, - { 27512, 40804 }, - { 27513, 40805 }, - { 27515, 36480 }, - { 27519, 40806 }, - { 27520, 40807 }, - { 27523, 40809 }, - { 27524, 40808 }, - { 27526, 38519 }, - { 27529, 36733 }, - { 27530, 36586 }, - { 27531, 36451 }, - { 27533, 40810 }, - { 27541, 40812 }, - { 27542, 36930 }, - { 27544, 40811 }, - { 27550, 40813 }, - { 27556, 40814 }, - { 27562, 40815 }, - { 27563, 40816 }, - { 27567, 40817 }, - { 27569, 40819 }, - { 27570, 40818 }, - { 27571, 40820 }, - { 27572, 35235 }, - { 27573, 37481 }, - { 27575, 40821 }, - { 27578, 36421 }, - { 27579, 35435 }, - { 27580, 40822 }, - { 27583, 37729 }, - { 27584, 39626 }, - { 27589, 35650 }, - { 27590, 40823 }, - { 27595, 40824 }, - { 27597, 38378 }, - { 27598, 38536 }, - { 27602, 37829 }, - { 27603, 40825 }, - { 27604, 38116 }, - { 27606, 64244 }, - { 27608, 38137 }, - { 27611, 38609 }, - { 27615, 40826 }, - { 27627, 40828 }, - { 27628, 40827 }, - { 27631, 40830 }, - { 27635, 40829 }, - { 27656, 40833 }, - { 27663, 36481 }, - { 27665, 38575 }, - { 27667, 40834 }, - { 27668, 40835 }, - { 27671, 35651 }, - { 27675, 40836 }, - { 27683, 40838 }, - { 27684, 40837 }, - { 27700, 36997 }, - { 27703, 38232 }, - { 27704, 35177 }, - { 27710, 38083 }, - { 27711, 64245 }, - { 27712, 37619 }, - { 27713, 36704 }, - { 27714, 35713 }, - { 27726, 38084 }, - { 27728, 36524 }, - { 27733, 40840 }, - { 27735, 35518 }, - { 27738, 35224 }, - { 27740, 64246 }, - { 27741, 37872 }, - { 27742, 40839 }, - { 27743, 36189 }, - { 27744, 37490 }, - { 27746, 40841 }, - { 27752, 40849 }, - { 27754, 40842 }, - { 27759, 64248 }, - { 27760, 37311 }, - { 27762, 35714 }, - { 27763, 40850 }, - { 27770, 35976 }, - { 27773, 35652 }, - { 27774, 40848 }, - { 27777, 40846 }, - { 27778, 40843 }, - { 27779, 38784 }, - { 27782, 64247 }, - { 27784, 37566 }, - { 27788, 37847 }, - { 27789, 40844 }, - { 27792, 40852 }, - { 27794, 40851 }, - { 27795, 35906 }, - { 27798, 35243 }, - { 27801, 36281 }, - { 27802, 40845 }, - { 27803, 40847 }, - { 27809, 38518 }, - { 27810, 37362 }, - { 27819, 38551 }, - { 27822, 40860 }, - { 27825, 40861 }, - { 27827, 35277 }, - { 27832, 38310 }, - { 27833, 38651 }, - { 27834, 40863 }, - { 27835, 36513 }, - { 27836, 36800 }, - { 27837, 40856 }, - { 27838, 40862 }, - { 27839, 35208 }, - { 27841, 35765 }, - { 27844, 40853 }, - { 27845, 40858 }, - { 27849, 37106 }, - { 27850, 38033 }, - { 27852, 38117 }, - { 27859, 40855 }, - { 27861, 38464 }, - { 27863, 40857 }, - { 27865, 40866 }, - { 27866, 64249 }, - { 27867, 40864 }, - { 27869, 40859 }, - { 27873, 38465 }, - { 27874, 37991 }, - { 27875, 35715 }, - { 27877, 37700 }, - { 27880, 37517 }, - { 27882, 40867 }, - { 27887, 40865 }, - { 27888, 37335 }, - { 27889, 40854 }, - { 27891, 35178 }, - { 27908, 64250 }, - { 27915, 38765 }, - { 27916, 40878 }, - { 27922, 40877 }, - { 27927, 37108 }, - { 27929, 40874 }, - { 27931, 38796 }, - { 27934, 37812 }, - { 27935, 40868 }, - { 27941, 37571 }, - { 27945, 35179 }, - { 27946, 36190 }, - { 27947, 40871 }, - { 27954, 36678 }, - { 27955, 40876 }, - { 27957, 40875 }, - { 27958, 40870 }, - { 27960, 40873 }, - { 27963, 35464 }, - { 27965, 40872 }, - { 27966, 37992 }, - { 27969, 38828 }, - { 27972, 36850 }, - { 27973, 37107 }, - { 27993, 40884 }, - { 27994, 40882 }, - { 27996, 38252 }, - { 28003, 40879 }, - { 28004, 40881 }, - { 28006, 35161 }, - { 28009, 36191 }, - { 28010, 38993 }, - { 28012, 35420 }, - { 28014, 38274 }, - { 28015, 64252 }, - { 28020, 38785 }, - { 28023, 35395 }, - { 28024, 36954 }, - { 28025, 40883 }, - { 28037, 40888 }, - { 28039, 64251 }, - { 28040, 36801 }, - { 28044, 38735 }, - { 28046, 40885 }, - { 28051, 40880 }, - { 28053, 40886 }, - { 28054, 64320 }, - { 28057, 38876 }, - { 28059, 37779 }, - { 28060, 37824 }, - { 28076, 64321 }, - { 28079, 35413 }, - { 28082, 35188 }, - { 28085, 40892 }, - { 28088, 40895 }, - { 28092, 38849 }, - { 28096, 38788 }, - { 28101, 40902 }, - { 28102, 40896 }, - { 28103, 40893 }, - { 28107, 38866 }, - { 28108, 40899 }, - { 28111, 64322 }, - { 28113, 36713 }, - { 28114, 40901 }, - { 28117, 40906 }, - { 28120, 37777 }, - { 28121, 40904 }, - { 28126, 40898 }, - { 28129, 37463 }, - { 28132, 40905 }, - { 28134, 40894 }, - { 28136, 40900 }, - { 28138, 40907 }, - { 28139, 35066 }, - { 28140, 40897 }, - { 28142, 40908 }, - { 28145, 36955 }, - { 28146, 64324 }, - { 28147, 36734 }, - { 28149, 38307 }, - { 28151, 36268 }, - { 28152, 64323 }, - { 28153, 40889 }, - { 28154, 40903 }, - { 28155, 37721 }, - { 28156, 64325 }, - { 28165, 37044 }, - { 28167, 35465 }, - { 28168, 36303 }, - { 28169, 36802 }, - { 28170, 40891 }, - { 28171, 36705 }, - { 28179, 35947 }, - { 28181, 40890 }, - { 28185, 40912 }, - { 28186, 36749 }, - { 28187, 36024 }, - { 28189, 40927 }, - { 28191, 40921 }, - { 28192, 35732 }, - { 28193, 37742 }, - { 28195, 40916 }, - { 28196, 40925 }, - { 28197, 34989 }, - { 28198, 35153 }, - { 28199, 64328 }, - { 28201, 35255 }, - { 28203, 40918 }, - { 28204, 37290 }, - { 28205, 40909 }, - { 28206, 40911 }, - { 28207, 36192 }, - { 28216, 40928 }, - { 28217, 64326 }, - { 28218, 40923 }, - { 28220, 64329 }, - { 28222, 40915 }, - { 28227, 40922 }, - { 28234, 38569 }, - { 28237, 40920 }, - { 28238, 40924 }, - { 28246, 36046 }, - { 28248, 36803 }, - { 28251, 37464 }, - { 28252, 64327 }, - { 28255, 40914 }, - { 28263, 38734 }, - { 28267, 40917 }, - { 28270, 40910 }, - { 28271, 37778 }, - { 28274, 40913 }, - { 28278, 40919 }, - { 28286, 39024 }, - { 28287, 36540 }, - { 28288, 38558 }, - { 28290, 40929 }, - { 28300, 38060 }, - { 28303, 40941 }, - { 28304, 36025 }, - { 28310, 36736 }, - { 28312, 40931 }, - { 28316, 38829 }, - { 28317, 36193 }, - { 28319, 40944 }, - { 28322, 35052 }, - { 28325, 40942 }, - { 28330, 40930 }, - { 28335, 40936 }, - { 28338, 40938 }, - { 28342, 38766 }, - { 28343, 40933 }, - { 28346, 37709 }, - { 28349, 40935 }, - { 28351, 64330 }, - { 28354, 40943 }, - { 28356, 40937 }, - { 28357, 38597 }, - { 28361, 40932 }, - { 28363, 36512 }, - { 28364, 40956 }, - { 28369, 35466 }, - { 28371, 40934 }, - { 28372, 40939 }, - { 28373, 40940 }, - { 28381, 37354 }, - { 28382, 37336 }, - { 28396, 40948 }, - { 28399, 40954 }, - { 28402, 40952 }, - { 28404, 37704 }, - { 28407, 57410 }, - { 28408, 40949 }, - { 28414, 40950 }, - { 28415, 40926 }, - { 28417, 35737 }, - { 28418, 38233 }, - { 28422, 36541 }, - { 28425, 36247 }, - { 28431, 38994 }, - { 28433, 40946 }, - { 28435, 57409 }, - { 28436, 35209 }, - { 28437, 37254 }, - { 28448, 38041 }, - { 28450, 35519 }, - { 28451, 38904 }, - { 28459, 38559 }, - { 28460, 37584 }, - { 28465, 40953 }, - { 28466, 40955 }, - { 28472, 37201 }, - { 28478, 57408 }, - { 28479, 40951 }, - { 28481, 40945 }, - { 28485, 35521 }, - { 28500, 35977 }, - { 28504, 57422 }, - { 28507, 57417 }, - { 28508, 37110 }, - { 28511, 35459 }, - { 28516, 36737 }, - { 28518, 57426 }, - { 28525, 57419 }, - { 28526, 37546 }, - { 28527, 57416 }, - { 28528, 37591 }, - { 28532, 57451 }, - { 28536, 57413 }, - { 28538, 57412 }, - { 28540, 57421 }, - { 28544, 57415 }, - { 28545, 57414 }, - { 28546, 57420 }, - { 28548, 37023 }, - { 28550, 57411 }, - { 28552, 64331 }, - { 28558, 57423 }, - { 28561, 57424 }, - { 28567, 35520 }, - { 28577, 57429 }, - { 28579, 57428 }, - { 28580, 57430 }, - { 28586, 57433 }, - { 28593, 37730 }, - { 28595, 57427 }, - { 28597, 64332 }, - { 28601, 57431 }, - { 28608, 35971 }, - { 28609, 37367 }, - { 28610, 57425 }, - { 28611, 37978 }, - { 28614, 57432 }, - { 28628, 57437 }, - { 28629, 57435 }, - { 28632, 57438 }, - { 28635, 57441 }, - { 28639, 57434 }, - { 28640, 36234 }, - { 28641, 37959 }, - { 28644, 40887 }, - { 28651, 38804 }, - { 28652, 57436 }, - { 28654, 57440 }, - { 28655, 37363 }, - { 28657, 57439 }, - { 28659, 57418 }, - { 28661, 64333 }, - { 28662, 59529 }, - { 28666, 57444 }, - { 28670, 57448 }, - { 28673, 57446 }, - { 28677, 64334 }, - { 28679, 64335 }, - { 28681, 57442 }, - { 28683, 57443 }, - { 28687, 57447 }, - { 28689, 57445 }, - { 28693, 38253 }, - { 28696, 57453 }, - { 28698, 57450 }, - { 28699, 57449 }, - { 28701, 57452 }, - { 28702, 37842 }, - { 28703, 57454 }, - { 28710, 37525 }, - { 28711, 37355 }, - { 28712, 64336 }, - { 28716, 37027 }, - { 28720, 57455 }, - { 28722, 57457 }, - { 28734, 57456 }, - { 28748, 40947 }, - { 28753, 57458 }, - { 28760, 37861 }, - { 28771, 57459 }, - { 28779, 35278 }, - { 28783, 37780 }, - { 28784, 35396 }, - { 28792, 35716 }, - { 28796, 36572 }, - { 28797, 36304 }, - { 28805, 64337 }, - { 28809, 38982 }, - { 28810, 36998 }, - { 28814, 35210 }, - { 28818, 57461 }, - { 28825, 57460 }, - { 28843, 64338 }, - { 28844, 57464 }, - { 28845, 37465 }, - { 28846, 57467 }, - { 28847, 57462 }, - { 28851, 57466 }, - { 28856, 57465 }, - { 28857, 37727 }, - { 28858, 35031 }, - { 28859, 64098 }, - { 28872, 38899 }, - { 28875, 57469 }, - { 28879, 35143 }, - { 28889, 57472 }, - { 28893, 57470 }, - { 28895, 57468 }, - { 28913, 57463 }, - { 28921, 38466 }, - { 28925, 57474 }, - { 28932, 64340 }, - { 28937, 57473 }, - { 28943, 64339 }, - { 28948, 35211 }, - { 28953, 57476 }, - { 28954, 38320 }, - { 28956, 57475 }, - { 28961, 38579 }, - { 28966, 36805 }, - { 28982, 37202 }, - { 28988, 36804 }, - { 28998, 64342 }, - { 28999, 64343 }, - { 29001, 38905 }, - { 29004, 57482 }, - { 29006, 37111 }, - { 29013, 57478 }, - { 29014, 57483 }, - { 29017, 35212 }, - { 29020, 64341 }, - { 29026, 57481 }, - { 29028, 38017 }, - { 29029, 57477 }, - { 29030, 57480 }, - { 29031, 36806 }, - { 29033, 38095 }, - { 29036, 57484 }, - { 29038, 36559 }, - { 29053, 37112 }, - { 29060, 57487 }, - { 29064, 57479 }, - { 29066, 35910 }, - { 29071, 57485 }, - { 29076, 38767 }, - { 29077, 57488 }, - { 29081, 60068 }, - { 29087, 36718 }, - { 29096, 57489 }, - { 29100, 57490 }, - { 29105, 37965 }, - { 29113, 57492 }, - { 29118, 57493 }, - { 29121, 64345 }, - { 29123, 37970 }, - { 29128, 37781 }, - { 29129, 57495 }, - { 29134, 57497 }, - { 29136, 38867 }, - { 29138, 57494 }, - { 29140, 57496 }, - { 29141, 35213 }, - { 29143, 57491 }, - { 29151, 39546 }, - { 29152, 57498 }, - { 29157, 37255 }, - { 29158, 36439 }, - { 29159, 57500 }, - { 29164, 57499 }, - { 29165, 36931 }, - { 29166, 39383 }, - { 29173, 57501 }, - { 29177, 57503 }, - { 29179, 57486 }, - { 29180, 57502 }, - { 29182, 64346 }, - { 29183, 57504 }, - { 29190, 38042 }, - { 29197, 57505 }, - { 29200, 57506 }, - { 29211, 57507 }, - { 29224, 57508 }, - { 29226, 37596 }, - { 29228, 57510 }, - { 29229, 57509 }, - { 29232, 57511 }, - { 29234, 57512 }, - { 29237, 36573 }, - { 29238, 38275 }, - { 29242, 38634 }, - { 29243, 57513 }, - { 29244, 57514 }, - { 29245, 37237 }, - { 29246, 36514 }, - { 29247, 57515 }, - { 29248, 57516 }, - { 29254, 57517 }, - { 29255, 38352 }, - { 29256, 38085 }, - { 29259, 57518 }, - { 29260, 38006 }, - { 29266, 37547 }, - { 29272, 57519 }, - { 29273, 35301 }, - { 29275, 35725 }, - { 29277, 38596 }, - { 29279, 38580 }, - { 29281, 35250 }, - { 29282, 38995 }, - { 29287, 38513 }, - { 29289, 38312 }, - { 29298, 37045 }, - { 29300, 57520 }, - { 29305, 37825 }, - { 29309, 36001 }, - { 29310, 57521 }, - { 29312, 36306 }, - { 29313, 57523 }, - { 29314, 57522 }, - { 29319, 57524 }, - { 29330, 57525 }, - { 29334, 57526 }, - { 29344, 35677 }, - { 29346, 57527 }, - { 29351, 57528 }, - { 29356, 36002 }, - { 29359, 38086 }, - { 29361, 64347 }, - { 29362, 57530 }, - { 29366, 36851 }, - { 29369, 57529 }, - { 29374, 64348 }, - { 29378, 35766 }, - { 29379, 57531 }, - { 29380, 57533 }, - { 29382, 57532 }, - { 29390, 57534 }, - { 29392, 36047 }, - { 29394, 57535 }, - { 29399, 35815 }, - { 29401, 37215 }, - { 29403, 36253 }, - { 29408, 57537 }, - { 29409, 57538 }, - { 29410, 57536 }, - { 29417, 36587 }, - { 29420, 37830 }, - { 29421, 35767 }, - { 29431, 57540 }, - { 29432, 37451 }, - { 29433, 57539 }, - { 29436, 38996 }, - { 29437, 38018 }, - { 29450, 57543 }, - { 29462, 57545 }, - { 29463, 57542 }, - { 29467, 38610 }, - { 29468, 57544 }, - { 29469, 57546 }, - { 29471, 38850 }, - { 29476, 64349 }, - { 29477, 57550 }, - { 29481, 57549 }, - { 29482, 37526 }, - { 29483, 37964 }, - { 29486, 36003 }, - { 29487, 57548 }, - { 29492, 57547 }, - { 29494, 38736 }, - { 29495, 38737 }, - { 29502, 57551 }, - { 29503, 35214 }, - { 29508, 36246 }, - { 29509, 36482 }, - { 29518, 57552 }, - { 29519, 57553 }, - { 29527, 57555 }, - { 29539, 36706 }, - { 29544, 57557 }, - { 29546, 57556 }, - { 29552, 57558 }, - { 29554, 35436 }, - { 29557, 57560 }, - { 29559, 64351 }, - { 29560, 57559 }, - { 29562, 57562 }, - { 29563, 57561 }, - { 29572, 36026 }, - { 29575, 38822 }, - { 29577, 35786 }, - { 29579, 35236 }, - { 29590, 35816 }, - { 29609, 35551 }, - { 29618, 38886 }, - { 29619, 57564 }, - { 29627, 57566 }, - { 29629, 64352 }, - { 29632, 57567 }, - { 29634, 35279 }, - { 29640, 57563 }, - { 29641, 64353 }, - { 29642, 36440 }, - { 29645, 37567 }, - { 29646, 57565 }, - { 29650, 64356 }, - { 29654, 64354 }, - { 29662, 57570 }, - { 29664, 36588 }, - { 29667, 64355 }, - { 29669, 57568 }, - { 29674, 35933 }, - { 29677, 38087 }, - { 29678, 57569 }, - { 29681, 57596 }, - { 29685, 64358 }, - { 29688, 57575 }, - { 29694, 36027 }, - { 29699, 35717 }, - { 29701, 57572 }, - { 29702, 38813 }, - { 29703, 64357 }, - { 29705, 38830 }, - { 29730, 37364 }, - { 29733, 57574 }, - { 29734, 64359 }, - { 29737, 64361 }, - { 29738, 64360 }, - { 29742, 64362 }, - { 29746, 57576 }, - { 29747, 38868 }, - { 29748, 35797 }, - { 29749, 38138 }, - { 29750, 37993 }, - { 29754, 57577 }, - { 29759, 57579 }, - { 29761, 57582 }, - { 29781, 57578 }, - { 29785, 57581 }, - { 29786, 36072 }, - { 29787, 35180 }, - { 29788, 57583 }, - { 29790, 37008 }, - { 29791, 57580 }, - { 29792, 38874 }, - { 29794, 64363 }, - { 29795, 57586 }, - { 29796, 60066 }, - { 29801, 57584 }, - { 29802, 57587 }, - { 29807, 57573 }, - { 29808, 57585 }, - { 29811, 36282 }, - { 29814, 57588 }, - { 29822, 57589 }, - { 29827, 38814 }, - { 29833, 64364 }, - { 29835, 57590 }, - { 29854, 57591 }, - { 29855, 64365 }, - { 29858, 57571 }, - { 29863, 57592 }, - { 29872, 35522 }, - { 29885, 36515 }, - { 29898, 57593 }, - { 29903, 57594 }, - { 29908, 57595 }, - { 29916, 35162 }, - { 29920, 57664 }, - { 29922, 38234 }, - { 29923, 57665 }, - { 29926, 35490 }, - { 29927, 57666 }, - { 29929, 57667 }, - { 29934, 57668 }, - { 29936, 57670 }, - { 29937, 57671 }, - { 29938, 57669 }, - { 29942, 38258 }, - { 29943, 57673 }, - { 29944, 57672 }, - { 29953, 64366 }, - { 29955, 57675 }, - { 29956, 57674 }, - { 29957, 57676 }, - { 29964, 57677 }, - { 29965, 57679 }, - { 29966, 57678 }, - { 29969, 36249 }, - { 29971, 57681 }, - { 29973, 57680 }, - { 29976, 35523 }, - { 29978, 36978 }, - { 29980, 37723 }, - { 29982, 57682 }, - { 29983, 37046 }, - { 29987, 36441 }, - { 29989, 35225 }, - { 29990, 57683 }, - { 29992, 38768 }, - { 29995, 38369 }, - { 29996, 57684 }, - { 29999, 64168 }, - { 30000, 37731 }, - { 30001, 38738 }, - { 30002, 36194 }, - { 30003, 36956 }, - { 30007, 37482 }, - { 30008, 39346 }, - { 30010, 37548 }, - { 30011, 35302 }, - { 30012, 57685 }, - { 30020, 57686 }, - { 30022, 57691 }, - { 30025, 57689 }, - { 30026, 57688 }, - { 30027, 40384 }, - { 30028, 35397 }, - { 30029, 57687 }, - { 30031, 35032 }, - { 30033, 38056 }, - { 30036, 38088 }, - { 30041, 38831 }, - { 30042, 57692 }, - { 30043, 57690 }, - { 30044, 37499 }, - { 30045, 37028 }, - { 30048, 38057 }, - { 30050, 38220 }, - { 30052, 57694 }, - { 30053, 38826 }, - { 30054, 35948 }, - { 30055, 57695 }, - { 30057, 57693 }, - { 30058, 38100 }, - { 30059, 57696 }, - { 30061, 57697 }, - { 30063, 64367 }, - { 30064, 35033 }, - { 30067, 36852 }, - { 30068, 57702 }, - { 30070, 57699 }, - { 30071, 37867 }, - { 30072, 57698 }, - { 30079, 35653 }, - { 30082, 57705 }, - { 30086, 57700 }, - { 30087, 57701 }, - { 30089, 57704 }, - { 30090, 57703 }, - { 30091, 38212 }, - { 30094, 37217 }, - { 30095, 37216 }, - { 30097, 35678 }, - { 30100, 57706 }, - { 30106, 57707 }, - { 30109, 57708 }, - { 30115, 57710 }, - { 30117, 57709 }, - { 30123, 35189 }, - { 30129, 57718 }, - { 30130, 38118 }, - { 30131, 57712 }, - { 30133, 57714 }, - { 30136, 57716 }, - { 30137, 36957 }, - { 30140, 57717 }, - { 30141, 57715 }, - { 30142, 36542 }, - { 30146, 57711 }, - { 30147, 57713 }, - { 30149, 38241 }, - { 30151, 36807 }, - { 30154, 57720 }, - { 30157, 57719 }, - { 30162, 57721 }, - { 30164, 36516 }, - { 30165, 36269 }, - { 30168, 37783 }, - { 30169, 57722 }, - { 30171, 37577 }, - { 30174, 57724 }, - { 30178, 38815 }, - { 30179, 57723 }, - { 30185, 37257 }, - { 30192, 57730 }, - { 30194, 57732 }, - { 30195, 57733 }, - { 30196, 37491 }, - { 30202, 57731 }, - { 30204, 57728 }, - { 30206, 57725 }, - { 30207, 57726 }, - { 30209, 57729 }, - { 30217, 57736 }, - { 30219, 57734 }, - { 30221, 57735 }, - { 30239, 57737 }, - { 30240, 57739 }, - { 30241, 57740 }, - { 30242, 57741 }, - { 30244, 57742 }, - { 30247, 57738 }, - { 30256, 57744 }, - { 30260, 57743 }, - { 30267, 57745 }, - { 30274, 38851 }, - { 30278, 57748 }, - { 30279, 57746 }, - { 30280, 57747 }, - { 30284, 35552 }, - { 30290, 38652 }, - { 30294, 38344 }, - { 30296, 57750 }, - { 30300, 57749 }, - { 30305, 57751 }, - { 30306, 57752 }, - { 30311, 57756 }, - { 30312, 57753 }, - { 30313, 57754 }, - { 30314, 57755 }, - { 30316, 57757 }, - { 30320, 57758 }, - { 30322, 57759 }, - { 30326, 57760 }, - { 30328, 57761 }, - { 30330, 38061 }, - { 30331, 37743 }, - { 30332, 57762 }, - { 30333, 38034 }, - { 30334, 38227 }, - { 30336, 57763 }, - { 30338, 64368 }, - { 30339, 57764 }, - { 30340, 37705 }, - { 30342, 35398 }, - { 30343, 36195 }, - { 30344, 57765 }, - { 30347, 57766 }, - { 30350, 57767 }, - { 30352, 36424 }, - { 30355, 57769 }, - { 30358, 57768 }, - { 30361, 57770 }, - { 30362, 57771 }, - { 30363, 64371 }, - { 30364, 64369 }, - { 30366, 64370 }, - { 30374, 64372 }, - { 30382, 38119 }, - { 30384, 57772 }, - { 30388, 57773 }, - { 30391, 60041 }, - { 30392, 57774 }, - { 30393, 57775 }, - { 30394, 57776 }, - { 30399, 36429 }, - { 30402, 57777 }, - { 30403, 38005 }, - { 30406, 38526 }, - { 30408, 35181 }, - { 30410, 35190 }, - { 30413, 57778 }, - { 30418, 57780 }, - { 30422, 57779 }, - { 30423, 37776 }, - { 30427, 37047 }, - { 30428, 40792 }, - { 30430, 57781 }, - { 30431, 38591 }, - { 30433, 57782 }, - { 30435, 35524 }, - { 30436, 38101 }, - { 30437, 57783 }, - { 30439, 57784 }, - { 30442, 57785 }, - { 30446, 38618 }, - { 30450, 38611 }, - { 30452, 37564 }, - { 30456, 37258 }, - { 30459, 57787 }, - { 30462, 36738 }, - { 30465, 36808 }, - { 30468, 57790 }, - { 30471, 57789 }, - { 30472, 57788 }, - { 30473, 38139 }, - { 30475, 35525 }, - { 30476, 36007 }, - { 30491, 57796 }, - { 30494, 57793 }, - { 30495, 36958 }, - { 30496, 38576 }, - { 30500, 57792 }, - { 30501, 57794 }, - { 30502, 57795 }, - { 30505, 57791 }, - { 30519, 57797 }, - { 30520, 57798 }, - { 30522, 37549 }, - { 30524, 35553 }, - { 30528, 37509 }, - { 30534, 64374 }, - { 30535, 57799 }, - { 30554, 57800 }, - { 30555, 57803 }, - { 30561, 36999 }, - { 30563, 37826 }, - { 30565, 57804 }, - { 30566, 38514 }, - { 30568, 57801 }, - { 30571, 57802 }, - { 30585, 57807 }, - { 30590, 57806 }, - { 30591, 57805 }, - { 30603, 57809 }, - { 30606, 57808 }, - { 30609, 57810 }, - { 30622, 57812 }, - { 30624, 57811 }, - { 30629, 38347 }, - { 30636, 36725 }, - { 30637, 38852 }, - { 30640, 57813 }, - { 30643, 37813 }, - { 30646, 57814 }, - { 30649, 57815 }, - { 30651, 57819 }, - { 30652, 57817 }, - { 30653, 57818 }, - { 30655, 57816 }, - { 30663, 57820 }, - { 30669, 57821 }, - { 30679, 57822 }, - { 30682, 57823 }, - { 30683, 38581 }, - { 30684, 57824 }, - { 30690, 38638 }, - { 30691, 57825 }, - { 30693, 37485 }, - { 30695, 38026 }, - { 30697, 35817 }, - { 30701, 37466 }, - { 30702, 57826 }, - { 30703, 35768 }, - { 30707, 37070 }, - { 30716, 57827 }, - { 30722, 36283 }, - { 30732, 57828 }, - { 30738, 57829 }, - { 30740, 36004 }, - { 30741, 36307 }, - { 30752, 57831 }, - { 30753, 64376 }, - { 30757, 37749 }, - { 30758, 36308 }, - { 30759, 35693 }, - { 30770, 38467 }, - { 30772, 37994 }, - { 30778, 37750 }, - { 30783, 36219 }, - { 30789, 57833 }, - { 30798, 64377 }, - { 30813, 36809 }, - { 30820, 64378 }, - { 30827, 38832 }, - { 30828, 36196 }, - { 30831, 36005 }, - { 30834, 38049 }, - { 30836, 57835 }, - { 30842, 64379 }, - { 30844, 57837 }, - { 30849, 36073 }, - { 30854, 57836 }, - { 30855, 37620 }, - { 30860, 57839 }, - { 30861, 35414 }, - { 30862, 57834 }, - { 30865, 38120 }, - { 30867, 35151 }, - { 30869, 36330 }, - { 30871, 39025 }, - { 30874, 57838 }, - { 30883, 57840 }, - { 30887, 38345 }, - { 30889, 37079 }, - { 30890, 57842 }, - { 30895, 57843 }, - { 30901, 57841 }, - { 30906, 35437 }, - { 30908, 57849 }, - { 30910, 57848 }, - { 30913, 36517 }, - { 30917, 57850 }, - { 30918, 57845 }, - { 30922, 57851 }, - { 30923, 57846 }, - { 30928, 38102 }, - { 30929, 57844 }, - { 30932, 57847 }, - { 30938, 57921 }, - { 30951, 57920 }, - { 30952, 38529 }, - { 30956, 57852 }, - { 30959, 35049 }, - { 30964, 57923 }, - { 30973, 57922 }, - { 30977, 36810 }, - { 30983, 57924 }, - { 30990, 37218 }, - { 30993, 57926 }, - { 30994, 57925 }, - { 31001, 57927 }, - { 31014, 57830 }, - { 31018, 57832 }, - { 31019, 57929 }, - { 31020, 57928 }, - { 31024, 64380 }, - { 31034, 36518 }, - { 31036, 38887 }, - { 31038, 36560 }, - { 31040, 57930 }, - { 31041, 35926 }, - { 31047, 35679 }, - { 31048, 35654 }, - { 31049, 36483 }, - { 31056, 38739 }, - { 31059, 57936 }, - { 31061, 57935 }, - { 31062, 37219 }, - { 31063, 57932 }, - { 31066, 57934 }, - { 31069, 36714 }, - { 31070, 36959 }, - { 31071, 57933 }, - { 31072, 57931 }, - { 31074, 37961 }, - { 31077, 36811 }, - { 31080, 38235 }, - { 31085, 36309 }, - { 31095, 37784 }, - { 31098, 57937 }, - { 31103, 57938 }, - { 31104, 57960 }, - { 31105, 35798 }, - { 31108, 39004 }, - { 31109, 37204 }, - { 31114, 57939 }, - { 31117, 35280 }, - { 31118, 37621 }, - { 31119, 38303 }, - { 31124, 64385 }, - { 31131, 64387 }, - { 31133, 57940 }, - { 31142, 35738 }, - { 31143, 57941 }, - { 31146, 57943 }, - { 31150, 57944 }, - { 31152, 37960 }, - { 31155, 57945 }, - { 31161, 57946 }, - { 31162, 57947 }, - { 31165, 35799 }, - { 31166, 35281 }, - { 31167, 37827 }, - { 31168, 36679 }, - { 31169, 36484 }, - { 31177, 57948 }, - { 31179, 36680 }, - { 31185, 35272 }, - { 31186, 38242 }, - { 31189, 57949 }, - { 31192, 38121 }, - { 31199, 37220 }, - { 31201, 57952 }, - { 31203, 57953 }, - { 31204, 38025 }, - { 31206, 36960 }, - { 31207, 57950 }, - { 31209, 37505 }, - { 31212, 57951 }, - { 31216, 36812 }, - { 31227, 35034 }, - { 31232, 35656 }, - { 31240, 57954 }, - { 31243, 37622 }, - { 31245, 57955 }, - { 31246, 37061 }, - { 31252, 38571 }, - { 31255, 38210 }, - { 31256, 57956 }, - { 31257, 57957 }, - { 31258, 37492 }, - { 31260, 38853 }, - { 31263, 57959 }, - { 31264, 57958 }, - { 31278, 36589 }, - { 31281, 57961 }, - { 31282, 35054 }, - { 31287, 57964 }, - { 31291, 57962 }, - { 31292, 35282 }, - { 31293, 35949 }, - { 31294, 57963 }, - { 31295, 36197 }, - { 31296, 36242 }, - { 31298, 38372 }, - { 31299, 57965 }, - { 31302, 38515 }, - { 31305, 57967 }, - { 31309, 37071 }, - { 31310, 35182 }, - { 31311, 35256 }, - { 31312, 34986 }, - { 31319, 57966 }, - { 31329, 57968 }, - { 31330, 57969 }, - { 31331, 36853 }, - { 31337, 57970 }, - { 31339, 35438 }, - { 31344, 57972 }, - { 31348, 35978 }, - { 31350, 35718 }, - { 31353, 57973 }, - { 31354, 35827 }, - { 31357, 57974 }, - { 31359, 37114 }, - { 31361, 37835 }, - { 31363, 37086 }, - { 31364, 36339 }, - { 31368, 57975 }, - { 31378, 37506 }, - { 31379, 37259 }, - { 31381, 57977 }, - { 31382, 57979 }, - { 31383, 57976 }, - { 31384, 57978 }, - { 31391, 35905 }, - { 31401, 57980 }, - { 31402, 35909 }, - { 31406, 35719 }, - { 31407, 38769 }, - { 31408, 57982 }, - { 31414, 57984 }, - { 31418, 35149 }, - { 31423, 57987 }, - { 31427, 35478 }, - { 31428, 57986 }, - { 31429, 57985 }, - { 31431, 57989 }, - { 31432, 57981 }, - { 31434, 57990 }, - { 31435, 38823 }, - { 31437, 57991 }, - { 31439, 57992 }, - { 31441, 64388 }, - { 31442, 39666 }, - { 31443, 57994 }, - { 31445, 57993 }, - { 31449, 57995 }, - { 31450, 57996 }, - { 31452, 38835 }, - { 31453, 57997 }, - { 31455, 59629 }, - { 31456, 36813 }, - { 31457, 57998 }, - { 31458, 57999 }, - { 31459, 36726 }, - { 31461, 37814 }, - { 31462, 58000 }, - { 31463, 64389 }, - { 31466, 37447 }, - { 31467, 64391 }, - { 31469, 58001 }, - { 31471, 37467 }, - { 31472, 58002 }, - { 31478, 35747 }, - { 31480, 39262 }, - { 31481, 37500 }, - { 31482, 36529 }, - { 31487, 35526 }, - { 31490, 58003 }, - { 31492, 58016 }, - { 31494, 58006 }, - { 31496, 35720 }, - { 31498, 58005 }, - { 31499, 58018 }, - { 31503, 58004 }, - { 31505, 36814 }, - { 31512, 58008 }, - { 31513, 58009 }, - { 31515, 37706 }, - { 31518, 58010 }, - { 31520, 35453 }, - { 31525, 36985 }, - { 31526, 38276 }, - { 31528, 58012 }, - { 31532, 37350 }, - { 31539, 58007 }, - { 31541, 58011 }, - { 31542, 58013 }, - { 31545, 36345 }, - { 31557, 58020 }, - { 31558, 38221 }, - { 31560, 38052 }, - { 31561, 37785 }, - { 31563, 35800 }, - { 31564, 58019 }, - { 31565, 58017 }, - { 31567, 38067 }, - { 31568, 58014 }, - { 31569, 37501 }, - { 31570, 37787 }, - { 31572, 37786 }, - { 31574, 36340 }, - { 31581, 58038 }, - { 31589, 58022 }, - { 31591, 58024 }, - { 31596, 58027 }, - { 31598, 58028 }, - { 31600, 58025 }, - { 31601, 58026 }, - { 31604, 58023 }, - { 31605, 58021 }, - { 31610, 58015 }, - { 31622, 38349 }, - { 31623, 35283 }, - { 31627, 58035 }, - { 31629, 58032 }, - { 31631, 58037 }, - { 31634, 58036 }, - { 31636, 38035 }, - { 31637, 38565 }, - { 31639, 36442 }, - { 31640, 58030 }, - { 31641, 58039 }, - { 31642, 58034 }, - { 31644, 58033 }, - { 31645, 58029 }, - { 31646, 64392 }, - { 31647, 58031 }, - { 31649, 35527 }, - { 31658, 37468 }, - { 31661, 37115 }, - { 31665, 38048 }, - { 31668, 58044 }, - { 31672, 38050 }, - { 31680, 37087 }, - { 31681, 58041 }, - { 31684, 38093 }, - { 31686, 58045 }, - { 31687, 38353 }, - { 31689, 37498 }, - { 31691, 58040 }, - { 31692, 58042 }, - { 31695, 58043 }, - { 31709, 58046 }, - { 31712, 36546 }, - { 31716, 37828 }, - { 31717, 58051 }, - { 31718, 58050 }, - { 31721, 58047 }, - { 31725, 38997 }, - { 31731, 58056 }, - { 31734, 58060 }, - { 31735, 58057 }, - { 31744, 58053 }, - { 31751, 58054 }, - { 31757, 58059 }, - { 31761, 58048 }, - { 31762, 39379 }, - { 31763, 58055 }, - { 31764, 58049 }, - { 31767, 58058 }, - { 31775, 58064 }, - { 31777, 35528 }, - { 31779, 58061 }, - { 31783, 58062 }, - { 31786, 58063 }, - { 31787, 58066 }, - { 31799, 58065 }, - { 31800, 38132 }, - { 31805, 58067 }, - { 31806, 38906 }, - { 31807, 38379 }, - { 31808, 58072 }, - { 31811, 58069 }, - { 31820, 58068 }, - { 31821, 37072 }, - { 31823, 58071 }, - { 31824, 58073 }, - { 31828, 58070 }, - { 31830, 58077 }, - { 31832, 58074 }, - { 31839, 58075 }, - { 31840, 58052 }, - { 31844, 58076 }, - { 31845, 58078 }, - { 31852, 58079 }, - { 31859, 38340 }, - { 31861, 58080 }, - { 31870, 38624 }, - { 31873, 35788 }, - { 31874, 35912 }, - { 31875, 58081 }, - { 31881, 38322 }, - { 31883, 37000 }, - { 31885, 38574 }, - { 31888, 58082 }, - { 31890, 38833 }, - { 31893, 38036 }, - { 31895, 37221 }, - { 31896, 37971 }, - { 31899, 36716 }, - { 31903, 35006 }, - { 31905, 58087 }, - { 31906, 58085 }, - { 31908, 58083 }, - { 31909, 35487 }, - { 31911, 36815 }, - { 31912, 58088 }, - { 31915, 58086 }, - { 31917, 58084 }, - { 31918, 58092 }, - { 31921, 58091 }, - { 31922, 58090 }, - { 31923, 58089 }, - { 31929, 58093 }, - { 31933, 58094 }, - { 31934, 37048 }, - { 31936, 58095 }, - { 31938, 58097 }, - { 31941, 58096 }, - { 31946, 36048 }, - { 31950, 37207 }, - { 31954, 58099 }, - { 31958, 37788 }, - { 31960, 58098 }, - { 31964, 58100 }, - { 31966, 38323 }, - { 31967, 37260 }, - { 31968, 36198 }, - { 31970, 58101 }, - { 31975, 38854 }, - { 31983, 58103 }, - { 31986, 58104 }, - { 31988, 58105 }, - { 31990, 58106 }, - { 31992, 36485 }, - { 31994, 58107 }, - { 31995, 35950 }, - { 31998, 35722 }, - { 32000, 35657 }, - { 32002, 58176 }, - { 32004, 38641 }, - { 32005, 36199 }, - { 32006, 58108 }, - { 32010, 58179 }, - { 32011, 38628 }, - { 32013, 37979 }, - { 32016, 38226 }, - { 32020, 36739 }, - { 32021, 58178 }, - { 32023, 36561 }, - { 32024, 36200 }, - { 32025, 36486 }, - { 32026, 35721 }, - { 32027, 38324 }, - { 32028, 58177 }, - { 32032, 37222 }, - { 32033, 38497 }, - { 32034, 36341 }, - { 32043, 36487 }, - { 32044, 37595 }, - { 32046, 58182 }, - { 32047, 38877 }, - { 32048, 36311 }, - { 32050, 58183 }, - { 32051, 36961 }, - { 32053, 58185 }, - { 32057, 36816 }, - { 32058, 36270 }, - { 32063, 58184 }, - { 32066, 36681 }, - { 32067, 36028 }, - { 32068, 37223 }, - { 32069, 58180 }, - { 32070, 58186 }, - { 32072, 64394 }, - { 32075, 58181 }, - { 32076, 35951 }, - { 32078, 58189 }, - { 32079, 58193 }, - { 32080, 35979 }, - { 32086, 58188 }, - { 32091, 58197 }, - { 32092, 64395 }, - { 32094, 36201 }, - { 32097, 38797 }, - { 32098, 35002 }, - { 32099, 58194 }, - { 32102, 35723 }, - { 32104, 58191 }, - { 32110, 58192 }, - { 32113, 37789 }, - { 32114, 58190 }, - { 32115, 58187 }, - { 32117, 35399 }, - { 32118, 37090 }, - { 32121, 36006 }, - { 32125, 58199 }, - { 32137, 58196 }, - { 32143, 58198 }, - { 32147, 58195 }, - { 32153, 35952 }, - { 32154, 37297 }, - { 32155, 58200 }, - { 32156, 37262 }, - { 32159, 58213 }, - { 32160, 64397 }, - { 32162, 58209 }, - { 32163, 58203 }, - { 32171, 58207 }, - { 32172, 36600 }, - { 32173, 35035 }, - { 32174, 58202 }, - { 32175, 58210 }, - { 32176, 58214 }, - { 32177, 36202 }, - { 32178, 38612 }, - { 32180, 37588 }, - { 32181, 58204 }, - { 32183, 64396 }, - { 32184, 58212 }, - { 32186, 58201 }, - { 32187, 37469 }, - { 32189, 58206 }, - { 32190, 35003 }, - { 32191, 38600 }, - { 32199, 58205 }, - { 32202, 35801 }, - { 32203, 38122 }, - { 32207, 37261 }, - { 32209, 38862 }, - { 32210, 36751 }, - { 32213, 58254 }, - { 32214, 64398 }, - { 32216, 58215 }, - { 32218, 37116 }, - { 32220, 58211 }, - { 32221, 58216 }, - { 32222, 58218 }, - { 32224, 37623 }, - { 32225, 58221 }, - { 32228, 58217 }, - { 32232, 38354 }, - { 32233, 35529 }, - { 32236, 38601 }, - { 32239, 35036 }, - { 32242, 58220 }, - { 32244, 38907 }, - { 32251, 58219 }, - { 32257, 35215 }, - { 32260, 37866 }, - { 32261, 58222 }, - { 32265, 58229 }, - { 32266, 58223 }, - { 32267, 58230 }, - { 32274, 58226 }, - { 32283, 38043 }, - { 32286, 36552 }, - { 32287, 58228 }, - { 32289, 58225 }, - { 32290, 58231 }, - { 32291, 58224 }, - { 32294, 36707 }, - { 32299, 38468 }, - { 32302, 36715 }, - { 32305, 58227 }, - { 32306, 58240 }, - { 32309, 58235 }, - { 32311, 58238 }, - { 32313, 58236 }, - { 32314, 58241 }, - { 32315, 58234 }, - { 32317, 58208 }, - { 32318, 37073 }, - { 32321, 38089 }, - { 32323, 58237 }, - { 32326, 58232 }, - { 32330, 37184 }, - { 32331, 35953 }, - { 32333, 36682 }, - { 32338, 64399 }, - { 32340, 36932 }, - { 32341, 37205 }, - { 32342, 58244 }, - { 32345, 58246 }, - { 32346, 58247 }, - { 32349, 58243 }, - { 32350, 58245 }, - { 32358, 58233 }, - { 32359, 58242 }, - { 32361, 58250 }, - { 32362, 58249 }, - { 32365, 38554 }, - { 32368, 35914 }, - { 32377, 58248 }, - { 32379, 58252 }, - { 32380, 58251 }, - { 32381, 58255 }, - { 32383, 58257 }, - { 32386, 36443 }, - { 32387, 58253 }, - { 32392, 58258 }, - { 32393, 58259 }, - { 32394, 64092 }, - { 32396, 58260 }, - { 32398, 58266 }, - { 32399, 37722 }, - { 32400, 58262 }, - { 32402, 58261 }, - { 32403, 58263 }, - { 32404, 58264 }, - { 32406, 58265 }, - { 32411, 58267 }, - { 32412, 58268 }, - { 32566, 35530 }, - { 32568, 58269 }, - { 32570, 58270 }, - { 32581, 58271 }, - { 32583, 64400 }, - { 32588, 58272 }, - { 32589, 58273 }, - { 32590, 58274 }, - { 32592, 58275 }, - { 32593, 58276 }, - { 32596, 58278 }, - { 32597, 58277 }, - { 32600, 58279 }, - { 32607, 58280 }, - { 32608, 58281 }, - { 32615, 58284 }, - { 32616, 58282 }, - { 32617, 58283 }, - { 32618, 36319 }, - { 32619, 35954 }, - { 32622, 37493 }, - { 32624, 38065 }, - { 32626, 36752 }, - { 32629, 37996 }, - { 32631, 38123 }, - { 32632, 58285 }, - { 32633, 40171 }, - { 32642, 58286 }, - { 32643, 58288 }, - { 32645, 38789 }, - { 32646, 58287 }, - { 32647, 58290 }, - { 32648, 58289 }, - { 32650, 38770 }, - { 32652, 58291 }, - { 32654, 38140 }, - { 32660, 58292 }, - { 32666, 58295 }, - { 32669, 58294 }, - { 32670, 58293 }, - { 32673, 64401 }, - { 32675, 58296 }, - { 32676, 35921 }, - { 32680, 37185 }, - { 32681, 35680 }, - { 32686, 58300 }, - { 32687, 58297 }, - { 32690, 58298 }, - { 32694, 58301 }, - { 32696, 58302 }, - { 32697, 58299 }, - { 32701, 35144 }, - { 32705, 35237 }, - { 32709, 58304 }, - { 32710, 58305 }, - { 32714, 58306 }, - { 32716, 38786 }, - { 32722, 36683 }, - { 32724, 58308 }, - { 32725, 58307 }, - { 32736, 37001 }, - { 32737, 58309 }, - { 32742, 58310 }, - { 32745, 58311 }, - { 32747, 35555 }, - { 32752, 35531 }, - { 32755, 58312 }, - { 32761, 58313 }, - { 32763, 38524 }, - { 32764, 38787 }, - { 32768, 38771 }, - { 32769, 38998 }, - { 32771, 36204 }, - { 32772, 58316 }, - { 32773, 36562 }, - { 32774, 58315 }, - { 32779, 58317 }, - { 32780, 36519 }, - { 32784, 37327 }, - { 32786, 58318 }, - { 32789, 36203 }, - { 32791, 38613 }, - { 32792, 58319 }, - { 32793, 58320 }, - { 32796, 58321 }, - { 32801, 58322 }, - { 32808, 58323 }, - { 32819, 36520 }, - { 32822, 38635 }, - { 32827, 58325 }, - { 32829, 37470 }, - { 32831, 58324 }, - { 32838, 58327 }, - { 32842, 58326 }, - { 32850, 58328 }, - { 32854, 37049 }, - { 32856, 58329 }, - { 32858, 58330 }, - { 32862, 38327 }, - { 32863, 58331 }, - { 32865, 37263 }, - { 32866, 58332 }, - { 32872, 58333 }, - { 32879, 38908 }, - { 32880, 58336 }, - { 32882, 58335 }, - { 32883, 58334 }, - { 32884, 37550 }, - { 32886, 58337 }, - { 32887, 36933 }, - { 32889, 58338 }, - { 32893, 58339 }, - { 32894, 38999 }, - { 32895, 58340 }, - { 32900, 58341 }, - { 32901, 58343 }, - { 32902, 58342 }, - { 32903, 38051 }, - { 32905, 37879 }, - { 32907, 39005 }, - { 32908, 38055 }, - { 32915, 58345 }, - { 32918, 36817 }, - { 32920, 38217 }, - { 32922, 58346 }, - { 32923, 58344 }, - { 32925, 35532 }, - { 32929, 36050 }, - { 32930, 36488 }, - { 32933, 38124 }, - { 32937, 36008 }, - { 32938, 38498 }, - { 32940, 58349 }, - { 32941, 58347 }, - { 32943, 36205 }, - { 32945, 36206 }, - { 32946, 35047 }, - { 32948, 36326 }, - { 32954, 38008 }, - { 32963, 35037 }, - { 32964, 58354 }, - { 32966, 37471 }, - { 32972, 38007 }, - { 32974, 37337 }, - { 32982, 58356 }, - { 32985, 58352 }, - { 32986, 58355 }, - { 32987, 58350 }, - { 32989, 58353 }, - { 32990, 38469 }, - { 32993, 36051 }, - { 32996, 35067 }, - { 32997, 58351 }, - { 33007, 58358 }, - { 33009, 58359 }, - { 33012, 37815 }, - { 33016, 35769 }, - { 33020, 58437 }, - { 33021, 37980 }, - { 33026, 36489 }, - { 33029, 35770 }, - { 33030, 37062 }, - { 33031, 39013 }, - { 33032, 38572 }, - { 33033, 58357 }, - { 33034, 37074 }, - { 33050, 35698 }, - { 33051, 58360 }, - { 33059, 58362 }, - { 33065, 58361 }, - { 33071, 58363 }, - { 33073, 37445 }, - { 33075, 37981 }, - { 33081, 37551 }, - { 33086, 58434 }, - { 33094, 58433 }, - { 33099, 58364 }, - { 33102, 36980 }, - { 33104, 38277 }, - { 33105, 58436 }, - { 33107, 58435 }, - { 33108, 36207 }, - { 33109, 39026 }, - { 33119, 58452 }, - { 33125, 58440 }, - { 33126, 58441 }, - { 33131, 36590 }, - { 33134, 58439 }, - { 33136, 36248 }, - { 33137, 58438 }, - { 33140, 58442 }, - { 33144, 37552 }, - { 33145, 38304 }, - { 33146, 37186 }, - { 33151, 37338 }, - { 33152, 58446 }, - { 33154, 58447 }, - { 33155, 58443 }, - { 33160, 58444 }, - { 33162, 58445 }, - { 33167, 36208 }, - { 33171, 58453 }, - { 33173, 58449 }, - { 33178, 38278 }, - { 33180, 38540 }, - { 33181, 38215 }, - { 33184, 58448 }, - { 33187, 58451 }, - { 33188, 58450 }, - { 33192, 38499 }, - { 33193, 58454 }, - { 33200, 58455 }, - { 33203, 37206 }, - { 33205, 58456 }, - { 33208, 58458 }, - { 33210, 58462 }, - { 33213, 58459 }, - { 33214, 58457 }, - { 33215, 37982 }, - { 33216, 58460 }, - { 33218, 58461 }, - { 33222, 35248 }, - { 33224, 58468 }, - { 33225, 58463 }, - { 33229, 58464 }, - { 33233, 58465 }, - { 33235, 37279 }, - { 33240, 58467 }, - { 33241, 58466 }, - { 33242, 58469 }, - { 33247, 58470 }, - { 33248, 58471 }, - { 33251, 36962 }, - { 33253, 35303 }, - { 33255, 58472 }, - { 33256, 38869 }, - { 33258, 36521 }, - { 33261, 36684 }, - { 33267, 36490 }, - { 33268, 37494 }, - { 33274, 58473 }, - { 33275, 58474 }, - { 33276, 35152 }, - { 33278, 58475 }, - { 33281, 58476 }, - { 33282, 58477 }, - { 33285, 58478 }, - { 33287, 58479 }, - { 33288, 35771 }, - { 33289, 40360 }, - { 33290, 58480 }, - { 33292, 37091 }, - { 33293, 58481 }, - { 33294, 36553 }, - { 33296, 58482 }, - { 33298, 39086 }, - { 33302, 58483 }, - { 33303, 38364 }, - { 33304, 35546 }, - { 33307, 37187 }, - { 33308, 36727 }, - { 33310, 38289 }, - { 33311, 36685 }, - { 33321, 58484 }, - { 33322, 36209 }, - { 33323, 58485 }, - { 33324, 38090 }, - { 33326, 58500 }, - { 33331, 58487 }, - { 33333, 37319 }, - { 33334, 38037 }, - { 33335, 36029 }, - { 33336, 58486 }, - { 33337, 37188 }, - { 33344, 58488 }, - { 33351, 37624 }, - { 33368, 58490 }, - { 33369, 58489 }, - { 33370, 58492 }, - { 33373, 58491 }, - { 33375, 58493 }, - { 33378, 58496 }, - { 33380, 58494 }, - { 33382, 35533 }, - { 33384, 58497 }, - { 33386, 58498 }, - { 33387, 58499 }, - { 33390, 36271 }, - { 33391, 38855 }, - { 33393, 58501 }, - { 33394, 36934 }, - { 33398, 35216 }, - { 33399, 58502 }, - { 33400, 58503 }, - { 33406, 58504 }, - { 33419, 35056 }, - { 33421, 58505 }, - { 33426, 58506 }, - { 33433, 38279 }, - { 33437, 36549 }, - { 33439, 58508 }, - { 33445, 35400 }, - { 33446, 34992 }, - { 33451, 58507 }, - { 33452, 58510 }, - { 33453, 37997 }, - { 33455, 36963 }, - { 33457, 35284 }, - { 33459, 38470 }, - { 33464, 35964 }, - { 33465, 35802 }, - { 33467, 58509 }, - { 33469, 35304 }, - { 33477, 35489 }, - { 33489, 35217 }, - { 33490, 58514 }, - { 33491, 38888 }, - { 33492, 37339 }, - { 33495, 38243 }, - { 33497, 58526 }, - { 33499, 35285 }, - { 33500, 58524 }, - { 33502, 58522 }, - { 33503, 58513 }, - { 33505, 58511 }, - { 33507, 58512 }, - { 33509, 36577 }, - { 33510, 35818 }, - { 33511, 37527 }, - { 33515, 37839 }, - { 33521, 35184 }, - { 33523, 58516 }, - { 33524, 58515 }, - { 33529, 58521 }, - { 33530, 58517 }, - { 33531, 58520 }, - { 33537, 64403 }, - { 33538, 38606 }, - { 33539, 58519 }, - { 33540, 35286 }, - { 33541, 35485 }, - { 33542, 58523 }, - { 33545, 58525 }, - { 33550, 35955 }, - { 33558, 58529 }, - { 33559, 58538 }, - { 33560, 58539 }, - { 33564, 34985 }, - { 33571, 58546 }, - { 33576, 35055 }, - { 33579, 58537 }, - { 33583, 58536 }, - { 33585, 58531 }, - { 33586, 58530 }, - { 33588, 58528 }, - { 33589, 58527 }, - { 33590, 37507 }, - { 33592, 37369 }, - { 33593, 58533 }, - { 33600, 58532 }, - { 33605, 58535 }, - { 33609, 37264 }, - { 33610, 35956 }, - { 33615, 35168 }, - { 33616, 58534 }, - { 33618, 36210 }, - { 33624, 37265 }, - { 33634, 64404 }, - { 33651, 58552 }, - { 33653, 58553 }, - { 33655, 35287 }, - { 33659, 35244 }, - { 33660, 58550 }, - { 33663, 64405 }, - { 33669, 58540 }, - { 33671, 58548 }, - { 33673, 58555 }, - { 33674, 58549 }, - { 33678, 58547 }, - { 33683, 58518 }, - { 33686, 58545 }, - { 33690, 58541 }, - { 33694, 35534 }, - { 33695, 58543 }, - { 33696, 58554 }, - { 33698, 58544 }, - { 33704, 58556 }, - { 33706, 58542 }, - { 33707, 38044 }, - { 33713, 38793 }, - { 33717, 58551 }, - { 33725, 58573 }, - { 33729, 58565 }, - { 33733, 37019 }, - { 33735, 64406 }, - { 33738, 35685 }, - { 33740, 35803 }, - { 33742, 58560 }, - { 33747, 35289 }, - { 33750, 36818 }, - { 33752, 58563 }, - { 33756, 36312 }, - { 33759, 37744 }, - { 33760, 58568 }, - { 33769, 38380 }, - { 33771, 58559 }, - { 33775, 35288 }, - { 33776, 36052 }, - { 33777, 38216 }, - { 33778, 58569 }, - { 33780, 58557 }, - { 33782, 64407 }, - { 33783, 58566 }, - { 33787, 58576 }, - { 33789, 58561 }, - { 33795, 58562 }, - { 33796, 37816 }, - { 33799, 58567 }, - { 33803, 58564 }, - { 33804, 38471 }, - { 33805, 58570 }, - { 33806, 35038 }, - { 33811, 58558 }, - { 33824, 58572 }, - { 33826, 58571 }, - { 33833, 38027 }, - { 33834, 58578 }, - { 33836, 58589 }, - { 33841, 35486 }, - { 33845, 58592 }, - { 33848, 58574 }, - { 33852, 58579 }, - { 33853, 38798 }, - { 33862, 58588 }, - { 33864, 64408 }, - { 33865, 38772 }, - { 33870, 38824 }, - { 33879, 37528 }, - { 33883, 35467 }, - { 33889, 38290 }, - { 33890, 58594 }, - { 33891, 37791 }, - { 33894, 34991 }, - { 33897, 58587 }, - { 33899, 58583 }, - { 33900, 37266 }, - { 33901, 58577 }, - { 33902, 58585 }, - { 33903, 58590 }, - { 33905, 37963 }, - { 33909, 34984 }, - { 33911, 58582 }, - { 33913, 58591 }, - { 33914, 38296 }, - { 33922, 58586 }, - { 33924, 58581 }, - { 33931, 36819 }, - { 33936, 36686 }, - { 33940, 36522 }, - { 33945, 38614 }, - { 33948, 38246 }, - { 33951, 58597 }, - { 33953, 58606 }, - { 33965, 58584 }, - { 33970, 35479 }, - { 33972, 64409 }, - { 33976, 36854 }, - { 33977, 58595 }, - { 33979, 58600 }, - { 33980, 37267 }, - { 33983, 58596 }, - { 33985, 58603 }, - { 33988, 37502 }, - { 33990, 58604 }, - { 33993, 38773 }, - { 33994, 58593 }, - { 33995, 35415 }, - { 33997, 58599 }, - { 34000, 58602 }, - { 34001, 38570 }, - { 34006, 58605 }, - { 34009, 58598 }, - { 34010, 58601 }, - { 34012, 64096 }, - { 34028, 38472 }, - { 34030, 38976 }, - { 34036, 58609 }, - { 34044, 58616 }, - { 34047, 58608 }, - { 34048, 36545 }, - { 34054, 58575 }, - { 34065, 38348 }, - { 34067, 38560 }, - { 34068, 58615 }, - { 34069, 58614 }, - { 34071, 58610 }, - { 34072, 58611 }, - { 34074, 35157 }, - { 34079, 58613 }, - { 34081, 58607 }, - { 34086, 37587 }, - { 34092, 58612 }, - { 34093, 35068 }, - { 34101, 37280 }, - { 34109, 38337 }, - { 34112, 58617 }, - { 34113, 58688 }, - { 34115, 38103 }, - { 34120, 58620 }, - { 34121, 36820 }, - { 34122, 36551 }, - { 34123, 58690 }, - { 34126, 35772 }, - { 34131, 64410 }, - { 34133, 58691 }, - { 34135, 38297 }, - { 34136, 58619 }, - { 34137, 64411 }, - { 34138, 58580 }, - { 34147, 58618 }, - { 34152, 39022 }, - { 34153, 37792 }, - { 34154, 38291 }, - { 34155, 64412 }, - { 34157, 58698 }, - { 34167, 58704 }, - { 34174, 58705 }, - { 34176, 58692 }, - { 34180, 38038 }, - { 34183, 58702 }, - { 34184, 58694 }, - { 34186, 58696 }, - { 34192, 58706 }, - { 34193, 58695 }, - { 34196, 58699 }, - { 34199, 35218 }, - { 34201, 37859 }, - { 34203, 58700 }, - { 34204, 58703 }, - { 34212, 58693 }, - { 34214, 37189 }, - { 34216, 58697 }, - { 34217, 36422 }, - { 34218, 36964 }, - { 34219, 35919 }, - { 34220, 38642 }, - { 34222, 38647 }, - { 34223, 36754 }, - { 34224, 64414 }, - { 34233, 58710 }, - { 34234, 58708 }, - { 34241, 39021 }, - { 34249, 58707 }, - { 34253, 38805 }, - { 34255, 58709 }, - { 34256, 58711 }, - { 34261, 58712 }, - { 34268, 58715 }, - { 34269, 58713 }, - { 34276, 37793 }, - { 34277, 58714 }, - { 34281, 38091 }, - { 34282, 58701 }, - { 34295, 36755 }, - { 34297, 58716 }, - { 34298, 58721 }, - { 34299, 37268 }, - { 34302, 58720 }, - { 34306, 58689 }, - { 34310, 58722 }, - { 34311, 37224 }, - { 34314, 58717 }, - { 34315, 58719 }, - { 34323, 58718 }, - { 34326, 40784 }, - { 34327, 40769 }, - { 34330, 58724 }, - { 34338, 58723 }, - { 34349, 38806 }, - { 34351, 57786 }, - { 34352, 58725 }, - { 34367, 58726 }, - { 34381, 58727 }, - { 34382, 36053 }, - { 34384, 35699 }, - { 34388, 58729 }, - { 34389, 39292 }, - { 34394, 35733 }, - { 34396, 38840 }, - { 34398, 35825 }, - { 34399, 58730 }, - { 34407, 58731 }, - { 34411, 37518 }, - { 34417, 58732 }, - { 34425, 37880 }, - { 34427, 35000 }, - { 34442, 35297 }, - { 34443, 58737 }, - { 34444, 58738 }, - { 34451, 58733 }, - { 34453, 36444 }, - { 34467, 58734 }, - { 34468, 37985 }, - { 34473, 58735 }, - { 34474, 58736 }, - { 34475, 58746 }, - { 34479, 58740 }, - { 34480, 58743 }, - { 34486, 58739 }, - { 34500, 58741 }, - { 34502, 58742 }, - { 34503, 36566 }, - { 34505, 58744 }, - { 34507, 37472 }, - { 34509, 35957 }, - { 34510, 35425 }, - { 34516, 58747 }, - { 34521, 35422 }, - { 34523, 58753 }, - { 34526, 58748 }, - { 34527, 58752 }, - { 34532, 38072 }, - { 34537, 58749 }, - { 34540, 58750 }, - { 34541, 38247 }, - { 34542, 38104 }, - { 34543, 58754 }, - { 34552, 37371 }, - { 34553, 58764 }, - { 34555, 58760 }, - { 34558, 35305 }, - { 34560, 58758 }, - { 34562, 38473 }, - { 34563, 58759 }, - { 34566, 58756 }, - { 34568, 58757 }, - { 34569, 58762 }, - { 34570, 58765 }, - { 34573, 58763 }, - { 34577, 58761 }, - { 34578, 58755 }, - { 34584, 37495 }, - { 34586, 58772 }, - { 34588, 38568 }, - { 34597, 58770 }, - { 34601, 58771 }, - { 34612, 58766 }, - { 34615, 58768 }, - { 34619, 58769 }, - { 34623, 58767 }, - { 34633, 37092 }, - { 34635, 39000 }, - { 34636, 58776 }, - { 34638, 58777 }, - { 34643, 58783 }, - { 34645, 36937 }, - { 34647, 58779 }, - { 34649, 58782 }, - { 34655, 58774 }, - { 34656, 58773 }, - { 34659, 58784 }, - { 34662, 35290 }, - { 34664, 58780 }, - { 34666, 58785 }, - { 34670, 58781 }, - { 34676, 58778 }, - { 34678, 37553 }, - { 34680, 58775 }, - { 34687, 38024 }, - { 34690, 58789 }, - { 34701, 38746 }, - { 34719, 58788 }, - { 34722, 58787 }, - { 34731, 58796 }, - { 34735, 58790 }, - { 34739, 58798 }, - { 34746, 38790 }, - { 34747, 58801 }, - { 34749, 58792 }, - { 34752, 58793 }, - { 34756, 58797 }, - { 34758, 58800 }, - { 34759, 58799 }, - { 34763, 58791 }, - { 34768, 58794 }, - { 34770, 58811 }, - { 34784, 58804 }, - { 34799, 58802 }, - { 34802, 58803 }, - { 34806, 58808 }, - { 34807, 58809 }, - { 34809, 35401 }, - { 34811, 35681 }, - { 34814, 58807 }, - { 34821, 58786 }, - { 34823, 64417 }, - { 34829, 58806 }, - { 34830, 58810 }, - { 34831, 58805 }, - { 34833, 58812 }, - { 34837, 58814 }, - { 34838, 58813 }, - { 34849, 58816 }, - { 34850, 58815 }, - { 34851, 58745 }, - { 34855, 58820 }, - { 34865, 58817 }, - { 34870, 58818 }, - { 34873, 58819 }, - { 34875, 58821 }, - { 34880, 35980 }, - { 34882, 58823 }, - { 34884, 58822 }, - { 34886, 36687 }, - { 34892, 36211 }, - { 34893, 40869 }, - { 34898, 58824 }, - { 34899, 36720 }, - { 34903, 35416 }, - { 34905, 58825 }, - { 34907, 35185 }, - { 34909, 36821 }, - { 34910, 58826 }, - { 34913, 36212 }, - { 34914, 58827 }, - { 34915, 35039 }, - { 34920, 38236 }, - { 34923, 58828 }, - { 34928, 37002 }, - { 34930, 58835 }, - { 34933, 58832 }, - { 34935, 37519 }, - { 34941, 58833 }, - { 34942, 58830 }, - { 34943, 35804 }, - { 34945, 58829 }, - { 34946, 58836 }, - { 34952, 35925 }, - { 34955, 37340 }, - { 34957, 58842 }, - { 34962, 58838 }, - { 34966, 37299 }, - { 34967, 58837 }, - { 34969, 58840 }, - { 34974, 58831 }, - { 34978, 58841 }, - { 34980, 58843 }, - { 34987, 38125 }, - { 34990, 58839 }, - { 34992, 58844 }, - { 34993, 58846 }, - { 34996, 36049 }, - { 34997, 58834 }, - { 34999, 35007 }, - { 35007, 58845 }, - { 35009, 36313 }, - { 35010, 38900 }, - { 35011, 58847 }, - { 35012, 58848 }, - { 35013, 37269 }, - { 35023, 38816 }, - { 35028, 58849 }, - { 35029, 38740 }, - { 35032, 58850 }, - { 35033, 58851 }, - { 35036, 38370 }, - { 35037, 58852 }, - { 35039, 36286 }, - { 35041, 38817 }, - { 35048, 58857 }, - { 35058, 58858 }, - { 35059, 36822 }, - { 35060, 58856 }, - { 35061, 64418 }, - { 35064, 38791 }, - { 35065, 58853 }, - { 35068, 58855 }, - { 35069, 37051 }, - { 35070, 37022 }, - { 35074, 58854 }, - { 35076, 58859 }, - { 35079, 38305 }, - { 35082, 58861 }, - { 35084, 58860 }, - { 35088, 35468 }, - { 35090, 38474 }, - { 35091, 58862 }, - { 35100, 64093 }, - { 35101, 58874 }, - { 35102, 58864 }, - { 35109, 58865 }, - { 35114, 58866 }, - { 35115, 58867 }, - { 35126, 58871 }, - { 35128, 58872 }, - { 35131, 58870 }, - { 35137, 58868 }, - { 35139, 58863 }, - { 35140, 58869 }, - { 35148, 58873 }, - { 35149, 59573 }, - { 35158, 35238 }, - { 35166, 58876 }, - { 35167, 35805 }, - { 35168, 58875 }, - { 35172, 58945 }, - { 35174, 58944 }, - { 35178, 58947 }, - { 35181, 58946 }, - { 35183, 58948 }, - { 35186, 36688 }, - { 35188, 58949 }, - { 35191, 58950 }, - { 35198, 58951 }, - { 35199, 37052 }, - { 35201, 38774 }, - { 35203, 58952 }, - { 35206, 38306 }, - { 35207, 37989 }, - { 35208, 58953 }, - { 35210, 58954 }, - { 35211, 36009 }, - { 35215, 35659 }, - { 35219, 58955 }, - { 35222, 36491 }, - { 35223, 37984 }, - { 35224, 58956 }, - { 35226, 35439 }, - { 35233, 58957 }, - { 35238, 58959 }, - { 35239, 38807 }, - { 35241, 58958 }, - { 35242, 36965 }, - { 35244, 58960 }, - { 35247, 58961 }, - { 35250, 58962 }, - { 35251, 35535 }, - { 35258, 58963 }, - { 35261, 58964 }, - { 35263, 58965 }, - { 35264, 58966 }, - { 35282, 35440 }, - { 35290, 58967 }, - { 35292, 58968 }, - { 35293, 58969 }, - { 35299, 35312 }, - { 35302, 36935 }, - { 35303, 58970 }, - { 35316, 58971 }, - { 35320, 58972 }, - { 35328, 36030 }, - { 35330, 37625 }, - { 35331, 58973 }, - { 35336, 35958 }, - { 35338, 36981 }, - { 35340, 58976 }, - { 35342, 37794 }, - { 35344, 58975 }, - { 35346, 64419 }, - { 35347, 35920 }, - { 35350, 58974 }, - { 35351, 37365 }, - { 35352, 35660 }, - { 35355, 58977 }, - { 35357, 58978 }, - { 35359, 36823 }, - { 35363, 35981 }, - { 35365, 58979 }, - { 35370, 38475 }, - { 35373, 37085 }, - { 35377, 35734 }, - { 35379, 38643 }, - { 35380, 37225 }, - { 35382, 58980 }, - { 35383, 64420 }, - { 35386, 36966 }, - { 35387, 37520 }, - { 35388, 36824 }, - { 35393, 58981 }, - { 35398, 58984 }, - { 35400, 58985 }, - { 35408, 36284 }, - { 35409, 37312 }, - { 35410, 58983 }, - { 35412, 36825 }, - { 35413, 38237 }, - { 35419, 58982 }, - { 35422, 36492 }, - { 35424, 35186 }, - { 35426, 58989 }, - { 35427, 35959 }, - { 35430, 36494 }, - { 35433, 36493 }, - { 35435, 39020 }, - { 35436, 58988 }, - { 35437, 58987 }, - { 35438, 37190 }, - { 35440, 35692 }, - { 35441, 39010 }, - { 35442, 35417 }, - { 35443, 36826 }, - { 35449, 64421 }, - { 35452, 58986 }, - { 35458, 58991 }, - { 35460, 58992 }, - { 35461, 58990 }, - { 35463, 36054 }, - { 35465, 38751 }, - { 35468, 36495 }, - { 35469, 37958 }, - { 35473, 58995 }, - { 35475, 37054 }, - { 35477, 37473 }, - { 35480, 38741 }, - { 35482, 58998 }, - { 35486, 36074 }, - { 35488, 37053 }, - { 35489, 58994 }, - { 35491, 58999 }, - { 35492, 36075 }, - { 35493, 58996 }, - { 35494, 58997 }, - { 35495, 64422 }, - { 35496, 58993 }, - { 35500, 37088 }, - { 35501, 37831 }, - { 35504, 37454 }, - { 35506, 35291 }, - { 35513, 38126 }, - { 35516, 35682 }, - { 35518, 64423 }, - { 35519, 37554 }, - { 35522, 59002 }, - { 35524, 59000 }, - { 35527, 37483 }, - { 35531, 37055 }, - { 35532, 35536 }, - { 35533, 59001 }, - { 35535, 36986 }, - { 35538, 38856 }, - { 35542, 39007 }, - { 35546, 59003 }, - { 35547, 59015 }, - { 35548, 37555 }, - { 35550, 59014 }, - { 35551, 64424 }, - { 35552, 59011 }, - { 35553, 59019 }, - { 35554, 59012 }, - { 35556, 59008 }, - { 35558, 37626 }, - { 35559, 59006 }, - { 35563, 59004 }, - { 35565, 38720 }, - { 35566, 36496 }, - { 35569, 59009 }, - { 35571, 59005 }, - { 35574, 64426 }, - { 35575, 59013 }, - { 35576, 36756 }, - { 35578, 36031 }, - { 35582, 37368 }, - { 35584, 38500 }, - { 35585, 35193 }, - { 35586, 35040 }, - { 35588, 37795 }, - { 35591, 59017 }, - { 35596, 59016 }, - { 35598, 37860 }, - { 35600, 59021 }, - { 35604, 59010 }, - { 35606, 59020 }, - { 35607, 59022 }, - { 35609, 36010 }, - { 35610, 59018 }, - { 35611, 36213 }, - { 35613, 36563 }, - { 35616, 59023 }, - { 35617, 38775 }, - { 35622, 59026 }, - { 35624, 59029 }, - { 35627, 59027 }, - { 35628, 38228 }, - { 35635, 59024 }, - { 35641, 35806 }, - { 35646, 59028 }, - { 35649, 59030 }, - { 35657, 59034 }, - { 35660, 59031 }, - { 35662, 59033 }, - { 35663, 59032 }, - { 35667, 64427 }, - { 35670, 59035 }, - { 35672, 36527 }, - { 35674, 59037 }, - { 35675, 59036 }, - { 35676, 38280 }, - { 35679, 59039 }, - { 35686, 35960 }, - { 35691, 59038 }, - { 35692, 59040 }, - { 35695, 59041 }, - { 35696, 35683 }, - { 35697, 58303 }, - { 35698, 36855 }, - { 35700, 59042 }, - { 35703, 36076 }, - { 35709, 59043 }, - { 35711, 64428 }, - { 35712, 59044 }, - { 35715, 36445 }, - { 35722, 40396 }, - { 35724, 59045 }, - { 35726, 59046 }, - { 35728, 36689 }, - { 35730, 59047 }, - { 35731, 59048 }, - { 35734, 59049 }, - { 35737, 59050 }, - { 35738, 59051 }, - { 35895, 37450 }, - { 35898, 59052 }, - { 35903, 59054 }, - { 35905, 59053 }, - { 35910, 37796 }, - { 35912, 59055 }, - { 35914, 38476 }, - { 35916, 59056 }, - { 35918, 59057 }, - { 35920, 59058 }, - { 35925, 59059 }, - { 35930, 37848 }, - { 35937, 36827 }, - { 35938, 59060 }, - { 35946, 36235 }, - { 35947, 39084 }, - { 35948, 59061 }, - { 35960, 59062 }, - { 35961, 38238 }, - { 35962, 59063 }, - { 35964, 59071 }, - { 35970, 59064 }, - { 35973, 59066 }, - { 35977, 59065 }, - { 35978, 59067 }, - { 35980, 38501 }, - { 35981, 59068 }, - { 35982, 59069 }, - { 35988, 59070 }, - { 35992, 59072 }, - { 35997, 35404 }, - { 35998, 37605 }, - { 36000, 38281 }, - { 36001, 36320 }, - { 36002, 36214 }, - { 36007, 38254 }, - { 36008, 35293 }, - { 36009, 38092 }, - { 36010, 59075 }, - { 36011, 35537 }, - { 36012, 37075 }, - { 36013, 59074 }, - { 36014, 59079 }, - { 36015, 37529 }, - { 36016, 38625 }, - { 36018, 59077 }, - { 36019, 59078 }, - { 36020, 35661 }, - { 36022, 59080 }, - { 36023, 38019 }, - { 36024, 37341 }, - { 36027, 38127 }, - { 36028, 37724 }, - { 36029, 59076 }, - { 36031, 38502 }, - { 36032, 35306 }, - { 36033, 59082 }, - { 36034, 38983 }, - { 36035, 37568 }, - { 36036, 39012 }, - { 36039, 36497 }, - { 36040, 59081 }, - { 36042, 37295 }, - { 36045, 59098 }, - { 36046, 37191 }, - { 36049, 37878 }, - { 36051, 38255 }, - { 36058, 59085 }, - { 36059, 36446 }, - { 36060, 36498 }, - { 36062, 36828 }, - { 36064, 38021 }, - { 36066, 36011 }, - { 36067, 59084 }, - { 36068, 59083 }, - { 36070, 38282 }, - { 36074, 36543 }, - { 36077, 37745 }, - { 36080, 64429 }, - { 36084, 64430 }, - { 36090, 59087 }, - { 36091, 59088 }, - { 36092, 36215 }, - { 36093, 59086 }, - { 36100, 59089 }, - { 36101, 59090 }, - { 36103, 59092 }, - { 36104, 37281 }, - { 36106, 59091 }, - { 36107, 35556 }, - { 36109, 59094 }, - { 36111, 59093 }, - { 36112, 59095 }, - { 36114, 64431 }, - { 36115, 59097 }, - { 36116, 59099 }, - { 36118, 59100 }, - { 36196, 37076 }, - { 36198, 36557 }, - { 36199, 59101 }, - { 36203, 35441 }, - { 36205, 59102 }, - { 36208, 37270 }, - { 36209, 59103 }, - { 36211, 59104 }, - { 36212, 38283 }, - { 36214, 64432 }, - { 36215, 35662 }, - { 36225, 59105 }, - { 36229, 37556 }, - { 36234, 35194 }, - { 36249, 59106 }, - { 36259, 36591 }, - { 36264, 37014 }, - { 36275, 37291 }, - { 36282, 59109 }, - { 36286, 59108 }, - { 36290, 59107 }, - { 36299, 59115 }, - { 36300, 59113 }, - { 36303, 59110 }, - { 36310, 59112 }, - { 36314, 59111 }, - { 36315, 59114 }, - { 36317, 35735 }, - { 36319, 59118 }, - { 36321, 37077 }, - { 36323, 59119 }, - { 36328, 36055 }, - { 36330, 59116 }, - { 36331, 59117 }, - { 36335, 38984 }, - { 36339, 37557 }, - { 36341, 37192 }, - { 36348, 59120 }, - { 36351, 59123 }, - { 36360, 59121 }, - { 36361, 59122 }, - { 36362, 38776 }, - { 36367, 37797 }, - { 36368, 59126 }, - { 36381, 59124 }, - { 36382, 59125 }, - { 36383, 59127 }, - { 36394, 59208 }, - { 36400, 59130 }, - { 36404, 59131 }, - { 36405, 59129 }, - { 36418, 59128 }, - { 36420, 37627 }, - { 36423, 59200 }, - { 36424, 59204 }, - { 36425, 59201 }, - { 36426, 59132 }, - { 36428, 59202 }, - { 36432, 59203 }, - { 36437, 59210 }, - { 36441, 59205 }, - { 36447, 37078 }, - { 36448, 59207 }, - { 36451, 59209 }, - { 36452, 59206 }, - { 36466, 59212 }, - { 36468, 36690 }, - { 36470, 59211 }, - { 36476, 59213 }, - { 36481, 59214 }, - { 36484, 59217 }, - { 36485, 59216 }, - { 36487, 59215 }, - { 36490, 59219 }, - { 36491, 59218 }, - { 36493, 38644 }, - { 36497, 59221 }, - { 36499, 59220 }, - { 36500, 59222 }, - { 36505, 59223 }, - { 36513, 59225 }, - { 36522, 59224 }, - { 36523, 36967 }, - { 36524, 59226 }, - { 36527, 35819 }, - { 36528, 59227 }, - { 36529, 59229 }, - { 36542, 59230 }, - { 36549, 59231 }, - { 36550, 59228 }, - { 36552, 59232 }, - { 36554, 36564 }, - { 36555, 59233 }, - { 36556, 35663 }, - { 36557, 35922 }, - { 36559, 64434 }, - { 36562, 36012 }, - { 36571, 59234 }, - { 36575, 37870 }, - { 36578, 37725 }, - { 36579, 59235 }, - { 36587, 59238 }, - { 36600, 36530 }, - { 36603, 59237 }, - { 36604, 59236 }, - { 36605, 35961 }, - { 36606, 59239 }, - { 36611, 35442 }, - { 36613, 59241 }, - { 36617, 36314 }, - { 36618, 59240 }, - { 36620, 59249 }, - { 36626, 59243 }, - { 36627, 59245 }, - { 36628, 38371 }, - { 36629, 59242 }, - { 36633, 59244 }, - { 36635, 59248 }, - { 36636, 59246 }, - { 36637, 35664 }, - { 36639, 59247 }, - { 36646, 59250 }, - { 36649, 38009 }, - { 36650, 38870 }, - { 36655, 36691 }, - { 36659, 59251 }, - { 36664, 38721 }, - { 36665, 59253 }, - { 36667, 59252 }, - { 36670, 59256 }, - { 36671, 38752 }, - { 36674, 59255 }, - { 36676, 35469 }, - { 36677, 59254 }, - { 36678, 59259 }, - { 36681, 59258 }, - { 36684, 59257 }, - { 36685, 37713 }, - { 36686, 59260 }, - { 36695, 59261 }, - { 36700, 59262 }, - { 36703, 36236 }, - { 36705, 35908 }, - { 36706, 59264 }, - { 36707, 59265 }, - { 36708, 59266 }, - { 36763, 36968 }, - { 36764, 59267 }, - { 36766, 36523 }, - { 36767, 59268 }, - { 36771, 59269 }, - { 36775, 39327 }, - { 36776, 39326 }, - { 36781, 59270 }, - { 36782, 58256 }, - { 36783, 59271 }, - { 36784, 37443 }, - { 36785, 36938 }, - { 36786, 37983 }, - { 36791, 59272 }, - { 36794, 38355 }, - { 36795, 37586 }, - { 36796, 36254 }, - { 36799, 37448 }, - { 36802, 35145 }, - { 36804, 38552 }, - { 36805, 36982 }, - { 36814, 35965 }, - { 36817, 35807 }, - { 36820, 38356 }, - { 36826, 59273 }, - { 36834, 59275 }, - { 36837, 59274 }, - { 36838, 35294 }, - { 36841, 37876 }, - { 36842, 59276 }, - { 36843, 38039 }, - { 36845, 37714 }, - { 36847, 59277 }, - { 36848, 36721 }, - { 36852, 59279 }, - { 36855, 38592 }, - { 36856, 59294 }, - { 36857, 59281 }, - { 36858, 59282 }, - { 36861, 37575 }, - { 36864, 37342 }, - { 36865, 37271 }, - { 36867, 37798 }, - { 36869, 59280 }, - { 36870, 35700 }, - { 36875, 59289 }, - { 36877, 59286 }, - { 36878, 59299 }, - { 36879, 37799 }, - { 36880, 37504 }, - { 36881, 59283 }, - { 36883, 37628 }, - { 36884, 37746 }, - { 36885, 59284 }, - { 36886, 59288 }, - { 36887, 36992 }, - { 36889, 38023 }, - { 36890, 37578 }, - { 36893, 37056 }, - { 36894, 59287 }, - { 36895, 37292 }, - { 36896, 37282 }, - { 36897, 59285 }, - { 36898, 34983 }, - { 36899, 38977 }, - { 36903, 59290 }, - { 36910, 37343 }, - { 36913, 36692 }, - { 36914, 36969 }, - { 36917, 59292 }, - { 36918, 59291 }, - { 36920, 35053 }, - { 36921, 59293 }, - { 36924, 38222 }, - { 36926, 59301 }, - { 36929, 37849 }, - { 36930, 37003 }, - { 36933, 37496 }, - { 36935, 35830 }, - { 36937, 59300 }, - { 36938, 38742 }, - { 36939, 35166 }, - { 36941, 38357 }, - { 36942, 35295 }, - { 36943, 59295 }, - { 36944, 59296 }, - { 36945, 59297 }, - { 36946, 59298 }, - { 36947, 37817 }, - { 36948, 37442 }, - { 36949, 35041 }, - { 36950, 59302 }, - { 36952, 59303 }, - { 36953, 60065 }, - { 36956, 37307 }, - { 36958, 59304 }, - { 36960, 35219 }, - { 36961, 37227 }, - { 36963, 36013 }, - { 36965, 38777 }, - { 36967, 64437 }, - { 36968, 59305 }, - { 36969, 37707 }, - { 36973, 37272 }, - { 36974, 36565 }, - { 36975, 59306 }, - { 36978, 59309 }, - { 36981, 36741 }, - { 36982, 59307 }, - { 36983, 37194 }, - { 36984, 37193 }, - { 36986, 35042 }, - { 36988, 38857 }, - { 36989, 59311 }, - { 36991, 38128 }, - { 36992, 59313 }, - { 36993, 59312 }, - { 36994, 59310 }, - { 36995, 57988 }, - { 36996, 35538 }, - { 36999, 59278 }, - { 37001, 59315 }, - { 37002, 59314 }, - { 37007, 59316 }, - { 37009, 38743 }, - { 37027, 37855 }, - { 37030, 38477 }, - { 37032, 59317 }, - { 37034, 36567 }, - { 37039, 59318 }, - { 37041, 59319 }, - { 37045, 59320 }, - { 37048, 37696 }, - { 37057, 35048 }, - { 37066, 36216 }, - { 37070, 39001 }, - { 37083, 59324 }, - { 37086, 64438 }, - { 37089, 35923 }, - { 37090, 59321 }, - { 37092, 59322 }, - { 37096, 38292 }, - { 37101, 35443 }, - { 37109, 38744 }, - { 37111, 35773 }, - { 37117, 37747 }, - { 37122, 59325 }, - { 37138, 59326 }, - { 37141, 64440 }, - { 37145, 59327 }, - { 37159, 64441 }, - { 37165, 37697 }, - { 37168, 59329 }, - { 37170, 59328 }, - { 37193, 37841 }, - { 37194, 59330 }, - { 37195, 36693 }, - { 37196, 36574 }, - { 37197, 38010 }, - { 37198, 37521 }, - { 37202, 36592 }, - { 37204, 37004 }, - { 37206, 59331 }, - { 37208, 59332 }, - { 37218, 36988 }, - { 37219, 59333 }, - { 37221, 59334 }, - { 37225, 59335 }, - { 37226, 38799 }, - { 37228, 36694 }, - { 37234, 59337 }, - { 37235, 59336 }, - { 37237, 36217 }, - { 37239, 36243 }, - { 37240, 36447 }, - { 37250, 59340 }, - { 37255, 36742 }, - { 37257, 59339 }, - { 37259, 59338 }, - { 37261, 37351 }, - { 37264, 36077 }, - { 37266, 37057 }, - { 37271, 38062 }, - { 37276, 36696 }, - { 37282, 59341 }, - { 37284, 36829 }, - { 37290, 59344 }, - { 37291, 59342 }, - { 37295, 59343 }, - { 37300, 59346 }, - { 37301, 59345 }, - { 37304, 36856 }, - { 37306, 59347 }, - { 37312, 59348 }, - { 37313, 59349 }, - { 37318, 38094 }, - { 37319, 36305 }, - { 37320, 36575 }, - { 37321, 59350 }, - { 37323, 59351 }, - { 37324, 38818 }, - { 37325, 36708 }, - { 37326, 38636 }, - { 37327, 38858 }, - { 37328, 59352 }, - { 37329, 35808 }, - { 37334, 59353 }, - { 37335, 64443 }, - { 37336, 37698 }, - { 37338, 64442 }, - { 37339, 59356 }, - { 37340, 35480 }, - { 37341, 36970 }, - { 37342, 64444 }, - { 37343, 59354 }, - { 37345, 59355 }, - { 37347, 37598 }, - { 37348, 64447 }, - { 37349, 64448 }, - { 37350, 38516 }, - { 37351, 35834 }, - { 37357, 64445 }, - { 37358, 64446 }, - { 37365, 59358 }, - { 37366, 59359 }, - { 37372, 59357 }, - { 37375, 59361 }, - { 37382, 64449 }, - { 37386, 64451 }, - { 37389, 37853 }, - { 37390, 35426 }, - { 37392, 64450 }, - { 37393, 59365 }, - { 37396, 59362 }, - { 37397, 59364 }, - { 37406, 59360 }, - { 37417, 59502 }, - { 37420, 59363 }, - { 37428, 38889 }, - { 37431, 36056 }, - { 37433, 64458 }, - { 37434, 64452 }, - { 37436, 64454 }, - { 37439, 59373 }, - { 37440, 64453 }, - { 37444, 37715 }, - { 37445, 59368 }, - { 37448, 59371 }, - { 37449, 59369 }, - { 37451, 59374 }, - { 37454, 64455 }, - { 37456, 59375 }, - { 37457, 64457 }, - { 37463, 59367 }, - { 37465, 64456 }, - { 37466, 59380 }, - { 37467, 35220 }, - { 37470, 59366 }, - { 37474, 38059 }, - { 37476, 59370 }, - { 37478, 36830 }, - { 37479, 64459 }, - { 37489, 36218 }, - { 37495, 64461 }, - { 37496, 64462 }, - { 37502, 38503 }, - { 37504, 35810 }, - { 37507, 36709 }, - { 37509, 37818 }, - { 37512, 64095 }, - { 37521, 37196 }, - { 37523, 59378 }, - { 37525, 59372 }, - { 37526, 59377 }, - { 37528, 38593 }, - { 37530, 37558 }, - { 37531, 59379 }, - { 37532, 59376 }, - { 37543, 64460 }, - { 37549, 37195 }, - { 37559, 59383 }, - { 37561, 59382 }, - { 37583, 59381 }, - { 37584, 64466 }, - { 37586, 38478 }, - { 37587, 64470 }, - { 37589, 64468 }, - { 37591, 64464 }, - { 37593, 64465 }, - { 37600, 64469 }, - { 37604, 36763 }, - { 37607, 64463 }, - { 37609, 59384 }, - { 37610, 38365 }, - { 37613, 35187 }, - { 37618, 38245 }, - { 37619, 37522 }, - { 37624, 35736 }, - { 37625, 64101 }, - { 37626, 59386 }, - { 37627, 64473 }, - { 37628, 36220 }, - { 37631, 64476 }, - { 37634, 64478 }, - { 37638, 36427 }, - { 37647, 59385 }, - { 37648, 37005 }, - { 37656, 37006 }, - { 37657, 59456 }, - { 37658, 59458 }, - { 37661, 64477 }, - { 37662, 64475 }, - { 37664, 36857 }, - { 37665, 64472 }, - { 37666, 59457 }, - { 37667, 59459 }, - { 37669, 64471 }, - { 37670, 35793 }, - { 37672, 38244 }, - { 37675, 36576 }, - { 37676, 38978 }, - { 37678, 59388 }, - { 37679, 36342 }, - { 37682, 39006 }, - { 37685, 59461 }, - { 37690, 59460 }, - { 37691, 59462 }, - { 37700, 59387 }, - { 37704, 64094 }, - { 37707, 37863 }, - { 37709, 37748 }, - { 37716, 37589 }, - { 37718, 59467 }, - { 37719, 64480 }, - { 37723, 37474 }, - { 37724, 59463 }, - { 37728, 59464 }, - { 37740, 35916 }, - { 37742, 59466 }, - { 37744, 64479 }, - { 37749, 36014 }, - { 37756, 59465 }, - { 37758, 36831 }, - { 37772, 35481 }, - { 37780, 59471 }, - { 37782, 36285 }, - { 37783, 37273 }, - { 37786, 37576 }, - { 37796, 64481 }, - { 37799, 35418 }, - { 37804, 59469 }, - { 37805, 59470 }, - { 37806, 37569 }, - { 37808, 59468 }, - { 37817, 59472 }, - { 37827, 59478 }, - { 37830, 64482 }, - { 37832, 59481 }, - { 37840, 59480 }, - { 37841, 37708 }, - { 37846, 59473 }, - { 37847, 59474 }, - { 37848, 59477 }, - { 37853, 59479 }, - { 37854, 64483 }, - { 37857, 35774 }, - { 37860, 59482 }, - { 37861, 59476 }, - { 37864, 59475 }, - { 37880, 64484 }, - { 37891, 59486 }, - { 37895, 59487 }, - { 37904, 59488 }, - { 37907, 59485 }, - { 37908, 59484 }, - { 37912, 36832 }, - { 37913, 37800 }, - { 37914, 59483 }, - { 37921, 59492 }, - { 37931, 59490 }, - { 37937, 64485 }, - { 37941, 59491 }, - { 37942, 59489 }, - { 37944, 37366 }, - { 37946, 59493 }, - { 37953, 59494 }, - { 37956, 59496 }, - { 37957, 64486 }, - { 37960, 64487 }, - { 37969, 35539 }, - { 37970, 59495 }, - { 37971, 38648 }, - { 37978, 59507 }, - { 37979, 59497 }, - { 37982, 59500 }, - { 37984, 59498 }, - { 37986, 59499 }, - { 37994, 59501 }, - { 38000, 59503 }, - { 38005, 59504 }, - { 38007, 59505 }, - { 38012, 59508 }, - { 38013, 59506 }, - { 38014, 59509 }, - { 38015, 59511 }, - { 38017, 59510 }, - { 38263, 37559 }, - { 38272, 38629 }, - { 38274, 59512 }, - { 38275, 37197 }, - { 38279, 59513 }, - { 38281, 38338 }, - { 38282, 59514 }, - { 38283, 35402 }, - { 38287, 35163 }, - { 38289, 35541 }, - { 38290, 64488 }, - { 38291, 35540 }, - { 38292, 59515 }, - { 38294, 59516 }, - { 38296, 59517 }, - { 38297, 59518 }, - { 38304, 59520 }, - { 38306, 35542 }, - { 38307, 35444 }, - { 38308, 36221 }, - { 38309, 38068 }, - { 38311, 59522 }, - { 38312, 59521 }, - { 38317, 59523 }, - { 38322, 35195 }, - { 38329, 59526 }, - { 38331, 59525 }, - { 38332, 59524 }, - { 38334, 59527 }, - { 38339, 59530 }, - { 38343, 35013 }, - { 38346, 59528 }, - { 38348, 59532 }, - { 38349, 59531 }, - { 38356, 59534 }, - { 38357, 59533 }, - { 38358, 59535 }, - { 38360, 37804 }, - { 38364, 59536 }, - { 38369, 59537 }, - { 38370, 59539 }, - { 38373, 59538 }, - { 38428, 38284 }, - { 38433, 59540 }, - { 38440, 59541 }, - { 38442, 36323 }, - { 38446, 59542 }, - { 38447, 59543 }, - { 38450, 38504 }, - { 38459, 37226 }, - { 38463, 34978 }, - { 38464, 37321 }, - { 38466, 59544 }, - { 38468, 38285 }, - { 38475, 59547 }, - { 38476, 59545 }, - { 38477, 36222 }, - { 38479, 59546 }, - { 38480, 36032 }, - { 38491, 38339 }, - { 38492, 59549 }, - { 38493, 59551 }, - { 38494, 59550 }, - { 38495, 59552 }, - { 38498, 35136 }, - { 38499, 36983 }, - { 38500, 36764 }, - { 38501, 35543 }, - { 38502, 59553 }, - { 38506, 38022 }, - { 38508, 59555 }, - { 38512, 35137 }, - { 38514, 59554 }, - { 38515, 37570 }, - { 38517, 38859 }, - { 38518, 37801 }, - { 38519, 59548 }, - { 38520, 38820 }, - { 38522, 36015 }, - { 38525, 38778 }, - { 38533, 35831 }, - { 38534, 38834 }, - { 38536, 35911 }, - { 38538, 37344 }, - { 38539, 58432 }, - { 38541, 59556 }, - { 38542, 35403 }, - { 38543, 37007 }, - { 38548, 35445 }, - { 38549, 59558 }, - { 38551, 59559 }, - { 38552, 59557 }, - { 38553, 35972 }, - { 38555, 36315 }, - { 38556, 36833 }, - { 38557, 64491 }, - { 38560, 35138 }, - { 38563, 38871 }, - { 38567, 59561 }, - { 38568, 59308 }, - { 38570, 59560 }, - { 38575, 64492 }, - { 38576, 59564 }, - { 38577, 59562 }, - { 38578, 59563 }, - { 38580, 59565 }, - { 38582, 59566 }, - { 38583, 38890 }, - { 38584, 59567 }, - { 38585, 59568 }, - { 38587, 37063 }, - { 38588, 38073 }, - { 38592, 37021 }, - { 38593, 35557 }, - { 38596, 38745 }, - { 38597, 35307 }, - { 38598, 36695 }, - { 38599, 36057 }, - { 38601, 59571 }, - { 38603, 59570 }, - { 38604, 36499 }, - { 38605, 59572 }, - { 38606, 59569 }, - { 38609, 36423 }, - { 38613, 59576 }, - { 38614, 58795 }, - { 38617, 39380 }, - { 38619, 37015 }, - { 38620, 59574 }, - { 38626, 38819 }, - { 38627, 37871 }, - { 38632, 35146 }, - { 38634, 37089 }, - { 38635, 36532 }, - { 38640, 38325 }, - { 38642, 35167 }, - { 38646, 38891 }, - { 38647, 38795 }, - { 38649, 59577 }, - { 38651, 37732 }, - { 38656, 36601 }, - { 38660, 59578 }, - { 38662, 59579 }, - { 38663, 36971 }, - { 38664, 59580 }, - { 38666, 38892 }, - { 38669, 59575 }, - { 38670, 59582 }, - { 38671, 59584 }, - { 38673, 59583 }, - { 38675, 59581 }, - { 38678, 59585 }, - { 38681, 59586 }, - { 38684, 37274 }, - { 38686, 35296 }, - { 38692, 59587 }, - { 38695, 38582 }, - { 38698, 59588 }, - { 38704, 59589 }, - { 38706, 38985 }, - { 38707, 64493 }, - { 38712, 40528 }, - { 38713, 59590 }, - { 38715, 64494 }, - { 38717, 59591 }, - { 38718, 59592 }, - { 38722, 59596 }, - { 38723, 64495 }, - { 38724, 59593 }, - { 38726, 59594 }, - { 38728, 59595 }, - { 38729, 59597 }, - { 38733, 64496 }, - { 38735, 64497 }, - { 38737, 64498 }, - { 38738, 37058 }, - { 38741, 64499 }, - { 38742, 38645 }, - { 38745, 37059 }, - { 38748, 59598 }, - { 38750, 38129 }, - { 38752, 59599 }, - { 38753, 60018 }, - { 38754, 38602 }, - { 38756, 59600 }, - { 38758, 59601 }, - { 38760, 59602 }, - { 38761, 35446 }, - { 38763, 59604 }, - { 38765, 36984 }, - { 38769, 59605 }, - { 38772, 35907 }, - { 38777, 59606 }, - { 38778, 59610 }, - { 38780, 59608 }, - { 38785, 59609 }, - { 38788, 35475 }, - { 38789, 59607 }, - { 38790, 59611 }, - { 38795, 59612 }, - { 38797, 35014 }, - { 38799, 59613 }, - { 38800, 59614 }, - { 38808, 36834 }, - { 38812, 59615 }, - { 38816, 35686 }, - { 38819, 59618 }, - { 38822, 59617 }, - { 38824, 59616 }, - { 38827, 59025 }, - { 38829, 38362 }, - { 38835, 59619 }, - { 38836, 59620 }, - { 38851, 59621 }, - { 38854, 59622 }, - { 38856, 59623 }, - { 38859, 59624 }, - { 38867, 35544 }, - { 38876, 59625 }, - { 38893, 59626 }, - { 38894, 37954 }, - { 38898, 59628 }, - { 38899, 35257 }, - { 38901, 59631 }, - { 38902, 59630 }, - { 38907, 35139 }, - { 38911, 35775 }, - { 38913, 38341 }, - { 38914, 37560 }, - { 38915, 36256 }, - { 38917, 36224 }, - { 38918, 36743 }, - { 38920, 36987 }, - { 38924, 59633 }, - { 38927, 59632 }, - { 38928, 38753 }, - { 38929, 35558 }, - { 38930, 38096 }, - { 38931, 37850 }, - { 38935, 37020 }, - { 38936, 38860 }, - { 38938, 35962 }, - { 38945, 59636 }, - { 38948, 59635 }, - { 38956, 38506 }, - { 38957, 37802 }, - { 38964, 35183 }, - { 38967, 59637 }, - { 38968, 59634 }, - { 38971, 38256 }, - { 38972, 38794 }, - { 38973, 59638 }, - { 38982, 59639 }, - { 38987, 59641 }, - { 38988, 37352 }, - { 38989, 35450 }, - { 38990, 35451 }, - { 38991, 59640 }, - { 38996, 35559 }, - { 38997, 36016 }, - { 38999, 64500 }, - { 39000, 35560 }, - { 39003, 37726 }, - { 39006, 38878 }, - { 39013, 64501 }, - { 39015, 36058 }, - { 39019, 59642 }, - { 39023, 59643 }, - { 39024, 59644 }, - { 39025, 59712 }, - { 39027, 59714 }, - { 39028, 59713 }, - { 39080, 38295 }, - { 39082, 59715 }, - { 39087, 59716 }, - { 39089, 59717 }, - { 39094, 59718 }, - { 39107, 59720 }, - { 39108, 59719 }, - { 39110, 59721 }, - { 39131, 38130 }, - { 39132, 58314 }, - { 39135, 36936 }, - { 39138, 35665 }, - { 39145, 59722 }, - { 39147, 59723 }, - { 39149, 39338 }, - { 39150, 40794 }, - { 39151, 38097 }, - { 39154, 35065 }, - { 39156, 35001 }, - { 39164, 36500 }, - { 39165, 38479 }, - { 39166, 36860 }, - { 39171, 59724 }, - { 39173, 38621 }, - { 39177, 59725 }, - { 39178, 38779 }, - { 39180, 35169 }, - { 39184, 36448 }, - { 39186, 59726 }, - { 39187, 35308 }, - { 39188, 59727 }, - { 39192, 59728 }, - { 39197, 59730 }, - { 39198, 59731 }, - { 39200, 59733 }, - { 39201, 59729 }, - { 39204, 59732 }, - { 39207, 64504 }, - { 39208, 35545 }, - { 39212, 59734 }, - { 39214, 59735 }, - { 39229, 59736 }, - { 39230, 59737 }, - { 39234, 59738 }, - { 39237, 59740 }, - { 39241, 59739 }, - { 39243, 59742 }, - { 39244, 59745 }, - { 39248, 59741 }, - { 39249, 59743 }, - { 39250, 59744 }, - { 39253, 59746 }, - { 39255, 35776 }, - { 39318, 36593 }, - { 39319, 59747 }, - { 39320, 59748 }, - { 39321, 36225 }, - { 39326, 64506 }, - { 39333, 59749 }, - { 39336, 35421 }, - { 39340, 37998 }, - { 39341, 59750 }, - { 39342, 59751 }, - { 39347, 37497 }, - { 39348, 37865 }, - { 39356, 59752 }, - { 39361, 38045 }, - { 39364, 37322 }, - { 39365, 35191 }, - { 39366, 35820 }, - { 39368, 35821 }, - { 39376, 37523 }, - { 39377, 59757 }, - { 39378, 35822 }, - { 39381, 35309 }, - { 39384, 59756 }, - { 39387, 59754 }, - { 39389, 59755 }, - { 39391, 59753 }, - { 39394, 59767 }, - { 39405, 59758 }, - { 39406, 59759 }, - { 39409, 59760 }, - { 39410, 59761 }, - { 39416, 59763 }, - { 39419, 59762 }, - { 39423, 36728 }, - { 39425, 59764 }, - { 39429, 59766 }, - { 39438, 35666 }, - { 39439, 59765 }, - { 39442, 37275 }, - { 39443, 36017 }, - { 39449, 59768 }, - { 39464, 37323 }, - { 39467, 59769 }, - { 39472, 37803 }, - { 39479, 59770 }, - { 39486, 59776 }, - { 39488, 59773 }, - { 39490, 59772 }, - { 39491, 59774 }, - { 39493, 59771 }, - { 39501, 59778 }, - { 39502, 64507 }, - { 39509, 59777 }, - { 39511, 59780 }, - { 39514, 35777 }, - { 39515, 59779 }, - { 39519, 59781 }, - { 39522, 59782 }, - { 39524, 59784 }, - { 39525, 59783 }, - { 39529, 59785 }, - { 39530, 59787 }, - { 39531, 59786 }, - { 39592, 36252 }, - { 39597, 59788 }, - { 39600, 59789 }, - { 39608, 35419 }, - { 39612, 59790 }, - { 39616, 59791 }, - { 39620, 37009 }, - { 39631, 59792 }, - { 39633, 59793 }, - { 39635, 59794 }, - { 39636, 59795 }, - { 39640, 36226 }, - { 39641, 64508 }, - { 39644, 64576 }, - { 39646, 59796 }, - { 39647, 59797 }, - { 39650, 59798 }, - { 39651, 59799 }, - { 39654, 59800 }, - { 39658, 38063 }, - { 39659, 59802 }, - { 39661, 38213 }, - { 39662, 59803 }, - { 39663, 59801 }, - { 39665, 59805 }, - { 39668, 59804 }, - { 39671, 59806 }, - { 39675, 59807 }, - { 39686, 59808 }, - { 39704, 59809 }, - { 39706, 59810 }, - { 39711, 59811 }, - { 39714, 59812 }, - { 39715, 59813 }, - { 39717, 59814 }, - { 39719, 59815 }, - { 39720, 59816 }, - { 39721, 59817 }, - { 39722, 59818 }, - { 39726, 59819 }, - { 39727, 59820 }, - { 39729, 40788 }, - { 39730, 59821 }, - { 39739, 58102 }, - { 39740, 35667 }, - { 39745, 35392 }, - { 39746, 36272 }, - { 39747, 59823 }, - { 39748, 59822 }, - { 39749, 38563 }, - { 39757, 59825 }, - { 39758, 59826 }, - { 39759, 59824 }, - { 39761, 59827 }, - { 39764, 38530 }, - { 39768, 59828 }, - { 39770, 35739 }, - { 39791, 38980 }, - { 39794, 64578 }, - { 39796, 59829 }, - { 39797, 64577 }, - { 39811, 59831 }, - { 39822, 35004 }, - { 39823, 64579 }, - { 39825, 59832 }, - { 39826, 38313 }, - { 39827, 59830 }, - { 39830, 59833 }, - { 39831, 59834 }, - { 39839, 59835 }, - { 39840, 59836 }, - { 39848, 59837 }, - { 39850, 38542 }, - { 39851, 36428 }, - { 39853, 36344 }, - { 39854, 37198 }, - { 39857, 64580 }, - { 39860, 59838 }, - { 39865, 59841 }, - { 39867, 64581 }, - { 39872, 59839 }, - { 39878, 59842 }, - { 39881, 36079 }, - { 39882, 59840 }, - { 39887, 59843 }, - { 39889, 59844 }, - { 39890, 59845 }, - { 39892, 59849 }, - { 39894, 36425 }, - { 39899, 37346 }, - { 39905, 59850 }, - { 39906, 59847 }, - { 39907, 59846 }, - { 39908, 59848 }, - { 39912, 35966 }, - { 39920, 59854 }, - { 39921, 59853 }, - { 39922, 59852 }, - { 39925, 34993 }, - { 39936, 64582 }, - { 39940, 59864 }, - { 39942, 59860 }, - { 39944, 59861 }, - { 39945, 59857 }, - { 39946, 59863 }, - { 39948, 59859 }, - { 39949, 35458 }, - { 39952, 39019 }, - { 39954, 59862 }, - { 39955, 59858 }, - { 39956, 59856 }, - { 39957, 59855 }, - { 39963, 59866 }, - { 39969, 59869 }, - { 39972, 59868 }, - { 39973, 59867 }, - { 39981, 38248 }, - { 39982, 59865 }, - { 39983, 35057 }, - { 39984, 59870 }, - { 39986, 59872 }, - { 39993, 35471 }, - { 39994, 59851 }, - { 39995, 35158 }, - { 39998, 59874 }, - { 40006, 59873 }, - { 40007, 59871 }, - { 40008, 37452 }, - { 40018, 38544 }, - { 40023, 38872 }, - { 40026, 59875 }, - { 40032, 59876 }, - { 40039, 59877 }, - { 40054, 59878 }, - { 40056, 59879 }, - { 40165, 37561 }, - { 40167, 59880 }, - { 40169, 38069 }, - { 40171, 59885 }, - { 40172, 59881 }, - { 40176, 59882 }, - { 40179, 38480 }, - { 40180, 38594 }, - { 40182, 37838 }, - { 40195, 59886 }, - { 40198, 59887 }, - { 40199, 37820 }, - { 40200, 59884 }, - { 40201, 59883 }, - { 40206, 35240 }, - { 40210, 59895 }, - { 40213, 59894 }, - { 40219, 35221 }, - { 40223, 59892 }, - { 40227, 59891 }, - { 40230, 59889 }, - { 40232, 35483 }, - { 40234, 59888 }, - { 40235, 36528 }, - { 40236, 35239 }, - { 40251, 36227 }, - { 40254, 59898 }, - { 40255, 59897 }, - { 40257, 59896 }, - { 40260, 59893 }, - { 40262, 59899 }, - { 40264, 59900 }, - { 40272, 59972 }, - { 40273, 59971 }, - { 40281, 59973 }, - { 40284, 35148 }, - { 40285, 59968 }, - { 40286, 59969 }, - { 40288, 36244 }, - { 40289, 38583 }, - { 40292, 59970 }, - { 40299, 64584 }, - { 40300, 38481 }, - { 40303, 59978 }, - { 40304, 64583 }, - { 40306, 59974 }, - { 40314, 59979 }, - { 40327, 59976 }, - { 40329, 59975 }, - { 40335, 35963 }, - { 40346, 59980 }, - { 40356, 59981 }, - { 40361, 59982 }, - { 40363, 59977 }, - { 40367, 59890 }, - { 40370, 59983 }, - { 40372, 37599 }, - { 40376, 59987 }, - { 40378, 59988 }, - { 40379, 59986 }, - { 40385, 59985 }, - { 40386, 59991 }, - { 40388, 59984 }, - { 40390, 59989 }, - { 40399, 59990 }, - { 40403, 59993 }, - { 40409, 59992 }, - { 40422, 59995 }, - { 40429, 59996 }, - { 40431, 59997 }, - { 40434, 39016 }, - { 40440, 59994 }, - { 40441, 37353 }, - { 40442, 36331 }, - { 40445, 59998 }, - { 40473, 64586 }, - { 40474, 59999 }, - { 40475, 60000 }, - { 40478, 60001 }, - { 40565, 60002 }, - { 40568, 36018 }, - { 40569, 60003 }, - { 40573, 60004 }, - { 40575, 36525 }, - { 40577, 60005 }, - { 40584, 60006 }, - { 40587, 60007 }, - { 40588, 60008 }, - { 40593, 60011 }, - { 40594, 60009 }, - { 40595, 39003 }, - { 40597, 60010 }, - { 40599, 38893 }, - { 40605, 60012 }, - { 40607, 38873 }, - { 40613, 60013 }, - { 40614, 38046 }, - { 40617, 60014 }, - { 40618, 60016 }, - { 40621, 60017 }, - { 40632, 60015 }, - { 40633, 36237 }, - { 40634, 38603 }, - { 40635, 38531 }, - { 40636, 39925 }, - { 40638, 40832 }, - { 40639, 38555 }, - { 40644, 35241 }, - { 40652, 60019 }, - { 40653, 35695 }, - { 40654, 60020 }, - { 40655, 60021 }, - { 40656, 60022 }, - { 40657, 64587 }, - { 40658, 36245 }, - { 40660, 60023 }, - { 40664, 57554 }, - { 40665, 38617 }, - { 40667, 37345 }, - { 40668, 60024 }, - { 40669, 60026 }, - { 40670, 60025 }, - { 40672, 60027 }, - { 40677, 60028 }, - { 40680, 60029 }, - { 40687, 60030 }, - { 40692, 60032 }, - { 40694, 60033 }, - { 40695, 60034 }, - { 40697, 60035 }, - { 40699, 60036 }, - { 40700, 60037 }, - { 40701, 60038 }, - { 40711, 60039 }, - { 40712, 60040 }, - { 40718, 37699 }, - { 40723, 36059 }, - { 40725, 60042 }, - { 40736, 37228 }, - { 40737, 60043 }, - { 40748, 60044 }, - { 40763, 38208 }, - { 40766, 60045 }, - { 40778, 60046 }, - { 40779, 57942 }, - { 40782, 59096 }, - { 40783, 59627 }, - { 40786, 60047 }, - { 40788, 60048 }, - { 40799, 60050 }, - { 40800, 60051 }, - { 40801, 60052 }, - { 40802, 38894 }, - { 40803, 60049 }, - { 40806, 60053 }, - { 40807, 60054 }, - { 40810, 60056 }, - { 40812, 60055 }, - { 40818, 60058 }, - { 40822, 60059 }, - { 40823, 60057 }, - { 40845, 38836 }, - { 40853, 60060 }, - { 40860, 60061 }, - { 40861, 57971 }, - { 40864, 60062 }, - { 57344, 61504 }, - { 57345, 61505 }, - { 57346, 61506 }, - { 57347, 61507 }, - { 57348, 61508 }, - { 57349, 61509 }, - { 57350, 61510 }, - { 57351, 61511 }, - { 57352, 61512 }, - { 57353, 61513 }, - { 57354, 61514 }, - { 57355, 61515 }, - { 57356, 61516 }, - { 57357, 61517 }, - { 57358, 61518 }, - { 57359, 61519 }, - { 57360, 61520 }, - { 57361, 61521 }, - { 57362, 61522 }, - { 57363, 61523 }, - { 57364, 61524 }, - { 57365, 61525 }, - { 57366, 61526 }, - { 57367, 61527 }, - { 57368, 61528 }, - { 57369, 61529 }, - { 57370, 61530 }, - { 57371, 61531 }, - { 57372, 61532 }, - { 57373, 61533 }, - { 57374, 61534 }, - { 57375, 61535 }, - { 57376, 61536 }, - { 57377, 61537 }, - { 57378, 61538 }, - { 57379, 61539 }, - { 57380, 61540 }, - { 57381, 61541 }, - { 57382, 61542 }, - { 57383, 61543 }, - { 57384, 61544 }, - { 57385, 61545 }, - { 57386, 61546 }, - { 57387, 61547 }, - { 57388, 61548 }, - { 57389, 61549 }, - { 57390, 61550 }, - { 57391, 61551 }, - { 57392, 61552 }, - { 57393, 61553 }, - { 57394, 61554 }, - { 57395, 61555 }, - { 57396, 61556 }, - { 57397, 61557 }, - { 57398, 61558 }, - { 57399, 61559 }, - { 57400, 61560 }, - { 57401, 61561 }, - { 57402, 61562 }, - { 57403, 61563 }, - { 57404, 61564 }, - { 57405, 61565 }, - { 57406, 61566 }, - { 57407, 61568 }, - { 57408, 61569 }, - { 57409, 61570 }, - { 57410, 61571 }, - { 57411, 61572 }, - { 57412, 61573 }, - { 57413, 61574 }, - { 57414, 61575 }, - { 57415, 61576 }, - { 57416, 61577 }, - { 57417, 61578 }, - { 57418, 61579 }, - { 57419, 61580 }, - { 57420, 61581 }, - { 57421, 61582 }, - { 57422, 61583 }, - { 57423, 61584 }, - { 57424, 61585 }, - { 57425, 61586 }, - { 57426, 61587 }, - { 57427, 61588 }, - { 57428, 61589 }, - { 57429, 61590 }, - { 57430, 61591 }, - { 57431, 61592 }, - { 57432, 61593 }, - { 57433, 61594 }, - { 57434, 61595 }, - { 57435, 61596 }, - { 57436, 61597 }, - { 57437, 61598 }, - { 57438, 61599 }, - { 57439, 61600 }, - { 57440, 61601 }, - { 57441, 61602 }, - { 57442, 61603 }, - { 57443, 61604 }, - { 57444, 61605 }, - { 57445, 61606 }, - { 57446, 61607 }, - { 57447, 61608 }, - { 57448, 61609 }, - { 57449, 61610 }, - { 57450, 61611 }, - { 57451, 61612 }, - { 57452, 61613 }, - { 57453, 61614 }, - { 57454, 61615 }, - { 57455, 61616 }, - { 57456, 61617 }, - { 57457, 61618 }, - { 57458, 61619 }, - { 57459, 61620 }, - { 57460, 61621 }, - { 57461, 61622 }, - { 57462, 61623 }, - { 57463, 61624 }, - { 57464, 61625 }, - { 57465, 61626 }, - { 57466, 61627 }, - { 57467, 61628 }, - { 57468, 61629 }, - { 57469, 61630 }, - { 57470, 61631 }, - { 57471, 61632 }, - { 57472, 61633 }, - { 57473, 61634 }, - { 57474, 61635 }, - { 57475, 61636 }, - { 57476, 61637 }, - { 57477, 61638 }, - { 57478, 61639 }, - { 57479, 61640 }, - { 57480, 61641 }, - { 57481, 61642 }, - { 57482, 61643 }, - { 57483, 61644 }, - { 57484, 61645 }, - { 57485, 61646 }, - { 57486, 61647 }, - { 57487, 61648 }, - { 57488, 61649 }, - { 57489, 61650 }, - { 57490, 61651 }, - { 57491, 61652 }, - { 57492, 61653 }, - { 57493, 61654 }, - { 57494, 61655 }, - { 57495, 61656 }, - { 57496, 61657 }, - { 57497, 61658 }, - { 57498, 61659 }, - { 57499, 61660 }, - { 57500, 61661 }, - { 57501, 61662 }, - { 57502, 61663 }, - { 57503, 61664 }, - { 57504, 61665 }, - { 57505, 61666 }, - { 57506, 61667 }, - { 57507, 61668 }, - { 57508, 61669 }, - { 57509, 61670 }, - { 57510, 61671 }, - { 57511, 61672 }, - { 57512, 61673 }, - { 57513, 61674 }, - { 57514, 61675 }, - { 57515, 61676 }, - { 57516, 61677 }, - { 57517, 61678 }, - { 57518, 61679 }, - { 57519, 61680 }, - { 57520, 61681 }, - { 57521, 61682 }, - { 57522, 61683 }, - { 57523, 61684 }, - { 57524, 61685 }, - { 57525, 61686 }, - { 57526, 61687 }, - { 57527, 61688 }, - { 57528, 61689 }, - { 57529, 61690 }, - { 57530, 61691 }, - { 57531, 61692 }, - { 57532, 61760 }, - { 57533, 61761 }, - { 57534, 61762 }, - { 57535, 61763 }, - { 57536, 61764 }, - { 57537, 61765 }, - { 57538, 61766 }, - { 57539, 61767 }, - { 57540, 61768 }, - { 57541, 61769 }, - { 57542, 61770 }, - { 57543, 61771 }, - { 57544, 61772 }, - { 57545, 61773 }, - { 57546, 61774 }, - { 57547, 61775 }, - { 57548, 61776 }, - { 57549, 61777 }, - { 57550, 61778 }, - { 57551, 61779 }, - { 57552, 61780 }, - { 57553, 61781 }, - { 57554, 61782 }, - { 57555, 61783 }, - { 57556, 61784 }, - { 57557, 61785 }, - { 57558, 61786 }, - { 57559, 61787 }, - { 57560, 61788 }, - { 57561, 61789 }, - { 57562, 61790 }, - { 57563, 61791 }, - { 57564, 61792 }, - { 57565, 61793 }, - { 57566, 61794 }, - { 57567, 61795 }, - { 57568, 61796 }, - { 57569, 61797 }, - { 57570, 61798 }, - { 57571, 61799 }, - { 57572, 61800 }, - { 57573, 61801 }, - { 57574, 61802 }, - { 57575, 61803 }, - { 57576, 61804 }, - { 57577, 61805 }, - { 57578, 61806 }, - { 57579, 61807 }, - { 57580, 61808 }, - { 57581, 61809 }, - { 57582, 61810 }, - { 57583, 61811 }, - { 57584, 61812 }, - { 57585, 61813 }, - { 57586, 61814 }, - { 57587, 61815 }, - { 57588, 61816 }, - { 57589, 61817 }, - { 57590, 61818 }, - { 57591, 61819 }, - { 57592, 61820 }, - { 57593, 61821 }, - { 57594, 61822 }, - { 57595, 61824 }, - { 57596, 61825 }, - { 57597, 61826 }, - { 57598, 61827 }, - { 57599, 61828 }, - { 57600, 61829 }, - { 57601, 61830 }, - { 57602, 61831 }, - { 57603, 61832 }, - { 57604, 61833 }, - { 57605, 61834 }, - { 57606, 61835 }, - { 57607, 61836 }, - { 57608, 61837 }, - { 57609, 61838 }, - { 57610, 61839 }, - { 57611, 61840 }, - { 57612, 61841 }, - { 57613, 61842 }, - { 57614, 61843 }, - { 57615, 61844 }, - { 57616, 61845 }, - { 57617, 61846 }, - { 57618, 61847 }, - { 57619, 61848 }, - { 57620, 61849 }, - { 57621, 61850 }, - { 57622, 61851 }, - { 57623, 61852 }, - { 57624, 61853 }, - { 57625, 61854 }, - { 57626, 61855 }, - { 57627, 61856 }, - { 57628, 61857 }, - { 57629, 61858 }, - { 57630, 61859 }, - { 57631, 61860 }, - { 57632, 61861 }, - { 57633, 61862 }, - { 57634, 61863 }, - { 57635, 61864 }, - { 57636, 61865 }, - { 57637, 61866 }, - { 57638, 61867 }, - { 57639, 61868 }, - { 57640, 61869 }, - { 57641, 61870 }, - { 57642, 61871 }, - { 57643, 61872 }, - { 57644, 61873 }, - { 57645, 61874 }, - { 57646, 61875 }, - { 57647, 61876 }, - { 57648, 61877 }, - { 57649, 61878 }, - { 57650, 61879 }, - { 57651, 61880 }, - { 57652, 61881 }, - { 57653, 61882 }, - { 57654, 61883 }, - { 57655, 61884 }, - { 57656, 61885 }, - { 57657, 61886 }, - { 57658, 61887 }, - { 57659, 61888 }, - { 57660, 61889 }, - { 57661, 61890 }, - { 57662, 61891 }, - { 57663, 61892 }, - { 57664, 61893 }, - { 57665, 61894 }, - { 57666, 61895 }, - { 57667, 61896 }, - { 57668, 61897 }, - { 57669, 61898 }, - { 57670, 61899 }, - { 57671, 61900 }, - { 57672, 61901 }, - { 57673, 61902 }, - { 57674, 61903 }, - { 57675, 61904 }, - { 57676, 61905 }, - { 57677, 61906 }, - { 57678, 61907 }, - { 57679, 61908 }, - { 57680, 61909 }, - { 57681, 61910 }, - { 57682, 61911 }, - { 57683, 61912 }, - { 57684, 61913 }, - { 57685, 61914 }, - { 57686, 61915 }, - { 57687, 61916 }, - { 57688, 61917 }, - { 57689, 61918 }, - { 57690, 61919 }, - { 57691, 61920 }, - { 57692, 61921 }, - { 57693, 61922 }, - { 57694, 61923 }, - { 57695, 61924 }, - { 57696, 61925 }, - { 57697, 61926 }, - { 57698, 61927 }, - { 57699, 61928 }, - { 57700, 61929 }, - { 57701, 61930 }, - { 57702, 61931 }, - { 57703, 61932 }, - { 57704, 61933 }, - { 57705, 61934 }, - { 57706, 61935 }, - { 57707, 61936 }, - { 57708, 61937 }, - { 57709, 61938 }, - { 57710, 61939 }, - { 57711, 61940 }, - { 57712, 61941 }, - { 57713, 61942 }, - { 57714, 61943 }, - { 57715, 61944 }, - { 57716, 61945 }, - { 57717, 61946 }, - { 57718, 61947 }, - { 57719, 61948 }, - { 57720, 62016 }, - { 57721, 62017 }, - { 57722, 62018 }, - { 57723, 62019 }, - { 57724, 62020 }, - { 57725, 62021 }, - { 57726, 62022 }, - { 57727, 62023 }, - { 57728, 62024 }, - { 57729, 62025 }, - { 57730, 62026 }, - { 57731, 62027 }, - { 57732, 62028 }, - { 57733, 62029 }, - { 57734, 62030 }, - { 57735, 62031 }, - { 57736, 62032 }, - { 57737, 62033 }, - { 57738, 62034 }, - { 57739, 62035 }, - { 57740, 62036 }, - { 57741, 62037 }, - { 57742, 62038 }, - { 57743, 62039 }, - { 57744, 62040 }, - { 57745, 62041 }, - { 57746, 62042 }, - { 57747, 62043 }, - { 57748, 62044 }, - { 57749, 62045 }, - { 57750, 62046 }, - { 57751, 62047 }, - { 57752, 62048 }, - { 57753, 62049 }, - { 57754, 62050 }, - { 57755, 62051 }, - { 57756, 62052 }, - { 57757, 62053 }, - { 57758, 62054 }, - { 57759, 62055 }, - { 57760, 62056 }, - { 57761, 62057 }, - { 57762, 62058 }, - { 57763, 62059 }, - { 57764, 62060 }, - { 57765, 62061 }, - { 57766, 62062 }, - { 57767, 62063 }, - { 57768, 62064 }, - { 57769, 62065 }, - { 57770, 62066 }, - { 57771, 62067 }, - { 57772, 62068 }, - { 57773, 62069 }, - { 57774, 62070 }, - { 57775, 62071 }, - { 57776, 62072 }, - { 57777, 62073 }, - { 57778, 62074 }, - { 57779, 62075 }, - { 57780, 62076 }, - { 57781, 62077 }, - { 57782, 62078 }, - { 57783, 62080 }, - { 57784, 62081 }, - { 57785, 62082 }, - { 57786, 62083 }, - { 57787, 62084 }, - { 57788, 62085 }, - { 57789, 62086 }, - { 57790, 62087 }, - { 57791, 62088 }, - { 57792, 62089 }, - { 57793, 62090 }, - { 57794, 62091 }, - { 57795, 62092 }, - { 57796, 62093 }, - { 57797, 62094 }, - { 57798, 62095 }, - { 57799, 62096 }, - { 57800, 62097 }, - { 57801, 62098 }, - { 57802, 62099 }, - { 57803, 62100 }, - { 57804, 62101 }, - { 57805, 62102 }, - { 57806, 62103 }, - { 57807, 62104 }, - { 57808, 62105 }, - { 57809, 62106 }, - { 57810, 62107 }, - { 57811, 62108 }, - { 57812, 62109 }, - { 57813, 62110 }, - { 57814, 62111 }, - { 57815, 62112 }, - { 57816, 62113 }, - { 57817, 62114 }, - { 57818, 62115 }, - { 57819, 62116 }, - { 57820, 62117 }, - { 57821, 62118 }, - { 57822, 62119 }, - { 57823, 62120 }, - { 57824, 62121 }, - { 57825, 62122 }, - { 57826, 62123 }, - { 57827, 62124 }, - { 57828, 62125 }, - { 57829, 62126 }, - { 57830, 62127 }, - { 57831, 62128 }, - { 57832, 62129 }, - { 57833, 62130 }, - { 57834, 62131 }, - { 57835, 62132 }, - { 57836, 62133 }, - { 57837, 62134 }, - { 57838, 62135 }, - { 57839, 62136 }, - { 57840, 62137 }, - { 57841, 62138 }, - { 57842, 62139 }, - { 57843, 62140 }, - { 57844, 62141 }, - { 57845, 62142 }, - { 57846, 62143 }, - { 57847, 62144 }, - { 57848, 62145 }, - { 57849, 62146 }, - { 57850, 62147 }, - { 57851, 62148 }, - { 57852, 62149 }, - { 57853, 62150 }, - { 57854, 62151 }, - { 57855, 62152 }, - { 57856, 62153 }, - { 57857, 62154 }, - { 57858, 62155 }, - { 57859, 62156 }, - { 57860, 62157 }, - { 57861, 62158 }, - { 57862, 62159 }, - { 57863, 62160 }, - { 57864, 62161 }, - { 57865, 62162 }, - { 57866, 62163 }, - { 57867, 62164 }, - { 57868, 62165 }, - { 57869, 62166 }, - { 57870, 62167 }, - { 57871, 62168 }, - { 57872, 62169 }, - { 57873, 62170 }, - { 57874, 62171 }, - { 57875, 62172 }, - { 57876, 62173 }, - { 57877, 62174 }, - { 57878, 62175 }, - { 57879, 62176 }, - { 57880, 62177 }, - { 57881, 62178 }, - { 57882, 62179 }, - { 57883, 62180 }, - { 57884, 62181 }, - { 57885, 62182 }, - { 57886, 62183 }, - { 57887, 62184 }, - { 57888, 62185 }, - { 57889, 62186 }, - { 57890, 62187 }, - { 57891, 62188 }, - { 57892, 62189 }, - { 57893, 62190 }, - { 57894, 62191 }, - { 57895, 62192 }, - { 57896, 62193 }, - { 57897, 62194 }, - { 57898, 62195 }, - { 57899, 62196 }, - { 57900, 62197 }, - { 57901, 62198 }, - { 57902, 62199 }, - { 57903, 62200 }, - { 57904, 62201 }, - { 57905, 62202 }, - { 57906, 62203 }, - { 57907, 62204 }, - { 57908, 62272 }, - { 57909, 62273 }, - { 57910, 62274 }, - { 57911, 62275 }, - { 57912, 62276 }, - { 57913, 62277 }, - { 57914, 62278 }, - { 57915, 62279 }, - { 57916, 62280 }, - { 57917, 62281 }, - { 57918, 62282 }, - { 57919, 62283 }, - { 57920, 62284 }, - { 57921, 62285 }, - { 57922, 62286 }, - { 57923, 62287 }, - { 57924, 62288 }, - { 57925, 62289 }, - { 57926, 62290 }, - { 57927, 62291 }, - { 57928, 62292 }, - { 57929, 62293 }, - { 57930, 62294 }, - { 57931, 62295 }, - { 57932, 62296 }, - { 57933, 62297 }, - { 57934, 62298 }, - { 57935, 62299 }, - { 57936, 62300 }, - { 57937, 62301 }, - { 57938, 62302 }, - { 57939, 62303 }, - { 57940, 62304 }, - { 57941, 62305 }, - { 57942, 62306 }, - { 57943, 62307 }, - { 57944, 62308 }, - { 57945, 62309 }, - { 57946, 62310 }, - { 57947, 62311 }, - { 57948, 62312 }, - { 57949, 62313 }, - { 57950, 62314 }, - { 57951, 62315 }, - { 57952, 62316 }, - { 57953, 62317 }, - { 57954, 62318 }, - { 57955, 62319 }, - { 57956, 62320 }, - { 57957, 62321 }, - { 57958, 62322 }, - { 57959, 62323 }, - { 57960, 62324 }, - { 57961, 62325 }, - { 57962, 62326 }, - { 57963, 62327 }, - { 57964, 62328 }, - { 57965, 62329 }, - { 57966, 62330 }, - { 57967, 62331 }, - { 57968, 62332 }, - { 57969, 62333 }, - { 57970, 62334 }, - { 57971, 62336 }, - { 57972, 62337 }, - { 57973, 62338 }, - { 57974, 62339 }, - { 57975, 62340 }, - { 57976, 62341 }, - { 57977, 62342 }, - { 57978, 62343 }, - { 57979, 62344 }, - { 57980, 62345 }, - { 57981, 62346 }, - { 57982, 62347 }, - { 57983, 62348 }, - { 57984, 62349 }, - { 57985, 62350 }, - { 57986, 62351 }, - { 57987, 62352 }, - { 57988, 62353 }, - { 57989, 62354 }, - { 57990, 62355 }, - { 57991, 62356 }, - { 57992, 62357 }, - { 57993, 62358 }, - { 57994, 62359 }, - { 57995, 62360 }, - { 57996, 62361 }, - { 57997, 62362 }, - { 57998, 62363 }, - { 57999, 62364 }, - { 58000, 62365 }, - { 58001, 62366 }, - { 58002, 62367 }, - { 58003, 62368 }, - { 58004, 62369 }, - { 58005, 62370 }, - { 58006, 62371 }, - { 58007, 62372 }, - { 58008, 62373 }, - { 58009, 62374 }, - { 58010, 62375 }, - { 58011, 62376 }, - { 58012, 62377 }, - { 58013, 62378 }, - { 58014, 62379 }, - { 58015, 62380 }, - { 58016, 62381 }, - { 58017, 62382 }, - { 58018, 62383 }, - { 58019, 62384 }, - { 58020, 62385 }, - { 58021, 62386 }, - { 58022, 62387 }, - { 58023, 62388 }, - { 58024, 62389 }, - { 58025, 62390 }, - { 58026, 62391 }, - { 58027, 62392 }, - { 58028, 62393 }, - { 58029, 62394 }, - { 58030, 62395 }, - { 58031, 62396 }, - { 58032, 62397 }, - { 58033, 62398 }, - { 58034, 62399 }, - { 58035, 62400 }, - { 58036, 62401 }, - { 58037, 62402 }, - { 58038, 62403 }, - { 58039, 62404 }, - { 58040, 62405 }, - { 58041, 62406 }, - { 58042, 62407 }, - { 58043, 62408 }, - { 58044, 62409 }, - { 58045, 62410 }, - { 58046, 62411 }, - { 58047, 62412 }, - { 58048, 62413 }, - { 58049, 62414 }, - { 58050, 62415 }, - { 58051, 62416 }, - { 58052, 62417 }, - { 58053, 62418 }, - { 58054, 62419 }, - { 58055, 62420 }, - { 58056, 62421 }, - { 58057, 62422 }, - { 58058, 62423 }, - { 58059, 62424 }, - { 58060, 62425 }, - { 58061, 62426 }, - { 58062, 62427 }, - { 58063, 62428 }, - { 58064, 62429 }, - { 58065, 62430 }, - { 58066, 62431 }, - { 58067, 62432 }, - { 58068, 62433 }, - { 58069, 62434 }, - { 58070, 62435 }, - { 58071, 62436 }, - { 58072, 62437 }, - { 58073, 62438 }, - { 58074, 62439 }, - { 58075, 62440 }, - { 58076, 62441 }, - { 58077, 62442 }, - { 58078, 62443 }, - { 58079, 62444 }, - { 58080, 62445 }, - { 58081, 62446 }, - { 58082, 62447 }, - { 58083, 62448 }, - { 58084, 62449 }, - { 58085, 62450 }, - { 58086, 62451 }, - { 58087, 62452 }, - { 58088, 62453 }, - { 58089, 62454 }, - { 58090, 62455 }, - { 58091, 62456 }, - { 58092, 62457 }, - { 58093, 62458 }, - { 58094, 62459 }, - { 58095, 62460 }, - { 58096, 62528 }, - { 58097, 62529 }, - { 58098, 62530 }, - { 58099, 62531 }, - { 58100, 62532 }, - { 58101, 62533 }, - { 58102, 62534 }, - { 58103, 62535 }, - { 58104, 62536 }, - { 58105, 62537 }, - { 58106, 62538 }, - { 58107, 62539 }, - { 58108, 62540 }, - { 58109, 62541 }, - { 58110, 62542 }, - { 58111, 62543 }, - { 58112, 62544 }, - { 58113, 62545 }, - { 58114, 62546 }, - { 58115, 62547 }, - { 58116, 62548 }, - { 58117, 62549 }, - { 58118, 62550 }, - { 58119, 62551 }, - { 58120, 62552 }, - { 58121, 62553 }, - { 58122, 62554 }, - { 58123, 62555 }, - { 58124, 62556 }, - { 58125, 62557 }, - { 58126, 62558 }, - { 58127, 62559 }, - { 58128, 62560 }, - { 58129, 62561 }, - { 58130, 62562 }, - { 58131, 62563 }, - { 58132, 62564 }, - { 58133, 62565 }, - { 58134, 62566 }, - { 58135, 62567 }, - { 58136, 62568 }, - { 58137, 62569 }, - { 58138, 62570 }, - { 58139, 62571 }, - { 58140, 62572 }, - { 58141, 62573 }, - { 58142, 62574 }, - { 58143, 62575 }, - { 58144, 62576 }, - { 58145, 62577 }, - { 58146, 62578 }, - { 58147, 62579 }, - { 58148, 62580 }, - { 58149, 62581 }, - { 58150, 62582 }, - { 58151, 62583 }, - { 58152, 62584 }, - { 58153, 62585 }, - { 58154, 62586 }, - { 58155, 62587 }, - { 58156, 62588 }, - { 58157, 62589 }, - { 58158, 62590 }, - { 58159, 62592 }, - { 58160, 62593 }, - { 58161, 62594 }, - { 58162, 62595 }, - { 58163, 62596 }, - { 58164, 62597 }, - { 58165, 62598 }, - { 58166, 62599 }, - { 58167, 62600 }, - { 58168, 62601 }, - { 58169, 62602 }, - { 58170, 62603 }, - { 58171, 62604 }, - { 58172, 62605 }, - { 58173, 62606 }, - { 58174, 62607 }, - { 58175, 62608 }, - { 58176, 62609 }, - { 58177, 62610 }, - { 58178, 62611 }, - { 58179, 62612 }, - { 58180, 62613 }, - { 58181, 62614 }, - { 58182, 62615 }, - { 58183, 62616 }, - { 58184, 62617 }, - { 58185, 62618 }, - { 58186, 62619 }, - { 58187, 62620 }, - { 58188, 62621 }, - { 58189, 62622 }, - { 58190, 62623 }, - { 58191, 62624 }, - { 58192, 62625 }, - { 58193, 62626 }, - { 58194, 62627 }, - { 58195, 62628 }, - { 58196, 62629 }, - { 58197, 62630 }, - { 58198, 62631 }, - { 58199, 62632 }, - { 58200, 62633 }, - { 58201, 62634 }, - { 58202, 62635 }, - { 58203, 62636 }, - { 58204, 62637 }, - { 58205, 62638 }, - { 58206, 62639 }, - { 58207, 62640 }, - { 58208, 62641 }, - { 58209, 62642 }, - { 58210, 62643 }, - { 58211, 62644 }, - { 58212, 62645 }, - { 58213, 62646 }, - { 58214, 62647 }, - { 58215, 62648 }, - { 58216, 62649 }, - { 58217, 62650 }, - { 58218, 62651 }, - { 58219, 62652 }, - { 58220, 62653 }, - { 58221, 62654 }, - { 58222, 62655 }, - { 58223, 62656 }, - { 58224, 62657 }, - { 58225, 62658 }, - { 58226, 62659 }, - { 58227, 62660 }, - { 58228, 62661 }, - { 58229, 62662 }, - { 58230, 62663 }, - { 58231, 62664 }, - { 58232, 62665 }, - { 58233, 62666 }, - { 58234, 62667 }, - { 58235, 62668 }, - { 58236, 62669 }, - { 58237, 62670 }, - { 58238, 62671 }, - { 58239, 62672 }, - { 58240, 62673 }, - { 58241, 62674 }, - { 58242, 62675 }, - { 58243, 62676 }, - { 58244, 62677 }, - { 58245, 62678 }, - { 58246, 62679 }, - { 58247, 62680 }, - { 58248, 62681 }, - { 58249, 62682 }, - { 58250, 62683 }, - { 58251, 62684 }, - { 58252, 62685 }, - { 58253, 62686 }, - { 58254, 62687 }, - { 58255, 62688 }, - { 58256, 62689 }, - { 58257, 62690 }, - { 58258, 62691 }, - { 58259, 62692 }, - { 58260, 62693 }, - { 58261, 62694 }, - { 58262, 62695 }, - { 58263, 62696 }, - { 58264, 62697 }, - { 58265, 62698 }, - { 58266, 62699 }, - { 58267, 62700 }, - { 58268, 62701 }, - { 58269, 62702 }, - { 58270, 62703 }, - { 58271, 62704 }, - { 58272, 62705 }, - { 58273, 62706 }, - { 58274, 62707 }, - { 58275, 62708 }, - { 58276, 62709 }, - { 58277, 62710 }, - { 58278, 62711 }, - { 58279, 62712 }, - { 58280, 62713 }, - { 58281, 62714 }, - { 58282, 62715 }, - { 58283, 62716 }, - { 58284, 62784 }, - { 58285, 62785 }, - { 58286, 62786 }, - { 58287, 62787 }, - { 58288, 62788 }, - { 58289, 62789 }, - { 58290, 62790 }, - { 58291, 62791 }, - { 58292, 62792 }, - { 58293, 62793 }, - { 58294, 62794 }, - { 58295, 62795 }, - { 58296, 62796 }, - { 58297, 62797 }, - { 58298, 62798 }, - { 58299, 62799 }, - { 58300, 62800 }, - { 58301, 62801 }, - { 58302, 62802 }, - { 58303, 62803 }, - { 58304, 62804 }, - { 58305, 62805 }, - { 58306, 62806 }, - { 58307, 62807 }, - { 58308, 62808 }, - { 58309, 62809 }, - { 58310, 62810 }, - { 58311, 62811 }, - { 58312, 62812 }, - { 58313, 62813 }, - { 58314, 62814 }, - { 58315, 62815 }, - { 58316, 62816 }, - { 58317, 62817 }, - { 58318, 62818 }, - { 58319, 62819 }, - { 58320, 62820 }, - { 58321, 62821 }, - { 58322, 62822 }, - { 58323, 62823 }, - { 58324, 62824 }, - { 58325, 62825 }, - { 58326, 62826 }, - { 58327, 62827 }, - { 58328, 62828 }, - { 58329, 62829 }, - { 58330, 62830 }, - { 58331, 62831 }, - { 58332, 62832 }, - { 58333, 62833 }, - { 58334, 62834 }, - { 58335, 62835 }, - { 58336, 62836 }, - { 58337, 62837 }, - { 58338, 62838 }, - { 58339, 62839 }, - { 58340, 62840 }, - { 58341, 62841 }, - { 58342, 62842 }, - { 58343, 62843 }, - { 58344, 62844 }, - { 58345, 62845 }, - { 58346, 62846 }, - { 58347, 62848 }, - { 58348, 62849 }, - { 58349, 62850 }, - { 58350, 62851 }, - { 58351, 62852 }, - { 58352, 62853 }, - { 58353, 62854 }, - { 58354, 62855 }, - { 58355, 62856 }, - { 58356, 62857 }, - { 58357, 62858 }, - { 58358, 62859 }, - { 58359, 62860 }, - { 58360, 62861 }, - { 58361, 62862 }, - { 58362, 62863 }, - { 58363, 62864 }, - { 58364, 62865 }, - { 58365, 62866 }, - { 58366, 62867 }, - { 58367, 62868 }, - { 58368, 62869 }, - { 58369, 62870 }, - { 58370, 62871 }, - { 58371, 62872 }, - { 58372, 62873 }, - { 58373, 62874 }, - { 58374, 62875 }, - { 58375, 62876 }, - { 58376, 62877 }, - { 58377, 62878 }, - { 58378, 62879 }, - { 58379, 62880 }, - { 58380, 62881 }, - { 58381, 62882 }, - { 58382, 62883 }, - { 58383, 62884 }, - { 58384, 62885 }, - { 58385, 62886 }, - { 58386, 62887 }, - { 58387, 62888 }, - { 58388, 62889 }, - { 58389, 62890 }, - { 58390, 62891 }, - { 58391, 62892 }, - { 58392, 62893 }, - { 58393, 62894 }, - { 58394, 62895 }, - { 58395, 62896 }, - { 58396, 62897 }, - { 58397, 62898 }, - { 58398, 62899 }, - { 58399, 62900 }, - { 58400, 62901 }, - { 58401, 62902 }, - { 58402, 62903 }, - { 58403, 62904 }, - { 58404, 62905 }, - { 58405, 62906 }, - { 58406, 62907 }, - { 58407, 62908 }, - { 58408, 62909 }, - { 58409, 62910 }, - { 58410, 62911 }, - { 58411, 62912 }, - { 58412, 62913 }, - { 58413, 62914 }, - { 58414, 62915 }, - { 58415, 62916 }, - { 58416, 62917 }, - { 58417, 62918 }, - { 58418, 62919 }, - { 58419, 62920 }, - { 58420, 62921 }, - { 58421, 62922 }, - { 58422, 62923 }, - { 58423, 62924 }, - { 58424, 62925 }, - { 58425, 62926 }, - { 58426, 62927 }, - { 58427, 62928 }, - { 58428, 62929 }, - { 58429, 62930 }, - { 58430, 62931 }, - { 58431, 62932 }, - { 58432, 62933 }, - { 58433, 62934 }, - { 58434, 62935 }, - { 58435, 62936 }, - { 58436, 62937 }, - { 58437, 62938 }, - { 58438, 62939 }, - { 58439, 62940 }, - { 58440, 62941 }, - { 58441, 62942 }, - { 58442, 62943 }, - { 58443, 62944 }, - { 58444, 62945 }, - { 58445, 62946 }, - { 58446, 62947 }, - { 58447, 62948 }, - { 58448, 62949 }, - { 58449, 62950 }, - { 58450, 62951 }, - { 58451, 62952 }, - { 58452, 62953 }, - { 58453, 62954 }, - { 58454, 62955 }, - { 58455, 62956 }, - { 58456, 62957 }, - { 58457, 62958 }, - { 58458, 62959 }, - { 58459, 62960 }, - { 58460, 62961 }, - { 58461, 62962 }, - { 58462, 62963 }, - { 58463, 62964 }, - { 58464, 62965 }, - { 58465, 62966 }, - { 58466, 62967 }, - { 58467, 62968 }, - { 58468, 62969 }, - { 58469, 62970 }, - { 58470, 62971 }, - { 58471, 62972 }, - { 58472, 63040 }, - { 58473, 63041 }, - { 58474, 63042 }, - { 58475, 63043 }, - { 58476, 63044 }, - { 58477, 63045 }, - { 58478, 63046 }, - { 58479, 63047 }, - { 58480, 63048 }, - { 58481, 63049 }, - { 58482, 63050 }, - { 58483, 63051 }, - { 58484, 63052 }, - { 58485, 63053 }, - { 58486, 63054 }, - { 58487, 63055 }, - { 58488, 63056 }, - { 58489, 63057 }, - { 58490, 63058 }, - { 58491, 63059 }, - { 58492, 63060 }, - { 58493, 63061 }, - { 58494, 63062 }, - { 58495, 63063 }, - { 58496, 63064 }, - { 58497, 63065 }, - { 58498, 63066 }, - { 58499, 63067 }, - { 58500, 63068 }, - { 58501, 63069 }, - { 58502, 63070 }, - { 58503, 63071 }, - { 58504, 63072 }, - { 58505, 63073 }, - { 58506, 63074 }, - { 58507, 63075 }, - { 58508, 63076 }, - { 58509, 63077 }, - { 58510, 63078 }, - { 58511, 63079 }, - { 58512, 63080 }, - { 58513, 63081 }, - { 58514, 63082 }, - { 58515, 63083 }, - { 58516, 63084 }, - { 58517, 63085 }, - { 58518, 63086 }, - { 58519, 63087 }, - { 58520, 63088 }, - { 58521, 63089 }, - { 58522, 63090 }, - { 58523, 63091 }, - { 58524, 63092 }, - { 58525, 63093 }, - { 58526, 63094 }, - { 58527, 63095 }, - { 58528, 63096 }, - { 58529, 63097 }, - { 58530, 63098 }, - { 58531, 63099 }, - { 58532, 63100 }, - { 58533, 63101 }, - { 58534, 63102 }, - { 58535, 63104 }, - { 58536, 63105 }, - { 58537, 63106 }, - { 58538, 63107 }, - { 58539, 63108 }, - { 58540, 63109 }, - { 58541, 63110 }, - { 58542, 63111 }, - { 58543, 63112 }, - { 58544, 63113 }, - { 58545, 63114 }, - { 58546, 63115 }, - { 58547, 63116 }, - { 58548, 63117 }, - { 58549, 63118 }, - { 58550, 63119 }, - { 58551, 63120 }, - { 58552, 63121 }, - { 58553, 63122 }, - { 58554, 63123 }, - { 58555, 63124 }, - { 58556, 63125 }, - { 58557, 63126 }, - { 58558, 63127 }, - { 58559, 63128 }, - { 58560, 63129 }, - { 58561, 63130 }, - { 58562, 63131 }, - { 58563, 63132 }, - { 58564, 63133 }, - { 58565, 63134 }, - { 58566, 63135 }, - { 58567, 63136 }, - { 58568, 63137 }, - { 58569, 63138 }, - { 58570, 63139 }, - { 58571, 63140 }, - { 58572, 63141 }, - { 58573, 63142 }, - { 58574, 63143 }, - { 58575, 63144 }, - { 58576, 63145 }, - { 58577, 63146 }, - { 58578, 63147 }, - { 58579, 63148 }, - { 58580, 63149 }, - { 58581, 63150 }, - { 58582, 63151 }, - { 58583, 63152 }, - { 58584, 63153 }, - { 58585, 63154 }, - { 58586, 63155 }, - { 58587, 63156 }, - { 58588, 63157 }, - { 58589, 63158 }, - { 58590, 63159 }, - { 58591, 63160 }, - { 58592, 63161 }, - { 58593, 63162 }, - { 58594, 63163 }, - { 58595, 63164 }, - { 58596, 63165 }, - { 58597, 63166 }, - { 58598, 63167 }, - { 58599, 63168 }, - { 58600, 63169 }, - { 58601, 63170 }, - { 58602, 63171 }, - { 58603, 63172 }, - { 58604, 63173 }, - { 58605, 63174 }, - { 58606, 63175 }, - { 58607, 63176 }, - { 58608, 63177 }, - { 58609, 63178 }, - { 58610, 63179 }, - { 58611, 63180 }, - { 58612, 63181 }, - { 58613, 63182 }, - { 58614, 63183 }, - { 58615, 63184 }, - { 58616, 63185 }, - { 58617, 63186 }, - { 58618, 63187 }, - { 58619, 63188 }, - { 58620, 63189 }, - { 58621, 63190 }, - { 58622, 63191 }, - { 58623, 63192 }, - { 58624, 63193 }, - { 58625, 63194 }, - { 58626, 63195 }, - { 58627, 63196 }, - { 58628, 63197 }, - { 58629, 63198 }, - { 58630, 63199 }, - { 58631, 63200 }, - { 58632, 63201 }, - { 58633, 63202 }, - { 58634, 63203 }, - { 58635, 63204 }, - { 58636, 63205 }, - { 58637, 63206 }, - { 58638, 63207 }, - { 58639, 63208 }, - { 58640, 63209 }, - { 58641, 63210 }, - { 58642, 63211 }, - { 58643, 63212 }, - { 58644, 63213 }, - { 58645, 63214 }, - { 58646, 63215 }, - { 58647, 63216 }, - { 58648, 63217 }, - { 58649, 63218 }, - { 58650, 63219 }, - { 58651, 63220 }, - { 58652, 63221 }, - { 58653, 63222 }, - { 58654, 63223 }, - { 58655, 63224 }, - { 58656, 63225 }, - { 58657, 63226 }, - { 58658, 63227 }, - { 58659, 63228 }, - { 58660, 63296 }, - { 58661, 63297 }, - { 58662, 63298 }, - { 58663, 63299 }, - { 58664, 63300 }, - { 58665, 63301 }, - { 58666, 63302 }, - { 58667, 63303 }, - { 58668, 63304 }, - { 58669, 63305 }, - { 58670, 63306 }, - { 58671, 63307 }, - { 58672, 63308 }, - { 58673, 63309 }, - { 58674, 63310 }, - { 58675, 63311 }, - { 58676, 63312 }, - { 58677, 63313 }, - { 58678, 63314 }, - { 58679, 63315 }, - { 58680, 63316 }, - { 58681, 63317 }, - { 58682, 63318 }, - { 58683, 63319 }, - { 58684, 63320 }, - { 58685, 63321 }, - { 58686, 63322 }, - { 58687, 63323 }, - { 58688, 63324 }, - { 58689, 63325 }, - { 58690, 63326 }, - { 58691, 63327 }, - { 58692, 63328 }, - { 58693, 63329 }, - { 58694, 63330 }, - { 58695, 63331 }, - { 58696, 63332 }, - { 58697, 63333 }, - { 58698, 63334 }, - { 58699, 63335 }, - { 58700, 63336 }, - { 58701, 63337 }, - { 58702, 63338 }, - { 58703, 63339 }, - { 58704, 63340 }, - { 58705, 63341 }, - { 58706, 63342 }, - { 58707, 63343 }, - { 58708, 63344 }, - { 58709, 63345 }, - { 58710, 63346 }, - { 58711, 63347 }, - { 58712, 63348 }, - { 58713, 63349 }, - { 58714, 63350 }, - { 58715, 63351 }, - { 58716, 63352 }, - { 58717, 63353 }, - { 58718, 63354 }, - { 58719, 63355 }, - { 58720, 63356 }, - { 58721, 63357 }, - { 58722, 63358 }, - { 58723, 63360 }, - { 58724, 63361 }, - { 58725, 63362 }, - { 58726, 63363 }, - { 58727, 63364 }, - { 58728, 63365 }, - { 58729, 63366 }, - { 58730, 63367 }, - { 58731, 63368 }, - { 58732, 63369 }, - { 58733, 63370 }, - { 58734, 63371 }, - { 58735, 63372 }, - { 58736, 63373 }, - { 58737, 63374 }, - { 58738, 63375 }, - { 58739, 63376 }, - { 58740, 63377 }, - { 58741, 63378 }, - { 58742, 63379 }, - { 58743, 63380 }, - { 58744, 63381 }, - { 58745, 63382 }, - { 58746, 63383 }, - { 58747, 63384 }, - { 58748, 63385 }, - { 58749, 63386 }, - { 58750, 63387 }, - { 58751, 63388 }, - { 58752, 63389 }, - { 58753, 63390 }, - { 58754, 63391 }, - { 58755, 63392 }, - { 58756, 63393 }, - { 58757, 63394 }, - { 58758, 63395 }, - { 58759, 63396 }, - { 58760, 63397 }, - { 58761, 63398 }, - { 58762, 63399 }, - { 58763, 63400 }, - { 58764, 63401 }, - { 58765, 63402 }, - { 58766, 63403 }, - { 58767, 63404 }, - { 58768, 63405 }, - { 58769, 63406 }, - { 58770, 63407 }, - { 58771, 63408 }, - { 58772, 63409 }, - { 58773, 63410 }, - { 58774, 63411 }, - { 58775, 63412 }, - { 58776, 63413 }, - { 58777, 63414 }, - { 58778, 63415 }, - { 58779, 63416 }, - { 58780, 63417 }, - { 58781, 63418 }, - { 58782, 63419 }, - { 58783, 63420 }, - { 58784, 63421 }, - { 58785, 63422 }, - { 58786, 63423 }, - { 58787, 63424 }, - { 58788, 63425 }, - { 58789, 63426 }, - { 58790, 63427 }, - { 58791, 63428 }, - { 58792, 63429 }, - { 58793, 63430 }, - { 58794, 63431 }, - { 58795, 63432 }, - { 58796, 63433 }, - { 58797, 63434 }, - { 58798, 63435 }, - { 58799, 63436 }, - { 58800, 63437 }, - { 58801, 63438 }, - { 58802, 63439 }, - { 58803, 63440 }, - { 58804, 63441 }, - { 58805, 63442 }, - { 58806, 63443 }, - { 58807, 63444 }, - { 58808, 63445 }, - { 58809, 63446 }, - { 58810, 63447 }, - { 58811, 63448 }, - { 58812, 63449 }, - { 58813, 63450 }, - { 58814, 63451 }, - { 58815, 63452 }, - { 58816, 63453 }, - { 58817, 63454 }, - { 58818, 63455 }, - { 58819, 63456 }, - { 58820, 63457 }, - { 58821, 63458 }, - { 58822, 63459 }, - { 58823, 63460 }, - { 58824, 63461 }, - { 58825, 63462 }, - { 58826, 63463 }, - { 58827, 63464 }, - { 58828, 63465 }, - { 58829, 63466 }, - { 58830, 63467 }, - { 58831, 63468 }, - { 58832, 63469 }, - { 58833, 63470 }, - { 58834, 63471 }, - { 58835, 63472 }, - { 58836, 63473 }, - { 58837, 63474 }, - { 58838, 63475 }, - { 58839, 63476 }, - { 58840, 63477 }, - { 58841, 63478 }, - { 58842, 63479 }, - { 58843, 63480 }, - { 58844, 63481 }, - { 58845, 63482 }, - { 58846, 63483 }, - { 58847, 63484 }, - { 58848, 63552 }, - { 58849, 63553 }, - { 58850, 63554 }, - { 58851, 63555 }, - { 58852, 63556 }, - { 58853, 63557 }, - { 58854, 63558 }, - { 58855, 63559 }, - { 58856, 63560 }, - { 58857, 63561 }, - { 58858, 63562 }, - { 58859, 63563 }, - { 58860, 63564 }, - { 58861, 63565 }, - { 58862, 63566 }, - { 58863, 63567 }, - { 58864, 63568 }, - { 58865, 63569 }, - { 58866, 63570 }, - { 58867, 63571 }, - { 58868, 63572 }, - { 58869, 63573 }, - { 58870, 63574 }, - { 58871, 63575 }, - { 58872, 63576 }, - { 58873, 63577 }, - { 58874, 63578 }, - { 58875, 63579 }, - { 58876, 63580 }, - { 58877, 63581 }, - { 58878, 63582 }, - { 58879, 63583 }, - { 58880, 63584 }, - { 58881, 63585 }, - { 58882, 63586 }, - { 58883, 63587 }, - { 58884, 63588 }, - { 58885, 63589 }, - { 58886, 63590 }, - { 58887, 63591 }, - { 58888, 63592 }, - { 58889, 63593 }, - { 58890, 63594 }, - { 58891, 63595 }, - { 58892, 63596 }, - { 58893, 63597 }, - { 58894, 63598 }, - { 58895, 63599 }, - { 58896, 63600 }, - { 58897, 63601 }, - { 58898, 63602 }, - { 58899, 63603 }, - { 58900, 63604 }, - { 58901, 63605 }, - { 58902, 63606 }, - { 58903, 63607 }, - { 58904, 63608 }, - { 58905, 63609 }, - { 58906, 63610 }, - { 58907, 63611 }, - { 58908, 63612 }, - { 58909, 63613 }, - { 58910, 63614 }, - { 58911, 63616 }, - { 58912, 63617 }, - { 58913, 63618 }, - { 58914, 63619 }, - { 58915, 63620 }, - { 58916, 63621 }, - { 58917, 63622 }, - { 58918, 63623 }, - { 58919, 63624 }, - { 58920, 63625 }, - { 58921, 63626 }, - { 58922, 63627 }, - { 58923, 63628 }, - { 58924, 63629 }, - { 58925, 63630 }, - { 58926, 63631 }, - { 58927, 63632 }, - { 58928, 63633 }, - { 58929, 63634 }, - { 58930, 63635 }, - { 58931, 63636 }, - { 58932, 63637 }, - { 58933, 63638 }, - { 58934, 63639 }, - { 58935, 63640 }, - { 58936, 63641 }, - { 58937, 63642 }, - { 58938, 63643 }, - { 58939, 63644 }, - { 58940, 63645 }, - { 58941, 63646 }, - { 58942, 63647 }, - { 58943, 63648 }, - { 58944, 63649 }, - { 58945, 63650 }, - { 58946, 63651 }, - { 58947, 63652 }, - { 58948, 63653 }, - { 58949, 63654 }, - { 58950, 63655 }, - { 58951, 63656 }, - { 58952, 63657 }, - { 58953, 63658 }, - { 58954, 63659 }, - { 58955, 63660 }, - { 58956, 63661 }, - { 58957, 63662 }, - { 58958, 63663 }, - { 58959, 63664 }, - { 58960, 63665 }, - { 58961, 63666 }, - { 58962, 63667 }, - { 58963, 63668 }, - { 58964, 63669 }, - { 58965, 63670 }, - { 58966, 63671 }, - { 58967, 63672 }, - { 58968, 63673 }, - { 58969, 63674 }, - { 58970, 63675 }, - { 58971, 63676 }, - { 58972, 63677 }, - { 58973, 63678 }, - { 58974, 63679 }, - { 58975, 63680 }, - { 58976, 63681 }, - { 58977, 63682 }, - { 58978, 63683 }, - { 58979, 63684 }, - { 58980, 63685 }, - { 58981, 63686 }, - { 58982, 63687 }, - { 58983, 63688 }, - { 58984, 63689 }, - { 58985, 63690 }, - { 58986, 63691 }, - { 58987, 63692 }, - { 58988, 63693 }, - { 58989, 63694 }, - { 58990, 63695 }, - { 58991, 63696 }, - { 58992, 63697 }, - { 58993, 63698 }, - { 58994, 63699 }, - { 58995, 63700 }, - { 58996, 63701 }, - { 58997, 63702 }, - { 58998, 63703 }, - { 58999, 63704 }, - { 59000, 63705 }, - { 59001, 63706 }, - { 59002, 63707 }, - { 59003, 63708 }, - { 59004, 63709 }, - { 59005, 63710 }, - { 59006, 63711 }, - { 59007, 63712 }, - { 59008, 63713 }, - { 59009, 63714 }, - { 59010, 63715 }, - { 59011, 63716 }, - { 59012, 63717 }, - { 59013, 63718 }, - { 59014, 63719 }, - { 59015, 63720 }, - { 59016, 63721 }, - { 59017, 63722 }, - { 59018, 63723 }, - { 59019, 63724 }, - { 59020, 63725 }, - { 59021, 63726 }, - { 59022, 63727 }, - { 59023, 63728 }, - { 59024, 63729 }, - { 59025, 63730 }, - { 59026, 63731 }, - { 59027, 63732 }, - { 59028, 63733 }, - { 59029, 63734 }, - { 59030, 63735 }, - { 59031, 63736 }, - { 59032, 63737 }, - { 59033, 63738 }, - { 59034, 63739 }, - { 59035, 63740 }, - { 59036, 63808 }, - { 59037, 63809 }, - { 59038, 63810 }, - { 59039, 63811 }, - { 59040, 63812 }, - { 59041, 63813 }, - { 59042, 63814 }, - { 59043, 63815 }, - { 59044, 63816 }, - { 59045, 63817 }, - { 59046, 63818 }, - { 59047, 63819 }, - { 59048, 63820 }, - { 59049, 63821 }, - { 59050, 63822 }, - { 59051, 63823 }, - { 59052, 63824 }, - { 59053, 63825 }, - { 59054, 63826 }, - { 59055, 63827 }, - { 59056, 63828 }, - { 59057, 63829 }, - { 59058, 63830 }, - { 59059, 63831 }, - { 59060, 63832 }, - { 59061, 63833 }, - { 59062, 63834 }, - { 59063, 63835 }, - { 59064, 63836 }, - { 59065, 63837 }, - { 59066, 63838 }, - { 59067, 63839 }, - { 59068, 63840 }, - { 59069, 63841 }, - { 59070, 63842 }, - { 59071, 63843 }, - { 59072, 63844 }, - { 59073, 63845 }, - { 59074, 63846 }, - { 59075, 63847 }, - { 59076, 63848 }, - { 59077, 63849 }, - { 59078, 63850 }, - { 59079, 63851 }, - { 59080, 63852 }, - { 59081, 63853 }, - { 59082, 63854 }, - { 59083, 63855 }, - { 59084, 63856 }, - { 59085, 63857 }, - { 59086, 63858 }, - { 59087, 63859 }, - { 59088, 63860 }, - { 59089, 63861 }, - { 59090, 63862 }, - { 59091, 63863 }, - { 59092, 63864 }, - { 59093, 63865 }, - { 59094, 63866 }, - { 59095, 63867 }, - { 59096, 63868 }, - { 59097, 63869 }, - { 59098, 63870 }, - { 59099, 63872 }, - { 59100, 63873 }, - { 59101, 63874 }, - { 59102, 63875 }, - { 59103, 63876 }, - { 59104, 63877 }, - { 59105, 63878 }, - { 59106, 63879 }, - { 59107, 63880 }, - { 59108, 63881 }, - { 59109, 63882 }, - { 59110, 63883 }, - { 59111, 63884 }, - { 59112, 63885 }, - { 59113, 63886 }, - { 59114, 63887 }, - { 59115, 63888 }, - { 59116, 63889 }, - { 59117, 63890 }, - { 59118, 63891 }, - { 59119, 63892 }, - { 59120, 63893 }, - { 59121, 63894 }, - { 59122, 63895 }, - { 59123, 63896 }, - { 59124, 63897 }, - { 59125, 63898 }, - { 59126, 63899 }, - { 59127, 63900 }, - { 59128, 63901 }, - { 59129, 63902 }, - { 59130, 63903 }, - { 59131, 63904 }, - { 59132, 63905 }, - { 59133, 63906 }, - { 59134, 63907 }, - { 59135, 63908 }, - { 59136, 63909 }, - { 59137, 63910 }, - { 59138, 63911 }, - { 59139, 63912 }, - { 59140, 63913 }, - { 59141, 63914 }, - { 59142, 63915 }, - { 59143, 63916 }, - { 59144, 63917 }, - { 59145, 63918 }, - { 59146, 63919 }, - { 59147, 63920 }, - { 59148, 63921 }, - { 59149, 63922 }, - { 59150, 63923 }, - { 59151, 63924 }, - { 59152, 63925 }, - { 59153, 63926 }, - { 59154, 63927 }, - { 59155, 63928 }, - { 59156, 63929 }, - { 59157, 63930 }, - { 59158, 63931 }, - { 59159, 63932 }, - { 59160, 63933 }, - { 59161, 63934 }, - { 59162, 63935 }, - { 59163, 63936 }, - { 59164, 63937 }, - { 59165, 63938 }, - { 59166, 63939 }, - { 59167, 63940 }, - { 59168, 63941 }, - { 59169, 63942 }, - { 59170, 63943 }, - { 59171, 63944 }, - { 59172, 63945 }, - { 59173, 63946 }, - { 59174, 63947 }, - { 59175, 63948 }, - { 59176, 63949 }, - { 59177, 63950 }, - { 59178, 63951 }, - { 59179, 63952 }, - { 59180, 63953 }, - { 59181, 63954 }, - { 59182, 63955 }, - { 59183, 63956 }, - { 59184, 63957 }, - { 59185, 63958 }, - { 59186, 63959 }, - { 59187, 63960 }, - { 59188, 63961 }, - { 59189, 63962 }, - { 59190, 63963 }, - { 59191, 63964 }, - { 59192, 63965 }, - { 59193, 63966 }, - { 59194, 63967 }, - { 59195, 63968 }, - { 59196, 63969 }, - { 59197, 63970 }, - { 59198, 63971 }, - { 59199, 63972 }, - { 59200, 63973 }, - { 59201, 63974 }, - { 59202, 63975 }, - { 59203, 63976 }, - { 59204, 63977 }, - { 59205, 63978 }, - { 59206, 63979 }, - { 59207, 63980 }, - { 59208, 63981 }, - { 59209, 63982 }, - { 59210, 63983 }, - { 59211, 63984 }, - { 59212, 63985 }, - { 59213, 63986 }, - { 59214, 63987 }, - { 59215, 63988 }, - { 59216, 63989 }, - { 59217, 63990 }, - { 59218, 63991 }, - { 59219, 63992 }, - { 59220, 63993 }, - { 59221, 63994 }, - { 59222, 63995 }, - { 59223, 63996 }, - { 63728, 160 }, - { 63729, 253 }, - { 63730, 254 }, - { 63731, 255 }, - { 63785, 64224 }, - { 63964, 64489 }, - { 64014, 64144 }, - { 64015, 64155 }, - { 64016, 64156 }, - { 64017, 64177 }, - { 64018, 64216 }, - { 64019, 64232 }, - { 64020, 64234 }, - { 64021, 64344 }, - { 64022, 64350 }, - { 64023, 64373 }, - { 64024, 64381 }, - { 64025, 64382 }, - { 64026, 64384 }, - { 64027, 64386 }, - { 64028, 64390 }, - { 64029, 64393 }, - { 64030, 64402 }, - { 64031, 64413 }, - { 64032, 64415 }, - { 64033, 64416 }, - { 64034, 64425 }, - { 64035, 64433 }, - { 64036, 64435 }, - { 64037, 64436 }, - { 64038, 64439 }, - { 64039, 64467 }, - { 64040, 64474 }, - { 64041, 64490 }, - { 64042, 64502 }, - { 64043, 64503 }, - { 64044, 64505 }, - { 64045, 64585 }, - { 65281, 33097 }, - { 65282, 64087 }, - { 65283, 33172 }, - { 65284, 33168 }, - { 65285, 33171 }, - { 65286, 33173 }, - { 65287, 64086 }, - { 65288, 33129 }, - { 65289, 33130 }, - { 65290, 33174 }, - { 65291, 33147 }, - { 65292, 33091 }, - { 65293, 33148 }, - { 65294, 33092 }, - { 65295, 33118 }, - { 65296, 33359 }, - { 65297, 33360 }, - { 65298, 33361 }, - { 65299, 33362 }, - { 65300, 33363 }, - { 65301, 33364 }, - { 65302, 33365 }, - { 65303, 33366 }, - { 65304, 33367 }, - { 65305, 33368 }, - { 65306, 33094 }, - { 65307, 33095 }, - { 65308, 33155 }, - { 65309, 33153 }, - { 65310, 33156 }, - { 65311, 33096 }, - { 65312, 33175 }, - { 65313, 33376 }, - { 65314, 33377 }, - { 65315, 33378 }, - { 65316, 33379 }, - { 65317, 33380 }, - { 65318, 33381 }, - { 65319, 33382 }, - { 65320, 33383 }, - { 65321, 33384 }, - { 65322, 33385 }, - { 65323, 33386 }, - { 65324, 33387 }, - { 65325, 33388 }, - { 65326, 33389 }, - { 65327, 33390 }, - { 65328, 33391 }, - { 65329, 33392 }, - { 65330, 33393 }, - { 65331, 33394 }, - { 65332, 33395 }, - { 65333, 33396 }, - { 65334, 33397 }, - { 65335, 33398 }, - { 65336, 33399 }, - { 65337, 33400 }, - { 65338, 33401 }, - { 65339, 33133 }, - { 65340, 33119 }, - { 65341, 33134 }, - { 65342, 33103 }, - { 65343, 33105 }, - { 65344, 33101 }, - { 65345, 33409 }, - { 65346, 33410 }, - { 65347, 33411 }, - { 65348, 33412 }, - { 65349, 33413 }, - { 65350, 33414 }, - { 65351, 33415 }, - { 65352, 33416 }, - { 65353, 33417 }, - { 65354, 33418 }, - { 65355, 33419 }, - { 65356, 33420 }, - { 65357, 33421 }, - { 65358, 33422 }, - { 65359, 33423 }, - { 65360, 33424 }, - { 65361, 33425 }, - { 65362, 33426 }, - { 65363, 33427 }, - { 65364, 33428 }, - { 65365, 33429 }, - { 65366, 33430 }, - { 65367, 33431 }, - { 65368, 33432 }, - { 65369, 33433 }, - { 65370, 33434 }, - { 65371, 33135 }, - { 65372, 33122 }, - { 65373, 33136 }, - { 65374, 33120 }, - { 65377, 161 }, - { 65378, 162 }, - { 65379, 163 }, - { 65380, 164 }, - { 65381, 165 }, - { 65382, 166 }, - { 65383, 167 }, - { 65384, 168 }, - { 65385, 169 }, - { 65386, 170 }, - { 65387, 171 }, - { 65388, 172 }, - { 65389, 173 }, - { 65390, 174 }, - { 65391, 175 }, - { 65392, 176 }, - { 65393, 177 }, - { 65394, 178 }, - { 65395, 179 }, - { 65396, 180 }, - { 65397, 181 }, - { 65398, 182 }, - { 65399, 183 }, - { 65400, 184 }, - { 65401, 185 }, - { 65402, 186 }, - { 65403, 187 }, - { 65404, 188 }, - { 65405, 189 }, - { 65406, 190 }, - { 65407, 191 }, - { 65408, 192 }, - { 65409, 193 }, - { 65410, 194 }, - { 65411, 195 }, - { 65412, 196 }, - { 65413, 197 }, - { 65414, 198 }, - { 65415, 199 }, - { 65416, 200 }, - { 65417, 201 }, - { 65418, 202 }, - { 65419, 203 }, - { 65420, 204 }, - { 65421, 205 }, - { 65422, 206 }, - { 65423, 207 }, - { 65424, 208 }, - { 65425, 209 }, - { 65426, 210 }, - { 65427, 211 }, - { 65428, 212 }, - { 65429, 213 }, - { 65430, 214 }, - { 65431, 215 }, - { 65432, 216 }, - { 65433, 217 }, - { 65434, 218 }, - { 65435, 219 }, - { 65436, 220 }, - { 65437, 221 }, - { 65438, 222 }, - { 65439, 223 }, - { 65504, 33169 }, - { 65505, 33170 }, - { 65506, 33226 }, - { 65507, 33104 }, - { 65508, 64085 }, - { 65509, 33167 } - }; - for( int i = 0; i < _LEN_DICT; i++ ){ - _DICT_SRC[i][0] = n[i][0]; - _DICT_SRC[i][1] = n[i][1]; - } -} - -void cp932_init() { - cp932_init_cor(); - for( int i = 0; i < _LEN_DICT; i++ ){ - _DICT.insert( map::value_type( _DICT_SRC[i][0], _DICT_SRC[i][1] ) ); - } - cp932_initialized = true; -} - -vector cp932_convert( wstring str ){ - int len = str.size(); - wchar_t *arr = new wchar_t[len]; - vector list( 0 ); - for( int i = 0; i < len; i++ ){ - map::const_iterator finder = _DICT.find( (int)arr[i] ); - if( finder != _DICT.end() ){ - int t = _DICT[(int)arr[i]]; - if ( t > 0xff ) { - char b1 = (char)(t >> 8); - char b2 = (char)(t - (b1 << 8)); - list.push_back( b1 ); - list.push_back( b2 ); - } else { - list.push_back( (char)t ); - } - } else { - list.push_back( 0x63 ); - } - } - return list; -} - - -wstring cp932_convert( vector dat ){ - if ( !cp932_initialized ) { - cp932_init(); - } - wostringstream sb; - int i = 0; - while( i < dat.size() ){ - int b1 = dat[i]; - bool found = false; - for( int j = 0; j < _LEN_DICT; j++ ){ - int key = _DICT_SRC[j][0]; - int test = _DICT_SRC[j][1]; - if ( b1 == test ) { - found = true; - sb << (wchar_t)key; - break; - } - } - i++; - if( !found && i < dat.size() ){ - int b2 = (dat[i - 1] << 8) + dat[i]; - for( int j = 0; j < _LEN_DICT; j++ ){ - int key = _DICT_SRC[j][0]; - int test = _DICT_SRC[j][1]; - if ( test == b2 ) { - sb << (wchar_t)key; - break; - } - } - i++; - } - } - return sb.str(); -} diff --git a/trunk/Boare.Lib.Vsq/port_cpp/cp932.h b/trunk/Boare.Lib.Vsq/port_cpp/cp932.h deleted file mode 100644 index 9cc77cd..0000000 --- a/trunk/Boare.Lib.Vsq/port_cpp/cp932.h +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef __cp932_h__ -#define __cp932_h__ - -#include -#include -#include - -using namespace std; - -wstring cp932_convert( vector dat ); -vector cp932_convert( wstring str ); - -#endif // __cp932_h__ diff --git a/trunk/Boare.Lib.Vsq/port_cpp/libvsq.cpp b/trunk/Boare.Lib.Vsq/port_cpp/libvsq.cpp deleted file mode 100644 index b460a7e..0000000 --- a/trunk/Boare.Lib.Vsq/port_cpp/libvsq.cpp +++ /dev/null @@ -1,2 +0,0 @@ -#include "libvsq.h" - diff --git a/trunk/Boare.Lib.Vsq/port_cpp/libvsq.h b/trunk/Boare.Lib.Vsq/port_cpp/libvsq.h deleted file mode 100644 index f4c37e6..0000000 --- a/trunk/Boare.Lib.Vsq/port_cpp/libvsq.h +++ /dev/null @@ -1,1184 +0,0 @@ -#ifndef __libvsq_h__ -#define __libvsq_h__ -#include -#include -#include -#include -#include -#include "cp932.h" - -using namespace std; - -namespace vsq{ - -inline vector util_split( string str, string delim ){ - vector result; - int cutAt; - while( (cutAt = str.find_first_of( delim )) != str.npos ){ - if( cutAt > 0 ){ - result.push_back( str.substr( 0, cutAt ) ); - } - str = str.substr( cutAt + 1 ); - } - if( str.length() > 0 ){ - result.push_back( str ); - } - return result; -} - -inline string string_replace( string str, string before, string after ){ - int start = 0; - int index = str.find( before, start ); - string newone = str; - while( index < 0 ){ - newone = newone.substr( 0, index ) + after + newone.substr( index + before.length() + 1 ); - start = index + before.length() + 1 + (after.length() - before.length()); - index = newone.find( before, start ); - } - return newone; -} - -template T parse( string s ){ - ostringstream oss( "" ); - T ret; - oss >> ret; - return ret; -} - -typedef unsigned char byte; - -struct TColor{ - int R; - int G; - int B; -}; - -class StreamReader{ -public: - StreamReader( string path ){ - m_ifs.open( path.c_str() ); - }; - - void Close(){ - m_ifs.close(); - }; - - string ReadLine(){ - string ret; - if( get_line( &m_ifs, &ret ) ){ - return ret; - }else{ - return NULL; - } - }; - int Peek(){ - return m_ifs.peek(); - }; -private: - ifstream m_ifs; - static bool get_line( ifstream *ifs, string *str ){ - char ch; - if( ifs->eof() ){ - return false; - } - while( ifs->get( ch ) ){ - if( ch == 0x0d ){ - if( ifs->get( ch ) ){ - if( ch != 0x0a ){ - ifs->seekg( -1, ios::cur ); - } - } - break; - }else if( ch == 0x0a ){ - break; - } - str->append( 1, ch ); - } - return true; - }; -}; - -/// -/// [ŃeLXgt@C߂̃NXD -/// -class TextMemoryStream { -public: - /// - /// - /// - /// - void Write( string value ){ - m_ms << value; - }; - void Rewind(){ - m_ms.seekg( 0, ios::beg ); - }; - void WriteLine( string s ){ - m_ms << s << "\x0d\x0a"; - }; - void Close(){ - m_ms.str( "" ); - }; - int Peek(){ - long current = m_ms.tellg(); - int ret = m_ms.get(); - if( m_ms.gcount() <= 0 ){ - m_ms.seekg( current, ios::beg ); - return -1; - } - m_ms.seekg( current, ios::beg ); - return ret; - }; - string ReadLine(){ - ostringstream buffer; - char value; - char ret; - ret = m_ms.get(); - while ( ret >= 0 ) { - value = (char)ret; - if ( value == NEW_LINE[0] ) { - char next; - long current = m_ms.tellg(); //0x0DõXg[̈ʒu - for ( int i = 1; i < 2; i++ ) { - ret = m_ms.get(); - if ( ret >= 0 ) { - next = ret; - if ( next != NEW_LINE[i] ) { - m_ms.seekg( current, ios::beg ); - break; - } - } - } - break; - } - buffer << value; - ret = m_ms.get(); - } - return buffer.str(); - }; - void Dispose(){ - m_ms.str( "" ); - }; - TextMemoryStream( string path ){ - m_ms.str( "" ); - //if ( File.Exists( path ) ) { - StreamReader sr( path ); - while( sr.Peek() >= 0 ){ - string line = sr.ReadLine(); - m_ms << line << "\x0d\x0a"; - } - sr.Close(); - m_ms.seekg( 0, ios::beg ); - NEW_LINE[0] = '\x0d'; - NEW_LINE[1] = '\x0a'; - }; - TextMemoryStream(){ - m_ms.str( "" ); - NEW_LINE[0] = '\x0d'; - NEW_LINE[1] = '\x0a'; - }; -private: - //FileAccess m_access; - stringstream m_ms; - //Encoding m_enc; - char NEW_LINE[2]; -}; - -class VsqCommon { -public: - string Version; - string Name; - string Color; - int DynamicsMode; - int PlayMode; - - /// - /// ep[^w肵RXgN^ - /// - /// gbN - /// ColorliӖ͕sj - /// DynamicsModeiftHg1j - /// PlayModeiftHg1j - VsqCommon( string name, TColor color, int dynamics_mode, int play_mode ); - - /// - /// MetaText̃eLXgt@C̃RXgN^ - /// - /// ǂݍރeLXgt@C - /// ǂݍ񂾍Ō̍sԂ - VsqCommon( TextMemoryStream sr, string& last_line ); - - /// - /// CX^X̓eeLXgt@Cɏo͂܂ - /// - /// o͐ - void write( TextMemoryStream& sw ); - - /// - /// VsqCommon\̂\zeXgs܂ - /// - /// eXgɐtrueAłȂfalse - static bool test(); -}; - -enum VsqHandleType { - Lyric, - Vibrato, - Singer -}; - -const int _NUM_SYMBOL_VOWEL_JP = 5; -static string _SYMBOL_VOWEL_JP[_NUM_SYMBOL_VOWEL_JP] = { - "a", - "i", - "M", - "e", - "o", -}; - -const int _NUM_SYMBOL_CONSONANT_JP = 36; -static string _SYMBOL_CONSONANT_JP[_NUM_SYMBOL_CONSONANT_JP] = { - "k", - "k'", - "g", - "g'", - "N", - "N'", - "s", - "S", - "z", - "Z", - "dz", - "dZ", - "t", - "t'", - "ts", - "tS", - "d", - "d'", - "n", - "J", - "h", - "h\\", - "C", - "p\\", - "p\\'", - "b", - "b'", - "p", - "p'", - "m", - "m'", - "j", - "4", - "4'", - "w", - "N\\", -}; - -const int _NUM_SYMBOL_EN = 53; -static string _SYMBOL_EN[_NUM_SYMBOL_EN] = { - "@", - "V", - "e", - "e", - "I", - "i:", - "{", - "O:", - "Q", - "U", - "u:", - "@r", - "eI", - "aI", - "OI", - "@U", - "aU", - "I@", - "e@", - "U@", - "O@", - "Q@", - "w", - "j", - "b", - "d", - "g", - "bh", - "dh", - "gh", - "dZ", - "v", - "D", - "z", - "Z", - "m", - "n", - "N", - "r", - "l", - "l0", - "p", - "t", - "k", - "ph", - "th", - "kh", - "tS", - "f", - "T", - "s", - "S", - "h", -}; - -class VsqPhoneticSymbol { -public: - static bool IsConsonant( string symbol ) { - for( int i = 0; i < _NUM_SYMBOL_CONSONANT_JP; i++ ){ - string s = _SYMBOL_CONSONANT_JP[i]; - if ( s == symbol ) { - return true; - } - } - return false; - } - static bool IsValidSymbol( string symbol ) { - for( int i = 0; i < _NUM_SYMBOL_VOWEL_JP; i++ ){ - string s = _SYMBOL_VOWEL_JP[i]; - if ( s == symbol ) { - return true; - } - } - for( int i = 0; i < _NUM_SYMBOL_CONSONANT_JP; i++ ){ - string s = _SYMBOL_CONSONANT_JP[i]; - if ( s == symbol ) { - return true; - } - } - for( int i = 0; i < _NUM_SYMBOL_EN; i++ ){ - string s = _SYMBOL_EN[i]; - if ( s == symbol ) { - return true; - } - } - return false; - } -}; - - -/// -/// VsqHandleɊi[̎̏NXB -/// -class Lyric { -private: - string m_phrase; - vector m_phonetic_symbol; - float d1; - vector m_consonant_adjustment; - bool m_protected; - - Lyric(){ - } - - /// - /// oCgsearch̒Ɋ܂܂oCgvaluëʒuT܂B - /// - /// Ώۂ̃oCg - /// oCg - /// value‚΂̃CfbNXA‚Ȃ-1Ԃ܂ - static int mIndexOf( vector search, vector value ) { - int i, j; - int search_length = search.size(); - int value_length = value.size(); - - // oCgтAΏۂ̃oCgт蒷ƂB - // ‚킯Ȃ - if ( value_length > search_length ) { - return -1; - } - - // i : ̊_ - for ( i = 0; i <= search_length - value_length; i++ ) { - bool failed = false; - for ( j = 0; j < value_length; j++ ) { - if ( search[i + j] != value[j] ) { - failed = true; - break; - } - } - if ( !failed ) { - return i; - } - } - return -1; - } - - - /// - /// vgo͉”\ǂ𔻒肵܂ - /// - /// - /// - static bool isprint( char ch ) { - if ( 32 <= (int)ch && (int)ch <= 126 ) { - return true; - } else { - return false; - } - } - -public: - bool PhoneticSymbolProtected() { - return m_protected; - } - - void PhoneticSymbolProtected( bool value ){ - m_protected = value; - } - - float UnknownFloat() { - return d1; - } - - void UnknownFloat( float value ){ - d1 = value; - } - - vector ConsonantAdjustment() { - return m_consonant_adjustment; - } - - /// - /// ̎ALw肵RXgN^ - /// - /// ̎ - /// L - Lyric( string phrase, string phonetic_symbol ) { - m_phrase = phrase; - PhoneticSymbol( phonetic_symbol ); - d1 = 0.000000f; - } - - /// - /// ̉̎̃t[Y擾܂͐ݒ肵܂B - /// - string Phrase() { - return m_phrase; - } - - void Phrase( string value ){ - m_phrase = value; - } - - /// - /// ̉̎̔L擾܂͐ݒ肵܂B - /// - string PhoneticSymbol() { - string ret = m_phonetic_symbol[0]; - for ( int i = 1; i < m_phonetic_symbol.size(); i++ ) { - ret += " " + m_phonetic_symbol[i]; - } - return ret; - } - - void PhoneticSymbol( string value ){ - string s = string_replace( value, " ", " " ); - m_phonetic_symbol = util_split( s, " " ); - for ( int i = 0; i < m_phonetic_symbol.size(); i++ ) { - m_phonetic_symbol[i] = string_replace( m_phonetic_symbol[i], "\\\\", "\\" ); - } - m_consonant_adjustment = vector( m_phonetic_symbol.size() ); - for ( int i = 0; i < m_phonetic_symbol.size(); i++ ) { - if ( VsqPhoneticSymbol::IsConsonant( m_phonetic_symbol[i] ) ) { - m_consonant_adjustment[i] = 64; - } else { - m_consonant_adjustment[i] = 0; - } - } - } - - vector PhoneticSymbolList(){ - vector ret = vector( m_phonetic_symbol.size() ); - for ( int i = 0; i < m_phonetic_symbol.size(); i++ ) { - ret[i] = m_phonetic_symbol[i]; - } - return ret; - } - - /// - /// 񂩂̃RXgN^ - /// - /// ̕ - Lyric( string _line ) { - if ( _line.length() <= 0 ) { - m_phrase = "a"; - PhoneticSymbol( "a" ); - d1 = 1.0f; - m_protected = false; - } else { - vector spl = util_split( _line, "," ); - int c_length = spl.size() - 3; - if ( spl.size() < 4 ) { - m_phrase = "a"; - PhoneticSymbol( "a" ); - d1 = 0.0f; - m_protected = false; - } else { - m_phrase = decode( spl[0] ); - PhoneticSymbol( decode( spl[1] ) ); - d1 = parse( spl[2] ); - m_protected = (spl[spl.size() - 1] == "0") ? false : true; - } - } - } - - /// - /// mIndexOf̃eXg\bhBsearch, value낢ςăeXg鎖B - /// - /// - static bool test_mIndexOf() { - vector search; - vector value; - unsigned char src_search[6] = { 0, 12, 3, 5, 16, 34 }; - unsigned char src_value[2] = { 16, 34 }; - for( int i = 0; i < 6; i++ ){ - search.push_back( src_search[i] ); - } - for( int i = 0; i < 2; i++ ){ - value.push_back( src_value[i] ); - } - if ( mIndexOf( search, value ) == 4 ) { - return true; - } else { - return false; - } - } - - /// - /// GXP[vꂽ\"A\x**𕜋A܂ - /// - /// fR[hΏۂ̕ - /// fR[h̕ - static string decode( string _string ) { - string result = _string; - result = string_replace( result, "\\\"", "" ); - vector str; - for( int i = 0; i < result.length(); i++ ){ - str.push_back( (unsigned char)result[i] ); - } - - vector x16; - string xx = "\\x"; - for( int i = 0; i < xx.length(); i++ ){ - x16.push_back( (unsigned char)xx[i] ); - } - int index = mIndexOf( str, x16 ); - while ( index >= 0 ) { - char chr_byte[2]; - chr_byte[0] = str[index + 2]; - chr_byte[1] = str[index + 3]; - string chr( chr_byte ); - char *endstr; - int chrcode = strtol( chr.c_str(), &endstr, 16 ); - str[index] = (byte)chrcode; - for ( int i = index + 4; i < str.size(); i++ ) { - str[i - 3] = str[i]; - } - int length = str.size() - 3; - vector new_str; - for ( int i = 0; i < length; i++ ) { - new_str.push_back( str[i] ); - } - Array.Resize( ref str, length ); - str = new_str; - index = mIndexOf( str, x16 ); - } - return cp932_convert( str ); - } - - - /// - /// ^ꂽ̒2oCg\x**̌`ɃGR[h܂B - /// - /// GR[hΏ - /// GR[h - static vector encode( string item ) { - //Encoding sjis = Encoding.GetEncoding( 932 ); - unsigned char[] bytea = cp932_convert( item );// sjis.GetBytes( item ); - string result = ""; - for ( int i = 0; i < bytea.Length; i++ ) { - if ( isprint( (char)bytea[i] ) ) { - result += (char)bytea[i]; - } else { - result += "\\x" + Convert.ToString( bytea[i], 16 ); - } - } - wchar_t[] res = result.ToCharArray(); - return res; - } - - - /// - /// ^ꂽShift_JISƂ݂ȂAbyte[]ɕϊchar[]ɕϊ̕Ԃ܂ - /// - /// ϊ̕ - /// ϊchar[] - static vector encodeEx( string item ) { - //Encoding sjis = Encoding.GetEncoding( 932 ); - byte[] dat = cp932_convert( item );// sjis.GetBytes( item ); - char[] result = new char[dat.Length]; - for ( int i = 0; i < dat.Length; i++ ) { - result[i] = (char)dat[i]; - } - return result; - } - - - /// - /// ̃CX^X𕶎ɕϊ܂ - /// - /// 2oCgGR[h邩ۂw肷tO - /// ϊ̕ - string ToString( bool a_encode ) { - string result; - if ( a_encode ) { - string njp = new string( encode( this.Phrase ) ); - result = "\"" + njp + "\",\"" + this.PhoneticSymbol + "\"," + d1.ToString( "0.000000" ); - } else { - result = "\""; - //Encoding sjis = Encoding.GetEncoding( 932 ); - byte[] dat = cp932.convert( this.Phrase );// sjis.GetBytes( this.Phrase ); - for ( int i = 0; i < dat.Length; i++ ) { - result += (char)dat[i]; - } - result += "\",\"" + this.PhoneticSymbol + "\"," + d1.ToString( "0.000000" ); - result = result.Replace( "\\\\", "\\" ); - } - for ( int i = 0; i < m_consonant_adjustment.Length; i++ ) { - result += "," + m_consonant_adjustment[i]; - } - if ( m_protected ) { - result += ",1"; - } else { - result += ",0"; - } - return result; - } - - /// - /// LyricCX^X\zeXgs܂ - /// - /// eXgɐtrueAłȂfalseԂ܂ - static bool test() { - string line = "\\\"\\x82\\xe7\\\",\\\"4 a\\\",1.000000,64,1,1"; - //Console.WriteLine( "Lyric.test; line=" + line ); - Lyric lyric( line ); - if ( lyric.Phrase == "" && - lyric.PhoneticSymbol == "4 a" && - lyric.d1 == 1.0 && - lyric.m_consonant_adjustment[0] == 64 && - lyric.m_consonant_adjustment[1] == 1 && - lyric.m_consonant_adjustment[2] == 1 ) { - return true; - } else { - return false; - } - } - -}; - -/// -/// nh舵܂BnhɂLyricHandleAVibratoHandleIconHandle -/// -class VsqHandle { -private: - VsqHandleType m_type; - /// - /// CX^XR\[ʂɏo͂܂ - /// - void Print() { - string result = this.ToString(); - Console.WriteLine( result ); - } -public: - int Index; - string IconID; - string IDS; - Lyric L0; - int Original; - string Caption; - int Length; - int StartDepth; - VibratoBPList DepthBP; - int StartRate; - VibratoBPList RateBP; -protected: - int m_language; - int m_program; - protected VsqHandle() { - } -public: - LyricHandle ConvertToLyricHandle() { - LyricHandle ret = new LyricHandle(); - ret.L0 = (Lyric)L0; - ret.m_type = m_type; - ret.Index = Index; - return ret; - } - - VibratoHandle ConvertToVibratoHandle() { - VibratoHandle ret = new VibratoHandle(); - ret.m_type = m_type; - ret.Index = Index; - ret.Caption = Caption; - ret.DepthBP = (VibratoBPList)DepthBP.Clone(); - ret.IconID = IconID; - ret.IDS = IDS; - ret.Index = Index; - ret.Length = Length; - ret.Original = Original; - ret.RateBP = (VibratoBPList)RateBP.Clone(); - ret.StartDepth = StartDepth; - ret.StartRate = StartRate; - return ret; - } - - IconHandle ConvertToIconHandle() { - IconHandle ret = new IconHandle(); - ret.m_type = m_type; - ret.Index = Index; - ret.Caption = Caption; - ret.IconID = IconID; - ret.IDS = IDS; - ret.Index = Index; - ret.Language( m_language ); - ret.Length = Length; - ret.Original = Original; - ret.Program( m_program ); - return ret; - } - - VsqHandleType type() { - return m_type; - } - - void type( VsqHandleType value ) { - m_type = value; - } - - /// - /// CX^XXg[ɏ݂܂B - /// encode=truȅꍇA2oCgGR[hďo͂܂B - /// - /// ݑΏ - /// 2oCgGR[h邩ۂw肷tO - void write( TextMemoryStream sw, bool encode ) { - sw.WriteLine( this.ToString( encode ) ); - } - - /// - /// FileStreamǂݍ݂ȂRXgNg - /// - /// ǂݍݑΏ - VsqHandle( TextMemoryStream sr, int value, ref string last_line ) { - this.Index = value; - string[] spl; - string[] spl2; - - // defaultlŔ~ - this.type( VsqHandleType.Vibrato ); - IconID = ""; - IDS = "normal"; - L0 = new Lyric( "" ); - Original = 0; - Caption = ""; - Length = 0; - StartDepth = 0; - DepthBP = null; - int depth_bp_num = 0; - StartRate = 0; - RateBP = null; - int rate_bp_num = 0; - m_language = 0; - m_program = 0; - - string tmpDepthBPX = ""; - string tmpDepthBPY = ""; - string tmpRateBPX = ""; - string tmpRateBPY = ""; - - // "["ɂԂ܂œǍ - last_line = sr.ReadLine(); - while ( !last_line.StartsWith( "[" ) ) { - spl = last_line.Split( new char[] { '=' } ); - switch ( spl[0] ) { - case "Language": - m_language = int.Parse( spl[1] ); - break; - case "Program": - m_program = int.Parse( spl[1] ); - break; - case "IconID": - IconID = spl[1]; - break; - case "IDS": - IDS = spl[1]; - break; - case "Original": - Original = int.Parse( spl[1] ); - break; - case "Caption": - Caption = spl[1]; - for ( int i = 2; i < spl.Length; i++ ) { - Caption += "=" + spl[i]; - } - break; - case "Length": - Length = int.Parse( spl[1] ); - break; - case "StartDepth": - StartDepth = int.Parse( spl[1] ); - break; - case "DepthBPNum": - depth_bp_num = int.Parse( spl[1] ); - break; - case "DepthBPX": - tmpDepthBPX = spl[1]; - break; - case "DepthBPY": - tmpDepthBPY = spl[1]; - break; - case "StartRate": - StartRate = int.Parse( spl[1] ); - break; - case "RateBPNum": - rate_bp_num = int.Parse( spl[1] ); - break; - case "RateBPX": - tmpRateBPX = spl[1]; - break; - case "RateBPY": - tmpRateBPY = spl[1]; - break; - case "L0": - m_type = VsqHandleType.Lyric; - L0 = new Lyric( spl[1] ); - break; - } - if ( sr.Peek() < 0 ) { - break; - } - last_line = sr.ReadLine(); - } - if ( IDS != "normal" ) { - type( VsqHandleType.Singer ); - } else if ( IconID != "" ) { - type( VsqHandleType.Vibrato ); - } else { - type( VsqHandleType.Lyric ); - } - - // RateBPX, RateBPY̐ݒ - if ( this.type() == VsqHandleType.Vibrato ) { - if ( rate_bp_num > 0 ) { - float[] rate_bp_x = new float[rate_bp_num]; - spl2 = tmpRateBPX.Split( new char[] { ',' } ); - for ( int i = 0; i < rate_bp_num; i++ ) { - rate_bp_x[i] = float.Parse( spl2[i] ); - } - - int[] rate_bp_y = new int[rate_bp_num]; - spl2 = tmpRateBPY.Split( new char[] { ',' } ); - for ( int i = 0; i < rate_bp_num; i++ ) { - rate_bp_y[i] = int.Parse( spl2[i] ); - } - RateBP = new VibratoBPList( rate_bp_x, rate_bp_y ); - } else { - //m_rate_bp_x = null; - //m_rate_bp_y = null; - RateBP = new VibratoBPList(); - } - - // DepthBPX, DepthBPY̐ݒ - if ( depth_bp_num > 0 ) { - float[] depth_bp_x = new float[depth_bp_num]; - spl2 = tmpDepthBPX.Split( new char[] { ',' } ); - for ( int i = 0; i < depth_bp_num; i++ ) { - depth_bp_x[i] = float.Parse( spl2[i] ); - } - - int[] depth_bp_y = new int[depth_bp_num]; - spl2 = tmpDepthBPY.Split( new char[] { ',' } ); - for ( int i = 0; i < depth_bp_num; i++ ) { - depth_bp_y[i] = int.Parse( spl2[i] ); - } - DepthBP = new VibratoBPList( depth_bp_x, depth_bp_y ); - } else { - DepthBP = new VibratoBPList(); - //m_depth_bp_x = null; - //m_depth_bp_y = null; - } - } else { - DepthBP = new VibratoBPList(); - RateBP = new VibratoBPList(); - } - } - - /// - /// nhwqiႦ"h#0123"Ƃjnhԍ擾܂ - /// - /// nhwq - /// nhԍ - static int HandleIndexFromString( string _string ) { - string[] spl = _string.Split( new char[] { '#' } ); - return int.Parse( spl[1] ); - } - - - /// - /// CX^XeLXgt@Cɏo͂܂ - /// - /// o͐ - void Print( StreamWriter sw ) { - string result = this.ToString(); - sw.WriteLine( result ); - } - - /// - /// CX^X𕶎ɕϊ܂ - /// - /// 2oCgGR[h邩ۂw肷tO - /// CX^Xϊ - string ToString( bool encode ) { - string result = ""; - result += "[h#" + Index.ToString( "0000" ) + "]"; - switch ( type() ) { - case VsqHandleType.Lyric: - result += Environment.NewLine + "L0=" + L0.ToString( encode ); - break; - case VsqHandleType.Vibrato: - result += Environment.NewLine + "IconID=" + IconID + Environment.NewLine; - result += "IDS=" + IDS + Environment.NewLine; - result += "Original=" + Original + Environment.NewLine; - result += "Caption=" + Caption + Environment.NewLine; - result += "Length=" + Length + Environment.NewLine; - result += "StartDepth=" + StartDepth + Environment.NewLine; - result += "DepthBPNum=" + DepthBP.Num() + Environment.NewLine; - if ( DepthBP.Num() > 0 ) { - result += "DepthBPX=" + DepthBP.getElement( 0 ).X.ToString( "0.000000" ); - for ( int i = 1; i < DepthBP.Num(); i++ ) { - result += "," + DepthBP.getElement( i ).X.ToString( "0.000000" ); - } - result += Environment.NewLine + "DepthBPY=" + DepthBP.getElement( 0 ).Y; - for ( int i = 1; i < DepthBP.Num(); i++ ) { - result += "," + DepthBP.getElement( i ).Y; - } - result += Environment.NewLine; - } - result += "StartRate=" + StartRate + Environment.NewLine; - result += "RateBPNum=" + RateBP.Num(); - if ( RateBP.Num() > 0 ) { - result += Environment.NewLine + "RateBPX=" + RateBP.getElement( 0 ).X.ToString( "0.000000" ); - for ( int i = 1; i < RateBP.Num(); i++ ) { - result += "," + RateBP.getElement( i ).X.ToString( "0.000000" ); - } - result += Environment.NewLine + "RateBPY=" + RateBP.getElement( 0 ).Y; - for ( int i = 1; i < RateBP.Num(); i++ ) { - result += "," + RateBP.getElement( i ).Y; - } - } - break; - case VsqHandleType.Singer: - result += Environment.NewLine + "IconID=" + IconID + Environment.NewLine; - result += "IDS=" + IDS + Environment.NewLine; - result += "Original=" + Original + Environment.NewLine; - result += "Caption=" + Caption + Environment.NewLine; - result += "Length=" + Length + Environment.NewLine; - result += "Language=" + m_language + Environment.NewLine; - result += "Program=" + m_program; - break; - default: - break; - } - return result; - } -}; - - -class VsqID { -public: - int value; - VsqIDType type; - int IconHandle_index; - IconHandle IconHandle; - int Length; - int Note; - int Dynamics; - int PMBendDepth; - int PMBendLength; - int PMbPortamentoUse; - int DEMdecGainRate; - int DEMaccent; - int LyricHandle_index; - LyricHandle LyricHandle; - int VibratoHandle_index; - VibratoHandle VibratoHandle; - int VibratoDelay; - - static VsqID EOS( -1 ); - - /// - /// ID̔ԍiID#********jw肵RXgN^B - /// - /// ID̔ԍ - VsqID( int a_value ) { - value = a_value; - } - - - /// - /// eLXgt@C̃RXgN^ - /// - /// ǂݍݑΏ - /// - /// ǂݍ񂾍Ō̍sԂ܂ - VsqID( TextMemoryStream sr, int value, string& last_line ) { - string[] spl; - this.value = value; - this.type = VsqIDType.Unknown; - this.IconHandle_index = -2; - this.LyricHandle_index = -1; - this.VibratoHandle_index = -1; - this.Length = 0; - this.Note = 0; - this.Dynamics = 0; - this.PMBendDepth = 0; - this.PMBendLength = 0; - this.PMbPortamentoUse = 0; - this.DEMdecGainRate = 0; - this.DEMaccent = 0; - //this.LyricHandle_index = -2; - //this.VibratoHandle_index = -2; - this.VibratoDelay = 0; - last_line = sr.ReadLine(); - while ( !last_line.StartsWith( "[" ) ) { - spl = last_line.Split( new char[] { '=' } ); - switch ( spl[0] ) { - case "Type": - if ( spl[1] == "Anote" ) { - type = VsqIDType.Anote; - } else if ( spl[1] == "Singer" ) { - type = VsqIDType.Singer; - } else { - type = VsqIDType.Unknown; - } - break; - case "Length": - this.Length = int.Parse( spl[1] ); - break; - case "Note#": - this.Note = int.Parse( spl[1] ); - break; - case "Dynamics": - this.Dynamics = int.Parse( spl[1] ); - break; - case "PMBendDepth": - this.PMBendDepth = int.Parse( spl[1] ); - break; - case "PMBendLength": - this.PMBendLength = int.Parse( spl[1] ); - break; - case "DEMdecGainRate": - this.DEMdecGainRate = int.Parse( spl[1] ); - break; - case "DEMaccent": - this.DEMaccent = int.Parse( spl[1] ); - break; - case "LyricHandle": - this.LyricHandle_index = VsqHandle.HandleIndexFromString( spl[1] ); - break; - case "IconHandle": - this.IconHandle_index = VsqHandle.HandleIndexFromString( spl[1] ); - break; - case "VibratoHandle": - this.VibratoHandle_index = VsqHandle.HandleIndexFromString( spl[1] ); - break; - case "VibratoDelay": - this.VibratoDelay = int.Parse( spl[1] ); - break; - case "PMbPortamentoUse": - PMbPortamentoUse = int.Parse( spl[1] ); - break; - } - if ( sr.Peek() < 0 ) { - break; - } - last_line = sr.ReadLine(); - } - } - - string ToString() { - string ret = "{Type=" + type; - switch ( type ) { - case VsqIDType.Anote: - ret += ", Length=" + Length; - ret += ", Note#=" + Note; - ret += ", Dynamics=" + Dynamics; - ret += ", PMBendDepth=" + PMBendDepth ; - ret += ", PMBendLength=" + PMBendLength ; - ret += ", PMbPortamentoUse=" + PMbPortamentoUse ; - ret += ", DEMdecGainRate=" + DEMdecGainRate ; - ret += ", DEMaccent=" + DEMaccent ; - if ( LyricHandle != null ) { - ret += ", LyricHandle=h#" + LyricHandle_index.ToString( "0000" ) ; - } - if ( VibratoHandle != null ) { - ret += ", VibratoHandle=h#" + VibratoHandle_index.ToString( "0000" ); - ret += ", VibratoDelay=" + VibratoDelay ; - } - break; - case VsqIDType.Singer: - ret += ", IconHandle=h#" + IconHandle_index.ToString( "0000" ); - break; - } - ret += "}"; - return ret; - } - - - /// - /// CX^XeLXgt@Cɏo͂܂ - /// - /// o͐ - void write( TextMemoryStream sw ) { - sw.WriteLine( "[ID#" + value.ToString( "0000" ) + "]" ); - sw.WriteLine( "Type=" + type ); - switch( type ){ - case VsqIDType.Anote: - sw.WriteLine( "Length=" + Length ); - sw.WriteLine( "Note#=" + Note ); - sw.WriteLine( "Dynamics=" + Dynamics ); - sw.WriteLine( "PMBendDepth=" + PMBendDepth ); - sw.WriteLine( "PMBendLength=" + PMBendLength ); - sw.WriteLine( "PMbPortamentoUse=" + PMbPortamentoUse ); - sw.WriteLine( "DEMdecGainRate=" + DEMdecGainRate ); - sw.WriteLine( "DEMaccent=" + DEMaccent ); - if ( LyricHandle != null ) { - sw.WriteLine( "LyricHandle=h#" + LyricHandle_index.ToString( "0000" ) ); - } - if ( VibratoHandle != null ) { - sw.WriteLine( "VibratoHandle=h#" + VibratoHandle_index.ToString( "0000" ) ); - sw.WriteLine( "VibratoDelay=" + VibratoDelay ); - } - break; - case VsqIDType.Singer: - sw.WriteLine( "IconHandle=h#" + IconHandle_index.ToString( "0000" ) ); - break; - } - } -}; - -} -#endif // __libvsq_h__ diff --git a/trunk/Boare.Lib.Vsq/port_cpp/main.cpp b/trunk/Boare.Lib.Vsq/port_cpp/main.cpp deleted file mode 100644 index eba7b38..0000000 --- a/trunk/Boare.Lib.Vsq/port_cpp/main.cpp +++ /dev/null @@ -1,17 +0,0 @@ -#include "libvsq.h" -#include - -using namespace std; -using namespace vsq; - -int main(){ - TextMemoryStream tms; - tms.WriteLine( "foo" ); - tms.WriteLine( "bar" ); - tms.Rewind(); - while( tms.Peek() >= 0 ){ - cout << tms.ReadLine() << endl; - } - tms.Close(); - return 0; -} diff --git a/trunk/LipSync/LipSync.sln b/trunk/LipSync/LipSync.sln index 8ede7be..77b5f5a 100644 --- a/trunk/LipSync/LipSync.sln +++ b/trunk/LipSync/LipSync.sln @@ -64,8 +64,10 @@ Global {D60A11E0-8FFA-4CBC-A2F9-7365AFDF47A9}.Debug|Any CPU.Build.0 = Debug|Any CPU {D60A11E0-8FFA-4CBC-A2F9-7365AFDF47A9}.Release|Any CPU.ActiveCfg = Release|Any CPU {D60A11E0-8FFA-4CBC-A2F9-7365AFDF47A9}.Release|Any CPU.Build.0 = Release|Any CPU - {0C58B068-272F-4390-A14F-3D72AFCF3DFB}.Debug|Any CPU.ActiveCfg = Debug|x86 - {0C58B068-272F-4390-A14F-3D72AFCF3DFB}.Release|Any CPU.ActiveCfg = Release|x86 + {0C58B068-272F-4390-A14F-3D72AFCF3DFB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0C58B068-272F-4390-A14F-3D72AFCF3DFB}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0C58B068-272F-4390-A14F-3D72AFCF3DFB}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0C58B068-272F-4390-A14F-3D72AFCF3DFB}.Release|Any CPU.Build.0 = Release|Any CPU {F4F8F601-4E3D-43F5-A8A8-AA1FB7F48452}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {F4F8F601-4E3D-43F5-A8A8-AA1FB7F48452}.Debug|Any CPU.Build.0 = Debug|Any CPU {F4F8F601-4E3D-43F5-A8A8-AA1FB7F48452}.Release|Any CPU.ActiveCfg = Release|Any CPU diff --git a/trunk/LipSync/LipSync/Editor/DisplacementControl.resx b/trunk/LipSync/LipSync/Editor/DisplacementControl.resx new file mode 100644 index 0000000..69c5649 --- /dev/null +++ b/trunk/LipSync/LipSync/Editor/DisplacementControl.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 17, 17 + + \ No newline at end of file diff --git a/trunk/LipSync/LipSync/Editor/FormCurveExport.Designer.cs b/trunk/LipSync/LipSync/Editor/FormCurveExport.Designer.cs new file mode 100644 index 0000000..74f2334 --- /dev/null +++ b/trunk/LipSync/LipSync/Editor/FormCurveExport.Designer.cs @@ -0,0 +1,204 @@ +/* + * FormCurveExport.Designer.cs + * Copyright (c) 2009 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 LipSync { + partial class FormCurveExport { + /// + /// 必要なデザイナ変数です。 + /// + private System.ComponentModel.IContainer components = null; + + /// + /// 使用中のリソースをすべてクリーンアップします。 + /// + /// マネージ リソースが破棄される場合 true、破棄されない場合は false です。 + protected override void Dispose( bool disposing ) { + if ( disposing && (components != null) ) { + components.Dispose(); + } + base.Dispose( disposing ); + } + + #region Windows フォーム デザイナで生成されたコード + + /// + /// デザイナ サポートに必要なメソッドです。このメソッドの内容を + /// コード エディタで変更しないでください。 + /// + private void InitializeComponent() { + this.chkX = new System.Windows.Forms.CheckBox(); + this.txtDirectory = new System.Windows.Forms.TextBox(); + this.lblDirectory = new System.Windows.Forms.Label(); + this.btnBrowse = new System.Windows.Forms.Button(); + this.chkY = new System.Windows.Forms.CheckBox(); + this.chkAlpha = new System.Windows.Forms.CheckBox(); + this.chkScale = new System.Windows.Forms.CheckBox(); + this.chkRotation = new System.Windows.Forms.CheckBox(); + this.folderBrowser = new System.Windows.Forms.FolderBrowserDialog(); + this.openFileDialog = new System.Windows.Forms.OpenFileDialog(); + this.btnOk = new System.Windows.Forms.Button(); + this.btnCancel = new System.Windows.Forms.Button(); + this.SuspendLayout(); + // + // chkX + // + this.chkX.AutoSize = true; + this.chkX.Location = new System.Drawing.Point( 29, 55 ); + this.chkX.Name = "chkX"; + this.chkX.Size = new System.Drawing.Size( 31, 16 ); + this.chkX.TabIndex = 0; + this.chkX.Text = "X"; + this.chkX.UseVisualStyleBackColor = true; + this.chkX.Click += new System.EventHandler( this.chkX_Click ); + // + // txtDirectory + // + this.txtDirectory.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.txtDirectory.Location = new System.Drawing.Point( 12, 24 ); + this.txtDirectory.Name = "txtDirectory"; + this.txtDirectory.Size = new System.Drawing.Size( 287, 19 ); + this.txtDirectory.TabIndex = 1; + // + // lblDirectory + // + this.lblDirectory.AutoSize = true; + this.lblDirectory.Location = new System.Drawing.Point( 12, 9 ); + this.lblDirectory.Name = "lblDirectory"; + this.lblDirectory.Size = new System.Drawing.Size( 52, 12 ); + this.lblDirectory.TabIndex = 2; + this.lblDirectory.Text = "Directory"; + // + // btnBrowse + // + this.btnBrowse.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.btnBrowse.Location = new System.Drawing.Point( 305, 22 ); + this.btnBrowse.Name = "btnBrowse"; + this.btnBrowse.Size = new System.Drawing.Size( 39, 23 ); + this.btnBrowse.TabIndex = 3; + this.btnBrowse.Text = "..."; + this.btnBrowse.UseVisualStyleBackColor = true; + this.btnBrowse.Click += new System.EventHandler( this.btnBrowse_Click ); + // + // chkY + // + this.chkY.AutoSize = true; + this.chkY.Location = new System.Drawing.Point( 29, 77 ); + this.chkY.Name = "chkY"; + this.chkY.Size = new System.Drawing.Size( 31, 16 ); + this.chkY.TabIndex = 4; + this.chkY.Text = "Y"; + this.chkY.UseVisualStyleBackColor = true; + this.chkY.Click += new System.EventHandler( this.chkY_Click ); + // + // chkAlpha + // + this.chkAlpha.AutoSize = true; + this.chkAlpha.Location = new System.Drawing.Point( 29, 99 ); + this.chkAlpha.Name = "chkAlpha"; + this.chkAlpha.Size = new System.Drawing.Size( 53, 16 ); + this.chkAlpha.TabIndex = 5; + this.chkAlpha.Text = "Alpha"; + this.chkAlpha.UseVisualStyleBackColor = true; + this.chkAlpha.Click += new System.EventHandler( this.chkAlpha_Click ); + // + // chkScale + // + this.chkScale.AutoSize = true; + this.chkScale.Location = new System.Drawing.Point( 29, 121 ); + this.chkScale.Name = "chkScale"; + this.chkScale.Size = new System.Drawing.Size( 52, 16 ); + this.chkScale.TabIndex = 6; + this.chkScale.Text = "Scale"; + this.chkScale.UseVisualStyleBackColor = true; + this.chkScale.Click += new System.EventHandler( this.chkScale_Click ); + // + // chkRotation + // + this.chkRotation.AutoSize = true; + this.chkRotation.Location = new System.Drawing.Point( 29, 143 ); + this.chkRotation.Name = "chkRotation"; + this.chkRotation.Size = new System.Drawing.Size( 67, 16 ); + this.chkRotation.TabIndex = 7; + this.chkRotation.Text = "Rotation"; + this.chkRotation.UseVisualStyleBackColor = true; + this.chkRotation.Click += new System.EventHandler( this.chkRotation_Click ); + // + // openFileDialog + // + this.openFileDialog.FileName = "openFileDialog1"; + // + // btnOk + // + this.btnOk.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.btnOk.DialogResult = System.Windows.Forms.DialogResult.OK; + this.btnOk.Location = new System.Drawing.Point( 180, 140 ); + this.btnOk.Name = "btnOk"; + this.btnOk.Size = new System.Drawing.Size( 75, 23 ); + this.btnOk.TabIndex = 8; + this.btnOk.Text = "OK"; + this.btnOk.UseVisualStyleBackColor = true; + // + // btnCancel + // + this.btnCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; + this.btnCancel.Location = new System.Drawing.Point( 261, 140 ); + this.btnCancel.Name = "btnCancel"; + this.btnCancel.Size = new System.Drawing.Size( 75, 23 ); + this.btnCancel.TabIndex = 9; + this.btnCancel.Text = "Cancel"; + this.btnCancel.UseVisualStyleBackColor = true; + // + // FormCurveExport + // + 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( 348, 175 ); + this.Controls.Add( this.btnCancel ); + this.Controls.Add( this.btnOk ); + this.Controls.Add( this.chkRotation ); + this.Controls.Add( this.chkScale ); + this.Controls.Add( this.chkAlpha ); + this.Controls.Add( this.chkY ); + this.Controls.Add( this.btnBrowse ); + this.Controls.Add( this.lblDirectory ); + this.Controls.Add( this.txtDirectory ); + this.Controls.Add( this.chkX ); + this.Name = "FormCurveExport"; + this.ShowIcon = false; + this.ShowInTaskbar = false; + this.Text = "Export Config"; + this.ResumeLayout( false ); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.CheckBox chkX; + private System.Windows.Forms.TextBox txtDirectory; + private System.Windows.Forms.Label lblDirectory; + private System.Windows.Forms.Button btnBrowse; + private System.Windows.Forms.CheckBox chkY; + private System.Windows.Forms.CheckBox chkAlpha; + private System.Windows.Forms.CheckBox chkScale; + private System.Windows.Forms.CheckBox chkRotation; + private System.Windows.Forms.FolderBrowserDialog folderBrowser; + private System.Windows.Forms.OpenFileDialog openFileDialog; + private System.Windows.Forms.Button btnOk; + private System.Windows.Forms.Button btnCancel; + } +} \ No newline at end of file diff --git a/trunk/LipSync/LipSync/Editor/FormCurveExport.cs b/trunk/LipSync/LipSync/Editor/FormCurveExport.cs new file mode 100644 index 0000000..9049929 --- /dev/null +++ b/trunk/LipSync/LipSync/Editor/FormCurveExport.cs @@ -0,0 +1,146 @@ +/* + * FormCurveExport.cs + * Copyright (c) 2009 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.Data; +using System.Drawing; +using System.Text; +using System.Windows.Forms; +using Boare.Lib.AppUtil; + +namespace LipSync { + public partial class FormCurveExport : Form { + public enum Mode { + EXPORT, + IMPORT, + } + + private Mode m_mode = Mode.EXPORT; + + public FormCurveExport() { + InitializeComponent(); + } + + public String getPath() { + return txtDirectory.Text; + } + + public bool isX() { + return chkX.Checked; + } + + public bool isY() { + return chkY.Checked; + } + + public bool isAlpha() { + return chkAlpha.Checked; + } + + public bool isScale() { + return chkScale.Checked; + } + + public bool isRotation() { + return chkRotation.Checked; + } + + public Mode getMode() { + return m_mode; + } + + public void setMode( Mode value ) { + m_mode = value; + if ( m_mode == Mode.EXPORT ) { + this.Text = _( "Curve Export Config" ); + lblDirectory.Text = _( "Directory" ); + } else if ( m_mode == Mode.IMPORT ) { + this.Text = _( "Curve Import Config" ); + lblDirectory.Text = _( "File" ); + if ( !chkX.Checked && !chkY.Checked && !chkAlpha.Checked && !chkScale.Checked && !chkRotation.Checked ) { + chkX.Checked = true; + } + } + } + + public static String _( String id ) { + return Messaging.getMessage( id ); + } + + private void chkX_Click( object sender, EventArgs e ) { + if ( m_mode == Mode.IMPORT ) { + chkX.Checked = true; + chkY.Checked = false; + chkAlpha.Checked = false; + chkScale.Checked = false; + chkRotation.Checked = false; + } + } + + private void chkY_Click( object sender, EventArgs e ) { + if ( m_mode == Mode.IMPORT ) { + chkX.Checked = false; + chkY.Checked = true; + chkAlpha.Checked = false; + chkScale.Checked = false; + chkRotation.Checked = false; + } + } + + private void chkAlpha_Click( object sender, EventArgs e ) { + if ( m_mode == Mode.IMPORT ) { + chkX.Checked = false; + chkY.Checked = false; + chkAlpha.Checked = true; + chkScale.Checked = false; + chkRotation.Checked = false; + } + } + + private void chkScale_Click( object sender, EventArgs e ) { + if ( m_mode == Mode.IMPORT ) { + chkX.Checked = false; + chkY.Checked = false; + chkAlpha.Checked = false; + chkScale.Checked = true; + chkRotation.Checked = false; + } + } + + private void chkRotation_Click( object sender, EventArgs e ) { + if ( m_mode == Mode.IMPORT ) { + chkX.Checked = false; + chkY.Checked = false; + chkAlpha.Checked = false; + chkScale.Checked = false; + chkRotation.Checked = true; + } + } + + private void btnBrowse_Click( object sender, EventArgs e ) { + if ( m_mode == Mode.EXPORT ) { + if ( folderBrowser.ShowDialog() != DialogResult.OK ) { + return; + } + txtDirectory.Text = folderBrowser.SelectedPath; + } else if ( m_mode == Mode.IMPORT ) { + if ( openFileDialog.ShowDialog() != DialogResult.OK ) { + return; + } + txtDirectory.Text = openFileDialog.FileName; + } + } + } +} diff --git a/trunk/LipSync/LipSync/Editor/FormCurveExport.resx b/trunk/LipSync/LipSync/Editor/FormCurveExport.resx new file mode 100644 index 0000000..c86e293 --- /dev/null +++ b/trunk/LipSync/LipSync/Editor/FormCurveExport.resx @@ -0,0 +1,126 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 17, 17 + + + 152, 17 + + \ No newline at end of file diff --git a/trunk/LipSync/LipSync/Editor/FormSeriesImage.resx b/trunk/LipSync/LipSync/Editor/FormSeriesImage.resx new file mode 100644 index 0000000..ff31a6d --- /dev/null +++ b/trunk/LipSync/LipSync/Editor/FormSeriesImage.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/trunk/bocoree/Arrays.cs b/trunk/bocoree/Arrays.cs new file mode 100644 index 0000000..5523e39 --- /dev/null +++ b/trunk/bocoree/Arrays.cs @@ -0,0 +1,27 @@ +/* + * Array.cs + * Copyright (c) 2009 kbinani + * + * This file is part of bocoree. + * + * bocoree is free software; you can redistribute it and/or + * modify it under the terms of the BSD License. + * + * bocoree 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. + */ +#if !JAVA +using System; +using System.Collections.Generic; + +namespace bocoree.java.util { + + public static class Arrays { + public static Vector asList( T[] a ) { + return new Vector( a ); + } + } + +} +#endif diff --git a/trunk/bocoree/BBackgroundWorker.cs b/trunk/bocoree/BBackgroundWorker.cs new file mode 100644 index 0000000..a2a145e --- /dev/null +++ b/trunk/bocoree/BBackgroundWorker.cs @@ -0,0 +1,21 @@ +/* + * BBackgroundWorker.cs + * Copyright (c) 2009 kbinani + * + * This file is part of bocoree. + * + * bocoree is free software; you can redistribute it and/or + * modify it under the terms of the BSD License. + * + * bocoree 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. + */ +#if JAVA +//INCLUDE ..\BuildJavaUI\src\org\kbinani\componentModel\BBackgroundWorker.java +#else +namespace bocoree.componentModel { + public class BBackgroundWorker : System.ComponentModel.BackgroundWorker { + } +} +#endif diff --git a/trunk/bocoree/BButton.cs b/trunk/bocoree/BButton.cs new file mode 100644 index 0000000..e32a6a1 --- /dev/null +++ b/trunk/bocoree/BButton.cs @@ -0,0 +1,248 @@ +/* + * BButton.cs + * Copyright (c) 2009 kbinani + * + * This file is part of bocoree. + * + * bocoree is free software; you can redistribute it and/or + * modify it under the terms of the BSD License. + * + * bocoree 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. + */ +#if JAVA +//INCLUDE ..\BuildJavaUI\src\org\kbinani\windows\forms\BButton.java +#else +namespace bocoree.windows.forms { + + public class BButton : System.Windows.Forms.Button { + #region java.awt.Component + // root implementation of java.awt.Component is in BForm.cs + public void setBounds( int x, int y, int width, int height ) { + base.Bounds = new System.Drawing.Rectangle( x, y, width, height ); + } + + public void setBounds( bocoree.java.awt.Rectangle rc ) { + base.Bounds = new System.Drawing.Rectangle( rc.x, rc.y, rc.width, rc.height ); + } + + public bocoree.java.awt.Cursor getCursor() { + System.Windows.Forms.Cursor c = base.Cursor; + bocoree.java.awt.Cursor ret = null; + if ( c.Equals( System.Windows.Forms.Cursors.Arrow ) ) { + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.DEFAULT_CURSOR ); + } else if ( c.Equals( System.Windows.Forms.Cursors.Cross ) ) { + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.CROSSHAIR_CURSOR ); + } else if ( c.Equals( System.Windows.Forms.Cursors.Default ) ) { + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.DEFAULT_CURSOR ); + } else if ( c.Equals( System.Windows.Forms.Cursors.Hand ) ) { + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.HAND_CURSOR ); + } else if ( c.Equals( System.Windows.Forms.Cursors.IBeam ) ) { + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.TEXT_CURSOR ); + } else if ( c.Equals( System.Windows.Forms.Cursors.PanEast ) ) { + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.E_RESIZE_CURSOR ); + } else if ( c.Equals( System.Windows.Forms.Cursors.PanNE ) ) { + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.NE_RESIZE_CURSOR ); + } else if ( c.Equals( System.Windows.Forms.Cursors.PanNorth ) ) { + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.N_RESIZE_CURSOR ); + } else if ( c.Equals( System.Windows.Forms.Cursors.PanNW ) ) { + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.NW_RESIZE_CURSOR ); + } else if ( c.Equals( System.Windows.Forms.Cursors.PanSE ) ) { + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.SE_RESIZE_CURSOR ); + } else if ( c.Equals( System.Windows.Forms.Cursors.PanSouth ) ) { + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.S_RESIZE_CURSOR ); + } else if ( c.Equals( System.Windows.Forms.Cursors.PanSW ) ) { + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.SW_RESIZE_CURSOR ); + } else if ( c.Equals( System.Windows.Forms.Cursors.PanWest ) ) { + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.W_RESIZE_CURSOR ); + } else if ( c.Equals( System.Windows.Forms.Cursors.SizeAll ) ) { + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.MOVE_CURSOR ); + } else { + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.CUSTOM_CURSOR ); + } + ret.cursor = c; + return ret; + } + + public void setCursor( bocoree.java.awt.Cursor value ) { + base.Cursor = value.cursor; + } + + public bool isVisible() { + return base.Visible; + } + + public void setVisible( bool value ) { + base.Visible = value; + } + +#if COMPONENT_ENABLE_TOOL_TIP_TEXT + public void setToolTipText( string value ) + { + base.ToolTipText = value; + } + + public String getToolTipText() + { + return base.ToolTipText; + } +#endif + +#if COMPONENT_PARENT_AS_OWNERITEM + public Object getParent() { + return base.OwnerItem; + } +#else + public object getParent() { + return base.Parent; + } +#endif + + public string getName() { + return base.Name; + } + + public void setName( string value ) { + base.Name = value; + } + +#if COMPONENT_ENABLE_LOCATION + public bocoree.java.awt.Point getLocationOnScreen() { + System.Drawing.Point p = base.PointToScreen( base.Location ); + return new bocoree.java.awt.Point( p.X, p.Y ); + } + + public bocoree.java.awt.Point getLocation() { + System.Drawing.Point loc = this.Location; + return new bocoree.java.awt.Point( loc.X, loc.Y ); + } + + public void setLocation( int x, int y ) { + base.Location = new System.Drawing.Point( x, y ); + } + + public void setLocation( bocoree.java.awt.Point p ) { + base.Location = new System.Drawing.Point( p.x, p.y ); + } +#endif + + public bocoree.java.awt.Rectangle getBounds() { + System.Drawing.Rectangle r = base.Bounds; + return new bocoree.java.awt.Rectangle( r.X, r.Y, r.Width, r.Height ); + } + +#if COMPONENT_ENABLE_X + public int getX() { + return base.Left; + } +#endif + +#if COMPONENT_ENABLE_Y + public int getY() { + return base.Top; + } +#endif + + public int getWidth() { + return base.Width; + } + + public int getHeight() { + return base.Height; + } + + public bocoree.java.awt.Dimension getSize() { + return new bocoree.java.awt.Dimension( base.Size.Width, base.Size.Height ); + } + + public void setSize( int width, int height ) { + base.Size = new System.Drawing.Size( width, height ); + } + + public void setSize( bocoree.java.awt.Dimension d ) { + setSize( d.width, d.height ); + } + + public void setBackground( bocoree.java.awt.Color color ) { + base.BackColor = System.Drawing.Color.FromArgb( color.getRed(), color.getGreen(), color.getBlue() ); + } + + public bocoree.java.awt.Color getBackground() { + return new bocoree.java.awt.Color( base.BackColor.R, base.BackColor.G, base.BackColor.B ); + } + + public void setForeground( bocoree.java.awt.Color color ) { + base.ForeColor = color.color; + } + + public bocoree.java.awt.Color getForeground() { + return new bocoree.java.awt.Color( base.ForeColor.R, base.ForeColor.G, base.ForeColor.B ); + } + + public bool isEnabled() { + return base.Enabled; + } + + public void setEnabled( bool value ) { + base.Enabled = value; + } + + public void requestFocus() { + base.Focus(); + } + + public bool isFocusOwner() { + return base.Focused; + } + + public void setPreferredSize( bocoree.java.awt.Dimension size ) { + base.Size = new System.Drawing.Size( size.width, size.height ); + } + + public bocoree.java.awt.Font getFont() { + return new bocoree.java.awt.Font( base.Font ); + } + + public void setFont( bocoree.java.awt.Font font ) { + if ( font == null ) { + return; + } + if ( font.font == null ) { + return; + } + base.Font = font.font; + } + #endregion + + #region javax.swing.AbstractButton + public string getText() { + return base.Text; + } + + public void setText( string value ) { + base.Text = value; + } +#if ABSTRACT_BUTTON_ENABLE_IS_SELECTED + public bool isSelected() { + return base.Checked; + } + + public void setSelected( bool value ) { + base.Checked = value; + } +#endif + public bocoree.java.awt.Icon getIcon() { + bocoree.java.awt.Icon ret = new bocoree.java.awt.Icon(); + ret.image = base.Image; + return ret; + } + + public void setIcon( bocoree.java.awt.Icon value ) { + base.Image = value.image; + } + #endregion + } + +} +#endif diff --git a/trunk/bocoree/BCancelEventArgs.cs b/trunk/bocoree/BCancelEventArgs.cs new file mode 100644 index 0000000..ab665bc --- /dev/null +++ b/trunk/bocoree/BCancelEventArgs.cs @@ -0,0 +1,16 @@ +/* + * BCancelEventArgs.cs + * Copyright (c) 2009 kbinani + * + * This file is part of bocoree. + * + * bocoree is free software; you can redistribute it and/or + * modify it under the terms of the BSD License. + * + * bocoree 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. + */ +#if JAVA +//INCLUDE ..\BuildJavaUI\src\org\kbinani\componentModel\BCancelEventArgs.java +#endif diff --git a/trunk/bocoree/BCheckBox.cs b/trunk/bocoree/BCheckBox.cs new file mode 100644 index 0000000..2f0f79b --- /dev/null +++ b/trunk/bocoree/BCheckBox.cs @@ -0,0 +1,105 @@ +/* + * BCheckBox.cs + * Copyright (c) 2009 kbinani + * + * This file is part of bocoree. + * + * bocoree is free software; you can redistribute it and/or + * modify it under the terms of the BSD License. + * + * bocoree 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. + */ +#if JAVA +//INCLUDE ..\BuildJavaUI\src\org\kbinani\windows\forms\BCheckBox.java +#else +#define ABSTRACT_BUTTON_ENABLE_IS_SELECTED +namespace bocoree.windows.forms { + public class BCheckBox : System.Windows.Forms.CheckBox{ + #region java.awt.Component + public bocoree.java.awt.Point getLocation() { + System.Drawing.Point loc = this.Location; + return new bocoree.java.awt.Point( loc.X, loc.Y ); + } + + public void setLocation( int x, int y ) { + base.Location = new System.Drawing.Point( x, y ); + } + + public void setLocation( bocoree.java.awt.Point p ) { + base.Location = new System.Drawing.Point( p.x, p.y ); + } + + public bocoree.java.awt.Rectangle getBounds() { + System.Drawing.Rectangle r = base.Bounds; + return new bocoree.java.awt.Rectangle( r.X, r.Y, r.Width, r.Height ); + } + + public int getX() { + return base.Left; + } + + public int getY() { + return base.Top; + } + + public int getWidth() { + return base.Width; + } + + public int getHeight() { + return base.Height; + } + + public bocoree.java.awt.Dimension getSize() { + return new bocoree.java.awt.Dimension( base.Size.Width, base.Size.Height ); + } + + public void setSize( int width, int height ) { + base.Size = new System.Drawing.Size( width, height ); + } + + public void setSize( bocoree.java.awt.Dimension d ) { + setSize( d.width, d.height ); + } + + public void setBackground( bocoree.java.awt.Color color ) { + base.BackColor = System.Drawing.Color.FromArgb( color.getRed(), color.getGreen(), color.getBlue() ); + } + + public void setFont( bocoree.java.awt.Font font ) { + base.Font = font.font; + } + + public bool getEnabled() { + return base.Enabled; + } + + public void setEnabled( bool value ) { + base.Enabled = value; + } + #endregion + + #region javax.swing.AbstractButton + public string getText() { + return base.Text; + } + + public void setText( string value ) { + base.Text = value; + } + +#if ABSTRACT_BUTTON_ENABLE_IS_SELECTED + public bool isSelected() { + return base.Checked; + } + + public void setSelected( bool value ) { + base.Checked = true; + } +#endif + #endregion + } +} +#endif diff --git a/trunk/bocoree/BComboBox.cs b/trunk/bocoree/BComboBox.cs new file mode 100644 index 0000000..d0aef8a --- /dev/null +++ b/trunk/bocoree/BComboBox.cs @@ -0,0 +1,255 @@ +#if JAVA +//INCLUDE ..\BuildJavaUI\src\org\kbinani\windows\forms\BComboBox.java +#else +using System; +using System.Windows.Forms; + +namespace bocoree.windows.forms{ + + public class BComboBox : ComboBox { + public void addItem( object item ) { + base.Items.Add( item ); + } + + public object getItemAt( int index ) { + return base.Items[index]; + } + + public int getItemCount() { + return base.Items.Count; + } + + public int getSelectedIndex() { + return base.SelectedIndex; + } + + public object getSelectedItem() { + return base.SelectedItem; + } + + public void insertItemAt( object item, int index ) { + base.Items.Insert( index, item ); + } + + public void removeAllItems() { + base.Items.Clear(); + } + + public void removeItem( object item ) { + base.Items.Remove( item ); + } + + public void removeItemAt( int index ) { + base.Items.RemoveAt( index ); + } + + public void setSelectedItem( object item ) { + base.SelectedItem = item; + } + + public void setSelectedIndex( int index ) { + base.SelectedIndex = index; + } + + #region java.awt.Component + // root implementation of java.awt.Component is in BForm.cs + public void setBounds( int x, int y, int width, int height ) { + base.Bounds = new System.Drawing.Rectangle( x, y, width, height ); + } + + public void setBounds( bocoree.java.awt.Rectangle rc ) { + base.Bounds = new System.Drawing.Rectangle( rc.x, rc.y, rc.width, rc.height ); + } + + public bocoree.java.awt.Cursor getCursor() { + System.Windows.Forms.Cursor c = base.Cursor; + bocoree.java.awt.Cursor ret = null; + if ( c.Equals( System.Windows.Forms.Cursors.Arrow ) ) { + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.DEFAULT_CURSOR ); + } else if ( c.Equals( System.Windows.Forms.Cursors.Cross ) ) { + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.CROSSHAIR_CURSOR ); + } else if ( c.Equals( System.Windows.Forms.Cursors.Default ) ) { + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.DEFAULT_CURSOR ); + } else if ( c.Equals( System.Windows.Forms.Cursors.Hand ) ) { + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.HAND_CURSOR ); + } else if ( c.Equals( System.Windows.Forms.Cursors.IBeam ) ) { + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.TEXT_CURSOR ); + } else if ( c.Equals( System.Windows.Forms.Cursors.PanEast ) ) { + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.E_RESIZE_CURSOR ); + } else if ( c.Equals( System.Windows.Forms.Cursors.PanNE ) ) { + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.NE_RESIZE_CURSOR ); + } else if ( c.Equals( System.Windows.Forms.Cursors.PanNorth ) ) { + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.N_RESIZE_CURSOR ); + } else if ( c.Equals( System.Windows.Forms.Cursors.PanNW ) ) { + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.NW_RESIZE_CURSOR ); + } else if ( c.Equals( System.Windows.Forms.Cursors.PanSE ) ) { + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.SE_RESIZE_CURSOR ); + } else if ( c.Equals( System.Windows.Forms.Cursors.PanSouth ) ) { + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.S_RESIZE_CURSOR ); + } else if ( c.Equals( System.Windows.Forms.Cursors.PanSW ) ) { + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.SW_RESIZE_CURSOR ); + } else if ( c.Equals( System.Windows.Forms.Cursors.PanWest ) ) { + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.W_RESIZE_CURSOR ); + } else if ( c.Equals( System.Windows.Forms.Cursors.SizeAll ) ) { + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.MOVE_CURSOR ); + } else { + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.CUSTOM_CURSOR ); + } + ret.cursor = c; + return ret; + } + + public void setCursor( bocoree.java.awt.Cursor value ) { + base.Cursor = value.cursor; + } + + public bool isVisible() { + return base.Visible; + } + + public void setVisible( bool value ) { + base.Visible = value; + } + +#if COMPONENT_ENABLE_TOOL_TIP_TEXT + public void setToolTipText( string value ) + { + base.ToolTipText = value; + } + + public String getToolTipText() + { + return base.ToolTipText; + } +#endif + +#if COMPONENT_PARENT_AS_OWNERITEM + public Object getParent() { + return base.OwnerItem; + } +#else + public object getParent() { + return base.Parent; + } +#endif + + public string getName() { + return base.Name; + } + + public void setName( string value ) { + base.Name = value; + } + +#if COMPONENT_ENABLE_LOCATION + public bocoree.java.awt.Point getLocationOnScreen() { + System.Drawing.Point p = base.PointToScreen( base.Location ); + return new bocoree.java.awt.Point( p.X, p.Y ); + } + + public bocoree.java.awt.Point getLocation() { + System.Drawing.Point loc = this.Location; + return new bocoree.java.awt.Point( loc.X, loc.Y ); + } + + public void setLocation( int x, int y ) { + base.Location = new System.Drawing.Point( x, y ); + } + + public void setLocation( bocoree.java.awt.Point p ) { + base.Location = new System.Drawing.Point( p.x, p.y ); + } +#endif + + public bocoree.java.awt.Rectangle getBounds() { + System.Drawing.Rectangle r = base.Bounds; + return new bocoree.java.awt.Rectangle( r.X, r.Y, r.Width, r.Height ); + } + +#if COMPONENT_ENABLE_X + public int getX() { + return base.Left; + } +#endif + +#if COMPONENT_ENABLE_Y + public int getY() { + return base.Top; + } +#endif + + public int getWidth() { + return base.Width; + } + + public int getHeight() { + return base.Height; + } + + public bocoree.java.awt.Dimension getSize() { + return new bocoree.java.awt.Dimension( base.Size.Width, base.Size.Height ); + } + + public void setSize( int width, int height ) { + base.Size = new System.Drawing.Size( width, height ); + } + + public void setSize( bocoree.java.awt.Dimension d ) { + setSize( d.width, d.height ); + } + + public void setBackground( bocoree.java.awt.Color color ) { + base.BackColor = System.Drawing.Color.FromArgb( color.getRed(), color.getGreen(), color.getBlue() ); + } + + public bocoree.java.awt.Color getBackground() { + return new bocoree.java.awt.Color( base.BackColor.R, base.BackColor.G, base.BackColor.B ); + } + + public void setForeground( bocoree.java.awt.Color color ) { + base.ForeColor = color.color; + } + + public bocoree.java.awt.Color getForeground() { + return new bocoree.java.awt.Color( base.ForeColor.R, base.ForeColor.G, base.ForeColor.B ); + } + + public bool isEnabled() { + return base.Enabled; + } + + public void setEnabled( bool value ) { + base.Enabled = value; + } + + public void requestFocus() { + base.Focus(); + } + + public bool isFocusOwner() { + return base.Focused; + } + + public void setPreferredSize( bocoree.java.awt.Dimension size ) { + base.Size = new System.Drawing.Size( size.width, size.height ); + } + + public bocoree.java.awt.Font getFont() { + return new bocoree.java.awt.Font( base.Font ); + } + + public void setFont( bocoree.java.awt.Font font ) { + if ( font == null ) { + return; + } + if ( font.font == null ) { + return; + } + base.Font = font.font; + } + #endregion + + } + +} +#endif diff --git a/trunk/bocoree/BDelegate.cs b/trunk/bocoree/BDelegate.cs new file mode 100644 index 0000000..179aa5e --- /dev/null +++ b/trunk/bocoree/BDelegate.cs @@ -0,0 +1,16 @@ +/* + * BDelegate.cs + * Copyright (c) 2009 kbinani + * + * This file is part of bocoree. + * + * bocoree is free software; you can redistribute it and/or + * modify it under the terms of the BSD License. + * + * bocoree 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. + */ +#if JAVA +//INCLUDE ..\BuildJavaUI\src\org\kbinani\BDelegate.java +#endif diff --git a/trunk/bocoree/BDialogResult.cs b/trunk/bocoree/BDialogResult.cs new file mode 100644 index 0000000..4f1adbb --- /dev/null +++ b/trunk/bocoree/BDialogResult.cs @@ -0,0 +1,27 @@ +/* + * BDialogResult.cs + * Copyright (c) 2009 kbinani + * + * This file is part of bocoree. + * + * bocoree is free software; you can redistribute it and/or + * modify it under the terms of the BSD License. + * + * bocoree 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. + */ +#if JAVA +//INCLUDE ..\BuildJavaUI\src\org\kbinani\windows\forms\BDialogResult.java +#else +namespace bocoree.windows.forms { + + public enum BDialogResult { + OK, + CANCEL, + YES, + NO, + } + +} +#endif diff --git a/trunk/bocoree/BDoWorkEventArgs.cs b/trunk/bocoree/BDoWorkEventArgs.cs new file mode 100644 index 0000000..0556841 --- /dev/null +++ b/trunk/bocoree/BDoWorkEventArgs.cs @@ -0,0 +1,16 @@ +/* + * BDoWorkEventArgs.cs + * Copyright (c) 2009 kbinani + * + * This file is part of bocoree. + * + * bocoree is free software; you can redistribute it and/or + * modify it under the terms of the BSD License. + * + * bocoree 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. + */ +#if JAVA +//INCLUDE ..\BuildJavaUI\src\org\kbinani\componentModel\BDoWorkEventArgs.java +#endif diff --git a/trunk/bocoree/BDoWorkEventHandler.cs b/trunk/bocoree/BDoWorkEventHandler.cs new file mode 100644 index 0000000..4ca035d --- /dev/null +++ b/trunk/bocoree/BDoWorkEventHandler.cs @@ -0,0 +1,16 @@ +/* + * BDoWorkEventHandler.cs + * Copyright (c) 2009 kbinani + * + * This file is part of bocoree. + * + * bocoree is free software; you can redistribute it and/or + * modify it under the terms of the BSD License. + * + * bocoree 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. + */ +#if JAVA +//INCLUDE ..\BuildJavaUI\src\org\kbinani\componentModel\BDoWorkEventHandler.java +#endif diff --git a/trunk/bocoree/BEvent.cs b/trunk/bocoree/BEvent.cs new file mode 100644 index 0000000..f40b5ba --- /dev/null +++ b/trunk/bocoree/BEvent.cs @@ -0,0 +1,16 @@ +/* + * BEvent.cs + * Copyright (c) 2009 kbinani + * + * This file is part of bocoree. + * + * bocoree is free software; you can redistribute it and/or + * modify it under the terms of the BSD License. + * + * bocoree 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. + */ +#if JAVA +//INCLUDE ..\BuildJavaUI\src\org\kbinani\BEvent.java +#endif diff --git a/trunk/bocoree/BEventArgs.cs b/trunk/bocoree/BEventArgs.cs new file mode 100644 index 0000000..991bd0d --- /dev/null +++ b/trunk/bocoree/BEventArgs.cs @@ -0,0 +1,16 @@ +/* + * BEventArgs.cs + * Copyright (c) 2009 kbinani + * + * This file is part of bocoree. + * + * bocoree is free software; you can redistribute it and/or + * modify it under the terms of the BSD License. + * + * bocoree 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. + */ +#if JAVA +//INCLUDE ..\BuildJavaUI\src\org\kbinani\BEventArgs.java +#endif diff --git a/trunk/bocoree/BEventHandler.cs b/trunk/bocoree/BEventHandler.cs new file mode 100644 index 0000000..4936d88 --- /dev/null +++ b/trunk/bocoree/BEventHandler.cs @@ -0,0 +1,16 @@ +/* + * BEventHandler.cs + * Copyright (c) 2009 kbinani + * + * This file is part of bocoree. + * + * bocoree is free software; you can redistribute it and/or + * modify it under the terms of the BSD License. + * + * bocoree 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. + */ +#if JAVA +//INCLUDE ..\BuildJavaUI\src\org\kbinani\BEventHandler.java +#endif diff --git a/trunk/bocoree/BFileChooser.cs b/trunk/bocoree/BFileChooser.cs new file mode 100644 index 0000000..6625046 --- /dev/null +++ b/trunk/bocoree/BFileChooser.cs @@ -0,0 +1,159 @@ +/* + * BFileChooser.cs + * Copyright (c) 2009 kbinani + * + * This file is part of bocoree. + * + * bocoree is free software; you can redistribute it and/or + * modify it under the terms of the BSD License. + * + * bocoree 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. + */ +#if JAVA +//INCLUDE ..\BuildJavaUI\src\org\kbinani\windows\forms\BFileChooser.java +#else +using System; +using System.IO; +using System.Windows.Forms; +using System.Collections.Generic; + +namespace bocoree.windows.forms { + + public class BFileChooser : IDisposable { + public const int APPROVE_OPTION = 0; + public const int CANCEL_OPTION = 1; + public const int ERROR_OPTION = -1; + + private string m_current_directory = ""; + private List m_filters = new List(); + private OpenFileDialog m_open = new OpenFileDialog(); + private SaveFileDialog m_save = new SaveFileDialog(); + private string m_current_filter = ""; + private string m_selected_file = ""; + + public BFileChooser( String currentDirectoryPath ) { + m_current_directory = currentDirectoryPath; + } + + public void addFileFilter( String filter ) { + m_filters.Add( filter ); + } + + public String getFileFilter() { + return m_current_filter; + } + + public void setFileFilter( String value ) { + m_current_filter = value; + } + + public void clearChoosableFileFilter() { + m_filters.Clear(); + } + + public string[] getChoosableFileFilter() { + return m_filters.ToArray(); + } + + public String getSelectedFile() { + return m_selected_file; + } + + public void setSelectedFile( String value ) { + m_selected_file = value; + m_open.FileName = m_selected_file; + m_save.FileName = m_selected_file; + } + + public void setInitialDirectory( string value ) { + m_open.InitialDirectory = value; + m_save.InitialDirectory = value; + } + + public int showOpenDialog( Control parent ) { + m_open.InitialDirectory = m_current_directory; + string filter = ""; + int count = 0; + int selected = -1; + foreach ( string f in m_filters ) { + filter += (count == 0 ? "" : "|") + f; + if ( f == m_current_filter ) { + selected = count; + } + count++; + } + m_open.Filter = filter; + if ( selected >= 0 ) { + m_open.FilterIndex = selected; + } + DialogResult dr = m_open.ShowDialog(); + m_selected_file = m_open.FileName; + int filter_index = m_open.FilterIndex; + if ( 0 <= filter_index && filter_index < m_filters.Count ) { + m_current_filter = m_filters[filter_index]; + } + if ( m_selected_file != "" ) { + m_current_directory = Path.GetDirectoryName( m_selected_file ); + } + if ( dr == DialogResult.OK ) { + return APPROVE_OPTION; + } else if ( dr == DialogResult.Cancel ) { + return CANCEL_OPTION; + } else { + return ERROR_OPTION; + } + } + + public int showSaveDialog( Control parent ) { + m_save.InitialDirectory = m_current_directory; + string filter = ""; + int count = 0; + int selected = -1; + foreach ( string f in m_filters ) { + filter += (count == 0 ? "" : "|") + f; + if ( f == m_current_filter ) { + selected = count; + } + count++; + } + m_save.Filter = filter; + if ( selected >= 0 ) { + m_save.FilterIndex = selected; + } + DialogResult dr = m_save.ShowDialog(); + m_selected_file = m_save.FileName; + int filter_index = m_save.FilterIndex; + if ( 0 <= filter_index && filter_index < m_filters.Count ) { + m_current_filter = m_filters[filter_index]; + } + if ( m_selected_file != "" ) { + m_current_directory = Path.GetDirectoryName( m_selected_file ); + } + if ( dr == DialogResult.OK ) { + return APPROVE_OPTION; + } else if ( dr == DialogResult.Cancel ) { + return CANCEL_OPTION; + } else { + return ERROR_OPTION; + } + } + + public void setDialogTitle( String value ) { + m_open.Title = value; + m_save.Title = value; + } + + public void Dispose() { + if ( m_open == null ) { + m_open.Dispose(); + } + if ( m_save == null ) { + m_save.Dispose(); + } + } + } + +} +#endif diff --git a/trunk/bocoree/BFolderBrowser.cs b/trunk/bocoree/BFolderBrowser.cs new file mode 100644 index 0000000..09efd9a --- /dev/null +++ b/trunk/bocoree/BFolderBrowser.cs @@ -0,0 +1,64 @@ +/* + * BFolderBrowser.cs + * Copyright (c) 2009 kbinani + * + * This file is part of bocoree. + * + * bocoree is free software; you can redistribute it and/or + * modify it under the terms of the BSD License. + * + * bocoree 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. + */ +#if JAVA +//INCLUDE ..\BuildJavaUI\src\org\kbinani\windows\forms\BFolderBrowser.java +#else +using System; +using System.Windows.Forms; + +namespace bocoree.windows.forms { + + public class BFolderBrowser { + public FolderBrowserDialog dialog; + + public BFolderBrowser() { + dialog = new FolderBrowserDialog(); + dialog.RootFolder = Environment.SpecialFolder.Desktop; + } + + public bool isNewFolderButtonVisible() { + return dialog.ShowNewFolderButton; + } + + public void setNewFolderButtonVisible( bool value ) { + dialog.ShowNewFolderButton = value; + } + + public string getDescription() { + return dialog.Description; + } + + public void setDescription( string value ) { + dialog.Description = value; + } + + public string getSelectedPath() { + return dialog.SelectedPath; + } + + public void setSelectedPath( string value ) { + dialog.SelectedPath = value; + } + + public BDialogResult showDialog() { + if ( dialog.ShowDialog() == DialogResult.OK ) { + return BDialogResult.OK; + } else { + return BDialogResult.CANCEL; + } + } + } + +} +#endif diff --git a/trunk/bocoree/BFontChooser.cs b/trunk/bocoree/BFontChooser.cs new file mode 100644 index 0000000..96b4985 --- /dev/null +++ b/trunk/bocoree/BFontChooser.cs @@ -0,0 +1,50 @@ +/* + * BFontChooser.cs + * Copyright (c) 2009 kbinani + * + * This file is part of bocoree. + * + * bocoree is free software; you can redistribute it and/or + * modify it under the terms of the BSD License. + * + * bocoree 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. + */ +#if JAVA +//INCLUDE ..\BuildJavaUI\src\org\kbinani\windows\forms\BFontChooser.java +#else +using System; +using System.Windows.Forms; +using bocoree.java.awt; + +namespace bocoree.windows.forms { + + public class BFontChooser { + public FontDialog dialog = null; + + public BFontChooser() { + dialog = new FontDialog(); + } + + public BDialogResult showDialog() { + DialogResult dr = dialog.ShowDialog(); + if ( dr == DialogResult.OK ) { + return BDialogResult.OK; + } else if ( dr == DialogResult.Cancel ) { + return BDialogResult.CANCEL; + } + return BDialogResult.CANCEL; + } + + public void setSelectedFont( Font font ) { + dialog.Font = font.font; + } + + public Font getSelectedFont() { + return new Font( dialog.Font ); + } + } + +} +#endif diff --git a/trunk/bocoree/BForm.cs b/trunk/bocoree/BForm.cs new file mode 100644 index 0000000..30b374e --- /dev/null +++ b/trunk/bocoree/BForm.cs @@ -0,0 +1,413 @@ +/* + * BForm.cs + * Copyright (c) 2009 kbinani + * + * This file is part of bocoree. + * + * bocoree is free software; you can redistribute it and/or + * modify it under the terms of the BSD License. + * + * bocoree 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. + */ +#if JAVA +//INCLUDE ..\BuildJavaUI\src\org\kbinani\windows\forms\BForm.java +#else +#define COMPONENT_ENABLE_LOCATION +#define COMPONENT_ENABLE_Y +#define COMPONENT_ENABLE_X +#define COMPONENT_ENABLE_FOCUS +#define COMPONENT_ENABLE_CURSOR +#define COMPONENT_ENABLE_REPAINT + +using System; + +namespace bocoree.windows.forms { + using boolean = System.Boolean; + + public class BForm : System.Windows.Forms.Form { + protected BDialogResult m_result = BDialogResult.CANCEL; + + public void setDialogResult( BDialogResult value ) { + switch ( value ) { + case BDialogResult.YES: + this.DialogResult = System.Windows.Forms.DialogResult.Yes; + break; + case BDialogResult.NO: + this.DialogResult = System.Windows.Forms.DialogResult.No; + break; + case BDialogResult.OK: + this.DialogResult = System.Windows.Forms.DialogResult.OK; + break; + case BDialogResult.CANCEL: + this.DialogResult = System.Windows.Forms.DialogResult.Cancel; + break; + } + } + + public BDialogResult getDialogResult() { + return m_result; + } + + public BDialogResult showDialog() { + System.Windows.Forms.DialogResult dr = base.ShowDialog(); + if ( dr == System.Windows.Forms.DialogResult.OK ) { + m_result = BDialogResult.OK; + } else if ( dr == System.Windows.Forms.DialogResult.Cancel ) { + m_result = BDialogResult.CANCEL; + } else if ( dr == System.Windows.Forms.DialogResult.Yes ) { + m_result = BDialogResult.YES; + } else if ( dr == System.Windows.Forms.DialogResult.No ) { + m_result = BDialogResult.NO; + } + return m_result; + } + + public void close() { + base.Close(); + } + + public bocoree.java.awt.Dimension getClientSize() { + System.Drawing.Size s = base.Size; + return new bocoree.java.awt.Dimension( s.Width, s.Height ); + } + + // root implementation: common APIs of org.kbinani.* + #region common APIs of org.kbinani.* + // root implementation is in BForm.cs + public bocoree.java.awt.Point pointToScreen( bocoree.java.awt.Point point_on_client ) { + bocoree.java.awt.Point p = getLocationOnScreen(); + return new bocoree.java.awt.Point( p.x + point_on_client.x, p.y + point_on_client.y ); + } + + public bocoree.java.awt.Point pointToClient( bocoree.java.awt.Point point_on_screen ) { + bocoree.java.awt.Point p = getLocationOnScreen(); + return new bocoree.java.awt.Point( point_on_screen.x - p.x, point_on_screen.y - p.y ); + } + #endregion + + // root implementation of java.awt.Component + #region java.awt.Component + // root implementation of java.awt.Component is in BForm.cs + public void invalidate() { + base.Invalidate(); + } + +#if COMPONENT_ENABLE_REPAINT + public void repaint() { + base.Refresh(); + } +#endif + +#if COMPONENT_ENABLE_CURSOR + public bocoree.java.awt.Cursor getCursor() { + System.Windows.Forms.Cursor c = base.Cursor; + bocoree.java.awt.Cursor ret = null; + if( c.Equals( System.Windows.Forms.Cursors.Arrow ) ){ + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.DEFAULT_CURSOR ); + } else if ( c.Equals( System.Windows.Forms.Cursors.Cross ) ){ + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.CROSSHAIR_CURSOR ); + } else if ( c.Equals( System.Windows.Forms.Cursors.Default ) ){ + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.DEFAULT_CURSOR ); + } else if ( c.Equals( System.Windows.Forms.Cursors.Hand ) ){ + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.HAND_CURSOR ); + } else if ( c.Equals( System.Windows.Forms.Cursors.IBeam ) ) { + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.TEXT_CURSOR ); + } else if ( c.Equals( System.Windows.Forms.Cursors.PanEast ) ) { + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.E_RESIZE_CURSOR ); + } else if ( c.Equals( System.Windows.Forms.Cursors.PanNE ) ) { + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.NE_RESIZE_CURSOR ); + } else if ( c.Equals( System.Windows.Forms.Cursors.PanNorth ) ) { + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.N_RESIZE_CURSOR ); + } else if ( c.Equals( System.Windows.Forms.Cursors.PanNW ) ) { + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.NW_RESIZE_CURSOR ); + } else if ( c.Equals( System.Windows.Forms.Cursors.PanSE ) ) { + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.SE_RESIZE_CURSOR ); + } else if ( c.Equals( System.Windows.Forms.Cursors.PanSouth ) ) { + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.S_RESIZE_CURSOR ); + } else if ( c.Equals( System.Windows.Forms.Cursors.PanSW ) ) { + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.SW_RESIZE_CURSOR ); + } else if ( c.Equals( System.Windows.Forms.Cursors.PanWest ) ) { + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.W_RESIZE_CURSOR ); + } else if ( c.Equals( System.Windows.Forms.Cursors.SizeAll ) ) { + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.MOVE_CURSOR ); + } else { + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.CUSTOM_CURSOR ); + } + ret.cursor = c; + return ret; + } + + public void setCursor( bocoree.java.awt.Cursor value ) { + base.Cursor = value.cursor; + } +#endif + + public bool isVisible() { + return base.Visible; + } + + public void setVisible( bool value ) { + base.Visible = value; + } + +#if COMPONENT_ENABLE_TOOL_TIP_TEXT + public void setToolTipText( string value ) + { + base.ToolTipText = value; + } + + public String getToolTipText() + { + return base.ToolTipText; + } +#endif + +#if COMPONENT_PARENT_AS_OWNERITEM + public Object getParent() { + return base.OwnerItem; + } +#else + public object getParent() { + return base.Parent; + } +#endif + + public string getName() { + return base.Name; + } + + public void setName( string value ) { + base.Name = value; + } + +#if COMPONENT_ENABLE_LOCATION + public void setBounds( int x, int y, int width, int height ) { + base.Bounds = new System.Drawing.Rectangle( x, y, width, height ); + } + + public void setBounds( bocoree.java.awt.Rectangle rc ) { + base.Bounds = new System.Drawing.Rectangle( rc.x, rc.y, rc.width, rc.height ); + } + + public bocoree.java.awt.Point getLocationOnScreen() { + System.Drawing.Point p = base.PointToScreen( base.Location ); + return new bocoree.java.awt.Point( p.X, p.Y ); + } + + public bocoree.java.awt.Point getLocation() { + System.Drawing.Point loc = this.Location; + return new bocoree.java.awt.Point( loc.X, loc.Y ); + } + + public void setLocation( int x, int y ) { + base.Location = new System.Drawing.Point( x, y ); + } + + public void setLocation( bocoree.java.awt.Point p ) { + base.Location = new System.Drawing.Point( p.x, p.y ); + } +#endif + + public bocoree.java.awt.Rectangle getBounds() { + System.Drawing.Rectangle r = base.Bounds; + return new bocoree.java.awt.Rectangle( r.X, r.Y, r.Width, r.Height ); + } + +#if COMPONENT_ENABLE_X + public int getX() { + return base.Left; + } +#endif + +#if COMPONENT_ENABLE_Y + public int getY() { + return base.Top; + } +#endif + + public int getWidth() { + return base.Width; + } + + public int getHeight() { + return base.Height; + } + + public bocoree.java.awt.Dimension getSize() { + return new bocoree.java.awt.Dimension( base.Size.Width, base.Size.Height ); + } + + public void setSize( int width, int height ) { + base.Size = new System.Drawing.Size( width, height ); + } + + public void setSize( bocoree.java.awt.Dimension d ) { + setSize( d.width, d.height ); + } + + public void setBackground( bocoree.java.awt.Color color ) { + base.BackColor = System.Drawing.Color.FromArgb( color.getRed(), color.getGreen(), color.getBlue() ); + } + + public bocoree.java.awt.Color getBackground() { + return new bocoree.java.awt.Color( base.BackColor.R, base.BackColor.G, base.BackColor.B ); + } + + public void setForeground( bocoree.java.awt.Color color ) { + base.ForeColor = color.color; + } + + public bocoree.java.awt.Color getForeground() { + return new bocoree.java.awt.Color( base.ForeColor.R, base.ForeColor.G, base.ForeColor.B ); + } + + public bool isEnabled() { + return base.Enabled; + } + + public void setEnabled( bool value ) { + base.Enabled = value; + } + +#if COMPONENT_ENABLE_FOCUS + public void requestFocus() { + base.Focus(); + } + + public bool isFocusOwner() { + return base.Focused; + } +#endif + + public void setPreferredSize( bocoree.java.awt.Dimension size ) { + base.Size = new System.Drawing.Size( size.width, size.height ); + } + + public bocoree.java.awt.Font getFont() { + return new bocoree.java.awt.Font( base.Font ); + } + + public void setFont( bocoree.java.awt.Font font ) { + if ( font == null ) { + return; + } + if ( font.font == null ) { + return; + } + base.Font = font.font; + } + #endregion + + // root implementation of java.awt.Window + #region java.awt.Window + // root implementation of java.awt.Window is in BForm.cs + public void setMinimumSize( bocoree.java.awt.Dimension size ) { + base.MinimumSize = new System.Drawing.Size( size.width, size.height ); + } + + public bocoree.java.awt.Dimension getMinimumSize() { + return new bocoree.java.awt.Dimension( base.MinimumSize.Width, base.MinimumSize.Height ); + } + + public void setAlwaysOnTop( boolean alwaysOnTop ) { + base.TopMost = alwaysOnTop; + } + + public boolean isAlwaysOnTop() { + return base.TopMost; + } + #endregion + + // root implementation of java.awt.Frame + #region java.awt.Frame + // root implementation of java.awt.Frame is in BForm.cs + public const int CROSSHAIR_CURSOR = 1; + public const int DEFAULT_CURSOR = 0; + public const int E_RESIZE_CURSOR = 11; + public const int HAND_CURSOR = 12; + public const int ICONIFIED = 1; + public const int MAXIMIZED_BOTH = 6; + public const int MAXIMIZED_HORIZ = 2; + public const int MAXIMIZED_VERT = 4; + public const int MOVE_CURSOR = 13; + public const int N_RESIZE_CURSOR = 8; + public const int NE_RESIZE_CURSOR = 7; + public const int NORMAL = 0; + public const int NW_RESIZE_CURSOR = 6; + public const int S_RESIZE_CURSOR = 9; + public const int SE_RESIZE_CURSOR = 5; + public const int SW_RESIZE_CURSOR = 4; + public const int TEXT_CURSOR = 2; + public const int W_RESIZE_CURSOR = 10; + public const int WAIT_CURSOR = 3; + + public void setIconImage( System.Drawing.Icon icon ) { + base.Icon = icon; + } + + public System.Drawing.Icon getIconImage() { + return base.Icon; + } + + public int getState() { + if ( base.WindowState == System.Windows.Forms.FormWindowState.Minimized ) { + return ICONIFIED; + } else { + return NORMAL; + } + } + + public void setState( int state ) { + if ( state == ICONIFIED ) { + if ( base.WindowState != System.Windows.Forms.FormWindowState.Minimized ) { + base.WindowState = System.Windows.Forms.FormWindowState.Minimized; + } + } else { + if ( base.WindowState == System.Windows.Forms.FormWindowState.Minimized ) { + base.WindowState = System.Windows.Forms.FormWindowState.Normal; + } + } + } + + public int getExtendedState() { + if ( base.WindowState == System.Windows.Forms.FormWindowState.Maximized ) { + return MAXIMIZED_BOTH; + } else if ( base.WindowState == System.Windows.Forms.FormWindowState.Minimized ) { + return ICONIFIED; + } else { + return NORMAL; + } + } + + public void setExtendedState( int value ) { + if ( value == ICONIFIED ) { + base.WindowState = System.Windows.Forms.FormWindowState.Minimized; + } else if ( value == MAXIMIZED_BOTH ) { + base.WindowState = System.Windows.Forms.FormWindowState.Maximized; + } else { + base.WindowState = System.Windows.Forms.FormWindowState.Normal; + } + } + + public string getTitle() { + return base.Text; + } + + public void setTitle( string value ) { + base.Text = value; + } + #endregion + + // root implementation of javax.swing.JComponent + #region javax.swing.JComponent + // root implementation of javax.swing.JComponent is in BForm.cs + public bool requestFocusInWindow() { + return base.Focus(); + } + #endregion + } + +} +#endif diff --git a/trunk/bocoree/BFormClosedEventArgs.cs b/trunk/bocoree/BFormClosedEventArgs.cs new file mode 100644 index 0000000..28a7fda --- /dev/null +++ b/trunk/bocoree/BFormClosedEventArgs.cs @@ -0,0 +1,16 @@ +/* + * BFormClosedEventArgs.cs + * Copyright (c) 2009 kbinani + * + * This file is part of bocoree. + * + * bocoree is free software; you can redistribute it and/or + * modify it under the terms of the BSD License. + * + * bocoree 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. + */ +#if JAVA +//INCLUDE ..\BuildJavaUI\src\org\kbinani\windows\forms\BFormClosedEventArgs.java +#endif diff --git a/trunk/bocoree/BFormClosingEventArgs.cs b/trunk/bocoree/BFormClosingEventArgs.cs new file mode 100644 index 0000000..97887a2 --- /dev/null +++ b/trunk/bocoree/BFormClosingEventArgs.cs @@ -0,0 +1,16 @@ +/* + * BFormClosingEventArgs.cs + * Copyright (c) 2009 kbinani + * + * This file is part of bocoree. + * + * bocoree is free software; you can redistribute it and/or + * modify it under the terms of the BSD License. + * + * bocoree 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. + */ +#if JAVA +//INCLUDE ..\BuildJavaUI\src\org\kbinani\windows\forms\BFormClosingEventArgs.java +#endif diff --git a/trunk/bocoree/BFormClosingEventHandler.cs b/trunk/bocoree/BFormClosingEventHandler.cs new file mode 100644 index 0000000..2e1eb7b --- /dev/null +++ b/trunk/bocoree/BFormClosingEventHandler.cs @@ -0,0 +1,16 @@ +/* + * BFormClosingEventHandler.cs + * Copyright (c) 2009 kbinani + * + * This file is part of bocoree. + * + * bocoree is free software; you can redistribute it and/or + * modify it under the terms of the BSD License. + * + * bocoree 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. + */ +#if JAVA +//INCLUDE ..\BuildJavaUI\src\org\kbinani\windows\forms\BFormClosingEventHandler.java +#endif diff --git a/trunk/bocoree/BFormWindowState.cs b/trunk/bocoree/BFormWindowState.cs new file mode 100644 index 0000000..11cdeaa --- /dev/null +++ b/trunk/bocoree/BFormWindowState.cs @@ -0,0 +1,26 @@ +/* + * BFormWindowState.cs + * Copyright (c) 2009 kbinani + * + * This file is part of bocoree. + * + * bocoree is free software; you can redistribute it and/or + * modify it under the terms of the BSD License. + * + * bocoree 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. + */ +#if JAVA +//INCLUDE ..\BuildJavaUI\src\org\kbinani\windows\forms\BFormWindowState.java +#else +namespace bocoree.windows.forms{ + + public enum BFormWindowState { + Normal, + Minimized, + Maximized, + } + +} +#endif diff --git a/trunk/bocoree/BGroupBox.cs b/trunk/bocoree/BGroupBox.cs new file mode 100644 index 0000000..f9ecf68 --- /dev/null +++ b/trunk/bocoree/BGroupBox.cs @@ -0,0 +1,15 @@ +#if JAVA +//INCLUDE ..\BuildJavaUI\src\org\kbinani\windows\forms\BGroupBox.java +#else +namespace bocoree.windows.forms{ + public class BGroupBox : System.Windows.Forms.GroupBox { + public string getTitle() { + return base.Text; + } + + public void setTitle( string value ) { + base.Text = value; + } + } +} +#endif diff --git a/trunk/bocoree/BHScrollBar.cs b/trunk/bocoree/BHScrollBar.cs new file mode 100644 index 0000000..8ebe944 --- /dev/null +++ b/trunk/bocoree/BHScrollBar.cs @@ -0,0 +1,228 @@ +/* + * BHScrollBar.cs + * Copyright (c) 2009 kbinani + * + * This file is part of bocoree. + * + * bocoree is free software; you can redistribute it and/or + * modify it under the terms of the BSD License. + * + * bocoree 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. + */ +#if JAVA +//INCLUDE ..\BuildJavaUI\src\org\kbinani\windows\forms\BHScrollBar.java +#else +namespace bocoree.windows.forms{ + + public class BHScrollBar : System.Windows.Forms.HScrollBar{ + #region javax.swing.ScrollBar + public void setMaximum( int value ) { + base.Maximum = value; + } + + public int getMaximum() { + return base.Maximum; + } + + public void setMinimum( int value ) { + base.Minimum = value; + } + + public int getMinimum() { + return base.Minimum; + } + + public int getValue() { + return base.Value; + } + + public void setValue( int value ) { + base.Value = value; + } + + public int getVisibleAmount() { + return base.LargeChange; + } + + public void setVisibleAmount( int value ) { + base.LargeChange = value; + } + #endregion + + #region java.awt.Component + // root implementation of java.awt.Component is in BForm.cs + public bocoree.java.awt.Cursor getCursor() { + System.Windows.Forms.Cursor c = base.Cursor; + bocoree.java.awt.Cursor ret = null; + if ( c.Equals( System.Windows.Forms.Cursors.Arrow ) ) { + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.DEFAULT_CURSOR ); + } else if ( c.Equals( System.Windows.Forms.Cursors.Cross ) ) { + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.CROSSHAIR_CURSOR ); + } else if ( c.Equals( System.Windows.Forms.Cursors.Default ) ) { + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.DEFAULT_CURSOR ); + } else if ( c.Equals( System.Windows.Forms.Cursors.Hand ) ) { + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.HAND_CURSOR ); + } else if ( c.Equals( System.Windows.Forms.Cursors.IBeam ) ) { + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.TEXT_CURSOR ); + } else if ( c.Equals( System.Windows.Forms.Cursors.PanEast ) ) { + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.E_RESIZE_CURSOR ); + } else if ( c.Equals( System.Windows.Forms.Cursors.PanNE ) ) { + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.NE_RESIZE_CURSOR ); + } else if ( c.Equals( System.Windows.Forms.Cursors.PanNorth ) ) { + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.N_RESIZE_CURSOR ); + } else if ( c.Equals( System.Windows.Forms.Cursors.PanNW ) ) { + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.NW_RESIZE_CURSOR ); + } else if ( c.Equals( System.Windows.Forms.Cursors.PanSE ) ) { + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.SE_RESIZE_CURSOR ); + } else if ( c.Equals( System.Windows.Forms.Cursors.PanSouth ) ) { + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.S_RESIZE_CURSOR ); + } else if ( c.Equals( System.Windows.Forms.Cursors.PanSW ) ) { + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.SW_RESIZE_CURSOR ); + } else if ( c.Equals( System.Windows.Forms.Cursors.PanWest ) ) { + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.W_RESIZE_CURSOR ); + } else if ( c.Equals( System.Windows.Forms.Cursors.SizeAll ) ) { + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.MOVE_CURSOR ); + } else { + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.CUSTOM_CURSOR ); + } + ret.cursor = c; + return ret; + } + + public void setCursor( bocoree.java.awt.Cursor value ) { + base.Cursor = value.cursor; + } + + public bool isVisible() { + return base.Visible; + } + + public void setVisible( bool value ) { + base.Visible = value; + } + +#if COMPONENT_ENABLE_TOOL_TIP_TEXT + public void setToolTipText( string value ) + { + base.ToolTipText = value; + } + + public String getToolTipText() + { + return base.ToolTipText; + } +#endif + +#if COMPONENT_PARENT_AS_OWNERITEM + public Object getParent() { + return base.OwnerItem; + } +#else + public object getParent() { + return base.Parent; + } +#endif + + public string getName() { + return base.Name; + } + + public void setName( string value ) { + base.Name = value; + } + +#if COMPONENT_ENABLE_LOCATION + public bocoree.java.awt.Point getLocationOnScreen() { + System.Drawing.Point p = base.PointToScreen( base.Location ); + return new bocoree.java.awt.Point( p.X, p.Y ); + } + + public bocoree.java.awt.Point getLocation() { + System.Drawing.Point loc = this.Location; + return new bocoree.java.awt.Point( loc.X, loc.Y ); + } + + public void setLocation( int x, int y ) { + base.Location = new System.Drawing.Point( x, y ); + } + + public void setLocation( bocoree.java.awt.Point p ) { + base.Location = new System.Drawing.Point( p.x, p.y ); + } +#endif + + public bocoree.java.awt.Rectangle getBounds() { + System.Drawing.Rectangle r = base.Bounds; + return new bocoree.java.awt.Rectangle( r.X, r.Y, r.Width, r.Height ); + } + +#if COMPONENT_ENABLE_X + public int getX() { + return base.Left; + } +#endif + +#if COMPONENT_ENABLE_Y + public int getY() { + return base.Top; + } +#endif + + public int getWidth() { + return base.Width; + } + + public int getHeight() { + return base.Height; + } + + public bocoree.java.awt.Dimension getSize() { + return new bocoree.java.awt.Dimension( base.Size.Width, base.Size.Height ); + } + + public void setSize( int width, int height ) { + base.Size = new System.Drawing.Size( width, height ); + } + + public void setSize( bocoree.java.awt.Dimension d ) { + setSize( d.width, d.height ); + } + + public void setBackground( bocoree.java.awt.Color color ) { + base.BackColor = System.Drawing.Color.FromArgb( color.getRed(), color.getGreen(), color.getBlue() ); + } + + public bocoree.java.awt.Color getBackground() { + return new bocoree.java.awt.Color( base.BackColor.R, base.BackColor.G, base.BackColor.B ); + } + + public void setForeground( bocoree.java.awt.Color color ) { + base.ForeColor = color.color; + } + + public bocoree.java.awt.Color getForeground() { + return new bocoree.java.awt.Color( base.ForeColor.R, base.ForeColor.G, base.ForeColor.B ); + } + + public void setFont( bocoree.java.awt.Font font ) { + base.Font = font.font; + } + + public bool isEnabled() { + return base.Enabled; + } + + public void setEnabled( bool value ) { + base.Enabled = value; + } + + public void requestFocus() { + base.Focus(); + } + #endregion + } + +} +#endif diff --git a/trunk/bocoree/BKeyEventArgs.cs b/trunk/bocoree/BKeyEventArgs.cs new file mode 100644 index 0000000..09bdbfb --- /dev/null +++ b/trunk/bocoree/BKeyEventArgs.cs @@ -0,0 +1,16 @@ +/* + * BKeyEventArgs.cs + * Copyright (c) 2009 kbinani + * + * This file is part of bocoree. + * + * bocoree is free software; you can redistribute it and/or + * modify it under the terms of the BSD License. + * + * bocoree 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. + */ +#if JAVA +//INCLUDE ..\BuildJavaUI\src\org\kbinani\windows\forms\BKeyEventArgs.java +#endif diff --git a/trunk/bocoree/BKeyEventHandler.cs b/trunk/bocoree/BKeyEventHandler.cs new file mode 100644 index 0000000..66a11c2 --- /dev/null +++ b/trunk/bocoree/BKeyEventHandler.cs @@ -0,0 +1,16 @@ +/* + * BKeyEventHandler.cs + * Copyright (c) 2009 kbinani + * + * This file is part of bocoree. + * + * bocoree is free software; you can redistribute it and/or + * modify it under the terms of the BSD License. + * + * bocoree 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. + */ +#if JAVA +//INCLUDE ..\BuildJavaUI\src\org\kbinani\windows\forms\BKeyEventHandler.java +#endif diff --git a/trunk/bocoree/BKeyPressEventArgs.cs b/trunk/bocoree/BKeyPressEventArgs.cs new file mode 100644 index 0000000..68b440d --- /dev/null +++ b/trunk/bocoree/BKeyPressEventArgs.cs @@ -0,0 +1,16 @@ +/* + * BKeyPressEventArgs.cs + * Copyright (c) 2009 kbinani + * + * This file is part of bocoree. + * + * bocoree is free software; you can redistribute it and/or + * modify it under the terms of the BSD License. + * + * bocoree 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. + */ +#if JAVA +//INCLUDE ..\BuildJavaUI\src\org\kbinani\windows\forms\BKeyPressEventArgs.java +#endif diff --git a/trunk/bocoree/BKeys.cs b/trunk/bocoree/BKeys.cs new file mode 100644 index 0000000..dcad051 --- /dev/null +++ b/trunk/bocoree/BKeys.cs @@ -0,0 +1,432 @@ +/* + * BKeys.cs + * Copyright (c) 2009 kbinani + * + * This file is part of bocoree. + * + * bocoree is free software; you can redistribute it and/or + * modify it under the terms of the BSD License. + * + * bocoree 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. + */ +#if JAVA +package org.kbinani.windows.forms; + +public enum BKeys{ + Modifiers( -65536 ), + None( 0 ), + LButton( 1 ), + RButton( 2 ), + Cancel( 3 ), + MButton( 4 ), + XButton1( 5 ), + XButton2( 6 ), + Back( 8 ), + Tab( 9 ), + LineFeed( 10 ), + Clear( 12 ), + Enter( 13 ), + Return( 13 ), + ShiftKey( 16 ), + ControlKey( 17 ), + Menu( 18 ), + Pause( 19 ), + CapsLock( 20 ), + Capital( 20 ), + KanaMode( 21 ), + HanguelMode( 21 ), + HangulMode( 21 ), + JunjaMode( 23 ), + FinalMode( 24 ), + KanjiMode( 25 ), + HanjaMode( 25 ), + Escape( 27 ), + IMEConvert( 28 ), + IMENonconvert( 29 ), + IMEAceept( 30 ), + IMEAccept( 30 ), + IMEModeChange( 31 ), + Space( 32 ), + Prior( 33 ), + PageUp( 33 ), + Next( 34 ), + PageDown( 34 ), + End( 35 ), + Home( 36 ), + Left( 37 ), + Up( 38 ), + Right( 39 ), + Down( 40 ), + Select( 41 ), + Print( 42 ), + Execute( 43 ), + PrintScreen( 44 ), + Snapshot( 44 ), + Insert( 45 ), + Delete( 46 ), + Help( 47 ), + D0( 48 ), + D1( 49 ), + D2( 50 ), + D3( 51 ), + D4( 52 ), + D5( 53 ), + D6( 54 ), + D7( 55 ), + D8( 56 ), + D9( 57 ), + A( 65 ), + B( 66 ), + C( 67 ), + D( 68 ), + E( 69 ), + F( 70 ), + G( 71 ), + H( 72 ), + I( 73 ), + J( 74 ), + K( 75 ), + L( 76 ), + M( 77 ), + N( 78 ), + O( 79 ), + P( 80 ), + Q( 81 ), + R( 82 ), + S( 83 ), + T( 84 ), + U( 85 ), + V( 86 ), + W( 87 ), + X( 88 ), + Y( 89 ), + Z( 90 ), + LWin( 91 ), + RWin( 92 ), + Apps( 93 ), + Sleep( 95 ), + NumPad0( 96 ), + NumPad1( 97 ), + NumPad2( 98 ), + NumPad3( 99 ), + NumPad4( 100 ), + NumPad5( 101 ), + NumPad6( 102 ), + NumPad7( 103 ), + NumPad8( 104 ), + NumPad9( 105 ), + Multiply( 106 ), + Add( 107 ), + Separator( 108 ), + Subtract( 109 ), + Decimal( 110 ), + Divide( 111 ), + F1( 112 ), + F2( 113 ), + F3( 114 ), + F4( 115 ), + F5( 116 ), + F6( 117 ), + F7( 118 ), + F8( 119 ), + F9( 120 ), + F10( 121 ), + F11( 122 ), + F12( 123 ), + F13( 124 ), + F14( 125 ), + F15( 126 ), + F16( 127 ), + F17( 128 ), + F18( 129 ), + F19( 130 ), + F20( 131 ), + F21( 132 ), + F22( 133 ), + F23( 134 ), + F24( 135 ), + NumLock( 144 ), + Scroll( 145 ), + LShiftKey( 160 ), + RShiftKey( 161 ), + LControlKey( 162 ), + RControlKey( 163 ), + LMenu( 164 ), + RMenu( 165 ), + BrowserBack( 166 ), + BrowserForward( 167 ), + BrowserRefresh( 168 ), + BrowserStop( 169 ), + BrowserSearch( 170 ), + BrowserFavorites( 171 ), + BrowserHome( 172 ), + VolumeMute( 173 ), + VolumeDown( 174 ), + VolumeUp( 175 ), + MediaNextTrack( 176 ), + MediaPreviousTrack( 177 ), + MediaStop( 178 ), + MediaPlayPause( 179 ), + LaunchMail( 180 ), + SelectMedia( 181 ), + LaunchApplication1( 182 ), + LaunchApplication2( 183 ), + Oem1( 186 ), + OemSemicolon( 186 ), + Oemplus( 187 ), + Oemcomma( 188 ), + OemMinus( 189 ), + OemPeriod( 190 ), + OemQuestion( 191 ), + Oem2( 191 ), + Oemtilde( 192 ), + Oem3( 192 ), + Oem4( 219 ), + OemOpenBrackets( 219 ), + OemPipe( 220 ), + Oem5( 220 ), + Oem6( 221 ), + OemCloseBrackets( 221 ), + Oem7( 222 ), + OemQuotes( 222 ), + Oem8( 223 ), + Oem102( 226 ), + OemBackslash( 226 ), + ProcessKey( 229 ), + Packet( 231 ), + Attn( 246 ), + Crsel( 247 ), + Exsel( 248 ), + EraseEof( 249 ), + Play( 250 ), + Zoom( 251 ), + NoName( 252 ), + Pa1( 253 ), + OemClear( 254 ), + KeyCode( 65535 ), + Shift( 65536 ), + Control( 131072 ), + Alt( 262144 ); + + private int m_value; + + private BKeys( int value ){ + m_value = value; + } + + public int getValue(){ + return m_value; + } + + public boolean equals( BKeys item ){ + if( item == null ){ + return false; + }else{ + return item.getValue() == getValue(); + } + } +} +#else +namespace bocoree.windows.forms { + + public enum BKeys { + Modifiers = -65536, + None = 0, + LButton = 1, + RButton = 2, + Cancel = 3, + MButton = 4, + XButton1 = 5, + XButton2 = 6, + Back = 8, + Tab = 9, + LineFeed = 10, + Clear = 12, + Enter = 13, + Return = 13, + ShiftKey = 16, + ControlKey = 17, + Menu = 18, + Pause = 19, + CapsLock = 20, + Capital = 20, + KanaMode = 21, + HanguelMode = 21, + HangulMode = 21, + JunjaMode = 23, + FinalMode = 24, + KanjiMode = 25, + HanjaMode = 25, + Escape = 27, + IMEConvert = 28, + IMENonconvert = 29, + IMEAceept = 30, + IMEAccept = 30, + IMEModeChange = 31, + Space = 32, + Prior = 33, + PageUp = 33, + Next = 34, + PageDown = 34, + End = 35, + Home = 36, + Left = 37, + Up = 38, + Right = 39, + Down = 40, + Select = 41, + Print = 42, + Execute = 43, + PrintScreen = 44, + Snapshot = 44, + Insert = 45, + Delete = 46, + Help = 47, + D0 = 48, + D1 = 49, + D2 = 50, + D3 = 51, + D4 = 52, + D5 = 53, + D6 = 54, + D7 = 55, + D8 = 56, + D9 = 57, + A = 65, + B = 66, + C = 67, + D = 68, + E = 69, + F = 70, + G = 71, + H = 72, + I = 73, + J = 74, + K = 75, + L = 76, + M = 77, + N = 78, + O = 79, + P = 80, + Q = 81, + R = 82, + S = 83, + T = 84, + U = 85, + V = 86, + W = 87, + X = 88, + Y = 89, + Z = 90, + LWin = 91, + RWin = 92, + Apps = 93, + Sleep = 95, + NumPad0 = 96, + NumPad1 = 97, + NumPad2 = 98, + NumPad3 = 99, + NumPad4 = 100, + NumPad5 = 101, + NumPad6 = 102, + NumPad7 = 103, + NumPad8 = 104, + NumPad9 = 105, + Multiply = 106, + Add = 107, + Separator = 108, + Subtract = 109, + Decimal = 110, + Divide = 111, + F1 = 112, + F2 = 113, + F3 = 114, + F4 = 115, + F5 = 116, + F6 = 117, + F7 = 118, + F8 = 119, + F9 = 120, + F10 = 121, + F11 = 122, + F12 = 123, + F13 = 124, + F14 = 125, + F15 = 126, + F16 = 127, + F17 = 128, + F18 = 129, + F19 = 130, + F20 = 131, + F21 = 132, + F22 = 133, + F23 = 134, + F24 = 135, + NumLock = 144, + Scroll = 145, + LShiftKey = 160, + RShiftKey = 161, + LControlKey = 162, + RControlKey = 163, + LMenu = 164, + RMenu = 165, + BrowserBack = 166, + BrowserForward = 167, + BrowserRefresh = 168, + BrowserStop = 169, + BrowserSearch = 170, + BrowserFavorites = 171, + BrowserHome = 172, + VolumeMute = 173, + VolumeDown = 174, + VolumeUp = 175, + MediaNextTrack = 176, + MediaPreviousTrack = 177, + MediaStop = 178, + MediaPlayPause = 179, + LaunchMail = 180, + SelectMedia = 181, + LaunchApplication1 = 182, + LaunchApplication2 = 183, + Oem1 = 186, + OemSemicolon = 186, + Oemplus = 187, + Oemcomma = 188, + OemMinus = 189, + OemPeriod = 190, + OemQuestion = 191, + Oem2 = 191, + Oemtilde = 192, + Oem3 = 192, + Oem4 = 219, + OemOpenBrackets = 219, + OemPipe = 220, + Oem5 = 220, + Oem6 = 221, + OemCloseBrackets = 221, + Oem7 = 222, + OemQuotes = 222, + Oem8 = 223, + Oem102 = 226, + OemBackslash = 226, + ProcessKey = 229, + Packet = 231, + Attn = 246, + Crsel = 247, + Exsel = 248, + EraseEof = 249, + Play = 250, + Zoom = 251, + NoName = 252, + Pa1 = 253, + OemClear = 254, + KeyCode = 65535, + Shift = 65536, + Control = 131072, + Alt = 262144, + } + +} +#endif diff --git a/trunk/bocoree/BLabel.cs b/trunk/bocoree/BLabel.cs new file mode 100644 index 0000000..f0bb7ca --- /dev/null +++ b/trunk/bocoree/BLabel.cs @@ -0,0 +1,236 @@ +/* + * BLabel.cs + * Copyright (c) 2009 kbinani + * + * This file is part of bocoree. + * + * bocoree is free software; you can redistribute it and/or + * modify it under the terms of the GPLv3 License. + * + * bocoree 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. + */ +#if JAVA +//INCLUDE ..\BuildJavaUI\src\org\kbinani\windows\forms\BLabel.java +#else +namespace bocoree.windows.forms{ + + public class BLabel : System.Windows.Forms.Label { + public string getText() { + return base.Text; + } + + public void setText( string value ) { + base.Text = value; + } + + #region java.awt.Component + // root implementation of java.awt.Component is in BForm.cs + public void invalidate() { + base.Invalidate(); + } + + public void repaint() { + base.Refresh(); + } + + public void setBounds( int x, int y, int width, int height ) { + base.Bounds = new System.Drawing.Rectangle( x, y, width, height ); + } + + public void setBounds( bocoree.java.awt.Rectangle rc ) { + base.Bounds = new System.Drawing.Rectangle( rc.x, rc.y, rc.width, rc.height ); + } + + public bocoree.java.awt.Cursor getCursor() { + System.Windows.Forms.Cursor c = base.Cursor; + bocoree.java.awt.Cursor ret = null; + if ( c.Equals( System.Windows.Forms.Cursors.Arrow ) ) { + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.DEFAULT_CURSOR ); + } else if ( c.Equals( System.Windows.Forms.Cursors.Cross ) ) { + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.CROSSHAIR_CURSOR ); + } else if ( c.Equals( System.Windows.Forms.Cursors.Default ) ) { + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.DEFAULT_CURSOR ); + } else if ( c.Equals( System.Windows.Forms.Cursors.Hand ) ) { + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.HAND_CURSOR ); + } else if ( c.Equals( System.Windows.Forms.Cursors.IBeam ) ) { + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.TEXT_CURSOR ); + } else if ( c.Equals( System.Windows.Forms.Cursors.PanEast ) ) { + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.E_RESIZE_CURSOR ); + } else if ( c.Equals( System.Windows.Forms.Cursors.PanNE ) ) { + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.NE_RESIZE_CURSOR ); + } else if ( c.Equals( System.Windows.Forms.Cursors.PanNorth ) ) { + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.N_RESIZE_CURSOR ); + } else if ( c.Equals( System.Windows.Forms.Cursors.PanNW ) ) { + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.NW_RESIZE_CURSOR ); + } else if ( c.Equals( System.Windows.Forms.Cursors.PanSE ) ) { + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.SE_RESIZE_CURSOR ); + } else if ( c.Equals( System.Windows.Forms.Cursors.PanSouth ) ) { + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.S_RESIZE_CURSOR ); + } else if ( c.Equals( System.Windows.Forms.Cursors.PanSW ) ) { + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.SW_RESIZE_CURSOR ); + } else if ( c.Equals( System.Windows.Forms.Cursors.PanWest ) ) { + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.W_RESIZE_CURSOR ); + } else if ( c.Equals( System.Windows.Forms.Cursors.SizeAll ) ) { + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.MOVE_CURSOR ); + } else { + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.CUSTOM_CURSOR ); + } + ret.cursor = c; + return ret; + } + + public void setCursor( bocoree.java.awt.Cursor value ) { + base.Cursor = value.cursor; + } + + public bool isVisible() { + return base.Visible; + } + + public void setVisible( bool value ) { + base.Visible = value; + } + +#if COMPONENT_ENABLE_TOOL_TIP_TEXT + public void setToolTipText( string value ) + { + base.ToolTipText = value; + } + + public String getToolTipText() + { + return base.ToolTipText; + } +#endif + +#if COMPONENT_PARENT_AS_OWNERITEM + public Object getParent() { + return base.OwnerItem; + } +#else + public object getParent() { + return base.Parent; + } +#endif + + public string getName() { + return base.Name; + } + + public void setName( string value ) { + base.Name = value; + } + +#if COMPONENT_ENABLE_LOCATION + public bocoree.java.awt.Point getLocationOnScreen() { + System.Drawing.Point p = base.PointToScreen( base.Location ); + return new bocoree.java.awt.Point( p.X, p.Y ); + } + + public bocoree.java.awt.Point getLocation() { + System.Drawing.Point loc = this.Location; + return new bocoree.java.awt.Point( loc.X, loc.Y ); + } + + public void setLocation( int x, int y ) { + base.Location = new System.Drawing.Point( x, y ); + } + + public void setLocation( bocoree.java.awt.Point p ) { + base.Location = new System.Drawing.Point( p.x, p.y ); + } +#endif + + public bocoree.java.awt.Rectangle getBounds() { + System.Drawing.Rectangle r = base.Bounds; + return new bocoree.java.awt.Rectangle( r.X, r.Y, r.Width, r.Height ); + } + +#if COMPONENT_ENABLE_X + public int getX() { + return base.Left; + } +#endif + +#if COMPONENT_ENABLE_Y + public int getY() { + return base.Top; + } +#endif + + public int getWidth() { + return base.Width; + } + + public int getHeight() { + return base.Height; + } + + public bocoree.java.awt.Dimension getSize() { + return new bocoree.java.awt.Dimension( base.Size.Width, base.Size.Height ); + } + + public void setSize( int width, int height ) { + base.Size = new System.Drawing.Size( width, height ); + } + + public void setSize( bocoree.java.awt.Dimension d ) { + setSize( d.width, d.height ); + } + + public void setBackground( bocoree.java.awt.Color color ) { + base.BackColor = System.Drawing.Color.FromArgb( color.getRed(), color.getGreen(), color.getBlue() ); + } + + public bocoree.java.awt.Color getBackground() { + return new bocoree.java.awt.Color( base.BackColor.R, base.BackColor.G, base.BackColor.B ); + } + + public void setForeground( bocoree.java.awt.Color color ) { + base.ForeColor = color.color; + } + + public bocoree.java.awt.Color getForeground() { + return new bocoree.java.awt.Color( base.ForeColor.R, base.ForeColor.G, base.ForeColor.B ); + } + + public bool isEnabled() { + return base.Enabled; + } + + public void setEnabled( bool value ) { + base.Enabled = value; + } + + public void requestFocus() { + base.Focus(); + } + + public bool isFocusOwner() { + return base.Focused; + } + + public void setPreferredSize( bocoree.java.awt.Dimension size ) { + base.Size = new System.Drawing.Size( size.width, size.height ); + } + + public bocoree.java.awt.Font getFont() { + return new bocoree.java.awt.Font( base.Font ); + } + + public void setFont( bocoree.java.awt.Font font ) { + if ( font == null ) { + return; + } + if ( font.font == null ) { + return; + } + base.Font = font.font; + } + #endregion + } + +} +#endif diff --git a/trunk/bocoree/BListView.cs b/trunk/bocoree/BListView.cs new file mode 100644 index 0000000..e8f8608 --- /dev/null +++ b/trunk/bocoree/BListView.cs @@ -0,0 +1,217 @@ +/* + * BListView.cs + * Copyright (c) 2009 kbinani + * + * This file is part of bocoree. + * + * bocoree is free software; you can redistribute it and/or + * modify it under the terms of the BSD License. + * + * bocoree 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. + */ +#if JAVA +//INCLUDE ..\BuildJavaUI\src\org\kbinani\windows\forms\BListView.java +#else +using System; +using System.Collections.Generic; +using System.Windows.Forms; +using bocoree.java.awt; + +namespace bocoree.windows.forms { + + public class BListView : System.Windows.Forms.ListView { + private List m_headers = new List(); + + public BListView() { + ListViewGroup def = new ListViewGroup(); + def.Name = ""; + base.Groups.Add( def ); + } + + public void ensureRowVisible( String group, int row ) { + ListViewGroup g = getGroupFromName( group ); + g.Items[row].EnsureVisible(); + } + + public void setGroupHeader( String group, String header ) { + ListViewGroup g = getGroupFromName( group ); + g.Header = header; + } + + public void setItemBackColorAt( String group, int index, Color color ) { + ListViewGroup g = getGroupFromName( group ); + g.Items[index].BackColor = color.color; + } + + public void clear() { + List cache = new List(); + foreach ( ColumnHeader hdr in base.Columns ) { + cache.Add( hdr ); + } + base.Clear(); + foreach ( ColumnHeader hdr in cache ) { + base.Columns.Add( hdr ); + } + } + + public string getGroupNameAt( int index ) { + return base.Groups[index].Name; + } + + public int getGroupCount() { + return base.Groups.Count; + } + + public void setItemAt( string group, int index, BListViewItem item ) { + ListViewGroup g = getGroupFromName( group ); + g.Items[index] = item; + } + + public void removeItemAt( string group, int index ) { + ListViewGroup g = getGroupFromName( group ); + g.Items.RemoveAt( index ); + } + + public BListViewItem getItemAt( string group, int index ) { + ListViewGroup g = getGroupFromName( group ); + return (BListViewItem)g.Items[index]; + } + + public int getItemCount( String group ) { + ListViewGroup g = getGroupFromName( group ); + return g.Items.Count; + } + + private ListViewGroup getGroupFromName( string name ) { + foreach ( ListViewGroup group in base.Groups ) { + if ( name == group.Name ) { + if ( name == "" ) { + group.Header = "Default"; + } + return group; + } + } +#if DEBUG + Console.WriteLine( "BListView#getGroupFromName; creating new group" ); +#endif + System.Windows.Forms.ListViewGroup g = new System.Windows.Forms.ListViewGroup(); + g.Name = name; + if ( name == "" ) { + g.Header = "Default"; + } else { + g.Header = name; + } + base.Groups.Add( g ); + return g; + } + + public Boolean isItemCheckedAt( string group, int index ) { + ListViewGroup g = getGroupFromName( group ); + return g.Items[index].Checked; + } + + public void setItemCheckedAt( string group, int index, bool value ) { + ListViewGroup g = getGroupFromName( group ); + g.Items[index].Checked = value; + } + + public int getSelectedIndex( string group ) { + ListViewGroup g = getGroupFromName( group ); + int count = g.Items.Count; + for ( int i = 0; i < count; i++ ) { + if ( g.Items[i].Selected ) { + return i; + } + } + return -1; + } + + public void clearSelection( string group ) { + ListViewGroup g = getGroupFromName( group ); + foreach ( ListViewItem item in g.Items ) { + item.Selected = false; + } + } + + public void setItemSelectedAt( string group, int index, bool value ) { + ListViewGroup g = getGroupFromName( group ); + g.Items[index].Selected = value; + } + + public void addItem( string group, BListViewItem item, bool value ) { + int dif = item.getSubItemCount() - base.Columns.Count; + for ( int i = 0; i < dif; i++ ) { + ColumnHeader hdr = new ColumnHeader(); + m_headers.Add( hdr ); + base.Columns.Add( hdr ); + } + ListViewGroup g = getGroupFromName( group ); + item.Checked = value; + item.Group = g; + base.Items.Add( item ); +#if DEBUG + //Console.WriteLine( "BListView#addItem; columnWidths;" + base.Columns[0].Width + "," + base.Columns[1].Width ); +#endif + } + + public void addItem( string group, BListViewItem item ) { + addItem( group, item, false ); + } + + public bool isMultiSelect() { + return base.MultiSelect; + } + + public void setMultiSelect( bool value ) { + base.MultiSelect = value; + } + + public void setColumnHeaders( string[] headers ) { +#if DEBUG + Console.WriteLine( "BListView#setColumnHeaders; before; base.Columns.Count=" + base.Columns.Count ); +#endif + int dif = headers.Length - base.Columns.Count; + for ( int i = 0; i < dif; i++ ) { + ColumnHeader hdr = new ColumnHeader(); + m_headers.Add( hdr ); + base.Columns.Add( hdr ); + } + for ( int i = 0; i < headers.Length; i++ ) { + base.Columns[i].Text = headers[i]; + base.Columns[i].Name = headers[i]; + } +#if DEBUG + Console.WriteLine( "BListView#setColumnHeaders; after; base.Columns.Count=" + base.Columns.Count ); +#endif + } + + public void setColumnWidth( int index, int width ) { + base.Columns[index].Width = width; + } + + public int getColumnWidth( int index ) { + return base.Columns[index].Width; + } + + public string[] getColumnHeaders() { + int len = base.Columns.Count; + string[] ret = new string[len]; + for ( int i = 0; i < len; i++ ) { + ret[i] = base.Columns[i].Text; + } + return ret; + } + + public bool isCheckBoxes() { + return base.CheckBoxes; + } + + public void setCheckBoxes( bool value ) { + base.CheckBoxes = value; + } + } + +} +#endif diff --git a/trunk/bocoree/BListViewItem.cs b/trunk/bocoree/BListViewItem.cs new file mode 100644 index 0000000..42a9351 --- /dev/null +++ b/trunk/bocoree/BListViewItem.cs @@ -0,0 +1,52 @@ +/* + * BFontChooser.cs + * Copyright (c) 2009 kbinani + * + * This file is part of bocoree. + * + * bocoree is free software; you can redistribute it and/or + * modify it under the terms of the BSD License. + * + * bocoree 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. + */ +#if JAVA +//INCLUDE ..\BuildJavaUI\src\org\kbinani\windows\forms\BListViewItem.java +#else +namespace bocoree.windows.forms { + + public class BListViewItem : System.Windows.Forms.ListViewItem { + private string group = ""; + + public BListViewItem( string[] values ) + : base( values ) { + } + + public object clone() { + return base.Clone(); + } + + public object getTag() { + return base.Tag; + } + + public void setTag( object value ) { + base.Tag = value; + } + + public int getSubItemCount() { + return base.SubItems.Count; + } + + public string getSubItemAt( int index ) { + return base.SubItems[index].Text; + } + + public void setSubItemAt( int index, string value ) { + base.SubItems[index].Text = value; + } + } + +} +#endif diff --git a/trunk/bocoree/BMenu.cs b/trunk/bocoree/BMenu.cs new file mode 100644 index 0000000..275dbda --- /dev/null +++ b/trunk/bocoree/BMenu.cs @@ -0,0 +1,229 @@ +/* + * BMenuItem.cs + * Copyright (c) 2009 kbinani + * + * This file is part of bocoree. + * + * bocoree is free software; you can redistribute it and/or + * modify it under the terms of the BSD License. + * + * bocoree 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. + */ +#if JAVA +//INCLUDE ..\BuildJavaUI\src\org\kbinani\windows\forms\BMenu.java +#else +#define ABSTRACT_BUTTON_ENABLE_IS_SELECTED +#define COMPONENT_PARENT_AS_OWNERITEM +#define COMPONENT_ENABLE_TOOL_TIP_TEXT +using System.Collections.Generic; +using System.Windows.Forms; +using bocoree.javax.swing; + +namespace bocoree.windows.forms { + // このクラスの中身はBMenuItem.csのコピー + public class BMenu : System.Windows.Forms.ToolStripMenuItem, MenuElement { + // root implementation of javax.swing.AbstractButton + #region javax.swing.AbstractButton + public string getText() { + return base.Text; + } + + public void setText( string value ) { + base.Text = value; + } +#if ABSTRACT_BUTTON_ENABLE_IS_SELECTED + public bool isSelected() { + return base.Checked; + } + + public void setSelected( bool value ) { + base.Checked = value; + } +#endif + public System.Drawing.Image getIcon() { + return base.Image; + } + + public void setIcon( System.Drawing.Image value ) { + base.Image = value; + } + #endregion + + #region java.awt.Component + public bool isVisible() { + return base.Visible; + } + + public void setVisible( bool value ) { + base.Visible = value; + } + +#if COMPONENT_ENABLE_TOOL_TIP_TEXT + public void setToolTipText( string value ) { + base.ToolTipText = value; + } + + public string getToolTipText() { + return base.ToolTipText; + } +#endif + +#if COMPONENT_PARENT_AS_OWNERITEM + public object getParent() { + return base.OwnerItem; + } +#else + public object getParent() + { + return base.Parent; + } +#endif + + public string getName() { + return base.Name; + } + + public void setName( string value ) { + base.Name = value; + } + +#if COMPONENT_ENABLE_LOCATION + public bocoree.java.awt.Point getLocation() + { + System.Drawing.Point loc = this.Location; + return new bocoree.java.awt.Point( loc.X, loc.Y ); + } + + public void setLocation( int x, int y ) + { + base.Location = new System.Drawing.Point( x, y ); + } + + public void setLocation( bocoree.java.awt.Point p ) + { + base.Location = new System.Drawing.Point( p.x, p.y ); + } +#endif + + public bocoree.java.awt.Rectangle getBounds() { + System.Drawing.Rectangle r = base.Bounds; + return new bocoree.java.awt.Rectangle( r.X, r.Y, r.Width, r.Height ); + } + +#if COMPONENT_ENABLE_X + public int getX() + { + return base.Left; + } +#endif + +#if COMPONENT_ENABLE_Y + public int getY() + { + return base.Top; + } +#endif + + public int getWidth() { + return base.Width; + } + + public int getHeight() { + return base.Height; + } + + public bocoree.java.awt.Dimension getSize() { + return new bocoree.java.awt.Dimension( base.Size.Width, base.Size.Height ); + } + + public void setSize( int width, int height ) { + base.Size = new System.Drawing.Size( width, height ); + } + + public void setSize( bocoree.java.awt.Dimension d ) { + setSize( d.width, d.height ); + } + + public void setBackground( bocoree.java.awt.Color color ) { + base.BackColor = System.Drawing.Color.FromArgb( color.getRed(), color.getGreen(), color.getBlue() ); + } + + public bocoree.java.awt.Color getBackground() { + return new bocoree.java.awt.Color( base.BackColor.R, base.BackColor.G, base.BackColor.B ); + } + + public void setForeground( bocoree.java.awt.Color color ) { + base.ForeColor = color.color; + } + + public bocoree.java.awt.Color getForeground() { + return new bocoree.java.awt.Color( base.ForeColor.R, base.ForeColor.G, base.ForeColor.B ); + } + + public void setFont( bocoree.java.awt.Font font ) { + base.Font = font.font; + } + + public bool getEnabled() { + return base.Enabled; + } + + public void setEnabled( bool value ) { + base.Enabled = value; + } + #endregion + + #region javax.swing.MenuElement + public MenuElement[] getSubElements() { + List list = new List(); + foreach ( ToolStripItem item in base.DropDownItems ) { + if ( item is MenuElement ) { + list.Add( (MenuElement)item ); + } + } + return list.ToArray(); + } + #endregion + + public bool isCheckOnClick() { + return base.CheckOnClick; + } + + public void setCheckOnClick( bool value ) { + base.CheckOnClick = value; + } + + public KeyStroke getAccelerator() { + KeyStroke ret = KeyStroke.getKeyStroke( 0, 0 ); + ret.keys = base.ShortcutKeys; + return ret; + } + + public void setAccelerator( KeyStroke stroke ) { + base.ShortcutKeys = stroke.keys; + } + + public void add( ToolStripItem item ) { + base.DropDownItems.Add( item ); + } + + public void addSeparator() { + base.DropDownItems.Add( new ToolStripSeparator() ); + } + + public void removeAll() { + base.DropDownItems.Clear(); + } + + public void setTag( object value ) { + base.Tag = value; + } + + public object getTag() { + return base.Tag; + } + } +} +#endif diff --git a/trunk/bocoree/BMenuBar.cs b/trunk/bocoree/BMenuBar.cs new file mode 100644 index 0000000..79c65be --- /dev/null +++ b/trunk/bocoree/BMenuBar.cs @@ -0,0 +1,155 @@ +/* + * BMenuBar.cs + * Copyright (c) 2009 kbinani + * + * This file is part of bocoree. + * + * bocoree is free software; you can redistribute it and/or + * modify it under the terms of the BSD License. + * + * bocoree 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. + */ +#if JAVA +//INCLUDE ..\BuildJavaUI\src\org\kbinani\windows\forms\BMenuBar.java +#else +using System; +using System.Collections.Generic; +using System.Windows.Forms; + +namespace bocoree.windows.forms { + public interface MenuElement { + MenuElement[] getSubElements(); + String getName(); + String getText(); + void setAccelerator( bocoree.javax.swing.KeyStroke stroke ); + bocoree.javax.swing.KeyStroke getAccelerator(); + object getParent(); + } + + public class BMenuBar : System.Windows.Forms.MenuStrip, MenuElement { + // root implementation of javax.swing.MenuElement + #region javax.swing.MenuElement + public MenuElement[] getSubElements() { + List list = new List(); + foreach ( ToolStripMenuItem item in base.Items ) { + if ( item is MenuElement ) { + list.Add( (MenuElement)item ); + } + } + return list.ToArray(); + } + #endregion + + #region javax.swing.AbstractButton + public string getText() { + return base.Text; + } + + public void setText( string value ) { + base.Text = value; + } +#if ABSTRACT_BUTTON_ENABLE_IS_SELECTED + public bool isSelected() { + return base.Checked; + } + + public void setSelected( bool value ) { + base.Checked = true; + } +#endif + #endregion + + #region java.awt.Component + public object getParent() { + return base.Parent; + } + + public string getName() { + return base.Name; + } + + public void setName( string value ) { + base.Name = value; + } + +#if COMPONENT_ENABLE_LOCATION + public bocoree.java.awt.Point getLocation() { + System.Drawing.Point loc = this.Location; + return new bocoree.java.awt.Point( loc.X, loc.Y ); + } + + public void setLocation( int x, int y ) { + base.Location = new System.Drawing.Point( x, y ); + } + + public void setLocation( bocoree.java.awt.Point p ) { + base.Location = new System.Drawing.Point( p.x, p.y ); + } +#endif + + public bocoree.java.awt.Rectangle getBounds() { + System.Drawing.Rectangle r = base.Bounds; + return new bocoree.java.awt.Rectangle( r.X, r.Y, r.Width, r.Height ); + } + +#if COMPONENT_ENABLE_X + public int getX() { + return base.Left; + } +#endif + +#if COMPONENT_ENABLE_Y + public int getY() { + return base.Top; + } +#endif + + public int getWidth() { + return base.Width; + } + + public int getHeight() { + return base.Height; + } + + public bocoree.java.awt.Dimension getSize() { + return new bocoree.java.awt.Dimension( base.Size.Width, base.Size.Height ); + } + + public void setSize( int width, int height ) { + base.Size = new System.Drawing.Size( width, height ); + } + + public void setSize( bocoree.java.awt.Dimension d ) { + setSize( d.width, d.height ); + } + + public void setBackground( bocoree.java.awt.Color color ) { + base.BackColor = System.Drawing.Color.FromArgb( color.getRed(), color.getGreen(), color.getBlue() ); + } + + public void setFont( bocoree.java.awt.Font font ) { + base.Font = font.font; + } + + public bool getEnabled() { + return base.Enabled; + } + + public void setEnabled( bool value ) { + base.Enabled = value; + } + #endregion + + public void setAccelerator( bocoree.javax.swing.KeyStroke stroke ) { + } + + public bocoree.javax.swing.KeyStroke getAccelerator() { + return null; + } + + } +} +#endif diff --git a/trunk/bocoree/BMenuItem.cs b/trunk/bocoree/BMenuItem.cs new file mode 100644 index 0000000..ff1f18e --- /dev/null +++ b/trunk/bocoree/BMenuItem.cs @@ -0,0 +1,234 @@ +/* + * BMenuItem.cs + * Copyright (c) 2009 kbinani + * + * This file is part of bocoree. + * + * bocoree is free software; you can redistribute it and/or + * modify it under the terms of the BSD License. + * + * bocoree 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. + */ +#if JAVA +//INCLUDE ..\BuildJavaUI\src\org\kbinani\windows\forms\BMenuItem.java +#else +#define ABSTRACT_BUTTON_ENABLE_IS_SELECTED +#define COMPONENT_PARENT_AS_OWNERITEM +#define COMPONENT_ENABLE_TOOL_TIP_TEXT +using System.Collections.Generic; +using System.Windows.Forms; +using bocoree.javax.swing; + +namespace bocoree.windows.forms { + public class BMenuItem : System.Windows.Forms.ToolStripMenuItem, MenuElement { + // root implementation of javax.swing.AbstractButton + #region javax.swing.AbstractButton + // root implementation of javax.swing.AbstractButton is in BMenuItem.cs + public string getText() { + return base.Text; + } + + public void setText( string value ) { + base.Text = value; + } +#if ABSTRACT_BUTTON_ENABLE_IS_SELECTED + public bool isSelected() { + return base.Checked; + } + + public void setSelected( bool value ) { + base.Checked = value; + } +#endif + public bocoree.java.awt.Icon getIcon() { + bocoree.java.awt.Icon ret = new bocoree.java.awt.Icon(); + ret.image = base.Image; + return ret; + } + + public void setIcon( bocoree.java.awt.Icon value ) { + if ( value == null ) { + base.Image = null; + } else { + base.Image = value.image; + } + } + #endregion + + #region java.awt.Component + public bool isVisible() { + return base.Visible; + } + + public void setVisible( bool value ) { + base.Visible = value; + } + +#if COMPONENT_ENABLE_TOOL_TIP_TEXT + public void setToolTipText( string value ) { + base.ToolTipText = value; + } + + public string getToolTipText() { + return base.ToolTipText; + } +#endif + +#if COMPONENT_PARENT_AS_OWNERITEM + public object getParent() { + return base.OwnerItem; + } +#else + public object getParent(){ + return base.Parent; + } +#endif + + public string getName() { + return base.Name; + } + + public void setName( string value ) { + base.Name = value; + } + +#if COMPONENT_ENABLE_LOCATION + public bocoree.java.awt.Point getLocation() + { + System.Drawing.Point loc = this.Location; + return new bocoree.java.awt.Point( loc.X, loc.Y ); + } + + public void setLocation( int x, int y ) + { + base.Location = new System.Drawing.Point( x, y ); + } + + public void setLocation( bocoree.java.awt.Point p ) + { + base.Location = new System.Drawing.Point( p.x, p.y ); + } +#endif + + public bocoree.java.awt.Rectangle getBounds() { + System.Drawing.Rectangle r = base.Bounds; + return new bocoree.java.awt.Rectangle( r.X, r.Y, r.Width, r.Height ); + } + +#if COMPONENT_ENABLE_X + public int getX() + { + return base.Left; + } +#endif + +#if COMPONENT_ENABLE_Y + public int getY() + { + return base.Top; + } +#endif + + public int getWidth() { + return base.Width; + } + + public int getHeight() { + return base.Height; + } + + public bocoree.java.awt.Dimension getSize() { + return new bocoree.java.awt.Dimension( base.Size.Width, base.Size.Height ); + } + + public void setSize( int width, int height ) { + base.Size = new System.Drawing.Size( width, height ); + } + + public void setSize( bocoree.java.awt.Dimension d ) { + setSize( d.width, d.height ); + } + + public void setBackground( bocoree.java.awt.Color color ) { + base.BackColor = System.Drawing.Color.FromArgb( color.getRed(), color.getGreen(), color.getBlue() ); + } + + public bocoree.java.awt.Color getBackground() { + return new bocoree.java.awt.Color( base.BackColor.R, base.BackColor.G, base.BackColor.B ); + } + + public void setForeground( bocoree.java.awt.Color color ) { + base.ForeColor = color.color; + } + + public bocoree.java.awt.Color getForeground() { + return new bocoree.java.awt.Color( base.ForeColor.R, base.ForeColor.G, base.ForeColor.B ); + } + + public void setFont( bocoree.java.awt.Font font ) { + base.Font = font.font; + } + + public bool getEnabled() { + return base.Enabled; + } + + public void setEnabled( bool value ) { + base.Enabled = value; + } + #endregion + + #region javax.swing.MenuElement + public MenuElement[] getSubElements() { + List list = new List(); + foreach ( ToolStripItem item in base.DropDownItems ) { + if ( item is MenuElement ) { + list.Add( (MenuElement)item ); + } + } + return list.ToArray(); + } + #endregion + + public bool isCheckOnClick() { + return base.CheckOnClick; + } + + public void setCheckOnClick( bool value ) { + base.CheckOnClick = value; + } + + public KeyStroke getAccelerator() { + KeyStroke ret = KeyStroke.getKeyStroke( 0, 0 ); + ret.keys = base.ShortcutKeys; + return ret; + } + + public void setAccelerator( KeyStroke stroke ) { + base.ShortcutKeys = stroke.keys; + } + + public void add( ToolStripItem item ) { + base.DropDownItems.Add( item ); + } + + public void addSeparator() { + base.DropDownItems.Add( new ToolStripSeparator() ); + } + + public void removeAll() { + base.DropDownItems.Clear(); + } + + public void setTag( object value ) { + base.Tag = value; + } + + public object getTag() { + return base.Tag; + } + } +} +#endif diff --git a/trunk/bocoree/BMenuSeparator.cs b/trunk/bocoree/BMenuSeparator.cs new file mode 100644 index 0000000..949e3f9 --- /dev/null +++ b/trunk/bocoree/BMenuSeparator.cs @@ -0,0 +1,237 @@ +/* + * BMenuSeparator.cs + * Copyright (c) 2009 kbinani + * + * This file is part of bocoree. + * + * bocoree is free software; you can redistribute it and/or + * modify it under the terms of the BSD License. + * + * bocoree 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. + */ +#if JAVA +//INCLUDE ..\BuildJavaUI\src\org\kbinani\windows\forms\BMenuSeparator.java +#else +using System; +using System.Windows.Forms; + +namespace bocoree.windows.forms{ + + public class BMenuSeparator : ToolStripSeparator { + #region java.awt.Component + // root implementation of java.awt.Component is in BForm.cs + public void invalidate() { + base.Invalidate(); + } + +#if COMPONENT_ENABLE_REPAINT + public void repaint() { + base.Refresh(); + } +#endif + +#if COMPONENT_ENABLE_CURSOR + public bocoree.java.awt.Cursor getCursor() { + System.Windows.Forms.Cursor c = base.Cursor; + bocoree.java.awt.Cursor ret = null; + if( c.Equals( System.Windows.Forms.Cursors.Arrow ) ){ + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.DEFAULT_CURSOR ); + } else if ( c.Equals( System.Windows.Forms.Cursors.Cross ) ){ + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.CROSSHAIR_CURSOR ); + } else if ( c.Equals( System.Windows.Forms.Cursors.Default ) ){ + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.DEFAULT_CURSOR ); + } else if ( c.Equals( System.Windows.Forms.Cursors.Hand ) ){ + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.HAND_CURSOR ); + } else if ( c.Equals( System.Windows.Forms.Cursors.IBeam ) ) { + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.TEXT_CURSOR ); + } else if ( c.Equals( System.Windows.Forms.Cursors.PanEast ) ) { + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.E_RESIZE_CURSOR ); + } else if ( c.Equals( System.Windows.Forms.Cursors.PanNE ) ) { + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.NE_RESIZE_CURSOR ); + } else if ( c.Equals( System.Windows.Forms.Cursors.PanNorth ) ) { + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.N_RESIZE_CURSOR ); + } else if ( c.Equals( System.Windows.Forms.Cursors.PanNW ) ) { + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.NW_RESIZE_CURSOR ); + } else if ( c.Equals( System.Windows.Forms.Cursors.PanSE ) ) { + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.SE_RESIZE_CURSOR ); + } else if ( c.Equals( System.Windows.Forms.Cursors.PanSouth ) ) { + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.S_RESIZE_CURSOR ); + } else if ( c.Equals( System.Windows.Forms.Cursors.PanSW ) ) { + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.SW_RESIZE_CURSOR ); + } else if ( c.Equals( System.Windows.Forms.Cursors.PanWest ) ) { + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.W_RESIZE_CURSOR ); + } else if ( c.Equals( System.Windows.Forms.Cursors.SizeAll ) ) { + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.MOVE_CURSOR ); + } else { + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.CUSTOM_CURSOR ); + } + ret.cursor = c; + return ret; + } + + public void setCursor( bocoree.java.awt.Cursor value ) { + base.Cursor = value.cursor; + } +#endif + + public bool isVisible() { + return base.Visible; + } + + public void setVisible( bool value ) { + base.Visible = value; + } + +#if COMPONENT_ENABLE_TOOL_TIP_TEXT + public void setToolTipText( string value ) + { + base.ToolTipText = value; + } + + public String getToolTipText() + { + return base.ToolTipText; + } +#endif + +#if COMPONENT_PARENT_AS_OWNERITEM + public Object getParent() { + return base.OwnerItem; + } +#else + public object getParent() { + return base.Parent; + } +#endif + + public string getName() { + return base.Name; + } + + public void setName( string value ) { + base.Name = value; + } + +#if COMPONENT_ENABLE_LOCATION + public void setBounds( int x, int y, int width, int height ) { + base.Bounds = new System.Drawing.Rectangle( x, y, width, height ); + } + + public void setBounds( bocoree.java.awt.Rectangle rc ) { + base.Bounds = new System.Drawing.Rectangle( rc.x, rc.y, rc.width, rc.height ); + } + + public bocoree.java.awt.Point getLocationOnScreen() { + System.Drawing.Point p = base.PointToScreen( base.Location ); + return new bocoree.java.awt.Point( p.X, p.Y ); + } + + public bocoree.java.awt.Point getLocation() { + System.Drawing.Point loc = this.Location; + return new bocoree.java.awt.Point( loc.X, loc.Y ); + } + + public void setLocation( int x, int y ) { + base.Location = new System.Drawing.Point( x, y ); + } + + public void setLocation( bocoree.java.awt.Point p ) { + base.Location = new System.Drawing.Point( p.x, p.y ); + } +#endif + + public bocoree.java.awt.Rectangle getBounds() { + System.Drawing.Rectangle r = base.Bounds; + return new bocoree.java.awt.Rectangle( r.X, r.Y, r.Width, r.Height ); + } + +#if COMPONENT_ENABLE_X + public int getX() { + return base.Left; + } +#endif + +#if COMPONENT_ENABLE_Y + public int getY() { + return base.Top; + } +#endif + + public int getWidth() { + return base.Width; + } + + public int getHeight() { + return base.Height; + } + + public bocoree.java.awt.Dimension getSize() { + return new bocoree.java.awt.Dimension( base.Size.Width, base.Size.Height ); + } + + public void setSize( int width, int height ) { + base.Size = new System.Drawing.Size( width, height ); + } + + public void setSize( bocoree.java.awt.Dimension d ) { + setSize( d.width, d.height ); + } + + public void setBackground( bocoree.java.awt.Color color ) { + base.BackColor = System.Drawing.Color.FromArgb( color.getRed(), color.getGreen(), color.getBlue() ); + } + + public bocoree.java.awt.Color getBackground() { + return new bocoree.java.awt.Color( base.BackColor.R, base.BackColor.G, base.BackColor.B ); + } + + public void setForeground( bocoree.java.awt.Color color ) { + base.ForeColor = color.color; + } + + public bocoree.java.awt.Color getForeground() { + return new bocoree.java.awt.Color( base.ForeColor.R, base.ForeColor.G, base.ForeColor.B ); + } + + public bool isEnabled() { + return base.Enabled; + } + + public void setEnabled( bool value ) { + base.Enabled = value; + } + +#if COMPONENT_ENABLE_FOCUS + public void requestFocus() { + base.Focus(); + } + + public bool isFocusOwner() { + return base.Focused; + } +#endif + + public void setPreferredSize( bocoree.java.awt.Dimension size ) { + base.Size = new System.Drawing.Size( size.width, size.height ); + } + + public bocoree.java.awt.Font getFont() { + return new bocoree.java.awt.Font( base.Font ); + } + + public void setFont( bocoree.java.awt.Font font ) { + if ( font == null ) { + return; + } + if ( font.font == null ) { + return; + } + base.Font = font.font; + } + #endregion + } + +} +#endif diff --git a/trunk/bocoree/BMouseButtons.cs b/trunk/bocoree/BMouseButtons.cs new file mode 100644 index 0000000..c4c50c1 --- /dev/null +++ b/trunk/bocoree/BMouseButtons.cs @@ -0,0 +1,16 @@ +/* + * BMouseButtons.cs + * Copyright (c) 2009 kbinani + * + * This file is part of bocoree. + * + * bocoree is free software; you can redistribute it and/or + * modify it under the terms of the BSD License. + * + * bocoree 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. + */ +#if JAVA +//INCLUDE ..\BuildJavaUI\src\org\kbinani\windows\forms\BMouseButtons.java +#endif diff --git a/trunk/bocoree/BMouseEventArgs.cs b/trunk/bocoree/BMouseEventArgs.cs new file mode 100644 index 0000000..b84de22 --- /dev/null +++ b/trunk/bocoree/BMouseEventArgs.cs @@ -0,0 +1,16 @@ +/* + * BMouseEventArgs.cs + * Copyright (c) 2009 kbinani + * + * This file is part of bocoree. + * + * bocoree is free software; you can redistribute it and/or + * modify it under the terms of the BSD License. + * + * bocoree 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. + */ +#if JAVA +//INCLUDE ..\BuildJavaUI\src\org\kbinani\windows\forms\BMouseEventArgs.java +#endif diff --git a/trunk/bocoree/BMouseEventHandler.cs b/trunk/bocoree/BMouseEventHandler.cs new file mode 100644 index 0000000..8a58361 --- /dev/null +++ b/trunk/bocoree/BMouseEventHandler.cs @@ -0,0 +1,16 @@ +/* + * BMouseEventHandler.cs + * Copyright (c) 2009 kbinani + * + * This file is part of bocoree. + * + * bocoree is free software; you can redistribute it and/or + * modify it under the terms of the BSD License. + * + * bocoree 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. + */ +#if JAVA +//INCLUDE ..\BuildJavaUI\src\org\kbinani\windows\forms\BMouseEventhandler.java +#endif diff --git a/trunk/bocoree/BNumericUpDown.cs b/trunk/bocoree/BNumericUpDown.cs new file mode 100644 index 0000000..d8445f1 --- /dev/null +++ b/trunk/bocoree/BNumericUpDown.cs @@ -0,0 +1,269 @@ +/* + * BNumericUpDown.cs + * Copyright (c) 2009 kbinani + * + * This file is part of bocoree. + * + * bocoree is free software; you can redistribute it and/or + * modify it under the terms of the BSD License. + * + * bocoree 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. + */ +#if JAVA +//INCLUDE ..\BuildJavaUI\src\org\kbinani\windows\forms\BNumericUpDown.java +#else +#define COMPONENT_ENABLE_FOCUS +#define COMPONENT_ENABLE_REPAINT + +namespace bocoree.windows.forms { + + public class BNumericUpDown : System.Windows.Forms.NumericUpDown { + public int getIncrement() { + return (int)base.Increment; + } + + public void setIncrement( int value ) { + base.Increment = value; + } + + public int getValue() { + return (int)base.Value; + } + + public void setValue( int value ) { + base.Value = value; + } + + public int getMaximum() { + return (int)base.Maximum; + } + + public void setMaximum( int value ) { + base.Maximum = value; + } + + public int getMinimum() { + return (int)base.Minimum; + } + + public void setMinimum( int value ) { + base.Minimum = value; + } + + #region java.awt.Component + // root implementation of java.awt.Component is in BForm.cs + public void invalidate() { + base.Invalidate(); + } + +#if COMPONENT_ENABLE_REPAINT + public void repaint() { + base.Refresh(); + } +#endif + +#if COMPONENT_ENABLE_CURSOR + public bocoree.java.awt.Cursor getCursor() { + System.Windows.Forms.Cursor c = base.Cursor; + bocoree.java.awt.Cursor ret = null; + if( c.Equals( System.Windows.Forms.Cursors.Arrow ) ){ + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.DEFAULT_CURSOR ); + } else if ( c.Equals( System.Windows.Forms.Cursors.Cross ) ){ + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.CROSSHAIR_CURSOR ); + } else if ( c.Equals( System.Windows.Forms.Cursors.Default ) ){ + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.DEFAULT_CURSOR ); + } else if ( c.Equals( System.Windows.Forms.Cursors.Hand ) ){ + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.HAND_CURSOR ); + } else if ( c.Equals( System.Windows.Forms.Cursors.IBeam ) ) { + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.TEXT_CURSOR ); + } else if ( c.Equals( System.Windows.Forms.Cursors.PanEast ) ) { + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.E_RESIZE_CURSOR ); + } else if ( c.Equals( System.Windows.Forms.Cursors.PanNE ) ) { + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.NE_RESIZE_CURSOR ); + } else if ( c.Equals( System.Windows.Forms.Cursors.PanNorth ) ) { + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.N_RESIZE_CURSOR ); + } else if ( c.Equals( System.Windows.Forms.Cursors.PanNW ) ) { + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.NW_RESIZE_CURSOR ); + } else if ( c.Equals( System.Windows.Forms.Cursors.PanSE ) ) { + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.SE_RESIZE_CURSOR ); + } else if ( c.Equals( System.Windows.Forms.Cursors.PanSouth ) ) { + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.S_RESIZE_CURSOR ); + } else if ( c.Equals( System.Windows.Forms.Cursors.PanSW ) ) { + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.SW_RESIZE_CURSOR ); + } else if ( c.Equals( System.Windows.Forms.Cursors.PanWest ) ) { + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.W_RESIZE_CURSOR ); + } else if ( c.Equals( System.Windows.Forms.Cursors.SizeAll ) ) { + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.MOVE_CURSOR ); + } else { + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.CUSTOM_CURSOR ); + } + ret.cursor = c; + return ret; + } + + public void setCursor( bocoree.java.awt.Cursor value ) { + base.Cursor = value.cursor; + } +#endif + + public bool isVisible() { + return base.Visible; + } + + public void setVisible( bool value ) { + base.Visible = value; + } + +#if COMPONENT_ENABLE_TOOL_TIP_TEXT + public void setToolTipText( string value ) + { + base.ToolTipText = value; + } + + public String getToolTipText() + { + return base.ToolTipText; + } +#endif + +#if COMPONENT_PARENT_AS_OWNERITEM + public Object getParent() { + return base.OwnerItem; + } +#else + public object getParent() { + return base.Parent; + } +#endif + + public string getName() { + return base.Name; + } + + public void setName( string value ) { + base.Name = value; + } + +#if COMPONENT_ENABLE_LOCATION + public void setBounds( int x, int y, int width, int height ) { + base.Bounds = new System.Drawing.Rectangle( x, y, width, height ); + } + + public void setBounds( bocoree.java.awt.Rectangle rc ) { + base.Bounds = new System.Drawing.Rectangle( rc.x, rc.y, rc.width, rc.height ); + } + + public bocoree.java.awt.Point getLocationOnScreen() { + System.Drawing.Point p = base.PointToScreen( base.Location ); + return new bocoree.java.awt.Point( p.X, p.Y ); + } + + public bocoree.java.awt.Point getLocation() { + System.Drawing.Point loc = this.Location; + return new bocoree.java.awt.Point( loc.X, loc.Y ); + } + + public void setLocation( int x, int y ) { + base.Location = new System.Drawing.Point( x, y ); + } + + public void setLocation( bocoree.java.awt.Point p ) { + base.Location = new System.Drawing.Point( p.x, p.y ); + } +#endif + + public bocoree.java.awt.Rectangle getBounds() { + System.Drawing.Rectangle r = base.Bounds; + return new bocoree.java.awt.Rectangle( r.X, r.Y, r.Width, r.Height ); + } + +#if COMPONENT_ENABLE_X + public int getX() { + return base.Left; + } +#endif + +#if COMPONENT_ENABLE_Y + public int getY() { + return base.Top; + } +#endif + + public int getWidth() { + return base.Width; + } + + public int getHeight() { + return base.Height; + } + + public bocoree.java.awt.Dimension getSize() { + return new bocoree.java.awt.Dimension( base.Size.Width, base.Size.Height ); + } + + public void setSize( int width, int height ) { + base.Size = new System.Drawing.Size( width, height ); + } + + public void setSize( bocoree.java.awt.Dimension d ) { + setSize( d.width, d.height ); + } + + public void setBackground( bocoree.java.awt.Color color ) { + base.BackColor = System.Drawing.Color.FromArgb( color.getRed(), color.getGreen(), color.getBlue() ); + } + + public bocoree.java.awt.Color getBackground() { + return new bocoree.java.awt.Color( base.BackColor.R, base.BackColor.G, base.BackColor.B ); + } + + public void setForeground( bocoree.java.awt.Color color ) { + base.ForeColor = color.color; + } + + public bocoree.java.awt.Color getForeground() { + return new bocoree.java.awt.Color( base.ForeColor.R, base.ForeColor.G, base.ForeColor.B ); + } + + public bool isEnabled() { + return base.Enabled; + } + + public void setEnabled( bool value ) { + base.Enabled = value; + } + +#if COMPONENT_ENABLE_FOCUS + public void requestFocus() { + base.Focus(); + } + + public bool isFocusOwner() { + return base.Focused; + } +#endif + + public void setPreferredSize( bocoree.java.awt.Dimension size ) { + base.Size = new System.Drawing.Size( size.width, size.height ); + } + + public bocoree.java.awt.Font getFont() { + return new bocoree.java.awt.Font( base.Font ); + } + + public void setFont( bocoree.java.awt.Font font ) { + if ( font == null ) { + return; + } + if ( font.font == null ) { + return; + } + base.Font = font.font; + } + #endregion + } + +} +#endif diff --git a/trunk/bocoree/BPaintEventArgs.cs b/trunk/bocoree/BPaintEventArgs.cs new file mode 100644 index 0000000..0cdaa6f --- /dev/null +++ b/trunk/bocoree/BPaintEventArgs.cs @@ -0,0 +1,16 @@ +/* + * BPaintEventArgs.cs + * Copyright (c) 2009 kbinani + * + * This file is part of bocoree. + * + * bocoree is free software; you can redistribute it and/or + * modify it under the terms of the BSD License. + * + * bocoree 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. + */ +#if JAVA +//INCLUDE ..\BuildJavaUI\src\org\kbinani\windows\forms\BPaintEventArgs.java +#endif diff --git a/trunk/bocoree/BPanel.cs b/trunk/bocoree/BPanel.cs new file mode 100644 index 0000000..f687325 --- /dev/null +++ b/trunk/bocoree/BPanel.cs @@ -0,0 +1,232 @@ +/* + * BPanel.cs + * Copyright (c) 2009 kbinani + * + * This file is part of bocoree. + * + * bocoree is free software; you can redistribute it and/or + * modify it under the terms of the BSD License. + * + * bocoree 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. + */ +#if JAVA +//INCLUDE ..\BuildJavaUI\src\org\kbinani\windows\forms\BPanel.java +#else +namespace bocoree.windows.forms { + public class BPanel : System.Windows.Forms.UserControl { + #region java.awt.Component + // root implementation of java.awt.Component is in BForm.cs + public void invalidate() { + base.Invalidate(); + } + +#if COMPONENT_ENABLE_REPAINT + public void repaint() { + base.Refresh(); + } +#endif + +#if COMPONENT_ENABLE_CURSOR + public bocoree.java.awt.Cursor getCursor() { + System.Windows.Forms.Cursor c = base.Cursor; + bocoree.java.awt.Cursor ret = null; + if( c.Equals( System.Windows.Forms.Cursors.Arrow ) ){ + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.DEFAULT_CURSOR ); + } else if ( c.Equals( System.Windows.Forms.Cursors.Cross ) ){ + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.CROSSHAIR_CURSOR ); + } else if ( c.Equals( System.Windows.Forms.Cursors.Default ) ){ + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.DEFAULT_CURSOR ); + } else if ( c.Equals( System.Windows.Forms.Cursors.Hand ) ){ + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.HAND_CURSOR ); + } else if ( c.Equals( System.Windows.Forms.Cursors.IBeam ) ) { + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.TEXT_CURSOR ); + } else if ( c.Equals( System.Windows.Forms.Cursors.PanEast ) ) { + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.E_RESIZE_CURSOR ); + } else if ( c.Equals( System.Windows.Forms.Cursors.PanNE ) ) { + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.NE_RESIZE_CURSOR ); + } else if ( c.Equals( System.Windows.Forms.Cursors.PanNorth ) ) { + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.N_RESIZE_CURSOR ); + } else if ( c.Equals( System.Windows.Forms.Cursors.PanNW ) ) { + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.NW_RESIZE_CURSOR ); + } else if ( c.Equals( System.Windows.Forms.Cursors.PanSE ) ) { + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.SE_RESIZE_CURSOR ); + } else if ( c.Equals( System.Windows.Forms.Cursors.PanSouth ) ) { + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.S_RESIZE_CURSOR ); + } else if ( c.Equals( System.Windows.Forms.Cursors.PanSW ) ) { + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.SW_RESIZE_CURSOR ); + } else if ( c.Equals( System.Windows.Forms.Cursors.PanWest ) ) { + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.W_RESIZE_CURSOR ); + } else if ( c.Equals( System.Windows.Forms.Cursors.SizeAll ) ) { + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.MOVE_CURSOR ); + } else { + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.CUSTOM_CURSOR ); + } + ret.cursor = c; + return ret; + } + + public void setCursor( bocoree.java.awt.Cursor value ) { + base.Cursor = value.cursor; + } +#endif + + public bool isVisible() { + return base.Visible; + } + + public void setVisible( bool value ) { + base.Visible = value; + } + +#if COMPONENT_ENABLE_TOOL_TIP_TEXT + public void setToolTipText( string value ) + { + base.ToolTipText = value; + } + + public String getToolTipText() + { + return base.ToolTipText; + } +#endif + +#if COMPONENT_PARENT_AS_OWNERITEM + public Object getParent() { + return base.OwnerItem; + } +#else + public object getParent() { + return base.Parent; + } +#endif + + public string getName() { + return base.Name; + } + + public void setName( string value ) { + base.Name = value; + } + +#if COMPONENT_ENABLE_LOCATION + public void setBounds( int x, int y, int width, int height ) { + base.Bounds = new System.Drawing.Rectangle( x, y, width, height ); + } + + public void setBounds( bocoree.java.awt.Rectangle rc ) { + base.Bounds = new System.Drawing.Rectangle( rc.x, rc.y, rc.width, rc.height ); + } + + public bocoree.java.awt.Point getLocationOnScreen() { + System.Drawing.Point p = base.PointToScreen( base.Location ); + return new bocoree.java.awt.Point( p.X, p.Y ); + } + + public bocoree.java.awt.Point getLocation() { + System.Drawing.Point loc = this.Location; + return new bocoree.java.awt.Point( loc.X, loc.Y ); + } + + public void setLocation( int x, int y ) { + base.Location = new System.Drawing.Point( x, y ); + } + + public void setLocation( bocoree.java.awt.Point p ) { + base.Location = new System.Drawing.Point( p.x, p.y ); + } +#endif + + public bocoree.java.awt.Rectangle getBounds() { + System.Drawing.Rectangle r = base.Bounds; + return new bocoree.java.awt.Rectangle( r.X, r.Y, r.Width, r.Height ); + } + +#if COMPONENT_ENABLE_X + public int getX() { + return base.Left; + } +#endif + +#if COMPONENT_ENABLE_Y + public int getY() { + return base.Top; + } +#endif + + public int getWidth() { + return base.Width; + } + + public int getHeight() { + return base.Height; + } + + public bocoree.java.awt.Dimension getSize() { + return new bocoree.java.awt.Dimension( base.Size.Width, base.Size.Height ); + } + + public void setSize( int width, int height ) { + base.Size = new System.Drawing.Size( width, height ); + } + + public void setSize( bocoree.java.awt.Dimension d ) { + setSize( d.width, d.height ); + } + + public void setBackground( bocoree.java.awt.Color color ) { + base.BackColor = System.Drawing.Color.FromArgb( color.getRed(), color.getGreen(), color.getBlue() ); + } + + public bocoree.java.awt.Color getBackground() { + return new bocoree.java.awt.Color( base.BackColor.R, base.BackColor.G, base.BackColor.B ); + } + + public void setForeground( bocoree.java.awt.Color color ) { + base.ForeColor = color.color; + } + + public bocoree.java.awt.Color getForeground() { + return new bocoree.java.awt.Color( base.ForeColor.R, base.ForeColor.G, base.ForeColor.B ); + } + + public bool isEnabled() { + return base.Enabled; + } + + public void setEnabled( bool value ) { + base.Enabled = value; + } + +#if COMPONENT_ENABLE_FOCUS + public void requestFocus() { + base.Focus(); + } + + public bool isFocusOwner() { + return base.Focused; + } +#endif + + public void setPreferredSize( bocoree.java.awt.Dimension size ) { + base.Size = new System.Drawing.Size( size.width, size.height ); + } + + public bocoree.java.awt.Font getFont() { + return new bocoree.java.awt.Font( base.Font ); + } + + public void setFont( bocoree.java.awt.Font font ) { + if ( font == null ) { + return; + } + if ( font.font == null ) { + return; + } + base.Font = font.font; + } + #endregion + } +} +#endif diff --git a/trunk/bocoree/BPictureBox.cs b/trunk/bocoree/BPictureBox.cs new file mode 100644 index 0000000..30c7b49 --- /dev/null +++ b/trunk/bocoree/BPictureBox.cs @@ -0,0 +1,273 @@ +/* + * BPictureBox.cs + * Copyright (c) 2009 kbinani + * + * This file is part of Boare.Cadencii. + * + * Boare.Cadencii is free software; you can redistribute it and/or + * modify it under the terms of the GPLv3 License. + * + * Boare.Cadencii 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. + */ +#if JAVA +//INCLUDE ..\BuildJavaUI\src\org\kbinani\windows\forms\BPictureBox.java +#else +using System.Windows.Forms; + +namespace bocoree.windows.forms { + + /// + /// KeyDownとKeyUpを受信できるPictureBox + /// + public class BPictureBox : PictureBox { + public event KeyEventHandler BKeyDown; + public event KeyEventHandler BKeyUp; + + protected override void OnKeyDown( KeyEventArgs e ) { + if ( BKeyDown != null ) { + BKeyDown( this, e ); + } + } + + protected override void OnKeyUp( KeyEventArgs e ) { + if ( BKeyUp != null ) { + BKeyUp( this, e ); + } + } + + protected override void OnMouseDown( MouseEventArgs e ) { + base.OnMouseDown( e ); + this.Focus(); + } + + public void setImage( bocoree.java.awt.Image value ) { + if ( value != null ) { + if ( value.image != null ) { + base.Image = value.image; + } + } else { + base.Image = null; + } + } + + public bocoree.java.awt.Image getImage() { + if ( base.Image == null ) { + return null; + } else { + bocoree.java.awt.Image ret = new bocoree.java.awt.Image(); + ret.image = base.Image; + return ret; + } + } + + #region java.awt.Component + // root implementation of java.awt.Component is in BForm.cs + public void invalidate() { + base.Invalidate(); + } + + public void repaint() { + base.Refresh(); + } + + public void setBounds( int x, int y, int width, int height ) { + base.Bounds = new System.Drawing.Rectangle( x, y, width, height ); + } + + public void setBounds( bocoree.java.awt.Rectangle rc ) { + base.Bounds = new System.Drawing.Rectangle( rc.x, rc.y, rc.width, rc.height ); + } + + public bocoree.java.awt.Cursor getCursor() { + System.Windows.Forms.Cursor c = base.Cursor; + bocoree.java.awt.Cursor ret = null; + if ( c.Equals( System.Windows.Forms.Cursors.Arrow ) ) { + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.DEFAULT_CURSOR ); + } else if ( c.Equals( System.Windows.Forms.Cursors.Cross ) ) { + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.CROSSHAIR_CURSOR ); + } else if ( c.Equals( System.Windows.Forms.Cursors.Default ) ) { + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.DEFAULT_CURSOR ); + } else if ( c.Equals( System.Windows.Forms.Cursors.Hand ) ) { + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.HAND_CURSOR ); + } else if ( c.Equals( System.Windows.Forms.Cursors.IBeam ) ) { + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.TEXT_CURSOR ); + } else if ( c.Equals( System.Windows.Forms.Cursors.PanEast ) ) { + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.E_RESIZE_CURSOR ); + } else if ( c.Equals( System.Windows.Forms.Cursors.PanNE ) ) { + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.NE_RESIZE_CURSOR ); + } else if ( c.Equals( System.Windows.Forms.Cursors.PanNorth ) ) { + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.N_RESIZE_CURSOR ); + } else if ( c.Equals( System.Windows.Forms.Cursors.PanNW ) ) { + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.NW_RESIZE_CURSOR ); + } else if ( c.Equals( System.Windows.Forms.Cursors.PanSE ) ) { + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.SE_RESIZE_CURSOR ); + } else if ( c.Equals( System.Windows.Forms.Cursors.PanSouth ) ) { + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.S_RESIZE_CURSOR ); + } else if ( c.Equals( System.Windows.Forms.Cursors.PanSW ) ) { + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.SW_RESIZE_CURSOR ); + } else if ( c.Equals( System.Windows.Forms.Cursors.PanWest ) ) { + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.W_RESIZE_CURSOR ); + } else if ( c.Equals( System.Windows.Forms.Cursors.SizeAll ) ) { + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.MOVE_CURSOR ); + } else { + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.CUSTOM_CURSOR ); + } + ret.cursor = c; + return ret; + } + + public void setCursor( bocoree.java.awt.Cursor value ) { + base.Cursor = value.cursor; + } + + public bool isVisible() { + return base.Visible; + } + + public void setVisible( bool value ) { + base.Visible = value; + } + +#if COMPONENT_ENABLE_TOOL_TIP_TEXT + public void setToolTipText( string value ) + { + base.ToolTipText = value; + } + + public String getToolTipText() + { + return base.ToolTipText; + } +#endif + +#if COMPONENT_PARENT_AS_OWNERITEM + public Object getParent() { + return base.OwnerItem; + } +#else + public object getParent() { + return base.Parent; + } +#endif + + public string getName() { + return base.Name; + } + + public void setName( string value ) { + base.Name = value; + } + +#if COMPONENT_ENABLE_LOCATION + public bocoree.java.awt.Point getLocationOnScreen() { + System.Drawing.Point p = base.PointToScreen( base.Location ); + return new bocoree.java.awt.Point( p.X, p.Y ); + } + + public bocoree.java.awt.Point getLocation() { + System.Drawing.Point loc = this.Location; + return new bocoree.java.awt.Point( loc.X, loc.Y ); + } + + public void setLocation( int x, int y ) { + base.Location = new System.Drawing.Point( x, y ); + } + + public void setLocation( bocoree.java.awt.Point p ) { + base.Location = new System.Drawing.Point( p.x, p.y ); + } +#endif + + public bocoree.java.awt.Rectangle getBounds() { + System.Drawing.Rectangle r = base.Bounds; + return new bocoree.java.awt.Rectangle( r.X, r.Y, r.Width, r.Height ); + } + +#if COMPONENT_ENABLE_X + public int getX() { + return base.Left; + } +#endif + +#if COMPONENT_ENABLE_Y + public int getY() { + return base.Top; + } +#endif + + public int getWidth() { + return base.Width; + } + + public int getHeight() { + return base.Height; + } + + public bocoree.java.awt.Dimension getSize() { + return new bocoree.java.awt.Dimension( base.Size.Width, base.Size.Height ); + } + + public void setSize( int width, int height ) { + base.Size = new System.Drawing.Size( width, height ); + } + + public void setSize( bocoree.java.awt.Dimension d ) { + setSize( d.width, d.height ); + } + + public void setBackground( bocoree.java.awt.Color color ) { + base.BackColor = System.Drawing.Color.FromArgb( color.getRed(), color.getGreen(), color.getBlue() ); + } + + public bocoree.java.awt.Color getBackground() { + return new bocoree.java.awt.Color( base.BackColor.R, base.BackColor.G, base.BackColor.B ); + } + + public void setForeground( bocoree.java.awt.Color color ) { + base.ForeColor = color.color; + } + + public bocoree.java.awt.Color getForeground() { + return new bocoree.java.awt.Color( base.ForeColor.R, base.ForeColor.G, base.ForeColor.B ); + } + + public bool isEnabled() { + return base.Enabled; + } + + public void setEnabled( bool value ) { + base.Enabled = value; + } + + public void requestFocus() { + base.Focus(); + } + + public bool isFocusOwner() { + return base.Focused; + } + + public void setPreferredSize( bocoree.java.awt.Dimension size ) { + base.Size = new System.Drawing.Size( size.width, size.height ); + } + + public bocoree.java.awt.Font getFont() { + return new bocoree.java.awt.Font( base.Font ); + } + + public void setFont( bocoree.java.awt.Font font ) { + if ( font == null ) { + return; + } + if ( font.font == null ) { + return; + } + base.Font = font.font; + } + #endregion + } + +} +#endif diff --git a/trunk/bocoree/BPopupMenu.cs b/trunk/bocoree/BPopupMenu.cs new file mode 100644 index 0000000..253cfa0 --- /dev/null +++ b/trunk/bocoree/BPopupMenu.cs @@ -0,0 +1,163 @@ +/* + * BPopupMenu.cs + * Copyright (c) 2009 kbinani + * + * This file is part of bocoree. + * + * bocoree is free software; you can redistribute it and/or + * modify it under the terms of the BSD License. + * + * bocoree 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. + */ +#if JAVA +//INCLUDE ..\BuildJavaUI\src\org\kbinani\windows\forms\BPopupMenu.java +#else +using System; +using System.Collections.Generic; +using System.Windows.Forms; +using bocoree.javax.swing; + +namespace bocoree.windows.forms { + + public class BPopupMenu : System.Windows.Forms.ContextMenuStrip, MenuElement { + public BPopupMenu( System.ComponentModel.IContainer container ) + : base( container ) { + } + + public string getText() { + return base.Text; + } + + public KeyStroke getAccelerator() { + return KeyStroke.getKeyStroke( 0, 0 ); + } + + public void setAccelerator( KeyStroke stroke ) { + } + + public void show( Control c, int x, int y ) { + base.Show( c, x, y ); + } + + #region javax.swing.MenuElement + public MenuElement[] getSubElements() { + List list = new List(); + foreach ( ToolStripItem item in base.Items ) { + if ( item is MenuElement ) { + list.Add( (MenuElement)item ); + } + } + return list.ToArray(); + } + #endregion + + #region java.awt.Component +#if COMPONENT_PARENT_AS_OWNERITEM + public object getParent() { + return base.OwnerItem; + } +#else + public object getParent() { + return base.Parent; + } +#endif + + public string getName() { + return base.Name; + } + + public void setName( string value ) { + base.Name = value; + } + +#if COMPONENT_ENABLE_LOCATION + public bocoree.java.awt.Point getLocation() + { + System.Drawing.Point loc = this.Location; + return new bocoree.java.awt.Point( loc.X, loc.Y ); + } + + public void setLocation( int x, int y ) + { + base.Location = new System.Drawing.Point( x, y ); + } + + public void setLocation( bocoree.java.awt.Point p ) + { + base.Location = new System.Drawing.Point( p.x, p.y ); + } +#endif + + public bocoree.java.awt.Rectangle getBounds() { + System.Drawing.Rectangle r = base.Bounds; + return new bocoree.java.awt.Rectangle( r.X, r.Y, r.Width, r.Height ); + } + +#if COMPONENT_ENABLE_X + public int getX() + { + return base.Left; + } +#endif + +#if COMPONENT_ENABLE_Y + public int getY() + { + return base.Top; + } +#endif + + public int getWidth() { + return base.Width; + } + + public int getHeight() { + return base.Height; + } + + public bocoree.java.awt.Dimension getSize() { + return new bocoree.java.awt.Dimension( base.Size.Width, base.Size.Height ); + } + + public void setSize( int width, int height ) { + base.Size = new System.Drawing.Size( width, height ); + } + + public void setSize( bocoree.java.awt.Dimension d ) { + setSize( d.width, d.height ); + } + + public void setBackground( bocoree.java.awt.Color color ) { + base.BackColor = System.Drawing.Color.FromArgb( color.getRed(), color.getGreen(), color.getBlue() ); + } + + public bocoree.java.awt.Color getBackground() { + return new bocoree.java.awt.Color( base.BackColor.R, base.BackColor.G, base.BackColor.B ); + } + + public void setForeground( bocoree.java.awt.Color color ) { + base.ForeColor = color.color; + } + + public bocoree.java.awt.Color getForeground() { + return new bocoree.java.awt.Color( base.ForeColor.R, base.ForeColor.G, base.ForeColor.B ); + } + + public void setFont( bocoree.java.awt.Font font ) { + base.Font = font.font; + } + + public bool getEnabled() { + return base.Enabled; + } + + public void setEnabled( bool value ) { + base.Enabled = value; + } + #endregion + } + +} +#endif diff --git a/trunk/bocoree/BPreviewKeyDownEventArgs.cs b/trunk/bocoree/BPreviewKeyDownEventArgs.cs new file mode 100644 index 0000000..b2cc464 --- /dev/null +++ b/trunk/bocoree/BPreviewKeyDownEventArgs.cs @@ -0,0 +1,16 @@ +/* + * BPreviewKeyDownEventArgs.cs + * Copyright (c) 2009 kbinani + * + * This file is part of bocoree. + * + * bocoree is free software; you can redistribute it and/or + * modify it under the terms of the BSD License. + * + * bocoree 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. + */ +#if JAVA +//INCLUDE ..\BuildJavaUI\src\org\kbinani\windows\forms\BPreviewKeyDownEventArgs.java +#endif diff --git a/trunk/bocoree/BProgressBar.cs b/trunk/bocoree/BProgressBar.cs new file mode 100644 index 0000000..ef2f2bc --- /dev/null +++ b/trunk/bocoree/BProgressBar.cs @@ -0,0 +1,46 @@ +/* + * BProgressBar.cs + * Copyright (c) 2009 kbinani + * + * This file is part of bocoree. + * + * bocoree is free software; you can redistribute it and/or + * modify it under the terms of the BSD License. + * + * bocoree 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. + */ +#if JAVA +//INCLUDE ..\BuildJavaUI\src\org\kbinani\windows\forms\BProgressBar.java +#else +namespace bocoree.windows.forms { + + public class BProgressBar : System.Windows.Forms.ProgressBar { + public int getMaximum() { + return base.Maximum; + } + + public void setMaximum( int value ) { + base.Maximum = value; + } + + public int getMinimum() { + return base.Minimum; + } + + public void setMinimum( int value ) { + base.Minimum = value; + } + + public int getValue() { + return base.Value; + } + + public void setValue( int value ) { + base.Value = value; + } + } + +} +#endif diff --git a/trunk/bocoree/BProgressChangedEventArgs.cs b/trunk/bocoree/BProgressChangedEventArgs.cs new file mode 100644 index 0000000..06c8d58 --- /dev/null +++ b/trunk/bocoree/BProgressChangedEventArgs.cs @@ -0,0 +1,16 @@ +/* + * BProgressChangedEventArgs.cs + * Copyright (c) 2009 kbinani + * + * This file is part of bocoree. + * + * bocoree is free software; you can redistribute it and/or + * modify it under the terms of the BSD License. + * + * bocoree 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. + */ +#if JAVA +//INCLUDE ..\BuildJavaUI\src\org\kbinani\componentModel\BProgressChangedEventArgs.java +#endif diff --git a/trunk/bocoree/BProgressChangedEventHandler.cs b/trunk/bocoree/BProgressChangedEventHandler.cs new file mode 100644 index 0000000..b3fa61e --- /dev/null +++ b/trunk/bocoree/BProgressChangedEventHandler.cs @@ -0,0 +1,16 @@ +/* + * BProgressChangedEventHandler.cs + * Copyright (c) 2009 kbinani + * + * This file is part of bocoree. + * + * bocoree is free software; you can redistribute it and/or + * modify it under the terms of the BSD License. + * + * bocoree 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. + */ +#if JAVA +//INCLUDE ..\BuildJavaUI\src\org\kbinani\componentModel\BProgressChangedEventHandler.java +#endif diff --git a/trunk/bocoree/BRunWorkerCompletedEventArgs.cs b/trunk/bocoree/BRunWorkerCompletedEventArgs.cs new file mode 100644 index 0000000..5d4812c --- /dev/null +++ b/trunk/bocoree/BRunWorkerCompletedEventArgs.cs @@ -0,0 +1,16 @@ +/* + * BRunWorkerCompletedEventArgs.cs + * Copyright (c) 2009 kbinani + * + * This file is part of bocoree. + * + * bocoree is free software; you can redistribute it and/or + * modify it under the terms of the BSD License. + * + * bocoree 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. + */ +#if JAVA +//INCLUDE ..\BuildJavaUI\src\org\kbinani\componentModel\BRunWorkerCompletedEventArgs.java +#endif diff --git a/trunk/bocoree/BRunWorkerCompletedEventHandler.cs b/trunk/bocoree/BRunWorkerCompletedEventHandler.cs new file mode 100644 index 0000000..26b13bd --- /dev/null +++ b/trunk/bocoree/BRunWorkerCompletedEventHandler.cs @@ -0,0 +1,16 @@ +/* + * BRunWorkerCompletedEventhandler.cs + * Copyright (c) 2009 kbinani + * + * This file is part of bocoree. + * + * bocoree is free software; you can redistribute it and/or + * modify it under the terms of the BSD License. + * + * bocoree 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. + */ +#if JAVA +//INCLUDE ..\BuildJavaUI\src\org\kbinani\componentModel\BRunWorkerCompletedEventHandler.java +#endif diff --git a/trunk/bocoree/BSlider.cs b/trunk/bocoree/BSlider.cs new file mode 100644 index 0000000..9b341d1 --- /dev/null +++ b/trunk/bocoree/BSlider.cs @@ -0,0 +1,158 @@ +#if JAVA +//INCLUDE ..\BuildJavaUI\src\org\kbinani\windows\forms\BSlider.java +#else +namespace bocoree.windows.forms { + + public class BSlider : System.Windows.Forms.TrackBar { + public int getValue() { + return base.Value; + } + + public void setValue( int value ) { + base.Value = value; + } + + public int getMinimum() { + return base.Minimum; + } + + public void setMinimum( int value ) { + base.Minimum = value; + } + + public int getMaximum() { + return base.Maximum; + } + + public void setMaximum( int value ) { + base.Maximum = value; + } + + #region java.awt.Component + // root implementation of java.awt.Component is in BForm.cs + public bool isVisible() { + return base.Visible; + } + + public void setVisible( bool value ) { + base.Visible = value; + } + +#if COMPONENT_ENABLE_TOOL_TIP_TEXT + public void setToolTipText( string value ) + { + base.ToolTipText = value; + } + + public String getToolTipText() + { + return base.ToolTipText; + } +#endif + +#if COMPONENT_PARENT_AS_OWNERITEM + public Object getParent() { + return base.OwnerItem; + } +#else + public object getParent() { + return base.Parent; + } +#endif + + public string getName() { + return base.Name; + } + + public void setName( string value ) { + base.Name = value; + } + +#if COMPONENT_ENABLE_LOCATION + public bocoree.java.awt.Point getLocation() { + System.Drawing.Point loc = this.Location; + return new bocoree.java.awt.Point( loc.X, loc.Y ); + } + + public void setLocation( int x, int y ) { + base.Location = new System.Drawing.Point( x, y ); + } + + public void setLocation( bocoree.java.awt.Point p ) { + base.Location = new System.Drawing.Point( p.x, p.y ); + } +#endif + + public bocoree.java.awt.Rectangle getBounds() { + System.Drawing.Rectangle r = base.Bounds; + return new bocoree.java.awt.Rectangle( r.X, r.Y, r.Width, r.Height ); + } + +#if COMPONENT_ENABLE_X + public int getX() { + return base.Left; + } +#endif + +#if COMPONENT_ENABLE_Y + public int getY() { + return base.Top; + } +#endif + + public int getWidth() { + return base.Width; + } + + public int getHeight() { + return base.Height; + } + + public bocoree.java.awt.Dimension getSize() { + return new bocoree.java.awt.Dimension( base.Size.Width, base.Size.Height ); + } + + public void setSize( int width, int height ) { + base.Size = new System.Drawing.Size( width, height ); + } + + public void setSize( bocoree.java.awt.Dimension d ) { + setSize( d.width, d.height ); + } + + public void setBackground( bocoree.java.awt.Color color ) { + base.BackColor = System.Drawing.Color.FromArgb( color.getRed(), color.getGreen(), color.getBlue() ); + } + + public bocoree.java.awt.Color getBackground() { + return new bocoree.java.awt.Color( base.BackColor.R, base.BackColor.G, base.BackColor.B ); + } + + public void setForeground( bocoree.java.awt.Color color ) { + base.ForeColor = color.color; + } + + public bocoree.java.awt.Color getForeground() { + return new bocoree.java.awt.Color( base.ForeColor.R, base.ForeColor.G, base.ForeColor.B ); + } + + public void setFont( bocoree.java.awt.Font font ) { + base.Font = font.font; + } + + public bool isEnabled() { + return base.Enabled; + } + + public void setEnabled( bool value ) { + base.Enabled = value; + } + + public void requestFocus() { + base.Focus(); + } + #endregion + } + +} +#endif diff --git a/trunk/bocoree/BSplitPane.cs b/trunk/bocoree/BSplitPane.cs new file mode 100644 index 0000000..7a7afee --- /dev/null +++ b/trunk/bocoree/BSplitPane.cs @@ -0,0 +1,46 @@ +/* + * BSplitPane.cs + * Copyright (c) 2009 kbinani + * + * This file is part of bocoree. + * + * bocoree is free software; you can redistribute it and/or + * modify it under the terms of the BSD License. + * + * bocoree 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. + */ +#if JAVA +//INCLUDE ..\BuildJavaUI\src\org\kbinani\windows\forms\BSplitPane.java +#else +namespace bocoree.windows.forms { + + public class BSplitPane : System.Windows.Forms.SplitContainer { + public int getDividerLocation() { + return base.SplitterDistance; + } + + public int getDividerSize() { + return base.SplitterWidth; + } + + public void setDividerLocation( int value ) { + base.SplitterDistance = value; + } + + public void setDividerSize( int value ) { + base.SplitterWidth = value; + } + + public bool isSplitterFixed() { + return base.IsSplitterFixed; + } + + public void setSplitterFixed( bool value ) { + base.IsSplitterFixed = value; + } + } + +} +#endif diff --git a/trunk/bocoree/BStatusLabel.cs b/trunk/bocoree/BStatusLabel.cs new file mode 100644 index 0000000..2254b27 --- /dev/null +++ b/trunk/bocoree/BStatusLabel.cs @@ -0,0 +1,50 @@ +/* + * BStatusLabel.cs + * Copyright (c) 2009 kbinani + * + * This file is part of bocoree. + * + * bocoree is free software; you can redistribute it and/or + * modify it under the terms of the BSD License. + * + * bocoree 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. + */ +#if JAVA +//INCLUDE ..\BuildJavaUI\src\org\kbinani\windows\forms\BStatusLabel.java +#else +namespace bocoree.windows.forms { + + public class BStatusLabel : System.Windows.Forms.ToolStripStatusLabel { + public void setText( string value ) { + base.Text = value; + } + + public string getText() { + return base.Text; + } + + public void setToolTipText( string value ) { + base.ToolTipText = value; + } + + public string getToolTipText() { + return base.ToolTipText; + } + + public bocoree.java.awt.Icon getIcon() { + return new bocoree.java.awt.ImageIcon( base.Image ); + } + + public void setIcon( bocoree.java.awt.Icon value ) { + if ( value == null ) { + base.Image = null; + } else { + base.Image = value.image; + } + } + } + +} +#endif diff --git a/trunk/bocoree/BTextArea.cs b/trunk/bocoree/BTextArea.cs new file mode 100644 index 0000000..28c0faa --- /dev/null +++ b/trunk/bocoree/BTextArea.cs @@ -0,0 +1,30 @@ +/* + * BTextArea.cs + * Copyright (c) 2009 kbinani + * + * This file is part of bocoree. + * + * bocoree is free software; you can redistribute it and/or + * modify it under the terms of the BSD License. + * + * bocoree 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. + */ +#if JAVA +//INCLUDE ..\BuildJavaUI\src\org\kbinani\windows\forms\BTextArea.java +#else +namespace bocoree.windows.forms { + + public class BTextArea : System.Windows.Forms.TextBox { + public BTextArea() { + base.Multiline = true; + base.AcceptsReturn = true; + base.AcceptsTab = true; + base.WordWrap = false; + base.ScrollBars = System.Windows.Forms.ScrollBars.Both; + } + } + +} +#endif diff --git a/trunk/bocoree/BTextBox.cs b/trunk/bocoree/BTextBox.cs new file mode 100644 index 0000000..6e9fa51 --- /dev/null +++ b/trunk/bocoree/BTextBox.cs @@ -0,0 +1,185 @@ +/* + * BTextBox.cs + * Copyright (c) 2009 kbinani + * + * This file is part of bocoree. + * + * bocoree is free software; you can redistribute it and/or + * modify it under the terms of the BSD License. + * + * bocoree 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. + */ +#if JAVA +//INCLUDE ..\BuildJavaUI\src\org\kbinani\windows\forms\BTextBox.java +#else +#define COMPONENT_ENABLE_LOCATION +namespace bocoree.windows.forms{ + + public class BTextBox : System.Windows.Forms.TextBox { + #region java.awt.Component + // root implementation of java.awt.Component is in BForm.cs + public bool isVisible() { + return base.Visible; + } + + public void setVisible( bool value ) { + base.Visible = value; + } + +#if COMPONENT_ENABLE_TOOL_TIP_TEXT + public void setToolTipText( string value ) + { + base.ToolTipText = value; + } + + public string getToolTipText() + { + return base.ToolTipText; + } +#endif + +#if COMPONENT_PARENT_AS_OWNERITEM + public object getParent() { + return base.OwnerItem; + } +#else + public object getParent() { + return base.Parent; + } +#endif + + public string getName() { + return base.Name; + } + + public void setName( string value ) { + base.Name = value; + } + +#if COMPONENT_ENABLE_LOCATION + public bocoree.java.awt.Point getLocation() { + System.Drawing.Point loc = this.Location; + return new bocoree.java.awt.Point( loc.X, loc.Y ); + } + + public void setLocation( int x, int y ) { + base.Location = new System.Drawing.Point( x, y ); + } + + public void setLocation( bocoree.java.awt.Point p ) { + base.Location = new System.Drawing.Point( p.x, p.y ); + } +#endif + + public bocoree.java.awt.Rectangle getBounds() { + System.Drawing.Rectangle r = base.Bounds; + return new bocoree.java.awt.Rectangle( r.X, r.Y, r.Width, r.Height ); + } + +#if COMPONENT_ENABLE_X + public int getX() { + return base.Left; + } +#endif + +#if COMPONENT_ENABLE_Y + public int getY() { + return base.Top; + } +#endif + + public int getWidth() { + return base.Width; + } + + public int getHeight() { + return base.Height; + } + + public bocoree.java.awt.Dimension getSize() { + return new bocoree.java.awt.Dimension( base.Size.Width, base.Size.Height ); + } + + public void setSize( int width, int height ) { + base.Size = new System.Drawing.Size( width, height ); + } + + public void setSize( bocoree.java.awt.Dimension d ) { + setSize( d.width, d.height ); + } + + public void setBackground( bocoree.java.awt.Color color ) { + base.BackColor = System.Drawing.Color.FromArgb( color.getRed(), color.getGreen(), color.getBlue() ); + } + + public bocoree.java.awt.Color getBackground() { + return new bocoree.java.awt.Color( base.BackColor.R, base.BackColor.G, base.BackColor.B ); + } + + public void setForeground( bocoree.java.awt.Color color ) { + base.ForeColor = color.color; + } + + public bocoree.java.awt.Color getForeground() { + return new bocoree.java.awt.Color( base.ForeColor.R, base.ForeColor.G, base.ForeColor.B ); + } + + public void setFont( bocoree.java.awt.Font font ) { + base.Font = font.font; + } + + public bool getEnabled() { + return base.Enabled; + } + + public void setEnabled( bool value ) { + base.Enabled = value; + } + + public void requestFocus() { + base.Focus(); + } + #endregion + + #region java.awt.TextComponent + public string getText() { + return base.Text; + } + + public void setText( string value ) { + base.Text = value; + } + #endregion + + #region javax.swing.JComponent + // root implementation of javax.swing.JComponent is in BForm.cs + public bool requestFocusInWindow() { + return base.Focus(); + } + #endregion + + public bool isImeModeOn() { + return base.ImeMode == System.Windows.Forms.ImeMode.Hiragana; + } + + public void setImeModeOn( bool value ){ + base.ImeMode = value ? System.Windows.Forms.ImeMode.Hiragana : System.Windows.Forms.ImeMode.Off; + } + + public void selectAll() { + base.SelectAll(); + } + + public void setTag( object value ) { + base.Tag = value; + } + + public object getTag() { + return base.Tag; + } + } + +} +#endif diff --git a/trunk/bocoree/BTimer.cs b/trunk/bocoree/BTimer.cs new file mode 100644 index 0000000..70dece7 --- /dev/null +++ b/trunk/bocoree/BTimer.cs @@ -0,0 +1,39 @@ +#if JAVA +//INCLUDE ..\BuildJavaUI\src\org\kbinani\windows\forms\BTimer.java +#else +using System; + +namespace bocoree.windows.forms { + + public class BTimer : System.Windows.Forms.Timer { + public void start() { + base.Start(); + } + + public BTimer() + : base() { + } + + public BTimer( System.ComponentModel.IContainer container ) + : base( container ) { + } + + public void stop() { + base.Stop(); + } + + public int getDelay() { + return base.Interval; + } + + public void setDelay( int value ) { + base.Interval = value; + } + + public bool isRunning() { + return base.Enabled; + } + } + +} +#endif diff --git a/trunk/bocoree/BToggleButton.cs b/trunk/bocoree/BToggleButton.cs new file mode 100644 index 0000000..9750310 --- /dev/null +++ b/trunk/bocoree/BToggleButton.cs @@ -0,0 +1,23 @@ +/* + * BToggleButton.cs + * Copyright (c) 2009 kbinani + * + * This file is part of bocoree. + * + * bocoree is free software; you can redistribute it and/or + * modify it under the terms of the BSD License. + * + * bocoree 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. + */ +#if JAVA +//INCLUDE ..\BuildJavaUI\src\org\kbinani\windows\forms\BToggleButton.java +#else +namespace bocoree.windows.forms { + + public class BToggleButton : System.Windows.Forms.ToolStripButton { + } + +} +#endif diff --git a/trunk/bocoree/BToolBar.cs b/trunk/bocoree/BToolBar.cs new file mode 100644 index 0000000..007340e --- /dev/null +++ b/trunk/bocoree/BToolBar.cs @@ -0,0 +1,36 @@ +/* + * BToolBar.cs + * Copyright (c) 2009 kbinani + * + * This file is part of bocoree. + * + * bocoree is free software; you can redistribute it and/or + * modify it under the terms of the BSD License. + * + * bocoree 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. + */ +#if JAVA +//INCLUDE ..\BuildJavaUI\src\org\kbinani\windows\forms\BToolBar.java +#else +namespace bocoree.windows.forms { + public class BToolBar : System.Windows.Forms.ToolStrip { + public int getComponentCount() { + return base.Items.Count; + } + + public System.Windows.Forms.ToolStripItem getComponentAtIndex( int index ) { + return base.Items[index]; + } + + public void add( System.Windows.Forms.ToolStripItem value ) { + base.Items.Add( value ); + } + + public void addSeparator() { + base.Items.Add( new System.Windows.Forms.ToolStripSeparator() ); + } + } +} +#endif diff --git a/trunk/bocoree/BToolStripButton.cs b/trunk/bocoree/BToolStripButton.cs new file mode 100644 index 0000000..80117f5 --- /dev/null +++ b/trunk/bocoree/BToolStripButton.cs @@ -0,0 +1,192 @@ +/* + * BToolStripButton.cs + * Copyright (c) 2009 kbinani + * + * This file is part of bocoree. + * + * bocoree is free software; you can redistribute it and/or + * modify it under the terms of the BSD License. + * + * bocoree 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. + */ +#if JAVA +//INCLUDE ..\BuildJavaUI\src\org\kbinani\windows\forms\BToolStripButton.java +#else +#define COMPONENT_PARENT_AS_OWNERITEM +#define COMPONENT_ENABLE_TOOL_TIP_TEXT +#define ABSTRACT_BUTTON_ENABLE_IS_SELECTED +namespace bocoree.windows.forms { + + public class BToolStripButton : System.Windows.Forms.ToolStripButton { + private object tag = null; + + public object getTag() { + return tag; + } + + public void setTag( object value ) { + tag = value; + } + + public bool isCheckOnClick() { + return base.CheckOnClick; + } + + public void setCheckOnClick( bool value ) { + base.CheckOnClick = value; + } + + #region java.awt.Component +#if COMPONENT_ENABLE_TOOL_TIP_TEXT + public void setToolTipText( string value ) { + base.ToolTipText = value; + } + + public string getToolTipText() { + return base.ToolTipText; + } +#endif + +#if COMPONENT_PARENT_AS_OWNERITEM + public object getParent() { + return base.OwnerItem; + } +#else + public object getParent() + { + return base.Parent; + } +#endif + + public string getName() { + return base.Name; + } + + public void setName( string value ) { + base.Name = value; + } + +#if COMPONENT_ENABLE_LOCATION + public bocoree.java.awt.Point getLocation() + { + System.Drawing.Point loc = this.Location; + return new bocoree.java.awt.Point( loc.X, loc.Y ); + } + + public void setLocation( int x, int y ) + { + base.Location = new System.Drawing.Point( x, y ); + } + + public void setLocation( bocoree.java.awt.Point p ) + { + base.Location = new System.Drawing.Point( p.x, p.y ); + } +#endif + + public bocoree.java.awt.Rectangle getBounds() { + System.Drawing.Rectangle r = base.Bounds; + return new bocoree.java.awt.Rectangle( r.X, r.Y, r.Width, r.Height ); + } + +#if COMPONENT_ENABLE_X + public int getX() + { + return base.Left; + } +#endif + +#if COMPONENT_ENABLE_Y + public int getY() + { + return base.Top; + } +#endif + + public int getWidth() { + return base.Width; + } + + public int getHeight() { + return base.Height; + } + + public bocoree.java.awt.Dimension getSize() { + return new bocoree.java.awt.Dimension( base.Size.Width, base.Size.Height ); + } + + public void setSize( int width, int height ) { + base.Size = new System.Drawing.Size( width, height ); + } + + public void setSize( bocoree.java.awt.Dimension d ) { + setSize( d.width, d.height ); + } + + public void setBackground( bocoree.java.awt.Color color ) { + base.BackColor = System.Drawing.Color.FromArgb( color.getRed(), color.getGreen(), color.getBlue() ); + } + + public bocoree.java.awt.Color getBackground() { + return new bocoree.java.awt.Color( base.BackColor.R, base.BackColor.G, base.BackColor.B ); + } + + public void setForeground( bocoree.java.awt.Color color ) { + base.ForeColor = color.color; + } + + public bocoree.java.awt.Color getForeground() { + return new bocoree.java.awt.Color( base.ForeColor.R, base.ForeColor.G, base.ForeColor.B ); + } + + public void setFont( bocoree.java.awt.Font font ) { + base.Font = font.font; + } + + public bool getEnabled() { + return base.Enabled; + } + + public void setEnabled( bool value ) { + base.Enabled = value; + } + #endregion + + #region javax.swing.AbstractButton + // root implementation of javax.swing.AbstractButton is in BMenuItem.cs + public string getText() { + return base.Text; + } + + public void setText( string value ) { + base.Text = value; + } +#if ABSTRACT_BUTTON_ENABLE_IS_SELECTED + public bool isSelected() { + return base.Checked; + } + + public void setSelected( bool value ) { + base.Checked = value; + } +#endif + public bocoree.java.awt.Icon getIcon() { + bocoree.java.awt.Icon ret = new bocoree.java.awt.Icon(); + ret.image = base.Image; + return ret; + } + + public void setIcon( bocoree.java.awt.Icon value ) { + if ( value == null ) { + base.Image = null; + } else { + base.Image = value.image; + } + } + #endregion + } + +} +#endif diff --git a/trunk/bocoree/BToolStripDropDownButton.cs b/trunk/bocoree/BToolStripDropDownButton.cs new file mode 100644 index 0000000..9499286 --- /dev/null +++ b/trunk/bocoree/BToolStripDropDownButton.cs @@ -0,0 +1,9 @@ +namespace bocoree.windows.forms { + + public class BToolStripDropDownButton : System.Windows.Forms.ToolStripDropDownButton { + public void setText( string value ) { + base.Text = value; + } + } + +} \ No newline at end of file diff --git a/trunk/bocoree/BToolStripLabel.cs b/trunk/bocoree/BToolStripLabel.cs new file mode 100644 index 0000000..bb1ffe2 --- /dev/null +++ b/trunk/bocoree/BToolStripLabel.cs @@ -0,0 +1,7 @@ +namespace bocoree.windows.forms { + public class BToolStripLabel : System.Windows.Forms.ToolStripLabel { + public void setText( string value ) { + base.Text = value; + } + } +} diff --git a/trunk/bocoree/BToolStripTextBox.cs b/trunk/bocoree/BToolStripTextBox.cs new file mode 100644 index 0000000..07f4168 --- /dev/null +++ b/trunk/bocoree/BToolStripTextBox.cs @@ -0,0 +1,13 @@ +namespace bocoree.windows.forms { + + public class BToolStripTextBox : System.Windows.Forms.ToolStripTextBox { + public void setText( string value ) { + base.Text = value; + } + + public string getText() { + return base.Text; + } + } + +} \ No newline at end of file diff --git a/trunk/bocoree/BVScrollBar.cs b/trunk/bocoree/BVScrollBar.cs new file mode 100644 index 0000000..63fc3a3 --- /dev/null +++ b/trunk/bocoree/BVScrollBar.cs @@ -0,0 +1,216 @@ +#if JAVA +//INCLUDE ..\BuildJavaUI\src\org\kbinani\windows\forms\BVScrollBar.java +#else +namespace bocoree.windows.forms { + + public class BVScrollBar : System.Windows.Forms.VScrollBar { + // root implementation of javax.swing.ScrollBar + #region javax.swing.ScrollBar + public void setMaximum( int value ) { + base.Maximum = value; + } + + public int getMaximum() { + return base.Maximum; + } + + public void setMinimum( int value ) { + base.Minimum = value; + } + + public int getMinimum() { + return base.Minimum; + } + + public int getValue() { + return base.Value; + } + + public void setValue( int value ) { + base.Value = value; + } + + public int getVisibleAmount() { + return base.LargeChange; + } + + public void setVisibleAmount( int value ) { + base.LargeChange = value; + } + #endregion + + #region java.awt.Component + // root implementation of java.awt.Component is in BForm.cs + public bocoree.java.awt.Cursor getCursor() { + System.Windows.Forms.Cursor c = base.Cursor; + bocoree.java.awt.Cursor ret = null; + if ( c.Equals( System.Windows.Forms.Cursors.Arrow ) ) { + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.DEFAULT_CURSOR ); + } else if ( c.Equals( System.Windows.Forms.Cursors.Cross ) ) { + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.CROSSHAIR_CURSOR ); + } else if ( c.Equals( System.Windows.Forms.Cursors.Default ) ) { + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.DEFAULT_CURSOR ); + } else if ( c.Equals( System.Windows.Forms.Cursors.Hand ) ) { + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.HAND_CURSOR ); + } else if ( c.Equals( System.Windows.Forms.Cursors.IBeam ) ) { + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.TEXT_CURSOR ); + } else if ( c.Equals( System.Windows.Forms.Cursors.PanEast ) ) { + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.E_RESIZE_CURSOR ); + } else if ( c.Equals( System.Windows.Forms.Cursors.PanNE ) ) { + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.NE_RESIZE_CURSOR ); + } else if ( c.Equals( System.Windows.Forms.Cursors.PanNorth ) ) { + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.N_RESIZE_CURSOR ); + } else if ( c.Equals( System.Windows.Forms.Cursors.PanNW ) ) { + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.NW_RESIZE_CURSOR ); + } else if ( c.Equals( System.Windows.Forms.Cursors.PanSE ) ) { + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.SE_RESIZE_CURSOR ); + } else if ( c.Equals( System.Windows.Forms.Cursors.PanSouth ) ) { + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.S_RESIZE_CURSOR ); + } else if ( c.Equals( System.Windows.Forms.Cursors.PanSW ) ) { + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.SW_RESIZE_CURSOR ); + } else if ( c.Equals( System.Windows.Forms.Cursors.PanWest ) ) { + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.W_RESIZE_CURSOR ); + } else if ( c.Equals( System.Windows.Forms.Cursors.SizeAll ) ) { + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.MOVE_CURSOR ); + } else { + ret = new bocoree.java.awt.Cursor( bocoree.java.awt.Cursor.CUSTOM_CURSOR ); + } + ret.cursor = c; + return ret; + } + + public void setCursor( bocoree.java.awt.Cursor value ) { + base.Cursor = value.cursor; + } + + public bool isVisible() { + return base.Visible; + } + + public void setVisible( bool value ) { + base.Visible = value; + } + +#if COMPONENT_ENABLE_TOOL_TIP_TEXT + public void setToolTipText( string value ) + { + base.ToolTipText = value; + } + + public String getToolTipText() + { + return base.ToolTipText; + } +#endif + +#if COMPONENT_PARENT_AS_OWNERITEM + public Object getParent() { + return base.OwnerItem; + } +#else + public object getParent() { + return base.Parent; + } +#endif + + public string getName() { + return base.Name; + } + + public void setName( string value ) { + base.Name = value; + } + +#if COMPONENT_ENABLE_LOCATION + public bocoree.java.awt.Point getLocationOnScreen() { + System.Drawing.Point p = base.PointToScreen( base.Location ); + return new bocoree.java.awt.Point( p.X, p.Y ); + } + + public bocoree.java.awt.Point getLocation() { + System.Drawing.Point loc = this.Location; + return new bocoree.java.awt.Point( loc.X, loc.Y ); + } + + public void setLocation( int x, int y ) { + base.Location = new System.Drawing.Point( x, y ); + } + + public void setLocation( bocoree.java.awt.Point p ) { + base.Location = new System.Drawing.Point( p.x, p.y ); + } +#endif + + public bocoree.java.awt.Rectangle getBounds() { + System.Drawing.Rectangle r = base.Bounds; + return new bocoree.java.awt.Rectangle( r.X, r.Y, r.Width, r.Height ); + } + +#if COMPONENT_ENABLE_X + public int getX() { + return base.Left; + } +#endif + +#if COMPONENT_ENABLE_Y + public int getY() { + return base.Top; + } +#endif + + public int getWidth() { + return base.Width; + } + + public int getHeight() { + return base.Height; + } + + public bocoree.java.awt.Dimension getSize() { + return new bocoree.java.awt.Dimension( base.Size.Width, base.Size.Height ); + } + + public void setSize( int width, int height ) { + base.Size = new System.Drawing.Size( width, height ); + } + + public void setSize( bocoree.java.awt.Dimension d ) { + setSize( d.width, d.height ); + } + + public void setBackground( bocoree.java.awt.Color color ) { + base.BackColor = System.Drawing.Color.FromArgb( color.getRed(), color.getGreen(), color.getBlue() ); + } + + public bocoree.java.awt.Color getBackground() { + return new bocoree.java.awt.Color( base.BackColor.R, base.BackColor.G, base.BackColor.B ); + } + + public void setForeground( bocoree.java.awt.Color color ) { + base.ForeColor = color.color; + } + + public bocoree.java.awt.Color getForeground() { + return new bocoree.java.awt.Color( base.ForeColor.R, base.ForeColor.G, base.ForeColor.B ); + } + + public void setFont( bocoree.java.awt.Font font ) { + base.Font = font.font; + } + + public bool isEnabled() { + return base.Enabled; + } + + public void setEnabled( bool value ) { + base.Enabled = value; + } + + public void requestFocus() { + base.Focus(); + } + #endregion + } + +} +#endif diff --git a/trunk/bocoree/Base64.cs b/trunk/bocoree/Base64.cs new file mode 100644 index 0000000..07d0710 --- /dev/null +++ b/trunk/bocoree/Base64.cs @@ -0,0 +1,156 @@ +/* + * Base64.cs + * Copyright (c) 2009 kbinani + * + * This file is part of bocoree. + * + * bocoree is free software; you can redistribute it and/or + * modify it under the terms of the BSD License. + * + * bocoree 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. + */ +#if JAVA +package org.kbinani; + +public class Base64{ + static final char TABLE[] = { + 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', + 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', + 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', + 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', + 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', + 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', + 'w', 'x', 'y', 'z', '0', '1', '2', '3', + '4', '5', '6', '7', '8', '9', '+', '/' + }; + + private Base64(){ + } + + public static String encode( byte[] value ){ + StringBuilder ret = new StringBuilder(); + int buf = 0; + int filled = 0; // bufに格納されているビット数 + int count = 0; + for( int i = 0; i < value.length; i++ ){ + int v = value[i] & 0xff; + if( filled == 0 ){ + buf = 0x3f & (v >>> 2); + ret.append( TABLE[buf] ); + buf = 0x3f & (v << 4); + filled = 2; + count++; + }else if( filled == 2 ){ + buf = buf | (v >>> 4); + ret.append( TABLE[buf] ); + buf = 0x3f & (v << 2); + filled = 4; + count++; + }else if( filled == 4 ){ + buf = buf | (v >>> 6); + ret.append( TABLE[buf] ); + buf = 0x3f & v; + ret.append( TABLE[buf] ); + filled = 0; + count += 2; + } + } + if( filled > 0 ){ + ret.append( TABLE[buf] ); + count++; + } + int r = count & 0x03; + if( r != 0 ){ + for( int i = 0; i < 4 - r; i++ ){ + ret.append( "=" ); + } + } + return ret.toString(); + } + + public static byte[] decode( String value ){ + int index = value.lastIndexOf( '=' ); + int len = 0; + int c = value.length(); + if( index < 0 ){ + len = c * 6; + }else{ + len = index * 6; + } + int total; + if( (len & 0x07) == 0 ){ + total = len >>> 3; + }else{ + total = (len >>> 3) + 1; + } + byte[] ret = new byte[total]; + int buf = 0; + int filled = 0; + index = 0; + for( int i = 0; i < c; i++ ){ + char ch = value.charAt( i ); + if( ch == '=' ){ + break; + } + int v = decodeUnit( ch ); + if( filled == 0 ){ + buf = v << 2; + filled = 6; + }else if( filled == 6 ){ + buf = buf | (v >>> 4); + ret[index] = (byte)buf; + buf = v << 4; + filled = 4; + index++; + }else if( filled == 4 ){ + buf = buf | (v >>> 2); + ret[index] = (byte)buf; + buf = v << 6; + filled = 2; + index++; + }else if( filled == 2 ){ + buf = buf | v; + ret[index] = (byte)buf; + buf = 0; + filled = 0; + index++; + } + } + if( filled > 0 ){ + ret[index] = (byte)buf; + } + return ret; + } + + private static int decodeUnit( char c ){ + int code = (int)c; + if( 97 <= code ){ + return code - 71; + }else if( 65 <= code ){ + return code - 65; + }else if( 48 <= code ){ + return code + 4; + }else if( code == 43 ){ + return 62; + }else{ + return 63; + } + } +} +#else +using System; + +namespace bocoree { + public static class Base64 { + public static string encode( byte[] value ) { + return Convert.ToBase64String( value ); + } + + public static byte[] decode( String value ) { + return Convert.FromBase64String( value ); + } + } +} +#endif diff --git a/trunk/bocoree/BufferedReader.cs b/trunk/bocoree/BufferedReader.cs new file mode 100644 index 0000000..9ab501a --- /dev/null +++ b/trunk/bocoree/BufferedReader.cs @@ -0,0 +1,92 @@ +#if !JAVA +/* + * BufferedReader.cs + * Copyright (c) 2009 kbinani + * + * This file is part of bocoree. + * + * bocoree is free software; you can redistribute it and/or + * modify it under the terms of the BSD License. + * + * bocoree 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.IO; +using System.Text; + +namespace bocoree.java.io { + + public class FileReader{ + public StreamReader m_reader; + + public FileReader( String fileName ){ + m_reader = new StreamReader( fileName ); + } + } + + public class FileInputStream : FileStream, InputStream { + public FileInputStream( String fileName ) + : base( fileName, FileMode.Open, FileAccess.Read ) { + } + + public void close() { + base.Close(); + } + + public int read( byte[] b, int off, int len ) { + return base.Read( b, off, len ); + } + + public int read( byte[] b ) { + return read( b, 0, b.Length ); + } + + public int read() { + return base.ReadByte(); + } + } + + public class InputStreamReader { + public StreamReader m_reader; + + public InputStreamReader( FileInputStream stream, String charsetName ) { + m_reader = new StreamReader( stream, Encoding.GetEncoding( charsetName ) ); + } + } + + public class BufferedReader { + private StreamReader m_reader; + + public BufferedReader( FileReader reader ) { + m_reader = reader.m_reader; + } + + public BufferedReader( InputStreamReader reader ) { + m_reader = reader.m_reader; + } + + public void close() { + m_reader.Close(); + } + + public int read() { + return m_reader.Read(); + } + + public int read( char[] cbuf, int off, int len ) { + return m_reader.Read( cbuf, off, len ); + } + + public String readLine() { + return m_reader.ReadLine(); + } + + public bool ready() { + return m_reader.Peek() >= 0; + } + } + +} +#endif diff --git a/trunk/bocoree/BufferedWriter.cs b/trunk/bocoree/BufferedWriter.cs new file mode 100644 index 0000000..c058deb --- /dev/null +++ b/trunk/bocoree/BufferedWriter.cs @@ -0,0 +1,126 @@ +#if !JAVA +/* + * BufferedWriter.cs + * Copyright (c) 2009 kbinani + * + * This file is part of bocoree. + * + * bocoree is free software; you can redistribute it and/or + * modify it under the terms of the BSD License. + * + * bocoree 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.IO; +using System.Text; + +namespace bocoree.java.io { + + public class FileWriter { + public StreamWriter m_writer; + + public FileWriter( String fileName ) { + m_writer = new StreamWriter( fileName ); + } + } + + public class FileOutputStream : FileStream, OutputStream { + public FileOutputStream( String fileName ) + : base( fileName, FileMode.Create, FileAccess.Write ) { + } + + public void close() { + base.Close(); + } + + /// + /// 出力ストリームをフラッシュして、バッファリングされていたすべての出力バイトを強制的にストリームに書き込みます。 + /// + public void flush() { + base.Flush(); + } + + /// + /// b.length バイトのデータを出力ストリームに書き込みます。 + /// + /// + public void write( byte[] b ) { + base.Write( b, 0, b.Length ); + } + + /// + /// 指定された byte 配列の、オフセット位置 off から始まる len バイトを出力ストリームに書き込みます。 + /// + /// + /// + /// + public void write( byte[] b, int off, int len ) { + base.Write( b, off, len ); + } + + /// + /// 指定された byte を出力ストリームに書き込みます。 + /// + /// + public void write( int b ) { + base.WriteByte( (byte)b ); + } + } + + public class OutputStreamWriter { + public StreamWriter m_writer; + + public OutputStreamWriter( FileOutputStream stream, String charsetName ) { + m_writer = new StreamWriter( stream, Encoding.GetEncoding( charsetName ) ); + } + } + + public class BufferedWriter { + private StreamWriter m_writer; + + public BufferedWriter( FileWriter writer ) { + m_writer = writer.m_writer; + } + + public BufferedWriter( OutputStreamWriter writer ) { + m_writer = writer.m_writer; + } + + public void close() { + m_writer.Close(); + } + + public void flush() { + m_writer.Flush(); + } + + public void newLine() { + m_writer.WriteLine(); + } + + public void write( char[] cbuf, int off, int len ) { + m_writer.Write( cbuf, off, len ); + } + + public void write( int c ) { + m_writer.Write( (char)c ); + } + + public void write( String s, int off, int len ) { + m_writer.Write( s.ToCharArray(), off, len ); + } + + public void write( String str ) { + m_writer.Write( str ); + } + + public void write( char[] cbuf ) { + m_writer.Write( cbuf ); + } + + } + +} +#endif diff --git a/trunk/bocoree/ByRef.cs b/trunk/bocoree/ByRef.cs new file mode 100644 index 0000000..dfcccf1 --- /dev/null +++ b/trunk/bocoree/ByRef.cs @@ -0,0 +1,35 @@ +/* + * ByRef.cs + * Copyright (c) 2009 kbinani + * + * This file is part of bocoree. + * + * bocoree is free software; you can redistribute it and/or + * modify it under the terms of the BSD License. + * + * Boare.Lib.Vsq 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. + */ +#if JAVA +package org.kbinani; +#else +using System; + +namespace bocoree { +#endif + + public class ByRef { + public T value; + + public ByRef() { + } + + public ByRef( T value_ ) { + value = value_; + } + } + +#if !JAVA +} +#endif diff --git a/trunk/bocoree/Collections.cs b/trunk/bocoree/Collections.cs index 18ed6cb..83aff36 100644 --- a/trunk/bocoree/Collections.cs +++ b/trunk/bocoree/Collections.cs @@ -1,18 +1,19 @@ -/* +#if !JAVA +/* * Collections.cs * Copyright (c) 2009 kbinani * - * This file is part of Boare.Cadencii. + * This file is part of bocoree. * - * Boare.Cadencii is free software; you can redistribute it and/or - * modify it under the terms of the GPLv3 License. + * bocoree is free software; you can redistribute it and/or + * modify it under the terms of the BSD License. * - * Boare.Cadencii is distributed in the hope that it will be useful, + * bocoree 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. */ //#define VECTOR_TEST -namespace bocoree { +namespace bocoree.java.util { public static class Collections { public static void sort( Vector list ) { @@ -23,3 +24,4 @@ namespace bocoree { } } +#endif diff --git a/trunk/bocoree/File.cs b/trunk/bocoree/File.cs new file mode 100644 index 0000000..d364668 --- /dev/null +++ b/trunk/bocoree/File.cs @@ -0,0 +1,475 @@ +/*#if !JAVA +using System; +using System.Collections.Generic; + +namespace bocoree { + + public class File { + public readonly string separator = System.IO.Path.DirectorySeparatorChar + ""; + public readonly char separatorChar = System.IO.Path.DirectorySeparatorChar; + + private string m_path; + + /// + /// 指定されたパス名文字列を抽象パス名に変換して、新しい File のインスタンスを生成します。 + /// + /// + public File( String pathname ) { + m_path = pathname; + } + + /// + /// この抽象パス名が示すファイルをアプリケーションが実行できるかどうかを判定します。 + /// + public bool canExecute() { + throw new NotImplementedException(); + } + + /// + /// この抽象パス名が示すファイルをアプリケーションが読み込めるかどうかを判定します。 + /// + public bool canRead() { + System.IO.FileStream fs = null; + bool ret = false; + try { + fs = System.IO.File.OpenRead( m_path ); + ret = true; + } catch { + ret = false; + } finally { + if ( fs != null ) { + try { + fs.Close(); + } catch { + } + } + } + return ret; + } + + /// + /// この抽象パス名が示すファイルをアプリケーションが変更できるかどうかを判定します。 + /// + public bool canWrite() { + System.IO.FileStream fs = null; + bool ret = false; + try { + fs = System.IO.File.OpenWrite( m_path ); + ret = true; + } catch { + ret = false; + } finally { + if ( fs != null ) { + try { + fs.Close(); + } catch { + } + } + } + return ret; + } + + /// + /// 2 つの抽象パス名を語彙的に比較します。 + /// + public int compareTo( File pathname ) { + return System.IO.Path.GetFullPath( this.m_path ).CompareTo( System.IO.Path.GetFullPath( pathname.m_path ) ); + } + + /// + /// この抽象パス名が示す空の新しいファイルを不可分 (atomic) に生成します (その名前のファイルがまだ存在しない場合だけ)。 + /// + public bool createNewFile() { + if ( System.IO.File.Exists( m_path ) ) { + return false; + } else { + System.IO.File.Create( m_path ); + return true; + } + } + + /// + /// 指定された接頭辞と接尾辞をファイル名の生成に使用して、デフォルトの一時ファイルディレクトリに空のファイルを生成します。 + /// + public static File createTempFile( string prefix, string suffix ) { + string tmp = System.IO.Path.GetTempFileName(); + string dir = System.IO.Path.GetDirectoryName( tmp ); + string file = System.IO.Path.GetFileName( tmp ); + return new File( System.IO.Path.Combine( dir, prefix + file + suffix ) ); + } + + /// + /// 指定されたディレクトリで新しい空のファイルを生成し、その名前には、指定された接頭辞および接尾辞の文字列が使用されます。 + /// + public static File createTempFile( string prefix, string suffix, File directory ) { + String dir = System.IO.Path.GetTempPath(); + if ( directory != null ) { + dir = directory.m_path; + } + if ( !System.IO.Directory.Exists( dir ) ) { + throw new System.IO.IOException(); + } + while ( true ) { + String f = prefix + System.IO.Path.GetRandomFileName() + suffix; + String full = System.IO.Path.Combine( dir, f ); + if ( !System.IO.File.Exists( full ) ) { + System.IO.File.Create( full ); + return new File( full ); + } + } + throw new System.IO.IOException(); + } + + /// + /// この抽象パス名が示すファイルまたはディレクトリを削除します。 + /// + public bool delete() { + try { + System.IO.File.Delete( m_path ); + return true; + } catch { + } + return false; + } + + /// + /// この抽象パス名が示すファイルまたはディレクトリが、仮想マシンが終了したときに削除されるように要求します。 + /// + public void deleteOnExit() { + throw new NotImplementedException(); + } + + /// + /// この抽象パス名が指定されたオブジェクトと等しいかどうかを判定します。 + /// + public bool equals( object obj ) { + return base.Equals( obj ); + } + + /// + /// この抽象パス名が示すファイルまたはディレクトリが存在するかどうかを判定します。 + /// + public bool exists() { + bool file = System.IO.File.Exists( m_path ); + bool dir = System.IO.Directory.Exists( m_path ); + return file || dir; + } + + /// + /// この抽象パス名の絶対形式を返します。 + /// + public File getAbsoluteFile() { + return new File( getAbsolutePath() ); + } + + /// + /// この抽象パス名の絶対パス名文字列を返します。 + /// + public string getAbsolutePath() { + return System.IO.Path.GetFullPath( m_path ); + } + + /// + /// この抽象パス名の正規の形式を返します。 + /// + public File getCanonicalFile() { + throw new NotImplementedException(); + } + + /// + /// この抽象パス名の正規のパス名文字列を返します。 + /// + public string getCanonicalPath() { + throw new NotImplementedException(); + } + + /// + /// この抽象パス名で指定されるパーティション内で未割り当てのバイト数を返します。 + /// + public long getFreeSpace() { + string drive = System.IO.Path.GetPathRoot( m_path ); + foreach ( System.IO.DriveInfo di in System.IO.DriveInfo.GetDrives() ) { + if ( di.RootDirectory.FullName == drive ) { + return di.TotalFreeSpace; + } + } + return 0; + } + + /// + /// この抽象パス名が示すファイルまたはディレクトリの名前を返します。 + /// + public string getName() { + return System.IO.Path.GetFileName( m_path ); + } + + /// + /// この抽象パス名の親のパス名文字列を返します。 + /// + public string getParent() { + return System.IO.Path.GetDirectoryName( m_path ); + } + + /// + /// この抽象パス名の親の抽象パス名を返します。 + /// + public File getParentFile() { + return new File( getParent() ); + } + + /// + /// この抽象パス名をパス名文字列に変換します。 + /// + public string getPath() { + return m_path; + } + + /// + /// この抽象パス名で指定されるパーティションのサイズを返します。 + /// + public long getTotalSpace() { + return getFreeSpace(); + } + + /// + /// この抽象パス名で指定されるパーティション上で、この仮想マシンが利用できるバイト数を返します。 + /// + public long getUsableSpace() { + return getFreeSpace(); + } + + /// + /// この抽象パス名のハッシュコードを計算します。 + /// + public int hashCode() { + return m_path.GetHashCode(); + } + + /// + /// この抽象パス名が絶対かどうかを判定します。 + /// + public bool isAbsolute() { + return System.IO.Path.IsPathRooted( m_path ); + } + + /// + /// この抽象パス名が示すファイルがディレクトリであるかどうかを判定します。 + /// + public bool isDirectory() { + bool dir = System.IO.Directory.Exists( m_path ); + if ( dir ) { + return true; + } else { + return false; + } + } + + /// + /// この抽象パス名が示すファイルが普通のファイルかどうかを判定します。 + /// + public bool isFile() { + throw new NotImplementedException(); + } + + /// + /// この抽象パス名が示すファイルが隠しファイルかどうかを判定します。 + /// + public bool isHidden() { + throw new NotImplementedException(); + } + + /// + /// この抽象パス名が示すファイルが最後に変更された時刻を返します。 + /// + public long lastModified() { + System.IO.FileInfo f = new System.IO.FileInfo( m_path ); + return f.LastWriteTimeUtc.Ticks; + } + + /// + /// この抽象パス名に指定されているファイルの長さを返します。 + /// + public long length() { + System.IO.FileInfo f = new System.IO.FileInfo( m_path ); + return f.Length; + } + + /// + /// この抽象パス名が示すディレクトリにあるファイルおよびディレクトリを示す文字列の配列を返します。 + /// + public string[] list() { + List list = new List(); + list.AddRange( System.IO.Directory.GetDirectories( m_path ) ); + list.AddRange( System.IO.Directory.GetFiles( m_path ) ); + return list.ToArray(); + } + + /// + /// この抽象パス名が示すディレクトリにあるファイルおよびディレクトリの中で、指定されたフィルタの基準を満たすものの文字列の配列を返します。 + /// + public string[] list( FilenameFilter filter ) { + List ret = new List(); + foreach ( string s in list() ) { + if ( filter.accept( this, s ) ) { + ret.Add( s ); + } + } + return ret.ToArray(); + } + + /// + /// この抽象パス名が示すディレクトリ内のファイルを示す抽象パス名の配列を返します。 + /// + public File[] listFiles() { + string[] files = System.IO.Directory.GetFiles( m_path ); + File[] ret = new File[files.Length]; + for ( int i = 0; i < files.Length; i++ ) { + ret[i] = new File( m_path + separator + files[i] ); + } + return ret; + } + + /// + /// この抽象パス名が示すディレクトリにあるファイルおよびディレクトリの中で、指定されたフィルタの基準を満たすものの抽象パス名の配列を返します。 + /// + public File[] listFiles( FileFilter filter ) { + List ret = new List(); + foreach ( string s in list() ) { + File f = new File( m_path + separator + s ); + if ( filter.accept( f ) ) { + ret.Add( f ); + } + } + return ret.ToArray(); + } + + /// + /// この抽象パス名が示すディレクトリにあるファイルおよびディレクトリの中で、指定されたフィルタの基準を満たすものの抽象パス名の配列を返します。 + /// + public File[] listFiles( FilenameFilter filter ) { + List ret = new List(); + foreach ( string s in list() ) { + if ( filter.accept( this, s ) ) { + File f = new File( m_path + separator + s ); + ret.Add( f ); + } + } + return ret.ToArray(); + } + + /// + /// 有効なファイルシステムのルートをリスト表示します。 + /// + public static File[] listRoots() { + throw new NotImplementedException(); + } + + /// + /// この抽象パス名が示すディレクトリを生成します。 + /// + public bool mkdir() { + try { + System.IO.Directory.CreateDirectory( m_path ); + return true; + } catch { + } + return false; + } + + /// + /// この抽象パス名が示すディレクトリを生成します。 + /// + public bool mkdirs() { + throw new NotImplementedException(); + } + + /// + /// この抽象パス名が示すファイルの名前を変更します。 + /// + public bool renameTo( File dest ) { + try { + System.IO.File.Replace( m_path, dest.m_path, m_path + "BAK" ); + return true; + } catch { + } + return false; + } + + /// + /// この抽象パス名に所有者の実行権を設定する簡易メソッドです。 + /// + public bool setExecutable( bool executable ) { + throw new NotImplementedException(); + } + + /// + /// この抽象パス名に所有者または全員の実行権を設定します。 + /// + public bool setExecutable( bool executable, bool ownerOnly ) { + throw new NotImplementedException(); + } + /// + /// この抽象パス名が示すファイルまたはディレクトリが変更された時刻を設定します。 + /// + public bool setLastModified( long time ) { + try { + System.IO.FileInfo f = new System.IO.FileInfo( m_path ); + f.LastWriteTimeUtc = new DateTime( time ); + return true; + } catch { + } + return false; + } + + /// + /// この抽象パス名に所有者の読み取り権を設定する簡易メソッドです。 + /// + public bool setReadable( bool readable ) { + throw new NotImplementedException(); + } + + /// + /// この抽象パス名に所有者または全員の読み取り権を設定します。 + /// + public bool setReadable( bool readable, bool ownerOnly ) { + throw new NotImplementedException(); + } + + /// + /// この抽象パス名が示すファイルまたはディレクトリにマークを設定し、読み込みオペレーションだけが許可されるようにします。 + /// + public bool setReadOnly() { + throw new NotImplementedException(); + } + + /// + /// この抽象パス名に所有者の書き込み権を設定する簡易メソッドです。 + /// + public bool setWritable( bool writable ) { + throw new NotImplementedException(); + } + + /// + /// この抽象パス名に所有者または全員の書き込み権を設定します。 + /// + public bool setWritable( bool writable, bool ownerOnly ) { + throw new NotImplementedException(); + } + + /// + /// この抽象パス名のパス名文字列を返します。 + /// + public string toString() { + return m_path; + } + } + + public interface FilenameFilter { + bool accept( File dir, String name ); + } + + public interface FileFilter { + bool accept( File filepath ); + } +} +#endif*/ diff --git a/trunk/bocoree/Graphics.cs b/trunk/bocoree/Graphics.cs index db58cd8..204c6a2 100644 --- a/trunk/bocoree/Graphics.cs +++ b/trunk/bocoree/Graphics.cs @@ -1,13 +1,14 @@ -/* +#if !JAVA +/* * Graphics.cs * Copyright (c) 2009 kbinani * - * This file is part of Boare.Cadencii. + * This file is part of bocoree. * - * Boare.Cadencii is free software; you can redistribute it and/or - * modify it under the terms of the GPLv3 License. + * bocoree is free software; you can redistribute it and/or + * modify it under the terms of the BSD License. * - * Boare.Cadencii is distributed in the hope that it will be useful, + * bocoree 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. */ @@ -62,3 +63,4 @@ namespace bocoree { } } +#endif diff --git a/trunk/bocoree/IEventHandler.cs b/trunk/bocoree/IEventHandler.cs new file mode 100644 index 0000000..63ad87c --- /dev/null +++ b/trunk/bocoree/IEventHandler.cs @@ -0,0 +1,16 @@ +/* + * IEventHandler.cs + * Copyright (c) 2009 kbinani + * + * This file is part of bocoree. + * + * bocoree is free software; you can redistribute it and/or + * modify it under the terms of the BSD License. + * + * bocoree 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. + */ +#if JAVA +//INCLUDE ..\BuildJavaUI\src\org\kbinani\IEventHandler.java +#endif diff --git a/trunk/bocoree/Iterator.cs b/trunk/bocoree/Iterator.cs index 8b8798f..8814874 100644 --- a/trunk/bocoree/Iterator.cs +++ b/trunk/bocoree/Iterator.cs @@ -1,17 +1,18 @@ -/* +#if !JAVA +/* * Iterator.cs * Copyright (c) 2009 kbinani * - * This file is part of Boare.Cadencii. + * This file is part of bocoree. * - * Boare.Cadencii is free software; you can redistribute it and/or - * modify it under the terms of the GPLv3 License. + * bocoree is free software; you can redistribute it and/or + * modify it under the terms of the BSD License. * - * Boare.Cadencii is distributed in the hope that it will be useful, + * bocoree 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 bocoree { +namespace bocoree.java.util { public interface Iterator { bool hasNext(); @@ -20,3 +21,4 @@ namespace bocoree { } } +#endif diff --git a/trunk/bocoree/ListIterator.cs b/trunk/bocoree/ListIterator.cs index 343fb70..41de1e9 100644 --- a/trunk/bocoree/ListIterator.cs +++ b/trunk/bocoree/ListIterator.cs @@ -1,20 +1,21 @@ -/* +#if !JAVA +/* * ListIterator.cs * Copyright (c) 2009 kbinani * - * This file is part of Boare.Cadencii. + * This file is part of bocoree. * - * Boare.Cadencii is free software; you can redistribute it and/or - * modify it under the terms of the GPLv3 License. + * bocoree is free software; you can redistribute it and/or + * modify it under the terms of the BSD License. * - * Boare.Cadencii is distributed in the hope that it will be useful, + * bocoree 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; -namespace bocoree { +namespace bocoree.java.util { public class ListIterator : Iterator { private List m_list; @@ -56,3 +57,4 @@ namespace bocoree { } } +#endif diff --git a/trunk/bocoree/PortUtil.cs b/trunk/bocoree/PortUtil.cs new file mode 100644 index 0000000..7b69566 --- /dev/null +++ b/trunk/bocoree/PortUtil.cs @@ -0,0 +1,1574 @@ +/* + * PortUtil.cs + * Copyright (c) 2009 kbinani + * + * This file is part of Boare.Lib.Vsq. + * + * Boare.Lib.Vsq is free software; you can redistribute it and/or + * modify it under the terms of the BSD License. + * + * Boare.Lib.Vsq 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. + */ +#if JAVA +package org.kbinani; + +import java.awt.*; +import java.awt.datatransfer.*; +import java.awt.event.*; +import java.awt.geom.*; +import java.util.*; +import java.nio.*; +import java.nio.charset.*; +import java.io.*; +import java.text.*; +import java.security.*; +import java.nio.channels.*; +import javax.swing.*; +import org.kbinani.windows.forms.*; +#else +using System; +using System.IO; +using System.Text; +using bocoree.java.awt; +using bocoree.java.awt.event_; +using bocoree.java.util; +using bocoree.windows.forms; +using bocoree.javax.swing; + +namespace bocoree { + using boolean = System.Boolean; + using Float = System.Single; + using Integer = System.Int32; + using Long = System.Int64; +#endif + +#if JAVA + public class PortUtil implements AWTEventListener{ +#else + public class PortUtil { +#endif + +#if JAVA + private static boolean s_ctrl = false; + private static boolean s_shift = false; + private static boolean s_alt = false; + private static PortUtil s_instance = null; +#endif + + public static Color AliceBlue = new Color( 240, 248, 255 ); + public static Color AntiqueWhite = new Color( 250, 235, 215 ); + public static Color Aqua = new Color( 0, 255, 255 ); + public static Color Aquamarine = new Color( 127, 255, 212 ); + public static Color Azure = new Color( 240, 255, 255 ); + public static Color Beige = new Color( 245, 245, 220 ); + public static Color Bisque = new Color( 255, 228, 196 ); + public static Color Black = new Color( 0, 0, 0 ); + public static Color BlanchedAlmond = new Color( 255, 235, 205 ); + public static Color Blue = new Color( 0, 0, 255 ); + public static Color BlueViolet = new Color( 138, 43, 226 ); + public static Color Brown = new Color( 165, 42, 42 ); + public static Color BurlyWood = new Color( 222, 184, 135 ); + public static Color CadetBlue = new Color( 95, 158, 160 ); + public static Color Chartreuse = new Color( 127, 255, 0 ); + public static Color Chocolate = new Color( 210, 105, 30 ); + public static Color Coral = new Color( 255, 127, 80 ); + public static Color CornflowerBlue = new Color( 100, 149, 237 ); + public static Color Cornsilk = new Color( 255, 248, 220 ); + public static Color Crimson = new Color( 220, 20, 60 ); + public static Color Cyan = new Color( 0, 255, 255 ); + public static Color DarkBlue = new Color( 0, 0, 139 ); + public static Color DarkCyan = new Color( 0, 139, 139 ); + public static Color DarkGoldenrod = new Color( 184, 134, 11 ); + public static Color DarkGray = new Color( 169, 169, 169 ); + public static Color DarkGreen = new Color( 0, 100, 0 ); + public static Color DarkKhaki = new Color( 189, 183, 107 ); + public static Color DarkMagenta = new Color( 139, 0, 139 ); + public static Color DarkOliveGreen = new Color( 85, 107, 47 ); + public static Color DarkOrange = new Color( 255, 140, 0 ); + public static Color DarkOrchid = new Color( 153, 50, 204 ); + public static Color DarkRed = new Color( 139, 0, 0 ); + public static Color DarkSalmon = new Color( 233, 150, 122 ); + public static Color DarkSeaGreen = new Color( 143, 188, 139 ); + public static Color DarkSlateBlue = new Color( 72, 61, 139 ); + public static Color DarkSlateGray = new Color( 47, 79, 79 ); + public static Color DarkTurquoise = new Color( 0, 206, 209 ); + public static Color DarkViolet = new Color( 148, 0, 211 ); + public static Color DeepPink = new Color( 255, 20, 147 ); + public static Color DeepSkyBlue = new Color( 0, 191, 255 ); + public static Color DimGray = new Color( 105, 105, 105 ); + public static Color DodgerBlue = new Color( 30, 144, 255 ); + public static Color Firebrick = new Color( 178, 34, 34 ); + public static Color FloralWhite = new Color( 255, 250, 240 ); + public static Color ForestGreen = new Color( 34, 139, 34 ); + public static Color Fuchsia = new Color( 255, 0, 255 ); + public static Color Gainsboro = new Color( 220, 220, 220 ); + public static Color GhostWhite = new Color( 248, 248, 255 ); + public static Color Gold = new Color( 255, 215, 0 ); + public static Color Goldenrod = new Color( 218, 165, 32 ); + public static Color Gray = new Color( 128, 128, 128 ); + public static Color Green = new Color( 0, 128, 0 ); + public static Color GreenYellow = new Color( 173, 255, 47 ); + public static Color Honeydew = new Color( 240, 255, 240 ); + public static Color HotPink = new Color( 255, 105, 180 ); + public static Color IndianRed = new Color( 205, 92, 92 ); + public static Color Indigo = new Color( 75, 0, 130 ); + public static Color Ivory = new Color( 255, 255, 240 ); + public static Color Khaki = new Color( 240, 230, 140 ); + public static Color Lavender = new Color( 230, 230, 250 ); + public static Color LavenderBlush = new Color( 255, 240, 245 ); + public static Color LawnGreen = new Color( 124, 252, 0 ); + public static Color LemonChiffon = new Color( 255, 250, 205 ); + public static Color LightBlue = new Color( 173, 216, 230 ); + public static Color LightCoral = new Color( 240, 128, 128 ); + public static Color LightCyan = new Color( 224, 255, 255 ); + public static Color LightGoldenrodYellow = new Color( 250, 250, 210 ); + public static Color LightGreen = new Color( 144, 238, 144 ); + public static Color LightGray = new Color( 211, 211, 211 ); + public static Color LightPink = new Color( 255, 182, 193 ); + public static Color LightSalmon = new Color( 255, 160, 122 ); + public static Color LightSeaGreen = new Color( 32, 178, 170 ); + public static Color LightSkyBlue = new Color( 135, 206, 250 ); + public static Color LightSlateGray = new Color( 119, 136, 153 ); + public static Color LightSteelBlue = new Color( 176, 196, 222 ); + public static Color LightYellow = new Color( 255, 255, 224 ); + public static Color Lime = new Color( 0, 255, 0 ); + public static Color LimeGreen = new Color( 50, 205, 50 ); + public static Color Linen = new Color( 250, 240, 230 ); + public static Color Magenta = new Color( 255, 0, 255 ); + public static Color Maroon = new Color( 128, 0, 0 ); + public static Color MediumAquamarine = new Color( 102, 205, 170 ); + public static Color MediumBlue = new Color( 0, 0, 205 ); + public static Color MediumOrchid = new Color( 186, 85, 211 ); + public static Color MediumPurple = new Color( 147, 112, 219 ); + public static Color MediumSeaGreen = new Color( 60, 179, 113 ); + public static Color MediumSlateBlue = new Color( 123, 104, 238 ); + public static Color MediumSpringGreen = new Color( 0, 250, 154 ); + public static Color MediumTurquoise = new Color( 72, 209, 204 ); + public static Color MediumVioletRed = new Color( 199, 21, 133 ); + public static Color MidnightBlue = new Color( 25, 25, 112 ); + public static Color MintCream = new Color( 245, 255, 250 ); + public static Color MistyRose = new Color( 255, 228, 225 ); + public static Color Moccasin = new Color( 255, 228, 181 ); + public static Color NavajoWhite = new Color( 255, 222, 173 ); + public static Color Navy = new Color( 0, 0, 128 ); + public static Color OldLace = new Color( 253, 245, 230 ); + public static Color Olive = new Color( 128, 128, 0 ); + public static Color OliveDrab = new Color( 107, 142, 35 ); + public static Color Orange = new Color( 255, 165, 0 ); + public static Color OrangeRed = new Color( 255, 69, 0 ); + public static Color Orchid = new Color( 218, 112, 214 ); + public static Color PaleGoldenrod = new Color( 238, 232, 170 ); + public static Color PaleGreen = new Color( 152, 251, 152 ); + public static Color PaleTurquoise = new Color( 175, 238, 238 ); + public static Color PaleVioletRed = new Color( 219, 112, 147 ); + public static Color PapayaWhip = new Color( 255, 239, 213 ); + public static Color PeachPuff = new Color( 255, 218, 185 ); + public static Color Peru = new Color( 205, 133, 63 ); + public static Color Pink = new Color( 255, 192, 203 ); + public static Color Plum = new Color( 221, 160, 221 ); + public static Color PowderBlue = new Color( 176, 224, 230 ); + public static Color Purple = new Color( 128, 0, 128 ); + public static Color Red = new Color( 255, 0, 0 ); + public static Color RosyBrown = new Color( 188, 143, 143 ); + public static Color RoyalBlue = new Color( 65, 105, 225 ); + public static Color SaddleBrown = new Color( 139, 69, 19 ); + public static Color Salmon = new Color( 250, 128, 114 ); + public static Color SandyBrown = new Color( 244, 164, 96 ); + public static Color SeaGreen = new Color( 46, 139, 87 ); + public static Color SeaShell = new Color( 255, 245, 238 ); + public static Color Sienna = new Color( 160, 82, 45 ); + public static Color Silver = new Color( 192, 192, 192 ); + public static Color SkyBlue = new Color( 135, 206, 235 ); + public static Color SlateBlue = new Color( 106, 90, 205 ); + public static Color SlateGray = new Color( 112, 128, 144 ); + public static Color Snow = new Color( 255, 250, 250 ); + public static Color SpringGreen = new Color( 0, 255, 127 ); + public static Color SteelBlue = new Color( 70, 130, 180 ); + public static Color Tan = new Color( 210, 180, 140 ); + public static Color Teal = new Color( 0, 128, 128 ); + public static Color Thistle = new Color( 216, 191, 216 ); + public static Color Tomato = new Color( 255, 99, 71 ); + public static Color Turquoise = new Color( 64, 224, 208 ); + public static Color Violet = new Color( 238, 130, 238 ); + public static Color Wheat = new Color( 245, 222, 179 ); + public static Color White = new Color( 255, 255, 255 ); + public static Color WhiteSmoke = new Color( 245, 245, 245 ); + public static Color Yellow = new Color( 255, 255, 0 ); + public static Color YellowGreen = new Color( 154, 205, 50 ); + +#if JAVA + static{ + s_instance = new PortUtil(); + Toolkit.getDefaultToolkit().addAWTEventListener( s_instance, AWTEvent.KEY_EVENT_MASK ); + } +#else + static PortUtil() { + } +#endif + + private PortUtil() { + } + + public static double getCurrentTime() { +#if JAVA + return new Date().getTime(); +#else + return DateTime.Now.Ticks * 100.0 / 1e9; +#endif + } + +#if JAVA + public void eventDispatched( AWTEvent e ){ + if( e instanceof KeyEvent ){ + KeyEvent ke = (KeyEvent)e; + int code = ke.getKeyCode(); + int id = ke.getID(); + if( id == KeyEvent.KEY_PRESSED ){ + if( code == KeyEvent.VK_ALT ){ + s_alt = true; + }else if( code == KeyEvent.VK_CONTROL ){ + s_ctrl = true; + }else if( code == KeyEvent.VK_SHIFT ){ + s_shift = true; + } + }else if( id == KeyEvent.KEY_RELEASED ){ + if( code == KeyEvent.VK_ALT ){ + s_alt = false; + }else if( code == KeyEvent.VK_CONTROL ){ + s_ctrl = false; + }else if( code == KeyEvent.VK_SHIFT ){ + s_shift = false; + } + } + } + } + + public static int getCurrentModifierKey() { + int ret = 0; + if( s_ctrl ){ + ret += InputEvent.CTRL_MASK; + } + if( s_alt ){ + ret += InputEvent.ALT_MASK; + } + if( s_shift ){ + ret += InputEvent.SHIFT_MASK; + } + return ret; + } +#else + public static int getCurrentModifierKey() { + int ret = 0; + System.Windows.Forms.Keys k = System.Windows.Forms.Control.ModifierKeys; + if ( (k & System.Windows.Forms.Keys.Control) == System.Windows.Forms.Keys.Control ) { + ret += InputEvent.CTRL_MASK; + } + if ( (k & System.Windows.Forms.Keys.Alt) == System.Windows.Forms.Keys.Alt ) { + ret += InputEvent.ALT_MASK; + } + if ( (k & System.Windows.Forms.Keys.Shift) == System.Windows.Forms.Keys.Shift ) { + ret += InputEvent.SHIFT_MASK; + } + return ret; + } +#endif + +#if JAVA + public static Rectangle getScreenBounds( Component w ){ + return w.getGraphicsConfiguration().getBounds(); + } +#else + public static Rectangle getScreenBounds( System.Windows.Forms.Control w ) { + System.Drawing.Rectangle rc = System.Windows.Forms.Screen.GetWorkingArea( w ); + return new Rectangle( rc.X, rc.Y, rc.Width, rc.Height ); + } +#endif + + #region Clipboard + public static void setClipboardText( String value ) { +#if JAVA + Clipboard clip = Toolkit.getDefaultToolkit().getSystemClipboard(); + clip.setContents( new StringSelection( value ), null ); +#else + System.Windows.Forms.Clipboard.SetText( value ); +#endif + } + + public static void clearClipboard() { +#if JAVA + Clipboard clip = Toolkit.getDefaultToolkit().getSystemClipboard(); + clip.setContents( new StringSelection( null ), null ); +#else + System.Windows.Forms.Clipboard.Clear(); +#endif + } + + public static boolean isClipboardContainsText() { +#if JAVA + Clipboard clip = Toolkit.getDefaultToolkit().getSystemClipboard(); + Transferable data = clip.getContents( null ); + + if( data == null || !data.isDataFlavorSupported( DataFlavor.stringFlavor ) ){ + return true; + }else{ + return false; + } +#else + return System.Windows.Forms.Clipboard.ContainsText(); +#endif + } + + public static String getClipboardText() { +#if JAVA + Clipboard clip = Toolkit.getDefaultToolkit().getSystemClipboard(); + Transferable data = clip.getContents( null ); + + String str = null; + if( data == null || !data.isDataFlavorSupported( DataFlavor.stringFlavor ) ){ + str = null; + }else{ + try { + str = (String)data.getTransferData( DataFlavor.stringFlavor ); + }catch( Exception e ){ + str = null; + } + } + return str; +#else + return System.Windows.Forms.Clipboard.GetText(); +#endif + } + #endregion + + #region BitConverter + + public static byte[] getbytes_int64_le( long data ) { +#if JAVA + byte[] dat = new byte[8]; + dat[0] = (byte)(data & (byte)0xff); + data = (data >>> 8); + dat[1] = (byte)(data & (byte)0xff); + data = (data >>> 8); + dat[2] = (byte)(data & (byte)0xff); + data = (data >>> 8); + dat[3] = (byte)(data & (byte)0xff); + data = (data >>> 8); + dat[4] = (byte)(data & (byte)0xff); + data = (data >>> 8); + dat[5] = (byte)(data & (byte)0xff); + data = (data >>> 8); + dat[6] = (byte)(data & (byte)0xff); + data = (data >>> 8); + dat[7] = (byte)(data & (byte)0xff); + return dat; +#else + byte[] dat = new byte[8]; + dat[0] = (byte)(data & (byte)0xff); + data = (data >> 8); + dat[1] = (byte)(data & (byte)0xff); + data = (data >> 8); + dat[2] = (byte)(data & (byte)0xff); + data = (data >> 8); + dat[3] = (byte)(data & (byte)0xff); + data = (data >> 8); + dat[4] = (byte)(data & (byte)0xff); + data = (data >> 8); + dat[5] = (byte)(data & (byte)0xff); + data = (data >> 8); + dat[6] = (byte)(data & (byte)0xff); + data = (data >> 8); + dat[7] = (byte)(data & (byte)0xff); + return dat; +#endif + } + + public static byte[] getbytes_uint32_le( long data ) { +#if JAVA + byte[] dat = new byte[4]; + data = 0xffffffff & data; + dat[0] = (byte)(data & (byte)0xff); + data = (data >>> 8); + dat[1] = (byte)(data & (byte)0xff); + data = (data >>> 8); + dat[2] = (byte)(data & (byte)0xff); + data = (data >>> 8); + dat[3] = (byte)(data & (byte)0xff); + return dat; +#else + byte[] dat = new byte[4]; + data = 0xffffffff & data; + dat[0] = (byte)(data & (byte)0xff); + data = (data >> 8); + dat[1] = (byte)(data & (byte)0xff); + data = (data >> 8); + dat[2] = (byte)(data & (byte)0xff); + data = (data >> 8); + dat[3] = (byte)(data & (byte)0xff); + return dat; +#endif + } + + public static byte[] getbytes_int32_le( int data ) { + long v = data; + if ( v < 0 ) { + v += 4294967296L; + } + return getbytes_uint32_le( v ); + } + + public static byte[] getbytes_int64_be( long data ) { +#if JAVA + byte[] dat = new byte[8]; + dat[7] = (byte)(data & (byte)0xff); + data = (data >>> 8); + dat[6] = (byte)(data & (byte)0xff); + data = (data >>> 8); + dat[5] = (byte)(data & (byte)0xff); + data = (data >>> 8); + dat[4] = (byte)(data & (byte)0xff); + data = (data >>> 8); + dat[3] = (byte)(data & (byte)0xff); + data = (data >>> 8); + dat[2] = (byte)(data & (byte)0xff); + data = (data >>> 8); + dat[1] = (byte)(data & (byte)0xff); + data = (data >>> 8); + dat[0] = (byte)(data & (byte)0xff); + return dat; +#else + byte[] dat = new byte[8]; + dat[7] = (byte)(data & (byte)0xff); + data = (data >> 8); + dat[6] = (byte)(data & (byte)0xff); + data = (data >> 8); + dat[5] = (byte)(data & (byte)0xff); + data = (data >> 8); + dat[4] = (byte)(data & (byte)0xff); + data = (data >> 8); + dat[3] = (byte)(data & (byte)0xff); + data = (data >> 8); + dat[2] = (byte)(data & (byte)0xff); + data = (data >> 8); + dat[1] = (byte)(data & (byte)0xff); + data = (data >> 8); + dat[0] = (byte)(data & (byte)0xff); + return dat; +#endif + } + + public static byte[] getbytes_uint32_be( long data ) { +#if JAVA + byte[] dat = new byte[4]; + data = 0xffffffff & data; + dat[3] = (byte)(data & (byte)0xff); + data = (data >>> 8); + dat[2] = (byte)(data & (byte)0xff); + data = (data >>> 8); + dat[1] = (byte)(data & (byte)0xff); + data = (data >>> 8); + dat[0] = (byte)(data & (byte)0xff); + return dat; +#else + byte[] dat = new byte[4]; + data = 0xffffffff & data; + dat[3] = (byte)(data & (byte)0xff); + data = data >> 8; + dat[2] = (byte)(data & (byte)0xff); + data = data >> 8; + dat[1] = (byte)(data & (byte)0xff); + data = data >> 8; + dat[0] = (byte)(data & (byte)0xff); + return dat; +#endif + } + + public static byte[] getbytes_int16_le( short data ) { + int i = data; + if ( i < 0 ) { + i += 65536; + } + return getbytes_uint16_le( i ); + } + + /// + /// compatible to BitConverter + /// + /// + /// + public static byte[] getbytes_uint16_le( int data ) { + byte[] dat = new byte[2]; +#if JAVA + dat[0] = (byte)(data & (byte)0xff); + data = (byte)(data >>> 8); + dat[1] = (byte)(data & (byte)0xff); +#else + dat[0] = (byte)(data & (byte)0xff); + data = (byte)(data >> 8); + dat[1] = (byte)(data & (byte)0xff); +#endif + return dat; + } + + public static byte[] getbytes_uint16_be( int data ) { + byte[] dat = new byte[2]; +#if JAVA + dat[1] = (byte)(data & (byte)0xff); + data = (byte)(data >>> 8); + dat[0] = (byte)(data & (byte)0xff); +#else + dat[1] = (byte)(data & (byte)0xff); + data = (byte)(data >> 8); + dat[0] = (byte)(data & (byte)0xff); +#endif + return dat; + } + + public static long make_int64_le( byte[] buf ) { + return (long)((long)((long)((long)((long)((long)((long)((long)((long)(((buf[7] << 8) | buf[6]) << 8) | buf[5]) << 8) | buf[4]) << 8) | buf[3]) << 8 | buf[2]) << 8) | buf[1]) << 8 | buf[0]; + } + + public static long make_int64_be( byte[] buf ) { + return (long)((long)((long)((long)((long)((long)((long)((long)((long)(((buf[0] << 8) | buf[1]) << 8) | buf[2]) << 8) | buf[3]) << 8) | buf[4]) << 8 | buf[5]) << 8) | buf[6]) << 8 | buf[7]; + } + + public static long make_uint32_le( byte[] buf ) { + return (long)((long)((long)((long)((buf[3] << 8) | buf[2]) << 8) | buf[1]) << 8) | buf[0]; + } + + public static long make_uint32_be( byte[] buf ) { + return (long)((long)((long)((long)((buf[0] << 8) | buf[1]) << 8) | buf[2]) << 8) | buf[3]; + } + + public static int make_int32_le( byte[] buf ) { + long v = make_uint32_le( buf ); + if ( v >= 2147483647L ) { + v -= 4294967296L; + } + return (int)v; + } + + /// + /// compatible to BitConverter + /// + /// + /// + public static int make_uint16_le( byte[] buf ) { + return (int)((int)(buf[1] << 8) | buf[0]); + } + + public static int make_uint16_be( byte[] buf ) { + return (int)((int)(buf[0] << 8) | buf[1]); + } + + /// + /// compatible to BitConverter + /// + /// + /// + public static short make_int16_le( byte[] buf ) { + int i = make_uint16_le( buf ); + if ( i >= 32768 ) { + i = i - 65536; + } + return (short)i; + } + #endregion + + #region System.Windows.Forms.Keys and bocoree.windows.forms.BKeys +#if !JAVA + public static int getModifierFromKeys( System.Windows.Forms.Keys keys ) { + int ret = 0; + if ( (keys & System.Windows.Forms.Keys.Control) == System.Windows.Forms.Keys.Control ) { + ret += InputEvent.CTRL_MASK; + } + if ( (keys & System.Windows.Forms.Keys.Alt) == System.Windows.Forms.Keys.Alt ) { + ret += InputEvent.ALT_MASK; + } + if ( (keys & System.Windows.Forms.Keys.Shift) == System.Windows.Forms.Keys.Shift ) { + ret += InputEvent.SHIFT_MASK; + } + return ret; + } +#endif + + public static KeyStroke getKeyStrokeFromBKeys( BKeys[] keys ) { + int modifier = 0; + int keycode = KeyEvent.VK_UNDEFINED; + for ( int i = 0; i < keys.Length; i++ ) { + if ( keys[i] == BKeys.Alt ) { + modifier += InputEvent.ALT_MASK; + } else if ( keys[i] == BKeys.Control ) { + modifier += InputEvent.CTRL_MASK; + } else if ( keys[i] == BKeys.Shift ) { + modifier += InputEvent.SHIFT_MASK; + } else { +#if JAVA + keycode = keys[i].getValue(); +#else + keycode = (int)keys[i]; +#endif + } + } + return KeyStroke.getKeyStroke( keycode, modifier ); + } + + public static BKeys[] getBKeysFromKeyStroke( KeyStroke stroke ) { + Vector ret = new Vector(); + int keycodes = stroke.getKeyCode(); + int modifier = stroke.getModifiers(); + ret.add( getBKeysFromKeyCode( keycodes ) ); + if ( (modifier & InputEvent.ALT_MASK) == InputEvent.ALT_MASK ) { + ret.add( BKeys.Alt ); + } + if ( (modifier & InputEvent.CTRL_MASK) == InputEvent.CTRL_MASK ) { + ret.add( BKeys.Control ); + } + if ( (modifier & InputEvent.SHIFT_MASK) == InputEvent.SHIFT_MASK ) { + ret.add( BKeys.Shift ); + } + return ret.toArray( new BKeys[] { } ); + } + + public static int getKeyCodeFromBKeys( BKeys keys ) { +#if JAVA + return keys.getValue(); +#else + return (int)keys; +#endif + } + + public static BKeys getBKeysFromKeyCode( int code ) { + switch ( code ) { + case KeyEvent.VK_UNDEFINED: + return BKeys.None; + case KeyEvent.KEY_LOCATION_STANDARD: + return BKeys.LButton; + case KeyEvent.KEY_LOCATION_LEFT: + return BKeys.RButton; + case KeyEvent.VK_CANCEL: + return BKeys.Cancel; + case KeyEvent.KEY_LOCATION_NUMPAD: + return BKeys.MButton; + case KeyEvent.VK_BACK_SPACE: + return BKeys.Back; + case KeyEvent.VK_TAB: + return BKeys.Tab; + case KeyEvent.VK_ENTER: + return BKeys.LineFeed; + case KeyEvent.VK_CLEAR: + return BKeys.Clear; + case KeyEvent.VK_SHIFT: + return BKeys.ShiftKey; + case KeyEvent.VK_CONTROL: + return BKeys.ControlKey; + case KeyEvent.VK_ALT: + return BKeys.Menu; + case KeyEvent.VK_PAUSE: + return BKeys.Pause; + case KeyEvent.VK_CAPS_LOCK: + return BKeys.CapsLock; + case KeyEvent.VK_KANA: + return BKeys.KanaMode; + case KeyEvent.VK_FINAL: + return BKeys.FinalMode; + case KeyEvent.VK_KANJI: + return BKeys.KanjiMode; + case KeyEvent.VK_ESCAPE: + return BKeys.Escape; + case KeyEvent.VK_CONVERT: + return BKeys.IMEConvert; + case KeyEvent.VK_NONCONVERT: + return BKeys.IMENonconvert; + case KeyEvent.VK_ACCEPT: + return BKeys.IMEAccept; + case KeyEvent.VK_MODECHANGE: + return BKeys.IMEModeChange; + case KeyEvent.VK_SPACE: + return BKeys.Space; + case KeyEvent.VK_PAGE_UP: + return BKeys.PageUp; + case KeyEvent.VK_PAGE_DOWN: + return BKeys.PageDown; + case KeyEvent.VK_END: + return BKeys.End; + case KeyEvent.VK_HOME: + return BKeys.Home; + case KeyEvent.VK_LEFT: + return BKeys.Left; + case KeyEvent.VK_UP: + return BKeys.Up; + case KeyEvent.VK_RIGHT: + return BKeys.Right; + case KeyEvent.VK_DOWN: + return BKeys.Down; + case KeyEvent.VK_0: + return BKeys.D0; + case KeyEvent.VK_1: + return BKeys.D1; + case KeyEvent.VK_2: + return BKeys.D2; + case KeyEvent.VK_3: + return BKeys.D3; + case KeyEvent.VK_4: + return BKeys.D4; + case KeyEvent.VK_5: + return BKeys.D5; + case KeyEvent.VK_6: + return BKeys.D6; + case KeyEvent.VK_7: + return BKeys.D7; + case KeyEvent.VK_8: + return BKeys.D8; + case KeyEvent.VK_9: + return BKeys.D9; + case KeyEvent.VK_A: + return BKeys.A; + case KeyEvent.VK_B: + return BKeys.B; + case KeyEvent.VK_C: + return BKeys.C; + case KeyEvent.VK_D: + return BKeys.D; + case KeyEvent.VK_E: + return BKeys.E; + case KeyEvent.VK_F: + return BKeys.F; + case KeyEvent.VK_G: + return BKeys.G; + case KeyEvent.VK_H: + return BKeys.H; + case KeyEvent.VK_I: + return BKeys.I; + case KeyEvent.VK_J: + return BKeys.J; + case KeyEvent.VK_K: + return BKeys.K; + case KeyEvent.VK_L: + return BKeys.L; + case KeyEvent.VK_M: + return BKeys.M; + case KeyEvent.VK_N: + return BKeys.N; + case KeyEvent.VK_O: + return BKeys.O; + case KeyEvent.VK_P: + return BKeys.P; + case KeyEvent.VK_Q: + return BKeys.Q; + case KeyEvent.VK_R: + return BKeys.R; + case KeyEvent.VK_S: + return BKeys.S; + case KeyEvent.VK_T: + return BKeys.T; + case KeyEvent.VK_U: + return BKeys.U; + case KeyEvent.VK_V: + return BKeys.V; + case KeyEvent.VK_W: + return BKeys.W; + case KeyEvent.VK_X: + return BKeys.X; + case KeyEvent.VK_Y: + return BKeys.Y; + case KeyEvent.VK_Z: + return BKeys.Z; + case KeyEvent.VK_OPEN_BRACKET: + return BKeys.LWin; + case KeyEvent.VK_BACK_SLASH: + return BKeys.RWin; + case KeyEvent.VK_CLOSE_BRACKET: + return BKeys.Apps; + case KeyEvent.VK_NUMPAD0: + return BKeys.NumPad0; + case KeyEvent.VK_NUMPAD1: + return BKeys.NumPad1; + case KeyEvent.VK_NUMPAD2: + return BKeys.NumPad2; + case KeyEvent.VK_NUMPAD3: + return BKeys.NumPad3; + case KeyEvent.VK_NUMPAD4: + return BKeys.NumPad4; + case KeyEvent.VK_NUMPAD5: + return BKeys.NumPad5; + case KeyEvent.VK_NUMPAD6: + return BKeys.NumPad6; + case KeyEvent.VK_NUMPAD7: + return BKeys.NumPad7; + case KeyEvent.VK_NUMPAD8: + return BKeys.NumPad8; + case KeyEvent.VK_NUMPAD9: + return BKeys.NumPad9; + case KeyEvent.VK_MULTIPLY: + return BKeys.Multiply; + case KeyEvent.VK_ADD: + return BKeys.Add; + case KeyEvent.VK_SEPARATOR: + return BKeys.Separator; + case KeyEvent.VK_SUBTRACT: + return BKeys.Subtract; + case KeyEvent.VK_DECIMAL: + return BKeys.Decimal; + case KeyEvent.VK_DIVIDE: + return BKeys.Divide; + case KeyEvent.VK_F1: + return BKeys.F1; + case KeyEvent.VK_F2: + return BKeys.F2; + case KeyEvent.VK_F3: + return BKeys.F3; + case KeyEvent.VK_F4: + return BKeys.F4; + case KeyEvent.VK_F5: + return BKeys.F5; + case KeyEvent.VK_F6: + return BKeys.F6; + case KeyEvent.VK_F7: + return BKeys.F7; + case KeyEvent.VK_F8: + return BKeys.F8; + case KeyEvent.VK_F9: + return BKeys.F9; + case KeyEvent.VK_F10: + return BKeys.F10; + case KeyEvent.VK_F11: + return BKeys.F11; + case KeyEvent.VK_F12: + return BKeys.F12; + case KeyEvent.VK_DELETE: + return BKeys.F16; + case KeyEvent.VK_DEAD_GRAVE: + return BKeys.F17; + case KeyEvent.VK_DEAD_ACUTE: + return BKeys.F18; + case KeyEvent.VK_DEAD_CIRCUMFLEX: + return BKeys.F19; + case KeyEvent.VK_DEAD_TILDE: + return BKeys.F20; + case KeyEvent.VK_DEAD_MACRON: + return BKeys.F21; + case KeyEvent.VK_DEAD_BREVE: + return BKeys.F22; + case KeyEvent.VK_DEAD_ABOVEDOT: + return BKeys.F23; + case KeyEvent.VK_DEAD_DIAERESIS: + return BKeys.F24; + case KeyEvent.VK_NUM_LOCK: + return BKeys.NumLock; + case KeyEvent.VK_SCROLL_LOCK: + return BKeys.Scroll; + case KeyEvent.VK_GREATER: + return BKeys.LShiftKey; + case KeyEvent.VK_BRACELEFT: + return BKeys.RShiftKey; + case KeyEvent.VK_BRACERIGHT: + return BKeys.LControlKey; + case KeyEvent.VK_BACK_QUOTE: + return BKeys.Oemtilde; + case KeyEvent.VK_QUOTE: + return BKeys.OemQuotes; + } + return BKeys.None; + } + #endregion + + #region Graphics extension + public static void drawBezier( Graphics2D g, float x1, float y1, + float ctrlx1, float ctrly1, + float ctrlx2, float ctrly2, + float x2, float y2 ) { +#if JAVA + g.draw( new CubicCurve2D.Float( x1, y1, ctrlx1, ctrly1, ctrlx2, ctrly2, x2, y2 ) ); +#else + Stroke stroke = g.getStroke(); + System.Drawing.Pen pen = null; + if ( stroke is BasicStroke ) { + pen = ((BasicStroke)stroke).pen; + } else { + pen = new System.Drawing.Pen( System.Drawing.Color.Black ); + } + g.nativeGraphics.DrawBezier( pen, new System.Drawing.PointF( x1, y1 ), + new System.Drawing.PointF( ctrlx1, ctrly1 ), + new System.Drawing.PointF( ctrlx2, ctrly2 ), + new System.Drawing.PointF( x2, y2 ) ); +#endif + } + + public static void drawStringEx( Graphics2D g, String s, Font font, Rectangle rect, int align, int valign ) { +#if JAVA + g.setFont( font ); + FontMetrics fm = g.getFontMetrics(); + Dimension ret = new Dimension( fm.stringWidth( s ), fm.getHeight() ); + float x = 0; + float y = 0; + if( align > 0 ){ + x = rect.x + rect.width - ret.width; + }else if( align < 0 ){ + x = rect.x; + }else{ + x = rect.x + rect.width / 2.0f - ret.width / 2.0f; + } + if( valign > 0 ){ + y = rect.y + rect.height - ret.height; + }else if( valign < 0 ){ + y = rect.y; + }else{ + y = rect.y + rect.height / 2.0f - ret.height / 2.0f; + } + g.drawString( s, x, y ); +#else + System.Drawing.StringFormat sf = new System.Drawing.StringFormat(); + if ( align > 0 ) { + sf.Alignment = System.Drawing.StringAlignment.Far; + } else if ( align < 0 ) { + sf.Alignment = System.Drawing.StringAlignment.Near; + } else { + sf.Alignment = System.Drawing.StringAlignment.Center; + } + if ( valign > 0 ) { + sf.LineAlignment = System.Drawing.StringAlignment.Far; + } else if ( valign < 0 ) { + sf.LineAlignment = System.Drawing.StringAlignment.Near; + } else { + sf.LineAlignment = System.Drawing.StringAlignment.Center; + } + g.nativeGraphics.DrawString( s, font.font, g.brush, new System.Drawing.RectangleF( rect.x, rect.y, rect.width, rect.height ), sf ); +#endif + } + #endregion + + #region System.IO + public static long getFileLength( String fpath ) { +#if JAVA + File f = new File( fpath ); + return f.length(); +#else + return new FileInfo( fpath ).Length; +#endif + } + + public static String getExtension( String fpath ) { +#if JAVA + String name = (new File( fpath )).getName(); + int index = name.lastIndexOf( '.' ); + if( index <= 0 ){ + return ""; + }else{ + return name.substring( index ); + } +#else + return Path.GetExtension( fpath ); +#endif + } + + public static String getFileName( String path ) { +#if JAVA + File f = new File( path ); + return f.getName(); +#else + return Path.GetFileName( path ); +#endif + } + + public static String getDirectoryName( String path ) { +#if JAVA + File f = new File( path ); + return f.getParent(); +#else + return System.IO.Path.GetDirectoryName( path ); +#endif + } + + public static String getFileNameWithoutExtension( String path ) { +#if JAVA + String file = getFileName( path ); + int index = file.lastIndexOf( file ); + if( index > 0 ){ + file = file.substring( 0, index ); + } + return file; +#else + return System.IO.Path.GetFileNameWithoutExtension( path ); +#endif + } + + public static String createTempFile() { +#if JAVA + String ret = ""; + try{ + File.createTempFile( "tmp", "" ).getAbsolutePath(); + }catch( Exception ex ){ + System.out.println( "PortUtil#createTempFile; ex=" + ex ); + } + return ret; +#else + return System.IO.Path.GetTempFileName(); +#endif + } + + public static String[] listFiles( String directory, String extension ) { +#if JAVA + File f = new File( directory ); + File[] list = f.listFiles(); + Vector ret = new Vector(); + for( int i = 0; i < list.length; i++ ){ + File t = list[i]; + if( !t.isDirectory() ){ + String name = t.getName(); + if( name.endsWith( extension ) ){ + ret.add( name ); + } + } + } + return ret.toArray( new String[]{} ); +#else + return System.IO.Directory.GetFiles( directory, "*" + extension ); +#endif + } + + public static void deleteFile( String path ) { +#if JAVA + new File( path ).delete(); +#else + System.IO.File.Delete( path ); +#endif + } + + public static boolean isDirectoryExists( String path ) { +#if JAVA + File f = new File( path ); + if( f.exists() ){ + if( f.isFile() ){ + return true; + }else{ + return false; + } + }else{ + return false; + } +#else + return Directory.Exists( path ); +#endif + } + + public static boolean isFileExists( String path ) { +#if JAVA + return (new File( path )).exists(); +#else + return System.IO.File.Exists( path ); +#endif + } + + public static String combinePath( String path1, String path2 ) { +#if JAVA + if( path1.endsWith( File.separator ) ){ + path1 = path1.substring( 0, path1.length() - 1 ); + } + if( path2.startsWith( File.separator ) ){ + path2 = path2.substring( 1 ); + } + return path1 + File.separator + path2; +#else + return System.IO.Path.Combine( path1, path2 ); +#endif + } + + public static String getTempPath() { +#if JAVA + return System.getProperty( "java.io.tmpdir" ); +#else + return Path.GetTempPath(); +#endif + } + + public static void createDirectory( String path ) { +#if JAVA + File f = new File( path ); + f.mkdir(); +#else + Directory.CreateDirectory( path ); +#endif + } + + public static void deleteDirectory( String path, boolean recurse ) { +#if JAVA + File f = new File( path ); + File[] list = f.listFiles(); + for( int i = 0; i < list.length; i++ ){ + File f0 = new File( combinePath( path, list[i].getName() ) ); + if( f0.isDirectory() ){ + deleteDirectory( f0.getPath(), true ); + }else{ + f0.delete(); + } + } +#else + Directory.Delete( path, recurse ); +#endif + } + + public static void deleteDirectory( String path ) { +#if JAVA + (new File( path )).delete(); +#else + Directory.Delete( path ); +#endif + } + + public static void copyFile( String file1, String file2 ) +#if JAVA + throws FileNotFoundException, IOException +#endif + { +#if JAVA + FileChannel sourceChannel = new FileInputStream( new File( file1 ) ).getChannel(); + FileChannel destinationChannel = new FileOutputStream( new File( file2 ) ).getChannel(); + sourceChannel.transferTo( 0, sourceChannel.size(), destinationChannel ); + sourceChannel.close(); + destinationChannel.close(); +#else + File.Copy( file1, file2 ); +#endif + } + #endregion + + #region Number Formatting + public static boolean tryParseInt( String s, ByRef value ) { + try { + value.value = parseInt( s ); + } catch ( Exception ex ) { + return false; + } + return true; + } + + public static boolean tryParseFloat( String s, ByRef value ) { + try { + value.value = parseFloat( s ); + } catch ( Exception ex ) { + return false; + } + return true; + } + + public static int parseInt( String value ) { +#if JAVA + return Integer.parseInt( value ); +#else + return int.Parse( value ); +#endif + } + + public static float parseFloat( String value ) { +#if JAVA + return Float.parseFloat( value ); +#else + return float.Parse( value ); +#endif + } + + public static double parseDouble( String value ) { +#if JAVA + return Double.parseDouble( value ); +#else + return double.Parse( value ); +#endif + } + + public static String formatDecimal( String format, double value ) { +#if JAVA + DecimalFormat df = new DecimalFormat( format ); + return df.format( value ); +#else + return value.ToString( format ); +#endif + } + + public static String formatDecimal( String format, long value ) { +#if JAVA + DecimalFormat df = new DecimalFormat( format ); + return df.format( value ); +#else + return value.ToString( format ); +#endif + } + + public static String toHexString( long value, int digits ) { + String ret = toHexString( value ); + int add = 4 - getStringLength( ret ); + for ( int i = 0; i < add; i++ ) { + ret = "0" + ret; + } + return ret; + } + + public static String toHexString( long value ) { +#if JAVA + return Long.toHexString( value ); +#else + return Convert.ToString( value, 16 ); +#endif + } + + public static long fromHexString( String s ) { +#if JAVA + return Long.parseLong( s, 16 ); +#else + return Convert.ToInt64( s, 16 ); +#endif + } + #endregion + + #region String Utility +#if JAVA + public static String[] splitString( String s, char... separator ) { +#else + public static String[] splitString( String s, params char[] separator ) { +#endif + return splitStringCorB( s, separator, int.MaxValue, false ); + } + + public static String[] splitString( String s, char[] separator, int count ) { + return splitStringCorB( s, separator, count, false ); + } + + public static String[] splitString( String s, char[] separator, boolean ignore_empty_entries ) { + return splitStringCorB( s, separator, int.MaxValue, ignore_empty_entries ); + } + + public static String[] splitString( String s, String[] separator, boolean ignore_empty_entries ) { + return splitStringCorA( s, separator, int.MaxValue, ignore_empty_entries ); + } + + public static String[] splitString( String s, char[] separator, int count, boolean ignore_empty_entries ) { + return splitStringCorB( s, separator, count, ignore_empty_entries ); + } + + public static String[] splitString( String s, String[] separator, int count, boolean ignore_empty_entries ) { + return splitStringCorA( s, separator, count, ignore_empty_entries ); + } + + private static String[] splitStringCorB( String s, char[] separator, int count, boolean ignore_empty_entries ) { +#if JAVA + int length = separator.length; +#else + int length = separator.Length; +#endif + String[] spl = new String[length]; + for ( int i = 0; i < length; i++ ) { + spl[i] = separator[i] + ""; + } + return splitStringCorA( s, spl, count, false ); + } + + private static String[] splitStringCorA( String s, String[] separator, int count, boolean ignore_empty_entries ) { +#if JAVA + if( separator.length == 0 ){ + return new String[]{ s }; + } + Vector ret = new Vector(); + String remain = s; + int len = separator.length; + int index = remain.indexOf( separator[0] ); + int i = 1; + while( index < 0 && i < separator.length ){ + index = remain.indexOf( separator[i] ); + } + int added_count = 0; + while( index >= 0 ){ + if( !ignore_empty_entries || (ignore_empty_entries && index > 0) ){ + if( added_count + 1 == count ){ + break; + }else{ + ret.add( remain.substring( 0, index ) ); + } + added_count++; + } + remain = remain.substring( index + len ); + index = remain.indexOf( separator[0] ); + i = 1; + while( index < 0 && i < separator.length ){ + index = remain.indexOf( separator[i] ); + } + } + if( !ignore_empty_entries || (ignore_empty_entries && remain.length() > 0) ){ + ret.add( remain ); + } + return ret.toArray( new String[]{} ); +#else + return s.Split( separator, count, (ignore_empty_entries ? StringSplitOptions.RemoveEmptyEntries : StringSplitOptions.None) ); +#endif + } + + public static int getStringLength( String s ) { + if ( s == null ) { + return 0; + } else { +#if JAVA + return s.length(); +#else + return s.Length; +#endif + } + } + + public static int getEncodedByteCount( String encoding, String str ) { + byte[] buf = getEncodedByte( encoding, str ); +#if JAVA + return buf.length; +#else + return buf.Length; +#endif + } + + public static byte[] getEncodedByte( String encoding, String str ) { +#if JAVA + Charset enc = Charset.forName( encoding ); + ByteBuffer bb = enc.encode( str ); + byte[] dat = new byte[bb.limit()]; + bb.get( dat ); + return dat; +#else + Encoding enc = Encoding.GetEncoding( encoding ); + return enc.GetBytes( str ); +#endif + } + + public static String getDecodedString( String encoding, byte[] data, int offset, int length ) { +#if JAVA + Charset enc = Charset.forName( encoding ); + ByteBuffer bb = ByteBuffer.allocate( length ); + bb.put( data, offset, length ); + return enc.decode( bb ).toString(); +#else + Encoding enc = Encoding.GetEncoding( encoding ); + return enc.GetString( data, offset, length ); +#endif + } + + public static String getDecodedString( String encoding, byte[] data ) { +#if JAVA + return getDecodedString( encoding, data, 0, data.length ); +#else + return getDecodedString( encoding, data, 0, data.Length ); +#endif + } + + #endregion + + public static void setMousePosition( Point p ) { +#if JAVA + // TODO: PortUtil#setMousePosition +#else + System.Windows.Forms.Cursor.Position = new System.Drawing.Point( p.x, p.y ); +#endif + } + + public static Point getMousePosition() { +#if JAVA + return MouseInfo.getPointerInfo().getLocation(); +#else + System.Drawing.Point p = System.Windows.Forms.Control.MousePosition; + return new Point( p.X, p.Y ); +#endif + } + +#if JAVA + public static Rectangle getWorkingArea( Window w ){ + return w.getGraphicsConfiguration().getBounds(); +#else + public static Rectangle getWorkingArea( System.Windows.Forms.Form w ) { + System.Drawing.Rectangle r = System.Windows.Forms.Screen.GetWorkingArea( w ); + return new Rectangle( r.X, r.Y, r.Width, r.Height ); +#endif + } + + public static String getMD5FromString( String str ) { +#if JAVA + MessageDigest digest = null; + try { + digest = MessageDigest.getInstance("MD5"); + byte[] buff = getEncodedByte( "UTF-8", str ); + digest.update( buff, 0, buff.length ); + } catch( NoSuchAlgorithmException ex2 ){ + System.err.println( "PortUtil#getMD5FromString; ex2=" + ex2 ); + } + byte[] dat = digest.digest(); + String ret = ""; + for( int i = 0; i < dat.length; i++ ){ + ret += String.format( "%02x", dat[i] ); + } + return ret; +#else + return Misc.getmd5( str ); +#endif + } + + public static String getMD5( String file ) +#if JAVA + throws FileNotFoundException, IOException +#endif + { +#if JAVA + InputStream in = new FileInputStream( file ); + MessageDigest digest = null; + try { + digest = MessageDigest.getInstance("MD5"); + byte[] buff = new byte[4096]; + int len = 0; + while ((len = in.read(buff, 0, buff.length)) >= 0) { + digest.update(buff, 0, len); + } + } catch (IOException e) { + throw e; + } catch( NoSuchAlgorithmException ex2 ){ + System.out.println( "PortUtil#getMD5; ex2=" + ex2 ); + } finally { + if (in != null) { + try { + in.close(); + } catch (IOException e) { + } + } + } + byte[] dat = digest.digest(); + String ret = ""; + for( int i = 0; i < dat.length; i++ ){ + ret += String.format( "%02x", dat[i] ); + } + return ret; +#else + String ret = ""; + using ( FileStream fs = new FileStream( file, FileMode.Open, FileAccess.Read ) ) { + ret = Misc.getmd5( fs ); + } + return ret; +#endif + } + + +#if JAVA + class FileFilterImp implements FileFilter{ + private String m_extension; + + public FileFilterImp( String extension ){ + m_extension = extension; + } + + public boolean accept( File f ){ + String file = f.getName(); + if( file.endsWith( m_extension ) ){ + return true; + }else{ + return false; + } + } + } +#endif + + #region Array conversion + public static Integer[] convertIntArray( int[] arr ) { +#if JAVA + Integer[] ret = new Integer[arr.length]; + for( int i = 0; i < arr.length; i++ ){ + ret[i] = arr[i]; + } + return ret; +#else + return arr; +#endif + } + + public static Long[] convertLongArray( long[] arr ) { +#if JAVA + Long[] ret = new Long[arr.length]; + for( int i = 0; i < arr.length; i++ ){ + ret[i] = arr[i]; + } + return ret; +#else + return arr; +#endif + } + + public static Byte[] convertByteArray( byte[] arr ) { +#if JAVA + Byte[] ret = new Byte[arr.length]; + for( int i = 0; i < arr.length; i++ ){ + ret[i] = arr[i]; + } + return ret; +#else + return arr; +#endif + } + + public static Float[] convertFloatArray( float[] arr ) { +#if JAVA + Float[] ret = new Float[arr.length]; + for( int i = 0; i < arr.length; i++ ){ + ret[i] = arr[i]; + } + return ret; +#else + return arr; +#endif + } + +#if JAVA + public static int[] convertIntArray( Integer[] arr ){ + int[] ret = new int[arr.length]; + for( int i = 0; i < arr.length; i++ ){ + ret[i] = arr[i]; + } + return ret; + } + + public static long[] convertLongArray( Long[] arr ){ + long[] ret = new long[arr.length]; + for( int i = 0; i < arr.length; i++ ){ + ret[i] = arr[i]; + } + return ret; + } + + public static byte[] convertByteArray( Byte[] arr ){ + byte[] ret = new byte[arr.length]; + for( int i = 0; i < arr.length; i++ ){ + ret[i] = arr[i]; + } + return ret; + } + + public static float[] convertFloatArray( Float[] arr ){ + float[] ret = new float[arr.length]; + for( int i = 0; i < arr.length; i++ ){ + ret[i] = arr[i]; + } + return ret; + } +#endif + #endregion + + public static String getApplicationStartupPath() { +#if JAVA + return System.getProperty( "user.dir" ); +#else + return System.Windows.Forms.Application.StartupPath; +#endif + } + + public static void println( String s ) { +#if JAVA + System.out.println( s ); +#else + Console.WriteLine( s ); +#endif + } + } + +#if !JAVA +} +#endif diff --git a/trunk/bocoree/RandomAccessFile.cs b/trunk/bocoree/RandomAccessFile.cs new file mode 100644 index 0000000..11d62cd --- /dev/null +++ b/trunk/bocoree/RandomAccessFile.cs @@ -0,0 +1,78 @@ +#if !JAVA +/* + * RandomAccessFile.cs + * Copyright (c) 2009 kbinani + * + * This file is part of bocoree. + * + * bocoree is free software; you can redistribute it and/or + * modify it under the terms of the BSD License. + * + * bocoree 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; + +namespace bocoree.java.io { + + public class RandomAccessFile { + private System.IO.FileStream m_stream; + + public RandomAccessFile( String name, String mode ) { + if( mode == "r" ){ + m_stream = new System.IO.FileStream( name, System.IO.FileMode.Open, System.IO.FileAccess.Read ); + } else if ( mode == "rw" ) { + m_stream = new System.IO.FileStream( name, System.IO.FileMode.OpenOrCreate, System.IO.FileAccess.ReadWrite ); + } else { + throw new ArgumentException( "mode: \"" + mode + "\" is not supported", "mode" ); + } + } + + public void close() { + m_stream.Close(); + } + + public long length() { + return m_stream.Length; + } + + public int read() { + return m_stream.ReadByte(); + } + + public int read( byte[] b ) { + return m_stream.Read( b, 0, b.Length ); + } + + public int read( byte[] b, int off, int len ) { + return m_stream.Read( b, off, len ); + } + + public void seek( long pos ) { + m_stream.Seek( pos, System.IO.SeekOrigin.Begin ); + } + + public void write( byte[] b ) { + m_stream.Write( b, 0, b.Length ); + } + + public void write( byte[] b, int off, int len ) { + m_stream.Write( b, off, len ); + } + + public void write( int b ) { + m_stream.WriteByte( (byte)b ); + } + + public void writeByte( int b ) { + write( b ); + } + + public long getFilePointer() { + return m_stream.Position; + } + } + +} +#endif diff --git a/trunk/bocoree/TreeMap.cs b/trunk/bocoree/TreeMap.cs index 94bbf54..758af29 100644 --- a/trunk/bocoree/TreeMap.cs +++ b/trunk/bocoree/TreeMap.cs @@ -1,13 +1,14 @@ -/* +#if !JAVA +/* * TreeMap.cs * Copyright (c) 2009 kbinani * - * This file is part of Boare.Cadencii. + * This file is part of bocoree. * - * Boare.Cadencii is free software; you can redistribute it and/or - * modify it under the terms of the GPLv3 License. + * bocoree is free software; you can redistribute it and/or + * modify it under the terms of the BSD License. * - * Boare.Cadencii is distributed in the hope that it will be useful, + * bocoree 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. */ @@ -104,3 +105,4 @@ namespace bocoree { #endif } +#endif diff --git a/trunk/bocoree/ValuePair.cs b/trunk/bocoree/ValuePair.cs new file mode 100644 index 0000000..a499730 --- /dev/null +++ b/trunk/bocoree/ValuePair.cs @@ -0,0 +1,91 @@ +/* + * ValuePair.cs + * Copyright (c) 2009 kbinani + * + * This file is part of bocoree. + * + * bocoree is free software; you can redistribute it and/or + * modify it under the terms of the BSD License. + * + * bocoree 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. + */ +#if JAVA +package org.kbinani; +#else +using System; + +namespace bocoree { +#endif + +#if JAVA + public class ValuePair, V> implements Comparable>{ +#else + public class ValuePair : IComparable> where K : IComparable { +#endif + private K m_key; + private V m_value; + + public ValuePair() { + } + + public ValuePair( K key_, V value_ ) { + m_key = key_; + m_value = value_; + } + + public int compareTo( ValuePair item ) { +#if JAVA + return m_key.compareTo( item.m_key ); +#else + return m_key.CompareTo( item.m_key ); +#endif + } + +#if !JAVA + public int CompareTo( ValuePair item ){ + return compareTo( item ); + } +#endif + + public K getKey() { + return m_key; + } + + public void setKey( K value ) { + m_key = value; + } + + public V getValue() { + return m_value; + } + + public void setValue( V v ) { + m_value = v; + } + +#if !JAVA + public K Key { + get { + return getKey(); + } + set { + setKey( value ); + } + } + + public V Value { + get { + return getValue(); + } + set { + setValue( value ); + } + } +#endif + } + +#if !JAVA +} +#endif diff --git a/trunk/bocoree/Vector.cs b/trunk/bocoree/Vector.cs index 4d6b905..d788928 100644 --- a/trunk/bocoree/Vector.cs +++ b/trunk/bocoree/Vector.cs @@ -1,13 +1,14 @@ -/* +#if !JAVA +/* * Vector.cs * Copyright (c) 2009 kbinani * - * This file is part of Boare.Cadencii. + * This file is part of bocoree. * - * Boare.Cadencii is free software; you can redistribute it and/or - * modify it under the terms of the GPLv3 License. + * bocoree is free software; you can redistribute it and/or + * modify it under the terms of the BSD License. * - * Boare.Cadencii is distributed in the hope that it will be useful, + * bocoree 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. */ @@ -16,7 +17,7 @@ using System; using System.Collections.Generic; using System.Runtime.Serialization; -namespace bocoree { +namespace bocoree.java.util { [Serializable] #if VECTOR_TEST @@ -95,12 +96,12 @@ namespace bocoree { : base( array.toArray( new T[]{} ) ){ } - public void addAll( T[] array ) { + public void addAll( Vector array ) { base.AddRange( array ); } - public void addAll( Vector array ) { - base.AddRange( array ); + public int indexOf( T obj ) { + return base.IndexOf( obj ); } public void insertElementAt( T obj, int index ){ @@ -115,10 +116,6 @@ namespace bocoree { base.RemoveAt( index ); } - public Vector( T[] array ) - : base( array ) { - } - public Vector() : base() { } @@ -172,3 +169,4 @@ namespace bocoree { #endif } +#endif diff --git a/trunk/bocoree/XmlMember.cs b/trunk/bocoree/XmlMember.cs new file mode 100644 index 0000000..8a7d531 --- /dev/null +++ b/trunk/bocoree/XmlMember.cs @@ -0,0 +1,288 @@ +#if JAVA +/* + * XmlMember.java + * Copyright (c) 2009 kbinani + * + * This file is part of org.kbinani.util. + * + * org.kbinani.util is free software; you can redistribute it and/or + * modify it under the terms of the BSD License. + * + * org.kbinani.util 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. + */ +package org.kbinani.xml; + +import java.util.*; +import java.lang.reflect.*; + +public class XmlMember{ + private String m_name; + private Method m_getter = null; + private Method m_setter = null; + private Field m_field = null; + private Class m_type = null; + private Method m_elementname_getter = null; + private Method m_isignored_getter = null; + + private XmlMember(){ + } + + public String getName(){ + return m_name; + } + + public Class getType(){ + return m_type; + } + + public static XmlMember[] extractMembers( Class t ){ + XmlSerializable descripter = null; + try + { + Object tinstance = t.newInstance(); + if( tinstance instanceof XmlSerializable ) + { + descripter = (XmlSerializable)tinstance; + } + } + catch( Exception ex ) + { + System.out.println( "XmlMember#extractMembers; ex=" + ex ); + } + //Method elementname_getter = null; + //Method isignored_getter = null; + /*try{ + elementname_getter = t.getMethod( "getXmlElementName", String.class ); + int m = elementname_getter.getModifiers(); + if( !Modifier.isPublic( m ) || !Modifier.isStatic( m ) ){ + elementname_getter = null; + } + }catch( Exception ex ){ + elementname_getter = null; + } + try{ + isignored_getter = t.getMethod( "isXmlIgnored", String.class ); + int m = isignored_getter.getModifiers(); + if( !Modifier.isPublic( m ) || !Modifier.isStatic( m ) ){ + isignored_getter = null; + } + }catch( Exception ex ){ + isignored_getter = null; + }*/ + Vector members = new Vector(); + + // superクラスのプロパティを取得 + if( t.getSuperclass() != null ){ + XmlMember[] super_members = extractMembers( t.getSuperclass() ); + for( XmlMember xm : super_members ){ + members.add( xm ); + } + } + Vector props = new Vector(); + for( Field f : t.getDeclaredFields() ){ + int m = f.getModifiers(); + if( !Modifier.isPublic( m ) || Modifier.isStatic( m ) ){ + continue; + } + props.add( f.getName() ); + } + + // get, set, isで始まるメソッド名を持つ、publicでstaticでないメソッドを抽出 + for( Method method : t.getDeclaredMethods() ){ + int m = method.getModifiers(); + if( !Modifier.isPublic( m ) || Modifier.isStatic( m ) ){ + continue; + } + String name = method.getName(); + if( name.startsWith( "get" ) ){ + name = name.substring( 3 ); + if( !props.contains( name ) ){ + props.add( name ); + } + }else if( name.startsWith( "set" ) ){ + name = name.substring( 3 ); + if( !props.contains( name ) ){ + props.add( name ); + } + }else if( name.startsWith( "is" ) ){ + name = name.substring( 2 ); + if( !props.contains( name ) ){ + props.add( name ); + } + } + } + + for( String name : props ){ + boolean ignore = false; + if( descripter != null ){ + try{ + ignore = descripter.isXmlIgnored( name ); + }catch( Exception ex ){ + } + } + if( ignore ){ + continue; + } + String xmlname = name; + if( descripter != null ){ + try{ + xmlname = descripter.getXmlElementName( name ); + }catch( Exception ex ){ + } + } + XmlMember xm = extract( t, name ); + if( xm != null ){ + xm.m_name = xmlname; + members.add( xm ); + } + } + + return members.toArray( new XmlMember[]{} ); + } + + public static XmlMember extract( Class cls, String property_name ){ + for( Field f : cls.getDeclaredFields() ){ + int m = f.getModifiers(); + if( !Modifier.isPublic( m ) || Modifier.isStatic( m ) ){ + continue; + } + String name = f.getName(); + if( name.equals( property_name ) ){ + XmlMember xm = new XmlMember(); + xm.m_name = property_name; + xm.m_field = f; + xm.m_getter = null; + xm.m_setter = null; + xm.m_type = f.getType(); + return xm; + } + } + + // get, set, isで始まるメソッド名を持つ、publicでstaticでないメソッドを抽出 + Method getter = null; + Method setter = null; + Class prop_type = null; + for( Method method : cls.getDeclaredMethods() ){ + int m = method.getModifiers(); + if( !Modifier.isPublic( m ) || Modifier.isStatic( m ) ){ + continue; + } + String name = method.getName(); + Class ret_type = method.getReturnType(); + if( name.startsWith( "set" ) && setter == null ){ + if( !name.substring( 3 ).equals( property_name ) ){ + continue; + } + // setterなので、戻り値の型はvoid + if( !ret_type.equals( Void.TYPE ) && !ret_type.equals( Void.class ) ){ + continue; + } + + // 引数の個数は1 + Class[] args = method.getParameterTypes(); + if( args.length != 1 ){ + continue; + } + + // 探している型と合致するか + if( prop_type == null ){ + prop_type = args[0]; + }else{ + if( !prop_type.equals( args[0] ) ){ + continue; + } + } + setter = method; + }else if( name.startsWith( "is" ) && getter == null ){ + if( !name.substring( 2 ).equals( property_name ) ){ + continue; + } + if( setter != null ){ + // setterが既に見つかっていて、ret_typeがboolean/Booleanじゃない場合 + if( !ret_type.equals( Boolean.TYPE ) || !ret_type.equals( Boolean.class ) ){ + return null; + } + } + // isで始まるgetterは、戻り値の型がBoolean or boolean + if( !ret_type.equals( Boolean.TYPE ) && !ret_type.equals( Boolean.class ) ){ + continue; + } + + // 引数の個数は0 + Class[] args = method.getParameterTypes(); + if( args.length != 0 ){ + continue; + } + + if( prop_type == null ){ + prop_type = ret_type; + }else{ + if( !prop_type.equals( ret_type ) ){ + continue; + } + } + getter = method; + }else if( name.startsWith( "get" ) && getter == null ){ + if( !name.substring( 3 ).equals( property_name ) ){ + continue; + } + // 引数の個数は0 + Class[] args = method.getParameterTypes(); + if( args.length != 0 ){ + continue; + } + + if( prop_type == null ){ + prop_type = ret_type; + }else{ + if( !prop_type.equals( ret_type ) ){ + continue; + } + } + getter = method; + } + if( getter != null && setter != null ){ + break; + } + } + if( getter != null && setter != null ){ + XmlMember xm = new XmlMember(); + xm.m_name = property_name; + xm.m_field = null; + xm.m_getter = getter; + xm.m_setter = setter; + xm.m_type = prop_type; + return xm; + }else{ + return null; + } + } + + public Object get( Object obj ){ + try{ + if( m_field != null ){ + return m_field.get( obj ); + }else{ + return m_getter.invoke( obj ); + } + }catch( Exception ex ){ + System.out.println( "org.kbinani.util.XmlMember.get; ex=" + ex ); + return null; + } + } + + public void set( Object obj, Object value ){ + try{ + if( m_field != null ){ + m_field.set( obj, value ); + }else{ + m_setter.invoke( obj, value ); + } + }catch( Exception ex ){ + System.out.println( "org.kbinani.util.XmlMember.set; ex=" + ex ); + } + } +} +#endif diff --git a/trunk/bocoree/XmlPoint.cs b/trunk/bocoree/XmlPoint.cs new file mode 100644 index 0000000..b715a45 --- /dev/null +++ b/trunk/bocoree/XmlPoint.cs @@ -0,0 +1,109 @@ +/* + * XmlPoint.cs + * Copyright (c) 2009 kbinani + * + * This file is part of bocoree. + * + * bocoree is free software; you can redistribute it and/or + * modify it under the terms of the BSD License. + * + * bocoree 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. + */ +#if JAVA +package org.kbinani; + +import java.awt.*; +#else +using System.Xml.Serialization; +using bocoree.java.awt; + +namespace bocoree +{ +#endif + + public class XmlPoint + { +#if !JAVA + [XmlIgnore] +#endif + public int x; +#if !JAVA + [XmlIgnore] +#endif + public int y; + + public XmlPoint() + { + } + + public XmlPoint( int x_, int y_ ) + { + x = x_; + y = y_; + } + + public XmlPoint( Point p ) + { + x = p.x; + y = p.y; + } + + public Point toPoint() + { + return new Point( x, y ); + } + + public int getX() + { + return x; + } + + public void setX( int value ) + { + x = value; + } + + public int getY() + { + return y; + } + + public void setY( int value ) + { + y = value; + } + +#if !JAVA + public int X + { + get + { + return getX(); + } + set + { + setX( value ); + } + } + + public int Y + { + get + { + return getY(); + } + set + { + setY( value ); + } + } + +#endif + + } + +#if !JAVA +} +#endif diff --git a/trunk/bocoree/XmlRectangle.cs b/trunk/bocoree/XmlRectangle.cs new file mode 100644 index 0000000..0df27aa --- /dev/null +++ b/trunk/bocoree/XmlRectangle.cs @@ -0,0 +1,138 @@ +/* + * XmlRectangle.cs + * Copyright (c) 2009 kbinani + * + * This file is part of bocoree. + * + * bocoree is free software; you can redistribute it and/or + * modify it under the terms of the BSD License. + * + * bocoree 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. + */ +#if JAVA +package org.kbinani; + +import java.awt.*; +#else +using System.Xml.Serialization; +using bocoree.java.awt; + +namespace bocoree{ +#endif + + public class XmlRectangle{ +#if !JAVA + [XmlIgnore] +#endif + public int x; +#if !JAVA + [XmlIgnore] +#endif + public int y; +#if !JAVA + [XmlIgnore] +#endif + public int width; +#if !JAVA + [XmlIgnore] +#endif + public int height; + + public XmlRectangle() + { + } + + public XmlRectangle( int x_, int y_, int width_, int height_ ){ + x = x_; + y = y_; + width = width_; + height = height_; + } + + public XmlRectangle( Rectangle rc ) { + x = rc.x; + y = rc.y; + width = rc.width; + height = rc.height; + } + + public Rectangle toRectangle() { + return new Rectangle( x, y, width, height ); + } + + public int getX() { + return x; + } + + public void setX( int value ) { + x = value; + } + + public int getY() { + return y; + } + + public void setY( int value ) { + y = value; + } + + public int getWidth() { + return width; + } + + public void setWidth( int value ) { + width = value; + } + + public int getHeight() { + return height; + } + + public void setHeight( int value ) { + height = value; + } +#if !JAVA + public int X{ + get{ + return getX(); + } + set{ + setX( value ); + } + } + + public int Y{ + get{ + return getY(); + } + set{ + setY( value ); + } + } + + public int Width{ + get{ + return getWidth(); + } + set{ + setWidth( value ); + } + } + + public int Height{ + get{ + return getHeight(); + } + set{ + setHeight( value ); + } + } +#endif + + } + +#if !JAVA +} +#endif diff --git a/trunk/bocoree/XmlSerializable.cs b/trunk/bocoree/XmlSerializable.cs new file mode 100644 index 0000000..51b544f --- /dev/null +++ b/trunk/bocoree/XmlSerializable.cs @@ -0,0 +1,31 @@ +/* + * XmlSerializable.cs + * Copyright (c) 2009 kbinani + * + * This file is part of bocoree. + * + * bocoree is free software; you can redistribute it and/or + * modify it under the terms of the BSD License. + * + * bocoree 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. + */ +#if JAVA +package org.kbinani.xml; +#else +using System; + +namespace bocoree.xml { + using boolean = System.Boolean; +#endif + + public interface XmlSerializable { + String getXmlElementName( String name ); + boolean isXmlIgnored( String name ); + String getGenericTypeName( String name ); + } + +#if !JAVA +} +#endif diff --git a/trunk/bocoree/XmlSerializeWithDescription.cs b/trunk/bocoree/XmlSerializeWithDescription.cs new file mode 100644 index 0000000..5d542fd --- /dev/null +++ b/trunk/bocoree/XmlSerializeWithDescription.cs @@ -0,0 +1,272 @@ +#if !JAVA +/* + * XmlSerializeWithDescription.cs + * Copyright (c) 2009 kbinani + * + * This file is part of bocoree. + * + * bocoree is free software; you can redistribute it and/or + * modify it under the terms of the BSD License. + * + * bocoree 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.Xml; +using System.Reflection; +using System.IO; + +namespace bocoree +{ + + /// + /// フィールド、またはプロパティの概要を格納するattribute + /// + [AttributeUsage( AttributeTargets.Field | AttributeTargets.Property, AllowMultiple = false )] + public class XmlItemDescription : Attribute + { + private string m_value = ""; + private string m_attribute_name = "description"; + + public XmlItemDescription( string Value ) + { + m_value = Value; + } + + public XmlItemDescription( string AttributeName, string Value ) + { + m_value = Value; + m_attribute_name = AttributeName; + } + + public string AttributeName + { + get + { + return m_attribute_name; + } + } + + public string Value + { + get + { + return m_value; + } + } + } + + /// + /// フィールドおよびプロパティを、XmlItemDescription属性の文字列を付加しながらXmlシリアライズする + /// + public class XmlSerializeWithDescription + { + private XmlTextWriter m_writer; + private Type m_type; + + public XmlSerializeWithDescription() + { + } + + public void Serialize( Stream stream, object obj ) + { + m_writer = new XmlTextWriter( stream, null ); + m_writer.Formatting = Formatting.Indented; + m_writer.Indentation = 4; + m_writer.IndentChar = ' '; + m_writer.WriteStartDocument(); + m_writer.WriteStartElement( obj.GetType().Name ); + PrintItemRecurse( obj ); + m_writer.WriteEndElement(); + m_writer.WriteEndDocument(); + m_writer.Flush(); + } + + private void PrintItemRecurse( object obj ) + { + Type t = obj.GetType(); + if ( !TryWriteValueType( obj ) ) + { + if ( t.IsGenericType ) + { + List f = new List(); + Type list_type = f.GetType().GetGenericTypeDefinition(); + if ( t.GetGenericTypeDefinition().Equals( list_type ) ) + { + Type[] gen = t.GetGenericArguments(); + if ( gen.Length == 1 ) + { + PropertyInfo count_property = t.GetProperty( "Count", typeof( int ) ); + int count = (int)count_property.GetValue( obj, new object[] { } ); + Type returntype = gen[0]; + MethodInfo indexer = t.GetMethod( "get_Item", new Type[] { typeof( int ) } ); + string name = ""; + if ( returntype.Equals( typeof( Boolean ) ) ) + { + name = "boolean"; + } + else if ( returntype.Equals( typeof( DateTime ) ) ) + { + name = "dateTime"; + } + else if ( returntype.Equals( typeof( Decimal ) ) ) + { + name = "decimal"; + } + else if ( returntype.Equals( typeof( Double ) ) ) + { + name = "double"; + } + else if ( returntype.Equals( typeof( Int32 ) ) ) + { + name = "int"; + } + else if ( returntype.Equals( typeof( Int64 ) ) ) + { + name = "long"; + } + else if ( returntype.Equals( typeof( Single ) ) ) + { + name = "float"; + } + else if ( returntype.Equals( typeof( String ) ) ) + { + name = "string"; + } + else if ( returntype.IsEnum ) + { + name = returntype.Name; + } + if ( indexer != null && name != "" ) + { + for ( int i = 0; i < count; i++ ) + { + object value = indexer.Invoke( obj, new object[] { i } ); + m_writer.WriteStartElement( name ); + TryWriteValueType( value ); + m_writer.WriteEndElement(); + } + } + } + } + } + else + { + foreach ( FieldInfo fi in t.GetFields() ) + { + if ( fi.IsPrivate || fi.IsStatic ) + { + continue; + } + object[] attr = fi.GetCustomAttributes( typeof( XmlItemDescription ), false ); + XmlItemDescription xid = null; + if ( attr.Length > 0 ) + { + xid = (XmlItemDescription)attr[0]; + } + WriteContents( fi.Name, fi.GetValue( obj ), xid ); + } + foreach ( PropertyInfo pi in t.GetProperties() ) + { + if ( !pi.CanRead | !pi.CanWrite ) + { + continue; + } + if ( !pi.GetSetMethod().IsPublic | !pi.GetGetMethod().IsPublic ) + { + continue; + } + if ( pi.GetSetMethod().IsStatic | pi.GetGetMethod().IsStatic ) + { + continue; + } + object[] attr = pi.GetCustomAttributes( typeof( XmlItemDescription ), false ); + XmlItemDescription xid = null; + if ( attr.Length > 0 ) + { + xid = (XmlItemDescription)attr[0]; + } + WriteContents( pi.Name, pi.GetValue( obj, new object[] { } ), xid ); + } + } + } + } + + private bool TryWriteValueType( object obj ) + { + Type t = obj.GetType(); + if ( t.Equals( typeof( Boolean ) ) ) + { + m_writer.WriteValue( (Boolean)obj ); + return true; + } + else if ( t.Equals( typeof( DateTime ) ) ) + { + m_writer.WriteValue( (DateTime)obj ); + return true; + } + else if ( t.Equals( typeof( Decimal ) ) ) + { + m_writer.WriteValue( (Decimal)obj ); + return true; + } + else if ( t.Equals( typeof( Double ) ) ) + { + m_writer.WriteValue( (Double)obj ); + return true; + } + else if ( t.Equals( typeof( Int32 ) ) ) + { + m_writer.WriteValue( (Int32)obj ); + return true; + } + else if ( t.Equals( typeof( Int64 ) ) ) + { + m_writer.WriteValue( (Int64)obj ); + return true; + } + else if ( t.Equals( typeof( Single ) ) ) + { + m_writer.WriteValue( (Single)obj ); + return true; + } + else if ( t.Equals( typeof( String ) ) ) + { + m_writer.WriteString( (String)obj ); + return true; + } + else if ( t.IsEnum ) + { + string val = Enum.GetName( t, obj ); + m_writer.WriteString( val ); + return true; + } + else + { + return false; + } + } + + private void WriteContents( string name, object next_obj, XmlItemDescription xid ) + { + m_writer.WriteStartElement( name ); + if ( xid != null ) + { + m_writer.WriteAttributeString( xid.AttributeName, xid.Value ); + } + PrintItemRecurse( next_obj ); + m_writer.WriteEndElement(); + } + + private void test() + { + System.Xml.Serialization.XmlSerializer xs = new System.Xml.Serialization.XmlSerializer( typeof( int ) ); + } + + } + +} +#endif diff --git a/trunk/bocoree/XmlSerializer.cs b/trunk/bocoree/XmlSerializer.cs new file mode 100644 index 0000000..e7c043b --- /dev/null +++ b/trunk/bocoree/XmlSerializer.cs @@ -0,0 +1,431 @@ +/* + * XmlSerializer.cs + * Copyright (c) 2009 kbinani + * + * This file is part of bocoree. + * + * bocoree is free software; you can redistribute it and/or + * modify it under the terms of the BSD License. + * + * bocoree 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. + */ +#if JAVA +package org.kbinani.xml; + +import java.io.*; +import java.util.*; +import java.lang.reflect.*; +import javax.xml.parsers.*; +import javax.xml.transform.*; +import javax.xml.transform.dom.*; +import javax.xml.transform.stream.*; +import org.w3c.dom.*; + +/** + * .NETのSystem.Xml.Serialization.XmlSerializerと同じ書式で入出力するためのXMLシリアライザ.
+ * シリアライズしたいクラスには,以下のメソッドを実装しておく必要があります.
+ *
+ *
getXmlElementNameメソッド
+ *
フィールド名やgetter/setter名からXMLのノード名を調べる
+ *
isXmlIgnoredメソッド
+ *
アイテムをXMLに出力するかどうかを決める
+ *
getGenericTypeNameメソッド
+ *
アイテムが総称型を含むクラスの場合に,その総称型名を調べる
+ *
+ *
+ *  public class Test2{
+        public float value = 1.0f;
+        private boolean m_b = true;
+        private int m_i = 2;
+        public Vector list = new Vector();
+        
+        public boolean isHoge(){
+            return m_b;
+        }
+        
+        public void setHoge( boolean value ){
+            m_b = value;
+        }
+        
+        public int getInteger(){
+            return m_i;
+        }
+        
+        public void setInteger( int value ){
+            m_i = value;
+        }
+        
+        public static String getXmlElementName( String name ){
+            if( name.equals( "value" ) ){
+                return "Value";
+            }else if( name.equals( "list" ) ){
+                return "List";
+            }
+            return name;
+        }
+
+        public static boolean isXmlIgnored( String name ){
+            if( name.equals( "Integer" ) ){
+                return true;
+            }
+            return false;
+        }
+
+        public static String getGenericTypeName( String name ){
+            if( name.equals( "list" ) ){
+                return "java.lang.Integer";
+            }
+            return "";
+        }
+    }
+ * 
+ * このように実装しておくと,だいたい以下のようなXMLの入出力が可能になります. + *
+    <Test2>
+        <Value>1.0</Value>
+        <Hoge>true</Hoge>
+        <List>
+            <int>1</int>
+            <int>2</int>
+        </List>
+    </Test2>
+ * 
+ */ +public class XmlSerializer{ + private Document m_document; + private Class m_class; + private boolean m_static_mode = false; + private boolean m_indent = true; + private int m_indent_width = 2; + + public boolean isIndent(){ + return m_indent; + } + + public void setIndent( boolean value ){ + m_indent = value; + } + + public int getIndentWidth(){ + return m_indent_width; + } + + public void setIndentWidth( int value ){ + if( value < 0 ){ + m_indent_width = 0; + }else{ + m_indent_width = value; + } + } + + public XmlSerializer( Class cls ){ + m_class = cls; + } + + public Object deserialize( InputStream stream ){ + try{ + DocumentBuilderFactory fact = DocumentBuilderFactory.newInstance(); + DocumentBuilder builder = fact.newDocumentBuilder(); + Document doc = builder.parse( stream ); + Object ret = parseNode( m_class, null, doc.getDocumentElement() ); + return ret; + }catch( Exception ex ){ + System.out.println( "XmlSerializer.deserialize; ex=" + ex ); + return null; + } + } + + private Object parseNode( Class t, Class parent_class, Node node ){ + NodeList childs = node.getChildNodes(); + int numChild = childs.getLength(); + Object obj; + String str = node.getTextContent() + ""; + if( t.equals( Integer.TYPE ) || t.equals( Integer.class ) ){ + return Integer.parseInt( str ); + }else if( t.equals( Byte.TYPE ) || t.equals( Byte.class ) ){ + return Byte.parseByte( str ); + }else if( t.equals( Short.TYPE ) || t.equals( Short.class ) ){ + return Short.parseShort( str ); + }else if( t.equals( Float.TYPE ) || t.equals( Float.class ) ){ + return Float.parseFloat( str ); + }else if( t.equals( Double.TYPE ) || t.equals( Double.class ) ){ + return Double.parseDouble( str ); + }else if( t.equals( Boolean.TYPE ) || t.equals( Boolean.class ) ){ + return Boolean.parseBoolean( str ); + }else if( t.equals( String.class ) ){ + return str; + }else if( t.isEnum() ){ + return Enum.valueOf( t, str ); + }else if( t.isArray() || t.equals( Vector.class ) ){ + // Class tがstatic String getGenericTypeName( String )を実装しているかどうか調べる + Method method = null; + if( parent_class == null ){ + return null; + } + for( Method m : parent_class.getDeclaredMethods() ){ + if( !m.getName().equals( "getGenericTypeName" ) ){ + continue; + } + int modifier = m.getModifiers(); + if( !Modifier.isStatic( modifier ) || !Modifier.isPublic( modifier ) ){ + continue; + } + if( !m.getReturnType().equals( String.class ) ){ + continue; + } + Class[] args = m.getParameterTypes(); + if( args.length != 1 ){ + continue; + } + if( !args[0].equals( String.class ) ){ + continue; + } + method = m; + break; + } + if( method == null ){ + return null; + } + try{ + String content_class_name = (String)method.invoke( null, node.getNodeName() ); + Class content_class = Class.forName( content_class_name ); + Vector vec = new Vector(); + String element_name = getCliTypeName( content_class ); + if( element_name.equals( "" ) ){ + element_name = content_class.getSimpleName(); + } + for( int i = 0; i < numChild; i++ ){ + Node c = childs.item( i ); + if( c.getNodeType() == Node.ELEMENT_NODE ){ + Element f = (Element)c; + if( !f.getTagName().equals( element_name ) ){ + continue; + } + vec.add( parseNode( content_class, t, c ) ); + } + } + if( t.isArray() ){ + int length = vec.size(); + Object arr = Array.newInstance( content_class, length ); + for( int i = 0; i < length; i++ ){ + Array.set( arr, i, vec.get( i ) ); + } + return arr; + }else if( t.equals( Vector.class ) ){ + return vec; + } + }catch( Exception ex ){ + System.out.println( "XmlSerializer.parseNode; ex=" + ex ); + return null; + } + } + try{ + obj = t.newInstance(); + }catch( Exception ex ){ + return null; + } + XmlMember[] members = XmlMember.extractMembers( t ); + for( int i = 0; i < numChild; i++ ){ + Node c = childs.item( i ); + if( c.getNodeType() == Node.ELEMENT_NODE ) { + Element f = (Element)c; + String name = f.getTagName(); + for( XmlMember xm : members ){ + if( f.getTagName().equals( xm.getName() ) ) { + xm.set( obj, parseNode( xm.getType(), t, c ) ); + break; + } + } + } + } + return obj; + } + + public void serialize( OutputStream stream, Object obj ) throws TransformerConfigurationException, + ParserConfigurationException, + TransformerException, + IllegalAccessException{ + DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); + DocumentBuilder builder = factory.newDocumentBuilder(); + DOMImplementation domImpl=builder.getDOMImplementation(); + m_document = domImpl.createDocument( null, m_class.getSimpleName(), null ); + Element root = m_document.getDocumentElement(); + parseFieldAndProperty( m_class, obj, root ); + TransformerFactory tfactory = TransformerFactory.newInstance(); + Transformer transformer = tfactory.newTransformer(); + if( m_indent ){ + transformer.setOutputProperty( OutputKeys.INDENT, "yes" ); + } + transformer.setOutputProperty( OutputKeys.METHOD, "xml" ); + if( m_indent ){ + transformer.setOutputProperty( "{http://xml.apache.org/xalan}indent-amount", "" + m_indent_width ); + } + transformer.transform( new DOMSource( m_document ), new StreamResult( stream ) ); + } + + private void parseFieldAndProperty( Class t, Object obj, Element el ) throws IllegalAccessException{ + if( obj == null ){ + return; + } + XmlMember[] members = XmlMember.extractMembers( t ); + for( XmlMember xm : members ){ + String name = xm.getName(); + Element el2 = m_document.createElement( name ); + printItemRecurse( xm.getType(), xm.get( obj ), el2 ); + el.appendChild( el2 ); + } + } + + private void printItemRecurse( Class t, Object obj, Element parent ) throws IllegalAccessException{ + try{ + if ( !tryWriteValueType( t, obj, parent ) ){ + if( t.isArray() || t.equals( Vector.class ) ){ + Object[] array = null; + if( t.isArray() ){ + array = (Object[])obj; + }else if( t.equals( Vector.class ) ){ + array = ((Vector)obj).toArray(); + } + if( array != null ){ + for( Object o : array ){ + if( o != null ){ + String name = getCliTypeName( o.getClass() ); + if( name.equals( "" ) ){ + name = o.getClass().getSimpleName(); + } + Element element = m_document.createElement( name ); + printItemRecurse( o.getClass(), o, element ); + parent.appendChild( element ); + } + } + } + }else{ + parseFieldAndProperty( t, obj, parent ); + } + } + }catch( Exception ex ){ + System.out.println( "printItemRecurse; ex=" + ex ); + } + } + + private static String getCliTypeName( Class t ){ + if( t.equals( Boolean.class ) || t.equals( Boolean.TYPE ) ){ + return "bool"; + }else if( t.equals( Double.class ) || t.equals( Double.TYPE ) ){ + return "double"; + }else if( t.equals( Integer.class ) || t.equals( Integer.TYPE ) ){ + return "int"; + }else if( t.equals( Long.class ) || t.equals( Long.TYPE ) ){ + return "long"; + }else if( t.equals( Short.class ) || t.equals( Short.TYPE ) ){ + return "short"; + }else if( t.equals( Float.class ) || t.equals( Float.TYPE ) ){ + return "float"; + }else if( t.equals( String.class ) ){ + return "string"; + }else{ + return ""; + } + } + + private boolean tryWriteValueType( Class t, Object obj, Element element ){ + if( t.equals( Boolean.class ) || t.equals( Boolean.TYPE ) ){ + element.appendChild( m_document.createTextNode( (Boolean)obj + "" ) ); + return true; + }else if( t.equals( Double.class ) || t.equals( Double.TYPE ) ){ + element.appendChild( m_document.createTextNode( (Double)obj + "" ) ); + return true; + }else if( t.equals( Integer.class ) || t.equals( Integer.TYPE ) ){ + element.appendChild( m_document.createTextNode( (Integer)obj + "" ) ); + return true; + }else if( t.equals( Long.class ) || t.equals( Long.TYPE ) ){ + element.appendChild( m_document.createTextNode( (Long)obj + "" ) ); + return true; + }else if( t.equals( Short.class ) || t.equals( Short.TYPE ) ){ + element.appendChild( m_document.createTextNode( (Short)obj + "" ) ); + return true; + }else if( t.equals( Float.class ) || t.equals( Float.TYPE ) ){ + element.appendChild( m_document.createTextNode( (Float)obj + "" ) ); + return true; + }else if( t.equals( String.class ) ){ + if( obj == null ){ + element.appendChild( m_document.createTextNode( "" ) ); + }else{ + element.appendChild( m_document.createTextNode( (String)obj ) ); + } + return true; + }else if( t.isEnum() ){ + if( obj == null ){ + for( Field f : t.getDeclaredFields() ){ + String name = f.getName(); + if( !name.startsWith( "$" ) ){ + element.appendChild( m_document.createTextNode( name ) ); + break; + } + } + }else{ + element.appendChild( m_document.createTextNode( obj + "" ) ); + } + return true; + }else{ + return false; + } + } +} +#else +using System; +using System.IO; +using bocoree.xml; + +namespace bocoree.xml { + + public class XmlSerializer { + private bool m_serialize_static_mode = false; + System.Xml.Serialization.XmlSerializer m_serializer; + XmlStaticMemberSerializer m_static_serializer; + + public XmlSerializer( Type cls ) { + m_serializer = new System.Xml.Serialization.XmlSerializer( cls ); + } + + public XmlSerializer( Type cls, bool serialize_static_mode ) + { + m_serialize_static_mode = serialize_static_mode; + if ( serialize_static_mode ) + { + m_static_serializer = new XmlStaticMemberSerializer( cls ); + } + else + { + m_serializer = new System.Xml.Serialization.XmlSerializer( cls ); + } + } + + public object deserialize( Stream stream ) { + if ( m_serialize_static_mode ) + { + m_static_serializer.Deserialize( stream ); + return null; + } + else + { + return m_serializer.Deserialize( stream ); + } + } + + public void serialize( Stream stream, object obj ) { + if ( m_serialize_static_mode ) + { + m_static_serializer.Serialize( stream ); + } + else + { + m_serializer.Serialize( stream, obj ); + } + } + } + +} +#endif diff --git a/trunk/bocoree/XmlStaticMemberSerializer.cs b/trunk/bocoree/XmlStaticMemberSerializer.cs new file mode 100644 index 0000000..0ad6944 --- /dev/null +++ b/trunk/bocoree/XmlStaticMemberSerializer.cs @@ -0,0 +1,246 @@ +#if !JAVA +/* + * XmlStaticMemberSerializer.cs + * Copyright (c) 2009 kbinani + * + * This file is part of bocoree. + * + * bocoree is free software; you can redistribute it and/or + * modify it under the terms of the BSD License. + * + * bocoree 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.CodeDom.Compiler; +using System.Collections.Generic; +using System.IO; +using System.Reflection; +using System.Xml.Serialization; + +using Microsoft.CSharp; + +namespace bocoree +{ + + /// + /// クラスのstaticメンバーのxmlシリアライズ/デシリアライズを行うclass + /// + public class XmlStaticMemberSerializer + { + /// + /// ターゲットとなるクラスから,シリアライズするメンバーを抽出する時に使用 + /// + private class MemberEntry + { + /// + /// プロパティ/フィールドの名前 + /// + public string Name; + /// + /// プロパティ/フィールドの型 + /// + public Type Type; + /// + /// プロパティ/フィールドのデフォルト値 + /// + public object Default; + + public MemberEntry( string name, Type type, object default_ ) + { + Name = name; + Type = type; + Default = default_; + } + } + + /// + /// シリアライズする対象の型.staticメンバーだけなので,インスタンスではなく型を保持 + /// + private Type m_item; + /// + /// シリアライズ/デシリアライズするための内部型 + /// + private Type m_config_type = null; + /// + /// m_config_typeで初期化されたシリアライザ + /// + private XmlSerializer m_xs = null; + + private XmlStaticMemberSerializer() + { + } + + /// + /// 指定された型をシリアライズするための初期化を行います + /// + /// + public XmlStaticMemberSerializer( Type item ) + { + m_item = item; + } + + /// + /// シリアライズを行い,ストリームに書き込みます + /// + /// + public void Serialize( Stream stream ) + { + if ( m_config_type == null ) + { + GenerateConfigType(); + } + ConstructorInfo ci = m_config_type.GetConstructor( new Type[] { } ); + object config = ci.Invoke( new object[] { } ); + foreach ( FieldInfo target in m_config_type.GetFields() ) + { + foreach ( PropertyInfo pi in m_item.GetProperties( BindingFlags.Public | BindingFlags.Static ) ) + { + if ( target.Name == pi.Name && target.FieldType.Equals( pi.PropertyType ) && pi.CanRead && pi.CanWrite ) + { + target.SetValue( config, pi.GetValue( m_item, new object[] { } ) ); + break; + } + } + foreach ( FieldInfo fi in m_item.GetFields( BindingFlags.Public | BindingFlags.Static ) ) + { + if ( target.Name == fi.Name && target.FieldType.Equals( fi.FieldType ) ) + { + target.SetValue( config, fi.GetValue( m_item ) ); + break; + } + } + } + m_xs.Serialize( stream, config ); + } + + /// + /// 指定したストリームを使って,デシリアライズを行います + /// + /// + public void Deserialize( Stream stream ) + { + if ( m_config_type == null ) + { + GenerateConfigType(); + } + object config = m_xs.Deserialize( stream ); + if ( config == null ) + { + throw new ApplicationException( "failed serializing internal config object" ); + } + foreach ( FieldInfo target in m_config_type.GetFields() ) + { + foreach ( PropertyInfo pi in m_item.GetProperties( BindingFlags.Public | BindingFlags.Static ) ) + { + if ( target.Name == pi.Name && target.FieldType.Equals( pi.PropertyType ) && pi.CanRead && pi.CanWrite ) + { + pi.SetValue( m_item, target.GetValue( config ), new object[] { } ); + break; + } + } + foreach ( FieldInfo fi in m_item.GetFields( BindingFlags.Public | BindingFlags.Static ) ) + { + if ( target.Name == fi.Name && target.FieldType.Equals( fi.FieldType ) ) + { + fi.SetValue( m_item, target.GetValue( config ) ); + break; + } + } + } + } + + /// + /// シリアライズ用の内部型をコンパイルし,m_xsが使用できるようにします + /// + private void GenerateConfigType() + { + List config_names = CollectScriptConfigEntries( m_item ); + string code = GenerateClassCodeForXmlSerialization( config_names, m_item ); + CSharpCodeProvider provider = new CSharpCodeProvider(); + CompilerParameters parameters = new CompilerParameters(); + parameters.ReferencedAssemblies.Add( "System.Windows.Forms.dll" ); + parameters.ReferencedAssemblies.Add( "System.dll" ); + parameters.ReferencedAssemblies.Add( "System.Drawing.dll" ); + parameters.ReferencedAssemblies.Add( "System.Xml.dll" ); + parameters.GenerateInMemory = true; + parameters.GenerateExecutable = false; + parameters.IncludeDebugInformation = true; + CompilerResults results = provider.CompileAssemblyFromSource( parameters, code ); + Assembly asm = results.CompiledAssembly; + if ( asm.GetTypes().Length <= 0 ) + { + m_config_type = null; + m_xs = null; + throw new ApplicationException( "failed generating internal xml serizlizer" ); + } + else + { + m_config_type = (asm.GetTypes())[0]; + m_xs = new XmlSerializer( m_config_type ); + } + } + + /// + /// 設定ファイルから読込むための型情報を蒐集 + /// + /// + /// + private static List CollectScriptConfigEntries( Type item ) + { + List config_names = new List(); + foreach ( PropertyInfo pi in item.GetProperties( BindingFlags.Static | BindingFlags.Public ) ) + { + object[] attrs = pi.GetCustomAttributes( true ); + foreach ( object obj in attrs ) + { + if ( obj.GetType().Equals( typeof( System.Xml.Serialization.XmlIgnoreAttribute ) ) ) + { + continue; + } + } + if ( pi.CanRead && pi.CanWrite ) + { + config_names.Add( new MemberEntry( pi.Name, pi.PropertyType, pi.GetValue( item, new object[] { } ) ) ); + } + } + foreach ( FieldInfo fi in item.GetFields( BindingFlags.Static | BindingFlags.Public ) ) + { + object[] attrs = fi.GetCustomAttributes( true ); + foreach ( object obj in attrs ) + { + if ( obj.GetType().Equals( typeof( System.Xml.Serialization.XmlIgnoreAttribute ) ) ) + { + continue; + } + } + config_names.Add( new MemberEntry( fi.Name, fi.FieldType, fi.GetValue( item ) ) ); + } + return config_names; + } + + /// + /// 指定した型から、Reflectionを使ってxmlシリアライズ用のクラスをコンパイルするためのC#コードを作成します + /// + /// + /// + private static string GenerateClassCodeForXmlSerialization( List config_names, Type item ) + { + // XmlSerialization用の型を作成 + string code = ""; + code += "using System;\n"; + code += "namespace Boare.Lib.AppUtil{\n"; + code += " public class StaticMembersOf" + item.Name + "{\n"; + foreach ( MemberEntry entry in config_names ) + { + code += " public " + entry.Type.ToString() + " " + entry.Name + ";\n"; + } + code += " }\n"; + code += "}\n"; + return code; + } + } + +} +#endif diff --git a/trunk/bocoree/awt.cs b/trunk/bocoree/awt.cs new file mode 100644 index 0000000..94e12e0 --- /dev/null +++ b/trunk/bocoree/awt.cs @@ -0,0 +1,536 @@ +/* + * awt.cs + * Copyright (c) 2009 kbinani + * + * This file is part of bocoree. + * + * bocoree is free software; you can redistribute it and/or + * modify it under the terms of the BSD License. + * + * bocoree 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. + */ +#if !JAVA +namespace bocoree.java.awt { + + public class Icon { + public System.Drawing.Image image; + } + + public class ImageIcon : Icon { + public ImageIcon( System.Drawing.Image image ) { + this.image = image; + } + + public ImageIcon( Image image ) { + if ( image != null ) { + this.image = image.image; + } + } + } + + public class Image{ + public System.Drawing.Image image; + + public int getWidth( object observer ) { + return image.Width; + } + + public int getHeight( object observer ) { + return image.Height; + } + } + + public class Cursor { + public const int CROSSHAIR_CURSOR = 1; + public const int CUSTOM_CURSOR = -1; + public const int DEFAULT_CURSOR = 0; + public const int E_RESIZE_CURSOR = 11; + public const int HAND_CURSOR = 12; + public const int MOVE_CURSOR = 13; + public const int N_RESIZE_CURSOR = 8; + public const int NE_RESIZE_CURSOR = 7; + public const int NW_RESIZE_CURSOR = 6; + public const int S_RESIZE_CURSOR = 9; + public const int SE_RESIZE_CURSOR = 5; + public const int SW_RESIZE_CURSOR = 4; + public const int TEXT_CURSOR = 2; + public const int W_RESIZE_CURSOR = 10; + public const int WAIT_CURSOR = 3; + + private int m_type = DEFAULT_CURSOR; + public System.Windows.Forms.Cursor cursor = System.Windows.Forms.Cursors.Default; + + public Cursor( int type ) { + m_type = type; + if ( m_type == CROSSHAIR_CURSOR ) { + cursor = System.Windows.Forms.Cursors.Cross; + } else if ( m_type == HAND_CURSOR ) { + cursor = System.Windows.Forms.Cursors.Hand; + } else if ( m_type == TEXT_CURSOR ) { + cursor = System.Windows.Forms.Cursors.IBeam; + } else if ( m_type == E_RESIZE_CURSOR ){ + cursor = System.Windows.Forms.Cursors.PanEast; + } else if ( m_type == NE_RESIZE_CURSOR ){ + cursor = System.Windows.Forms.Cursors.PanNE; + } else if ( m_type == N_RESIZE_CURSOR ){ + cursor = System.Windows.Forms.Cursors.PanNorth; + } else if ( m_type == NW_RESIZE_CURSOR ) { + cursor = System.Windows.Forms.Cursors.PanNW; + } else if ( m_type == SE_RESIZE_CURSOR ){ + cursor = System.Windows.Forms.Cursors.PanSE; + } else if ( m_type == S_RESIZE_CURSOR ){ + cursor = System.Windows.Forms.Cursors.PanSouth; + } else if ( m_type == SW_RESIZE_CURSOR ){ + cursor = System.Windows.Forms.Cursors.PanSW; + } else if( m_type == W_RESIZE_CURSOR ){ + cursor = System.Windows.Forms.Cursors.PanWest; + } else if ( m_type == MOVE_CURSOR ){ + cursor = System.Windows.Forms.Cursors.SizeAll; + } + } + + public int getType() { + return m_type; + } + } + + public class Graphics2D { + public System.Drawing.Graphics nativeGraphics; + public Color color = Color.black; + private BasicStroke m_stroke = new BasicStroke(); + public System.Drawing.SolidBrush brush = new System.Drawing.SolidBrush( System.Drawing.Color.Black ); + private System.Drawing.Font m_font = new System.Drawing.Font( "Arial", 10 ); + + public Graphics2D( System.Drawing.Graphics g ) { + nativeGraphics = g; + } + + public void clearRect( int x, int y, int width, int height ) { + nativeGraphics.FillRectangle( System.Drawing.Brushes.White, x, y, width, height ); + } + + public void drawLine( int x1, int y1, int x2, int y2 ) { + nativeGraphics.DrawLine( m_stroke.pen, x1, y1, x2, y2 ); + } + + public void drawRect( int x, int y, int width, int height ) { + nativeGraphics.DrawRectangle( m_stroke.pen, x, y, width, height ); + } + + public void fillRect( int x, int y, int width, int height ) { + nativeGraphics.FillRectangle( brush, x, y, width, height ); + } + + public void drawOval( int x, int y, int width, int height ) { + nativeGraphics.DrawEllipse( m_stroke.pen, x, y, width, height ); + } + + public void fillOval( int x, int y, int width, int height ) { + nativeGraphics.FillRectangle( brush, x, y, width, height ); + } + + public void setColor( Color c ) { + color = c; + m_stroke.pen.Color = c.color; + brush.Color = c.color; + } + + public Color getColor() { + return color; + } + + public void setFont( Font font ) { + m_font = font.font; + } + + public void drawString( string str, float x, float y ) { + nativeGraphics.DrawString( str, m_font, brush, x, y ); + } + + public void drawPolygon( Polygon p ) { + drawPolygon( p.xpoints, p.ypoints, p.npoints ); + } + + public void drawPolygon( int[] xPoints, int[] yPoints, int nPoints ) { + System.Drawing.Point[] points = new System.Drawing.Point[nPoints]; + for ( int i = 0; i < nPoints; i++ ) { + points[i] = new System.Drawing.Point( xPoints[i], yPoints[i] ); + } + nativeGraphics.DrawLines( m_stroke.pen, points ); + } + + public void fillPolygon( Polygon p ) { + fillPolygon( p.xpoints, p.ypoints, p.npoints ); + } + + public void fillPolygon( int[] xPoints, int[] yPoints, int nPoints ) { + System.Drawing.Point[] points = new System.Drawing.Point[nPoints]; + for ( int i = 0; i < nPoints; i++ ) { + points[i] = new System.Drawing.Point( xPoints[i], yPoints[i] ); + } + nativeGraphics.FillPolygon( brush, points ); + } + + public void setStroke( Stroke stroke ) { + if ( stroke is BasicStroke ) { + BasicStroke bstroke = (BasicStroke)stroke; + m_stroke.pen = bstroke.pen; + m_stroke.pen.Color = color.color; + } + } + + public Stroke getStroke() { + return m_stroke; + } + + public Shape getClip() { + Shape ret = new Shape(); + ret.region = nativeGraphics.Clip; + return ret; + } + + public void setClip( Shape clip ) { + if ( clip == null ) { + nativeGraphics.Clip = new System.Drawing.Region(); + } else { + nativeGraphics.Clip = clip.region; + } + } + + public void clipRect( int x, int y, int width, int height ) { + nativeGraphics.Clip = new System.Drawing.Region( new System.Drawing.Rectangle( x, y, width, height ) ); + } + + public void drawImage( bocoree.java.awt.image.BufferedImage img, int x, int y, object obs ) { + if ( img is bocoree.java.awt.image.BufferedImage ) { + nativeGraphics.DrawImage( ((bocoree.java.awt.image.BufferedImage)img).m_image, new System.Drawing.Point( x, y ) ); + } + } + + public void drawImage( bocoree.java.awt.Image img, int x, int y, object obs ) { + if ( img == null ) { + return; + } + nativeGraphics.DrawImage( img.image, new System.Drawing.Point( x, y ) ); + } + } + + /*public interface Image{ + int getHeight( object observer ); + int getWidth( object observer ); + }*/ + + public struct Color { + /// + /// 黒を表します。 + /// + public static Color black = new Color( System.Drawing.Color.Black ); + /// + /// 黒を表します。 + /// + public static Color BLACK = new Color( System.Drawing.Color.Black ); + /// + /// 青を表します。 + /// + public static Color blue = new Color( System.Drawing.Color.Blue ); + /// + /// 青を表します。 + /// + public static Color BLUE = new Color( System.Drawing.Color.Blue ); + /// + /// シアンを表します。 + /// + public static Color cyan = new Color( System.Drawing.Color.Cyan ); + /// + /// シアンを表します。 + /// + public static Color CYAN = new Color( System.Drawing.Color.Cyan ); + /// + /// ダークグレイを表します。 + /// + public static Color DARK_GRAY = new Color( System.Drawing.Color.DarkGray ); + /// + /// ダークグレイを表します。 + /// + public static Color darkGray = new Color( System.Drawing.Color.DarkGray ); + /// + /// グレイを表します。 + /// + public static Color gray = new Color( System.Drawing.Color.Gray ); + /// + /// グレイを表します。 + /// + public static Color GRAY = new Color( System.Drawing.Color.Gray ); + /// + /// 緑を表します。 + /// + public static Color green = new Color( System.Drawing.Color.Green ); + /// + /// 緑を表します。 + /// + public static Color GREEN = new Color( System.Drawing.Color.Green ); + /// + /// ライトグレイを表します。 + /// + public static Color LIGHT_GRAY = new Color( System.Drawing.Color.LightGray ); + /// + /// ライトグレイを表します。 + /// + public static Color lightGray = new Color( System.Drawing.Color.LightGray ); + /// + /// マゼンタを表します。 + /// + public static Color magenta = new Color( System.Drawing.Color.Magenta ); + /// + /// マゼンタを表します。 + /// + public static Color MAGENTA = new Color( System.Drawing.Color.Magenta ); + /// + /// オレンジを表します。 + /// + public static Color orange = new Color( System.Drawing.Color.Orange ); + /// + /// オレンジを表します。 + /// + public static Color ORANGE = new Color( System.Drawing.Color.Orange ); + /// + /// ピンクを表します。 + /// + public static Color pink = new Color( System.Drawing.Color.Pink ); + /// + /// ピンクを表します。 + /// + public static Color PINK = new Color( System.Drawing.Color.Pink ); + /// + /// 赤を表します。 + /// + public static Color red = new Color( System.Drawing.Color.Red ); + /// + /// 赤を表します。 + /// + public static Color RED = new Color( System.Drawing.Color.Red ); + /// + /// 白を表します。 + /// + public static Color white = new Color( System.Drawing.Color.White ); + /// + /// 白を表します。 + /// + public static Color WHITE = new Color( System.Drawing.Color.White ); + /// + /// 黄を表します。 + /// + public static Color yellow = new Color( System.Drawing.Color.Yellow ); + /// + /// 黄を表します。 + /// + public static Color YELLOW = new Color( System.Drawing.Color.Yellow ); + + public System.Drawing.Color color; + + public Color( System.Drawing.Color value ) { + color = value; + } + + public Color( int r, int g, int b ) { + color = System.Drawing.Color.FromArgb( r, g, b ); + } + + public Color( int r, int g, int b, int a ) { + color = System.Drawing.Color.FromArgb( a, r, g, b ); + } + + public int getRed() { + return color.R; + } + + public int getGreen() { + return color.G; + } + + public int getBlue() { + return color.B; + } + } + + public struct Rectangle { + public int height; + public int width; + public int x; + public int y; + + public Rectangle( int width_, int height_ ) { + x = 0; + y = 0; + width = width_; + height = height_; + } + + public Rectangle( int x_, int y_, int width_, int height_ ) { + x = x_; + y = y_; + width = width_; + height = height_; + } + + public Rectangle( Rectangle r ) { + x = r.x; + y = r.y; + width = r.width; + height = r.height; + } + } + + public struct Point { + public int x; + public int y; + + public Point( int x_, int y_ ) { + x = x_; + y = y_; + } + + public Point( Point p ) { + x = p.x; + y = p.y; + } + } + + public class Font { + public const int PLAIN = 0; + public const int ITALIC = 2; + public const int BOLD = 1; + public static readonly string DIALOG = "Dialog"; + public static readonly string DIALOG_INPUT = "DialogInput"; + public static readonly string MONOSPACED = "Monospaced"; + public static readonly string SANS_SERIF = "SansSerif"; + public static readonly string SERIF = "Serif"; + public System.Drawing.Font font; + + public Font( System.Drawing.Font value ) { + font = value; + } + + public Font( string name, int style, int size ) { + System.Drawing.FontStyle fstyle = System.Drawing.FontStyle.Regular; + if ( style >= Font.BOLD ) { + fstyle = fstyle | System.Drawing.FontStyle.Bold; + } + if ( style >= Font.ITALIC ) { + fstyle = fstyle | System.Drawing.FontStyle.Italic; + } + font = new System.Drawing.Font( name, size, fstyle ); + } + + public string getName() { + return font.Name; + } + + public int getSize() { + return (int)font.SizeInPoints; + } + + public float getSize2D() { + return font.SizeInPoints; + } + } + + public interface Stroke { + } + + public class BasicStroke : Stroke { + public const int CAP_BUTT = 0; + public const int CAP_ROUND = 1; + public const int CAP_SQUARE = 2; + public const int JOIN_BEVEL = 2; + public const int JOIN_MITER = 0; + public const int JOIN_ROUND = 1; + public System.Drawing.Pen pen; + + public BasicStroke() { + pen = new System.Drawing.Pen( System.Drawing.Color.Black ); + } + + public BasicStroke( float width ) + : this( width, 0, 0, 10.0f ) { + } + + public BasicStroke( float width, int cap, int join ) + : this( width, cap, join, 10.0f ) { + } + + public BasicStroke( float width, int cap, int join, float miterlimit ) { + pen = new System.Drawing.Pen( System.Drawing.Color.Black, width ); + System.Drawing.Drawing2D.LineCap linecap = System.Drawing.Drawing2D.LineCap.Flat; + if ( cap == 1 ) { + linecap = System.Drawing.Drawing2D.LineCap.Round; + } else if ( cap == 2 ) { + linecap = System.Drawing.Drawing2D.LineCap.Square; + } + pen.StartCap = linecap; + pen.EndCap = linecap; + System.Drawing.Drawing2D.LineJoin linejoin = System.Drawing.Drawing2D.LineJoin.Miter; + if ( join == 1 ) { + linejoin = System.Drawing.Drawing2D.LineJoin.Round; + } else if ( join == 2 ) { + linejoin = System.Drawing.Drawing2D.LineJoin.Bevel; + } + pen.LineJoin = linejoin; + pen.MiterLimit = miterlimit; + } + + public BasicStroke( float width, int cap, int join, float miterlimit, float[] dash, float dash_phase ) + : this( width, cap, join, miterlimit ) { + pen.DashPattern = dash; + pen.DashOffset = dash_phase; + } + } + + public class Polygon { + /// + /// 点の総数です。 + /// + public int npoints; + /// + /// X 座標の配列です。 + /// + public int[] xpoints; + /// + /// Y 座標の配列です。 + /// + public int[] ypoints; + + public Polygon() { + npoints = 0; + xpoints = new int[0]; + ypoints = new int[0]; + } + + public Polygon( int[] xpoints_, int[] ypoints_, int npoints_ ) { + npoints = npoints_; + xpoints = xpoints_; + ypoints = ypoints_; + } + } + + public class Shape { + public System.Drawing.Region region; + } + + public struct Dimension { + public int height; + public int width; + + public Dimension( int width_, int height_ ) { + width = width_; + height = height_; + } + } + + public class Frame : System.Windows.Forms.Form { + } + +} +#endif diff --git a/trunk/bocoree/awt.event.cs b/trunk/bocoree/awt.event.cs new file mode 100644 index 0000000..929d876 --- /dev/null +++ b/trunk/bocoree/awt.event.cs @@ -0,0 +1,239 @@ +/* + * awt.event.cs + * Copyright (c) 2009 kbinani + * + * This file is part of bocoree. + * + * bocoree is free software; you can redistribute it and/or + * modify it under the terms of the BSD License. + * + * bocoree 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. + */ +#if !JAVA +namespace bocoree.java.awt.event_{ + + public class InputEvent { + public const int ALT_DOWN_MASK = 512; + public const int ALT_GRAPH_DOWN_MASK = 8192; + public const int ALT_GRAPH_MASK = 32; + public const int ALT_MASK = 8; + public const int BUTTON1_DOWN_MASK = 1024; + public const int BUTTON1_MASK = 16; + public const int BUTTON2_DOWN_MASK = 2048; + public const int BUTTON2_MASK = 8; + public const int BUTTON3_DOWN_MASK = 4096; + public const int BUTTON3_MASK = 4; + public const int CTRL_DOWN_MASK = 128; + public const int CTRL_MASK = 2; + public const int META_DOWN_MASK = 256; + public const int META_MASK = 4; + public const int SHIFT_DOWN_MASK = 64; + public const int SHIFT_MASK = 1; + } + + public class KeyEvent { + //public const char CHAR_UNDEFINED = 65535; + public const int KEY_FIRST = 400; + public const int KEY_LAST = 402; + public const int KEY_LOCATION_LEFT = 2; + public const int KEY_LOCATION_NUMPAD = 4; + public const int KEY_LOCATION_RIGHT = 3; + public const int KEY_LOCATION_STANDARD = 1; + public const int KEY_LOCATION_UNKNOWN = 0; + public const int KEY_PRESSED = 401; + public const int KEY_RELEASED = 402; + public const int KEY_TYPED = 400; + public const int VK_0 = 48; + public const int VK_1 = 49; + public const int VK_2 = 50; + public const int VK_3 = 51; + public const int VK_4 = 52; + public const int VK_5 = 53; + public const int VK_6 = 54; + public const int VK_7 = 55; + public const int VK_8 = 56; + public const int VK_9 = 57; + public const int VK_A = 65; + public const int VK_ACCEPT = 30; + public const int VK_ADD = 107; + public const int VK_AGAIN = 65481; + public const int VK_ALL_CANDIDATES = 256; + public const int VK_ALPHANUMERIC = 240; + public const int VK_ALT = 18; + public const int VK_ALT_GRAPH = 65406; + public const int VK_AMPERSAND = 150; + public const int VK_ASTERISK = 151; + public const int VK_AT = 512; + public const int VK_B = 66; + public const int VK_BACK_QUOTE = 192; + public const int VK_BACK_SLASH = 92; + public const int VK_BACK_SPACE = 8; + public const int VK_BEGIN = 65368; + public const int VK_BRACELEFT = 161; + public const int VK_BRACERIGHT = 162; + public const int VK_C = 67; + public const int VK_CANCEL = 3; + public const int VK_CAPS_LOCK = 20; + public const int VK_CIRCUMFLEX = 514; + public const int VK_CLEAR = 12; + public const int VK_CLOSE_BRACKET = 93; + public const int VK_CODE_INPUT = 258; + public const int VK_COLON = 513; + public const int VK_COMMA = 44; + public const int VK_COMPOSE = 65312; + public const int VK_CONTEXT_MENU = 525; + public const int VK_CONTROL = 17; + public const int VK_CONVERT = 28; + public const int VK_COPY = 65485; + public const int VK_CUT = 65489; + public const int VK_D = 68; + public const int VK_DEAD_ABOVEDOT = 134; + public const int VK_DEAD_ABOVERING = 136; + public const int VK_DEAD_ACUTE = 129; + public const int VK_DEAD_BREVE = 133; + public const int VK_DEAD_CARON = 138; + public const int VK_DEAD_CEDILLA = 139; + public const int VK_DEAD_CIRCUMFLEX = 130; + public const int VK_DEAD_DIAERESIS = 135; + public const int VK_DEAD_DOUBLEACUTE = 137; + public const int VK_DEAD_GRAVE = 128; + public const int VK_DEAD_IOTA = 141; + public const int VK_DEAD_MACRON = 132; + public const int VK_DEAD_OGONEK = 140; + public const int VK_DEAD_SEMIVOICED_SOUND = 143; + public const int VK_DEAD_TILDE = 131; + public const int VK_DEAD_VOICED_SOUND = 142; + public const int VK_DECIMAL = 110; + public const int VK_DELETE = 127; + public const int VK_DIVIDE = 111; + public const int VK_DOLLAR = 515; + public const int VK_DOWN = 40; + public const int VK_E = 69; + public const int VK_END = 35; + public const int VK_ENTER = 10; + public const int VK_EQUALS = 61; + public const int VK_ESCAPE = 27; + public const int VK_EURO_SIGN = 516; + public const int VK_EXCLAMATION_MARK = 517; + public const int VK_F = 70; + public const int VK_F1 = 112; + public const int VK_F10 = 121; + public const int VK_F11 = 122; + public const int VK_F12 = 123; + public const int VK_F13 = 61440; + public const int VK_F14 = 61441; + public const int VK_F15 = 61442; + public const int VK_F16 = 61443; + public const int VK_F17 = 61444; + public const int VK_F18 = 61445; + public const int VK_F19 = 61446; + public const int VK_F2 = 113; + public const int VK_F20 = 61447; + public const int VK_F21 = 61448; + public const int VK_F22 = 61449; + public const int VK_F23 = 61450; + public const int VK_F24 = 61451; + public const int VK_F3 = 114; + public const int VK_F4 = 115; + public const int VK_F5 = 116; + public const int VK_F6 = 117; + public const int VK_F7 = 118; + public const int VK_F8 = 119; + public const int VK_F9 = 120; + public const int VK_FINAL = 24; + public const int VK_FIND = 65488; + public const int VK_FULL_WIDTH = 243; + public const int VK_G = 71; + public const int VK_GREATER = 160; + public const int VK_H = 72; + public const int VK_HALF_WIDTH = 244; + public const int VK_HELP = 156; + public const int VK_HIRAGANA = 242; + public const int VK_HOME = 36; + public const int VK_I = 73; + public const int VK_INPUT_METHOD_ON_OFF = 263; + public const int VK_INSERT = 155; + public const int VK_INVERTED_EXCLAMATION_MARK = 518; + public const int VK_J = 74; + public const int VK_JAPANESE_HIRAGANA = 260; + public const int VK_JAPANESE_KATAKANA = 259; + public const int VK_JAPANESE_ROMAN = 261; + public const int VK_K = 75; + public const int VK_KANA = 21; + public const int VK_KANA_LOCK = 262; + public const int VK_KANJI = 25; + public const int VK_KATAKANA = 241; + public const int VK_KP_DOWN = 225; + public const int VK_KP_LEFT = 226; + public const int VK_KP_RIGHT = 227; + public const int VK_KP_UP = 224; + public const int VK_L = 76; + public const int VK_LEFT = 37; + public const int VK_LEFT_PARENTHESIS = 519; + public const int VK_LESS = 153; + public const int VK_M = 77; + public const int VK_META = 157; + public const int VK_MINUS = 45; + public const int VK_MODECHANGE = 31; + public const int VK_MULTIPLY = 106; + public const int VK_N = 78; + public const int VK_NONCONVERT = 29; + public const int VK_NUM_LOCK = 144; + public const int VK_NUMBER_SIGN = 520; + public const int VK_NUMPAD0 = 96; + public const int VK_NUMPAD1 = 97; + public const int VK_NUMPAD2 = 98; + public const int VK_NUMPAD3 = 99; + public const int VK_NUMPAD4 = 100; + public const int VK_NUMPAD5 = 101; + public const int VK_NUMPAD6 = 102; + public const int VK_NUMPAD7 = 103; + public const int VK_NUMPAD8 = 104; + public const int VK_NUMPAD9 = 105; + public const int VK_O = 79; + public const int VK_OPEN_BRACKET = 91; + public const int VK_P = 80; + public const int VK_PAGE_DOWN = 34; + public const int VK_PAGE_UP = 33; + public const int VK_PASTE = 65487; + public const int VK_PAUSE = 19; + public const int VK_PERIOD = 46; + public const int VK_PLUS = 521; + public const int VK_PREVIOUS_CANDIDATE = 257; + public const int VK_PRINTSCREEN = 154; + public const int VK_PROPS = 65482; + public const int VK_Q = 81; + public const int VK_QUOTE = 222; + public const int VK_QUOTEDBL = 152; + public const int VK_R = 82; + public const int VK_RIGHT = 39; + public const int VK_RIGHT_PARENTHESIS = 522; + public const int VK_ROMAN_CHARACTERS = 245; + public const int VK_S = 83; + public const int VK_SCROLL_LOCK = 145; + public const int VK_SEMICOLON = 59; + public const int VK_SEPARATER = 108; + public const int VK_SEPARATOR = 108; + public const int VK_SHIFT = 16; + public const int VK_SLASH = 47; + public const int VK_SPACE = 32; + public const int VK_STOP = 65480; + public const int VK_SUBTRACT = 109; + public const int VK_T = 84; + public const int VK_TAB = 9; + public const int VK_U = 85; + public const int VK_UNDEFINED = 0; + public const int VK_UNDERSCORE = 523; + public const int VK_UNDO = 65483; + public const int VK_UP = 38; + public const int VK_V = 86; + public const int VK_W = 87; + public const int VK_WINDOWS = 524; + public const int VK_X = 88; + public const int VK_Y = 89; + public const int VK_Z = 90; + } +} +#endif diff --git a/trunk/bocoree/awt.geom.cs b/trunk/bocoree/awt.geom.cs new file mode 100644 index 0000000..59243b6 --- /dev/null +++ b/trunk/bocoree/awt.geom.cs @@ -0,0 +1,30 @@ +/* + * awt.geom.cs + * Copyright (c) 2009 kbinani + * + * This file is part of bocoree. + * + * bocoree is free software; you can redistribute it and/or + * modify it under the terms of the BSD License. + * + * bocoree 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. + */ +#if !JAVA +namespace bocoree.java { + + public class AffineTransform { + System.Drawing.Drawing2D.Matrix m_matrix; + + public AffineTransform() { + m_matrix = new System.Drawing.Drawing2D.Matrix(); + } + + public AffineTransform( float m00, float m10, float m01, float m11, float m02, float m12 ) { + m_matrix = new System.Drawing.Drawing2D.Matrix( m00, m01, m10, m11, m02, m12 ); + } + } + +} +#endif diff --git a/trunk/bocoree/awt.image.cs b/trunk/bocoree/awt.image.cs new file mode 100644 index 0000000..bda4020 --- /dev/null +++ b/trunk/bocoree/awt.image.cs @@ -0,0 +1,54 @@ +/* + * awt.image.cs + * Copyright (c) 2009 kbinani + * + * This file is part of bocoree. + * + * bocoree is free software; you can redistribute it and/or + * modify it under the terms of the BSD License. + * + * bocoree 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. + */ +#if !JAVA +namespace bocoree.java.awt.image { + + public class BufferedImage/* : bocoree.awt.Image*/{ + public static int TYPE_INT_BGR = 0; + public static int TYPE_INT_RGB = 1; + public static int TYPE_INT_ARGB = 2; + + public System.Drawing.Bitmap m_image; + + public BufferedImage( int width, int height, int imageType ) { + System.Drawing.Imaging.PixelFormat format = System.Drawing.Imaging.PixelFormat.Format24bppRgb; + if ( imageType == TYPE_INT_ARGB ) { + format = System.Drawing.Imaging.PixelFormat.Format32bppArgb; + } + m_image = new System.Drawing.Bitmap( width, height, format ); + } + + public Graphics2D createGraphics() { + return new Graphics2D( System.Drawing.Graphics.FromImage( m_image ) ); + } + + public int getHeight( object observer ) { + return m_image.Height; + } + + public int getWidth( object observer ) { + return m_image.Width; + } + + public int getWidth() { + return m_image.Width; + } + + public int getHeight() { + return m_image.Height; + } + } + +} +#endif diff --git a/trunk/bocoree/bocoree.csproj b/trunk/bocoree/bocoree.csproj index 2d3c075..8eeb893 100644 --- a/trunk/bocoree/bocoree.csproj +++ b/trunk/bocoree/bocoree.csproj @@ -3,7 +3,7 @@ Debug AnyCPU - 9.0.21022 + 9.0.30729 2.0 {C8AAE632-9C6C-4372-8175-811528A66742} Library @@ -56,22 +56,170 @@ + + + Form + + + + + + + Component + + + Component + + + + Component + + + Component + + + + + + + + + + + + + + Form + + + + + + + Component + + + + + + + Component + + + Component + + + + Component + + + Component + + + Component + + + + + + Component + + + + UserControl + + + Component + + + Component + + + + Component + + + + + + + Component + + + Component + + + Component + + + Component + + + Component + + + Component + + + Component + + + Component + + + Component + + + Component + + + Component + + + Component + + + Component + + + Component + + + + + Component + + - + + + - - + + + + + + + + + + + + + +