예제 #1
0
        /// <exception cref="ChainscriptException">
        ///  </exception>
        public LinkBuilder(string process, string mapId)
        {
            if (String.IsNullOrEmpty(process))
            {
                throw new ChainscriptException(Error.LinkProcessMissing);
            }

            if (String.IsNullOrEmpty(mapId))
            {
                throw new ChainscriptException(Error.LinkMapIdMissing);
            }

            Stratumn.Chainscript.Proto.Process processObj = new Stratumn.Chainscript.Proto.Process
            {
                Name = process
            };

            Stratumn.Chainscript.Proto.LinkMeta linkMeta = new Stratumn.Chainscript.Proto.LinkMeta
            {
                ClientId  = Constants.ClientId,
                MapId     = mapId,
                OutDegree = -1,
                Process   = processObj
            };

            this.link = new Stratumn.Chainscript.Proto.Link
            {
                Version = Constants.LINK_VERSION,
                Meta    = linkMeta
            };
        }
예제 #2
0
 /// <summary>
 /// A link always belong to an instance of a process. </summary>
 /// <exception cref="ChainscriptException">
 /// @returns the link's process name. </exception>
 public virtual Process Process()
 {
     Stratumn.Chainscript.Proto.Process process = LinkMeta.Process;
     if (process == null)
     {
         throw new ChainscriptException(Error.LinkProcessMissing);
     }
     return(new Process(string.IsNullOrEmpty(process.Name) ? ""
                   : process.Name, string.IsNullOrEmpty(process.State) ? ""
                            : process.State));
 }