コード例 #1
0
        public async Task Save()
        {
            if (Dirty)
            {
                using (StreamWriter writer = new StreamWriter(ListingFilename))
                {
                    writer.Write(JsonConvert.SerializeObject(this, Formatting.Indented));
                }

                string hashFilename = await IpfsApiWrapper.AddAsync(ListingFilename);

                await IpfsApiWrapper.PublishAsync(hashFilename);

                Dirty = false;
            }
        }
コード例 #2
0
        private async Task AddFileNotAlreadyExisting(string filename, object lockObject)
        {
            string hashFilename = await IpfsApiWrapper.AddAsync(filename);

            IpfsFile file = new IpfsFile
            {
                LocalFilename  = filename,
                RemoteFilename = hashFilename
            };

            file.ComputerAndStoreHash(filename);
            lock (lockObject)
            {
                Dirty = true;
                _Files.Add(file);
            }
        }
コード例 #3
0
ファイル: PeerListing.cs プロジェクト: saluspass/salus-client
        public async Task Save()
        {
            if (Dirty)
            {
                using (StreamWriter writer = new StreamWriter(ListingFilename))
                {
                    writer.Write(JsonConvert.SerializeObject(this, Formatting.Indented));
                }

                string hashFilename = await IpfsApiWrapper.AddAsync(ListingFilename);

                string filenameHashIpnsEntry = await IpfsApiWrapper.GetAdditionalInformation("salus");

                await IpfsApiWrapper.PublishAsync(hashFilename, filenameHashIpnsEntry);

                Dirty = false;
            }
        }