本文整理汇总了C#中QTPlugin.Address类的典型用法代码示例。如果您正苦于以下问题:C# Address类的具体用法?C# Address怎么用?C# Address使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Address类属于QTPlugin命名空间,在下文中一共展示了Address类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AppLauncher
public AppLauncher(Address[] addresses, string pathCurrent) {
List<string> list = new List<string>();
List<string> list2 = new List<string>();
this.strCurrentPath = this.strSelFiles = this.strSelDirs = this.strSelObjs = string.Empty;
this.iSelItemsCount = this.iSelFileCount = this.iSelDirsCount = 0;
if(addresses != null) {
this.iSelItemsCount = addresses.Length;
for(int i = 0; i < addresses.Length; i++) {
using(IDLWrapper wrapper = new IDLWrapper(addresses[i].ITEMIDLIST)) {
if(wrapper.Available && wrapper.HasPath) {
if(wrapper.IsFileSystemFile) {
list.Add(addresses[i].Path);
}
else {
list2.Add(addresses[i].Path);
}
}
}
}
}
if(Directory.Exists(pathCurrent)) {
this.strCurrentPath = "\"" + pathCurrent + "\"";
}
foreach(string str in list) {
this.strSelFiles = this.strSelFiles + "\"" + str + "\" ";
}
foreach(string str2 in list2) {
this.strSelDirs = this.strSelDirs + "\"" + str2 + "\" ";
}
this.strSelObjs = (this.strSelFiles + this.strSelDirs).Trim();
this.strSelFiles = this.strSelFiles.Trim();
this.strSelDirs = this.strSelDirs.Trim();
this.iSelFileCount = list.Count;
this.iSelDirsCount = list2.Count;
}
示例2: CreateWindow
public bool CreateWindow(Address address)
{
using(IDLWrapper wrapper = new IDLWrapper(address)) {
if(wrapper.Available) {
tabBar.OpenNewWindow(wrapper);
return true;
}
}
return false;
}
示例3: CreateTab
public bool CreateTab(Address address, int index, bool fLocked, bool fSelect)
{
using(IDLWrapper wrapper = new IDLWrapper(address)) {
address.ITEMIDLIST = wrapper.IDL;
address.Path = wrapper.Path;
}
if((address.ITEMIDLIST == null) || (address.ITEMIDLIST.Length <= 0)) {
return false;
}
QTabItem tab = new QTabItem(QTUtility2.MakePathDisplayText(address.Path, false), address.Path, tabBar.tabControl1);
tab.NavigatedTo(address.Path, address.ITEMIDLIST, -1, false);
tab.ToolTipText = QTUtility2.MakePathDisplayText(address.Path, true);
tab.TabLocked = fLocked;
if(index < 0) {
tabBar.AddInsertTab(tab);
}
else {
if(index > tabBar.tabControl1.TabCount) {
index = tabBar.tabControl1.TabCount;
}
tabBar.tabControl1.TabPages.Insert(index, tab);
}
if(fSelect) {
tabBar.tabControl1.SelectTab(tab);
}
return true;
}
示例4: AddressToPIDL
private static IntPtr AddressToPIDL(Address address) {
IntPtr zero = IntPtr.Zero;
if((address.ITEMIDLIST != null) && (address.ITEMIDLIST.Length != 0)) {
return ShellMethods.CreateIDL(address.ITEMIDLIST);
}
if(!string.IsNullOrEmpty(address.Path)) {
zero = PInvoke.ILCreateFromPath(address.Path);
}
return zero;
}
示例5: TryGetSelection
internal bool TryGetSelection(out Address[] adSelectedItems, out string pathFocused, bool fDisplayName) {
adSelectedItems = new Address[0];
pathFocused = string.Empty;
List<Address> list = new List<Address>();
if(!this.fIFolderViewNotImplemented) {
IShellFolder shellFolder = null;
IShellView ppshv = null;
IFolderView view2 = null;
IPersistFolder2 ppv = null;
IEnumIDList list2 = null;
IntPtr zero = IntPtr.Zero;
try {
if(this.ShellBrowser.QueryActiveShellView(out ppshv) == 0) {
int num;
IntPtr ptr2;
int num2;
try {
view2 = (IFolderView)ppshv;
}
catch(InvalidCastException) {
this.fIFolderViewNotImplemented = true;
return false;
}
Guid riid = ExplorerGUIDs.IID_IPersistFolder2;
Guid guid2 = ExplorerGUIDs.IID_IEnumIDList;
if(view2.GetFolder(ref riid, out ppv) != 0) {
return false;
}
if((ppv.GetCurFolder(out zero) != 0) || (zero == IntPtr.Zero)) {
return false;
}
if(!ShellMethods.GetShellFolder(zero, out shellFolder)) {
return false;
}
if((view2.GetFocusedItem(out num) == 0) && (view2.Item(num, out ptr2) == 0)) {
STRRET strret;
IntPtr pv = PInvoke.ILCombine(zero, ptr2);
StringBuilder pszBuf = new StringBuilder(260);
if(shellFolder.GetDisplayNameOf(ptr2, 0x8000, out strret) == 0) {
PInvoke.StrRetToBuf(ref strret, ptr2, pszBuf, pszBuf.Capacity);
}
pathFocused = pszBuf.ToString();
PInvoke.CoTaskMemFree(ptr2);
PInvoke.CoTaskMemFree(pv);
}
if(view2.ItemCount(1, out num2) != 0) {
return false;
}
if(num2 != 0) {
IntPtr ptr4;
if((view2.Items(1, ref guid2, out list2) != 0) || (list2 == null)) {
return false;
}
uint uFlags = fDisplayName ? 0 : 0x8000u;
while(list2.Next(1, out ptr4, null) == 0) {
STRRET strret2;
StringBuilder builder2 = new StringBuilder(260);
if(shellFolder.GetDisplayNameOf(ptr4, uFlags, out strret2) == 0) {
PInvoke.StrRetToBuf(ref strret2, ptr4, builder2, builder2.Capacity);
}
IntPtr pidl = PInvoke.ILCombine(zero, ptr4);
list.Add(new Address(pidl, builder2.ToString()));
PInvoke.CoTaskMemFree(ptr4);
PInvoke.CoTaskMemFree(pidl);
}
adSelectedItems = list.ToArray();
}
return true;
}
}
catch(Exception exception) {
QTUtility2.MakeErrorLog(exception, null);
}
finally {
if(shellFolder != null) {
Marshal.ReleaseComObject(shellFolder);
shellFolder = null;
}
if(ppshv != null) {
Marshal.ReleaseComObject(ppshv);
ppshv = null;
}
if(ppv != null) {
Marshal.ReleaseComObject(ppv);
ppv = null;
}
if(list2 != null) {
Marshal.ReleaseComObject(list2);
list2 = null;
}
if(zero != IntPtr.Zero) {
PInvoke.CoTaskMemFree(zero);
}
}
}
return false;
}
示例6: PluginEventArgs
public PluginEventArgs(int index, Address address)
{
this.index = index;
this.address = address;
}
示例7: TryGetSelection
public bool TryGetSelection(out Address[] adSelectedItems, out string pathFocused, bool fDisplayName)
{
using(IDLWrapper wrapper = GetFocusedItem()) {
pathFocused = wrapper.ParseName;
}
return TryGetSelection(out adSelectedItems, fDisplayName);
}
示例8: Browse
public bool Browse(Address address)
{
if(tab != null) {
tabBar.tabControl1.SelectTab(tab);
using(IDLWrapper wrapper = new IDLWrapper(address)) {
return tabBar.ShellBrowser.Navigate(wrapper) == 0;
}
}
return false;
}
示例9: Explorer_NavigateComplete2
private void Explorer_NavigateComplete2(object pDisp, ref object URL) {
string path = (string)URL;
lastCompletedBrowseObjectIDL = lastAttemptedBrowseObjectIDL;
if(!IsShown) {
DoFirstNavigation(false, path);
}
if(fNowQuitting) {
Explorer.Quit();
}
else {
int hash = -1;
bool flag = IsSpecialFolderNeedsToTravel(path);
bool flag2 = QTUtility2.IsShellPathButNotFileSystem(path);
bool flag3 = QTUtility2.IsShellPathButNotFileSystem(CurrentTab.CurrentPath);
// If we're navigating on a locked tab, we simulate opening the target folder
// in a new tab. First we clone the tab at the old address and lock it. Then
// we move the current tab to the "new tab" position and unlock it.
if(!flag2 && !flag3 && !NavigatedByCode && CurrentTab.TabLocked) {
int pos = tabControl1.SelectedIndex;
tabControl1.SetRedraw(false);
QTabItem item = CloneTabButton(CurrentTab, null, false, pos);
item.TabLocked = true;
CurrentTab.TabLocked = false;
pos++;
int max = tabControl1.TabPages.Count - 1;
switch(QTUtility.ConfigValues[1]) {
case 0:
if(pos != max) {
tabControl1.TabPages.Relocate(pos, max);
}
break;
case 1:
tabControl1.TabPages.Relocate(pos, 0);
break;
case 3:
tabControl1.TabPages.Relocate(pos, pos - 1);
break;
}
tabControl1.SetRedraw(true);
lstActivatedTabs.Remove(CurrentTab);
lstActivatedTabs.Add(item);
lstActivatedTabs.Add(CurrentTab);
if(lstActivatedTabs.Count > 15) {
lstActivatedTabs.RemoveAt(0);
}
}
if(!NavigatedByCode && flag) {
hash = DateTime.Now.GetHashCode();
LogEntryDic[hash] = GetCurrentLogEntry();
}
ClearTravelLogs();
try {
tabControl1.SetRedraw(false);
if(fNowTravelByTree) {
using(IDLWrapper wrapper = GetCurrentPIDL()) {
QTabItem tabPage = CreateNewTab(wrapper);
tabControl1.SelectTabDirectly(tabPage);
CurrentTab = tabPage;
}
}
if(tabControl1.AutoSubText && !fNavigatedByTabSelection) {
CurrentTab.Comment = string.Empty;
}
CurrentAddress = path;
CurrentTab.Text = Explorer.LocationName;
CurrentTab.CurrentIDL = null;
CurrentTab.TooltipText2 = null;
byte[] idl;
using(IDLWrapper wrapper2 = GetCurrentPIDL()) {
CurrentTab.CurrentIDL = idl = wrapper2.IDL;
if(flag) {
if((!NavigatedByCode && (idl != null)) && (idl.Length > 0)) {
path = path + "*?*?*" + hash;
QTUtility.ITEMIDLIST_Dic_Session[path] = idl;
CurrentTab.CurrentPath = CurrentAddress = path;
}
}
else if((flag2 && wrapper2.Available) && !CurrentTab.CurrentPath.Contains("???")) {
string str2;
int num2;
if(IDLWrapper.GetIDLHash(wrapper2.PIDL, out num2, out str2)) {
hash = num2;
CurrentTab.CurrentPath = CurrentAddress = path = str2;
}
else if((idl != null) && (idl.Length > 0)) {
hash = num2;
path = path + "???" + hash;
IDLWrapper.AddCache(path, idl);
CurrentTab.CurrentPath = CurrentAddress = path;
}
}
if(!NavigatedByCode) {
CurrentTab.NavigatedTo(CurrentAddress, idl, hash);
}
}
//.........这里部分代码省略.........
示例10: CreateTMPPathsToOpenNew
private static IEnumerable<string> CreateTMPPathsToOpenNew(Address[] addresses, string pathExclude) {
List<string> list = new List<string>();
QTUtility2.InitializeTemporaryPaths();
for(int i = 0; i < addresses.Length; i++) {
try {
using(IDLWrapper wrapper = new IDLWrapper(addresses[i].ITEMIDLIST)) {
if(wrapper.Available && wrapper.HasPath) {
string path = wrapper.Path;
if(path.Length > 0 && !path.PathEquals(pathExclude) &&
!QTUtility2.IsShellPathButNotFileSystem(path) &&
wrapper.IsFolder && !wrapper.IsLinkToDeadFolder) {
list.Add(path);
}
}
}
}
catch {
}
}
return list;
}
示例11: MakeSourcePaths
private static string MakeSourcePaths(Address[] addresses) {
string str = String.Empty;
foreach(Address ad in addresses) {
if(!String.IsNullOrEmpty(ad.Path) /*&& ( File.Exists( ad.Path ) || Directory.Exists( ad.Path ) ) */) //to allow compressed..
str += ad.Path + "\0";
}
str += "\0";
return str;
}
示例12: IDLWrapper
public IDLWrapper(Address ad) {
attributes = 0xfffffff0;
pIDL = IntPtr.Zero;
if(ad.ITEMIDLIST != null && ad.ITEMIDLIST.Length > 0) {
pIDL = ShellMethods.CreateIDL(ad.ITEMIDLIST);
}
if(pIDL == IntPtr.Zero && !string.IsNullOrEmpty(ad.Path)) {
InitFromPath(ad.Path);
}
}
示例13: TrySetSelection
internal bool TrySetSelection(Address[] addresses, string pathToFocus, bool fDeselectOthers) {
if(addresses != null) {
IShellFolder ppshf = null;
IShellView ppshv = null;
try {
if(this.ShellBrowser.QueryActiveShellView(out ppshv) == 0) {
IntPtr ptr3;
if(PInvoke.SHGetDesktopFolder(out ppshf) != 0) {
return false;
}
bool flag = true;
bool flag2 = false;
bool flag3 = (pathToFocus != null) && (pathToFocus.Length > 0);
uint pchEaten = 0;
uint pdwAttributes = 0;
if(fDeselectOthers) {
((IFolderView)ppshv).SelectItem(0, 4);
}
foreach(Address address in addresses) {
IntPtr zero = IntPtr.Zero;
if((address.ITEMIDLIST != null) && (address.ITEMIDLIST.Length > 0)) {
zero = ShellMethods.CreateIDL(address.ITEMIDLIST);
}
if((((zero != IntPtr.Zero) || (address.Path == null)) || ((address.Path.Length <= 0) || (ppshf.ParseDisplayName(IntPtr.Zero, IntPtr.Zero, address.Path, ref pchEaten, out zero, ref pdwAttributes) == 0))) && (zero != IntPtr.Zero)) {
IntPtr pidlItem = PInvoke.ILFindLastID(zero);
uint uFlags = 1;
if(flag) {
uFlags |= 8;
if(!flag3) {
flag2 = true;
uFlags |= 0x10;
}
if(fDeselectOthers) {
uFlags |= 4;
}
flag = false;
}
if((!flag2 && flag3) && (address.Path == pathToFocus)) {
flag2 = true;
uFlags |= 0x10;
}
ppshv.SelectItem(pidlItem, uFlags);
PInvoke.CoTaskMemFree(zero);
}
}
if((!flag2 && flag3) && (ppshf.ParseDisplayName(IntPtr.Zero, IntPtr.Zero, pathToFocus, ref pchEaten, out ptr3, ref pdwAttributes) == 0)) {
IntPtr ptr4 = PInvoke.ILFindLastID(ptr3);
ppshv.SelectItem(ptr4, 0x18);
PInvoke.CoTaskMemFree(ptr3);
}
return true;
}
}
catch(Exception exception) {
QTUtility2.MakeErrorLog(exception, null);
}
finally {
if(ppshv != null) {
Marshal.ReleaseComObject(ppshv);
ppshv = null;
}
if(ppshf != null) {
Marshal.ReleaseComObject(ppshf);
ppshf = null;
}
}
}
return false;
}
示例14: TryGetSelection
public bool TryGetSelection(out Address[] adSelectedItems)
{
string str;
return tabBar.ShellBrowser.TryGetSelection(out adSelectedItems, out str, false);
}
示例15: HandleTabFolderActions
private bool HandleTabFolderActions(int index, Keys modKeys, bool fEnqExec) {
IntPtr zero = IntPtr.Zero;
IntPtr ppidl = IntPtr.Zero;
try {
Address[] addressArray;
IDLWrapper wrapper1;
bool flag = true;
if(index != -1) {
addressArray = new Address[0];
wrapper1 = ShellBrowser.GetItem(index);
}
else {
string str;
if(ShellBrowser.TryGetSelection(out addressArray, out str, false) && (addressArray.Length > 0)) {
List<Address> list = new List<Address>(addressArray);
wrapper1 = new IDLWrapper(ShellMethods.CreateIDL(list[0].ITEMIDLIST));
list.RemoveAt(0);
addressArray = list.ToArray();
flag = (addressArray.Length > 0) || (modKeys == Keys.Shift);
}
else {
return false;
}
}
using(IDLWrapper wrapper = wrapper1) {
if((wrapper.Available && wrapper.HasPath) && wrapper.IsReadyIfDrive) {
if(wrapper.IsFolder) {
if(modKeys == Keys.Control) {
if(!wrapper.IsLinkToDeadFolder) {
QTUtility.TMPPathList.AddRange(CreateTMPPathsToOpenNew(addressArray, wrapper.Path));
OpenNewWindow(wrapper);
}
else {
SystemSounds.Hand.Play();
}
}
else if(modKeys == (Keys.Alt | Keys.Control | Keys.Shift)) {
DirectoryInfo info = new DirectoryInfo(wrapper.Path);
if(info.Exists) {
DirectoryInfo[] directories = info.GetDirectories();
if((directories.Length + tabControl1.TabCount) < 0x41) {
tabControl1.SetRedraw(false);
foreach(DirectoryInfo info2 in directories) {
if(info2.Name != "System Volume Information") {
using(IDLWrapper wrapper2 = new IDLWrapper(info2.FullName)) {
if(wrapper2.Available && (!wrapper2.IsLink || Directory.Exists(ShellMethods.GetLinkTargetPath(info2.FullName)))) {
OpenNewTab(wrapper2, true, false);
}
}
}
}
tabControl1.SetRedraw(true);
}
else {
SystemSounds.Hand.Play();
}
}
}
else {
if(addressArray.Length > 1) {
tabControl1.SetRedraw(false);
}
try {
if(flag) {
OpenNewTab(wrapper, (modKeys & Keys.Shift) == Keys.Shift, false);
}
else if(!wrapper.IsFileSystemFile) {
ShellBrowser.Navigate(wrapper);
}
else {
return false;
}
for(int i = 0; i < addressArray.Length; i++) {
using(IDLWrapper wrapper3 = new IDLWrapper(addressArray[i].ITEMIDLIST)) {
if(((wrapper3.Available && wrapper3.HasPath) && (wrapper3.IsReadyIfDrive && wrapper3.IsFolder)) && !wrapper3.IsLinkToDeadFolder) {
string path = wrapper3.Path;
if(((path != wrapper.Path) && (path.Length > 0)) && !QTUtility2.IsShellPathButNotFileSystem(path)) {
OpenNewTab(wrapper3, true, false);
}
}
}
}
}
finally {
if(addressArray.Length > 1) {
tabControl1.SetRedraw(true);
}
}
}
return true;
}
if(wrapper.IsLink) {
using(IDLWrapper wrapper4 = new IDLWrapper(ShellMethods.GetLinkTargetIDL(wrapper.Path))) {
if(((wrapper4.Available && wrapper4.HasPath) && (wrapper4.IsReadyIfDrive && wrapper4.IsFolder)) && !wrapper.IsLinkToDeadFolder) {
if(modKeys == Keys.Control) {
QTUtility.TMPPathList.AddRange(CreateTMPPathsToOpenNew(addressArray, wrapper.Path));
OpenNewWindow(wrapper4);
}
else {
if(flag) {
//.........这里部分代码省略.........