richardschneider / net-ipfs-http-client

InterPlanetary File System client for .Net (C#, VB, F# ...)
MIT License
158 stars 52 forks source link

How to give support to ipfs.core for android 8.1 in xamarin forms...??? #44

Closed mosinms7711 closed 5 years ago

mosinms7711 commented 5 years ago

Hello...I am not unable to add IPFS.Core package in my android project...My Dependancy in .net Standard 2.0 and m targetting 8.1...Please help me out...

richardschneider commented 5 years ago

I have not tried Ipfs.Core with Xamarin. Could you please give the errors?

Does Xamarin support .Net Standard 2? Have you read https://dzone.com/articles/xamarin-forms-and-net-standard-getting-started?

richardschneider commented 5 years ago

This may also help https://docs.microsoft.com/en-us/xamarin/xamarin-forms/internals/net-standard

Also, are you trying to add ipfs.core of ipfs.api? Please raise individual issues, my mind only has a few slots for issues.

If you have repo with the project, I'll fork it and try to get it to work.

mosinms7711 commented 5 years ago

@richardschneider Thanks for help.can you please tell me...How to wrap data in Merkle Dag with xamarin forms or c#.?I need to add content to ipfs network.Before that i want hash value for the content.Now i can get hash values of raw data but when we add content to ipfs it wrap the data with merkle dag then create hash value of the content before uploading to ipfs n/w.

richardschneider commented 5 years ago

The easy way is to simply call FileSystem.AddFileAsync. It returns a FileSystemNode which contains the Id. The ID is a CID (Content ID) which in the normal case, v0, is the multihash.

using Ipfs.Api;

var ipfs = new IpfsClient();
var path = "path-to-file";
var node = await ipfs.FileSystem.AddFileAsync(path);
var hash = (string)node.Id;
Console.WriteLine($"The hash is {hash}");
mosinms7711 commented 5 years ago

@richardschneider thank for help...for the jpeg image above code gives different hash value than IPFS add.Can you please help me with the same.?

richardschneider commented 5 years ago

Please show what IPFS addreturns and what the above code prints. Also please attach the image.

I did test this on my machine and it worked.

richardschneider commented 5 years ago

The new documentation on the client and the file system may help.