public void OpenFile(string path) { if (File.Exists(path)) { MultiFile.OpenFile(path); } }
private void OpenFile() { OpenFileDialog OFD = new OpenFileDialog(); if (OFD.ShowDialog() == true) { MultiFile.OpenFile(OFD.FileName); } }
public static bool UploadFile(Page page, MultiFile uploadControl, string relative, out List <string> uploadedFiles) { bool result = true; uploadedFiles = new List <string>(); if (relative.StartsWith("/")) { relative = relative.Substring(1); } if (!relative.EndsWith("/")) { relative += "/"; } string absolute = page.Server.MapPath("~/") + relative; Random random = new Random(); foreach (UploadedFile file in uploadControl.Files) { string extension = System.IO.Path.GetExtension(file.FileName).ToUpper(); string nFilename = EZGoal.Common.GenerateFilenameByGUID(extension); if (!System.IO.Directory.Exists(absolute)) { System.IO.Directory.CreateDirectory(absolute); } if (file.ContentLength > 0) { try { file.SaveAs(absolute + nFilename); } catch { result = false; } } uploadedFiles.Add(relative + nFilename); } return(result); }
private void Window_Closing(object arg) { if (MultiFile.CloseFile()) { if (visualizer != null) { visualizer.Close(); } if (setchar != null) { setchar.Close(); } ApplicationSettings.AppSetting.Default.Save(); ApplicationSettings.BackgroundDefault.Default.Save(); ApplicationSettings.SPREditor.Default.Save(); ApplicationSettings.WindowSetting.Default.Save(); } else { (arg as CancelEventArgs).Cancel = true; } }
private void Window_Closing(object sender, CancelEventArgs e) { if (MultiFile.CloseFile()) { if (visualizer != null) { visualizer.Close(); } if (setchar != null) { setchar.Close(); } Settings.AppSetting.Default.Save(); Settings.BackgroundDefault.Default.Save(); Settings.SPREditor.Default.Save(); Settings.WindowSetting.Default.Save(); } else { e.Cancel = true; } }
private void SaveAsFile() { if (MultiFile.OpenFileName != "") { SaveFileDialog SFD = new SaveFileDialog(); SFD.OverwritePrompt = true; string dirpath = Path.GetDirectoryName(MultiFile.OpenFileName); string filename = Path.GetFileName(MultiFile.OpenFileName); if (Directory.Exists(dirpath)) { SFD.InitialDirectory = dirpath; } SFD.FileName = filename; string ext = Path.GetExtension(MultiFile.OpenFileName).Remove(0, 1); SFD.Filter = ext.ToUpper() + "|*." + ext; if (SFD.ShowDialog() == true) { MultiFile.SaveFile(SFD.FileName); } } }
public virtual void Open(string filePath, int pagePoolSize) { lock (this) { #if OMIT_MULTIFILE IFile file = new OSFile(filePath, readOnly, noFlush); #else IFile file; if (filePath.StartsWith("@")) file = new MultiFile(filePath.Substring(1), readOnly, noFlush); else file = new OSFile(filePath, readOnly, noFlush); #endif try { Open(file, pagePoolSize); } catch (StorageError ex) { file.Close(); throw ex; } } }