对于c#–如何在WinRT/Windows8中按日期顺序获取文件列表感兴趣的读者,本文将提供您所需要的所有信息,我们将详细讲解c#获取系统日期,并且为您提供关于c#–如何在Windows商店(WinR
对于c# – 如何在WinRT / Windows 8中按日期顺序获取文件列表感兴趣的读者,本文将提供您所需要的所有信息,我们将详细讲解c# 获取系统日期,并且为您提供关于c# – 如何在Windows商店(WinRT)应用程序中启用DocumentsLibrary功能?、C:如何获取Windows目录中的文件列表?、vb.net – 如何在Windows Store / WP8 / WinRT的可移植类库中使用反射?、Windows Phone – 如何在Windows 10上获取设备平台的宝贵知识。
本文目录一览:- c# – 如何在WinRT / Windows 8中按日期顺序获取文件列表(c# 获取系统日期)
- c# – 如何在Windows商店(WinRT)应用程序中启用DocumentsLibrary功能?
- C:如何获取Windows目录中的文件列表?
- vb.net – 如何在Windows Store / WP8 / WinRT的可移植类库中使用反射?
- Windows Phone – 如何在Windows 10上获取设备平台
c# – 如何在WinRT / Windows 8中按日期顺序获取文件列表(c# 获取系统日期)
我认为这段代码应该这样做,
var queryOptions = new QueryOptions(CommonFileQuery.OrderByDate,new[] { ".xml" }); queryOptions.FolderDepth = FolderDepth.Deep; StorageFolder folder = await ApplicationData.Current.LocalFolder.CreateFolderAsync("Recent",CreationCollisionoption.OpenIfExists); StorageFileQueryResult query = folder.CreateFileQueryWithOptions(queryOptions); var files = await query.GetFilesAsync();
但这给了我以下错误:
WinRT information: The requested enumeration option is not available
for this folder because it is not within a library or homegroup. Only folders within a library or a homegroup support all enumeration options.
有没有办法从Local文件夹中的目录中读取文件时按日期顺序获取文件列表?
解决方法
c# – 如何在Windows商店(WinRT)应用程序中启用DocumentsLibrary功能?
// DEBUG ONLY: StorageFile file = await KNownFolders.DocumentsLibrary.CreateFileAsync("hey lol.txt");
但它抛出了这个异常(我预期):
WinRT information: Access to the specified location (DocumentsLibrary) requires a capability to be declared in the manifest.
哪个好.我期待它.所以我转到Package.appxmanifest并转到Capabilities选项卡,令我惊讶的是,没有列出“DocumentsLibrary”功能.
如果它不存在,我该如何启用它?
解决方法
[Although] this capability is gone just from the UI,you still can open appxmanifest source and manually add the capability. The result will probably be the same as before – failure of certification for individual developers,so you better stay away from this trick. Microsoft strongly recommend against using Documents Library capability,suggesting Folder and File Pickers instead.
C:如何获取Windows目录中的文件列表?
我试图按照RFC959标准在C(学校作业)中实现一个FTP服务器。
我遇到了LIST命令的麻烦。 RFC读取:“这个命令导致一个列表被从服务器发送到被动的DTP,如果path名指定一个目录或其他文件组,服务器应该传送指定目录中的文件列表,如果path名指定一个文件,然后服务器应该发送文件的当前信息。一个空参数意味着用户的当前工作或默认目录。
我知道有像GetCurrentDirectory等function。是否有一个函数来获取输出如在MS-DOS命令提示符下的'dir'? 任何类似的事情都会有所帮助。
提前致谢!
两行文件之间的区别
从IE打开Word文档
使用c / c ++打开随机命名文件夹中的文件
java – 文件字符集
比较2个文件夹和查找具有不同字节数的文件
使用pyinotify来监视文件的创build,但等待它完全写入磁盘
为什么FileStream和copyFile比Windows资源pipe理器慢得多?
如何知道somone在“Open With”下使用我的程序时打开了哪个文件?(C#)
关于在Linux上使用Javascript的文件处理
父/subprocessclosures文件描述符
FindFirstFile和FindNextFile是枚举路径的API。
Adrian Worley编写了一个教程,解释如何使用FindFirstFile和FindNextFile获取目录中的文件列表http://www.adrianxw.dk/SoftwareSite/FindFirstFile/FindFirstFile1.html
这是一个小例子。
#include <windows.h> #include <iostream> using namespace std; int main() { HANDLE hFind; WIN32_FIND_DATA FindData; cout << "FindFirstFile/FindNextFile demo.n" << endl; // Find the first file hFind = FindFirstFile("C:\Windows\*.exe",&FindData); cout << FindData.cFileName << endl; // Look for more while (FindNextFile(hFind,&FindData)) { cout << FindData.cFileName << endl; } // Close the file handle FindClose(hFind); return 0; }
vb.net – 如何在Windows Store / WP8 / WinRT的可移植类库中使用反射?
Public Overridable Function GetPropertyValue(ByVal p_propertyName As String) As Object Dim bf As System.Reflection.BindingFlags bf = Reflection.BindingFlags.IgnoreCase Or Reflection.BindingFlags.Public Or Reflection.BindingFlags.Instance Or Reflection.BindingFlags.NonPublic Dim propInfo As System.Reflection.PropertyInfo = Me.GetType().GetProperty(p_propertyName,bf) Dim tempValue As Object = nothing If propInfo Is nothing Then Return nothing End If Try tempValue = propInfo.GetValue(Me,nothing) Catch ex As Exception Errors.Add(New Warp10.Framework.BaSEObjects.BaseErrorMessage(String.Format("Could not Get Value from Property {0},Error was :{1}",p_propertyName,ex.Message),-1)) Return nothing End Try Return tempValue End Function
BindingFlags似乎不存在. System.Reflection.PropertyInfo是一个有效的类型,但我无法弄清楚如何填充它.有什么建议?
解决方法
虽然这是C#代码(我的道歉:)),但这里使用这个新功能是完全相同的:
public class TestClass { public string Name { get; set; } public object GetPropValue(string propertyName) { var propInfo = RuntimeReflectionExtensions.GetRuntimeProperties(this.GetType()).Where(pi => pi.Name == propertyName).First(); return propInfo.GetValue(this); } }
如果您只关心在类本身声明的属性,那么此代码甚至更简单:
public class TestClass { public string Name { get; set; } public object GetPropValue(string propertyName) { var propInfo = this.GetType().GetTypeInfo().GetDeclaredProperty(propertyName); return propInfo.GetValue(this); } }
Windows Phone – 如何在Windows 10上获取设备平台
通过使用Apiinformation检查当前的类型,方法等是可行的,但我认为应该有一个更可靠的方式.
Windows.System.Profile.AnalyticsInfo.VersionInfo.DeviceFamily
您可以在这里找到更多信息:https://msdn.microsoft.com/en-us/library/windows/apps/dn705767.aspx
更新:
https://msdn.microsoft.com/en-us/library/windows/apps/windows.system.profile.analyticsversioninfo.aspx
关于c# – 如何在WinRT / Windows 8中按日期顺序获取文件列表和c# 获取系统日期的介绍已经告一段落,感谢您的耐心阅读,如果想了解更多关于c# – 如何在Windows商店(WinRT)应用程序中启用DocumentsLibrary功能?、C:如何获取Windows目录中的文件列表?、vb.net – 如何在Windows Store / WP8 / WinRT的可移植类库中使用反射?、Windows Phone – 如何在Windows 10上获取设备平台的相关信息,请在本站寻找。
本文标签: