Example #1
0
        private async void AddDirectory(string path)
        {
            await IPFS.FilesMkdir(path);

            this.m_Directories = await DirectoryCollection.Build();

            this.NotifyPropertyChanged("Directories");
        }
Example #2
0
        public static async Task <DirectoryCollection> Build()
        {
            DirectoryCollection directoryCollection = new DirectoryCollection();
            JObject             result = await IPFS.FilesLs("/");

            JArray entries = (JArray)result["Entries"];

            foreach (JObject jObject in entries)
            {
                string    subDirectoryName = jObject["Name"].ToString();
                Directory subDirectory     = new Directory(subDirectoryName, "/" + subDirectoryName);
                directoryCollection.Add(subDirectory);
                await AddChildrenRecursive(subDirectory);
            }
            return(directoryCollection);
        }
Example #3
0
        private static async Task AddChildrenRecursive(Directory parentDirectory)
        {
            JObject result = await IPFS.FilesLs(parentDirectory.Path);

            JToken value = result["Entries"];

            if (value.Type != JTokenType.Null)
            {
                JArray entries = (JArray)result["Entries"];
                foreach (JObject jObject in entries)
                {
                    string    subDirectoryName = jObject["Name"].ToString();
                    Directory subDirectory     = new Directory(subDirectoryName, parentDirectory.Path + "/" + subDirectoryName);
                    parentDirectory.Subdirectories.Add(subDirectory);
                    await AddChildrenRecursive(subDirectory);
                }
            }
        }
Example #4
0
 private async void RemoveDirectory(string path)
 {
     await IPFS.FilesMkdir(path);
 }
Example #5
0
 private async void PubSubPub()
 {
     //await IPFS.PubSubPub("cow", "jumped");
     await IPFS.PubSubSub("cow");
 }