platformdotnet / platform.virtualfilesystem Goto Github PK
View Code? Open in Web Editor NEWLicense: Other
License: Other
Is there a chance we'll ever see direct support for the System.Uri class? Do you foresee any particular difficulties that would be present in creating such support, if I or someone else were to attempt addition of this functionality to the API?
Hi. I'm trying to serialize all attributes from a file/directory (put them into a settings file) and then restore them later.
I need to support all attribute types. Ideally I need to store the attributes as a dictionary, where the key is a string (the attribute name), and the value is a byte array.
I notice theNode.Attributes[...] can have several data types, so how do I make sure they are all byte arrays returned?
Also, somewhat unrelated, but doing this is throwing an exception:
foreach (string name in dir.Attributes.Names)
{
newDirectory.Attributes[name] = dir.Attributes[name];
}
Dear tumtumtum,
I tried to use the latest version of Platform.VirtualFileSystem in my program. Unfortunately I get the following Exception:
Result Message: System.MissingMethodException : Method not found: 'System.Collections.Generic.IEnumerable1<!!0> Platform.EnumerableUtils.Distinct(System.Collections.Generic.IEnumerable
1<!!0>)'.
Result StackTrace:
at Platform.VirtualFileSystem.FileSystemOptions..ctor(Type nodeCacheType, IList1 nodeServiceProviderTypes, IList
1 nodeResolutionFilterTypes, IList1 nodeOperationFilterTypes, IList
1 accessPermissionVerifierTypes, NameValueCollection variables)
at Platform.VirtualFileSystem.FileSystemOptions.get_Default()
at Platform.VirtualFileSystem.AbstractFileSystemManager.Resolve(String uri, NodeType nodeType, AddressScope scope)
at Platform.VirtualFileSystem.AbstractResolver.ResolveFile(String name, AddressScope scope)
at Platform.VirtualFileSystem.AbstractResolver.ResolveFile(String name)
I suppose, that after removing Distinct form EnumerableUtils not all the packages were correct rebuilt. Could you please republish the nuget packages?
Best regards
yarick123.
This throws a "System.NotSupportedException" :
IDirectory dir = FileSystemManager.Default.ResolveDirectory(@"C:\Users\Name\Documents\Platform Test\A");
IDirectory dir2 = FileSystemManager.Default.ResolveDirectory(@"C:\Users\Name\Documents\Platform Test\B");
dir.CopyToDirectory(dir2, false);
// This does too: dir.CopyTo(dir2, false);
Is CopyToDirectory/CopyTo supported on directories?
It seems that the XML documentation is missing for the NuGet package even though you use/have xmldoc comments.
Hi, I am testing out VirtualFileSystem and I'm really liking it so far.
I'm working on an application, and I need to know before an INode is copied locally (from anywhere else) whether it will save as a file or a folder. Do you know the most reliable way to determine this?
I mean something like the following:
void ProcessData(INode node)
{
// Will the node save as a folder or a file?
// If folder, copy it to local temp folder and process the folder somehow.
// If file, do something else (for example, it may not be supported by this method,)
}
Edit:
I think I may have answered my own question. I guess theNode.NodeType is where you can check if it's a File or Directory. If so, feel free to close this. Thanks.
It looks like the base logic is there, but I don't see any means of ever making the FileSystemOpstions ReadOnly = true.
in FileSystemOptions:
public bool ReadOnly => false;
Shouldn't that at least be marked virtual so I could create my own ZipFIleSystemOptions and then flip that to true?
I access to my zip content using this :
var localDir =FileSystemManager.Default.ResolveDirectory("zip://[file://W:/Temp/cabinet.public/cabinet.zip]/cabinet");
It's ok when zip has no password, but not when zip content is password protected.
How can I set zip passwords?
Thank you
Dear tumtumtum,
there is the following scenario:
zip-file
is downloaded and is put to a temporary location,thumbnail
from this zip-file
is copied by VirtualFileSystem
to some location: var zipFile = FileSystemManager.Default.ResolveFile("zip-file");
...
var thumbnail = FileSystemManager.Default.ResolveFile(
string.Format("zip://[{0}]/{1}", zipFile.Address, "thumbnail.jpg"));
...
thumbnail.CopyTo(...);
FileSystemManager.Default.CloseAllFileSystems()
is calledzip-file
tried to be deleted. On this place happens an IOException: The process cannot access the file 'zip-file' because it is being used by another process.A workaround, which helps me, is to insert the following code after processing thumbnail
in the finally
block:
thumbnail.FileSystem.Dispose();
P.S. I tried it with current version of VirtualFileSystem - 1.0.0.70.
Best regards
yarick123
Hi,
Have you planned FTP support ?
Thanx
I'm trying to transfer a file from disk into a file inside of a zip file using FileTransferService, but it doesn't seem to work. It gives me a file not found error.
var zip = ZipFileSystem.CreateZipFile(FileSystemManager.Default.ResolveFile(@"C:\Users\Michael\Documents\Platform Test\A\storage.zip"), FileSystemOptions.Default);
var target = zip.ResolveFile(@"fileInZip");
var source = FileSystemManager.Default.ResolveFile(@"C:\Users\Michael\Documents\p1 - Copy.png");
IFileTransferService service = source.GetService<IFileTransferService>(new FileTransferServiceType(target));
service.Start();
service.WaitForAnyTaskState(TaskState.Finished);
//System.NotSupportedException
new ImaginaryFileSystem("file").RootDirectory.ResolveFile("foo").Create();
//Also System.NotSupportedException
new ImaginaryFileSystem("file").RootDirectory.ResolveFile("foo").Create(true);
:(
How can one read a jpeg image directly from file system, for example in legacy file system we read JPEG as follows:
var stream=new FileStream(myFile,FileMode.Read);
var bmi = new BitmapImage();
bmi.BeginInit();
bmi.StreamSource = stream;
bmi.EndInit();
bmi.Freeze();
I'm trying to set the compression level to "store" (0).
using (ZipFileSystem zfs = ZipFileSystem.CreateZipFile(file,
FileSystemOptions.Default.AddVariables(new { ZipCompressionLevel = "0" })))
{ ... }
This does not seem to work. It is still compressing the file.
It would be nice if you could dispose of nodes individually instead of closing the entire filesystem.
When a folder contains the characters %3a I get an exception: "the given path's format is not supported. " When it contains %3c I get: "Illegal characters in path."
The problem seems to be that VFS is turning these into actual characters (i.e %3a is turned into a colon.)
These are causing issues when using INode.Name and also GetDirectories() (example: if the directory contains a folder with the name %3a inside of it.) It is also causing various other problems.
Is it possible to dispose single nodes instead of the closing an entire file system?
for (var i = 0; i < 100000000; i++)
{
IFile file = FileSystemManager.Default.ResolveFile(@"C:\file " + i.ToString());
// TODO: dispose of "file x" only ...
}
// Somewhere else I am working with nodes at the same time, so I can't close the entire file system that they both share.
Running the above example is causing a memory leak. I need a way to dispose of individual nodes. I am still not quite sure how to do this, based on the documentation.
On a side note, this even appears to cause a memory leak.
for (var i = 0; i < 100000000; i++)
{
IFile file = FileSystemManager.Default.ResolveFile(@"C:\file " + i.ToString());
FileSystemManager.Default.CloseAllFileSystems();
}
Update the library to support modern async/await methods.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.