本文整理汇总了C#中Shell.NameSpace方法的典型用法代码示例。如果您正苦于以下问题:C# Shell.NameSpace方法的具体用法?C# Shell.NameSpace怎么用?C# Shell.NameSpace使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Shell
的用法示例。
在下文中一共展示了Shell.NameSpace方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: s
public void s()
{
var shell = default(Shell);
var desktop = default(Folder);
try
{
shell = new Shell();
desktop = shell.NameSpace(ShellSpecialFolderConstants.ssfDESKTOP);
}
finally
{
if (desktop != null) { Marshal.ReleaseComObject(desktop); }
if (shell != null) { Marshal.ReleaseComObject(shell); }
}
}
示例2: GetFileProps
Dictionary<int, KeyValuePair<string, string>> GetFileProps(string filename)
{
Shell shl = new Shell();
Folder fldr = shl.NameSpace(Path.GetDirectoryName(filename));
FolderItem itm = fldr.ParseName(Path.GetFileName(filename));
Dictionary<int, KeyValuePair<string, string>> fileProps = new Dictionary<int, KeyValuePair<string, string>>();
for (int i = 0; i < 100; i++)
{
string propValue = fldr.GetDetailsOf(itm, i);
if (propValue != "")
{
fileProps.Add(i, new KeyValuePair<string, string>(fldr.GetDetailsOf(null, i), propValue));
}
}
return fileProps;
}
示例3: Restoration
public Restoration(string dateTime, int dateTimeNegative)
{
var shell = new Shell();
list = new List<FolderItem2>();
Folder recypleBin = shell.NameSpace(10);
foreach (FolderItem2 f in from FolderItem2 f in recypleBin.Items()
where f.ModifyDate.ToString(CultureInfo.CurrentCulture).Contains(dateTime.Substring(0, dateTimeNegative))
where f.Type == "Текстовый документ" || f.Type == "Папка с файлами"
select f)
{
list.Add(f);
foreach (var folderItemVerb in
f.Verbs().Cast<FolderItemVerb>().Where(folderItemVerb => folderItemVerb.Name.ToUpper().Contains("estore".ToUpper()) || folderItemVerb.Name.ToUpper().Contains("тановить".ToUpper())))
{
folderItemVerb.DoIt();
Console.WriteLine(f.Name + " - \t Восстановлен");
}
}
Marshal.FinalReleaseComObject(shell);
}
示例4: GetShortcutTargetFile
public static bool GetShortcutTargetFile(string shortcutFilename, out String TargetPath, out String TargetDescr)
{
bool Result = false;
TargetPath = string.Empty;
TargetDescr = string.Empty;
string pathOnly = System.IO.Path.GetDirectoryName(shortcutFilename);
string filenameOnly = System.IO.Path.GetFileName(shortcutFilename);
Shell shell = new Shell();
Folder folder = shell.NameSpace(pathOnly);
FolderItem folderItem = folder.ParseName(filenameOnly);
Result = (folderItem != null);
if (Result)
{
Shell32.ShellLinkObject link = (Shell32.ShellLinkObject)folderItem.GetLink;
TargetPath = link.Path;
//TargetDescr = link.Description;
String FileName = System.IO.Path.GetFileName(link.Path);
TargetDescr = FileName;
} // if (Result)
return Result;
}
示例5: GetMediaInfo
public static void GetMediaInfo(string DataFoldername, string DataFilename, out int bitrate, out string length)
{
int bitrateIndex = 28;
int lengthIndex = 27;
bitrate = 128;
length = "00:04:00";
Shell shell = new Shell();
Folder objFolder;
objFolder = shell.NameSpace(DataFoldername);
/*
for (int i = 0; i < short.MaxValue; i++)
{
string header = objFolder.GetDetailsOf(null, i);
if (String.IsNullOrEmpty(header))
break;
if (header.Contains("bitrate"))
bitrateIndex = i;
if (header.Contains("length"))
bitrateIndex = i;
}
*/
FolderItem item = objFolder.ParseName(DataFilename);
length = objFolder.GetDetailsOf(item, lengthIndex);
string temp = objFolder.GetDetailsOf(item, bitrateIndex);
int tempbitrate = 0;
for (int i = 0; i < temp.Length; i++)
{
if (char.IsDigit(temp[i]))
tempbitrate = tempbitrate * 10 + temp[i] - 0x30;
}
if (tempbitrate != 0)
bitrate = tempbitrate;
return;
}
示例6: GetFileDetails
public string GetFileDetails(string fileFolder, string filePath, infoFile infotype)
{
try
{
Shell fileshell = new Shell();
Folder fileshellfolder = fileshell.NameSpace(fileFolder);
return fileshellfolder.GetDetailsOf(fileshellfolder.ParseName(filePath), (int)infotype);
}
catch
{
return string.Empty;
}
}
示例7: printMetaData
private static void printMetaData(string musikFolder)
{
List<string> arrHeaders = new List<string>();
EntryText("Writing MetaData");
Shell32.Shell _shell = new Shell();
Shell32.Folder _objFolder = _shell.NameSpace(musikFolder);
for (int i = 0; i < short.MaxValue; i++)
{
string header = _objFolder.GetDetailsOf(null, i);
if (String.IsNullOrEmpty(header))
break;
arrHeaders.Add(header);
}
foreach (var items in _objFolder.Items())
{
for (int i = 0; i < arrHeaders.Count; i++)
{
Console.WriteLine("{0}\t{1}: {2}", i, arrHeaders[i], _objFolder.GetDetailsOf(items, i));
}
break;
}
}