public SoundControl(SoundBase sb, IPluginHost pluginHost) { InitializeComponent(); this.soundBase = sb; this.pluginHost = pluginHost; this.wav_file = pluginHost.Get_TempFolder() + Path.DirectorySeparatorChar + Path.GetRandomFileName(); soundBase.Save_WAV(wav_file, false); if (soundBase.CanLoop) { wav_loop_file = pluginHost.Get_TempFolder() + Path.DirectorySeparatorChar + Path.GetRandomFileName(); soundBase.Save_WAV(wav_loop_file, true); } checkLoop.Enabled = soundBase.CanLoop; btnImport.Enabled = soundBase.CanEdit; ReadLanguage(); Information(); }
void bw_DoWorkRead(object sender, DoWorkEventArgs e) { // Get params string file = ((string[])e.Argument)[0]; int id = Convert.ToInt32(((string[])e.Argument)[1]); BinaryReader br = new BinaryReader(File.OpenRead(file)); string header = new String(br.ReadChars(4)); br.Close(); // Process SoundBase sb = null; if (header == "sadl") sb = new SADL(pluginHost.Get_Language(), file, id); else if (file.ToUpper().EndsWith(".ADX")) sb = new ADX(file, id); sb.Initialize(); e.Result = sb; }
void bw_RunWorkerCompletedRead(object sender, RunWorkerCompletedEventArgs e) { sb = (SoundBase)e.Result; wait.Close(); wait.Dispose(); }