private void копироватьToolStripMenuItem_Click(object sender, EventArgs e) { int index = listView1.SelectedIndices[0]; SelectFile = listView1.Items[index].Text; SelectFile = SelectFile.Substring(0, SelectFile.LastIndexOf('.')); RootDirRecord tempR = Emulator.FindRec(SelectFile); Inode tempI = Emulator.FindInode(tempR.Number_Inode_Property); if (Emulator.CheckID(Emulator.CurrentUser, tempI) == true) { SavedRecord = Emulator.FindRec(SelectFile); SavedInode = Emulator.FindInode(SavedRecord.Number_Inode_Property); textdata = Emulator.ReadData(SelectFile); numofcopy = 1; вставитьToolStripMenuItem.Enabled = true; } else { MessageBox.Show("У вас недостаточно прав!"); } }
public void SaveSelectionsToFile() { var(success, file) = SelectFile.AskForSaveLocation(); if (success) { try { var option = new JsonSerializerOptions { WriteIndented = true }; var selectedPackages = model.Packages.AllSelected().Select(x => new PackagesSaveDetail(x)).ToList(); var selectedFiles = model.ThirdParty.AllSelected().Select(x => x.Location).ToList(); var records = new SelectionRecords() { Packages = selectedPackages, ThirdPartyFilenames = selectedFiles }; File.WriteAllText(file, JsonSerializer.Serialize(records, option)); } catch (IOException error) { InfoBox.Write($"Unable to write to {file}. Error: {error.Message}", InfoBox.Level.Error); } } }
private void свойстваToolStripMenuItem_Click(object sender, EventArgs e) { int index = listView1.SelectedIndices[0]; SelectFile = listView1.Items[index].Text; SelectFile = SelectFile.Substring(0, SelectFile.LastIndexOf('.')); RootDirRecord tempR = Emulator.FindRec(SelectFile); Inode tempI = Emulator.FindInode(tempR.Number_Inode_Property); if (Emulator.CheckID(Emulator.CurrentUser, tempI) == true) { Change = true; } else { Change = false; } Prop P = new Prop(); P.Owner = this; P.ShowDialog(); удалитьToolStripMenuItem.Enabled = false; копироватьToolStripMenuItem.Enabled = false; свойстваToolStripMenuItem.Enabled = false; RefreshTreeList(); }
private void Export_Click(object sender, EventArgs e) { SelectFile.Filter = "Json files (*.json)|*.json|Text files (*.txt)|*.txt"; if (SelectFile.ShowDialog() == DialogResult.OK) { service.localItems.ExportAsJSON(SelectFile.FileName, (List <MediaItemDTO>)ItemsTable.DataSource); } }
public void UploadFileApplication() { Pages.Patient_Page.NewPatientApplication(); Thread.Sleep(1500); Pages.Patient_Page.EnterPatientDocument(); UploadFileBtn.ClickOn(); SelectFile.SendKeys(Constant.fileForTest); UploadWindowSave.ClickOn(); }
void Awake() { if (null == _instance) _instance = this; else if (_instance != this) Destroy(gameObject); Init(); }
private void listView1_MouseDoubleClick(object sender, MouseEventArgs e) { if (listView1.SelectedItems[0].ImageIndex == 0) { int index = listView1.SelectedIndices[0]; SelectFile = listView1.Items[index].Text; RootDirRecord tempR = Emulator.FindRec(SelectFile); Inode tempI = Emulator.FindInode(tempR.Number_Inode_Property); if (Emulator.CheckID(Emulator.CurrentUser, tempI) == true) { foreach (TreeNode node in treeView1.Nodes) { if (node.Text == listView1.SelectedItems[0].Text) { treeView1.SelectedNode = node; treeView1.Select(); break; } foreach (TreeNode innode in node.Nodes) { if (innode.Text == listView1.SelectedItems[0].Text) { treeView1.SelectedNode = innode; treeView1.Select(); break; } } } } else { MessageBox.Show("У вас недостаточно прав!"); } } else { int index = listView1.SelectedIndices[0]; SelectFile = listView1.Items[index].Text; SelectFile = SelectFile.Substring(0, SelectFile.LastIndexOf('.')); RootDirRecord tempR = Emulator.FindRec(SelectFile); Inode tempI = Emulator.FindInode(tempR.Number_Inode_Property); if (Emulator.CheckReadAccess(Emulator.CurrentUser, tempI) == true) { EditFile EF = new EditFile(); EF.Owner = this; EF.ShowDialog(); //удалитьToolStripMenuItem.Enabled = false; //копироватьToolStripMenuItem.Enabled = false; //свойстваToolStripMenuItem.Enabled = false; } else { MessageBox.Show("У вас недостаточно прав!"); } } }
void Awake() { if (null == _instance) { _instance = this; } else if (_instance != this) { Destroy(gameObject); } Init(); }
public void UploadFileApplication() { var patientDataID = Browser.Driver.FindElement(By.ClassName("mainTabPrefix")).GetAttribute("data-entity-id"); var countBefore = utility.TableCount("//*[@id='tab11_gridCustomerDocuments_" + patientDataID + "']/div[2]/div[1]/table/tbody"); UplaodFileBtn.ClickOn(); SelectFile.ClickOn(); String script = "document.getElementById('SelectFile').value='" + "C:\\\\temp\\\\file.txt" + "';"; ((IJavaScriptExecutor)Browser.Driver).ExecuteScript(script); UploadWindowSave.ClickOn(); var countAfter = utility.TableCount("//*[@id='tab11_gridCustomerDocuments_" + patientDataID + "']/div[2]/div[1]/table/tbody"); Assert.AreNotEqual(countBefore, countAfter); }
private void ifilt(bool asEMBED) { _selected_file = string.Empty; if (openFileDialog.ShowDialog() == DialogResult.OK) { try { if (asEMBED) { _selected_file = this.openFileDialog.FileName; webBrowser.Navigate(_selected_file); } else { try { TextReader reader = new FilterReader(openFileDialog.FileName); using (reader) { string tmp_file = Path.Combine(Environment.GetEnvironmentVariable("TEMP"), DateTime.Now.Ticks.ToString() + ".html"); using (StreamWriter sw = new StreamWriter(tmp_file, false, DefaultEncoding)) { sw.Write(Regex.Replace(reader.ReadToEnd().Replace(Environment.NewLine, "<br>"), "\n", "<BR>" + Environment.NewLine, RegexOptions.Singleline)); sw.Close(); } ////object missing = System.Reflection.Missing.Value; ////object tmp = (object)tmp_file; _selected_file = tmp_file; webBrowser.Navigate(tmp_file); ////this.axWebBrowser1.Navigate2(ref tmp, ref missing, ref missing, ref missing, ref missing); } } catch (ArgumentException) { MessageBox.Show("Данный тип файлов не поддерживается"); } } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error"); return; } } SelectFile.Invoke(_selected_file); ////EditModeOn(); }
public DataContextSpisok() { SelectFileControl = new SelectFile(); SelectListControl = new SelectList(); ShemeDocument = new ShemeMethod(TestUserControl); XmlFile = new ListViewModelXmlFileGenerateMethod(ConfigFile.FileSpisok); TextBoxFileModel = new TextBoxModelMethod(); ModelSnuOne = new ModelSnuOneFormNameListMethod(); CheckBoxModel = new CheckBoxModel(); CommandFormirovanie command = new CommandFormirovanie(); Transfer = new DelegateCommand(() => { XmlFile.MoveFile(ConfigFile.PathInn); }); SelectFile = new DelegateCommand(delegate { command.SelectFileSlsx(TextBoxFileModel, ModelSnuOne); }); FormirovanieXml = new DelegateCommand((delegate { command.FormirovanieXml(ModelSnuOne, TextBoxFileModel, ShemeDocument, CheckBoxModel, ConfigFile.FileSpisok, XmlFile); })); }
public void LoadSelectionsFromFile() { var(success, file) = SelectFile.AskForOpenLocation(); if (success) { try { InfoBox.Write($"Reading selections from {file}", InfoBox.Level.Status); var option = new JsonSerializerOptions { WriteIndented = true }; using var jsonFile = File.OpenText(file); var records = JsonSerializer.Deserialize <SelectionRecords>(jsonFile.ReadToEnd(), option); model.Packages.SelectPackages(records.Packages.Select(x => x.Name).ToList()); model.ThirdParty.SelectFiles(records.ThirdPartyFilenames); foreach (var name in records.Packages) { InfoBox.Write($"{name}", InfoBox.Level.Info); } foreach (var name in records.ThirdPartyFilenames) { InfoBox.Write($"{name}", InfoBox.Level.Info); } } catch (JsonException) { InfoBox.Write($"Unable load from {file}.", InfoBox.Level.Warning); } catch (FileNotFoundException) { } catch (IOException error) { InfoBox.Write($"Unable to read {file}. Error: {error.Message}", InfoBox.Level.Error); } } }
private void btnSelect_Click(object sender, EventArgs e) { i = 0; lblFilePath.Text = ""; SelectFile.FilterIndex = 1; SelectFile.RestoreDirectory = true; SelectFile.Title = "Sélectionnez un fichier"; if (SelectFile.ShowDialog() == DialogResult.OK) { try { fileDir = System.IO.Path.GetDirectoryName(SelectFile.FileName) + "\\"; fileName = System.IO.Path.GetFileNameWithoutExtension(SelectFile.FileName); fileExt = System.IO.Path.GetExtension(SelectFile.FileName); filePath = fileDir + fileName + fileExt; ActualLabel(); btnCopy.Enabled = btnCut.Enabled = btnRename.Enabled = btnDuplicate.Enabled = btnDelete.Enabled = tbxRename.Enabled = true; } catch (Exception ex) { MessageBox.Show("Error: " + ex.Message); } } }
private void удалитьToolStripMenuItem_Click(object sender, EventArgs e) { int index = listView1.SelectedIndices[0]; SelectFile = listView1.Items[index].Text; SelectFile = SelectFile.Substring(0, SelectFile.LastIndexOf('.')); RootDirRecord tempR = Emulator.FindRec(SelectFile); Inode tempI = Emulator.FindInode(tempR.Number_Inode_Property); if (Emulator.CheckID(Emulator.CurrentUser, tempI) == true) { int[] MainPosandNum = Emulator.FindBind(Emulator.CurrentPosition, SelectFile); int Seek = Emulator.FindRecSeek(SelectFile); UserInfo tempU = Emulator.FindUser(tempI.User_ID_Property); Emulator.DeleteRIB(MainPosandNum[0], Seek, tempU, MainPosandNum[1], false); RefreshTreeList(); } else { MessageBox.Show("У вас недостаточно прав!"); } удалитьToolStripMenuItem.Enabled = false; копироватьToolStripMenuItem.Enabled = false; свойстваToolStripMenuItem.Enabled = false; RefreshTreeList(); //this.Show(); //Activate(); //this.Activate(); //this.OnActivated(); //this.Activated; //this.Refresh(); }
public static string OpenFile(ThumbItem item) { string results = String.Empty; if (item != null) { string strPath = String.Empty; bool bLaunched = false; IServices service = Util.GetService(item.EType); IMyCollectionsData currentItem = service.Get(item.Id); if (currentItem != null) { switch (item.EType) { case EntityType.Music: string fullpath = Path.Combine(currentItem.FilePath, currentItem.FileName); strPath = fullpath; if (Directory.Exists(fullpath)) { string[] strFiles = Util.GetFiles(fullpath, new List <string> { "*.mp3", "*.flc" }); if (strFiles.Any()) { string filePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "play.m3u"); //FIX 2.8.9.0 using (StreamWriter file = new StreamWriter(filePath, false, Encoding.Default)) { foreach (string music in strFiles) { file.WriteLine(music); } file.Close(); } Process.Start(filePath); bLaunched = true; } else { results = "Can't find any mp3 or flc"; } } else if (File.Exists(fullpath)) { Process.Start(fullpath); bLaunched = true; } else { results = "Can't find any mp3 or flc"; } break; case EntityType.Apps: case EntityType.Books: case EntityType.Games: case EntityType.Nds: if (String.IsNullOrWhiteSpace(currentItem.FilePath) == false || String.IsNullOrWhiteSpace(currentItem.FileName) == false) { if (String.IsNullOrWhiteSpace(currentItem.FilePath) == false && String.IsNullOrWhiteSpace(currentItem.FileName) == false) { strPath = Path.Combine(currentItem.FilePath, currentItem.FileName); } if (String.IsNullOrWhiteSpace(currentItem.FilePath) == true && String.IsNullOrWhiteSpace(currentItem.FileName) == false) { strPath = currentItem.FileName; } if (String.IsNullOrWhiteSpace(currentItem.FilePath) == false && String.IsNullOrWhiteSpace(currentItem.FileName) == true) { strPath = currentItem.FilePath; } if (Directory.Exists(strPath) == true || File.Exists(strPath) == true) { Process.Start(strPath); bLaunched = true; } } break; case EntityType.Movie: case EntityType.XXX: if (String.IsNullOrWhiteSpace(currentItem.FilePath) == false || String.IsNullOrWhiteSpace(currentItem.FileName) == false) { if (String.IsNullOrWhiteSpace(currentItem.FilePath) == false && String.IsNullOrWhiteSpace(currentItem.FileName) == false) { strPath = Path.Combine(currentItem.FilePath, currentItem.FileName); } if (String.IsNullOrWhiteSpace(currentItem.FilePath) == true && String.IsNullOrWhiteSpace(currentItem.FileName) == false) { strPath = currentItem.FileName; } if (String.IsNullOrWhiteSpace(currentItem.FilePath) == false && String.IsNullOrWhiteSpace(currentItem.FileName) == true) { strPath = currentItem.FilePath; } if (Directory.Exists(strPath) == true && File.Exists(strPath) == false) { string[] strFiles = Util.GetFiles(strPath, new List <string> { "*.avi", "*.mkv", "*.mov", "*.divx" }); if (strFiles.Any()) { strPath = Path.Combine(strPath, strFiles[0]); } } if (Directory.Exists(strPath) == true || File.Exists(strPath) == true) { Process.Start(strPath); bLaunched = true; } } break; case EntityType.Series: if (Directory.Exists(currentItem.FilePath)) { string[] strFiles = Util.GetFiles(currentItem.FilePath, new List <string> { "*.avi", "*.mkv", "*.mov", "*.divx" }); if (strFiles.Any()) { SelectFile objWindow = new SelectFile(strFiles); objWindow.ShowDialog(); if (String.IsNullOrEmpty(objWindow.SelectedValue) == false) { Process.Start(objWindow.SelectedValue); } bLaunched = true; } else { results = "Can't find any avi or mkv"; } } else { results = "Can't file path : " + currentItem.FilePath; } break; } } if (bLaunched == false && String.IsNullOrWhiteSpace(results)) { results = "Can't find path : " + strPath; } } return(results); }
private void ExtractFromZip_button(object sender, RoutedEventArgs e) { var browseZipWindow = new SelectFile(); browseZipWindow.Show(); }