mirror of
https://github.com/blueskythlikesclouds/SonicAudioTools.git
synced 2025-02-13 09:12:35 +01:00
Fix audio looping and add new features
This commit is contained in:
parent
c7069bff58
commit
608f94c646
@ -1,6 +1,18 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<configSections>
|
||||
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
|
||||
<section name="CsbBuilder.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
|
||||
</sectionGroup>
|
||||
</configSections>
|
||||
<startup useLegacyV2RuntimeActivationPolicy="true">
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
|
||||
</startup>
|
||||
<userSettings>
|
||||
<CsbBuilder.Properties.Settings>
|
||||
<setting name="NameNodeAfterItsParent" serializeAs="String">
|
||||
<value>False</value>
|
||||
</setting>
|
||||
</CsbBuilder.Properties.Settings>
|
||||
</userSettings>
|
||||
</configuration>
|
@ -1,235 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.IO;
|
||||
|
||||
using SonicAudioLib.IO;
|
||||
using NAudio.Wave;
|
||||
|
||||
namespace CsbBuilder.Audio
|
||||
{
|
||||
public struct AdxHeader
|
||||
{
|
||||
public ushort Identifier;
|
||||
public ushort DataPosition;
|
||||
public byte EncodeType;
|
||||
public byte BlockLength;
|
||||
public byte SampleBitdepth;
|
||||
public byte ChannelCount;
|
||||
public uint SampleRate;
|
||||
public uint SampleCount;
|
||||
public ushort CutoffFrequency;
|
||||
public byte Version;
|
||||
public byte Flags;
|
||||
public bool LoopEnabled;
|
||||
public uint LoopBeginSampleIndex;
|
||||
public uint LoopBeginByteIndex;
|
||||
public uint LoopEndSampleIndex;
|
||||
public uint LoopEndByteIndex;
|
||||
}
|
||||
|
||||
public static class AdxConverter
|
||||
{
|
||||
public static void ConvertToWav(string sourceFileName)
|
||||
{
|
||||
ConvertToWav(sourceFileName, Path.ChangeExtension(sourceFileName, "wav"));
|
||||
}
|
||||
|
||||
public static void ConvertToWav(string sourceFileName, string destinationFileName)
|
||||
{
|
||||
BufferedWaveProvider provider = Decode(sourceFileName, 1.0, 0.0);
|
||||
|
||||
using (WaveFileWriter writer = new WaveFileWriter(destinationFileName, provider.WaveFormat))
|
||||
{
|
||||
int num;
|
||||
|
||||
byte[] buffer = new byte[32767];
|
||||
while ((num = provider.Read(buffer, 0, buffer.Length)) != 0)
|
||||
{
|
||||
writer.Write(buffer, 0, num);
|
||||
}
|
||||
}
|
||||
|
||||
provider.ClearBuffer();
|
||||
}
|
||||
|
||||
public static AdxHeader LoadHeader(string sourceFileName)
|
||||
{
|
||||
using (Stream source = File.OpenRead(sourceFileName))
|
||||
{
|
||||
return ReadHeader(source);
|
||||
}
|
||||
}
|
||||
|
||||
public static AdxHeader ReadHeader(Stream source)
|
||||
{
|
||||
AdxHeader header = new AdxHeader();
|
||||
header.Identifier = EndianStream.ReadUInt16BE(source);
|
||||
header.DataPosition = EndianStream.ReadUInt16BE(source);
|
||||
header.EncodeType = EndianStream.ReadByte(source);
|
||||
header.BlockLength = EndianStream.ReadByte(source);
|
||||
header.SampleBitdepth = EndianStream.ReadByte(source);
|
||||
header.ChannelCount = EndianStream.ReadByte(source);
|
||||
header.SampleRate = EndianStream.ReadUInt32BE(source);
|
||||
header.SampleCount = EndianStream.ReadUInt32BE(source);
|
||||
header.CutoffFrequency = EndianStream.ReadUInt16BE(source);
|
||||
header.Version = EndianStream.ReadByte(source);
|
||||
header.Flags = EndianStream.ReadByte(source);
|
||||
source.Seek(4, SeekOrigin.Current);
|
||||
header.LoopEnabled = EndianStream.ReadUInt32BE(source) > 0;
|
||||
header.LoopBeginSampleIndex = EndianStream.ReadUInt32BE(source);
|
||||
header.LoopBeginByteIndex = EndianStream.ReadUInt32BE(source);
|
||||
header.LoopEndSampleIndex = EndianStream.ReadUInt32BE(source);
|
||||
header.LoopEndByteIndex = EndianStream.ReadUInt32BE(source);
|
||||
return header;
|
||||
}
|
||||
|
||||
public static BufferedWaveProvider Decode(string sourceFileName, double volume, double pitch)
|
||||
{
|
||||
using (Stream source = File.OpenRead(sourceFileName))
|
||||
{
|
||||
return Decode(source, volume, pitch);
|
||||
}
|
||||
}
|
||||
|
||||
private static void CalculateCoefficients(double cutoffFrequency, double sampleRate, out short coef1, out short coef2)
|
||||
{
|
||||
double a = Math.Sqrt(2.0);
|
||||
double b = a - Math.Cos(cutoffFrequency * 6.2831855 / sampleRate);
|
||||
double c = (b - Math.Sqrt((b - (a - 1.0)) * (a - 1.0 + b))) / (a - 1.0);
|
||||
|
||||
coef1 = (short)(8192.0 * c);
|
||||
coef2 = (short)(c * c * -4096.0);
|
||||
}
|
||||
|
||||
// https://wiki.multimedia.cx/index.php/CRI_ADX_ADPCM
|
||||
public static BufferedWaveProvider Decode(Stream source, double volume, double pitch)
|
||||
{
|
||||
AdxHeader header = ReadHeader(source);
|
||||
|
||||
WaveFormat waveFormat = new WaveFormat((int)header.SampleRate, 16, header.ChannelCount);
|
||||
BufferedWaveProvider provider = new BufferedWaveProvider(waveFormat);
|
||||
provider.BufferLength = (int)(header.SampleCount * header.ChannelCount * 2);
|
||||
|
||||
provider.ReadFully = false;
|
||||
provider.DiscardOnBufferOverflow = true;
|
||||
|
||||
short firstHistory1 = 0;
|
||||
short firstHistory2 = 0;
|
||||
short secondHistory1 = 0;
|
||||
short secondHistory2 = 0;
|
||||
|
||||
CalculateCoefficients(header.CutoffFrequency, header.SampleRate, out short coef1, out short coef2);
|
||||
|
||||
source.Seek(header.DataPosition + 4, SeekOrigin.Begin);
|
||||
|
||||
if (header.ChannelCount == 1)
|
||||
{
|
||||
for (int i = 0; i < header.SampleCount / 32; i++)
|
||||
{
|
||||
byte[] block = EndianStream.ReadBytes(source, header.BlockLength);
|
||||
foreach (short sampleShort in DecodeBlock(block, ref firstHistory1, ref firstHistory2, coef1, coef2))
|
||||
{
|
||||
double sample = (double)sampleShort * volume;
|
||||
|
||||
if (sample > short.MaxValue)
|
||||
{
|
||||
sample = short.MaxValue;
|
||||
}
|
||||
|
||||
if (sample < short.MinValue)
|
||||
{
|
||||
sample = short.MinValue;
|
||||
}
|
||||
|
||||
provider.AddSamples(BitConverter.GetBytes((short)sample), 0, 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
else if (header.ChannelCount == 2)
|
||||
{
|
||||
for (int i = 0; i < header.SampleCount / 32; i++)
|
||||
{
|
||||
byte[] blockLeft = EndianStream.ReadBytes(source, header.BlockLength);
|
||||
byte[] blockRight = EndianStream.ReadBytes(source, header.BlockLength);
|
||||
|
||||
short[] samplesLeft = DecodeBlock(blockLeft, ref firstHistory1, ref firstHistory2, coef1, coef2);
|
||||
short[] samplesRight = DecodeBlock(blockRight, ref secondHistory1, ref secondHistory2, coef1, coef2);
|
||||
|
||||
for (int j = 0; j < 32; j++)
|
||||
{
|
||||
double newSampleLeft = samplesLeft[j] * volume;
|
||||
double newSampleRight = samplesRight[j] * volume;
|
||||
|
||||
if (newSampleLeft > short.MaxValue)
|
||||
{
|
||||
newSampleLeft = short.MaxValue;
|
||||
}
|
||||
|
||||
if (newSampleLeft < short.MinValue)
|
||||
{
|
||||
newSampleLeft = short.MinValue;
|
||||
}
|
||||
|
||||
if (newSampleRight > short.MaxValue)
|
||||
{
|
||||
newSampleRight = short.MaxValue;
|
||||
}
|
||||
|
||||
if (newSampleRight < short.MinValue)
|
||||
{
|
||||
newSampleRight = short.MinValue;
|
||||
}
|
||||
|
||||
samplesLeft[j] = (short)newSampleLeft;
|
||||
samplesRight[j] = (short)newSampleRight;
|
||||
|
||||
byte[] sampleLeft = BitConverter.GetBytes(samplesLeft[j]);
|
||||
byte[] sampleRight = BitConverter.GetBytes(samplesRight[j]);
|
||||
|
||||
provider.AddSamples(new byte[] { sampleLeft[0], sampleLeft[1], sampleRight[0], sampleRight[1] }, 0, 4);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return provider;
|
||||
}
|
||||
|
||||
public static short[] DecodeBlock(byte[] block, ref short history1, ref short history2, short coef1, short coef2)
|
||||
{
|
||||
int scale = (block[0] << 8 | block[1]) + 1;
|
||||
|
||||
short[] samples = new short[32];
|
||||
|
||||
for (int i = 0; i < 32; i++)
|
||||
{
|
||||
int sampleByte = block[2 + i / 2];
|
||||
int sampleNibble = ((i & 1) != 0 ? (sampleByte & 7) - (sampleByte & 8) : ((sampleByte & 0x70) - (sampleByte & 0x80)) >> 4);
|
||||
int sampleDelta = sampleNibble * scale;
|
||||
int predictedSample12 = coef1 * history1 + coef2 * history2;
|
||||
int predictedSample = predictedSample12 >> 12;
|
||||
|
||||
int sampleRaw = predictedSample + sampleDelta;
|
||||
|
||||
if (sampleRaw > short.MaxValue)
|
||||
{
|
||||
sampleRaw = short.MaxValue;
|
||||
}
|
||||
|
||||
else if (sampleRaw < short.MinValue)
|
||||
{
|
||||
sampleRaw = short.MinValue;
|
||||
}
|
||||
|
||||
samples[i] = (short)sampleRaw;
|
||||
|
||||
history2 = history1;
|
||||
history1 = (short)sampleRaw;
|
||||
}
|
||||
|
||||
return samples;
|
||||
}
|
||||
}
|
||||
}
|
478
Source/CsbBuilder/Audio/AdxFileReader.cs
Normal file
478
Source/CsbBuilder/Audio/AdxFileReader.cs
Normal file
@ -0,0 +1,478 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
using SonicAudioLib.IO;
|
||||
|
||||
using NAudio.Wave;
|
||||
using NAudio.Wave.SampleProviders;
|
||||
|
||||
namespace CsbBuilder.Audio
|
||||
{
|
||||
public struct AdxHeader
|
||||
{
|
||||
public ushort Identifier;
|
||||
public ushort DataPosition;
|
||||
public byte EncodeType;
|
||||
public byte BlockLength;
|
||||
public byte SampleBitdepth;
|
||||
public byte ChannelCount;
|
||||
public uint SampleRate;
|
||||
public uint SampleCount;
|
||||
public ushort CutoffFrequency;
|
||||
public ushort Version;
|
||||
public short[][] SampleHistories;
|
||||
}
|
||||
|
||||
public class AdxFileReader : WaveStream
|
||||
{
|
||||
private class SampleHistory
|
||||
{
|
||||
public short Sample1 = 0;
|
||||
public short Sample2 = 0;
|
||||
}
|
||||
|
||||
private Stream source;
|
||||
|
||||
private AdxHeader header;
|
||||
private WaveFormat waveFormat;
|
||||
|
||||
private short coef1;
|
||||
private short coef2;
|
||||
|
||||
private SampleHistory[] histories;
|
||||
|
||||
private int sampleCount;
|
||||
private int readSamples;
|
||||
|
||||
private byte[] previousSamples;
|
||||
|
||||
private double volume = 1;
|
||||
private double pitch = 0;
|
||||
private long delayTime = 0;
|
||||
private DateTime startTime;
|
||||
|
||||
public override WaveFormat WaveFormat
|
||||
{
|
||||
get
|
||||
{
|
||||
return waveFormat;
|
||||
}
|
||||
}
|
||||
|
||||
public override long Length
|
||||
{
|
||||
get
|
||||
{
|
||||
return sampleCount * 2;
|
||||
}
|
||||
}
|
||||
|
||||
public override long Position
|
||||
{
|
||||
get
|
||||
{
|
||||
return readSamples * 2;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsFinished
|
||||
{
|
||||
get
|
||||
{
|
||||
return readSamples >= sampleCount;
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsLoopEnabled { get; set; }
|
||||
|
||||
public double Volume
|
||||
{
|
||||
set
|
||||
{
|
||||
volume = value;
|
||||
}
|
||||
}
|
||||
|
||||
public double Pitch
|
||||
{
|
||||
set
|
||||
{
|
||||
pitch = value;
|
||||
}
|
||||
}
|
||||
|
||||
public int DelayTime
|
||||
{
|
||||
set
|
||||
{
|
||||
startTime = DateTime.Now;
|
||||
delayTime = value * 10000;
|
||||
}
|
||||
}
|
||||
|
||||
public override int Read(byte[] buffer, int offset, int count)
|
||||
{
|
||||
if (IsFinished && !IsLoopEnabled)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (delayTime > 0)
|
||||
{
|
||||
if ((DateTime.Now - startTime).Ticks < delayTime)
|
||||
{
|
||||
return count;
|
||||
}
|
||||
|
||||
delayTime = 0;
|
||||
}
|
||||
|
||||
int length = count;
|
||||
|
||||
while ((length % (header.ChannelCount * 64)) != 0)
|
||||
{
|
||||
length++;
|
||||
}
|
||||
|
||||
byte[] samples = new byte[length];
|
||||
|
||||
int currentLength = 0;
|
||||
|
||||
while (currentLength < length)
|
||||
{
|
||||
int sampleLength = GetNextSamples(samples, currentLength);
|
||||
|
||||
if (sampleLength < 0)
|
||||
{
|
||||
count = count > currentLength ? currentLength : count;
|
||||
break;
|
||||
}
|
||||
|
||||
currentLength = sampleLength;
|
||||
}
|
||||
|
||||
if (previousSamples != null)
|
||||
{
|
||||
samples = previousSamples.Concat(samples).ToArray();
|
||||
length = samples.Length;
|
||||
}
|
||||
|
||||
if (length > count)
|
||||
{
|
||||
previousSamples = samples.Skip(count).ToArray();
|
||||
}
|
||||
|
||||
else if (length < count)
|
||||
{
|
||||
previousSamples = null;
|
||||
count = length;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
previousSamples = null;
|
||||
}
|
||||
|
||||
Array.Copy(samples, 0, buffer, offset, count);
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
private int GetNextSamples(byte[] destination, int startIndex)
|
||||
{
|
||||
short[][] channelSamples = new short[header.ChannelCount][];
|
||||
|
||||
for (int i = 0; i < header.ChannelCount; i++)
|
||||
{
|
||||
if (!DecodeBlock(i, out short[] samples))
|
||||
{
|
||||
if (IsLoopEnabled)
|
||||
{
|
||||
Reset();
|
||||
DecodeBlock(i, out samples);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
readSamples = sampleCount;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
channelSamples[i] = samples;
|
||||
}
|
||||
|
||||
int position = startIndex;
|
||||
|
||||
for (int i = 0; i < 32; i++)
|
||||
{
|
||||
for (int j = 0; j < header.ChannelCount; j++)
|
||||
{
|
||||
short sample = (short)(channelSamples[j][i] * volume);
|
||||
|
||||
destination[position++] = (byte)sample;
|
||||
destination[position++] = (byte)(sample >> 8);
|
||||
}
|
||||
}
|
||||
|
||||
return position;
|
||||
}
|
||||
|
||||
private bool DecodeBlock(int c, out short[] samples)
|
||||
{
|
||||
int scale = EndianStream.ReadUInt16BE(source) + 1;
|
||||
|
||||
// There seems to be a null sample block at the end of every adx file.
|
||||
// It always added a half second delay between intro and loop, so
|
||||
// I wanted to get rid of it.
|
||||
if (scale > short.MaxValue + 1)
|
||||
{
|
||||
samples = null;
|
||||
return false;
|
||||
}
|
||||
|
||||
samples = new short[32];
|
||||
|
||||
int sampleByte = 0;
|
||||
|
||||
SampleHistory history = histories[c];
|
||||
for (int i = 0; i < 32; i++)
|
||||
{
|
||||
if ((i % 2) == 0)
|
||||
{
|
||||
sampleByte = source.ReadByte();
|
||||
}
|
||||
|
||||
int sample = ((i & 1) != 0 ?
|
||||
(sampleByte & 7) - (sampleByte & 8) :
|
||||
((sampleByte & 0x70) - (sampleByte & 0x80)) >> 4) * scale +
|
||||
((coef1 * history.Sample1 + coef2 * history.Sample2) >> 12);
|
||||
|
||||
sample = sample > short.MaxValue ? short.MaxValue : sample < short.MinValue ? short.MinValue : sample;
|
||||
|
||||
samples[i] = (short)sample;
|
||||
|
||||
history.Sample2 = history.Sample1;
|
||||
history.Sample1 = (short)sample;
|
||||
|
||||
readSamples++;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public void Reset()
|
||||
{
|
||||
source.Seek(header.DataPosition + 4, SeekOrigin.Begin);
|
||||
readSamples = 0;
|
||||
}
|
||||
|
||||
public void ReplaceHistories(AdxFileReader reader)
|
||||
{
|
||||
histories = reader.histories;
|
||||
}
|
||||
|
||||
public static AdxHeader LoadHeader(string sourceFileName)
|
||||
{
|
||||
using (Stream source = File.OpenRead(sourceFileName))
|
||||
{
|
||||
return ReadHeader(source);
|
||||
}
|
||||
}
|
||||
|
||||
public static AdxHeader ReadHeader(Stream source)
|
||||
{
|
||||
AdxHeader header = new AdxHeader();
|
||||
header.Identifier = EndianStream.ReadUInt16BE(source);
|
||||
header.DataPosition = EndianStream.ReadUInt16BE(source);
|
||||
header.EncodeType = EndianStream.ReadByte(source);
|
||||
header.BlockLength = EndianStream.ReadByte(source);
|
||||
header.SampleBitdepth = EndianStream.ReadByte(source);
|
||||
header.ChannelCount = EndianStream.ReadByte(source);
|
||||
header.SampleRate = EndianStream.ReadUInt32BE(source);
|
||||
header.SampleCount = EndianStream.ReadUInt32BE(source);
|
||||
header.CutoffFrequency = EndianStream.ReadUInt16BE(source);
|
||||
header.Version = EndianStream.ReadUInt16BE(source);
|
||||
return header;
|
||||
}
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
source.Close();
|
||||
}
|
||||
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
public AdxFileReader(string fileName) : this(File.OpenRead(fileName))
|
||||
{
|
||||
}
|
||||
|
||||
public AdxFileReader(Stream source)
|
||||
{
|
||||
this.source = source;
|
||||
|
||||
header = AdxFileReader.ReadHeader(this.source);
|
||||
source.Seek(header.DataPosition + 4, SeekOrigin.Begin);
|
||||
|
||||
// Calculate coefficients
|
||||
double a = Math.Sqrt(2.0);
|
||||
double b = a - Math.Cos(header.CutoffFrequency * Math.PI * 2.0 / header.SampleRate);
|
||||
double c = (b - Math.Sqrt((b - (a - 1.0)) * (a - 1.0 + b))) / (a - 1.0);
|
||||
|
||||
coef1 = (short)(8192.0 * c);
|
||||
coef2 = (short)(c * c * -4096.0);
|
||||
|
||||
histories = new SampleHistory[header.ChannelCount];
|
||||
for (int i = 0; i < histories.Length; i++)
|
||||
{
|
||||
histories[i] = new SampleHistory();
|
||||
}
|
||||
|
||||
sampleCount = (int)(header.SampleCount * header.ChannelCount);
|
||||
waveFormat = new WaveFormat((int)header.SampleRate, 16, header.ChannelCount);
|
||||
}
|
||||
}
|
||||
|
||||
public class ExtendedAdxFileReader : WaveStream
|
||||
{
|
||||
private List<AdxFileReader> readers = new List<AdxFileReader>();
|
||||
private int currentIndex = 0;
|
||||
|
||||
public override long Length
|
||||
{
|
||||
get
|
||||
{
|
||||
long totalLength = 0;
|
||||
|
||||
foreach (AdxFileReader reader in readers)
|
||||
{
|
||||
totalLength += reader.Length;
|
||||
}
|
||||
|
||||
return totalLength;
|
||||
}
|
||||
}
|
||||
|
||||
public override long Position
|
||||
{
|
||||
get
|
||||
{
|
||||
long position = 0;
|
||||
|
||||
foreach (AdxFileReader reader in readers)
|
||||
{
|
||||
if (reader == readers[currentIndex])
|
||||
{
|
||||
position += reader.Position;
|
||||
break;
|
||||
}
|
||||
|
||||
position += reader.Length;
|
||||
}
|
||||
|
||||
return position;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
||||
public override WaveFormat WaveFormat
|
||||
{
|
||||
get
|
||||
{
|
||||
return readers[currentIndex].WaveFormat;
|
||||
}
|
||||
}
|
||||
|
||||
public double Volume
|
||||
{
|
||||
set
|
||||
{
|
||||
readers.ForEach(reader => reader.Volume = value);
|
||||
}
|
||||
}
|
||||
|
||||
public double Pitch
|
||||
{
|
||||
set
|
||||
{
|
||||
readers.ForEach(reader => reader.Pitch = value);
|
||||
}
|
||||
}
|
||||
|
||||
public int DelayTime
|
||||
{
|
||||
set
|
||||
{
|
||||
readers.First().DelayTime = value;
|
||||
}
|
||||
}
|
||||
|
||||
public override int Read(byte[] buffer, int offset, int count)
|
||||
{
|
||||
int num = readers[currentIndex].Read(buffer, 0, count);
|
||||
|
||||
if ((num < count) && !readers[currentIndex].IsLoopEnabled)
|
||||
{
|
||||
currentIndex++;
|
||||
|
||||
readers[currentIndex].ReplaceHistories(readers[currentIndex - 1]);
|
||||
|
||||
int num2 = readers[currentIndex].Read(buffer, num, count - num);
|
||||
return num + num2;
|
||||
}
|
||||
|
||||
else if (readers[currentIndex].IsFinished && !readers[currentIndex].IsLoopEnabled)
|
||||
{
|
||||
currentIndex++;
|
||||
|
||||
readers[currentIndex].ReplaceHistories(readers[currentIndex - 1]);
|
||||
|
||||
num = readers[currentIndex].Read(buffer, 0, count);
|
||||
}
|
||||
|
||||
return num;
|
||||
}
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
readers.ForEach(reader => reader.Dispose());
|
||||
}
|
||||
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
public ExtendedAdxFileReader(params string[] fileNames) : this(fileNames.Select(fileName => File.OpenRead(fileName)).ToArray())
|
||||
{
|
||||
}
|
||||
|
||||
public ExtendedAdxFileReader(params Stream[] sources)
|
||||
{
|
||||
foreach (Stream source in sources)
|
||||
{
|
||||
readers.Add(new AdxFileReader(source));
|
||||
}
|
||||
|
||||
// The last one is the one to loop
|
||||
readers.Last().IsLoopEnabled = true;
|
||||
}
|
||||
}
|
||||
}
|
@ -307,11 +307,11 @@ namespace CsbBuilder.Builder
|
||||
});
|
||||
|
||||
// Finally, serialize the CSB file.
|
||||
CriTableSerializer.Serialize(outputFileName, cueSheetTables, CriTableWriterSettings.AdxSettings);
|
||||
CriTableSerializer.Serialize(outputFileName, cueSheetTables, CriTableWriterSettings.AdxSettings, MainForm.Settings.BufferSize);
|
||||
|
||||
if (cpkArchive.Count > 0)
|
||||
{
|
||||
cpkArchive.Save(Path.ChangeExtension(outputFileName, "cpk"));
|
||||
cpkArchive.Save(Path.ChangeExtension(outputFileName, "cpk"), MainForm.Settings.BufferSize);
|
||||
}
|
||||
|
||||
foreach (FileInfo junk in junks)
|
||||
|
@ -30,7 +30,7 @@ namespace CsbBuilder
|
||||
maskedTextBox1.Text = Path.GetFileNameWithoutExtension(name);
|
||||
|
||||
string directoryName = Path.GetDirectoryName(name);
|
||||
maskedTextBox2.Text = !string.IsNullOrEmpty(directoryName) ? Path.ChangeExtension(name, null) : Path.Combine(Program.ProjectsPath, name);
|
||||
maskedTextBox2.Text = !string.IsNullOrEmpty(directoryName) && MainForm.Settings.ImportedCsbProjectDirectory == Settings.ProjectDirectory.DirectoryOfCsb ? Path.ChangeExtension(name, null) : Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), MainForm.Settings.ProjectsDirectory, Path.GetFileNameWithoutExtension(name));
|
||||
}
|
||||
|
||||
public CreateNewProjectForm()
|
||||
|
@ -53,6 +53,7 @@
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Audio\AdxFileReader.cs" />
|
||||
<Compile Include="BuilderNode\BuilderAisacGraphNode.cs" />
|
||||
<Compile Include="BuilderNode\BuilderAisacNode.cs" />
|
||||
<Compile Include="BuilderNode\BuilderAisacPointNode.cs" />
|
||||
@ -74,9 +75,9 @@
|
||||
<Compile Include="CreateNewProjectForm.Designer.cs">
|
||||
<DependentUpon>CreateNewProjectForm.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Audio\AdxConverter.cs" />
|
||||
<Compile Include="Extensions.cs" />
|
||||
<Compile Include="Importer\CsbImporter.cs" />
|
||||
<Compile Include="Settings.cs" />
|
||||
<Compile Include="SetAudioForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
@ -107,6 +108,12 @@
|
||||
<Compile Include="SetReferenceForm.Designer.cs">
|
||||
<DependentUpon>SetReferenceForm.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="SettingsForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="SettingsForm.Designer.cs">
|
||||
<DependentUpon>SettingsForm.cs</DependentUpon>
|
||||
</Compile>
|
||||
<EmbeddedResource Include="ExceptionForm.resx">
|
||||
<DependentUpon>ExceptionForm.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
@ -132,16 +139,10 @@
|
||||
<EmbeddedResource Include="SetReferenceForm.resx">
|
||||
<DependentUpon>SetReferenceForm.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="SettingsForm.resx">
|
||||
<DependentUpon>SettingsForm.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<None Include="packages.config" />
|
||||
<None Include="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||
</None>
|
||||
<Compile Include="Properties\Settings.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
@ -223,6 +224,7 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="NAudio.LICENSE.txt" />
|
||||
<None Include="Resources\Settings_16x.png" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
|
@ -29,7 +29,7 @@ namespace CsbBuilder.Importer
|
||||
CriCpkArchive cpkArchive = new CriCpkArchive();
|
||||
|
||||
// First, deserialize the main tables
|
||||
List<SerializationCueSheetTable> cueSheets = CriTableSerializer.Deserialize<SerializationCueSheetTable>(path);
|
||||
List<SerializationCueSheetTable> cueSheets = CriTableSerializer.Deserialize<SerializationCueSheetTable>(path, MainForm.Settings.BufferSize);
|
||||
|
||||
/* Deserialize all the tables we need to import.
|
||||
* None = 0,
|
||||
@ -111,7 +111,7 @@ namespace CsbBuilder.Importer
|
||||
File.WriteAllBytes(outputFileName, data);
|
||||
|
||||
// Read the samples just in case
|
||||
soundElementNode.SampleCount += AdxConverter.LoadHeader(outputFileName).SampleCount;
|
||||
soundElementNode.SampleCount += AdxFileReader.LoadHeader(outputFileName).SampleCount;
|
||||
}
|
||||
|
||||
project.SoundElementNodes.Add(soundElementNode);
|
||||
|
210
Source/CsbBuilder/MainForm.Designer.cs
generated
210
Source/CsbBuilder/MainForm.Designer.cs
generated
@ -44,6 +44,16 @@
|
||||
this.buildToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.buildCurrentProjectToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.buildCurrentProjectAsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.toolsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.toolStripMenuItem49 = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.aDXToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.convertADXsToWAVToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.aAXToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.extractAAXToFolderToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.packFolderToAAXToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.toolStripSeparator26 = new System.Windows.Forms.ToolStripSeparator();
|
||||
this.settingsButton = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.aboutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.propertyGrid = new System.Windows.Forms.PropertyGrid();
|
||||
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
|
||||
this.tabControl2 = new System.Windows.Forms.TabControl();
|
||||
@ -172,7 +182,6 @@
|
||||
this.toolStripMenuItem41 = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.toolStripMenuItem42 = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.toolStripMenuItem43 = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.aboutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.mainMenu.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
|
||||
this.splitContainer1.Panel1.SuspendLayout();
|
||||
@ -212,6 +221,7 @@
|
||||
this.mainMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.fileToolStripMenuItem,
|
||||
this.buildToolStripMenuItem,
|
||||
this.toolsToolStripMenuItem,
|
||||
this.aboutToolStripMenuItem});
|
||||
this.mainMenu.Location = new System.Drawing.Point(0, 0);
|
||||
this.mainMenu.Name = "mainMenu";
|
||||
@ -358,6 +368,84 @@
|
||||
this.buildCurrentProjectAsToolStripMenuItem.ToolTipText = "Build the current project as Cue Sheet Binary in a different path.";
|
||||
this.buildCurrentProjectAsToolStripMenuItem.Click += new System.EventHandler(this.BuildProjectAs);
|
||||
//
|
||||
// toolsToolStripMenuItem
|
||||
//
|
||||
this.toolsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.toolStripMenuItem49,
|
||||
this.toolStripSeparator26,
|
||||
this.settingsButton});
|
||||
this.toolsToolStripMenuItem.Name = "toolsToolStripMenuItem";
|
||||
this.toolsToolStripMenuItem.Size = new System.Drawing.Size(48, 20);
|
||||
this.toolsToolStripMenuItem.Text = "Tools";
|
||||
//
|
||||
// toolStripMenuItem49
|
||||
//
|
||||
this.toolStripMenuItem49.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.aDXToolStripMenuItem,
|
||||
this.aAXToolStripMenuItem});
|
||||
this.toolStripMenuItem49.Image = global::CsbBuilder.Properties.Resources.Sound;
|
||||
this.toolStripMenuItem49.Name = "toolStripMenuItem49";
|
||||
this.toolStripMenuItem49.Size = new System.Drawing.Size(152, 22);
|
||||
this.toolStripMenuItem49.Text = "Audio Tools";
|
||||
//
|
||||
// aDXToolStripMenuItem
|
||||
//
|
||||
this.aDXToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.convertADXsToWAVToolStripMenuItem});
|
||||
this.aDXToolStripMenuItem.Name = "aDXToolStripMenuItem";
|
||||
this.aDXToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
|
||||
this.aDXToolStripMenuItem.Text = "ADX";
|
||||
//
|
||||
// convertADXsToWAVToolStripMenuItem
|
||||
//
|
||||
this.convertADXsToWAVToolStripMenuItem.Name = "convertADXsToWAVToolStripMenuItem";
|
||||
this.convertADXsToWAVToolStripMenuItem.Size = new System.Drawing.Size(198, 22);
|
||||
this.convertADXsToWAVToolStripMenuItem.Text = "Convert ADX(s) to WAV";
|
||||
this.convertADXsToWAVToolStripMenuItem.Click += new System.EventHandler(this.convertADXsToWAVToolStripMenuItem_Click);
|
||||
//
|
||||
// aAXToolStripMenuItem
|
||||
//
|
||||
this.aAXToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.extractAAXToFolderToolStripMenuItem,
|
||||
this.packFolderToAAXToolStripMenuItem});
|
||||
this.aAXToolStripMenuItem.Name = "aAXToolStripMenuItem";
|
||||
this.aAXToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
|
||||
this.aAXToolStripMenuItem.Text = "AAX";
|
||||
//
|
||||
// extractAAXToFolderToolStripMenuItem
|
||||
//
|
||||
this.extractAAXToFolderToolStripMenuItem.Name = "extractAAXToFolderToolStripMenuItem";
|
||||
this.extractAAXToFolderToolStripMenuItem.Size = new System.Drawing.Size(198, 22);
|
||||
this.extractAAXToFolderToolStripMenuItem.Text = "Extract AAX(s) to folder";
|
||||
this.extractAAXToFolderToolStripMenuItem.Click += new System.EventHandler(this.extractAAXToFolderToolStripMenuItem_Click);
|
||||
//
|
||||
// packFolderToAAXToolStripMenuItem
|
||||
//
|
||||
this.packFolderToAAXToolStripMenuItem.Name = "packFolderToAAXToolStripMenuItem";
|
||||
this.packFolderToAAXToolStripMenuItem.Size = new System.Drawing.Size(198, 22);
|
||||
this.packFolderToAAXToolStripMenuItem.Text = "Pack ADX(s) to AAX";
|
||||
this.packFolderToAAXToolStripMenuItem.Click += new System.EventHandler(this.packFolderToAAXToolStripMenuItem_Click);
|
||||
//
|
||||
// toolStripSeparator26
|
||||
//
|
||||
this.toolStripSeparator26.Name = "toolStripSeparator26";
|
||||
this.toolStripSeparator26.Size = new System.Drawing.Size(149, 6);
|
||||
//
|
||||
// settingsButton
|
||||
//
|
||||
this.settingsButton.Image = global::CsbBuilder.Properties.Resources.Settings;
|
||||
this.settingsButton.Name = "settingsButton";
|
||||
this.settingsButton.Size = new System.Drawing.Size(152, 22);
|
||||
this.settingsButton.Text = "Settings";
|
||||
this.settingsButton.Click += new System.EventHandler(this.OpenSettings);
|
||||
//
|
||||
// aboutToolStripMenuItem
|
||||
//
|
||||
this.aboutToolStripMenuItem.Name = "aboutToolStripMenuItem";
|
||||
this.aboutToolStripMenuItem.Size = new System.Drawing.Size(52, 20);
|
||||
this.aboutToolStripMenuItem.Text = "About";
|
||||
this.aboutToolStripMenuItem.Click += new System.EventHandler(this.ShowAbout);
|
||||
//
|
||||
// propertyGrid
|
||||
//
|
||||
this.propertyGrid.AllowDrop = true;
|
||||
@ -731,13 +819,13 @@
|
||||
this.toolStripMenuItem47});
|
||||
this.aisacTreeMenu.Name = "contextMenuStrip1";
|
||||
this.aisacTreeMenu.RenderMode = System.Windows.Forms.ToolStripRenderMode.System;
|
||||
this.aisacTreeMenu.Size = new System.Drawing.Size(189, 104);
|
||||
this.aisacTreeMenu.Size = new System.Drawing.Size(190, 104);
|
||||
//
|
||||
// toolStripMenuItem45
|
||||
//
|
||||
this.toolStripMenuItem45.Image = global::CsbBuilder.Properties.Resources.Create;
|
||||
this.toolStripMenuItem45.Name = "toolStripMenuItem45";
|
||||
this.toolStripMenuItem45.Size = new System.Drawing.Size(188, 22);
|
||||
this.toolStripMenuItem45.Size = new System.Drawing.Size(189, 22);
|
||||
this.toolStripMenuItem45.Text = "Create";
|
||||
this.toolStripMenuItem45.ToolTipText = "Create a new node.";
|
||||
this.toolStripMenuItem45.Click += new System.EventHandler(this.CreateNode);
|
||||
@ -746,7 +834,7 @@
|
||||
//
|
||||
this.toolStripMenuItem46.Image = global::CsbBuilder.Properties.Resources.Folder;
|
||||
this.toolStripMenuItem46.Name = "toolStripMenuItem46";
|
||||
this.toolStripMenuItem46.Size = new System.Drawing.Size(188, 22);
|
||||
this.toolStripMenuItem46.Size = new System.Drawing.Size(189, 22);
|
||||
this.toolStripMenuItem46.Text = "Create Folder";
|
||||
this.toolStripMenuItem46.ToolTipText = "Create a new folder.";
|
||||
this.toolStripMenuItem46.Click += new System.EventHandler(this.CreateFolder);
|
||||
@ -754,26 +842,26 @@
|
||||
// toolStripSeparator24
|
||||
//
|
||||
this.toolStripSeparator24.Name = "toolStripSeparator24";
|
||||
this.toolStripSeparator24.Size = new System.Drawing.Size(185, 6);
|
||||
this.toolStripSeparator24.Size = new System.Drawing.Size(186, 6);
|
||||
//
|
||||
// toolStripMenuItem48
|
||||
//
|
||||
this.toolStripMenuItem48.Image = global::CsbBuilder.Properties.Resources.Template;
|
||||
this.toolStripMenuItem48.Name = "toolStripMenuItem48";
|
||||
this.toolStripMenuItem48.Size = new System.Drawing.Size(188, 22);
|
||||
this.toolStripMenuItem48.Size = new System.Drawing.Size(189, 22);
|
||||
this.toolStripMenuItem48.Text = "Load AISAC Template";
|
||||
this.toolStripMenuItem48.Click += new System.EventHandler(this.LoadTemplate);
|
||||
//
|
||||
// toolStripSeparator25
|
||||
//
|
||||
this.toolStripSeparator25.Name = "toolStripSeparator25";
|
||||
this.toolStripSeparator25.Size = new System.Drawing.Size(185, 6);
|
||||
this.toolStripSeparator25.Size = new System.Drawing.Size(186, 6);
|
||||
//
|
||||
// toolStripMenuItem47
|
||||
//
|
||||
this.toolStripMenuItem47.Image = global::CsbBuilder.Properties.Resources.Paste;
|
||||
this.toolStripMenuItem47.Name = "toolStripMenuItem47";
|
||||
this.toolStripMenuItem47.Size = new System.Drawing.Size(188, 22);
|
||||
this.toolStripMenuItem47.Size = new System.Drawing.Size(189, 22);
|
||||
this.toolStripMenuItem47.Text = "Paste";
|
||||
this.toolStripMenuItem47.ToolTipText = "Paste the copied node.";
|
||||
this.toolStripMenuItem47.Click += new System.EventHandler(this.PasteNodeOnTree);
|
||||
@ -944,13 +1032,13 @@
|
||||
this.setVoiceLimitGroupReferenceToolStripMenuItem});
|
||||
this.trackMenu.Name = "cueAndVoiceLimitGroupMenu";
|
||||
this.trackMenu.RenderMode = System.Windows.Forms.ToolStripRenderMode.System;
|
||||
this.trackMenu.Size = new System.Drawing.Size(258, 220);
|
||||
this.trackMenu.Size = new System.Drawing.Size(259, 220);
|
||||
//
|
||||
// toolStripMenuItem16
|
||||
//
|
||||
this.toolStripMenuItem16.Image = global::CsbBuilder.Properties.Resources.Create;
|
||||
this.toolStripMenuItem16.Name = "toolStripMenuItem16";
|
||||
this.toolStripMenuItem16.Size = new System.Drawing.Size(257, 22);
|
||||
this.toolStripMenuItem16.Size = new System.Drawing.Size(258, 22);
|
||||
this.toolStripMenuItem16.Text = "Create Block";
|
||||
this.toolStripMenuItem16.ToolTipText = "Create a new child block node.";
|
||||
this.toolStripMenuItem16.Click += new System.EventHandler(this.CreateChildTrackNode);
|
||||
@ -959,7 +1047,7 @@
|
||||
//
|
||||
this.createToolStripMenuItem3.Image = global::CsbBuilder.Properties.Resources.Sound;
|
||||
this.createToolStripMenuItem3.Name = "createToolStripMenuItem3";
|
||||
this.createToolStripMenuItem3.Size = new System.Drawing.Size(257, 22);
|
||||
this.createToolStripMenuItem3.Size = new System.Drawing.Size(258, 22);
|
||||
this.createToolStripMenuItem3.Text = "Create Sound";
|
||||
this.createToolStripMenuItem3.ToolTipText = "Create a new child sound node.";
|
||||
this.createToolStripMenuItem3.Click += new System.EventHandler(this.CreateChildNode);
|
||||
@ -967,13 +1055,13 @@
|
||||
// toolStripSeparator10
|
||||
//
|
||||
this.toolStripSeparator10.Name = "toolStripSeparator10";
|
||||
this.toolStripSeparator10.Size = new System.Drawing.Size(254, 6);
|
||||
this.toolStripSeparator10.Size = new System.Drawing.Size(255, 6);
|
||||
//
|
||||
// toolStripMenuItem20
|
||||
//
|
||||
this.toolStripMenuItem20.Image = global::CsbBuilder.Properties.Resources.Copy;
|
||||
this.toolStripMenuItem20.Name = "toolStripMenuItem20";
|
||||
this.toolStripMenuItem20.Size = new System.Drawing.Size(257, 22);
|
||||
this.toolStripMenuItem20.Size = new System.Drawing.Size(258, 22);
|
||||
this.toolStripMenuItem20.Text = "Copy";
|
||||
this.toolStripMenuItem20.ToolTipText = "Copy the selected node.";
|
||||
this.toolStripMenuItem20.Click += new System.EventHandler(this.CopyNode);
|
||||
@ -982,7 +1070,7 @@
|
||||
//
|
||||
this.toolStripMenuItem21.Image = global::CsbBuilder.Properties.Resources.Paste;
|
||||
this.toolStripMenuItem21.Name = "toolStripMenuItem21";
|
||||
this.toolStripMenuItem21.Size = new System.Drawing.Size(257, 22);
|
||||
this.toolStripMenuItem21.Size = new System.Drawing.Size(258, 22);
|
||||
this.toolStripMenuItem21.Text = "Paste";
|
||||
this.toolStripMenuItem21.ToolTipText = "Paste the copied node as child.";
|
||||
this.toolStripMenuItem21.Click += new System.EventHandler(this.PasteNode);
|
||||
@ -991,7 +1079,7 @@
|
||||
//
|
||||
this.toolStripMenuItem1.Image = global::CsbBuilder.Properties.Resources.Remove;
|
||||
this.toolStripMenuItem1.Name = "toolStripMenuItem1";
|
||||
this.toolStripMenuItem1.Size = new System.Drawing.Size(257, 22);
|
||||
this.toolStripMenuItem1.Size = new System.Drawing.Size(258, 22);
|
||||
this.toolStripMenuItem1.Text = "Remove";
|
||||
this.toolStripMenuItem1.ToolTipText = "Remove the selected node.";
|
||||
this.toolStripMenuItem1.Click += new System.EventHandler(this.RemoveNode);
|
||||
@ -999,13 +1087,13 @@
|
||||
// toolStripSeparator3
|
||||
//
|
||||
this.toolStripSeparator3.Name = "toolStripSeparator3";
|
||||
this.toolStripSeparator3.Size = new System.Drawing.Size(254, 6);
|
||||
this.toolStripSeparator3.Size = new System.Drawing.Size(255, 6);
|
||||
//
|
||||
// selectAisacReferenceToolStripMenuItem
|
||||
//
|
||||
this.selectAisacReferenceToolStripMenuItem.Image = global::CsbBuilder.Properties.Resources.Select;
|
||||
this.selectAisacReferenceToolStripMenuItem.Name = "selectAisacReferenceToolStripMenuItem";
|
||||
this.selectAisacReferenceToolStripMenuItem.Size = new System.Drawing.Size(257, 22);
|
||||
this.selectAisacReferenceToolStripMenuItem.Size = new System.Drawing.Size(258, 22);
|
||||
this.selectAisacReferenceToolStripMenuItem.Text = "Select AISAC Reference";
|
||||
this.selectAisacReferenceToolStripMenuItem.ToolTipText = "Select the referenced AISAC node from the AISAC tree.";
|
||||
this.selectAisacReferenceToolStripMenuItem.Click += new System.EventHandler(this.SelectAisacReference);
|
||||
@ -1014,7 +1102,7 @@
|
||||
//
|
||||
this.selectVoiceLimitGroupReferenceToolStripMenuItem.Image = global::CsbBuilder.Properties.Resources.Select;
|
||||
this.selectVoiceLimitGroupReferenceToolStripMenuItem.Name = "selectVoiceLimitGroupReferenceToolStripMenuItem";
|
||||
this.selectVoiceLimitGroupReferenceToolStripMenuItem.Size = new System.Drawing.Size(257, 22);
|
||||
this.selectVoiceLimitGroupReferenceToolStripMenuItem.Size = new System.Drawing.Size(258, 22);
|
||||
this.selectVoiceLimitGroupReferenceToolStripMenuItem.Text = "Select Voice Limit Group Reference";
|
||||
this.selectVoiceLimitGroupReferenceToolStripMenuItem.ToolTipText = "Select the referenced Voice Limit Group node from the Voice Limit Group tree.";
|
||||
this.selectVoiceLimitGroupReferenceToolStripMenuItem.Click += new System.EventHandler(this.SelectVoiceLimitGroupReference);
|
||||
@ -1022,13 +1110,13 @@
|
||||
// toolStripSeparator4
|
||||
//
|
||||
this.toolStripSeparator4.Name = "toolStripSeparator4";
|
||||
this.toolStripSeparator4.Size = new System.Drawing.Size(254, 6);
|
||||
this.toolStripSeparator4.Size = new System.Drawing.Size(255, 6);
|
||||
//
|
||||
// setAisacReferenceToolStripMenuItem
|
||||
//
|
||||
this.setAisacReferenceToolStripMenuItem.Image = global::CsbBuilder.Properties.Resources.SetReference;
|
||||
this.setAisacReferenceToolStripMenuItem.Name = "setAisacReferenceToolStripMenuItem";
|
||||
this.setAisacReferenceToolStripMenuItem.Size = new System.Drawing.Size(257, 22);
|
||||
this.setAisacReferenceToolStripMenuItem.Size = new System.Drawing.Size(258, 22);
|
||||
this.setAisacReferenceToolStripMenuItem.Text = "Set AISAC Reference";
|
||||
this.setAisacReferenceToolStripMenuItem.ToolTipText = "Set the AISAC reference from the AISAC tree.";
|
||||
this.setAisacReferenceToolStripMenuItem.Click += new System.EventHandler(this.SetAisacReference);
|
||||
@ -1037,7 +1125,7 @@
|
||||
//
|
||||
this.setVoiceLimitGroupReferenceToolStripMenuItem.Image = global::CsbBuilder.Properties.Resources.SetReference;
|
||||
this.setVoiceLimitGroupReferenceToolStripMenuItem.Name = "setVoiceLimitGroupReferenceToolStripMenuItem";
|
||||
this.setVoiceLimitGroupReferenceToolStripMenuItem.Size = new System.Drawing.Size(257, 22);
|
||||
this.setVoiceLimitGroupReferenceToolStripMenuItem.Size = new System.Drawing.Size(258, 22);
|
||||
this.setVoiceLimitGroupReferenceToolStripMenuItem.Text = "Set Voice Limit Group Reference";
|
||||
this.setVoiceLimitGroupReferenceToolStripMenuItem.ToolTipText = "Set the Voice Limit Group reference from the Voice Limit Group tree.";
|
||||
this.setVoiceLimitGroupReferenceToolStripMenuItem.Click += new System.EventHandler(this.SetVoiceLimitGroupReference);
|
||||
@ -1145,13 +1233,13 @@
|
||||
this.toolStripMenuItem8});
|
||||
this.trackItemMenu.Name = "cueAndVoiceLimitGroupMenu";
|
||||
this.trackItemMenu.RenderMode = System.Windows.Forms.ToolStripRenderMode.System;
|
||||
this.trackItemMenu.Size = new System.Drawing.Size(258, 242);
|
||||
this.trackItemMenu.Size = new System.Drawing.Size(259, 242);
|
||||
//
|
||||
// toolStripMenuItem33
|
||||
//
|
||||
this.toolStripMenuItem33.Image = global::CsbBuilder.Properties.Resources.Create;
|
||||
this.toolStripMenuItem33.Name = "toolStripMenuItem33";
|
||||
this.toolStripMenuItem33.Size = new System.Drawing.Size(257, 22);
|
||||
this.toolStripMenuItem33.Size = new System.Drawing.Size(258, 22);
|
||||
this.toolStripMenuItem33.Text = "Create";
|
||||
this.toolStripMenuItem33.ToolTipText = "Create a new node.";
|
||||
this.toolStripMenuItem33.Click += new System.EventHandler(this.CreateAndInsertSoundNode);
|
||||
@ -1159,13 +1247,13 @@
|
||||
// toolStripSeparator18
|
||||
//
|
||||
this.toolStripSeparator18.Name = "toolStripSeparator18";
|
||||
this.toolStripSeparator18.Size = new System.Drawing.Size(254, 6);
|
||||
this.toolStripSeparator18.Size = new System.Drawing.Size(255, 6);
|
||||
//
|
||||
// toolStripMenuItem23
|
||||
//
|
||||
this.toolStripMenuItem23.Image = global::CsbBuilder.Properties.Resources.Copy;
|
||||
this.toolStripMenuItem23.Name = "toolStripMenuItem23";
|
||||
this.toolStripMenuItem23.Size = new System.Drawing.Size(257, 22);
|
||||
this.toolStripMenuItem23.Size = new System.Drawing.Size(258, 22);
|
||||
this.toolStripMenuItem23.Text = "Copy";
|
||||
this.toolStripMenuItem23.ToolTipText = "Copy the selected node.";
|
||||
this.toolStripMenuItem23.Click += new System.EventHandler(this.CopyNode);
|
||||
@ -1174,7 +1262,7 @@
|
||||
//
|
||||
this.toolStripMenuItem30.Image = global::CsbBuilder.Properties.Resources.Paste;
|
||||
this.toolStripMenuItem30.Name = "toolStripMenuItem30";
|
||||
this.toolStripMenuItem30.Size = new System.Drawing.Size(257, 22);
|
||||
this.toolStripMenuItem30.Size = new System.Drawing.Size(258, 22);
|
||||
this.toolStripMenuItem30.Text = "Paste";
|
||||
this.toolStripMenuItem30.ToolTipText = "Paste the copied node after the selected node.";
|
||||
this.toolStripMenuItem30.Click += new System.EventHandler(this.PasteAndInsertNode);
|
||||
@ -1183,7 +1271,7 @@
|
||||
//
|
||||
this.toolStripMenuItem4.Image = global::CsbBuilder.Properties.Resources.Remove;
|
||||
this.toolStripMenuItem4.Name = "toolStripMenuItem4";
|
||||
this.toolStripMenuItem4.Size = new System.Drawing.Size(257, 22);
|
||||
this.toolStripMenuItem4.Size = new System.Drawing.Size(258, 22);
|
||||
this.toolStripMenuItem4.Text = "Remove";
|
||||
this.toolStripMenuItem4.ToolTipText = "Remove the selected node.";
|
||||
this.toolStripMenuItem4.Click += new System.EventHandler(this.RemoveNode);
|
||||
@ -1191,13 +1279,13 @@
|
||||
// toolStripSeparator6
|
||||
//
|
||||
this.toolStripSeparator6.Name = "toolStripSeparator6";
|
||||
this.toolStripSeparator6.Size = new System.Drawing.Size(254, 6);
|
||||
this.toolStripSeparator6.Size = new System.Drawing.Size(255, 6);
|
||||
//
|
||||
// selectSoundElementReferenceToolStripMenuItem
|
||||
//
|
||||
this.selectSoundElementReferenceToolStripMenuItem.Image = global::CsbBuilder.Properties.Resources.Select;
|
||||
this.selectSoundElementReferenceToolStripMenuItem.Name = "selectSoundElementReferenceToolStripMenuItem";
|
||||
this.selectSoundElementReferenceToolStripMenuItem.Size = new System.Drawing.Size(257, 22);
|
||||
this.selectSoundElementReferenceToolStripMenuItem.Size = new System.Drawing.Size(258, 22);
|
||||
this.selectSoundElementReferenceToolStripMenuItem.Text = "Select Sound Element Reference";
|
||||
this.selectSoundElementReferenceToolStripMenuItem.ToolTipText = "Select the referenced Sound Element node from the Sound Element tree.";
|
||||
this.selectSoundElementReferenceToolStripMenuItem.Click += new System.EventHandler(this.SelectSoundElementReference);
|
||||
@ -1206,7 +1294,7 @@
|
||||
//
|
||||
this.toolStripMenuItem5.Image = global::CsbBuilder.Properties.Resources.Select;
|
||||
this.toolStripMenuItem5.Name = "toolStripMenuItem5";
|
||||
this.toolStripMenuItem5.Size = new System.Drawing.Size(257, 22);
|
||||
this.toolStripMenuItem5.Size = new System.Drawing.Size(258, 22);
|
||||
this.toolStripMenuItem5.Text = "Select AISAC Reference";
|
||||
this.toolStripMenuItem5.ToolTipText = "Select the referenced AISAC node from the AISAC tree.";
|
||||
this.toolStripMenuItem5.Click += new System.EventHandler(this.SelectAisacReference);
|
||||
@ -1215,7 +1303,7 @@
|
||||
//
|
||||
this.toolStripMenuItem6.Image = global::CsbBuilder.Properties.Resources.Select;
|
||||
this.toolStripMenuItem6.Name = "toolStripMenuItem6";
|
||||
this.toolStripMenuItem6.Size = new System.Drawing.Size(257, 22);
|
||||
this.toolStripMenuItem6.Size = new System.Drawing.Size(258, 22);
|
||||
this.toolStripMenuItem6.Text = "Select Voice Limit Group Reference";
|
||||
this.toolStripMenuItem6.ToolTipText = "Select the referenced Voice Limit Group node from the Voice Limit Group tree.";
|
||||
this.toolStripMenuItem6.Click += new System.EventHandler(this.SelectVoiceLimitGroupReference);
|
||||
@ -1223,13 +1311,13 @@
|
||||
// toolStripSeparator7
|
||||
//
|
||||
this.toolStripSeparator7.Name = "toolStripSeparator7";
|
||||
this.toolStripSeparator7.Size = new System.Drawing.Size(254, 6);
|
||||
this.toolStripSeparator7.Size = new System.Drawing.Size(255, 6);
|
||||
//
|
||||
// setSoundElementReferenceToolStripMenuItem
|
||||
//
|
||||
this.setSoundElementReferenceToolStripMenuItem.Image = global::CsbBuilder.Properties.Resources.SetReference;
|
||||
this.setSoundElementReferenceToolStripMenuItem.Name = "setSoundElementReferenceToolStripMenuItem";
|
||||
this.setSoundElementReferenceToolStripMenuItem.Size = new System.Drawing.Size(257, 22);
|
||||
this.setSoundElementReferenceToolStripMenuItem.Size = new System.Drawing.Size(258, 22);
|
||||
this.setSoundElementReferenceToolStripMenuItem.Text = "Set Sound Element Reference";
|
||||
this.setSoundElementReferenceToolStripMenuItem.ToolTipText = "Set the Sound Element reference from the Sound Element tree.";
|
||||
this.setSoundElementReferenceToolStripMenuItem.Click += new System.EventHandler(this.SetSoundElementReference);
|
||||
@ -1238,7 +1326,7 @@
|
||||
//
|
||||
this.toolStripMenuItem7.Image = global::CsbBuilder.Properties.Resources.SetReference;
|
||||
this.toolStripMenuItem7.Name = "toolStripMenuItem7";
|
||||
this.toolStripMenuItem7.Size = new System.Drawing.Size(257, 22);
|
||||
this.toolStripMenuItem7.Size = new System.Drawing.Size(258, 22);
|
||||
this.toolStripMenuItem7.Text = "Set AISAC Reference";
|
||||
this.toolStripMenuItem7.ToolTipText = "Set the AISAC reference from the AISAC tree.";
|
||||
this.toolStripMenuItem7.Click += new System.EventHandler(this.SetAisacReference);
|
||||
@ -1247,7 +1335,7 @@
|
||||
//
|
||||
this.toolStripMenuItem8.Image = global::CsbBuilder.Properties.Resources.SetReference;
|
||||
this.toolStripMenuItem8.Name = "toolStripMenuItem8";
|
||||
this.toolStripMenuItem8.Size = new System.Drawing.Size(257, 22);
|
||||
this.toolStripMenuItem8.Size = new System.Drawing.Size(258, 22);
|
||||
this.toolStripMenuItem8.Text = "Set Voice Limit Group Reference";
|
||||
this.toolStripMenuItem8.ToolTipText = "Set the Voice Limit Group reference from the Voice Limit Group tree.";
|
||||
this.toolStripMenuItem8.Click += new System.EventHandler(this.SetVoiceLimitGroupReference);
|
||||
@ -1445,13 +1533,13 @@
|
||||
this.toolStripMenuItem38});
|
||||
this.aisacNodeMenu.Name = "cueAndVoiceLimitGroupMenu";
|
||||
this.aisacNodeMenu.RenderMode = System.Windows.Forms.ToolStripRenderMode.System;
|
||||
this.aisacNodeMenu.Size = new System.Drawing.Size(153, 148);
|
||||
this.aisacNodeMenu.Size = new System.Drawing.Size(154, 148);
|
||||
//
|
||||
// toolStripMenuItem35
|
||||
//
|
||||
this.toolStripMenuItem35.Image = global::CsbBuilder.Properties.Resources.Create;
|
||||
this.toolStripMenuItem35.Name = "toolStripMenuItem35";
|
||||
this.toolStripMenuItem35.Size = new System.Drawing.Size(152, 22);
|
||||
this.toolStripMenuItem35.Size = new System.Drawing.Size(153, 22);
|
||||
this.toolStripMenuItem35.Text = "Create";
|
||||
this.toolStripMenuItem35.ToolTipText = "Create a new node after the selected node.";
|
||||
this.toolStripMenuItem35.Click += new System.EventHandler(this.CreateAndInsertNode);
|
||||
@ -1459,13 +1547,13 @@
|
||||
// toolStripSeparator20
|
||||
//
|
||||
this.toolStripSeparator20.Name = "toolStripSeparator20";
|
||||
this.toolStripSeparator20.Size = new System.Drawing.Size(149, 6);
|
||||
this.toolStripSeparator20.Size = new System.Drawing.Size(150, 6);
|
||||
//
|
||||
// loadTemplateToolStripMenuItem
|
||||
//
|
||||
this.loadTemplateToolStripMenuItem.Image = global::CsbBuilder.Properties.Resources.Template;
|
||||
this.loadTemplateToolStripMenuItem.Name = "loadTemplateToolStripMenuItem";
|
||||
this.loadTemplateToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
|
||||
this.loadTemplateToolStripMenuItem.Size = new System.Drawing.Size(153, 22);
|
||||
this.loadTemplateToolStripMenuItem.Text = "Load Template";
|
||||
this.loadTemplateToolStripMenuItem.Click += new System.EventHandler(this.LoadTemplate);
|
||||
//
|
||||
@ -1473,20 +1561,20 @@
|
||||
//
|
||||
this.saveTemplateToolStripMenuItem.Image = global::CsbBuilder.Properties.Resources.Template;
|
||||
this.saveTemplateToolStripMenuItem.Name = "saveTemplateToolStripMenuItem";
|
||||
this.saveTemplateToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
|
||||
this.saveTemplateToolStripMenuItem.Size = new System.Drawing.Size(153, 22);
|
||||
this.saveTemplateToolStripMenuItem.Text = "Save Template";
|
||||
this.saveTemplateToolStripMenuItem.Click += new System.EventHandler(this.SaveTemplate);
|
||||
//
|
||||
// toolStripSeparator21
|
||||
//
|
||||
this.toolStripSeparator21.Name = "toolStripSeparator21";
|
||||
this.toolStripSeparator21.Size = new System.Drawing.Size(149, 6);
|
||||
this.toolStripSeparator21.Size = new System.Drawing.Size(150, 6);
|
||||
//
|
||||
// toolStripMenuItem36
|
||||
//
|
||||
this.toolStripMenuItem36.Image = global::CsbBuilder.Properties.Resources.Copy;
|
||||
this.toolStripMenuItem36.Name = "toolStripMenuItem36";
|
||||
this.toolStripMenuItem36.Size = new System.Drawing.Size(152, 22);
|
||||
this.toolStripMenuItem36.Size = new System.Drawing.Size(153, 22);
|
||||
this.toolStripMenuItem36.Text = "Copy";
|
||||
this.toolStripMenuItem36.ToolTipText = "Copy the selected node.";
|
||||
this.toolStripMenuItem36.Click += new System.EventHandler(this.CopyNode);
|
||||
@ -1495,7 +1583,7 @@
|
||||
//
|
||||
this.toolStripMenuItem37.Image = global::CsbBuilder.Properties.Resources.Paste;
|
||||
this.toolStripMenuItem37.Name = "toolStripMenuItem37";
|
||||
this.toolStripMenuItem37.Size = new System.Drawing.Size(152, 22);
|
||||
this.toolStripMenuItem37.Size = new System.Drawing.Size(153, 22);
|
||||
this.toolStripMenuItem37.Text = "Paste";
|
||||
this.toolStripMenuItem37.ToolTipText = "Paste the copied node after the selected node.";
|
||||
this.toolStripMenuItem37.Click += new System.EventHandler(this.PasteAndInsertNode);
|
||||
@ -1504,7 +1592,7 @@
|
||||
//
|
||||
this.toolStripMenuItem38.Image = global::CsbBuilder.Properties.Resources.Remove;
|
||||
this.toolStripMenuItem38.Name = "toolStripMenuItem38";
|
||||
this.toolStripMenuItem38.Size = new System.Drawing.Size(152, 22);
|
||||
this.toolStripMenuItem38.Size = new System.Drawing.Size(153, 22);
|
||||
this.toolStripMenuItem38.Text = "Remove";
|
||||
this.toolStripMenuItem38.ToolTipText = "Remove the selected node.";
|
||||
this.toolStripMenuItem38.Click += new System.EventHandler(this.RemoveNode);
|
||||
@ -1522,13 +1610,13 @@
|
||||
this.toolStripMenuItem43});
|
||||
this.aisacFolderMenu.Name = "synthSoundElementAndAisacMenu";
|
||||
this.aisacFolderMenu.RenderMode = System.Windows.Forms.ToolStripRenderMode.System;
|
||||
this.aisacFolderMenu.Size = new System.Drawing.Size(189, 148);
|
||||
this.aisacFolderMenu.Size = new System.Drawing.Size(190, 148);
|
||||
//
|
||||
// toolStripMenuItem39
|
||||
//
|
||||
this.toolStripMenuItem39.Image = global::CsbBuilder.Properties.Resources.Create;
|
||||
this.toolStripMenuItem39.Name = "toolStripMenuItem39";
|
||||
this.toolStripMenuItem39.Size = new System.Drawing.Size(188, 22);
|
||||
this.toolStripMenuItem39.Size = new System.Drawing.Size(189, 22);
|
||||
this.toolStripMenuItem39.Text = "Create";
|
||||
this.toolStripMenuItem39.ToolTipText = "Create a new child node.";
|
||||
this.toolStripMenuItem39.Click += new System.EventHandler(this.CreateChildNode);
|
||||
@ -1537,7 +1625,7 @@
|
||||
//
|
||||
this.toolStripMenuItem40.Image = global::CsbBuilder.Properties.Resources.Folder;
|
||||
this.toolStripMenuItem40.Name = "toolStripMenuItem40";
|
||||
this.toolStripMenuItem40.Size = new System.Drawing.Size(188, 22);
|
||||
this.toolStripMenuItem40.Size = new System.Drawing.Size(189, 22);
|
||||
this.toolStripMenuItem40.Text = "Create Folder";
|
||||
this.toolStripMenuItem40.ToolTipText = "Create a new child folder.";
|
||||
this.toolStripMenuItem40.Click += new System.EventHandler(this.CreateChildFolder);
|
||||
@ -1545,26 +1633,26 @@
|
||||
// toolStripSeparator22
|
||||
//
|
||||
this.toolStripSeparator22.Name = "toolStripSeparator22";
|
||||
this.toolStripSeparator22.Size = new System.Drawing.Size(185, 6);
|
||||
this.toolStripSeparator22.Size = new System.Drawing.Size(186, 6);
|
||||
//
|
||||
// toolStripMenuItem44
|
||||
//
|
||||
this.toolStripMenuItem44.Image = global::CsbBuilder.Properties.Resources.Template;
|
||||
this.toolStripMenuItem44.Name = "toolStripMenuItem44";
|
||||
this.toolStripMenuItem44.Size = new System.Drawing.Size(188, 22);
|
||||
this.toolStripMenuItem44.Size = new System.Drawing.Size(189, 22);
|
||||
this.toolStripMenuItem44.Text = "Load AISAC Template";
|
||||
this.toolStripMenuItem44.Click += new System.EventHandler(this.LoadTemplate);
|
||||
//
|
||||
// toolStripSeparator23
|
||||
//
|
||||
this.toolStripSeparator23.Name = "toolStripSeparator23";
|
||||
this.toolStripSeparator23.Size = new System.Drawing.Size(185, 6);
|
||||
this.toolStripSeparator23.Size = new System.Drawing.Size(186, 6);
|
||||
//
|
||||
// toolStripMenuItem41
|
||||
//
|
||||
this.toolStripMenuItem41.Image = global::CsbBuilder.Properties.Resources.Copy;
|
||||
this.toolStripMenuItem41.Name = "toolStripMenuItem41";
|
||||
this.toolStripMenuItem41.Size = new System.Drawing.Size(188, 22);
|
||||
this.toolStripMenuItem41.Size = new System.Drawing.Size(189, 22);
|
||||
this.toolStripMenuItem41.Text = "Copy";
|
||||
this.toolStripMenuItem41.ToolTipText = "Copy the selected node.";
|
||||
this.toolStripMenuItem41.Click += new System.EventHandler(this.CopyNode);
|
||||
@ -1573,7 +1661,7 @@
|
||||
//
|
||||
this.toolStripMenuItem42.Image = global::CsbBuilder.Properties.Resources.Paste;
|
||||
this.toolStripMenuItem42.Name = "toolStripMenuItem42";
|
||||
this.toolStripMenuItem42.Size = new System.Drawing.Size(188, 22);
|
||||
this.toolStripMenuItem42.Size = new System.Drawing.Size(189, 22);
|
||||
this.toolStripMenuItem42.Text = "Paste";
|
||||
this.toolStripMenuItem42.ToolTipText = "Paste the copied node as child.";
|
||||
this.toolStripMenuItem42.Click += new System.EventHandler(this.PasteNode);
|
||||
@ -1582,18 +1670,11 @@
|
||||
//
|
||||
this.toolStripMenuItem43.Image = global::CsbBuilder.Properties.Resources.Remove;
|
||||
this.toolStripMenuItem43.Name = "toolStripMenuItem43";
|
||||
this.toolStripMenuItem43.Size = new System.Drawing.Size(188, 22);
|
||||
this.toolStripMenuItem43.Size = new System.Drawing.Size(189, 22);
|
||||
this.toolStripMenuItem43.Text = "Remove";
|
||||
this.toolStripMenuItem43.ToolTipText = "Remove the selected node.";
|
||||
this.toolStripMenuItem43.Click += new System.EventHandler(this.RemoveNode);
|
||||
//
|
||||
// aboutToolStripMenuItem
|
||||
//
|
||||
this.aboutToolStripMenuItem.Name = "aboutToolStripMenuItem";
|
||||
this.aboutToolStripMenuItem.Size = new System.Drawing.Size(52, 20);
|
||||
this.aboutToolStripMenuItem.Text = "About";
|
||||
this.aboutToolStripMenuItem.Click += new System.EventHandler(this.ShowAbout);
|
||||
//
|
||||
// MainForm
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
@ -1794,6 +1875,15 @@
|
||||
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem48;
|
||||
private System.Windows.Forms.ToolStripSeparator toolStripSeparator25;
|
||||
private System.Windows.Forms.ToolStripMenuItem aboutToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem toolsToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripSeparator toolStripSeparator26;
|
||||
private System.Windows.Forms.ToolStripMenuItem settingsButton;
|
||||
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem49;
|
||||
private System.Windows.Forms.ToolStripMenuItem aDXToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem aAXToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem extractAAXToFolderToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem packFolderToAAXToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem convertADXsToWAVToolStripMenuItem;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -23,6 +23,7 @@ using CsbBuilder.Serialization;
|
||||
using CsbBuilder.Properties;
|
||||
|
||||
using SonicAudioLib.IO;
|
||||
using SonicAudioLib.Archive;
|
||||
|
||||
using NAudio.Wave;
|
||||
|
||||
@ -30,6 +31,8 @@ namespace CsbBuilder
|
||||
{
|
||||
public partial class MainForm : Form
|
||||
{
|
||||
public static Settings Settings;
|
||||
|
||||
private bool enabled = false;
|
||||
private bool saved = true;
|
||||
private CsbProject project = null;
|
||||
@ -47,6 +50,8 @@ namespace CsbBuilder
|
||||
imageList.Images.Add("Folder", Resources.Folder);
|
||||
imageList.Images.Add("FolderOpen", Resources.FolderOpen);
|
||||
imageList.Images.Add("Sound", Resources.Sound);
|
||||
|
||||
Settings = Settings.Load();
|
||||
}
|
||||
|
||||
public void ClearTreeViews()
|
||||
@ -263,12 +268,13 @@ namespace CsbBuilder
|
||||
|
||||
int index = 0;
|
||||
|
||||
while (collection.ContainsKey($"Cue_{index}"))
|
||||
string parentName = parent != null && Settings.NameNodeAfterParent ? parent.Name : "Cue";
|
||||
while (collection.ContainsKey($"{parentName}_{index}"))
|
||||
{
|
||||
index++;
|
||||
}
|
||||
|
||||
TreeNode treeNode = nodeIndex == -1 ? collection.Add($"Cue_{index}") : collection.Insert(nodeIndex, $"Cue_{index}");
|
||||
TreeNode treeNode = nodeIndex == -1 ? collection.Add($"{parentName}_{index}") : collection.Insert(nodeIndex, $"{parentName}_{index}");
|
||||
treeNode.Name = treeNode.Text;
|
||||
treeNode.ContextMenuStrip = cueReferenceMenu;
|
||||
BuilderCueNode cueNode = new BuilderCueNode();
|
||||
@ -331,12 +337,13 @@ namespace CsbBuilder
|
||||
|
||||
int index = 0;
|
||||
|
||||
while (collection.ContainsKey($"Synth_{index}"))
|
||||
string parentName = parent != null && Settings.NameNodeAfterParent ? parent.Name : "Synth";
|
||||
while (collection.ContainsKey($"{parentName}_{index}"))
|
||||
{
|
||||
index++;
|
||||
}
|
||||
|
||||
TreeNode treeNode = nodeIndex == -1 ? collection.Add($"Synth_{index}") : collection.Insert(nodeIndex, $"Synth_{index}");
|
||||
TreeNode treeNode = nodeIndex == -1 ? collection.Add($"{parentName}_{index}") : collection.Insert(nodeIndex, $"{parentName}_{index}");
|
||||
treeNode.Name = treeNode.Text;
|
||||
treeNode.ContextMenuStrip = trackMenu;
|
||||
BuilderSynthNode synthNode = new BuilderSynthNode();
|
||||
@ -364,12 +371,13 @@ namespace CsbBuilder
|
||||
|
||||
int index = 0;
|
||||
|
||||
while (collection.ContainsKey($"Sound_{index}"))
|
||||
string parentName = parent != null && Settings.NameNodeAfterParent ? parent.Name : "Sound";
|
||||
while (collection.ContainsKey($"{parentName}_{index}"))
|
||||
{
|
||||
index++;
|
||||
}
|
||||
|
||||
TreeNode treeNode = nodeIndex == -1 ? collection.Add($"Sound_{index}") : collection.Insert(nodeIndex, $"Sound_{index}");
|
||||
TreeNode treeNode = nodeIndex == -1 ? collection.Add($"{parentName}_{index}") : collection.Insert(nodeIndex, $"{parentName}_{index}");
|
||||
treeNode.Name = treeNode.Text;
|
||||
treeNode.ContextMenuStrip = trackItemMenu;
|
||||
treeNode.ImageIndex = 3;
|
||||
@ -398,12 +406,13 @@ namespace CsbBuilder
|
||||
|
||||
int index = 0;
|
||||
|
||||
while (collection.ContainsKey($"SoundElement_{index}"))
|
||||
string parentName = parent != null && Settings.NameNodeAfterParent ? parent.Name : "SoundElement";
|
||||
while (collection.ContainsKey($"{parentName}_{index}"))
|
||||
{
|
||||
index++;
|
||||
}
|
||||
|
||||
TreeNode treeNode = nodeIndex == -1 ? collection.Add($"SoundElement_{index}") : collection.Insert(nodeIndex, $"SoundElement_{index}");
|
||||
TreeNode treeNode = nodeIndex == -1 ? collection.Add($"{parentName}_{index}") : collection.Insert(nodeIndex, $"{parentName}_{index}");
|
||||
treeNode.Name = treeNode.Text;
|
||||
treeNode.ContextMenuStrip = soundElementMenu;
|
||||
BuilderSoundElementNode soundElementNode = new BuilderSoundElementNode();
|
||||
@ -424,12 +433,13 @@ namespace CsbBuilder
|
||||
|
||||
int index = 0;
|
||||
|
||||
while (collection.ContainsKey($"AISAC_{index}"))
|
||||
string parentName = parent != null && Settings.NameNodeAfterParent ? parent.Name : "AISAC";
|
||||
while (collection.ContainsKey($"{parentName}_{index}"))
|
||||
{
|
||||
index++;
|
||||
}
|
||||
|
||||
TreeNode treeNode = nodeIndex == -1 ? collection.Add($"AISAC_{index}") : collection.Insert(nodeIndex, $"AISAC_{index}");
|
||||
TreeNode treeNode = nodeIndex == -1 ? collection.Add($"{parentName}_{index}") : collection.Insert(nodeIndex, $"{parentName}_{index}");
|
||||
treeNode.Name = treeNode.Text;
|
||||
treeNode.ContextMenuStrip = aisacNodeMenu;
|
||||
BuilderAisacNode aisacNode = aisacNodeToImport != null ? aisacNodeToImport : new BuilderAisacNode();
|
||||
@ -448,12 +458,13 @@ namespace CsbBuilder
|
||||
|
||||
int index = 0;
|
||||
|
||||
while (collection.ContainsKey($"VoiceLimitGroup_{index}"))
|
||||
string parentName = parent != null && Settings.NameNodeAfterParent ? parent.Name : "VoiceLimitGroup";
|
||||
while (collection.ContainsKey($"{parentName}_{index}"))
|
||||
{
|
||||
index++;
|
||||
}
|
||||
|
||||
TreeNode treeNode = nodeIndex == -1 ? collection.Add($"VoiceLimitGroup_{index}") : collection.Insert(nodeIndex, $"VoiceLimitGroup_{index}");
|
||||
TreeNode treeNode = nodeIndex == -1 ? collection.Add($"{parentName}_{index}") : collection.Insert(nodeIndex, $"{parentName}_{index}");
|
||||
treeNode.Name = treeNode.Text;
|
||||
treeNode.ContextMenuStrip = nodeMenu;
|
||||
BuilderVoiceLimitGroupNode voiceLimitGroup = new BuilderVoiceLimitGroupNode();
|
||||
@ -472,6 +483,7 @@ namespace CsbBuilder
|
||||
|
||||
int index = 0;
|
||||
|
||||
string parentName = parent != null && Settings.NameNodeAfterParent ? parent.Name : "Folder";
|
||||
while (collection.ContainsKey($"Folder_{index}"))
|
||||
{
|
||||
index++;
|
||||
@ -758,41 +770,48 @@ namespace CsbBuilder
|
||||
UpdateNodes(voiceLimitGroupTree.Nodes);
|
||||
}
|
||||
|
||||
private void OnRenameEnd(object sender, NodeLabelEditEventArgs e)
|
||||
private void RenameNode(TreeNode node, string name)
|
||||
{
|
||||
if (string.IsNullOrEmpty(e.Label))
|
||||
saved = false;
|
||||
string previousName = node.FullPath;
|
||||
|
||||
// check siblings before rename
|
||||
TreeNodeCollection collection = node.Parent != null ? node.Parent.Nodes : node.TreeView.Nodes;
|
||||
|
||||
if (collection.ContainsKey(name))
|
||||
{
|
||||
e.CancelEdit = true;
|
||||
return;
|
||||
int index = -1;
|
||||
string _name = name;
|
||||
while (collection.ContainsKey(name))
|
||||
{
|
||||
name = $"{_name}_{++index}";
|
||||
}
|
||||
}
|
||||
|
||||
saved = false;
|
||||
string previousName = e.Node.FullPath;
|
||||
node.Name = name;
|
||||
node.Text = name;
|
||||
|
||||
e.Node.Name = e.Label;
|
||||
e.Node.Text = e.Label;
|
||||
|
||||
string fullPath = e.Node.FullPath;
|
||||
string fullPath = node.FullPath;
|
||||
|
||||
UpdateAllNodes();
|
||||
|
||||
if (e.Node.Tag is BuilderSynthNode)
|
||||
if (node.Tag is BuilderSynthNode)
|
||||
{
|
||||
project.CueNodes.Where(cue => cue.SynthReference == previousName).ToList().ForEach(cue => cue.SynthReference = fullPath);
|
||||
project.SynthNodes.Where(synth => synth.Children.Contains(previousName)).ToList().ForEach(synth => synth.Children[synth.Children.IndexOf(previousName)] = fullPath);
|
||||
}
|
||||
|
||||
else if (e.Node.Tag is BuilderSoundElementNode)
|
||||
else if (node.Tag is BuilderSoundElementNode)
|
||||
{
|
||||
project.SynthNodes.Where(synth => synth.SoundElementReference == previousName).ToList().ForEach(synth => synth.SoundElementReference = fullPath);
|
||||
}
|
||||
|
||||
else if (e.Node.Tag is BuilderAisacNode)
|
||||
else if (node.Tag is BuilderAisacNode)
|
||||
{
|
||||
project.SynthNodes.Where(synth => synth.AisacReference == previousName).ToList().ForEach(synth => synth.AisacReference = fullPath);
|
||||
}
|
||||
|
||||
else if (e.Node.Tag is BuilderVoiceLimitGroupNode)
|
||||
else if (node.Tag is BuilderVoiceLimitGroupNode)
|
||||
{
|
||||
project.SynthNodes.Where(synth => synth.VoiceLimitGroupReference == previousName).ToList().ForEach(synth => synth.VoiceLimitGroupReference = fullPath);
|
||||
}
|
||||
@ -800,6 +819,17 @@ namespace CsbBuilder
|
||||
propertyGrid.Refresh();
|
||||
}
|
||||
|
||||
private void OnRenameEnd(object sender, NodeLabelEditEventArgs e)
|
||||
{
|
||||
if (string.IsNullOrEmpty(e.Label) || e.Label == e.Node.Name)
|
||||
{
|
||||
e.CancelEdit = true;
|
||||
return;
|
||||
}
|
||||
|
||||
RenameNode(e.Node, e.Label);
|
||||
}
|
||||
|
||||
private void OnPropertyChange(object s, PropertyValueChangedEventArgs e)
|
||||
{
|
||||
saved = false;
|
||||
@ -1288,6 +1318,11 @@ namespace CsbBuilder
|
||||
else
|
||||
{
|
||||
synthNode.SoundElementReference = setReferenceForm.SelectedNode.FullPath;
|
||||
|
||||
if (Settings.RenameToSoundElement)
|
||||
{
|
||||
RenameNode(selectedNode, setReferenceForm.SelectedNode.Name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1353,7 +1388,7 @@ namespace CsbBuilder
|
||||
|
||||
public void ReadAdx(string path, out uint sampleRate, out byte channelCount, out uint sampleCount)
|
||||
{
|
||||
AdxHeader header = AdxConverter.LoadHeader(path);
|
||||
AdxHeader header = AdxFileReader.LoadHeader(path);
|
||||
sampleRate = header.SampleRate;
|
||||
channelCount = header.ChannelCount;
|
||||
sampleCount = header.SampleCount;
|
||||
@ -1391,111 +1426,28 @@ namespace CsbBuilder
|
||||
|
||||
private void AddSoundElementSound(BuilderSoundElementNode soundElementNode, double volume, double pitch, int sampleCount, int delayTime)
|
||||
{
|
||||
BufferedWaveProvider provider = null;
|
||||
int delayInBytes = 0;
|
||||
WaveStream waveStream = null;
|
||||
|
||||
if (!string.IsNullOrEmpty(soundElementNode.Intro))
|
||||
if (!string.IsNullOrEmpty(soundElementNode.Intro) && string.IsNullOrEmpty(soundElementNode.Loop))
|
||||
{
|
||||
provider = AdxConverter.Decode(project.GetFullAudioPath(soundElementNode.Intro), volume, pitch);
|
||||
|
||||
if (delayTime != 0)
|
||||
{
|
||||
delayInBytes = GetByteCountFromMiliseconds(delayTime, provider.WaveFormat.SampleRate, provider.WaveFormat.Channels, provider.WaveFormat.BitsPerSample);
|
||||
|
||||
byte[] buffer = new byte[provider.BufferLength];
|
||||
provider.Read(buffer, 0, buffer.Length);
|
||||
|
||||
provider = new BufferedWaveProvider(provider.WaveFormat);
|
||||
provider.BufferLength = delayInBytes + buffer.Length;
|
||||
provider.ReadFully = false;
|
||||
|
||||
provider.AddSamples(new byte[delayInBytes], 0, delayInBytes);
|
||||
provider.AddSamples(buffer, 0, buffer.Length);
|
||||
}
|
||||
waveStream = new AdxFileReader(project.GetFullAudioPath(soundElementNode.Intro)) { Volume = volume, Pitch = pitch, DelayTime = delayTime };
|
||||
}
|
||||
|
||||
// If there's ANYTHING that can loop audio files in NAudio... please, tell me!
|
||||
if (!string.IsNullOrEmpty(soundElementNode.Loop))
|
||||
else if (string.IsNullOrEmpty(soundElementNode.Intro) && !string.IsNullOrEmpty(soundElementNode.Loop))
|
||||
{
|
||||
BufferedWaveProvider loopProvider = AdxConverter.Decode(project.GetFullAudioPath(soundElementNode.Loop), volume, pitch);
|
||||
|
||||
if (provider == null && delayTime != 0)
|
||||
{
|
||||
delayInBytes = GetByteCountFromMiliseconds(delayTime, loopProvider.WaveFormat.SampleRate, loopProvider.WaveFormat.Channels, loopProvider.WaveFormat.BitsPerSample);
|
||||
}
|
||||
|
||||
int writtenByteCount = 0;
|
||||
|
||||
byte[] intro = null;
|
||||
|
||||
byte[] loop = new byte[loopProvider.BufferLength];
|
||||
loopProvider.Read(loop, 0, loop.Length);
|
||||
|
||||
if (provider != null)
|
||||
{
|
||||
intro = new byte[provider.BufferLength];
|
||||
provider.Read(intro, 0, intro.Length);
|
||||
}
|
||||
|
||||
provider = new BufferedWaveProvider(loopProvider.WaveFormat);
|
||||
provider.BufferLength = 0;
|
||||
|
||||
if (sampleCount != -1)
|
||||
{
|
||||
provider.BufferLength = delayInBytes + (sampleCount * provider.WaveFormat.Channels * provider.WaveFormat.BitsPerSample / 8);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
if (intro != null)
|
||||
{
|
||||
provider.BufferLength += intro.Length;
|
||||
}
|
||||
|
||||
provider.BufferLength += loop.Length;
|
||||
}
|
||||
|
||||
provider.ReadFully = false;
|
||||
|
||||
if (intro != null)
|
||||
{
|
||||
provider.AddSamples(intro, 0, intro.Length);
|
||||
writtenByteCount += intro.Length;
|
||||
}
|
||||
|
||||
else if (intro == null && delayTime != 0)
|
||||
{
|
||||
provider.BufferLength += delayInBytes;
|
||||
provider.AddSamples(new byte[delayInBytes], 0, delayInBytes);
|
||||
writtenByteCount += delayInBytes;
|
||||
}
|
||||
|
||||
if (sampleCount != -1)
|
||||
{
|
||||
while (writtenByteCount < provider.BufferLength)
|
||||
{
|
||||
if ((writtenByteCount + loop.Length) > provider.BufferLength)
|
||||
{
|
||||
provider.AddSamples(loop, 0, provider.BufferLength - writtenByteCount);
|
||||
break;
|
||||
}
|
||||
|
||||
writtenByteCount += loop.Length;
|
||||
provider.AddSamples(loop, 0, loop.Length);
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
provider.AddSamples(loop, 0, loop.Length);
|
||||
}
|
||||
waveStream = new ExtendedAdxFileReader(project.GetFullAudioPath(soundElementNode.Loop)) { Volume = volume, Pitch = pitch, DelayTime = delayTime };
|
||||
}
|
||||
|
||||
if (provider != null)
|
||||
else if (!string.IsNullOrEmpty(soundElementNode.Intro) && !string.IsNullOrEmpty(soundElementNode.Loop))
|
||||
{
|
||||
WaveOut sound = new WaveOut();
|
||||
sound.Init(provider);
|
||||
sounds.Add(sound);
|
||||
waveStream = new ExtendedAdxFileReader(project.GetFullAudioPath(soundElementNode.Intro), project.GetFullAudioPath(soundElementNode.Loop)) { Volume = volume, Pitch = pitch, DelayTime = delayTime };
|
||||
}
|
||||
|
||||
if (waveStream != null)
|
||||
{
|
||||
DirectSoundOut waveOut = new DirectSoundOut();
|
||||
waveOut.Init(waveStream);
|
||||
sounds.Add(waveOut);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1552,7 +1504,7 @@ namespace CsbBuilder
|
||||
synthTreeNode = synthTreeNode.Parent;
|
||||
}
|
||||
|
||||
return pitch / 1000.0;
|
||||
return pitch / 100.0;
|
||||
}
|
||||
|
||||
private double GetAbsoluteVolume(TreeNode synthTreeNode)
|
||||
@ -2175,5 +2127,156 @@ namespace CsbBuilder
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void OpenSettings(object sender, EventArgs e)
|
||||
{
|
||||
using (SettingsForm settings = new SettingsForm())
|
||||
{
|
||||
settings.ShowDialog(this);
|
||||
}
|
||||
}
|
||||
|
||||
private void convertADXsToWAVToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
using (OpenFileDialog openFileDialog = new OpenFileDialog
|
||||
{
|
||||
Title = "Convert ADX Files",
|
||||
FileName = "Select ADX files you want to convert and press Open",
|
||||
Filter = "ADX Files|*.adx",
|
||||
DefaultExt = "adx",
|
||||
Multiselect = true,
|
||||
})
|
||||
{
|
||||
if (openFileDialog.ShowDialog(this) == DialogResult.OK)
|
||||
{
|
||||
using (SaveFileDialog saveFileDialog = new SaveFileDialog
|
||||
{
|
||||
Title = "Output Directory",
|
||||
FileName = "Enter into a directory and press Save",
|
||||
})
|
||||
{
|
||||
if (saveFileDialog.ShowDialog(this) == DialogResult.OK)
|
||||
{
|
||||
foreach (string fileName in openFileDialog.FileNames)
|
||||
{
|
||||
using (AdxFileReader reader = new AdxFileReader(fileName))
|
||||
using (WaveFileWriter writer = new WaveFileWriter(
|
||||
Path.Combine(
|
||||
Path.GetDirectoryName(saveFileDialog.FileName),
|
||||
Path.GetFileNameWithoutExtension(fileName) + ".wav"),
|
||||
reader.WaveFormat))
|
||||
{
|
||||
int num;
|
||||
byte[] buffer = new byte[Settings.BufferSize];
|
||||
|
||||
while ((num = reader.Read(buffer, 0, Settings.BufferSize)) != 0)
|
||||
{
|
||||
writer.Write(buffer, 0, num);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void extractAAXToFolderToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
using (OpenFileDialog openFileDialog = new OpenFileDialog
|
||||
{
|
||||
Title = "Extract AAX Files",
|
||||
FileName = "Select AAX files you want to extract and press Open",
|
||||
Filter = "AAX Files|*.aax",
|
||||
DefaultExt = "aax",
|
||||
Multiselect = true,
|
||||
})
|
||||
{
|
||||
if (openFileDialog.ShowDialog(this) == DialogResult.OK)
|
||||
{
|
||||
using (SaveFileDialog saveFileDialog = new SaveFileDialog
|
||||
{
|
||||
Title = "Output Directory",
|
||||
FileName = "Enter into a directory and press Save",
|
||||
})
|
||||
{
|
||||
if (saveFileDialog.ShowDialog(this) == DialogResult.OK)
|
||||
{
|
||||
foreach (string fileName in openFileDialog.FileNames)
|
||||
{
|
||||
CriAaxArchive aaxArchive = new CriAaxArchive();
|
||||
aaxArchive.Load(fileName, Settings.BufferSize);
|
||||
|
||||
foreach (CriAaxEntry entry in aaxArchive)
|
||||
{
|
||||
using (Stream source = File.OpenRead(fileName))
|
||||
using (Stream destination = File.Create(
|
||||
Path.Combine(
|
||||
Path.GetDirectoryName(saveFileDialog.FileName),
|
||||
$"{Path.GetFileNameWithoutExtension(fileName)}_{entry.Flag}.adx")))
|
||||
{
|
||||
EndianStream.CopyPartTo(source, destination, entry.Position, entry.Length, Settings.BufferSize);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void packFolderToAAXToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
using (OpenFileDialog openFileDialog = new OpenFileDialog
|
||||
{
|
||||
Title = "Extract ADX Files",
|
||||
FileName = "Select ADX files you want to pack and press Open",
|
||||
Filter = "ADX Files|*.adx",
|
||||
DefaultExt = "adx",
|
||||
Multiselect = true,
|
||||
})
|
||||
{
|
||||
string[] files = null;
|
||||
DialogResult dialogResult;
|
||||
|
||||
while ((dialogResult = openFileDialog.ShowDialog(this)) == DialogResult.OK)
|
||||
{
|
||||
if (openFileDialog.FileNames.Length > 2)
|
||||
{
|
||||
MessageBox.Show("You can select maximum 2 ADX files.", "CSB Builder", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
files = openFileDialog.FileNames;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (dialogResult == DialogResult.OK)
|
||||
{
|
||||
using (SaveFileDialog saveFileDialog = new SaveFileDialog
|
||||
{
|
||||
Title = "Output File",
|
||||
FileName = "*.aax",
|
||||
Filter = "AAX Files|*.aax",
|
||||
DefaultExt = "aax",
|
||||
})
|
||||
{
|
||||
if (saveFileDialog.ShowDialog(this) == DialogResult.OK)
|
||||
{
|
||||
CriAaxArchive archive = new CriAaxArchive();
|
||||
|
||||
for (int i = 0; i < files.Length; i++)
|
||||
{
|
||||
archive.Add(new CriAaxEntry { FilePath = new FileInfo(files[i]), Flag = (CriAaxEntryFlag)i });
|
||||
}
|
||||
|
||||
archive.Save(saveFileDialog.FileName);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -8,6 +8,7 @@ using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Globalization;
|
||||
|
||||
using NAudio.Wave;
|
||||
|
||||
namespace CsbBuilder
|
||||
{
|
||||
@ -36,12 +37,6 @@ namespace CsbBuilder
|
||||
[STAThread]
|
||||
static void Main(string[] args)
|
||||
{
|
||||
if (args.Length > 0)
|
||||
{
|
||||
Audio.AdxConverter.ConvertToWav(args[0]);
|
||||
return;
|
||||
}
|
||||
|
||||
Thread.CurrentThread.CurrentUICulture = CultureInfo.GetCultureInfo("en-US");
|
||||
Application.ThreadException += OnException;
|
||||
Application.EnableVisualStyles();
|
||||
|
@ -15,8 +15,8 @@ namespace CsbBuilder.Project
|
||||
{
|
||||
public class CsbProject
|
||||
{
|
||||
private string name = "New CSB Project";
|
||||
private DirectoryInfo directory = new DirectoryInfo(Path.Combine(Program.ProjectsPath, "New CSB Project"));
|
||||
private string name;
|
||||
private DirectoryInfo directory;
|
||||
|
||||
private List<BuilderCueNode> cueNodes = new List<BuilderCueNode>();
|
||||
private List<BuilderSynthNode> synthNodes = new List<BuilderSynthNode>();
|
||||
@ -257,5 +257,11 @@ namespace CsbBuilder.Project
|
||||
directory.Create();
|
||||
AudioDirectory.Create();
|
||||
}
|
||||
|
||||
public CsbProject()
|
||||
{
|
||||
name = MainForm.Settings.ProjectsName;
|
||||
directory = new DirectoryInfo(Path.Combine(MainForm.Settings.ProjectsDirectory, name));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
10
Source/CsbBuilder/Properties/Resources.Designer.cs
generated
10
Source/CsbBuilder/Properties/Resources.Designer.cs
generated
@ -250,6 +250,16 @@ namespace CsbBuilder.Properties {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap Settings {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("Settings", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
|
@ -184,4 +184,7 @@
|
||||
<data name="Template" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\Template_16x.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="Settings" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\Settings_16x.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
</root>
|
30
Source/CsbBuilder/Properties/Settings.Designer.cs
generated
30
Source/CsbBuilder/Properties/Settings.Designer.cs
generated
@ -1,30 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace CsbBuilder.Properties
|
||||
{
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
|
||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
|
||||
{
|
||||
|
||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||
|
||||
public static Settings Default
|
||||
{
|
||||
get
|
||||
{
|
||||
return defaultInstance;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
|
||||
<Profiles>
|
||||
<Profile Name="(Default)" />
|
||||
</Profiles>
|
||||
<Settings />
|
||||
</SettingsFile>
|
BIN
Source/CsbBuilder/Resources/Settings_16x.png
Normal file
BIN
Source/CsbBuilder/Resources/Settings_16x.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 274 B |
95
Source/CsbBuilder/Settings.cs
Normal file
95
Source/CsbBuilder/Settings.cs
Normal file
@ -0,0 +1,95 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.ComponentModel;
|
||||
using System.IO;
|
||||
using System.Windows.Forms;
|
||||
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace CsbBuilder.Project
|
||||
{
|
||||
public class Settings : ICloneable
|
||||
{
|
||||
public enum ProjectDirectory
|
||||
{
|
||||
DirectoryOfProjects,
|
||||
DirectoryOfCsb,
|
||||
}
|
||||
|
||||
[DisplayName("Name node after its parent"), Category("General")]
|
||||
[Description("Names a node after its parent if it exists, or the node tree name.")]
|
||||
public bool NameNodeAfterParent { get; set; }
|
||||
|
||||
[DisplayName("Buffer size"), Category("Stream")]
|
||||
[Description("Buffer size used to copy data from streams. Higher values may make streams faster or slower. (e.g. importing/building CSB files)")]
|
||||
public int BufferSize { get; set; }
|
||||
|
||||
[DisplayName("Default directory of new CSB projects"), Category("Project")]
|
||||
[Description("Default output directory of new CSB projects (relative to where .EXE is) in New Project window.")]
|
||||
public string ProjectsDirectory { get; set; }
|
||||
|
||||
[DisplayName("Default name of new CSB projects"), Category("Project")]
|
||||
[Description("Default name of new CSB projects in New Project window.")]
|
||||
public string ProjectsName { get; set; }
|
||||
|
||||
[DisplayName("Default project directory of imported CSB files"), Category("Project")]
|
||||
[Description("Default project output directory of imported CSB files.")]
|
||||
public ProjectDirectory ImportedCsbProjectDirectory { get; set; }
|
||||
|
||||
[DisplayName("Rename Sound node to referenced Sound Element node"), Category("Application")]
|
||||
public bool RenameToSoundElement { get; set; }
|
||||
|
||||
public static Settings Load()
|
||||
{
|
||||
string path = Path.ChangeExtension(Application.ExecutablePath, "xml");
|
||||
|
||||
Settings settings = null;
|
||||
|
||||
if (File.Exists(path))
|
||||
{
|
||||
XmlSerializer serializer = new XmlSerializer(typeof(Settings));
|
||||
|
||||
using (Stream source = File.OpenRead(path))
|
||||
{
|
||||
settings = (Settings)serializer.Deserialize(source);
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
settings = new Settings();
|
||||
settings.Save();
|
||||
}
|
||||
|
||||
return settings;
|
||||
}
|
||||
|
||||
public void Save()
|
||||
{
|
||||
XmlSerializer serializer = new XmlSerializer(typeof(Settings));
|
||||
|
||||
using (Stream destination = File.Create(Path.ChangeExtension(Application.ExecutablePath, "xml"), BufferSize))
|
||||
{
|
||||
serializer.Serialize(destination, this);
|
||||
}
|
||||
}
|
||||
|
||||
public object Clone()
|
||||
{
|
||||
return MemberwiseClone();
|
||||
}
|
||||
|
||||
public Settings()
|
||||
{
|
||||
NameNodeAfterParent = true;
|
||||
BufferSize = 4096;
|
||||
ProjectsDirectory = "Projects";
|
||||
ProjectsName = "New CSB Project";
|
||||
ImportedCsbProjectDirectory = ProjectDirectory.DirectoryOfCsb;
|
||||
RenameToSoundElement = true;
|
||||
}
|
||||
}
|
||||
}
|
96
Source/CsbBuilder/SettingsForm.Designer.cs
generated
Normal file
96
Source/CsbBuilder/SettingsForm.Designer.cs
generated
Normal file
@ -0,0 +1,96 @@
|
||||
namespace CsbBuilder
|
||||
{
|
||||
partial class SettingsForm
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.button1 = new System.Windows.Forms.Button();
|
||||
this.button2 = new System.Windows.Forms.Button();
|
||||
this.propertyGrid1 = new System.Windows.Forms.PropertyGrid();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// button1
|
||||
//
|
||||
this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.button1.DialogResult = System.Windows.Forms.DialogResult.OK;
|
||||
this.button1.Location = new System.Drawing.Point(485, 482);
|
||||
this.button1.Name = "button1";
|
||||
this.button1.Size = new System.Drawing.Size(75, 23);
|
||||
this.button1.TabIndex = 0;
|
||||
this.button1.Text = "Save";
|
||||
this.button1.UseVisualStyleBackColor = true;
|
||||
this.button1.Click += new System.EventHandler(this.button1_Click);
|
||||
//
|
||||
// button2
|
||||
//
|
||||
this.button2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.button2.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||
this.button2.Location = new System.Drawing.Point(566, 482);
|
||||
this.button2.Name = "button2";
|
||||
this.button2.Size = new System.Drawing.Size(75, 23);
|
||||
this.button2.TabIndex = 1;
|
||||
this.button2.Text = "Cancel";
|
||||
this.button2.UseVisualStyleBackColor = true;
|
||||
this.button2.Click += new System.EventHandler(this.button2_Click);
|
||||
//
|
||||
// propertyGrid1
|
||||
//
|
||||
this.propertyGrid1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.propertyGrid1.Location = new System.Drawing.Point(12, 12);
|
||||
this.propertyGrid1.Name = "propertyGrid1";
|
||||
this.propertyGrid1.Size = new System.Drawing.Size(629, 464);
|
||||
this.propertyGrid1.TabIndex = 2;
|
||||
this.propertyGrid1.PropertyValueChanged += new System.Windows.Forms.PropertyValueChangedEventHandler(this.propertyGrid1_PropertyValueChanged);
|
||||
//
|
||||
// SettingsForm
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(653, 517);
|
||||
this.Controls.Add(this.propertyGrid1);
|
||||
this.Controls.Add(this.button2);
|
||||
this.Controls.Add(this.button1);
|
||||
this.MaximizeBox = false;
|
||||
this.MinimizeBox = false;
|
||||
this.Name = "SettingsForm";
|
||||
this.ShowIcon = false;
|
||||
this.Text = "Settings";
|
||||
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.SettingsForm_FormClosing);
|
||||
this.Load += new System.EventHandler(this.SettingsForm_Load);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.Button button1;
|
||||
private System.Windows.Forms.Button button2;
|
||||
private System.Windows.Forms.PropertyGrid propertyGrid1;
|
||||
}
|
||||
}
|
68
Source/CsbBuilder/SettingsForm.cs
Normal file
68
Source/CsbBuilder/SettingsForm.cs
Normal file
@ -0,0 +1,68 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
using CsbBuilder.Properties;
|
||||
using CsbBuilder.Project;
|
||||
|
||||
namespace CsbBuilder
|
||||
{
|
||||
public partial class SettingsForm : Form
|
||||
{
|
||||
private bool saved = true;
|
||||
|
||||
public SettingsForm()
|
||||
{
|
||||
InitializeComponent();
|
||||
propertyGrid1.SelectedObject = MainForm.Settings.Clone();
|
||||
}
|
||||
|
||||
private void SettingsForm_Load(object sender, EventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
private void propertyGrid1_PropertyValueChanged(object s, PropertyValueChangedEventArgs e)
|
||||
{
|
||||
saved = false;
|
||||
}
|
||||
|
||||
private void button1_Click(object sender, EventArgs e)
|
||||
{
|
||||
saved = true;
|
||||
|
||||
MainForm.Settings = (Settings)propertyGrid1.SelectedObject;
|
||||
MainForm.Settings.Save();
|
||||
|
||||
Close();
|
||||
}
|
||||
|
||||
private void button2_Click(object sender, EventArgs e)
|
||||
{
|
||||
Close();
|
||||
}
|
||||
|
||||
private void SettingsForm_FormClosing(object sender, FormClosingEventArgs e)
|
||||
{
|
||||
if (!saved && !MainForm.Settings.Equals(propertyGrid1.SelectedObject))
|
||||
{
|
||||
DialogResult result = MessageBox.Show("Do you want to save your changes?", "CSB Builder", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
|
||||
|
||||
if (result == DialogResult.OK)
|
||||
{
|
||||
button1_Click(null, null);
|
||||
}
|
||||
|
||||
else if (result == DialogResult.Cancel)
|
||||
{
|
||||
e.Cancel = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
120
Source/CsbBuilder/SettingsForm.resx
Normal file
120
Source/CsbBuilder/SettingsForm.resx
Normal file
@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
@ -20,11 +20,28 @@ namespace SonicAudioCmd
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
CriTable table = new CriTable();
|
||||
table.Load("test.utf");
|
||||
try
|
||||
{
|
||||
CriCpkArchive archive = new CriCpkArchive();
|
||||
archive.Load(args[0]);
|
||||
|
||||
Console.WriteLine(table.Rows[0]["testField"]);
|
||||
Console.ReadLine();
|
||||
using (Stream source = File.OpenRead(args[0]))
|
||||
{
|
||||
foreach (CriCpkEntry entry in archive)
|
||||
{
|
||||
using (Stream destination = File.Create(entry.Name))
|
||||
{
|
||||
EndianStream.CopyPartTo(source, destination, entry.Position, entry.Length, ushort.MaxValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
catch (Exception exception)
|
||||
{
|
||||
Console.WriteLine(exception);
|
||||
Console.ReadLine();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -473,7 +473,7 @@ namespace SonicAudioLib.CriMw
|
||||
private void WriteModule(ModuleBase module)
|
||||
{
|
||||
WriteUInt32((uint)vldPool.Put(module));
|
||||
WriteUInt32((uint)module.CalculateLength());
|
||||
WriteUInt32(0);
|
||||
}
|
||||
|
||||
private void WriteGuid(Guid guid)
|
||||
|
@ -25,7 +25,12 @@ namespace SonicAudioLib.CriMw.Serialization
|
||||
|
||||
public static void Serialize<T>(string destinationFileName, List<T> objects, CriTableWriterSettings settings)
|
||||
{
|
||||
using (Stream destination = File.Create(destinationFileName))
|
||||
Serialize(destinationFileName, objects, settings, 4096);
|
||||
}
|
||||
|
||||
public static void Serialize<T>(string destinationFileName, List<T> objects, CriTableWriterSettings settings, int bufferSize)
|
||||
{
|
||||
using (Stream destination = File.Create(destinationFileName, bufferSize))
|
||||
{
|
||||
Serialize(destination, objects, settings);
|
||||
}
|
||||
@ -226,7 +231,12 @@ namespace SonicAudioLib.CriMw.Serialization
|
||||
|
||||
public static List<T> Deserialize<T>(string sourceFileName)
|
||||
{
|
||||
return Deserialize(sourceFileName, typeof(T)).OfType<T>().ToList();
|
||||
return Deserialize<T>(sourceFileName, 4096);
|
||||
}
|
||||
|
||||
public static List<T> Deserialize<T>(string sourceFileName, int bufferSize)
|
||||
{
|
||||
return Deserialize(sourceFileName, typeof(T), bufferSize).OfType<T>().ToList();
|
||||
}
|
||||
|
||||
public static List<T> Deserialize<T>(Stream source)
|
||||
@ -247,14 +257,14 @@ namespace SonicAudioLib.CriMw.Serialization
|
||||
}
|
||||
}
|
||||
|
||||
public static ArrayList Deserialize(string sourceFileName, Type type)
|
||||
public static ArrayList Deserialize(string sourceFileName, Type type, int bufferSize)
|
||||
{
|
||||
if (!File.Exists(sourceFileName))
|
||||
{
|
||||
return new ArrayList();
|
||||
}
|
||||
|
||||
using (Stream source = File.OpenRead(sourceFileName))
|
||||
using (Stream source = new FileStream(sourceFileName, FileMode.Open, FileAccess.Read, FileShare.None, bufferSize))
|
||||
{
|
||||
return Deserialize(source, type);
|
||||
}
|
||||
@ -314,6 +324,8 @@ namespace SonicAudioLib.CriMw.Serialization
|
||||
value = Convert.ChangeType(value, Enum.GetUnderlyingType(propertyInfo.PropertyType));
|
||||
}
|
||||
|
||||
value = Convert.ChangeType(value, propertyInfo.PropertyType);
|
||||
|
||||
propertyInfo.SetValue(obj, value);
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
|
||||
namespace SonicAudioLib.IO
|
||||
{
|
||||
@ -170,10 +171,10 @@ namespace SonicAudioLib.IO
|
||||
/// </summary>
|
||||
public byte[] ToArray()
|
||||
{
|
||||
using (MemoryStream memoryStream = new MemoryStream())
|
||||
using (MemoryStream destination = new MemoryStream())
|
||||
{
|
||||
CopyTo(memoryStream);
|
||||
return memoryStream.ToArray();
|
||||
CopyTo(destination);
|
||||
return destination.ToArray();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -95,7 +95,7 @@ namespace SonicAudioLib.IO
|
||||
length = Helpers.Align(length, align);
|
||||
|
||||
long position = length;
|
||||
length += module.CalculateLength();
|
||||
length += 0;
|
||||
items.Add(module);
|
||||
|
||||
return position;
|
||||
|
@ -11,14 +11,19 @@ namespace SonicAudioLib.Module
|
||||
public abstract void Read(Stream source);
|
||||
public abstract void Write(Stream destination);
|
||||
|
||||
public virtual void Load(string sourceFileName)
|
||||
public virtual void Load(string sourceFileName, int bufferSize)
|
||||
{
|
||||
using (Stream source = File.OpenRead(sourceFileName))
|
||||
using (Stream source = new FileStream(sourceFileName, FileMode.Open, FileAccess.Read, FileShare.None, bufferSize))
|
||||
{
|
||||
Read(source);
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void Load(string sourceFileName)
|
||||
{
|
||||
Load(sourceFileName, 4096);
|
||||
}
|
||||
|
||||
public virtual void Load(byte[] sourceByteArray)
|
||||
{
|
||||
using (Stream source = new MemoryStream(sourceByteArray))
|
||||
@ -29,7 +34,12 @@ namespace SonicAudioLib.Module
|
||||
|
||||
public virtual void Save(string destinationFileName)
|
||||
{
|
||||
using (Stream destination = File.Create(destinationFileName))
|
||||
Save(destinationFileName, 4096);
|
||||
}
|
||||
|
||||
public virtual void Save(string destinationFileName, int bufferSize)
|
||||
{
|
||||
using (Stream destination = File.Create(destinationFileName, bufferSize))
|
||||
{
|
||||
Write(destination);
|
||||
}
|
||||
@ -43,10 +53,5 @@ namespace SonicAudioLib.Module
|
||||
return destination.ToArray();
|
||||
}
|
||||
}
|
||||
|
||||
public virtual long CalculateLength()
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user