public static void Save(IResourceNode[] nodes, bool useSubDirs, ResourceDataType resourceDataType) { if (nodes == null) { return; } var files = GetFiles(GetResourceData(nodes, resourceDataType), useSubDirs).ToArray(); if (files.Length == 0) { return; } var data = new ProgressVM(MainWindow.Instance.Dispatcher, new ResourceSaver(files)); var win = new ProgressDlg(); win.DataContext = data; win.Owner = MainWindow.Instance; win.Title = files.Length == 1 ? "Save Resource" : "Save Resources"; var res = win.ShowDialog(); if (res != true) { return; } if (!data.WasError) { return; } MainWindow.Instance.ShowMessageBox(string.Format("An error occurred:\n\n{0}", data.ErrorMessage)); }
public override void ShowDialog(object sender, EventArgs e) { if (d3d == null) { d3d = new Direct3D(); var pm = new SlimDX.Direct3D9.PresentParameters(); pm.Windowed = true; device = new Device(d3d, 0, DeviceType.Reference, IntPtr.Zero, CreateFlags.FpuPreserve, pm); } string[] files; string path; if (ConvDlg.Show(Name, GetOpenFilter(), out files, out path) == DialogResult.OK) { ProgressDlg pd = new ProgressDlg(DevStringTable.Instance["GUI:Converting"]); pd.MinVal = 0; pd.Value = 0; pd.MaxVal = files.Length; pd.Show(); for (int i = 0; i < files.Length; i++) { string dest = Path.Combine(path, Path.GetFileNameWithoutExtension(files[i]) + ".x"); Convert(new DevFileLocation(files[i]), new DevFileLocation(dest)); pd.Value = i; } pd.Close(); pd.Dispose(); } }
public override void ShowDialog(object sender, EventArgs e) { FontDlg dlg = new FontDlg(FontFamily.Families); if (dlg.ShowDialog() == DialogResult.OK) { string path = dlg.DestPath; FontFamily[] fonts = dlg.SelectedFonts(); ProgressDlg pd = new ProgressDlg(DevStringTable.Instance["GUI:Converting"]); pd.MinVal = 0; pd.Value = 0; pd.MaxVal = fonts.Length; pd.Show(); for (int i = 0; i < fonts.Length; i++) { string dest = Path.Combine(path, Path.GetFileNameWithoutExtension(fonts[i].Name) + ".fnt"); currentFont = fonts[i]; Convert(null, new DevFileLocation(dest)); pd.Value = i; } pd.Close(); pd.Dispose(); } }
public override void ShowDialog(object sender, EventArgs e) { string[] files; string path; if (ConvDlg.Show("转换器", GetOpenFilter(), out files, out path) == DialogResult.OK) { ProgressDlg pd = new ProgressDlg(DevStringTable.Instance["GUI:Converting"]); pd.MinVal = 0; pd.Value = 0; pd.MaxVal = files.Length; pd.Show(); for (int i = 0; i < files.Length; i++) { string dest = Path.Combine(path, Path.GetFileNameWithoutExtension(files[i]) + ".tex"); Convert(new DevFileLocation(files[i]), new DevFileLocation(dest)); pd.Value = i; Application.DoEvents(); } pd.Close(); pd.Dispose(); } }
/// ------------------------------------------------------------------------------------ /// <summary> /// Handles creating new sessions from the selected files. /// </summary> /// ------------------------------------------------------------------------------------ private void HandleCreateSessionsButtonClick(object sender, EventArgs e) { Hide(); _mediaPlayerViewModel.Stop(true); var pairs = _viewModel.GetUniqueSourceAndDestinationPairs().ToArray(); if (pairs.Length == 0) { return; } var model = new CopyFilesViewModel(pairs); model.BeforeFileCopiedAction = _viewModel.CreateSingleSession; model.FileCopyFailedAction = (srcFile, dstFile) => { if (File.Exists(dstFile)) { File.Delete(dstFile); } }; var caption = LocalizationManager.GetString( "DialogBoxes.NewSessionsFromFilesDlg.CreatingSessions.ProgressDlg.Caption", "Creating Sessions"); using (var dlg = new ProgressDlg(model, caption)) { dlg.StartPosition = FormStartPosition.CenterScreen; dlg.ShowDialog(); } }
public override void ShowDialog(object sender, EventArgs e) { string[] files; string path; if (ConvDlg.Show("", GetOpenFilter(), out files, out path) == DialogResult.OK) { ProgressDlg pd = new ProgressDlg(DevStringTable.Instance["GUI:Converting"]); pd.MinVal = 0; pd.Value = 0; pd.MaxVal = files.Length; pd.Show(); string dest = Path.Combine(path, "color.ini"); ini = new IniConfiguration(); iniSect = new IniSection("Textures"); ini.Add(iniSect.Name, iniSect); for (int i = 0; i < files.Length; i++) { Convert(new DevFileLocation(files[i]), null); pd.Value = i; Application.DoEvents(); } pd.Close(); pd.Dispose(); ini.Save(dest); } }
void Save(ModuleVM[] files) { var list = new Tuple <DnModule, string> [files.Length]; if (files.Length == 1) { var vm = files[0]; var filename = new PickSaveFilename().GetFilename(GetModuleFilename(vm.Module), GetDefaultExtension(GetModuleFilename(vm.Module), vm.IsExe, vm.Module.CorModule.IsManifestModule), PickFilenameConstants.DotNetAssemblyOrModuleFilter); if (string.IsNullOrEmpty(filename)) { return; } list[0] = Tuple.Create(vm.Module, filename); } else { var dir = new PickDirectory().GetDirectory(null); if (!Directory.Exists(dir)) { return; } for (int i = 0; i < files.Length; i++) { var file = files[i]; var filename = DebugOutputUtils.GetFilename(file.Module.Name); var lf = filename.ToUpperInvariant(); if (lf.EndsWith(".EXE") || lf.EndsWith(".DLL") || lf.EndsWith(".NETMODULE")) { } else if (file.Module.CorModule.IsManifestModule) { filename += file.IsExe ? ".exe" : ".dll"; } else { filename += ".netmodule"; } list[i] = Tuple.Create(file.Module, Path.Combine(dir, filename)); } } var data = new ProgressVM(Dispatcher.CurrentDispatcher, new PEFilesSaver(list)); var win = new ProgressDlg(); win.DataContext = data; win.Owner = appWindow.MainWindow; win.Title = list.Length == 1 ? dnSpy_Debugger_Resources.ModuleSaveModuleTitle : dnSpy_Debugger_Resources.ModuleSaveModulesTitle; var res = win.ShowDialog(); if (res != true) { return; } if (!data.WasError) { return; } messageBoxManager.Show(string.Format(dnSpy_Debugger_Resources.ErrorOccurredX, data.ErrorMessage)); }
public override void ShowDialog(object sender, EventArgs e) { string[] files; string path; if (ConvDlg.Show("转换器", GetOpenFilter(), out files, out path) == DialogResult.OK) { ProgressDlg pd = new ProgressDlg(DevStringTable.Instance["GUI:Converting"]); pd.MinVal = 0; pd.Value = 0; pd.MaxVal = files.Length; pd.Show(); for (int i = 0; i < files.Length; i++) { componIndex = i; Convert(new DevFileLocation(files[i]), null); pd.Value = i; Application.DoEvents(); } pd.Close(); pd.Dispose(); string dest = Path.Combine(path, "index.png"); Bitmap bmp = new Bitmap(width, height, PixelFormat.Format32bppArgb); BitmapData data = bmp.LockBits(new Rectangle(0, 0, width, height), ImageLockMode.WriteOnly, PixelFormat.Format32bppArgb); uint *dst = (uint *)data.Scan0; for (int i = 0; i < height; i++) { for (int j = 0; j < width; j++) { result[i * width + j].Normalize(); uint val = 0; for (int k = 0; k < ConCount; k++) { val <<= 4; //if (result[i * width + j][k] > ConMax) //{ // throw new Exception(); //} val |= ((uint)result[i * width + j][k] & ConMax); } dst[i * width + j] = val; } } bmp.Save(dest, ImageFormat.Png); bmp.Dispose(); result = null; } }
public override void Setup() { base.Setup(); fDialog = new ProgressDlg(); fDialog.Show(); }
public override void ShowDialog(object sender, EventArgs e) { string[] files; string path; if (ConvDlg.Show("", GetOpenFilter(), out files, out path) == DialogResult.OK) { ProgressDlg pd = new ProgressDlg(DevStringTable.Instance["GUI:Converting"]); pd.MinVal = 0; pd.Value = 0; pd.MaxVal = files.Length; pd.Show(); for (int i = 0; i < files.Length; i++) { string dest = Path.Combine(path, Path.GetFileNameWithoutExtension(files[i]) + ".tdmp"); Convert(new DevFileLocation(files[i]), new DevFileLocation(dest)); pd.Value = i; Application.DoEvents(); } pd.Close(); pd.Dispose(); } }
public override void ShowDialog(object sender, EventArgs e) { string[] files; string path; if (ConvDlg.Show("转换器", GetOpenFilter(), out files, out path) == DialogResult.OK) { ProgressDlg pd = new ProgressDlg(DevStringTable.Instance["GUI:Converting"]); pd.MinVal = 0; pd.Value = 0; pd.MaxVal = files.Length; pd.Show(); for (int i = 0; i < files.Length; i++) { componIndex = i; Convert(new DevFileLocation(files[i]), null); pd.Value = i; Application.DoEvents(); } pd.Close(); pd.Dispose(); string dest = Path.Combine(path, "index.png"); Bitmap bmp = new Bitmap(width, height, PixelFormat.Format32bppArgb); BitmapData data = bmp.LockBits(new Rectangle(0, 0, width, height), ImageLockMode.WriteOnly, PixelFormat.Format32bppArgb); uint* dst = (uint*)data.Scan0; for (int i = 0; i < height; i++) { for (int j = 0; j < width; j++) { result[i * width + j].Normalize(); uint val = 0; for (int k = 0; k < ConCount; k++) { val <<= 4; //if (result[i * width + j][k] > ConMax) //{ // throw new Exception(); //} val |= ((uint)result[i * width + j][k] & ConMax); } dst[i * width + j] = val; } } bmp.Save(dest, ImageFormat.Png); bmp.Dispose(); result = null; } }
public bool CalculateSpecSpec() { if (_spec != null) { _specspec = ProgressDlg.CalculateSpecSpec(_spec); specspecFinish?.Invoke(); return(true); } return(false); }
public bool CalculateCepstrum() { if (_spec != null) { _cepstrum = ProgressDlg.CalculateCepstrum(_spec); cepstrumFinish?.Invoke(); return(true); } return(false); }
/// <summary> /// Occurs when OK button is clicked. /// </summary> /// <param name="sender">sender</param> /// <param name="e">EventArgs</param> private void BtnOK_Click(object sender, EventArgs e) { string errorMessage = string.Empty; errorMessage = _panel.UpdateParameter(); errorMessage += ValidateParameters(); if (errorMessage != string.Empty) { MessageBox.Show(errorMessage, "Invalid Parameter", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } //if thread is already exists, abort it. if (_threadCal != null) { _threadCal.Abort(); _threadCal = null; } //Save parameters. _resamplingParam.WriteParameterIni(); _baselineParam.WriteParameterIni(); //Prepare to calculate. //Create thread for dialog. _threadCal = new System.Threading.Thread(ThreadCalc); _threadCal.Priority = System.Threading.ThreadPriority.Lowest; //Create dialog. if (_dlgProgress == null) { _dlgProgress = new ProgressDlg(); _dlgProgress.CancelEnabled = true; _dlgProgress.PrgCancel += DlgProgress_PrgCancel; _calculate.UpdateProgress += UpdateRemoveCalcProgress; _calculate.UpdateResamplingProgressTemp += UpdateSpecCalcResamplingProgress; } //Start calculate. _threadCal.Start(); _dlgProgress.ShowDialog(); _calculate.UpdateResamplingProgressTemp -= UpdateSpecCalcResamplingProgress; _dlgProgress = null; if (_calculate.Result != null) { _calculate.SubmitResultToTree(); } }
public IDsDocument[] Load(IEnumerable<DocumentToLoad> documents) { documentsToLoad = documents.ToArray(); ProgressMaximum = documentsToLoad.Length; const int MAX_NUM_DOCUMENTS_NO_DLG_BOX = 10; if (documentsToLoad.Length <= MAX_NUM_DOCUMENTS_NO_DLG_BOX) { foreach (var f in documentsToLoad) Load(f); } else ProgressDlg.Show(this, "dnSpy", ownerWindow); return loadedDocuments.ToArray(); }
internal static void Execute2(DnHexBox dnHexBox, Window ownerWindow) { Debug.Assert(ownerWindow != null); var doc = dnHexBox.Document; if (doc == null) { return; } var sel = dnHexBox.Selection; if (sel == null) { return; } var dialog = new WF.SaveFileDialog() { Filter = PickFilenameConstants.AnyFilenameFilter, RestoreDirectory = true, ValidateNames = true, }; if (dialog.ShowDialog() != WF.DialogResult.OK) { return; } var data = new ProgressVM(Dispatcher.CurrentDispatcher, new HexDocumentDataSaver(doc, sel.Value.StartOffset, sel.Value.EndOffset, dialog.FileName)); var win = new ProgressDlg(); win.DataContext = data; win.Owner = ownerWindow ?? Application.Current.MainWindow; win.Title = string.Format(dnSpy_Shared_Resources.HexEditorSaveSelection_Title, sel.Value.StartOffset, sel.Value.EndOffset); var res = win.ShowDialog(); if (res != true) { return; } if (!data.WasError) { return; } App.MsgBox.Instance.Show(string.Format(dnSpy_Shared_Resources.AnErrorOccurred, data.ErrorMessage)); }
/// ------------------------------------------------------------------------------------ public static void Save(string outputFilePath, string title, TierCollection tierCollection, string wsTranscriptionId, string wsFreeTranslationId, string mediaFilePath, string sourceFilePath) { var helper = new FLExTextExporter(outputFilePath, title, tierCollection, wsTranscriptionId, wsFreeTranslationId, mediaFilePath, sourceFilePath); var caption = LocalizationManager.GetString( "SessionsView.Transcription.TextAnnotationEditor.ExportingToFLExInterlinear.ProgressDlg.Caption", "Exporting to FLEx Interlinear"); using (var dlg = new ProgressDlg(helper, caption)) { dlg.StartPosition = FormStartPosition.CenterScreen; dlg.ShowDialog(); } }
internal static void Execute2(DnHexBox dnHexBox) { var doc = dnHexBox.Document; if (doc == null) { return; } var sel = dnHexBox.Selection; if (sel == null) { return; } var dialog = new WF.SaveFileDialog() { Filter = PickFilenameConstants.AnyFilenameFilter, RestoreDirectory = true, ValidateNames = true, }; if (dialog.ShowDialog() != WF.DialogResult.OK) { return; } var data = new ProgressVM(MainWindow.Instance.Dispatcher, new HexDocumentDataSaver(doc, sel.Value.StartOffset, sel.Value.EndOffset, dialog.FileName)); var win = new ProgressDlg(); win.DataContext = data; win.Owner = MainWindow.Instance; win.Title = string.Format("Save Selection 0x{0:X}-0x{1:X}", sel.Value.StartOffset, sel.Value.EndOffset); var res = win.ShowDialog(); if (res != true) { return; } if (!data.WasError) { return; } MainWindow.Instance.ShowMessageBox(string.Format("An error occurred:\n\n{0}", data.ErrorMessage)); }
public IDsDocument[] Load(IEnumerable <DocumentToLoad> documents) { documentsToLoad = documents.ToArray(); ProgressMaximum = documentsToLoad.Length; const int MAX_NUM_DOCUMENTS_NO_DLG_BOX = 10; if (documentsToLoad.Length <= MAX_NUM_DOCUMENTS_NO_DLG_BOX) { foreach (var f in documentsToLoad) { Load(f); } } else { ProgressDlg.Show(this, MainApp.Constants.DnSpy, ownerWindow); } return(loadedDocuments.ToArray()); }
public IDnSpyFile[] Load(IEnumerable <FileToLoad> files) { filesToLoad = files.ToArray(); ProgressMaximum = filesToLoad.Length; const int MAX_NUM_FILES_NO_DLG_BOX = 10; if (filesToLoad.Length <= MAX_NUM_FILES_NO_DLG_BOX) { foreach (var f in filesToLoad) { Load(f); } } else { ProgressDlg.Show(this, "dnSpy", ownerWindow); } return(loadedFiles.ToArray()); }
public override void SaveSelection() { if (HexView.Selection.IsEmpty) { return; } var dialog = new WF.SaveFileDialog() { Filter = PickFilenameConstants.AnyFilenameFilter, RestoreDirectory = true, ValidateNames = true, }; if (dialog.ShowDialog() != WF.DialogResult.OK) { return; } var selectionSpan = HexView.Selection.StreamSelectionSpan; var data = new ProgressVM(CurrentDispatcher, new HexBufferDataSaver(HexView.Buffer, selectionSpan, dialog.FileName)); var win = new ProgressDlg(); win.DataContext = data; win.Owner = OwnerWindow; var info = SelectionToUserValue(selectionSpan.Start, selectionSpan.End); win.Title = string.Format(dnSpy_Resources.HexEditorSaveSelection_Title, info.Anchor.ToUInt64(), info.Active.ToUInt64()); var res = win.ShowDialog(); if (res != true) { return; } if (!data.WasError) { return; } messageBoxService.Show(string.Format(dnSpy_Resources.AnErrorOccurred, data.ErrorMessage)); }
/// <summary> /// Saves the nodes /// </summary> /// <param name="nodes">Nodes</param> /// <param name="useSubDirs">true to create sub directories, false to dump everything in the same folder</param> /// <param name="resourceDataType">Type of data to save</param> /// <param name="ownerWindow">Owner window</param> public static void Save(IResourceDataProvider[] nodes, bool useSubDirs, ResourceDataType resourceDataType, Window ownerWindow = null) { if (nodes == null) { return; } Tuple <ResourceData, string>[] files; try { files = GetFiles(GetResourceData(nodes, resourceDataType), useSubDirs).ToArray(); } catch (Exception ex) { MsgBox.Instance.Show(ex); return; } if (files.Length == 0) { return; } var data = new ProgressVM(Dispatcher.CurrentDispatcher, new ResourceSaver(files)); var win = new ProgressDlg(); win.DataContext = data; win.Owner = ownerWindow ?? Application.Current.MainWindow; win.Title = files.Length == 1 ? dnSpy_Contracts_DnSpy_Resources.SaveResource : dnSpy_Contracts_DnSpy_Resources.SaveResources; var res = win.ShowDialog(); if (res != true) { return; } if (!data.WasError) { return; } MsgBox.Instance.Show(string.Format(dnSpy_Contracts_DnSpy_Resources.AnErrorOccurred, data.ErrorMessage)); }