private void GoToPicPreviewKeys(object sender, KeyEventArgs e) { switch (e.Key) { case Key.D0: case Key.D1: case Key.D2: case Key.D3: case Key.D4: case Key.D5: case Key.D6: case Key.D7: case Key.D8: case Key.D9: case Key.NumPad0: case Key.NumPad1: case Key.NumPad2: case Key.NumPad3: case Key.NumPad4: case Key.NumPad5: case Key.NumPad6: case Key.NumPad7: case Key.NumPad8: case Key.NumPad9: case Key.Back: case Key.Delete: case Key.Left: case Key.Right: break; // Allow these keys case Key.A: case Key.C: case Key.X: if ((Keyboard.Modifiers & ModifierKeys.Control) == ModifierKeys.Control) { // Allow Ctrl + A, Ctrl + C, Ctrl + X break; } else { e.Handled = true; // only allowed on ctrl return; } case Key.Escape: // Escape logic GoToPicBox.Text = FolderIndex.ToString(CultureInfo.CurrentCulture); ClearGoTo(); e.Handled = true; break; case Key.Enter: // Execute it! GoToPicEvent(sender, e); ClearGoTo(); break; default: e.Handled = true; // Don't allow other keys break; } }
public Option <FolderPath> EndPathMonitor(CorrelationToken MonitorToken) { if (FolderIndex.TryRemove(MonitorToken, out FolderTree tree)) { FileIndex.TryRemove(MonitorToken, out Dictionary <FilePath, FileDescription> content); Listeners.TryRemove(MonitorToken, out Action <FileChangeDescription> listener); return(tree.Root); } return(none <FolderPath>()); }
public void CreateArchive(string filename) { BinaryWriter bw = new BinaryWriter(new FileStream(filename, FileMode.Create)); FileHeader tempHead = new FileHeader(); tempHead.Write(bw); FileIndex tempFileIndex = new FileIndex(); tempFileIndex.TotalEntries = 0; tempFileIndex.Write(bw); FolderIndex tempFolderIndex = new FolderIndex(); tempFolderIndex.TotalEntries = 0; tempFolderIndex.Write(bw); bw.Close(); }
internal static async void GoToPicEvent(object sender, RoutedEventArgs e) { if (int.TryParse(GetQuickSettingsMenu.GoToPic.GoToPicBox.Text.ToString(), out int x)) { x--; x = x <= 0 ? 0 : x; x = x >= Pics.Count ? Pics.Count - 1 : x; Pic(x); await LoadWindows.GetMainWindow.Dispatcher.BeginInvoke((Action)(() => { GetQuickSettingsMenu.GoToPic.GoToPicBox.Text = (x + 1).ToString(CultureInfo.CurrentCulture); })); } else if (Pics.Count > 0 && Pics.Count > FolderIndex) { GetQuickSettingsMenu.GoToPic.GoToPicBox.Text = FolderIndex.ToString(CultureInfo.CurrentCulture); } }
public Option <CorrelationToken> MonitorPath(FolderPath Path) { var token = CorrelationToken.Create(Path); if (FolderIndex.TryAdd(token, new FolderTree(Path))) { FolderIndex.TryFind(token) .OnNone(Notify) .OnSome(tree => { var index = ToMutableIndex(tree); FileIndex.TryAdd(token, index); iter(index.Keys, file => Notify(inform($"Indexed {file}"))); }); } C.Notify(inform($"{AgentRuntimeId} completed indexing {token}")); return(token); }
public SimpleArchiveFileSystem(string filename) { if (!File.Exists(filename)) { CreateArchive(filename); } stream = new FileStream(filename, FileMode.Open); BinaryReader br = new BinaryReader(stream); header = new FileHeader(); header.Read(br); br.BaseStream.Position = header.FileIndexOffset; fileIndex = new FileIndex(); fileIndex.Read(br); br.BaseStream.Position = header.FolderIndexOffset; folderIndex = new FolderIndex(); folderIndex.Read(br); }
public void AddToFolderIndexes(FolderIndex folderIndex) { base.AddObject("FolderIndexes", folderIndex); }
public static FolderIndex CreateFolderIndex(long id) { FolderIndex folderIndex = new FolderIndex(); folderIndex.id = id; return folderIndex; }