Пример #1
0
        /// <summary>
        /// Set the given object as the link's metadata. </summary>
        /// <param name="data"> custom data to save with the link metadata. </param>
        /// <exception cref="ChainscriptException"> </exception>
        /// <exception cref="Exception">  </exception>
        ///
        public object Metadata()
        {
            this.VerifyCompatibility();
            object     result       = null;
            ByteString linkMetadata = LinkMeta.Data;

            if (linkMetadata == null || linkMetadata.IsEmpty)
            {
                return(result);
            }
            switch (this.Version())
            {
            case Constants.LINK_VERSION_1_0_0:
                return(Canonicalizer.Parse(linkMetadata.ToStringUtf8()));

            default:
                throw new ChainscriptException(Error.LinkVersionUnknown);
            }
        }
Пример #2
0
        /// <summary>
        /// gets the Data
        /// </summary>
        /// <returns></returns>
        public object Data()
        {
            /// <summary>
            /// The link data (business logic details about the execution of a process step). </summary>
            /// <exception cref="Exception">
            /// @returns the object containing the link details. </exception>

            this.VerifyCompatibility();

            if (this.ALink.Data == null || this.ALink.Data.IsEmpty)
            {
                return(null);
            }
            switch (this.Version())
            {
            case Constants.LINK_VERSION_1_0_0:
                return(Canonicalizer.Parse(this.ALink.Data.ToStringUtf8()));

            default:
                throw new ChainscriptException(Error.LinkVersionUnknown);
            }
        }