public async void GenerateCLFile() { string fn = ""; var sfd = new SaveFileDialog() { DefaultExt = "exe", AddExtension = true, Title = "Save Packed File", Filter = "Executable Files (.exe)|*.*", }; if (sfd.ShowDialog() == DialogResult.OK) { fn = sfd.FileName; } if (encFiles.Count == 0) { MessageBox.Show("Please select an input file."); return; } if (mainExecutable == "") { mainExecutable = encFiles[0]; } await Task.Run(() => { SetStatus("NetBitz v1.0.4"); SetStatus("Generating application..."); var f = new AssemblyFactory(); encFiles.Remove(mainExecutable); MemoryStream ms = f.CreateSFXModuleEx(encFiles, mainExecutable); SetStatus("Generation completed."); using (var fs = File.Create(sfd.FileName)) { ms.WriteTo(fs); } }); }