/// <summary> /// New property explorer with a provider item path. /// </summary> /// <param name="itemPath">Item path.</param> public PropertyExplorer(string itemPath) : base(new Guid(TypeIdString)) { if (itemPath == null) { throw new ArgumentNullException("itemPath"); } // the path _ThePath = new PathInfoEx(itemPath); Functions = ExplorerFunctions.GetContent | ExplorerFunctions.SetText; if (My.ProviderInfoEx.HasDynamicProperty(Provider)) { Functions |= ( ExplorerFunctions.AcceptFiles | ExplorerFunctions.DeleteFiles | ExplorerFunctions.CloneFile | ExplorerFunctions.CreateFile | ExplorerFunctions.RenameFile); } }
void Reset(string path) { // set location if (!string.IsNullOrEmpty(path) && path != ".") { A.Psf.Engine.SessionState.Path.SetLocation(path); } // get location PathInfoEx location = new PathInfoEx(A.Psf.Engine.SessionState.Path.CurrentLocation); if (!My.ProviderInfoEx.IsNavigation(location.Provider)) { throw new RuntimeException("Provider '" + location.Provider + "' does not support navigation."); } // get root item Collection <PSObject> items = A.Psf.Engine.SessionState.InvokeProvider.Item.Get(new string[] { "." }, true, true); //! trap Get-Item at Cert: if (items.Count == 0) { throw new RuntimeException(string.Format(null, "Provider '{0}' cannot get '{1}'.", location.Provider, location.Path)); } PSObject data = items[0]; // reset roots RootFiles.Clear(); var ti = new TreeFile { Name = location.Path, // special case name for the root Fill = TheFill, Data = data }; RootFiles.Add(ti); ti.Expand(); // panel info Location = ti.Path; }
//! Very slow operation, that is why we propagate the provider on exploring. internal PathInfoEx Info() { return(_Info_ ?? (_Info_ = new PathInfoEx(Location))); }
internal ItemExplorer(PathInfoEx info) : this(info.Path) { _Info_ = info; }