bool ParseSSHUrl(string url) { if (!url.Contains(':')) { return(false); } var tokens = url.Split(new [] { ':' }, 2); if (!Uri.IsWellFormedUriString(tokens [0], UriKind.RelativeOrAbsolute) || !Uri.IsWellFormedUriString(tokens [1], UriKind.RelativeOrAbsolute)) { return(false); } var userAndHost = tokens [0].Split('@'); repositoryUserEntry.Text = userAndHost [0]; repositoryServerEntry.Text = userAndHost [1]; repositoryPortSpin.Value = 22; string path = tokens [1]; if (!path.StartsWith("/", StringComparison.Ordinal)) { path = "/" + path; } repositoryPathEntry.Text = path; comboProtocol.Active = protocols.IndexOf("ssh"); comboProtocol.Sensitive = false; PathChanged?.Invoke(this, EventArgs.Empty); return(true); }
public void Init(EnvironmentVariableTarget ev) { // MessageBox.Show("init"); // CurrentPathText = GetCurrentPathText(); if (CurrentPathText != string.Empty) { CurrentPathLength = CurrentPathText.Length; CurrentPathList.Clear(); CurrentPathList = GetCurrentPathList(); CurrentPathCount = CurrentPathList.Count; // MessageBox.Show(PathSummary); Over1023 = CurrentPathLength > 1023; PathSummaryColor = Over1023 ? Color.Red : Color.Black; PathUnique = CurrentPathList.Where(Directory.Exists) // remove not exist .Distinct().ToList(); //remove duplicated DublicatedList.Clear(); DublicatedList = GetDuplicatedList(CurrentPathList); NotExistList = new BindingList <string>(CurrentPathList.Where(item => !Directory.Exists(item)).ToList()); PathSummary = string.Format("Path Length: {0}, Count: {1}", CurrentPathLength, CurrentPathCount); if (Over1023) { PathSummary += " (Over 1023 char)"; } CanRepair = GetRepairStatus(); IsDuplicated = DublicatedList.Count > 0; PathChanged.Raise(this, null); } }
private void tvwMain_AfterSelect(object sender, TreeViewEventArgs e) { try { // ignore some special locations - it doesn't make sense to show files then these. All these just report as path "" TreeNode node = e.Node; if (string.Compare((string)node.Tag, "My Network Places") == 0) { } else if (string.Compare((string)node.Tag, "Microsoft Windows Network") == 0) { } else if (node == m_MyComputerNode) { } else if (string.Compare((string)node.Tag, "Entire Network") == 0) { } else if (node.Parent != null && string.Compare((string)node.Parent.Tag, "Microsoft Windows Network") == 0) { } else { SelectedPath = (string)node.Tag; PathChanged?.Invoke(this, EventArgs.Empty); } } catch (Exception ex) { Debug.WriteLine(ex.Message); } }
private void PostLevelStackMutate() { ViewModel.BackEnabled = _levels.Count > 0; if (_currentLevel != null) { var jObject = _currentLevel as JObject; if (jObject != null) { ViewModel.CurrentPath = jObject.Path; PathChanged?.Invoke(this, new PathChangedEventArgs { NewPath = jObject.Path }); return; } var jArray = _currentLevel as JArray; if (jArray != null) { ViewModel.CurrentPath = jArray.Path; PathChanged?.Invoke(this, new PathChangedEventArgs { NewPath = jArray.Path }); return; } } }
/// <summary> /// Save the current configuration. /// </summary> internal bool SaveConfiguration() { var configuration = Configuration; if (configuration == null) { return(true); } if (string.IsNullOrEmpty(configuration.Path)) { return(SaveConfigurationAs()); } try { configuration.Save(configuration.Path); UserPreferences.Preferences.LocoNetConfigurationPath = configuration.Path; UserPreferences.SaveNow(); PathChanged.Fire(this); return(true); } catch (Exception ex) { MessageBox.Show(ex.Message); return(false); } }
// Constructor public AppSystem(IForegroundWindowHook fgHook, IWindowUpdateHook winHook, IMouseHook msHook) { _state = new InitialState(); _stateContext = new AppStateContext { PathModeLocksToHandle = false, ForegroundHook = fgHook, WindowHook = winHook, MouseHook = msHook, SetCurrentState = (next) => SetCurrentState(next), SendLockStateChange = () => LockStateChanged.Invoke(this, new Events.LockStateChangedEventArgs { IsLocked = IsLocked }), SendPathChange = (path) => PathChanged.Invoke(this, new Events.PathChangedEventArgs { Path = path }), SendTitleChange = (title) => TitleChanged.Invoke(this, new Events.TitleChangedEventArgs { Title = title }), SendDimensionsChange = (dimensions) => DimensionsChanged.Invoke(this, new Events.DimensionsChangedEventArgs { Dimensions = dimensions }), SendForegroundChange = (inForeground) => ForegroundChanged.Invoke(this, new Events.ForegroundStateChangedEventArgs { InForeground = inForeground }) }; fgHook.ForegroundWindowChanged += ForegroundHook_ForegroundWindowChanged; winHook.WindowClosed += WindowHook_WindowClosed; winHook.DimensionsChanged += WindowHook_DimensionsChanged; winHook.TitleChanged += WindowHook_TitleChanged; }
public void GoToFolder(MyPath path) { var folder = Manager.Go(path); PutFilesOnPanel(folder.EnumerateFiles()); PathChanged?.Invoke(Current); }
public void GoUp() { var folder = Manager.GoUp(); PathChanged?.Invoke(Current); PutFilesOnPanel(folder.EnumerateFiles()); }
public void SetPath(string path) { if (!path.StartsWith("/")) { path = CurrentPath + "/" + path; } var parts = new List <string>(); foreach (var part in path.Split('/')) { if (part == "..") { if (parts.Count() > 0) { parts.RemoveAt(parts.Count - 1); } continue; } parts.Add(part); } path = string.Join("/", parts); CurrentPath = path; CurrentObject = World.QuerySingle(path, out var prettyPath); CurrentPrettyPath = prettyPath; PathChanged?.Invoke(this, CurrentObject, CurrentPath, prettyPath); }
public override void OnClick() { base.OnClick(); movePath = new LinkedList <Vector2Int>(); movePath.AddLast(location); PathChanged?.Invoke(movePath.ToArray()); }
void Fill() { comboProtocol.Sensitive = true; if (repo.Uri != null && repo.Uri.IsAbsoluteUri) { if (repo.Name == repositoryServerEntry.Text) { repo.Name = repo.Uri.Host; } repositoryServerEntry.Text = repo.Uri.Host; repositoryPortSpin.Value = repo.Uri.Port; repositoryPathEntry.Text = repo.Uri.PathAndQuery; repositoryUserEntry.Text = repo.Uri.UserInfo; comboProtocol.Active = protocols.IndexOf(repo.Uri.Scheme); PathChanged?.Invoke(this, EventArgs.Empty); } else if (!ParseSSHUrl(repo.Url)) { // The url may have a scheme, but it may be an incomplete or incorrect url. Do the best to select // the correct value in the protocol combo string prot = repo.SupportedProtocols.FirstOrDefault(p => repo.Url.StartsWith(p + "://", StringComparison.Ordinal)); if (prot != null) { repositoryServerEntry.Text = string.Empty; repositoryPortSpin.Value = 0; repositoryPathEntry.Text = string.Empty; repositoryUserEntry.Text = string.Empty; comboProtocol.Active = protocols.IndexOf(prot); } else { comboProtocol.Active = protocols.IndexOf(repo.Protocol); } } }
protected void OnPathChanged(string oldPath, string newPath) { PathChanged?.Invoke(this, new PathChangedArgs() { OldPath = oldPath, NewPath = newPath }); }
public void OnExitState() { _path?.Clear(); PathChanged?.Invoke(); _currentPathIdx = 0; _elapsedPathUpdate = 0.0f; _currentStateTimeUnitsElapsed = 0.0f; }
void OnPathChanged(FilePath oldPath, FilePath oldLink) { PathChanged?.Invoke(this, CreateEventArgs()); ProjectFilePathChangedEventArgs CreateEventArgs() { var oldVirtualPath = GetProjectVirtualPath(oldLink, oldPath, Project); return(new ProjectFilePathChangedEventArgs(this, oldPath, filename, oldVirtualPath, ProjectVirtualPath)); } }
public void RecalculatePath() { if (_path == null) { _path = new List <Vector2Int>(); } PathUtils.FindPath(_mapController, Coords, _entityController.Player.Coords, ref _path, ValidNavigationCoords); PathChanged?.Invoke(); _currentPathIdx = 0; _elapsedPathUpdate = 0.0f; }
public void GoForward() { try { var folder = Manager.GoForward(); PathChanged?.Invoke(Current); PutFilesOnPanel(folder.EnumerateFiles()); } catch (EmptyHistoryException) { } }
protected async void PathChangedHandler(UIChangeEventArgs e) { if (IsMultiple) { var files = await JSRunner.GetFilePaths(ElementRef); PathChanged?.Invoke(files); } else { PathChanged?.Invoke(new string[] { e?.Value?.ToString() }); } }
protected async void PathChangedHandler(UIChangeEventArgs e) { if (IsMultiple) { InternalValue = await JSRunner.GetFilePaths(ElementRef); } else { InternalValue = new string[] { e?.Value?.ToString() } }; PathChanged?.Invoke(InternalValue); }
public TreeNode <IDataPath> chdir(string path) { PathName pathName = new PathName(path); TreeNode <IDataPath> node = mgr.Navigate(pathName); if (node != null) { mgr.current = node; PathChanged?.Invoke(this, new EventArgs <TreeNode <IDataPath> >(node)); } return(node); }
private void FileTree_OnSelectedItemChanged(object sender, RoutedPropertyChangedEventArgs <object> e) { var node = (TreeNode)e.NewValue; if (!(node.File is Folder)) { return; } var dir = (Folder)node.File; Manager.Go(dir); PutFilesOnPanel(dir.EnumerateFiles()); PathChanged?.Invoke(Current); }
private void Navigate(int index) { var strBuilder = new StringBuilder(); strBuilder.Append(Links[0]); for (int i = 1; i <= index; i++) { strBuilder.Append($"\\{Links[i]}"); } PathChanged.InvokeAsync(strBuilder.ToString()); if (NavigateCB == null) { return; } NavigateCB.Invoke(); }
private void FolderViewOnMouseDoubleClick(MyFile file) { if (file is Folder) { var folder = (Folder)file; PutFilesOnPanel(folder.EnumerateFiles()); Manager.Go(folder); PathChanged?.Invoke(Current); } if (file is TextFile) { file = (TextFile)file; object result; if (Repo.TryGet(file.Path.GetExt(), out result)) { } } }
public void OpenExe() { var fd = new OpenFileDialog { Filters = { new FileDialogFilter("Enter the Gungeon executable", Autodetector.ExeName) } }; fd.ShowDialog(this); if (fd.FileName == null) { return; } PathBox.Text = fd.FileName; PathBox.CaretIndex = PathBox.Text.Length; PathChanged.Invoke(this, new EventArgs()); }
public ISendToItem DeepClone() { var clone = new PathValidatingSendToItem(_name, _player.DeepClone()); var pathChangedInvocations = PathChanged.GetInvocationList(); foreach (var invocation in pathChangedInvocations) { clone.PathChanged += (EventHandler <EventArgs>)invocation; } if (ParametersChanged != null) { var parametersChangedInvocations = ParametersChanged.GetInvocationList(); foreach (var invocation in parametersChangedInvocations) { clone.ParametersChanged += (EventHandler <EventArgs>)invocation; } } return(clone); }
protected override void ContextClickedItem(int id) { base.ContextClickedItem(id); var clickedItem = FindItem(id, _root); if (clickedItem == null || clickedItem.depth > 0 || clickedItem.displayName.Equals(NO_CURRENT_KINDS_AND_ACTIONS_SELECTED) || clickedItem.displayName.Equals(NO_CURRENT_ACTIONS_LOADED) || clickedItem.displayName.Equals(NO_RECORDS_SAVED) || clickedItem.displayName.Equals(NO_PATHS_ACCEPTED)) { return; } switch (TreePurpose) { case TreePurpose.DRAW_CURRENT_NAMES: RecordNameChanged?.Invoke(clickedItem.displayName, this); Recorder.SetCurrentRecordName(clickedItem.displayName); break; case TreePurpose.DRAW_SAVED_NAMES: RecordNameUsedInLoad?.Invoke(clickedItem.displayName, this); Storage.SetCurrentRecordName(clickedItem.displayName); break; case TreePurpose.PATHS: PathChanged?.Invoke(clickedItem.displayName, this); Integrator.SetCurrentRecordName(clickedItem.displayName); break; case TreePurpose.DRAW_SAVED_KINDS_AND_ACTIONS: case TreePurpose.DRAW_CURRENT_KINDS_AND_ACTIONS: break; case TreePurpose.NONE: throw new System.ArgumentOutOfRangeException(string.Empty, "Tree purpose is NONE!"); default: throw new System.ArgumentOutOfRangeException(); } }
/// <summary> /// Open a configuration from the given path. /// </summary> internal void OpenConfiguration(string path) { try { // Open var tmp = LocoNetConfiguration.Load(path); // Can we close? if (SaveConfigurationIfDirty()) { Setup(null, tmp); UserPreferences.Preferences.LocoNetConfigurationPath = path; UserPreferences.SaveNow(); PathChanged.Fire(this); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void BuildPath() { var list = new List <Point>(); Action <PointF?> tryAdd = (point) => { if (point == null) { return; } list.Add(new Point( (int)(point.Value.X / Board.TileSize.Width), (int)(point.Value.Y / Board.TileSize.Height))); }; tryAdd(_start); tryAdd(_finish); CurrentPath = new Path(list); Board.Path = CurrentPath; PathChanged?.Invoke(this, EventArgs.Empty); }
protected virtual void SendPathUpdate() { OnPropertyChanged(nameof(Path)); PathChanged?.Invoke(this, EventArgs.Empty); }
protected virtual void OnPathChanged(EventArgs e) { PathChanged?.Invoke(this, e); }
void OnPathChanged(DocumentPathChangedEventArgs e) => PathChanged?.Invoke(this, e);