Exemplo n.º 1
0
 public MatryxCortex()
 {
     if (Instance == null)
     {
         Instance = this;
         supportedCalcflowCategories.Add("math");
     }
 }
Exemplo n.º 2
0
        public IEnumerator uploadContent()
        {
            if (!content.Equals(""))
            {
                List <string> fileNames = new List <string>()
                {
                    "jsonContent.json"
                };
                List <string> contents = new List <string> {
                    content
                };
                List <string> fileTypes = new List <string>()
                {
                    "application/json"
                };
                var uploadToIPFS = new Utils.CoroutineWithData <string>(MatryxCortex.Instance, MatryxCortex.uploadFiles(fileNames, contents));
                yield return(uploadToIPFS);

                ipfsContentHash = uploadToIPFS.result;
                yield return(true);
            }

            yield return(false);
        }
Exemplo n.º 3
0
        public IEnumerator uploadContent()
        {
            if (dto.Content == null || dto.Content.Equals(string.Empty))
            {
                if (description != null && !description.Equals(string.Empty))
                {
                    if (commit.ipfsContentHash != null && commit.ipfsContentHash.Substring(0, 2) == "Qm")
                    {
                        var uploadToIPFS = new Utils.CoroutineWithData <string>(MatryxCortex.Instance, MatryxCortex.uploadJson(title, description, commit.ipfsContentHash));
                        yield return(uploadToIPFS);

                        dto.Content = uploadToIPFS.result;
                    }
                }
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// Uploads a Tournament's description and files to IPFS.
        /// </summary>
        /// <param name="tournament"> The tournament whose description and files are to be uploaded. </param>
        /// <returns> The description hash and files hash of the tournament in that order. </returns>
        public IEnumerator uploadContent()
        {
            string contentHash = "";
            string filesHash   = "";

            // TODO: Allow for file uploading for tournaments (FileBrowser)
            //if (tournament.fileHash == null || tournament.fileHash.Equals(string.Empty))
            //{
            //    if (tournament.file != null && !tournament.file.Equals(string.Empty))
            //    {
            //        var uploadToIPFS = new Utils.CoroutineWithData<string>(MatryxCortex.Instance, Utils.uploadFiles("filesContent", "", tournament.file, "text/plain"));
            //        yield return uploadToIPFS;
            //        filesHash = uploadToIPFS.result;
            //    }
            //}

            if (contentHash == string.Empty)
            {
                if (description != null && !description.Equals(string.Empty))
                {
                    var uploadToIPFS = new Utils.CoroutineWithData <string>(MatryxCortex.Instance, MatryxCortex.uploadJson(title, description, "", "math"));
                    yield return(uploadToIPFS);

                    contentHash = uploadToIPFS.result;
                }
            }

            yield return(new string[2] {
                contentHash, filesHash
            });
        }