Esempio n. 1
0
        // adds a new file to the current file registry
        // returns the name of the registered file
        public async Task <string> RegisterFile(string fileId)
        {
            if (RegistryAddress != null)
            {
                // get file info
                File file = await MyDriveManager.GetFile(RegistryAddress, fileId);

                // get file hash and metadata hash
                string fileHash = await MyDriveManager.GetFileHash(RegistryAddress, file.FileId);

                string metadataHash = await MyDriveManager.GetMetadataHash(RegistryAddress, file.FileId);

                // add new file contract
                await MyEthManager.NewFile(RegistryAddress, file, fileHash, metadataHash);

                return(file.Name);
            }

            throw new Exception("No file registry chosen");
        }