Add CSB Builder

This commit is contained in:
Skyth 2017-01-26 23:40:46 +03:00
parent a1541a648b
commit 2688e7e7dc
88 changed files with 8788 additions and 1080 deletions

Binary file not shown.

BIN
Release/CsbBuilder.exe Normal file

Binary file not shown.

Binary file not shown.

BIN
Release/NAudio.dll Normal file

Binary file not shown.

Binary file not shown.

View File

@ -11,7 +11,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AcbEditor", "Source\AcbEdit
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CsbEditor", "Source\CsbEditor\CsbEditor.csproj", "{91F6B6A6-5D95-4C7A-B22E-A35BD32DB67A}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CsbEditor", "Source\CsbEditor\CsbEditor.csproj", "{91F6B6A6-5D95-4C7A-B22E-A35BD32DB67A}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CsbBuilder", "Source\CsbBuilder\CsbBuilder.csproj", "{4CF49665-3DFD-4A5C-B231-B97842F091B9}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CsbBuilder", "Source\CsbBuilder\CsbBuilder.csproj", "{70A6A571-23EC-4B2C-A579-1E6812DDC34E}"
EndProject EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -34,9 +34,10 @@ Global
{91F6B6A6-5D95-4C7A-B22E-A35BD32DB67A}.Debug|Any CPU.Build.0 = Debug|Any CPU {91F6B6A6-5D95-4C7A-B22E-A35BD32DB67A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{91F6B6A6-5D95-4C7A-B22E-A35BD32DB67A}.Release|Any CPU.ActiveCfg = Release|Any CPU {91F6B6A6-5D95-4C7A-B22E-A35BD32DB67A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{91F6B6A6-5D95-4C7A-B22E-A35BD32DB67A}.Release|Any CPU.Build.0 = Release|Any CPU {91F6B6A6-5D95-4C7A-B22E-A35BD32DB67A}.Release|Any CPU.Build.0 = Release|Any CPU
{4CF49665-3DFD-4A5C-B231-B97842F091B9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {70A6A571-23EC-4B2C-A579-1E6812DDC34E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4CF49665-3DFD-4A5C-B231-B97842F091B9}.Debug|Any CPU.Build.0 = Debug|Any CPU {70A6A571-23EC-4B2C-A579-1E6812DDC34E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4CF49665-3DFD-4A5C-B231-B97842F091B9}.Release|Any CPU.ActiveCfg = Release|Any CPU {70A6A571-23EC-4B2C-A579-1E6812DDC34E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{70A6A571-23EC-4B2C-A579-1E6812DDC34E}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE

View File

@ -10,7 +10,7 @@ using System.Runtime.InteropServices;
[assembly: AssemblyConfiguration("")] [assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")] [assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("AcbEditor")] [assembly: AssemblyProduct("AcbEditor")]
[assembly: AssemblyCopyright("Copyright © 2016")] [assembly: AssemblyCopyright("Copyright © blueskythlikesclouds 2014-2016")]
[assembly: AssemblyTrademark("")] [assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")] [assembly: AssemblyCulture("")]
@ -32,5 +32,4 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyVersion("0.3.*")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

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

View File

@ -0,0 +1,238 @@
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;
short coef1 = 0;
short coef2 = 0;
CalculateCoefficients(header.CutoffFrequency, header.SampleRate, out coef1, out 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;
}
}
}

View File

@ -0,0 +1,323 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using CsbBuilder.Project;
using CsbBuilder.BuilderNode;
using CsbBuilder.Serialization;
using SonicAudioLib.CriMw;
using SonicAudioLib.CriMw.Serialization;
using SonicAudioLib.Archive;
namespace CsbBuilder.Builder
{
public static class CsbBuilder
{
public static void Build(CsbProject project, string outputFileName)
{
CriCpkArchive cpkArchive = new CriCpkArchive();
DirectoryInfo outputDirectory = new DirectoryInfo(Path.GetDirectoryName(outputFileName));
List<SerializationCueSheetTable> cueSheetTables = new List<SerializationCueSheetTable>();
SerializationVersionInfoTable versionInfoTable = new SerializationVersionInfoTable();
cueSheetTables.Add(new SerializationCueSheetTable
{
TableData = CriTableSerializer.Serialize(new List<SerializationVersionInfoTable>() { versionInfoTable }, CriTableWriterSettings.AdxSettings),
Name = "INFO",
TableType = 7,
});
// Serialize cues.
List<SerializationCueTable> cueTables = new List<SerializationCueTable>();
foreach (BuilderCueNode cueNode in project.CueNodes)
{
cueTables.Add(new SerializationCueTable
{
Name = cueNode.Name,
Id = cueNode.Identifier,
UserData = cueNode.UserComment,
Flags = cueNode.Flags,
SynthPath = cueNode.SynthReference,
});
}
cueSheetTables.Add(new SerializationCueSheetTable
{
TableData = CriTableSerializer.Serialize(cueTables, CriTableWriterSettings.AdxSettings),
Name = "CUE",
TableType = 1,
});
// Serialize synth tables.
List<SerializationSynthTable> synthTables = new List<SerializationSynthTable>();
foreach (BuilderSynthNode synthNode in project.SynthNodes)
{
SerializationSynthTable synthTable = new SerializationSynthTable
{
SynthName = synthNode.Name,
SynthType = (byte)synthNode.Type,
ComplexType = (byte)synthNode.PlaybackType,
Volume = synthNode.Volume,
Pitch = synthNode.Pitch,
DelayTime = synthNode.DelayTime,
SControl = synthNode.SControl,
EgDelay = synthNode.EgDelay,
EgAttack = synthNode.EgAttack,
EgHold = synthNode.EgHold,
EgDecay = synthNode.EgDecay,
EgRelease = synthNode.EgRelease,
EgSustain = synthNode.EgSustain,
FType = synthNode.FilterType,
FCof1 = synthNode.FilterCutoff1,
FCof2 = synthNode.FilterCutoff2,
FReso = synthNode.FilterReso,
FReleaseOffset = synthNode.FilterReleaseOffset,
DryOName = synthNode.DryOName,
Mtxrtr = synthNode.Mtxrtr,
Dry0 = synthNode.Dry0,
Dry1 = synthNode.Dry1,
Dry2 = synthNode.Dry2,
Dry3 = synthNode.Dry3,
Dry4 = synthNode.Dry4,
Dry5 = synthNode.Dry5,
Dry6 = synthNode.Dry6,
Dry7 = synthNode.Dry7,
WetOName = synthNode.WetOName,
Wet0 = synthNode.Wet0,
Wet1 = synthNode.Wet1,
Wet2 = synthNode.Wet2,
Wet3 = synthNode.Wet3,
Wet4 = synthNode.Wet4,
Wet5 = synthNode.Wet5,
Wet6 = synthNode.Wet6,
Wet7 = synthNode.Wet7,
Wcnct0 = synthNode.Wcnct0,
Wcnct1 = synthNode.Wcnct1,
Wcnct2 = synthNode.Wcnct2,
Wcnct3 = synthNode.Wcnct3,
Wcnct4 = synthNode.Wcnct4,
Wcnct5 = synthNode.Wcnct5,
Wcnct6 = synthNode.Wcnct6,
Wcnct7 = synthNode.Wcnct7,
VoiceLimitGroupName = synthNode.VoiceLimitGroupReference,
VoiceLimitType = synthNode.VoiceLimitType,
VoiceLimitPriority = synthNode.VoiceLimitPriority,
VoiceLimitPhTime = synthNode.VoiceLimitProhibitionTime,
VoiceLimitPcdlt = synthNode.VoiceLimitPcdlt,
Pan3dVolumeOffset = synthNode.Pan3dVolumeOffset,
Pan3dVolumeGain = synthNode.Pan3dVolumeGain,
Pan3dAngleOffset = synthNode.Pan3dAngleOffset,
Pan3dAngleGain = synthNode.Pan3dAngleGain,
Pan3dDistanceOffset = synthNode.Pan3dDistanceOffset,
Pan3dDistanceGain = synthNode.Pan3dDistanceGain,
Dry0g = synthNode.Dry0g,
Dry1g = synthNode.Dry1g,
Dry2g = synthNode.Dry2g,
Dry3g = synthNode.Dry3g,
Dry4g = synthNode.Dry4g,
Dry5g = synthNode.Dry5g,
Dry6g = synthNode.Dry6g,
Dry7g = synthNode.Dry7g,
Wet0g = synthNode.Wet0g,
Wet1g = synthNode.Wet1g,
Wet2g = synthNode.Wet2g,
Wet3g = synthNode.Wet3g,
Wet4g = synthNode.Wet4g,
Wet5g = synthNode.Wet5g,
Wet6g = synthNode.Wet6g,
Wet7g = synthNode.Wet7g,
F1Type = synthNode.Filter1Type,
F1CofOffset = synthNode.Filter1CutoffOffset,
F1CofGain = synthNode.Filter1CutoffGain,
F1ResoOffset = synthNode.Filter1ResoOffset,
F1ResoGain = synthNode.Filter1ResoGain,
F2Type = synthNode.Filter2Type,
F2CofLowOffset = synthNode.Filter2CutoffLowerOffset,
F2CofLowGain = synthNode.Filter2CutoffLowerGain,
F2CofHighOffset = synthNode.Filter2CutoffHigherOffset,
F2CofHighGain = synthNode.Filter2CutoffHigherGain,
Probability = synthNode.PlaybackProbability,
NumberLmtChildren = synthNode.NLmtChildren,
Repeat = synthNode.Repeat,
ComboTime = synthNode.ComboTime,
ComboLoopBack = synthNode.ComboLoopBack,
};
if (synthNode.Type == BuilderSynthType.Single)
{
synthTable.LinkName = synthNode.SoundElementReference;
}
else if (synthNode.Type == BuilderSynthType.WithChildren)
{
foreach (string trackReference in synthNode.Children)
{
synthTable.LinkName += trackReference + (char)0x0A;
}
}
if (!string.IsNullOrEmpty(synthNode.AisacReference))
{
BuilderAisacNode aisacNode = project.AisacNodes.First(aisac => aisac.Name == synthNode.AisacReference);
synthTable.AisacSetName = aisacNode.AisacName + "::" + aisacNode.Name + (char)0x0A;
}
synthTables.Add(synthTable);
}
cueSheetTables.Add(new SerializationCueSheetTable
{
TableData = CriTableSerializer.Serialize(synthTables, CriTableWriterSettings.AdxSettings),
Name = "SYNTH",
TableType = 2,
});
List<FileInfo> junks = new List<FileInfo>();
// Serialize the sound elements.
List<SerializationSoundElementTable> soundElementTables = new List<SerializationSoundElementTable>();
foreach (BuilderSoundElementNode soundElementNode in project.SoundElementNodes)
{
CriAaxArchive aaxArchive = new CriAaxArchive();
if (!string.IsNullOrEmpty(soundElementNode.Intro))
{
aaxArchive.Add(new CriAaxEntry
{
Flag = CriAaxEntryFlag.Intro,
FilePath = new FileInfo(Path.Combine(project.AudioDirectory.FullName, soundElementNode.Intro)),
});
}
if (!string.IsNullOrEmpty(soundElementNode.Loop))
{
aaxArchive.Add(new CriAaxEntry
{
Flag = CriAaxEntryFlag.Loop,
FilePath = new FileInfo(Path.Combine(project.AudioDirectory.FullName, soundElementNode.Loop)),
});
}
byte[] data = new byte[0];
if (soundElementNode.Streaming)
{
CriCpkEntry entry = new CriCpkEntry();
entry.Name = Path.GetFileName(soundElementNode.Name);
entry.DirectoryName = Path.GetDirectoryName(soundElementNode.Name);
entry.Id = (uint)cpkArchive.Count;
entry.UpdateDateTime = DateTime.Now;
entry.FilePath = new FileInfo(Path.GetTempFileName());
cpkArchive.Add(entry);
aaxArchive.Save(entry.FilePath.FullName);
junks.Add(entry.FilePath);
}
else
{
data = aaxArchive.Save();
}
soundElementTables.Add(new SerializationSoundElementTable
{
Name = soundElementNode.Name,
Data = data,
FormatType = 0,
SoundFrequency = soundElementNode.SampleRate,
NumberChannels = soundElementNode.ChannelCount,
Streaming = soundElementNode.Streaming,
NumberSamples = soundElementNode.SampleCount,
});
}
cueSheetTables.Add(new SerializationCueSheetTable
{
TableData = CriTableSerializer.Serialize(soundElementTables, CriTableWriterSettings.AdxSettings),
Name = "SOUND_ELEMENT",
TableType = 4,
});
// Serialize the aisacs.
List<SerializationAisacTable> aisacTables = new List<SerializationAisacTable>();
foreach (BuilderAisacNode aisacNode in project.AisacNodes)
{
List<SerializationAisacGraphTable> graphTables = new List<SerializationAisacGraphTable>();
foreach (BuilderAisacGraphNode graphNode in aisacNode.Graphs)
{
List<SerializationAisacPointTable> pointTables = new List<SerializationAisacPointTable>();
foreach (BuilderAisacPointNode pointNode in graphNode.Points)
{
pointTables.Add(new SerializationAisacPointTable
{
In = pointNode.X,
Out = pointNode.Y,
});
}
graphTables.Add(new SerializationAisacGraphTable
{
Points = CriTableSerializer.Serialize(pointTables, CriTableWriterSettings.AdxSettings),
Type = graphNode.Type,
InMax = graphNode.MaximumX,
InMin = graphNode.MinimumX,
OutMax = graphNode.MaximumY,
OutMin = graphNode.MinimumY,
});
}
aisacTables.Add(new SerializationAisacTable
{
Graph = CriTableSerializer.Serialize(graphTables, CriTableWriterSettings.AdxSettings),
Name = aisacNode.AisacName,
PathName = aisacNode.Name,
Type = aisacNode.Type,
RandomRange = aisacNode.RandomRange,
});
}
cueSheetTables.Add(new SerializationCueSheetTable
{
TableData = CriTableSerializer.Serialize(aisacTables, CriTableWriterSettings.AdxSettings),
Name = "ISAAC",
TableType = 5,
});
// Serialize the voice limit groups.
List<SerializationVoiceLimitGroupTable> voiceLimitGroupTables = new List<SerializationVoiceLimitGroupTable>();
foreach (BuilderVoiceLimitGroupNode voiceLimitGroupNode in project.VoiceLimitGroupNodes)
{
voiceLimitGroupTables.Add(new SerializationVoiceLimitGroupTable
{
VoiceLimitGroupName = voiceLimitGroupNode.Name,
VoiceLimitGroupNum = voiceLimitGroupNode.MaxAmountOfInstances,
});
}
cueSheetTables.Add(new SerializationCueSheetTable
{
TableData = CriTableSerializer.Serialize(voiceLimitGroupTables, CriTableWriterSettings.AdxSettings),
Name = "VOICE_LIMIT_GROUP",
TableType = 6,
});
// Finally, serialize the CSB file.
CriTableSerializer.Serialize(outputFileName, cueSheetTables, CriTableWriterSettings.AdxSettings);
if (cpkArchive.Count > 0)
{
cpkArchive.Save(Path.ChangeExtension(outputFileName, "cpk"));
}
foreach (FileInfo junk in junks)
{
junk.Delete();
}
}
}
}

View File

@ -0,0 +1,41 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.ComponentModel;
namespace CsbBuilder.BuilderNode
{
public class BuilderAisacGraphNode : BuilderBaseNode
{
[Category("General")]
[Description("The type of this Graph. Currently, none of the types are known.")]
public byte Type { get; set; }
[Category("Vector"), DisplayName("Maximum X")]
[Description("The maximum range that the X values in this Graph can reach.")]
public float MaximumX { get; set; }
[Category("Vector"), DisplayName("Minimum X")]
[Description("The minimum range that the X values in this Graph can reach.")]
public float MinimumX { get; set; }
[Category("Vector"), DisplayName("Maximum Y")]
[Description("The maximum range that the Y values in this Graph can reach.")]
public float MaximumY { get; set; }
[Category("Vector"), DisplayName("Minimum Y")]
[Description("The minimum range that the Y values in this Graph can reach.")]
public float MinimumY { get; set; }
[Category("Vector"), DisplayName("Points")]
[Description("The points of this Graph.")]
public List<BuilderAisacPointNode> Points { get; set; }
public BuilderAisacGraphNode()
{
Points = new List<BuilderAisacPointNode>();
}
}
}

View File

@ -0,0 +1,32 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.ComponentModel;
namespace CsbBuilder.BuilderNode
{
public class BuilderAisacNode : BuilderBaseNode
{
[Category("General"), DisplayName("Aisac Name")]
[Description("The name of this Aisac. (Shouldn't be seen as the node name.)")]
public string AisacName { get; set; }
[Category("General")]
[Description("The type of this Aisac. Currently, none of the types are known.")]
public byte Type { get; set; }
[Category("Graph")]
[Description("The Graph's of this Aisac.")]
public List<BuilderAisacGraphNode> Graphs { get; set; }
[Category("Graph"), DisplayName("Random Range (Unknown)")]
public byte RandomRange { get; set; }
public BuilderAisacNode()
{
Graphs = new List<BuilderAisacGraphNode>();
}
}
}

View File

@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.ComponentModel;
namespace CsbBuilder.BuilderNode
{
public class BuilderAisacPointNode : BuilderBaseNode
{
[Category("Vector"), DisplayName("X")]
[Description("The X dimension of this Point, relative to the Graph it's in.")]
public ushort X { get; set; }
[Category("Vector"), DisplayName("Y")]
[Description("The Y dimension of this Point, relative to the Graph it's in.")]
public ushort Y { get; set; }
}
}

View File

@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.ComponentModel;
using System.Globalization;
namespace CsbBuilder.BuilderNode
{
public abstract class BuilderBaseNode : ICloneable
{
[Category("General"), ReadOnly(true)]
[Description("The name of this node. Shift JIS encoding is used for this in the Cue Sheet Binary, so try to avoid using special characters that this codec does not support.")]
public string Name { get; set; }
public object Clone()
{
return MemberwiseClone();
}
}
}

View File

@ -0,0 +1,29 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.ComponentModel;
namespace CsbBuilder.BuilderNode
{
public class BuilderCueNode : BuilderBaseNode
{
[Category("General"), DisplayName("Identifier")]
[Description("The identifier of this Cue. Must be unique for this Cue Sheet.")]
public uint Identifier { get; set; }
[ReadOnly(true)]
[Category("General"), DisplayName("Synth Reference Path")]
[Description("The full path of the Synth (can be Track or Sound) that this Cue is referenced to. When this Cue is called to play in game, the referenced Synth will be played.")]
public string SynthReference { get; set; }
[Category("General"), DisplayName("User Comment")]
[Description("User comment of this Cue. Shift JIS encoding is used for this in the Cue Sheet Binary, so try to avoid using special characters that this codec does not support.")]
public string UserComment { get; set; }
[Category("General")]
[Description("Currently, none of the flags are known. However, value '1' seems to mute the Cue in-game.")]
public byte Flags { get; set; }
}
}

View File

@ -0,0 +1,41 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.ComponentModel;
namespace CsbBuilder.BuilderNode
{
public class BuilderSoundElementNode : BuilderBaseNode
{
[ReadOnly(true)]
[Category("General")]
[Description("The name of the audio in Project/Audio directory, which is going to play before the loop audio starts to play. Can be left empty, so that there will be no audio to play.")]
public string Intro { get; set; }
[ReadOnly(true)]
[Category("General")]
[Description("The name of the audio in Project/Audio directory, which is going to be looped. Can be left empty, so that there will be no audio to loop in-game.")]
public string Loop { get; set; }
[ReadOnly(true)]
[Category("General"), DisplayName("Channel Count")]
[Description("The channel count of BOTH Intro and Loop audio files. If they do not match, this will most likely result issues in-game, because the game ignores the channel count information in the audio file itself, but uses this info.")]
public byte ChannelCount { get; set; }
[Category("General"), DisplayName("Streamed")]
[Description("Determines whether the audio files specified here are going to be streamed from a .CPK file, which is outside the .CSB file. Otherwise, it will be played from the memory. That's the best to be 'true', if the specified audio files are large.")]
public bool Streaming { get; set; }
[ReadOnly(true)]
[Category("General"), DisplayName("Sample Rate")]
[Description("The sample rate of BOTH Intro and Loop audio files. If they do not match, this will most likely result issues in-game, because the game ignores the sample rate information in the audio file itself, but uses this info.")]
public uint SampleRate { get; set; }
[ReadOnly(true)]
[Category("General"), DisplayName("Sample Count")]
[Description("The sample count of Intro and Loop files, added together.")]
public uint SampleCount { get; set; }
}
}

View File

@ -0,0 +1,436 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.ComponentModel;
using System.Reflection;
namespace CsbBuilder.BuilderNode
{
public enum BuilderSynthType
{
Single,
WithChildren,
}
public enum BuilderSynthPlaybackType
{
[Browsable(false)]
Normal = -1,
Polyphonic = 0,
RandomNoRepeat = 1,
Sequential = 2,
Random = 3,
}
public class BuilderSynthNode : BuilderBaseNode
{
private BuilderSynthPlaybackType playbackType = BuilderSynthPlaybackType.Polyphonic;
private Random random = new Random();
private List<int> indices = new List<int>();
private int nextChild = -1;
private byte playbackProbability = 100;
[Browsable(false)]
public BuilderSynthType Type { get; set; }
[Category("General"), DisplayName("Playback Type")]
[Description("The playback type of this Synth.")]
public BuilderSynthPlaybackType PlaybackType
{
get
{
if (Type == BuilderSynthType.Single)
{
return BuilderSynthPlaybackType.Normal;
}
return playbackType;
}
set
{
if (Type == BuilderSynthType.Single || value == BuilderSynthPlaybackType.Normal)
{
return;
}
playbackType = value;
}
}
[ReadOnly(true)]
[Category("General"), DisplayName("Sound Element Reference Path")]
[Description("The Sound that this Synth is referenced to. This will be empty if this Synth represents a Track.")]
public string SoundElementReference { get; set; }
[Browsable(false)]
public List<string> Children { get; set; }
[ReadOnly(true)]
[Category("General"), DisplayName("Aisac Reference Path")]
[Description("The Aisac that this Synth is referenced to.")]
public string AisacReference { get; set; }
[Category("General")]
[Description("The volume of this Synth.")]
public short Volume { get; set; }
[Category("General")]
[Description("The pitch of this Synth.")]
public short Pitch { get; set; }
[Category("General"), DisplayName("Delay Time")]
[Description("The delay of this Synth. The time is in miliseconds.")]
public uint DelayTime { get; set; }
[Category("Unknown"), DisplayName("S Control")]
public byte SControl { get; set; }
[Category("EG"), DisplayName("EG Delay")]
public ushort EgDelay { get; set; }
[Category("EG"), DisplayName("EG Attack")]
public ushort EgAttack { get; set; }
[Category("EG"), DisplayName("EG Hold")]
public ushort EgHold { get; set; }
[Category("EG"), DisplayName("EG Decay")]
public ushort EgDecay { get; set; }
[Category("EG"), DisplayName("EG Release")]
public ushort EgRelease { get; set; }
[Category("EG"), DisplayName("EG Sustain")]
public ushort EgSustain { get; set; }
[Category("Filter (Unknown)"), DisplayName("Filter Type")]
public byte FilterType { get; set; }
[Category("Filter (Unknown)"), DisplayName("Filter Cutoff 1")]
public ushort FilterCutoff1 { get; set; }
[Category("Filter (Unknown)"), DisplayName("Filter Cutoff 2")]
public ushort FilterCutoff2 { get; set; }
[Category("Filter (Unknown)"), DisplayName("Filter RESO (Unknown)")]
public ushort FilterReso { get; set; }
[Category("Filter (Unknown)"), DisplayName("Filter Release Offset")]
public byte FilterReleaseOffset { get; set; }
[Category("Dryness"), DisplayName("Dry O Name (Unknown)")]
public string DryOName { get; set; }
[Category("Unknown")]
public string Mtxrtr { get; set; }
[Category("Dryness"), DisplayName("Dry 0")]
public ushort Dry0 { get; set; }
[Category("Dryness"), DisplayName("Dry 1")]
public ushort Dry1 { get; set; }
[Category("Dryness"), DisplayName("Dry 2")]
public ushort Dry2 { get; set; }
[Category("Dryness"), DisplayName("Dry 3")]
public ushort Dry3 { get; set; }
[Category("Dryness"), DisplayName("Dry 4")]
public ushort Dry4 { get; set; }
[Category("Dryness"), DisplayName("Dry 5")]
public ushort Dry5 { get; set; }
[Category("Dryness"), DisplayName("Dry 6")]
public ushort Dry6 { get; set; }
[Category("Dryness"), DisplayName("Dry 7")]
public ushort Dry7 { get; set; }
[Category("Wetness"), DisplayName("Wet O Name (Unknown)")]
public string WetOName { get; set; }
[Category("Wetness"), DisplayName("Wet 0")]
public ushort Wet0 { get; set; }
[Category("Wetness"), DisplayName("Wet 1")]
public ushort Wet1 { get; set; }
[Category("Wetness"), DisplayName("Wet 2")]
public ushort Wet2 { get; set; }
[Category("Wetness"), DisplayName("Wet 3")]
public ushort Wet3 { get; set; }
[Category("Wetness"), DisplayName("Wet 4")]
public ushort Wet4 { get; set; }
[Category("Wetness"), DisplayName("Wet 5")]
public ushort Wet5 { get; set; }
[Category("Wetness"), DisplayName("Wet 6")]
public ushort Wet6 { get; set; }
[Category("Wetness"), DisplayName("Wet 7")]
public ushort Wet7 { get; set; }
[Category("Wcnct (Unknown)"), DisplayName("Wcnct 0")]
public string Wcnct0 { get; set; }
[Category("Wcnct (Unknown)"), DisplayName("Wcnct 1")]
public string Wcnct1 { get; set; }
[Category("Wcnct (Unknown)"), DisplayName("Wcnct 2")]
public string Wcnct2 { get; set; }
[Category("Wcnct (Unknown)"), DisplayName("Wcnct 3")]
public string Wcnct3 { get; set; }
[Category("Wcnct (Unknown)"), DisplayName("Wcnct 4")]
public string Wcnct4 { get; set; }
[Category("Wcnct (Unknown)"), DisplayName("Wcnct 5")]
public string Wcnct5 { get; set; }
[Category("Wcnct (Unknown)"), DisplayName("Wcnct 6")]
public string Wcnct6 { get; set; }
[Category("Wcnct (Unknown)"), DisplayName("Wcnct 7")]
public string Wcnct7 { get; set; }
[ReadOnly(true)]
[Category("Voice Limit"), DisplayName("Voice Limit Group Reference")]
public string VoiceLimitGroupReference { get; set; }
[Category("Voice Limit"), DisplayName("Voice Limit Type")]
public byte VoiceLimitType { get; set; }
[Category("Voice Limit"), DisplayName("Voice Limit Priority")]
public byte VoiceLimitPriority { get; set; }
[Category("Voice Limit"), DisplayName("Voice Limit Prohibition Time")]
public ushort VoiceLimitProhibitionTime { get; set; }
[Category("Voice Limit"), DisplayName("Voice Limit Pcdlt (Unknown)")]
public sbyte VoiceLimitPcdlt { get; set; }
[Category("Pan 3D"), DisplayName("Pan 3D Volume Offset")]
public short Pan3dVolumeOffset { get; set; }
[Category("Pan 3D"), DisplayName("Pan 3D Volume Gain")]
public short Pan3dVolumeGain { get; set; }
[Category("Pan 3D"), DisplayName("Pan 3D Angle Offset")]
public short Pan3dAngleOffset { get; set; }
[Category("Pan 3D"), DisplayName("Pan 3D Angle Gain")]
public short Pan3dAngleGain { get; set; }
[Category("Pan 3D"), DisplayName("Pan 3D Distance Offset")]
public short Pan3dDistanceOffset { get; set; }
[Category("Pan 3D"), DisplayName("Pan 3D Distance Gain")]
public short Pan3dDistanceGain { get; set; }
[Category("Dryness"), DisplayName("Dry 0 Gain")]
public byte Dry0g { get; set; }
[Category("Dryness"), DisplayName("Dry 1 Gain")]
public byte Dry1g { get; set; }
[Category("Dryness"), DisplayName("Dry 2 Gain")]
public byte Dry2g { get; set; }
[Category("Dryness"), DisplayName("Dry 3 Gain")]
public byte Dry3g { get; set; }
[Category("Dryness"), DisplayName("Dry 4 Gain")]
public byte Dry4g { get; set; }
[Category("Dryness"), DisplayName("Dry 5 Gain")]
public byte Dry5g { get; set; }
[Category("Dryness"), DisplayName("Dry 6 Gain")]
public byte Dry6g { get; set; }
[Category("Dryness"), DisplayName("Dry 7 Gain")]
public byte Dry7g { get; set; }
[Category("Wetness"), DisplayName("Wet 0 Gain")]
public byte Wet0g { get; set; }
[Category("Wetness"), DisplayName("Wet 1 Gain")]
public byte Wet1g { get; set; }
[Category("Wetness"), DisplayName("Wet 2 Gain")]
public byte Wet2g { get; set; }
[Category("Wetness"), DisplayName("Wet 3 Gain")]
public byte Wet3g { get; set; }
[Category("Wetness"), DisplayName("Wet 4 Gain")]
public byte Wet4g { get; set; }
[Category("Wetness"), DisplayName("Wet 5 Gain")]
public byte Wet5g { get; set; }
[Category("Wetness"), DisplayName("Wet 6 Gain")]
public byte Wet6g { get; set; }
[Category("Wetness"), DisplayName("Wet 7 Gain")]
public byte Wet7g { get; set; }
[Category("Filter 1 (Unknown)"), DisplayName("Filter 1 Type")]
public byte Filter1Type { get; set; }
[Category("Filter 1 (Unknown)"), DisplayName("Filter 1 Cutoff Offset")]
public ushort Filter1CutoffOffset { get; set; }
[Category("Filter 1 (Unknown)"), DisplayName("Filter 1 Cutoff Gain")]
public ushort Filter1CutoffGain { get; set; }
[Category("Filter 1 (Unknown)"), DisplayName("Filter 1 RESO (Unknown) Offset")]
public ushort Filter1ResoOffset { get; set; }
[Category("Filter 1 (Unknown)"), DisplayName("Filter 1 RESO (Unknown) Gain")]
public ushort Filter1ResoGain { get; set; }
[Category("Filter 2 (Unknown)"), DisplayName("Filter 2 Type")]
public byte Filter2Type { get; set; }
[Category("Filter 2 (Unknown)"), DisplayName("Filter 2 Cutoff Lower Offset")]
public ushort Filter2CutoffLowerOffset { get; set; }
[Category("Filter 2 (Unknown)"), DisplayName("Filter 2 Cutoff Lower Gain")]
public ushort Filter2CutoffLowerGain { get; set; }
[Category("Filter 2 (Unknown)"), DisplayName("Filter 2 Cutoff Higher Offset")]
public ushort Filter2CutoffHigherOffset { get; set; }
[Category("Filter 2 (Unknown)"), DisplayName("Filter 2 Cutoff Higher Gain")]
public ushort Filter2CutoffHigherGain { get; set; }
[Category("General"), DisplayName("Playback Probability")]
[Description("The probability of this Synth being played. A random number (max 100) will be chosen and if this number is lower than this parameter (or equals), it will be played. This does not do anything if this Synth represents a Track.")]
public byte PlaybackProbability
{
get
{
if (Type == BuilderSynthType.WithChildren)
{
return 0;
}
return playbackProbability;
}
set
{
playbackProbability = value > 100 ? (byte)100 : value;
}
}
[Category("Unknown"), DisplayName("N LMT Children")]
public byte NLmtChildren { get; set; }
[Category("General"), DisplayName("Repeat")]
public byte Repeat { get; set; }
[Category("General"), DisplayName("Combo Time")]
public uint ComboTime { get; set; }
[Category("General"), DisplayName("Combo Loop Back")]
public byte ComboLoopBack { get; set; }
[Browsable(false)]
public bool PlayThisTurn
{
get
{
return random.Next(100) <= PlaybackProbability;
}
}
[Browsable(false)]
public int RandomChildNode
{
get
{
if (playbackType == BuilderSynthPlaybackType.RandomNoRepeat)
{
if (indices.Count == Children.Count)
{
indices.Clear();
}
int nextChild = random.Next(Children.Count);
while (indices.Contains(nextChild))
{
nextChild = random.Next(Children.Count);
}
indices.Add(nextChild);
return nextChild;
}
return random.Next(Children.Count);
}
}
[Browsable(false)]
public int NextChildNode
{
get
{
if (nextChild + 1 == Children.Count)
{
nextChild = -1;
}
return ++nextChild;
}
}
public BuilderSynthNode()
{
Children = new List<string>();
Volume = 1000;
EgSustain = 1000;
Dry0g = 255;
Dry1g = 255;
Dry2g = 255;
Dry3g = 255;
Dry4g = 255;
Dry5g = 255;
Dry6g = 255;
Dry7g = 255;
Wet0g = 255;
Wet1g = 255;
Wet2g = 255;
Wet3g = 255;
Wet4g = 255;
Wet5g = 255;
Wet6g = 255;
Wet7g = 255;
Pan3dAngleGain = 1000;
Pan3dDistanceGain = 1000;
Pan3dDistanceOffset = 1000;
Pan3dVolumeGain = 1000;
Pan3dVolumeOffset = 1000;
Filter2CutoffHigherGain = 1000;
Filter2CutoffHigherOffset = 1000;
Filter2CutoffLowerGain = 1000;
}
}
}

View File

@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.ComponentModel;
namespace CsbBuilder.BuilderNode
{
public class BuilderVoiceLimitGroupNode : BuilderBaseNode
{
[Category("General"), DisplayName("Max Amount of Instances")]
public uint MaxAmountOfInstances { get; set; }
}
}

View File

@ -0,0 +1,171 @@
namespace CsbBuilder
{
partial class CreateNewProjectForm
{
/// <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.groupBox1 = new System.Windows.Forms.GroupBox();
this.button1 = new System.Windows.Forms.Button();
this.maskedTextBox2 = new System.Windows.Forms.MaskedTextBox();
this.label2 = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.maskedTextBox1 = new System.Windows.Forms.MaskedTextBox();
this.button3 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.groupBox1.SuspendLayout();
this.SuspendLayout();
//
// groupBox1
//
this.groupBox1.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.groupBox1.Controls.Add(this.button1);
this.groupBox1.Controls.Add(this.maskedTextBox2);
this.groupBox1.Controls.Add(this.label2);
this.groupBox1.Controls.Add(this.label1);
this.groupBox1.Controls.Add(this.maskedTextBox1);
this.groupBox1.FlatStyle = System.Windows.Forms.FlatStyle.System;
this.groupBox1.Location = new System.Drawing.Point(12, 12);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(529, 102);
this.groupBox1.TabIndex = 0;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "Project";
//
// button1
//
this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.button1.FlatStyle = System.Windows.Forms.FlatStyle.System;
this.button1.Location = new System.Drawing.Point(448, 68);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(75, 23);
this.button1.TabIndex = 4;
this.button1.Text = "Browse";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// maskedTextBox2
//
this.maskedTextBox2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.maskedTextBox2.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.maskedTextBox2.Location = new System.Drawing.Point(6, 70);
this.maskedTextBox2.Name = "maskedTextBox2";
this.maskedTextBox2.Size = new System.Drawing.Size(436, 20);
this.maskedTextBox2.TabIndex = 3;
this.maskedTextBox2.TextChanged += new System.EventHandler(this.maskedTextBox2_TextChanged);
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(3, 55);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(32, 13);
this.label2.TabIndex = 2;
this.label2.Text = "Path:";
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(3, 16);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(38, 13);
this.label1.TabIndex = 1;
this.label1.Text = "Name:";
//
// maskedTextBox1
//
this.maskedTextBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.maskedTextBox1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.maskedTextBox1.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.maskedTextBox1.Location = new System.Drawing.Point(6, 32);
this.maskedTextBox1.Name = "maskedTextBox1";
this.maskedTextBox1.Size = new System.Drawing.Size(517, 20);
this.maskedTextBox1.TabIndex = 0;
this.maskedTextBox1.TextChanged += new System.EventHandler(this.maskedTextBox1_TextChanged);
//
// button3
//
this.button3.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.button3.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.button3.FlatStyle = System.Windows.Forms.FlatStyle.System;
this.button3.Location = new System.Drawing.Point(466, 120);
this.button3.Name = "button3";
this.button3.Size = new System.Drawing.Size(75, 23);
this.button3.TabIndex = 6;
this.button3.Text = "Cancel";
this.button3.UseVisualStyleBackColor = true;
//
// 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.OK;
this.button2.FlatStyle = System.Windows.Forms.FlatStyle.System;
this.button2.Location = new System.Drawing.Point(385, 120);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(75, 23);
this.button2.TabIndex = 5;
this.button2.Text = "OK";
this.button2.UseVisualStyleBackColor = true;
//
// CreateNewProjectForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(553, 148);
this.Controls.Add(this.button2);
this.Controls.Add(this.button3);
this.Controls.Add(this.groupBox1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.MaximizeBox = false;
this.MaximumSize = new System.Drawing.Size(928, 187);
this.MinimizeBox = false;
this.MinimumSize = new System.Drawing.Size(464, 187);
this.Name = "CreateNewProjectForm";
this.ShowIcon = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Create New Project";
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.Button button3;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.MaskedTextBox maskedTextBox2;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.MaskedTextBox maskedTextBox1;
}
}

View File

@ -0,0 +1,77 @@
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 System.IO;
using CsbBuilder.Project;
namespace CsbBuilder
{
public partial class CreateNewProjectForm : Form
{
private CsbProject project = new CsbProject();
public CsbProject Project
{
get
{
return project;
}
}
public CreateNewProjectForm(string name) : this()
{
maskedTextBox1.Text = Path.GetFileNameWithoutExtension(name);
string directoryName = Path.GetDirectoryName(name);
maskedTextBox2.Text = !string.IsNullOrEmpty(directoryName) ? Path.ChangeExtension(name, null) : Path.Combine(Program.ProjectsPath, name);
}
public CreateNewProjectForm()
{
InitializeComponent();
maskedTextBox1.Text = project.Name;
maskedTextBox2.Text = project.Directory.FullName;
}
private void maskedTextBox1_TextChanged(object sender, EventArgs e)
{
if (string.IsNullOrEmpty(maskedTextBox1.Text))
{
MessageBox.Show("Name cannot be empty.", "CSB Builder", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
project.Name = maskedTextBox1.Text;
}
private void button1_Click(object sender, EventArgs e)
{
using (FolderBrowserDialog selectFolder = new FolderBrowserDialog())
{
if (selectFolder.ShowDialog() == DialogResult.OK)
{
maskedTextBox2.Text = selectFolder.SelectedPath;
}
}
}
private void maskedTextBox2_TextChanged(object sender, EventArgs e)
{
if (string.IsNullOrEmpty(maskedTextBox2.Text))
{
MessageBox.Show("Path cannot be empty.", "CSB Builder", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
project.Directory = new DirectoryInfo(maskedTextBox2.Text);
}
}
}

View File

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

View File

@ -1,48 +0,0 @@
using System.IO;
using SonicAudioLib.CriMw.Serialization;
using System;
using System.Xml.Serialization;
namespace CsbBuilder
{
[CriSerializable("AAX")]
[Serializable]
public class CriTableAax
{
public enum EnumLoopFlag : byte
{
Intro = 0,
Loop = 1,
};
private byte[] _data = new byte[0];
private EnumLoopFlag _lpflg = EnumLoopFlag.Intro;
[CriField("data", 0)]
public byte[] Data
{
get
{
return _data;
}
set
{
_data = value;
}
}
[CriField("lpflg", 1)]
public EnumLoopFlag LoopFlag
{
get
{
return _lpflg;
}
set
{
_lpflg = value;
}
}
}
}

View File

@ -1,104 +0,0 @@
using System.Collections.Generic;
using System.IO;
using SonicAudioLib.CriMw;
using SonicAudioLib.CriMw.Serialization;
using System;
using System.Xml.Serialization;
namespace CsbBuilder
{
[Serializable]
[CriSerializable("TBLIGR")]
public class CriTableAisacGraph
{
private byte _type = 0;
private float _imax = 0;
private float _imin = 0;
private float _omax = 0;
private float _omin = 0;
[CriField("type", 0)]
public byte Type
{
get
{
return _type;
}
set
{
_type = value;
}
}
[CriField("imax", 1)]
public float InMaximum
{
get
{
return _imax;
}
set
{
_imax = value;
}
}
[CriField("imin", 2)]
public float InMinimum
{
get
{
return _imin;
}
set
{
_imin = value;
}
}
[CriField("omax", 3)]
public float OutMaximum
{
get
{
return _omax;
}
set
{
_omax = value;
}
}
[CriField("omin", 4)]
public float OutMinimum
{
get
{
return _omin;
}
set
{
_omin = value;
}
}
[CriIgnore]
public List<CriTableAisacPoint> PointsList { get; set; }
[XmlIgnore]
[CriField("points", 5)]
public byte[] Points
{
get
{
return CriTableSerializer.Serialize(PointsList, CriTableWriterSettings.AdxSettings);
}
set
{
PointsList = CriTableSerializer.Deserialize<CriTableAisacPoint>(value);
}
}
}
}

View File

@ -1,134 +0,0 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using SonicAudioLib.CriMw;
using SonicAudioLib.CriMw.Serialization;
using System.Linq;
using System.Xml.Serialization;
namespace CsbBuilder
{
[Serializable]
[CriSerializable("TBLCSB")]
public class CriTableCueSheet
{
public enum EnumTableType : byte
{
None = 0,
Cue = 1,
Synth = 2,
SoundElement = 4,
Aisac = 5,
VoiceLimitGroup = 6,
VersionInfo = 7,
};
private string _name = string.Empty;
private EnumTableType _ttype = EnumTableType.None;
[CriField("name", 0)]
public string Name
{
get
{
return _name;
}
set
{
_name = value;
}
}
[CriField("ttype", 1)]
public EnumTableType TableType
{
get
{
return _ttype;
}
set
{
_ttype = value;
}
}
[CriIgnore]
[XmlArray]
[XmlArrayItem(typeof(CriTableCue))]
[XmlArrayItem(typeof(CriTableSynth))]
[XmlArrayItem(typeof(CriTableSoundElement))]
[XmlArrayItem(typeof(CriTableAisac))]
[XmlArrayItem(typeof(CriTableVoiceLimitGroup))]
[XmlArrayItem(typeof(CriTableVersionInfo))]
public ArrayList DataList { get; set; }
[XmlIgnore]
[CriField("utf", 2)]
public byte[] Data
{
get
{
switch (_ttype)
{
case EnumTableType.None:
return new byte[0];
case EnumTableType.Cue:
return CriTableSerializer.Serialize(DataList.OfType<CriTableCue>().ToList(), CriTableWriterSettings.AdxSettings);
case EnumTableType.Synth:
return CriTableSerializer.Serialize(DataList.OfType<CriTableSynth>().ToList(), CriTableWriterSettings.AdxSettings);
case EnumTableType.SoundElement:
return CriTableSerializer.Serialize(DataList.OfType<CriTableSoundElement>().ToList(), CriTableWriterSettings.AdxSettings);
case EnumTableType.Aisac:
return CriTableSerializer.Serialize(DataList.OfType<CriTableAisac>().ToList(), CriTableWriterSettings.AdxSettings);
case EnumTableType.VoiceLimitGroup:
return CriTableSerializer.Serialize(DataList.OfType<CriTableVoiceLimitGroup>().ToList(), CriTableWriterSettings.AdxSettings);
case EnumTableType.VersionInfo:
return CriTableSerializer.Serialize(DataList.OfType<CriTableVersionInfo>().ToList(), CriTableWriterSettings.AdxSettings);
}
throw new ArgumentException($"Unknown table type {_ttype}, please report the error with the file.", "_ttype");
}
set
{
switch (_ttype)
{
case EnumTableType.Cue:
DataList = CriTableSerializer.Deserialize(value, typeof(CriTableCue));
break;
case EnumTableType.Synth:
DataList = CriTableSerializer.Deserialize(value, typeof(CriTableSynth));
break;
case EnumTableType.SoundElement:
DataList = CriTableSerializer.Deserialize(value, typeof(CriTableSoundElement));
break;
case EnumTableType.Aisac:
DataList = CriTableSerializer.Deserialize(value, typeof(CriTableAisac));
break;
case EnumTableType.VoiceLimitGroup:
DataList = CriTableSerializer.Deserialize(value, typeof(CriTableVoiceLimitGroup));
break;
case EnumTableType.VersionInfo:
DataList = CriTableSerializer.Deserialize(value, typeof(CriTableVersionInfo));
break;
default:
throw new ArgumentException($"Unknown table type {_ttype}, please report the error with the file.", "_ttype");
}
}
}
}
}

View File

@ -1,127 +0,0 @@
using System.Collections.Generic;
using System.IO;
using SonicAudioLib.CriMw;
using SonicAudioLib.CriMw.Serialization;
using System;
using System.Xml.Serialization;
namespace CsbBuilder
{
[Serializable]
[CriSerializable("TBLSDL")]
public class CriTableSoundElement
{
public enum EnumFormat : byte
{
Adx = 0,
Dsp = 4,
};
private string _name = string.Empty;
private EnumFormat _fmt = EnumFormat.Adx;
private byte _nch = 0;
private bool _stmflg = false;
private uint _sfreq = 0;
private uint _nsmpl = 0;
[CriField("name", 0)]
public string Name
{
get
{
return _name;
}
set
{
_name = value;
}
}
[CriIgnore]
public List<CriTableAax> DataList { get; set; }
[XmlIgnore]
[CriField("data", 1)]
public byte[] Data
{
get
{
return CriTableSerializer.Serialize(DataList, CriTableWriterSettings.AdxSettings);
}
set
{
if (value.Length > 0)
{
DataList = CriTableSerializer.Deserialize<CriTableAax>(value);
}
}
}
[CriField("fmt", 2)]
public EnumFormat Format
{
get
{
return _fmt;
}
set
{
_fmt = value;
}
}
[CriField("nch", 3)]
public byte NumberChannels
{
get
{
return _nch;
}
set
{
_nch = value;
}
}
[CriField("stmflg", 4)]
public bool Streaming
{
get
{
return _stmflg;
}
set
{
_stmflg = value;
}
}
[CriField("sfreq", 5)]
public uint SoundFrequence
{
get
{
return _sfreq;
}
set
{
_sfreq = value;
}
}
[CriField("nsmpl", 6)]
public uint NumberSamples
{
get
{
return _nsmpl;
}
set
{
_nsmpl = value;
}
}
}
}

View File

@ -4,8 +4,8 @@
<PropertyGroup> <PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{4CF49665-3DFD-4A5C-B231-B97842F091B9}</ProjectGuid> <ProjectGuid>{70A6A571-23EC-4B2C-A579-1E6812DDC34E}</ProjectGuid>
<OutputType>Exe</OutputType> <OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder> <AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>CsbBuilder</RootNamespace> <RootNamespace>CsbBuilder</RootNamespace>
<AssemblyName>CsbBuilder</AssemblyName> <AssemblyName>CsbBuilder</AssemblyName>
@ -32,39 +32,123 @@
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
</PropertyGroup> </PropertyGroup>
<PropertyGroup>
<StartupObject />
</PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="NAudio, Version=1.8.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\NAudio.1.8.0\lib\net35\NAudio.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Core" /> <Reference Include="System.Core" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml.Linq" /> <Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" /> <Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" /> <Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" /> <Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Net.Http" /> <Reference Include="System.Net.Http" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" /> <Reference Include="System.Xml" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="CriTableAax.cs" /> <Compile Include="BuilderNode\BuilderAisacGraphNode.cs" />
<Compile Include="CriTableAisac.cs" /> <Compile Include="BuilderNode\BuilderAisacNode.cs" />
<Compile Include="CriTableAisacGraph.cs" /> <Compile Include="BuilderNode\BuilderAisacPointNode.cs" />
<Compile Include="CriTableAisacPoint.cs" /> <Compile Include="BuilderNode\BuilderCueNode.cs" />
<Compile Include="CriTableCue.cs" /> <Compile Include="BuilderNode\BuilderBaseNode.cs" />
<Compile Include="CriTableCueSheet.cs" /> <Compile Include="BuilderNode\BuilderSoundElementNode.cs" />
<Compile Include="CriTableSoundElement.cs" /> <Compile Include="BuilderNode\BuilderSynthNode.cs" />
<Compile Include="CriTableSynth.cs" /> <Compile Include="BuilderNode\BuilderVoiceLimitGroupNode.cs" />
<Compile Include="CriTableVersionInfo.cs" /> <Compile Include="Builder\CsbBuilder.cs" />
<Compile Include="CriTableVoiceLimitGroup.cs" /> <Compile Include="ExceptionForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="ExceptionForm.Designer.cs">
<DependentUpon>ExceptionForm.cs</DependentUpon>
</Compile>
<Compile Include="CreateNewProjectForm.cs">
<SubType>Form</SubType>
</Compile>
<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="SetAudioForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="SetAudioForm.Designer.cs">
<DependentUpon>SetAudioForm.cs</DependentUpon>
</Compile>
<Compile Include="MainForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="MainForm.Designer.cs">
<DependentUpon>MainForm.cs</DependentUpon>
</Compile>
<Compile Include="Program.cs" /> <Compile Include="Program.cs" />
<Compile Include="Project\CsbProject.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Serialization\SerializationCueSheetTable.cs" />
<Compile Include="Serialization\SerializationCueTable.cs" />
<Compile Include="Serialization\SerializationAisacGraphTable.cs" />
<Compile Include="Serialization\SerializationAisacPointTable.cs" />
<Compile Include="Serialization\SerializationAisacTable.cs" />
<Compile Include="Serialization\SerializationSoundElementTable.cs" />
<Compile Include="Serialization\SerializationSynthTable.cs" />
<Compile Include="Serialization\SerializationVoiceLimitGroupTable.cs" />
<Compile Include="Serialization\SerializationVersionInfoTable.cs" />
<Compile Include="SetReferenceForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="SetReferenceForm.Designer.cs">
<DependentUpon>SetReferenceForm.cs</DependentUpon>
</Compile>
<EmbeddedResource Include="ExceptionForm.resx">
<DependentUpon>ExceptionForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="CreateNewProjectForm.resx">
<DependentUpon>CreateNewProjectForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="SetAudioForm.resx">
<DependentUpon>SetAudioForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="MainForm.resx">
<DependentUpon>MainForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs"> <Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen> <AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon> <DependentUpon>Resources.resx</DependentUpon>
<DesignTime>True</DesignTime>
</Compile>
<EmbeddedResource Include="SetReferenceForm.resx">
<DependentUpon>SetReferenceForm.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> </Compile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="App.config" /> <None Include="App.config" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<None Include="Resources\FolderBrowserDialogControl_grey_16x.png" />
</ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\SonicAudioLib\SonicAudioLib.csproj"> <ProjectReference Include="..\SonicAudioLib\SonicAudioLib.csproj">
<Project>{63138773-1f47-474c-9345-15eb6183ecc6}</Project> <Project>{63138773-1f47-474c-9345-15eb6183ecc6}</Project>
@ -72,10 +156,70 @@
</ProjectReference> </ProjectReference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<EmbeddedResource Include="Properties\Resources.resx"> <None Include="Resources\ProjectFolderOpen_exp_16x.png" />
<Generator>ResXFileCodeGenerator</Generator> </ItemGroup>
<LastGenOutput>Resources.Designer.cs</LastGenOutput> <ItemGroup>
</EmbeddedResource> <None Include="Resources\Save_16x.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\Import_grey_16x.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\SaveAs_16x.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\Exit_16x.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\BuildDefinition_16x.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\CreateListItem_16x.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\Remove_16x.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\Remove_thin_10x_16x.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\MergeModule_16x.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\Merge_16x.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\Reference_16x.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\Select_16x.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\SoundFile_16x.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\AudioPlayback_16x.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\Stop_grey_16x.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\Paste_16x.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\Copy_16x.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\Folder_grey_16x.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\FolderOpen_exp_16x.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\None_16x.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\Template_16x.png" />
</ItemGroup> </ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. <!-- To modify your build process, add your task inside one of the targets below and uncomment it.

View File

@ -0,0 +1,124 @@
namespace CsbBuilder
{
partial class ExceptionForm
{
/// <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.label1 = new System.Windows.Forms.Label();
this.richTextBox1 = new System.Windows.Forms.RichTextBox();
this.button1 = new System.Windows.Forms.Button();
this.richTextBox2 = new System.Windows.Forms.RichTextBox();
this.button2 = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// label1
//
this.label1.AutoSize = true;
this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(162)));
this.label1.Location = new System.Drawing.Point(12, 12);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(463, 40);
this.label1.TabIndex = 0;
this.label1.Text = "An exception happened. \r\nPlease report the error to improve the application quali" +
"ty.";
//
// richTextBox1
//
this.richTextBox1.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.richTextBox1.Location = new System.Drawing.Point(16, 64);
this.richTextBox1.Name = "richTextBox1";
this.richTextBox1.ReadOnly = true;
this.richTextBox1.Size = new System.Drawing.Size(538, 170);
this.richTextBox1.TabIndex = 1;
this.richTextBox1.Text = "";
//
// 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(475, 416);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(75, 23);
this.button1.TabIndex = 2;
this.button1.Text = "OK";
this.button1.UseVisualStyleBackColor = true;
//
// richTextBox2
//
this.richTextBox2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.richTextBox2.Location = new System.Drawing.Point(16, 240);
this.richTextBox2.Name = "richTextBox2";
this.richTextBox2.ReadOnly = true;
this.richTextBox2.Size = new System.Drawing.Size(538, 170);
this.richTextBox2.TabIndex = 3;
this.richTextBox2.Text = "";
//
// button2
//
this.button2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.button2.Location = new System.Drawing.Point(394, 416);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(75, 23);
this.button2.TabIndex = 4;
this.button2.Text = "Copy Report";
this.button2.UseVisualStyleBackColor = true;
this.button2.Click += new System.EventHandler(this.CopyReport);
//
// ExceptionForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(562, 445);
this.Controls.Add(this.button2);
this.Controls.Add(this.richTextBox2);
this.Controls.Add(this.button1);
this.Controls.Add(this.richTextBox1);
this.Controls.Add(this.label1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "ExceptionForm";
this.ShowIcon = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "CSB Builder";
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Label label1;
private System.Windows.Forms.RichTextBox richTextBox1;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.RichTextBox richTextBox2;
private System.Windows.Forms.Button button2;
}
}

View File

@ -0,0 +1,42 @@
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;
namespace CsbBuilder
{
public partial class ExceptionForm : Form
{
private Exception exception;
public ExceptionForm(Exception exception)
{
InitializeComponent();
this.exception = exception;
if (this.exception == null)
{
this.exception = new Exception("The exception reference is for some reason set to null! Please don't forget to report what you were doing before this happened.");
}
richTextBox1.Text = exception.Message;
richTextBox2.Text = exception.StackTrace;
}
private void CopyReport(object sender, EventArgs e)
{
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.AppendLine($"Application: {Program.ApplicationVersion}");
stringBuilder.AppendLine($"Exception Message: {exception.Message}");
stringBuilder.AppendLine($"Exception Details:");
stringBuilder.AppendLine(exception.StackTrace);
Clipboard.SetText(stringBuilder.ToString());
}
}
}

View File

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

View File

@ -0,0 +1,86 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace CsbBuilder
{
public static class Extensions
{
public static TreeNode CreateNodesByFullPath(this TreeView treeView, string path)
{
string fullPath = string.Empty;
TreeNode currentNode = null;
foreach (string node in path.Split('/'))
{
fullPath += node;
TreeNode treeNode = treeView.FindNodeByFullPath(fullPath);
bool notFound = treeNode == null;
if (notFound)
{
treeNode = new TreeNode(node);
treeNode.Name = treeNode.Text;
}
if (currentNode != null && notFound)
{
currentNode.Nodes.Add(treeNode);
}
else if (currentNode == null && notFound)
{
treeView.Nodes.Add(treeNode);
}
currentNode = treeNode;
fullPath += '/';
}
return currentNode;
}
public static TreeNode FindNodeByFullPath(this TreeNode treeNode, string path)
{
foreach (TreeNode node in treeNode.Nodes)
{
if (node.FullPath == path)
{
return node;
}
TreeNode childNode = node.FindNodeByFullPath(path);
if (childNode != null)
{
return childNode;
}
}
return null;
}
public static TreeNode FindNodeByFullPath(this TreeView treeView, string path)
{
foreach (TreeNode node in treeView.Nodes)
{
if (node.FullPath == path)
{
return node;
}
TreeNode childNode = node.FindNodeByFullPath(path);
if (childNode != null)
{
return childNode;
}
}
return null;
}
}
}

View File

@ -0,0 +1,305 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.ComponentModel;
using CsbBuilder.Audio;
using CsbBuilder.Project;
using CsbBuilder.BuilderNode;
using CsbBuilder.Serialization;
using SonicAudioLib.IO;
using SonicAudioLib.CriMw.Serialization;
using SonicAudioLib.Archive;
using System.Windows.Forms;
namespace CsbBuilder.Importer
{
public static class CsbImporter
{
public static void Import(string path, CsbProject project)
{
// Find the CPK first
string cpkPath = Path.ChangeExtension(path, "cpk");
bool exists = File.Exists(cpkPath);
CriCpkArchive cpkArchive = new CriCpkArchive();
// First, deserialize the main tables
List<SerializationCueSheetTable> cueSheets = CriTableSerializer.Deserialize<SerializationCueSheetTable>(path);
/* Deserialize all the tables we need to import.
* None = 0,
* Cue = 1,
* Synth = 2,
* SoundElement = 4,
* Aisac = 5,
* VoiceLimitGroup = 6,
* VersionInfo = 7,
*/
List<SerializationCueTable> cueTables = CriTableSerializer.Deserialize<SerializationCueTable>(cueSheets.FirstOrDefault(table => table.TableType == 1).TableData);
List<SerializationSynthTable> synthTables = CriTableSerializer.Deserialize<SerializationSynthTable>(cueSheets.FirstOrDefault(table => table.TableType == 2).TableData);
List<SerializationSoundElementTable> soundElementTables = CriTableSerializer.Deserialize<SerializationSoundElementTable>(cueSheets.FirstOrDefault(table => table.TableType == 4).TableData);
List<SerializationAisacTable> aisacTables = CriTableSerializer.Deserialize<SerializationAisacTable>(cueSheets.FirstOrDefault(table => table.TableType == 5).TableData);
// voice limit groups appeared in the later versions, so check if it exists.
List<SerializationVoiceLimitGroupTable> voiceLimitGroupTables = new List<SerializationVoiceLimitGroupTable>();
if (cueSheets.Exists(table => table.TableType == 6))
{
voiceLimitGroupTables = CriTableSerializer.Deserialize<SerializationVoiceLimitGroupTable>(cueSheets.FirstOrDefault(table => table.TableType == 6).TableData);
}
// Deserialize Sound Element tables
// BUT BEFORE THAT, see if there's any sound element with Streamed on
if (soundElementTables.Exists(soundElementTable => soundElementTable.Streaming))
{
if (!exists)
{
throw new Exception("Cannot find CPK file for this CSB file. Please ensure that the CPK file is in the directory where the CSB file is, and has the same name as the CSB file, but with .CPK extension.");
}
cpkArchive.Load(cpkPath);
}
foreach (SerializationSoundElementTable soundElementTable in soundElementTables)
{
BuilderSoundElementNode soundElementNode = new BuilderSoundElementNode();
soundElementNode.Name = soundElementTable.Name;
soundElementNode.ChannelCount = soundElementTable.NumberChannels;
soundElementNode.SampleRate = soundElementTable.SoundFrequency;
soundElementNode.Streaming = soundElementTable.Streaming;
CriAaxArchive aaxArchive = new CriAaxArchive();
byte[] aaxData = soundElementTable.Data;
if (exists && soundElementNode.Streaming)
{
using (Stream source = File.OpenRead(cpkPath))
using (Stream entrySource = cpkArchive.GetByPath(soundElementTable.Name).Open(source))
{
aaxData = ((Substream)entrySource).ToArray();
}
}
aaxArchive.Load(aaxData);
foreach (CriAaxEntry entry in aaxArchive)
{
byte[] data = new byte[entry.Length];
Array.Copy(aaxData, entry.Position, data, 0, data.Length);
string outputFileName = Path.Combine(project.AudioDirectory.FullName, soundElementTable.Name.Replace('/', '_'));
if (entry.Flag == CriAaxEntryFlag.Intro)
{
outputFileName += "_Intro.adx";
soundElementNode.Intro = Path.GetFileName(outputFileName);
}
else if (entry.Flag == CriAaxEntryFlag.Loop)
{
outputFileName += "_Loop.adx";
soundElementNode.Loop = Path.GetFileName(outputFileName);
}
File.WriteAllBytes(outputFileName, data);
// Read the samples just in case
soundElementNode.SampleCount += AdxConverter.LoadHeader(outputFileName).SampleCount;
}
project.SoundElementNodes.Add(soundElementNode);
}
// Deserialize Voice Limit Group tables
foreach (SerializationVoiceLimitGroupTable voiceLimitGroupTable in voiceLimitGroupTables)
{
project.VoiceLimitGroupNodes.Add(new BuilderVoiceLimitGroupNode
{
Name = voiceLimitGroupTable.VoiceLimitGroupName,
MaxAmountOfInstances = voiceLimitGroupTable.VoiceLimitGroupNum,
});
}
// Deserialize Aisac tables
foreach (SerializationAisacTable aisacTable in aisacTables)
{
BuilderAisacNode aisacNode = new BuilderAisacNode();
aisacNode.Name = aisacTable.PathName;
aisacNode.AisacName = aisacTable.Name;
aisacNode.Type = aisacTable.Type;
aisacNode.RandomRange = aisacTable.RandomRange;
// Deserialize the graphs
List<SerializationAisacGraphTable> graphTables = CriTableSerializer.Deserialize<SerializationAisacGraphTable>(aisacTable.Graph);
foreach (SerializationAisacGraphTable graphTable in graphTables)
{
BuilderAisacGraphNode graphNode = new BuilderAisacGraphNode();
graphNode.Name = $"Graph{aisacNode.Graphs.Count}";
graphNode.Type = graphTable.Type;
graphNode.MaximumX = graphTable.InMax;
graphNode.MinimumX = graphTable.InMin;
graphNode.MaximumY = graphTable.OutMax;
graphNode.MinimumY = graphTable.OutMin;
// Deserialize the points
List<SerializationAisacPointTable> pointTables = CriTableSerializer.Deserialize<SerializationAisacPointTable>(graphTable.Points);
foreach (SerializationAisacPointTable pointTable in pointTables)
{
BuilderAisacPointNode pointNode = new BuilderAisacPointNode();
pointNode.Name = $"Point{graphNode.Points.Count}";
pointNode.X = pointTable.In;
pointNode.Y = pointTable.Out;
graphNode.Points.Add(pointNode);
}
aisacNode.Graphs.Add(graphNode);
}
project.AisacNodes.Add(aisacNode);
}
// Deserialize Synth tables
foreach (SerializationSynthTable synthTable in synthTables)
{
BuilderSynthNode synthNode = new BuilderSynthNode();
synthNode.Name = synthTable.SynthName;
synthNode.Type = (BuilderSynthType)synthTable.SynthType;
synthNode.PlaybackType = (BuilderSynthPlaybackType)synthTable.ComplexType;
synthNode.Volume = synthTable.Volume;
synthNode.Pitch = synthTable.Pitch;
synthNode.DelayTime = synthTable.DelayTime;
synthNode.SControl = synthTable.SControl;
synthNode.EgDelay = synthTable.EgDelay;
synthNode.EgAttack = synthTable.EgAttack;
synthNode.EgHold = synthTable.EgHold;
synthNode.EgDecay = synthTable.EgDecay;
synthNode.EgRelease = synthTable.EgRelease;
synthNode.EgSustain = synthTable.EgSustain;
synthNode.FilterType = synthTable.FType;
synthNode.FilterCutoff1 = synthTable.FCof1;
synthNode.FilterCutoff2 = synthTable.FCof2;
synthNode.FilterReso = synthTable.FReso;
synthNode.FilterReleaseOffset = synthTable.FReleaseOffset;
synthNode.DryOName = synthTable.DryOName;
synthNode.Mtxrtr = synthTable.Mtxrtr;
synthNode.Dry0 = synthTable.Dry0;
synthNode.Dry1 = synthTable.Dry1;
synthNode.Dry2 = synthTable.Dry2;
synthNode.Dry3 = synthTable.Dry3;
synthNode.Dry4 = synthTable.Dry4;
synthNode.Dry5 = synthTable.Dry5;
synthNode.Dry6 = synthTable.Dry6;
synthNode.Dry7 = synthTable.Dry7;
synthNode.WetOName = synthTable.WetOName;
synthNode.Wet0 = synthTable.Wet0;
synthNode.Wet1 = synthTable.Wet1;
synthNode.Wet2 = synthTable.Wet2;
synthNode.Wet3 = synthTable.Wet3;
synthNode.Wet4 = synthTable.Wet4;
synthNode.Wet5 = synthTable.Wet5;
synthNode.Wet6 = synthTable.Wet6;
synthNode.Wet7 = synthTable.Wet7;
synthNode.Wcnct0 = synthTable.Wcnct0;
synthNode.Wcnct1 = synthTable.Wcnct1;
synthNode.Wcnct2 = synthTable.Wcnct2;
synthNode.Wcnct3 = synthTable.Wcnct3;
synthNode.Wcnct4 = synthTable.Wcnct4;
synthNode.Wcnct5 = synthTable.Wcnct5;
synthNode.Wcnct6 = synthTable.Wcnct6;
synthNode.Wcnct7 = synthTable.Wcnct7;
synthNode.VoiceLimitType = synthTable.VoiceLimitType;
synthNode.VoiceLimitPriority = synthTable.VoiceLimitPriority;
synthNode.VoiceLimitProhibitionTime = synthTable.VoiceLimitPhTime;
synthNode.VoiceLimitPcdlt = synthTable.VoiceLimitPcdlt;
synthNode.Pan3dVolumeOffset = synthTable.Pan3dVolumeOffset;
synthNode.Pan3dVolumeGain = synthTable.Pan3dVolumeGain;
synthNode.Pan3dAngleOffset = synthTable.Pan3dAngleOffset;
synthNode.Pan3dAngleGain = synthTable.Pan3dAngleGain;
synthNode.Pan3dDistanceOffset = synthTable.Pan3dDistanceOffset;
synthNode.Pan3dDistanceGain = synthTable.Pan3dDistanceGain;
synthNode.Dry0g = synthTable.Dry0g;
synthNode.Dry1g = synthTable.Dry1g;
synthNode.Dry2g = synthTable.Dry2g;
synthNode.Dry3g = synthTable.Dry3g;
synthNode.Dry4g = synthTable.Dry4g;
synthNode.Dry5g = synthTable.Dry5g;
synthNode.Dry6g = synthTable.Dry6g;
synthNode.Dry7g = synthTable.Dry7g;
synthNode.Wet0g = synthTable.Wet0g;
synthNode.Wet1g = synthTable.Wet1g;
synthNode.Wet2g = synthTable.Wet2g;
synthNode.Wet3g = synthTable.Wet3g;
synthNode.Wet4g = synthTable.Wet4g;
synthNode.Wet5g = synthTable.Wet5g;
synthNode.Wet6g = synthTable.Wet6g;
synthNode.Wet7g = synthTable.Wet7g;
synthNode.Filter1Type = synthTable.F1Type;
synthNode.Filter1CutoffOffset = synthTable.F1CofOffset;
synthNode.Filter1CutoffGain = synthTable.F1CofGain;
synthNode.Filter1ResoOffset = synthTable.F1ResoOffset;
synthNode.Filter1ResoGain = synthTable.F1ResoGain;
synthNode.Filter2Type = synthTable.F2Type;
synthNode.Filter2CutoffLowerOffset = synthTable.F2CofLowOffset;
synthNode.Filter2CutoffLowerGain = synthTable.F2CofLowGain;
synthNode.Filter2CutoffHigherOffset = synthTable.F2CofHighOffset;
synthNode.Filter2CutoffHigherGain = synthTable.F2CofHighGain;
synthNode.PlaybackProbability = synthTable.Probability;
synthNode.NLmtChildren = synthTable.NumberLmtChildren;
synthNode.Repeat = synthTable.Repeat;
synthNode.ComboTime = synthTable.ComboTime;
synthNode.ComboLoopBack = synthTable.ComboLoopBack;
project.SynthNodes.Add(synthNode);
}
// Convert the cue tables
foreach (SerializationCueTable cueTable in cueTables)
{
BuilderCueNode cueNode = new BuilderCueNode();
cueNode.Name = cueTable.Name;
cueNode.Identifier = cueTable.Id;
cueNode.UserComment = cueTable.UserData;
cueNode.Flags = cueTable.Flags;
cueNode.SynthReference = cueTable.SynthPath;
project.CueNodes.Add(cueNode);
}
// Fix links
for (int i = 0; i < synthTables.Count; i++)
{
SerializationSynthTable synthTable = synthTables[i];
BuilderSynthNode synthNode = project.SynthNodes[i];
if (synthNode.Type == BuilderSynthType.Single)
{
synthNode.SoundElementReference = synthTable.LinkName;
}
// Polyphonic
else if (synthNode.Type == BuilderSynthType.WithChildren)
{
synthNode.Children = synthTable.LinkName.Split(new char[] { (char)0x0A }, StringSplitOptions.RemoveEmptyEntries).ToList();
}
if (!string.IsNullOrEmpty(synthTable.AisacSetName))
{
string[] aisacs = synthTable.AisacSetName.Split(new char[] { (char)0x0A }, StringSplitOptions.RemoveEmptyEntries);
string[] name = aisacs[0].Split(new string[] { "::" }, StringSplitOptions.None);
synthNode.AisacReference = name[1]; // will add support for multiple aisacs (I'm actually not even sure if csbs support multiple aisacs...)
}
if (!string.IsNullOrEmpty(synthTable.VoiceLimitGroupName))
{
synthNode.VoiceLimitGroupReference = synthTable.VoiceLimitGroupName;
}
}
}
}
}

1799
Source/CsbBuilder/MainForm.Designer.cs generated Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,177 @@
<?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>
<metadata name="mainMenu.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>394, 17</value>
</metadata>
<metadata name="splitContainer1.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="nodeTreeMenu.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>259, 17</value>
</metadata>
<metadata name="imageList.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="synthFolderTreeMenu.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>459, 56</value>
</metadata>
<metadata name="folderTreeMenu.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>120, 17</value>
</metadata>
<metadata name="splitContainer2.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="aisacTreeMenu.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>161, 95</value>
</metadata>
<metadata name="nodeMenu.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>504, 17</value>
</metadata>
<metadata name="folderMenu.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>615, 17</value>
</metadata>
<metadata name="trackMenu.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>730, 17</value>
</metadata>
<metadata name="cueReferenceMenu.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>840, 17</value>
</metadata>
<metadata name="trackItemMenu.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 56</value>
</metadata>
<metadata name="soundElementMenu.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>151, 56</value>
</metadata>
<metadata name="synthFolderMenu.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>312, 56</value>
</metadata>
<metadata name="statusStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>629, 56</value>
</metadata>
<metadata name="aisacNodeMenu.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>745, 56</value>
</metadata>
<metadata name="aisacFolderMenu.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 95</value>
</metadata>
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>172</value>
</metadata>
</root>

View File

@ -1,77 +1,58 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.IO; using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
using System.IO;
using SonicAudioLib.CriMw; using System.Reflection;
using SonicAudioLib.CriMw.Serialization;
using SonicAudioLib.IO;
using SonicAudioLib.Archive;
using System.Globalization; using System.Globalization;
using System.Xml.Serialization;
using System.Runtime.Serialization.Formatters.Binary;
using System.Runtime.Serialization;
namespace CsbBuilder namespace CsbBuilder
{ {
class Program static class Program
{ {
public static string ProjectsPath
{
get
{
return Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "Projects");
}
}
public static string ApplicationVersion
{
get
{
AssemblyName assemblyName = Assembly.GetEntryAssembly().GetName();
return $"{assemblyName.Name} (Version {assemblyName.Version.ToString()})";
}
}
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main(string[] args) static void Main(string[] args)
{ {
if (args.Length < 1) if (args.Length > 0)
{ {
Console.WriteLine(Properties.Resources.Description); Audio.AdxConverter.ConvertToWav(args[0]);
Console.ReadLine();
return; return;
} }
if (args[0].EndsWith(".csb")) Thread.CurrentThread.CurrentUICulture = CultureInfo.GetCultureInfo("en-US");
{ Application.ThreadException += OnException;
List<CriTableCueSheet> tables = CriTableSerializer.Deserialize<CriTableCueSheet>(args[0]); Application.EnableVisualStyles();
Serialize(args[0] + ".xml", tables); Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new MainForm());
foreach (CriTableCueSheet table in tables)
{
DirectoryInfo baseDirectory = new DirectoryInfo(
Path.Combine(
Path.GetDirectoryName(args[0]),
Path.GetFileNameWithoutExtension(args[0]),
Enum.GetName(typeof(CriTableCueSheet.EnumTableType), table.TableType)));
baseDirectory.Create();
foreach (CriTableCue cue in table.DataList.OfType<CriTableCue>())
{
Serialize(Path.Combine(baseDirectory.FullName, cue.Name + ".xml"), cue);
} }
foreach (CriTableSynth synth in table.DataList.OfType<CriTableSynth>()) private static void OnException(object sender, ThreadExceptionEventArgs e)
{ {
Directory.CreateDirectory(Path.Combine(baseDirectory.FullName, Path.GetDirectoryName(synth.SynthName))); new ExceptionForm(e.Exception).ShowDialog();
Serialize(Path.Combine(baseDirectory.FullName, synth.SynthName + ".xml"), synth); Application.Exit();
}
foreach (CriTableSoundElement soundElement in table.DataList.OfType<CriTableSoundElement>())
{
Directory.CreateDirectory(Path.Combine(baseDirectory.FullName, Path.GetDirectoryName(soundElement.Name)));
}
}
}
else if (File.GetAttributes(args[0]).HasFlag(FileAttributes.Directory))
{
}
}
static void Serialize(string path, object obj)
{
XmlSerializer serializer = new XmlSerializer(obj.GetType());
using (Stream destination = File.Create(path))
{
serializer.Serialize(destination, obj);
}
} }
} }
} }

View File

@ -0,0 +1,261 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using CsbBuilder.BuilderNode;
using System.Xml.Serialization;
using System.Windows.Forms;
using CsbBuilder;
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 List<BuilderCueNode> cueNodes = new List<BuilderCueNode>();
private List<BuilderSynthNode> synthNodes = new List<BuilderSynthNode>();
private List<BuilderSoundElementNode> soundElementNodes = new List<BuilderSoundElementNode>();
private List<BuilderAisacNode> aisacNodes = new List<BuilderAisacNode>();
private List<BuilderVoiceLimitGroupNode> voiceLimitGroupNodes = new List<BuilderVoiceLimitGroupNode>();
public string Name
{
get
{
return name;
}
set
{
name = value;
}
}
[XmlIgnore]
public DirectoryInfo Directory
{
get
{
return directory;
}
set
{
directory = value;
}
}
[XmlIgnore]
public DirectoryInfo AudioDirectory
{
get
{
return new DirectoryInfo(Path.Combine(directory.FullName, "Audio"));
}
}
[XmlIgnore]
public DirectoryInfo BinaryDirectory
{
get
{
return new DirectoryInfo(Path.Combine(directory.FullName, "Binary"));
}
}
[XmlIgnore]
public FileInfo ProjectFile
{
get
{
return new FileInfo(Path.Combine(directory.FullName, $"{name}.csbproject"));
}
}
[XmlArray("CueNodes"), XmlArrayItem(typeof(BuilderCueNode))]
public List<BuilderCueNode> CueNodes
{
get
{
return cueNodes;
}
}
[XmlArray("SynthNodes"), XmlArrayItem(typeof(BuilderSynthNode))]
public List<BuilderSynthNode> SynthNodes
{
get
{
return synthNodes;
}
}
[XmlArray("SoundElementNodes"), XmlArrayItem(typeof(BuilderSoundElementNode))]
public List<BuilderSoundElementNode> SoundElementNodes
{
get
{
return soundElementNodes;
}
}
[XmlArray("AisacNodes"), XmlArrayItem(typeof(BuilderAisacNode))]
public List<BuilderAisacNode> AisacNodes
{
get
{
return aisacNodes;
}
}
[XmlArray("VoiceLimitGroupNodes"), XmlArrayItem(typeof(BuilderVoiceLimitGroupNode))]
public List<BuilderVoiceLimitGroupNode> VoiceLimitGroupNodes
{
get
{
return voiceLimitGroupNodes;
}
}
private void GetAbsoluteIndex(string path, TreeNode treeNode, ref int index, ref bool stop)
{
if (!stop)
{
index++;
if (treeNode.FullPath == path)
{
stop = true;
}
else
{
foreach (TreeNode childNode in treeNode.Nodes)
{
GetAbsoluteIndex(path, childNode, ref index, ref stop);
}
}
}
}
private int GetAbsoluteIndex(string path, TreeView treeView)
{
bool stop = false;
int index = -1;
foreach (TreeNode treeNode in treeView.Nodes)
{
GetAbsoluteIndex(path, treeNode, ref index, ref stop);
}
return index;
}
public void Order(TreeView cueTree, TreeView synthTree, TreeView soundElementTree, TreeView aisacTree, TreeView voiceLimitGroupTree)
{
cueNodes = cueNodes.OrderBy(cue => cueTree.Nodes.IndexOfKey(cue.Name)).ToList();
synthNodes = synthNodes.OrderBy(synth => GetAbsoluteIndex(synth.Name, synthTree)).ToList();
soundElementNodes = soundElementNodes.OrderBy(soundElement => soundElementTree.FindNodeByFullPath(soundElement.Name).Index).ToList();
aisacNodes = aisacNodes.OrderBy(aisac => aisacTree.FindNodeByFullPath(aisac.Name).Index).ToList();
voiceLimitGroupNodes = voiceLimitGroupNodes.OrderBy(voiceLimitGroup => voiceLimitGroupTree.Nodes.IndexOfKey(voiceLimitGroup.Name)).ToList();
synthNodes.ForEach(synth =>
{
if (synth.Children.Count > 0)
{
synth.Children = synth.Children.OrderBy(child => synthTree.FindNodeByFullPath(child).Index).ToList();
}
});
}
public static CsbProject Load(string projectFile)
{
XmlSerializer serializer = new XmlSerializer(typeof(CsbProject));
CsbProject csbProject = null;
using (Stream source = File.OpenRead(projectFile))
{
csbProject = (CsbProject)serializer.Deserialize(source);
}
csbProject.Directory = new DirectoryInfo(Path.GetDirectoryName(projectFile));
return csbProject;
}
public string AddAudio(string path)
{
if (string.IsNullOrEmpty(path))
{
return string.Empty;
}
string name = Path.GetFileName(path);
string nameNoExtension = Path.GetFileNameWithoutExtension(name);
string outputPath = Path.Combine(AudioDirectory.FullName, name);
if (path != outputPath)
{
string uniqueName = nameNoExtension;
int index = -1;
while (File.Exists(Path.Combine(AudioDirectory.FullName, $"{uniqueName}.adx")))
{
uniqueName = $"{nameNoExtension}_{++index}";
}
outputPath = Path.Combine(AudioDirectory.FullName, $"{uniqueName}.adx");
File.Copy(path, outputPath, true);
name = $"{uniqueName}.adx";
}
return name;
}
public string GetFullAudioPath(string name)
{
return Path.Combine(AudioDirectory.FullName, name);
}
public void Save()
{
XmlSerializer serializer = new XmlSerializer(typeof(CsbProject));
using (Stream destination = ProjectFile.Create())
{
serializer.Serialize(destination, this);
}
}
public void SaveAs(string outputDirectory)
{
DirectoryInfo oldAudioDirectory = AudioDirectory;
name = Path.GetFileNameWithoutExtension(outputDirectory);
directory = new DirectoryInfo(Path.GetDirectoryName(outputDirectory));
Create();
Save();
if (oldAudioDirectory.Exists)
{
foreach (FileInfo audioFile in oldAudioDirectory.EnumerateFiles())
{
audioFile.CopyTo(Path.Combine(AudioDirectory.FullName, audioFile.Name), true);
}
}
}
public void Create()
{
directory.Create();
AudioDirectory.Create();
}
}
}

View File

@ -5,12 +5,12 @@ using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following // General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information // set of attributes. Change these attribute values to modify the information
// associated with an assembly. // associated with an assembly.
[assembly: AssemblyTitle("CsbBuilder")] [assembly: AssemblyTitle("CSB Builder")]
[assembly: AssemblyDescription("")] [assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")] [assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")] [assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("CsbBuilder")] [assembly: AssemblyProduct("CsbBuilder")]
[assembly: AssemblyCopyright("Copyright © 2016")] [assembly: AssemblyCopyright("Copyright © blueskythlikesclouds 2014-2017")]
[assembly: AssemblyTrademark("")] [assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")] [assembly: AssemblyCulture("")]
@ -20,7 +20,7 @@ using System.Runtime.InteropServices;
[assembly: ComVisible(false)] [assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM // The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("91f6b6a6-5d95-4c7a-b22e-a35bd32db67a")] [assembly: Guid("70a6a571-23ec-4b2c-a579-1e6812ddc34e")]
// Version information for an assembly consists of the following four values: // Version information for an assembly consists of the following four values:
// //
@ -32,5 +32,4 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyVersion("0.1.*")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@ -61,11 +61,222 @@ namespace CsbBuilder.Properties {
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to placeholder. /// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary> /// </summary>
internal static string Description { internal static System.Drawing.Bitmap Build {
get { get {
return ResourceManager.GetString("Description", resourceCulture); object obj = ResourceManager.GetObject("Build", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap Copy {
get {
object obj = ResourceManager.GetObject("Copy", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap Create {
get {
object obj = ResourceManager.GetObject("Create", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap Exit {
get {
object obj = ResourceManager.GetObject("Exit", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap Folder {
get {
object obj = ResourceManager.GetObject("Folder", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap FolderOpen {
get {
object obj = ResourceManager.GetObject("FolderOpen", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap Import {
get {
object obj = ResourceManager.GetObject("Import", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap ImportAndMerge {
get {
object obj = ResourceManager.GetObject("ImportAndMerge", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap LoadProject {
get {
object obj = ResourceManager.GetObject("LoadProject", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap Merge {
get {
object obj = ResourceManager.GetObject("Merge", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap NewProject {
get {
object obj = ResourceManager.GetObject("NewProject", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap Node {
get {
object obj = ResourceManager.GetObject("Node", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap Paste {
get {
object obj = ResourceManager.GetObject("Paste", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap Play {
get {
object obj = ResourceManager.GetObject("Play", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap Remove {
get {
object obj = ResourceManager.GetObject("Remove", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap Save {
get {
object obj = ResourceManager.GetObject("Save", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap SaveAs {
get {
object obj = ResourceManager.GetObject("SaveAs", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap Select {
get {
object obj = ResourceManager.GetObject("Select", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap SetReference {
get {
object obj = ResourceManager.GetObject("SetReference", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap Sound {
get {
object obj = ResourceManager.GetObject("Sound", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap Stop {
get {
object obj = ResourceManager.GetObject("Stop", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap Template {
get {
object obj = ResourceManager.GetObject("Template", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
} }
} }
} }

View File

@ -117,7 +117,71 @@
<resheader name="writer"> <resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader> </resheader>
<data name="Description" xml:space="preserve"> <assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<value>placeholder</value> <data name="Create" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\CreateListItem_16x.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Stop" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Stop_grey_16x.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Merge" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\MergeModule_16x.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Remove" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Remove_thin_10x_16x.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Paste" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Paste_16x.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Save" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Save_16x.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="LoadProject" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\ProjectFolderOpen_exp_16x.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Build" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\BuildDefinition_16x.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Exit" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Exit_16x.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Import" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Import_grey_16x.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="SetReference" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Reference_16x.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="NewProject" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\FolderBrowserDialogControl_grey_16x.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Sound" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\SoundFile_16x.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Play" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\AudioPlayback_16x.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="SaveAs" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\SaveAs_16x.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="ImportAndMerge" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Merge_16x.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Select" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Select_16x.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Copy" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Copy_16x.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Folder" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Folder_grey_16x.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="FolderOpen" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\FolderOpen_exp_16x.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Node" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\None_16x.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<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>
</root> </root>

View File

@ -0,0 +1,30 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace 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;
}
}
}
}

View File

@ -0,0 +1,7 @@
<?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>

Binary file not shown.

After

Width:  |  Height:  |  Size: 252 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 409 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 200 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 263 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 390 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 222 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 307 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 195 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 422 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 297 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 381 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 429 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 278 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 344 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 179 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 126 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 138 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 304 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 222 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 469 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 360 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 142 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 235 B

View File

@ -0,0 +1,94 @@
using System.IO;
using SonicAudioLib.CriMw.Serialization;
namespace CsbBuilder.Serialization
{
[CriSerializable("TBLIGR")]
public class SerializationAisacGraphTable
{
private byte typeField = 0;
private float imaxField = 0;
private float iminField = 0;
private float omaxField = 0;
private float ominField = 0;
private byte[] pointsField = null;
[CriField("type", 0)]
public byte Type
{
get
{
return typeField;
}
set
{
typeField = value;
}
}
[CriField("imax", 1)]
public float InMax
{
get
{
return imaxField;
}
set
{
imaxField = value;
}
}
[CriField("imin", 2)]
public float InMin
{
get
{
return iminField;
}
set
{
iminField = value;
}
}
[CriField("omax", 3)]
public float OutMax
{
get
{
return omaxField;
}
set
{
omaxField = value;
}
}
[CriField("omin", 4)]
public float OutMin
{
get
{
return ominField;
}
set
{
ominField = value;
}
}
[CriField("points", 5)]
public byte[] Points
{
get
{
return pointsField;
}
set
{
pointsField = value;
}
}
}
}

View File

@ -1,28 +1,24 @@
using System.IO; using System.IO;
using SonicAudioLib.CriMw.Serialization; using SonicAudioLib.CriMw.Serialization;
using System; namespace CsbBuilder.Serialization
using System.Xml.Serialization;
namespace CsbBuilder
{ {
[Serializable]
[CriSerializable("TBLIPT")] [CriSerializable("TBLIPT")]
public class CriTableAisacPoint public class SerializationAisacPointTable
{ {
private ushort _in = 0; private ushort inField = 0;
private ushort _out = 0; private ushort outField = 0;
[CriField("in", 0)] [CriField("in", 0)]
public ushort In public ushort In
{ {
get get
{ {
return _in; return inField;
} }
set set
{ {
_in = value; inField = value;
} }
} }
@ -31,11 +27,11 @@ namespace CsbBuilder
{ {
get get
{ {
return _out; return outField;
} }
set set
{ {
_out = value; outField = value;
} }
} }
} }

View File

@ -1,32 +1,27 @@
using System.Collections.Generic;
using System.IO; using System.IO;
using SonicAudioLib.CriMw;
using SonicAudioLib.CriMw.Serialization; using SonicAudioLib.CriMw.Serialization;
using System; namespace CsbBuilder.Serialization
using System.Xml.Serialization;
namespace CsbBuilder
{ {
[Serializable]
[CriSerializable("TBLISC")] [CriSerializable("TBLISC")]
public class CriTableAisac public class SerializationAisacTable
{ {
private string _name = string.Empty; private string nameField = string.Empty;
private string _ptname = string.Empty; private string ptnameField = string.Empty;
private byte _type = 0; private byte typeField = 0;
private byte _rndrng = 0; private byte[] grphField = null;
private byte rndrngField = 0;
[CriField("name", 0)] [CriField("name", 0)]
public string Name public string Name
{ {
get get
{ {
return _name; return nameField;
} }
set set
{ {
_name = value; nameField = value;
} }
} }
@ -35,11 +30,11 @@ namespace CsbBuilder
{ {
get get
{ {
return _ptname; return ptnameField;
} }
set set
{ {
_ptname = value; ptnameField = value;
} }
} }
@ -48,29 +43,24 @@ namespace CsbBuilder
{ {
get get
{ {
return _type; return typeField;
} }
set set
{ {
_type = value; typeField = value;
} }
} }
[CriIgnore]
public List<CriTableAisacGraph> GraphList { get; set; }
[XmlIgnore]
[CriField("grph", 3)] [CriField("grph", 3)]
public byte[] Graph public byte[] Graph
{ {
get get
{ {
return CriTableSerializer.Serialize(GraphList, CriTableWriterSettings.AdxSettings); return grphField;
} }
set set
{ {
GraphList = CriTableSerializer.Deserialize<CriTableAisacGraph>(value); grphField = value;
} }
} }
@ -79,11 +69,11 @@ namespace CsbBuilder
{ {
get get
{ {
return _rndrng; return rndrngField;
} }
set set
{ {
_rndrng = value; rndrngField = value;
} }
} }
} }

View File

@ -0,0 +1,52 @@
using System.IO;
using SonicAudioLib.CriMw.Serialization;
namespace CsbBuilder.Serialization
{
[CriSerializable("TBLCSB")]
public class SerializationCueSheetTable
{
private string nameField = string.Empty;
private byte ttypeField = 0;
private byte[] utfField = null;
[CriField("name", 0)]
public string Name
{
get
{
return nameField;
}
set
{
nameField = value;
}
}
[CriField("ttype", 1)]
public byte TableType
{
get
{
return ttypeField;
}
set
{
ttypeField = value;
}
}
[CriField("utf", 2)]
public byte[] TableData
{
get
{
return utfField;
}
set
{
utfField = value;
}
}
}
}

View File

@ -1,31 +1,27 @@
using System.IO; using System.IO;
using SonicAudioLib.CriMw.Serialization; using SonicAudioLib.CriMw.Serialization;
using System; namespace CsbBuilder.Serialization
using System.Xml.Serialization;
namespace CsbBuilder
{ {
[Serializable]
[CriSerializable("TBLCUE")] [CriSerializable("TBLCUE")]
public class CriTableCue public class SerializationCueTable
{ {
private string _name = string.Empty; private string nameField = string.Empty;
private uint _id = 0; private uint idField = 0;
private string _synth = string.Empty; private string synthField = string.Empty;
private string _udata = string.Empty; private string udataField = string.Empty;
private byte _flags = 0; private byte flagsField = 0;
[CriField("name", 0)] [CriField("name", 0)]
public string Name public string Name
{ {
get get
{ {
return _name; return nameField;
} }
set set
{ {
_name = value; nameField = value;
} }
} }
@ -34,24 +30,24 @@ namespace CsbBuilder
{ {
get get
{ {
return _id; return idField;
} }
set set
{ {
_id = value; idField = value;
} }
} }
[CriField("synth", 2)] [CriField("synth", 2)]
public string Synth public string SynthPath
{ {
get get
{ {
return _synth; return synthField;
} }
set set
{ {
_synth = value; synthField = value;
} }
} }
@ -60,11 +56,11 @@ namespace CsbBuilder
{ {
get get
{ {
return _udata; return udataField;
} }
set set
{ {
_udata = value; udataField = value;
} }
} }
@ -73,11 +69,11 @@ namespace CsbBuilder
{ {
get get
{ {
return _flags; return flagsField;
} }
set set
{ {
_flags = value; flagsField = value;
} }
} }
} }

View File

@ -0,0 +1,108 @@
using System.IO;
using SonicAudioLib.CriMw.Serialization;
namespace CsbBuilder.Serialization
{
[CriSerializable("TBLSDL")]
public class SerializationSoundElementTable
{
private string nameField = string.Empty;
private byte[] dataField = null;
private byte fmtField = 0;
private byte nchField = 0;
private bool stmflgField = false;
private uint sfreqField = 0;
private uint nsmplField = 0;
[CriField("name", 0)]
public string Name
{
get
{
return nameField;
}
set
{
nameField = value;
}
}
[CriField("data", 1)]
public byte[] Data
{
get
{
return dataField;
}
set
{
dataField = value;
}
}
[CriField("fmt", 2)]
public byte FormatType
{
get
{
return fmtField;
}
set
{
fmtField = value;
}
}
[CriField("nch", 3)]
public byte NumberChannels
{
get
{
return nchField;
}
set
{
nchField = value;
}
}
[CriField("stmflg", 4)]
public bool Streaming
{
get
{
return stmflgField;
}
set
{
stmflgField = value;
}
}
[CriField("sfreq", 5)]
public uint SoundFrequency
{
get
{
return sfreqField;
}
set
{
sfreqField = value;
}
}
[CriField("nsmpl", 6)]
public uint NumberSamples
{
get
{
return nsmplField;
}
set
{
nsmplField = value;
}
}
}
}

View File

@ -1,28 +1,24 @@
using System.IO; using System.IO;
using SonicAudioLib.CriMw.Serialization; using SonicAudioLib.CriMw.Serialization;
using System; namespace CsbBuilder.Serialization
using System.Xml.Serialization;
namespace CsbBuilder
{ {
[Serializable]
[CriSerializable("TBL_INFO")] [CriSerializable("TBL_INFO")]
public class CriTableVersionInfo public class SerializationVersionInfoTable
{ {
private uint _DataFmtVer = 0x940000; private uint DataFmtVerField = 0x940000;
private uint _ExtSize = 0; private uint ExtSizeField = 0;
[CriField("DataFmtVer", 0)] [CriField("DataFmtVer", 0)]
public uint DataFormatVersion public uint DataFormatVersion
{ {
get get
{ {
return _DataFmtVer; return DataFmtVerField;
} }
set set
{ {
_DataFmtVer = value; DataFmtVerField = value;
} }
} }
@ -31,11 +27,11 @@ namespace CsbBuilder
{ {
get get
{ {
return _ExtSize; return ExtSizeField;
} }
set set
{ {
_ExtSize = value; ExtSizeField = value;
} }
} }
} }

View File

@ -1,28 +1,24 @@
using System.IO; using System.IO;
using SonicAudioLib.CriMw.Serialization; using SonicAudioLib.CriMw.Serialization;
using System; namespace CsbBuilder.Serialization
using System.Xml.Serialization;
namespace CsbBuilder
{ {
[Serializable]
[CriSerializable("TBLVLG")] [CriSerializable("TBLVLG")]
public class CriTableVoiceLimitGroup public class SerializationVoiceLimitGroupTable
{ {
private string _vlgname = string.Empty; private string vlgnameField = string.Empty;
private uint _vlgnvoice = 0; private uint vlgnvoiceField = 0;
[CriField("vlgname", 0)] [CriField("vlgname", 0)]
public string VoiceLimitGroupName public string VoiceLimitGroupName
{ {
get get
{ {
return _vlgname; return vlgnameField;
} }
set set
{ {
_vlgname = value; vlgnameField = value;
} }
} }
@ -31,11 +27,11 @@ namespace CsbBuilder
{ {
get get
{ {
return _vlgnvoice; return vlgnvoiceField;
} }
set set
{ {
_vlgnvoice = value; vlgnvoiceField = value;
} }
} }
} }

193
Source/CsbBuilder/SetAudioForm.Designer.cs generated Normal file
View File

@ -0,0 +1,193 @@
namespace CsbBuilder
{
partial class SetAudioForm
{
/// <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.groupBox1 = new System.Windows.Forms.GroupBox();
this.swapButton = new System.Windows.Forms.Button();
this.okButton = new System.Windows.Forms.Button();
this.introBrowseButton = new System.Windows.Forms.Button();
this.cancelButton = new System.Windows.Forms.Button();
this.loopBrowseButton = new System.Windows.Forms.Button();
this.loopTextBox = new System.Windows.Forms.MaskedTextBox();
this.label2 = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.introTextBox = new System.Windows.Forms.MaskedTextBox();
this.groupBox1.SuspendLayout();
this.SuspendLayout();
//
// groupBox1
//
this.groupBox1.Controls.Add(this.swapButton);
this.groupBox1.Controls.Add(this.okButton);
this.groupBox1.Controls.Add(this.introBrowseButton);
this.groupBox1.Controls.Add(this.cancelButton);
this.groupBox1.Controls.Add(this.loopBrowseButton);
this.groupBox1.Controls.Add(this.loopTextBox);
this.groupBox1.Controls.Add(this.label2);
this.groupBox1.Controls.Add(this.label1);
this.groupBox1.Controls.Add(this.introTextBox);
this.groupBox1.FlatStyle = System.Windows.Forms.FlatStyle.System;
this.groupBox1.Location = new System.Drawing.Point(12, 12);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(529, 102);
this.groupBox1.TabIndex = 7;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "Audio";
//
// swapButton
//
this.swapButton.Anchor = System.Windows.Forms.AnchorStyles.None;
this.swapButton.Font = new System.Drawing.Font("Microsoft Sans Serif", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(162)));
this.swapButton.Location = new System.Drawing.Point(499, 17);
this.swapButton.Name = "swapButton";
this.swapButton.Size = new System.Drawing.Size(24, 50);
this.swapButton.TabIndex = 6;
this.swapButton.Text = "↕";
this.swapButton.UseVisualStyleBackColor = true;
this.swapButton.Click += new System.EventHandler(this.Swap);
//
// okButton
//
this.okButton.Anchor = System.Windows.Forms.AnchorStyles.None;
this.okButton.DialogResult = System.Windows.Forms.DialogResult.OK;
this.okButton.FlatStyle = System.Windows.Forms.FlatStyle.System;
this.okButton.Location = new System.Drawing.Point(367, 73);
this.okButton.Name = "okButton";
this.okButton.Size = new System.Drawing.Size(75, 23);
this.okButton.TabIndex = 8;
this.okButton.Text = "OK";
this.okButton.UseVisualStyleBackColor = true;
//
// introBrowseButton
//
this.introBrowseButton.Anchor = System.Windows.Forms.AnchorStyles.None;
this.introBrowseButton.FlatStyle = System.Windows.Forms.FlatStyle.System;
this.introBrowseButton.Location = new System.Drawing.Point(418, 17);
this.introBrowseButton.Name = "introBrowseButton";
this.introBrowseButton.Size = new System.Drawing.Size(75, 23);
this.introBrowseButton.TabIndex = 5;
this.introBrowseButton.Text = "Browse";
this.introBrowseButton.UseVisualStyleBackColor = true;
this.introBrowseButton.Click += new System.EventHandler(this.BrowseIntro);
//
// cancelButton
//
this.cancelButton.Anchor = System.Windows.Forms.AnchorStyles.None;
this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.cancelButton.FlatStyle = System.Windows.Forms.FlatStyle.System;
this.cancelButton.Location = new System.Drawing.Point(448, 73);
this.cancelButton.Name = "cancelButton";
this.cancelButton.Size = new System.Drawing.Size(75, 23);
this.cancelButton.TabIndex = 9;
this.cancelButton.Text = "Cancel";
this.cancelButton.UseVisualStyleBackColor = true;
//
// loopBrowseButton
//
this.loopBrowseButton.Anchor = System.Windows.Forms.AnchorStyles.None;
this.loopBrowseButton.FlatStyle = System.Windows.Forms.FlatStyle.System;
this.loopBrowseButton.Location = new System.Drawing.Point(418, 44);
this.loopBrowseButton.Name = "loopBrowseButton";
this.loopBrowseButton.Size = new System.Drawing.Size(75, 23);
this.loopBrowseButton.TabIndex = 4;
this.loopBrowseButton.Text = "Browse";
this.loopBrowseButton.UseVisualStyleBackColor = true;
this.loopBrowseButton.Click += new System.EventHandler(this.BrowseLoop);
//
// loopTextBox
//
this.loopTextBox.Anchor = System.Windows.Forms.AnchorStyles.None;
this.loopTextBox.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.loopTextBox.Location = new System.Drawing.Point(43, 45);
this.loopTextBox.Name = "loopTextBox";
this.loopTextBox.Size = new System.Drawing.Size(369, 20);
this.loopTextBox.TabIndex = 3;
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(6, 48);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(34, 13);
this.label2.TabIndex = 2;
this.label2.Text = "Loop:";
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(9, 21);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(31, 13);
this.label1.TabIndex = 1;
this.label1.Text = "Intro:";
//
// introTextBox
//
this.introTextBox.Anchor = System.Windows.Forms.AnchorStyles.None;
this.introTextBox.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.introTextBox.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.introTextBox.Location = new System.Drawing.Point(43, 19);
this.introTextBox.Name = "introTextBox";
this.introTextBox.Size = new System.Drawing.Size(369, 20);
this.introTextBox.TabIndex = 0;
//
// SetAudioForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(554, 124);
this.Controls.Add(this.groupBox1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "SetAudioForm";
this.ShowIcon = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Load Audio";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.OnClose);
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.Button loopBrowseButton;
private System.Windows.Forms.MaskedTextBox loopTextBox;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.MaskedTextBox introTextBox;
private System.Windows.Forms.Button okButton;
private System.Windows.Forms.Button cancelButton;
private System.Windows.Forms.Button swapButton;
private System.Windows.Forms.Button introBrowseButton;
}
}

View File

@ -0,0 +1,99 @@
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 System.IO;
namespace CsbBuilder
{
public partial class SetAudioForm : Form
{
public SetAudioForm(string intro, string loop)
{
InitializeComponent();
introTextBox.Text = intro;
loopTextBox.Text = loop;
}
public string Intro
{
get
{
return introTextBox.Text;
}
}
public string Loop
{
get
{
return loopTextBox.Text;
}
}
private void Swap(object sender, EventArgs e)
{
string intro = introTextBox.Text;
string loop = loopTextBox.Text;
introTextBox.Text = loop;
loopTextBox.Text = intro;
}
private void BrowseIntro(object sender, EventArgs e)
{
using (OpenFileDialog openAdx = new OpenFileDialog
{
Title = "Please select your ADX file.",
Filter = "ADX Files|*.adx",
DefaultExt = "adx",
})
{
if (openAdx.ShowDialog() == DialogResult.OK)
{
introTextBox.Text = openAdx.FileName;
}
}
}
private void BrowseLoop(object sender, EventArgs e)
{
using (OpenFileDialog openAdx = new OpenFileDialog
{
Title = "Please select your ADX file.",
Filter = "ADX Files|*.adx",
DefaultExt = "adx",
})
{
if (openAdx.ShowDialog() == DialogResult.OK)
{
loopTextBox.Text = openAdx.FileName;
}
}
}
private void OnClose(object sender, FormClosingEventArgs e)
{
if (DialogResult == DialogResult.OK)
{
if ((!string.IsNullOrEmpty(Intro) && !File.Exists(Intro)) || (!string.IsNullOrEmpty(Loop) && !File.Exists(Loop)))
{
MessageBox.Show("File(s) not found.", "CSB Builder", MessageBoxButtons.OK, MessageBoxIcon.Error);
e.Cancel = true;
}
if ((!string.IsNullOrEmpty(Intro) && !Intro.EndsWith(".adx")) || (!string.IsNullOrEmpty(Loop) && !Loop.EndsWith(".adx")))
{
MessageBox.Show("Please use an .ADX file.", "CSB Builder", MessageBoxButtons.OK, MessageBoxIcon.Warning);
e.Cancel = true;
}
}
}
}
}

View File

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

View File

@ -0,0 +1,115 @@
namespace CsbBuilder
{
partial class SetReferenceForm
{
/// <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.cancelButton = new System.Windows.Forms.Button();
this.okButton = new System.Windows.Forms.Button();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.nodeTree = new System.Windows.Forms.TreeView();
this.groupBox1.SuspendLayout();
this.SuspendLayout();
//
// cancelButton
//
this.cancelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.cancelButton.FlatStyle = System.Windows.Forms.FlatStyle.System;
this.cancelButton.Location = new System.Drawing.Point(389, 391);
this.cancelButton.Name = "cancelButton";
this.cancelButton.Size = new System.Drawing.Size(75, 23);
this.cancelButton.TabIndex = 8;
this.cancelButton.Text = "Cancel";
this.cancelButton.UseVisualStyleBackColor = true;
//
// okButton
//
this.okButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.okButton.DialogResult = System.Windows.Forms.DialogResult.OK;
this.okButton.FlatStyle = System.Windows.Forms.FlatStyle.System;
this.okButton.Location = new System.Drawing.Point(308, 391);
this.okButton.Name = "okButton";
this.okButton.Size = new System.Drawing.Size(75, 23);
this.okButton.TabIndex = 7;
this.okButton.Text = "OK";
this.okButton.UseVisualStyleBackColor = true;
//
// groupBox1
//
this.groupBox1.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.groupBox1.AutoSize = true;
this.groupBox1.Controls.Add(this.nodeTree);
this.groupBox1.Location = new System.Drawing.Point(12, 12);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(452, 373);
this.groupBox1.TabIndex = 9;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "Node Tree";
//
// nodeTree
//
this.nodeTree.Dock = System.Windows.Forms.DockStyle.Fill;
this.nodeTree.HideSelection = false;
this.nodeTree.Location = new System.Drawing.Point(3, 16);
this.nodeTree.Name = "nodeTree";
this.nodeTree.PathSeparator = "/";
this.nodeTree.Size = new System.Drawing.Size(446, 354);
this.nodeTree.TabIndex = 0;
this.nodeTree.NodeMouseDoubleClick += new System.Windows.Forms.TreeNodeMouseClickEventHandler(this.nodeTree_NodeMouseDoubleClick);
//
// SetReferenceForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(476, 426);
this.Controls.Add(this.groupBox1);
this.Controls.Add(this.cancelButton);
this.Controls.Add(this.okButton);
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "SetReferenceForm";
this.ShowIcon = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Please select the node you want to set as reference.";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.SetReferenceForm_FormClosing);
this.groupBox1.ResumeLayout(false);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Button cancelButton;
private System.Windows.Forms.Button okButton;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.TreeView nodeTree;
}
}

View File

@ -0,0 +1,96 @@
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.BuilderNode;
namespace CsbBuilder
{
public partial class SetReferenceForm : Form
{
public TreeNode SelectedNode
{
get
{
return nodeTree.SelectedNode;
}
}
public SetReferenceForm(TreeView treeView)
{
InitializeComponent();
nodeTree.ImageList = treeView.ImageList;
foreach (TreeNode treeNode in treeView.Nodes)
{
AddNode(treeNode, null);
}
nodeTree.ExpandAll();
}
private void AddNode(TreeNode treeNode, TreeNode parentNode)
{
bool cancel = false;
if (treeNode.Tag is BuilderSynthNode)
{
BuilderSynthNode synthNode = (BuilderSynthNode)treeNode.Tag;
if (treeNode.Parent != null && treeNode.Parent.Tag != null && synthNode.Type == 0)
{
cancel = true;
}
}
TreeNode newNode = null;
if (!cancel)
{
newNode = new TreeNode();
newNode.Name = treeNode.Name;
newNode.Text = treeNode.Text;
newNode.ImageIndex = treeNode.ImageIndex;
newNode.SelectedImageIndex = treeNode.SelectedImageIndex;
if (parentNode != null)
{
parentNode.Nodes.Add(newNode);
}
else
{
nodeTree.Nodes.Add(newNode);
}
}
foreach (TreeNode childNode in treeNode.Nodes)
{
AddNode(childNode, newNode);
}
}
private void SetReferenceForm_FormClosing(object sender, FormClosingEventArgs e)
{
if (DialogResult == DialogResult.OK)
{
if (SelectedNode != null && SelectedNode.ImageIndex == 3)
{
MessageBox.Show("You can't set a folder as a reference!", "CSB Builder", MessageBoxButtons.OK, MessageBoxIcon.Error);
e.Cancel = true;
}
}
}
private void nodeTree_NodeMouseDoubleClick(object sender, TreeNodeMouseClickEventArgs e)
{
Close();
DialogResult = DialogResult.OK;
}
}
}

View File

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

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="NAudio" version="1.8.0" targetFramework="net452" />
</packages>

View File

@ -10,7 +10,7 @@ using System.Runtime.InteropServices;
[assembly: AssemblyConfiguration("")] [assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")] [assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("CsbEditor")] [assembly: AssemblyProduct("CsbEditor")]
[assembly: AssemblyCopyright("Copyright © 2016")] [assembly: AssemblyCopyright("Copyright © blueskythlikesclouds 2014-2016")]
[assembly: AssemblyTrademark("")] [assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")] [assembly: AssemblyCulture("")]
@ -32,5 +32,4 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyVersion("0.2.*")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@ -20,47 +20,7 @@ namespace SonicAudioCmd
{ {
static void Main(string[] args) static void Main(string[] args)
{ {
if (args[0].EndsWith(".cpk")) // What are you looking at? There's nothing here. Go away.
{
CriCpkArchive archive = new CriCpkArchive();
archive.Load(args[0]);
//archive.Print();
foreach (CriCpkEntry entry in archive)
{
using (Stream source = File.OpenRead(args[0]), substream = entry.Open(source))
{
FileInfo fileInfo = new FileInfo(Path.Combine(Path.GetFileNameWithoutExtension(args[0]), entry.DirectoryName != null ? entry.DirectoryName : "", entry.Name != null ? entry.Name : entry.Id.ToString() + ".bin"));
fileInfo.Directory.Create();
using (Stream destination = fileInfo.Create())
{
substream.CopyTo(destination);
}
fileInfo.LastWriteTime = entry.UpdateDateTime;
}
}
}
else
{
CriCpkArchive archive = new CriCpkArchive();
archive.Align = 16;
archive.Mode = CriCpkMode.Id;
uint id = 0;
foreach (string file in Directory.GetFiles(args[0], "*", SearchOption.AllDirectories))
{
CriCpkEntry entry = new CriCpkEntry();
entry.Id = id;
entry.Name = Path.GetFileName(file);
entry.DirectoryName = Path.GetDirectoryName(file.Replace(args[0] + "\\", ""));
entry.FilePath = new FileInfo(file);
archive.Add(entry);
id++;
}
archive.Save(args[0] + ".cpk");
}
} }
} }
} }

View File

@ -33,4 +33,3 @@ using System.Runtime.InteropServices;
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@ -0,0 +1,72 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.IO.Compression;
using System.ComponentModel;
using System.Collections;
using System.Threading;
using SonicAudioLib;
using SonicAudioLib.Archive;
using SonicAudioLib.IO;
using SonicAudioLib.CriMw;
using System.Xml;
namespace SonicAudioCmd
{
class Program
{
static void Main(string[] args)
{
if (args[0].EndsWith(".cpk"))
{
CriCpkArchive archive = new CriCpkArchive();
archive.Load(args[0]);
//archive.Print();
foreach (CriCpkEntry entry in archive)
{
new Thread(new ThreadStart(delegate
{
using (Stream source = File.OpenRead(args[0]), substream = entry.Open(source))
{
Console.WriteLine("Extracting {0}{1}", entry.DirectoryName, entry.Name);
FileInfo fileInfo = new FileInfo(Path.Combine(Path.GetFileNameWithoutExtension(args[0]), entry.DirectoryName != null ? entry.DirectoryName : "", entry.Name != null ? entry.Name : entry.Id.ToString() + ".bin"));
fileInfo.Directory.Create();
using (Stream destination = fileInfo.Create())
{
substream.CopyTo(destination);
}
fileInfo.LastWriteTime = entry.UpdateDateTime;
}
})).Start();
}
}
else
{
CriCpkArchive archive = new CriCpkArchive();
archive.Align = 16;
archive.Mode = CriCpkMode.Id;
uint id = 0;
foreach (string file in Directory.GetFiles(args[0], "*", SearchOption.AllDirectories))
{
CriCpkEntry entry = new CriCpkEntry();
entry.Id = id;
entry.Name = Path.GetFileName(file);
entry.DirectoryName = Path.GetDirectoryName(file.Replace(args[0] + "\\", ""));
entry.FilePath = new FileInfo(file);
archive.Add(entry);
id++;
}
archive.Save(args[0] + ".cpk");
}
}
}
}

View File

@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Reflection;
using SonicAudioLib.IO; using SonicAudioLib.IO;
using SonicAudioLib.CriMw; using SonicAudioLib.CriMw;
@ -63,9 +64,9 @@ namespace SonicAudioLib.Archive
set set
{ {
if (value <= 0) if (align != 1)
{ {
value = 1; new NotImplementedException("Currently, alignment handling in .CPK files is broken. Always use 1.");
} }
align = value; align = value;
@ -93,12 +94,15 @@ namespace SonicAudioLib.Archive
{ {
reader.Read(); reader.Read();
#if DEBUG // The older CPK versions don't have the CpkMode field, and the other stuff. I will add
for (int i = 0; i < reader.NumberOfFields; i++) // support for the older versions when someone reports it. I need file examples.
ushort version = reader.GetUInt16("Version");
ushort revision = reader.GetUInt16("Revision");
if (version != 7 && revision != 2)
{ {
Console.WriteLine("{0} ({1}): {2}", reader.GetFieldName(i), reader.GetFieldFlag(i), reader.GetValue(i)); throw new Exception($"This CPK file version ({version}.{revision}) isn't supported yet! Please report the error with the file if you want support for this CPK version.");
} }
#endif
mode = (CriCpkMode)reader.GetUInt32("CpkMode"); mode = (CriCpkMode)reader.GetUInt32("CpkMode");
@ -129,11 +133,7 @@ namespace SonicAudioLib.Archive
entry.Position = (long)tocReader.GetUInt64("FileOffset"); entry.Position = (long)tocReader.GetUInt64("FileOffset");
entry.Id = tocReader.GetUInt32("ID"); entry.Id = tocReader.GetUInt32("ID");
entry.Comment = tocReader.GetString("UserString"); entry.Comment = tocReader.GetString("UserString");
entry.IsCompressed = entry.Length != tocReader.GetUInt32("ExtractSize");
if (entry.Length != tocReader.GetUInt32("ExtractSize"))
{
entry.IsCompressed = true;
}
if (contentPosition < tocPosition) if (contentPosition < tocPosition)
{ {
@ -181,11 +181,7 @@ namespace SonicAudioLib.Archive
CriCpkEntry entry = new CriCpkEntry(); CriCpkEntry entry = new CriCpkEntry();
entry.Id = dataReader.GetUInt16("ID"); entry.Id = dataReader.GetUInt16("ID");
entry.Length = dataReader.GetUInt16("FileSize"); entry.Length = dataReader.GetUInt16("FileSize");
entry.IsCompressed = entry.Length != dataReader.GetUInt16("ExtractSize");
if (entry.Length != dataReader.GetUInt16("ExtractSize"))
{
entry.IsCompressed = true;
}
entries.Add(entry); entries.Add(entry);
} }
@ -201,11 +197,7 @@ namespace SonicAudioLib.Archive
CriCpkEntry entry = new CriCpkEntry(); CriCpkEntry entry = new CriCpkEntry();
entry.Id = dataReader.GetUInt16("ID"); entry.Id = dataReader.GetUInt16("ID");
entry.Length = dataReader.GetUInt32("FileSize"); entry.Length = dataReader.GetUInt32("FileSize");
entry.IsCompressed = entry.Length != dataReader.GetUInt32("ExtractSize");
if (entry.Length != dataReader.GetUInt32("ExtractSize"))
{
entry.IsCompressed = true;
}
entries.Add(entry); entries.Add(entry);
} }
@ -325,6 +317,8 @@ namespace SonicAudioLib.Archive
tocMemoryStream = new MemoryStream(); tocMemoryStream = new MemoryStream();
etocMemoryStream = new MemoryStream(); etocMemoryStream = new MemoryStream();
var orderedEntries = entries.OrderBy(entry => entry.Name).ToList();
using (CriCpkSection tocSection = new CriCpkSection(tocMemoryStream, "TOC ")) using (CriCpkSection tocSection = new CriCpkSection(tocMemoryStream, "TOC "))
using (CriCpkSection etocSection = new CriCpkSection(etocMemoryStream, "ETOC")) using (CriCpkSection etocSection = new CriCpkSection(etocMemoryStream, "ETOC"))
{ {
@ -343,7 +337,7 @@ namespace SonicAudioLib.Archive
etocSection.Writer.WriteField("UpdateDateTime", typeof(ulong)); etocSection.Writer.WriteField("UpdateDateTime", typeof(ulong));
etocSection.Writer.WriteField("LocalDir", typeof(string)); etocSection.Writer.WriteField("LocalDir", typeof(string));
foreach (CriCpkEntry entry in entries) foreach (CriCpkEntry entry in orderedEntries)
{ {
tocSection.Writer.WriteRow(true, tocSection.Writer.WriteRow(true,
(entry.DirectoryName).Replace('\\', '/'), (entry.DirectoryName).Replace('\\', '/'),
@ -356,7 +350,7 @@ namespace SonicAudioLib.Archive
etocSection.Writer.WriteRow(true, etocSection.Writer.WriteRow(true,
CpkDateTimeFromDateTime(entry.UpdateDateTime), CpkDateTimeFromDateTime(entry.UpdateDateTime),
entry.DirectoryName); entry.FilePath.DirectoryName.Replace('\\', '/'));
vldPool.Put(entry.FilePath); vldPool.Put(entry.FilePath);
} }
@ -376,11 +370,11 @@ namespace SonicAudioLib.Archive
itocSection.Writer.WriteField("ID", typeof(int)); itocSection.Writer.WriteField("ID", typeof(int));
itocSection.Writer.WriteField("TocIndex", typeof(int)); itocSection.Writer.WriteField("TocIndex", typeof(int));
foreach (CriCpkEntry entry in entries) foreach (CriCpkEntry entry in orderedEntries)
{ {
itocSection.Writer.WriteRow(true, itocSection.Writer.WriteRow(true,
(int)entry.Id, (int)entry.Id,
entries.IndexOf(entry)); orderedEntries.IndexOf(entry));
} }
itocSection.Writer.WriteEndTable(); itocSection.Writer.WriteEndTable();
@ -508,7 +502,7 @@ namespace SonicAudioLib.Archive
cpkSection.Writer.WriteValue("Sorted", (ushort)1); cpkSection.Writer.WriteValue("Sorted", (ushort)1);
cpkSection.Writer.WriteValue("CpkMode", (uint)mode); cpkSection.Writer.WriteValue("CpkMode", (uint)mode);
cpkSection.Writer.WriteValue("Tvers", "SONICAUDIOLIB, DLL1.0.0.0"); cpkSection.Writer.WriteValue("Tvers", GetToolVersion());
cpkSection.Writer.WriteValue("Comment", Comment); cpkSection.Writer.WriteValue("Comment", Comment);
cpkSection.Writer.WriteValue("FileSize", (ulong)vldPool.Length); cpkSection.Writer.WriteValue("FileSize", (ulong)vldPool.Length);
@ -561,6 +555,12 @@ namespace SonicAudioLib.Archive
((((ulong)dateTime.Hour * 0x100 + (uint)dateTime.Minute) * 0x100 + (uint)dateTime.Second) * 0x100); ((((ulong)dateTime.Hour * 0x100 + (uint)dateTime.Minute) * 0x100 + (uint)dateTime.Second) * 0x100);
} }
private string GetToolVersion()
{
AssemblyName assemblyName = Assembly.GetEntryAssembly().GetName();
return $"{assemblyName.Name}, {assemblyName.Version.ToString()}";
}
private class CriCpkSection : IDisposable private class CriCpkSection : IDisposable
{ {
private Stream destination; private Stream destination;

View File

@ -196,6 +196,11 @@ namespace SonicAudioLib.CriMw
return fields.FindIndex(field => field.Name == fieldName); return fields.FindIndex(field => field.Name == fieldName);
} }
public bool ContainsField(string fieldName)
{
return fields.Exists(field => field.Name == fieldName);
}
private void GoToValue(int fieldIndex) private void GoToValue(int fieldIndex)
{ {
long position = headerPosition + header.RowsPosition + (header.RowLength * rowIndex); long position = headerPosition + header.RowsPosition + (header.RowLength * rowIndex);

View File

@ -163,7 +163,7 @@ namespace SonicAudioLib.CriMw.Serialization
if (defaultValue is bool) if (defaultValue is bool)
{ {
defaultValue = (bool)defaultValue == true ? 1 : 0; defaultValue = ((bool)defaultValue == true) ? (byte)1 : (byte)0;
} }
else if (defaultValue is Enum) else if (defaultValue is Enum)
@ -199,7 +199,7 @@ namespace SonicAudioLib.CriMw.Serialization
if (value is bool) if (value is bool)
{ {
value = (bool)value == true ? 1 : 0; value = ((bool)value == true) ? (byte)1 : (byte)0;
} }
else if (value is Enum) else if (value is Enum)
@ -236,6 +236,11 @@ namespace SonicAudioLib.CriMw.Serialization
public static ArrayList Deserialize(byte[] sourceByteArray, Type type) public static ArrayList Deserialize(byte[] sourceByteArray, Type type)
{ {
if (sourceByteArray == null || sourceByteArray.Length == 0)
{
return new ArrayList();
}
using (MemoryStream source = new MemoryStream(sourceByteArray)) using (MemoryStream source = new MemoryStream(sourceByteArray))
{ {
return Deserialize(source, type); return Deserialize(source, type);
@ -244,6 +249,11 @@ namespace SonicAudioLib.CriMw.Serialization
public static ArrayList Deserialize(string sourceFileName, Type type) public static ArrayList Deserialize(string sourceFileName, Type type)
{ {
if (!File.Exists(sourceFileName))
{
return new ArrayList();
}
using (Stream source = File.OpenRead(sourceFileName)) using (Stream source = File.OpenRead(sourceFileName))
{ {
return Deserialize(source, type); return Deserialize(source, type);
@ -256,49 +266,55 @@ namespace SonicAudioLib.CriMw.Serialization
using (CriTableReader tableReader = CriTableReader.Create(source, true)) using (CriTableReader tableReader = CriTableReader.Create(source, true))
{ {
PropertyInfo[] propertyInfos = type.GetProperties(); IEnumerable<PropertyInfo> propertyInfos = type.GetProperties().Where(property =>
{
if (property.GetCustomAttribute<CriIgnoreAttribute>() == null)
{
string fieldName = property.Name;
if (property.GetCustomAttribute<CriFieldAttribute>() != null)
{
fieldName = property.GetCustomAttribute<CriFieldAttribute>().FieldName;
}
return tableReader.ContainsField(fieldName);
}
return false;
});
while (tableReader.Read()) while (tableReader.Read())
{ {
object obj = Activator.CreateInstance(type); object obj = Activator.CreateInstance(type);
for (int i = 0; i < tableReader.NumberOfFields; i++) // I hope this is faster than the old method lol
{
string fieldName = tableReader.GetFieldName(i);
foreach (PropertyInfo propertyInfo in propertyInfos) foreach (PropertyInfo propertyInfo in propertyInfos)
{ {
string fieldNameMatch = propertyInfo.Name; string fieldName = propertyInfo.Name;
CriFieldAttribute fieldAttribute = propertyInfo.GetCustomAttribute<CriFieldAttribute>(); if (propertyInfo.GetCustomAttribute<CriFieldAttribute>() != null)
if (fieldAttribute != null && !string.IsNullOrEmpty(fieldAttribute.FieldName))
{ {
fieldNameMatch = fieldAttribute.FieldName; fieldName = propertyInfo.GetCustomAttribute<CriFieldAttribute>().FieldName;
} }
if (fieldName == fieldNameMatch) object value = tableReader.GetValue(fieldName);
{
object value = tableReader.GetValue(i); if (value is Substream)
if (propertyInfo.PropertyType == typeof(byte[]) && value is Substream)
{ {
value = ((Substream)value).ToArray(); value = ((Substream)value).ToArray();
} }
if (propertyInfo.PropertyType == typeof(bool)) else if (value is byte && propertyInfo.PropertyType == typeof(bool))
{ {
value = (byte)value != 0; value = (byte)value == 1;
} }
else if (propertyInfo.PropertyType.IsEnum) else if (propertyInfo.PropertyType.IsEnum)
{ {
value = Enum.ToObject(propertyInfo.PropertyType, value); value = Convert.ChangeType(value, Enum.GetUnderlyingType(propertyInfo.PropertyType));
} }
propertyInfo.SetValue(obj, value); propertyInfo.SetValue(obj, value);
break;
}
}
} }
arrayList.Add(obj); arrayList.Add(obj);

View File

@ -10,7 +10,7 @@ using System.Runtime.InteropServices;
[assembly: AssemblyConfiguration("")] [assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")] [assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("SonicAudioLib")] [assembly: AssemblyProduct("SonicAudioLib")]
[assembly: AssemblyCopyright("Copyright © blueskythlikesclouds 2014-2016")] [assembly: AssemblyCopyright("Copyright © blueskythlikesclouds 2014-2017")]
[assembly: AssemblyTrademark("")] [assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")] [assembly: AssemblyCulture("")]
@ -32,5 +32,4 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyVersion("0.1.*")]
[assembly: AssemblyFileVersion("1.0.0.0")]