Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/266.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 给定路径';独立存储中不支持s格式_C#_Windows Phone 8 - Fatal编程技术网

C# 给定路径';独立存储中不支持s格式

C# 给定路径';独立存储中不支持s格式,c#,windows-phone-8,C#,Windows Phone 8,我想在上传到服务器之前计算我的文件大小,然后通过创建文件夹将我的文件保存在隔离存储中。现在我想获取用于计算文件大小的路径,但它给出了错误“不支持给定路径的格式” 我的代码是: stringfilepath=Path.Combine(FolderName,FileName); 字符串fp=@“ms-appdata:///local//“+imageFolder+”/“+fName;//在这里,我尝试了“/”并尝试直接附加“filePath”,但仍然抛出相同的错误 FileInfo=newfilei

我想在上传到服务器之前计算我的文件大小,然后通过创建文件夹将我的文件保存在隔离存储中。现在我想获取用于计算文件大小的路径,但它给出了错误“不支持给定路径的格式”

我的代码是:

stringfilepath=Path.Combine(FolderName,FileName);
字符串fp=@“ms-appdata:///local//“+imageFolder+”/“+fName;//在这里,我尝试了“/”并尝试直接附加“filePath”,但仍然抛出相同的错误
FileInfo=newfileinfo(fp)////此处抛出错误“不支持给定路径的格式”
var fileLength=new System.IO.FileInfo(fp.Length);
int image\u file\u size=Convert.ToInt32(文件长度);

此路径的正确格式是什么?

当您在XAML中寻找代码时,请考虑这种路径。如果您想使用System.IO

然后,您需要像这样构建路径

string dbPath = Path.Combine(Windows.Storage.ApplicationData.Current.LocalFolder.Path, "db.sqlite");   
FileInfo info = new FileInfo(dbPath);


此代码工作正常

stringfilepath=Path.Combine(FolderName,FileName);
字符串FilePath=Path.Combine(Windows.Storage.ApplicationData.Current.LocalFolder.Path,FilePath);
FileInfo=newfileinfo(FilePath);
var fileLength=new System.IO.FileInfo(FilePath).Length;
int image\u file\u size=Convert.ToInt32(文件长度);

这对您有用吗:“Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData)”现在我得到了这个平台不支持的错误操作:(哇,它工作了,非常感谢Chubosaurus软件:)string FilePath=Path.Combine(Windows.Storage.ApplicationData.Current.LocalFolder.Path,FilePath); FileInfo=newfileinfo(FilePath);var fileLength=new System.IO.FileInfo(FilePath).Length;