private void fVoices_Load(object sender, EventArgs e) { this._ff7 = ConfigurationManager.AppSettings["FF7"]; this._hook = ConfigurationManager.AppSettings["HookDll"]; this._hook = this._hook.Replace("{APPPATH}", Application.CommonAppDataPath); using (Stream input = this._data.Open("index.xml")) this._index = Util.Deserialise <VoiceIndex>(input); this._index.Freeze(); string file = this._index.Lookup(0); if (file != null) { this._global = this.LoadVL(file); } using (Stream input = this._data.Open("ultrasound.xml")) this._ultrasound = Util.Deserialise <Voices.Ultrasound>(input); this._ultrasound.Freeze(); this._output = new ALOutput(this._data) { Log = new Action <string>(this.DoLog) }; new Thread(new ThreadStart(this.ThreadReader)) { Name = "BackgroundVoiceReader", IsBackground = true }.Start(); new Thread(new ThreadStart(this.SoundReader)) { Name = "BackgroundUltrasoundReader", IsBackground = true, Priority = ThreadPriority.AboveNormal }.Start(); Button bTest = this.bTest; Button bDump = this.bDump; string[] commandLineArgs = Environment.GetCommandLineArgs(); Func <string, bool> predicate = (Func <string, bool>)(s => s.Equals("/DUMP", StringComparison.InvariantCultureIgnoreCase)); int num1; bool flag = (num1 = ((IEnumerable <string>)commandLineArgs).Any <string>(predicate) ? 1 : 0) != 0; bDump.Visible = num1 != 0; int num2 = flag ? 1 : 0; bTest.Visible = num2 != 0; ComboBox cbLogging = this.cbLogging; int? nullable = (int?)Registry.GetValue("HKEY_CURRENT_USER\\Software\\Ficedula\\Ultrasound", "Logging", (object)0); int valueOrDefault = (nullable.HasValue ? new int?(nullable.GetValueOrDefault()) : new int?(0)).GetValueOrDefault(); cbLogging.SelectedIndex = valueOrDefault; }
public static void DumpAll(string inFolder, string outFolder) { VoiceIndex t = new VoiceIndex() { Entries = new List <IndexEntry>() }; using (FileStream fileStream1 = new FileStream(Path.Combine(inFolder, "maplist"), FileMode.Open)) { ushort num1 = Util.ReadUShortFrom((Stream)fileStream1, 0); byte[] numArray = new byte[32]; foreach (int num2 in Enumerable.Range(0, (int)num1)) { fileStream1.Position = (long)(2 + 32 * num2); fileStream1.Read(numArray, 0, 32); string str = Encoding.ASCII.GetString(numArray).Trim().TrimEnd(new char[1]); string path = Path.Combine(inFolder, str); if (File.Exists(path)) { using (FileStream fileStream2 = new FileStream(path, FileMode.Open)) { using (FileStream fileStream3 = new FileStream(Path.Combine(outFolder, str + ".xml"), FileMode.Create)) Util.Serialise <VoiceList>(Dumper.Dump((Stream)fileStream2, str), (Stream)fileStream3); } t.Entries.Add(new IndexEntry() { File = str + ".xml", FieldID = num2 }); } Debug.WriteLine("Processed " + str); } } using (FileStream fileStream = new FileStream(Path.Combine(outFolder, "index.xml"), FileMode.Create)) Util.Serialise <VoiceIndex>(t, (Stream)fileStream); }