2009-07-30 08:02:59 -07:00
|
|
|
|
/*
|
|
|
|
|
* AttackConfig.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.
|
|
|
|
|
*/
|
2009-09-07 03:44:18 -07:00
|
|
|
|
#if JAVA
|
2010-03-16 20:14:08 -07:00
|
|
|
|
package org.kbinani.vsq;
|
|
|
|
|
|
2009-09-07 03:44:18 -07:00
|
|
|
|
import java.io.*;
|
2010-03-16 20:14:08 -07:00
|
|
|
|
import org.kbinani.*;
|
2009-09-07 03:44:18 -07:00
|
|
|
|
#else
|
2009-07-30 08:02:59 -07:00
|
|
|
|
using System;
|
2009-09-07 03:44:18 -07:00
|
|
|
|
using bocoree;
|
2010-03-16 20:14:08 -07:00
|
|
|
|
using bocoree.java.io;
|
2009-09-07 03:44:18 -07:00
|
|
|
|
|
2009-07-30 08:02:59 -07:00
|
|
|
|
namespace Boare.Lib.Vsq {
|
2009-09-07 03:44:18 -07:00
|
|
|
|
#endif
|
2009-07-30 08:02:59 -07:00
|
|
|
|
|
|
|
|
|
public class AttackConfig {
|
|
|
|
|
public int number;
|
|
|
|
|
public String file;
|
|
|
|
|
public String author;
|
|
|
|
|
public String vendor;
|
|
|
|
|
public NoteHeadHandle contents;
|
|
|
|
|
|
|
|
|
|
public AttackConfig() {
|
|
|
|
|
contents = new NoteHeadHandle();
|
|
|
|
|
}
|
|
|
|
|
|
2010-03-16 20:14:08 -07:00
|
|
|
|
#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
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2009-07-30 08:02:59 -07:00
|
|
|
|
public void parseAic( String aic_file ) {
|
2010-03-16 20:14:08 -07:00
|
|
|
|
BufferedReader sr = null;
|
|
|
|
|
try {
|
|
|
|
|
sr = new BufferedReader( new FileReader( aic_file ) );
|
2009-07-30 08:02:59 -07:00
|
|
|
|
String line;
|
|
|
|
|
String current_entry = "";
|
|
|
|
|
String articulation = "";
|
2010-03-16 20:14:08 -07:00
|
|
|
|
while ( (line = sr.readLine()) != null ) {
|
2009-07-30 08:02:59 -07:00
|
|
|
|
if ( line.StartsWith( "[" ) ) {
|
|
|
|
|
current_entry = line;
|
|
|
|
|
continue;
|
2009-09-07 03:44:18 -07:00
|
|
|
|
} else if ( line.Equals( "" ) || line.StartsWith( ";" ) ) {
|
2009-07-30 08:02:59 -07:00
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
2010-03-16 20:14:08 -07:00
|
|
|
|
String[] spl = PortUtil.splitString( line, new char[] { '=' }, true );
|
2009-07-30 08:02:59 -07:00
|
|
|
|
if ( spl.Length < 2 ) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
spl[0] = spl[0].Trim();
|
|
|
|
|
spl[1] = spl[1].Trim();
|
2009-09-07 03:44:18 -07:00
|
|
|
|
if ( current_entry.Equals( "[Common]" ) ) {
|
|
|
|
|
if ( spl[0].Equals( "Articulation" ) ) {
|
2009-07-30 08:02:59 -07:00
|
|
|
|
articulation = spl[1];
|
|
|
|
|
}
|
2009-09-07 03:44:18 -07:00
|
|
|
|
} else if ( current_entry.Equals( "[Parameter]" ) ) {
|
|
|
|
|
if ( spl[0].Equals( "Length" ) ) {
|
2009-07-30 08:02:59 -07:00
|
|
|
|
try {
|
2010-03-16 20:14:08 -07:00
|
|
|
|
this.contents.setLength( PortUtil.parseInt( spl[1] ) );
|
|
|
|
|
} catch ( Exception ex ) {
|
|
|
|
|
}
|
2009-09-07 03:44:18 -07:00
|
|
|
|
} else if ( spl[0].Equals( "Duration" ) ) {
|
2009-07-30 08:02:59 -07:00
|
|
|
|
try {
|
2010-03-16 20:14:08 -07:00
|
|
|
|
this.contents.Duration = PortUtil.parseInt( spl[1] );
|
|
|
|
|
} catch ( Exception ex ) {
|
|
|
|
|
}
|
2009-09-07 03:44:18 -07:00
|
|
|
|
} else if ( spl[0].Equals( "Depth" ) ) {
|
2009-07-30 08:02:59 -07:00
|
|
|
|
try {
|
2010-03-16 20:14:08 -07:00
|
|
|
|
this.contents.Depth = PortUtil.parseInt( spl[1] );
|
|
|
|
|
} catch ( Exception ex ) {
|
|
|
|
|
}
|
2009-07-30 08:02:59 -07:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2010-03-16 20:14:08 -07:00
|
|
|
|
} catch ( Exception ex ) {
|
|
|
|
|
} finally {
|
|
|
|
|
if ( sr != null ) {
|
|
|
|
|
try {
|
|
|
|
|
sr.close();
|
|
|
|
|
} catch ( Exception ex2 ) {
|
|
|
|
|
}
|
|
|
|
|
}
|
2009-07-30 08:02:59 -07:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2010-03-16 20:14:08 -07:00
|
|
|
|
#if !JAVA
|
2009-07-30 08:02:59 -07:00
|
|
|
|
}
|
2010-03-16 20:14:08 -07:00
|
|
|
|
#endif
|