public void Write(ByteArrayField val)
 {
     WriteHeader(Type_ByteArray, val.Tag);
     WriteHeader(Type_Byte, 0);
     Write(val.Data.Length, 0);
     Write(val.Data);
 }
Example #2
0
        protected ByteArrayField CreateByteArrayField(string key, bool required)
        {
            ByteArrayField field = new ByteArrayField(key, required);

            this.AddField(field);
            return(field);
        }
        public JceField ReadField()
        {
            Header header = PeakHeader();

            switch (header.Type)
            {
            case Type_Byte:
                return(ReadField <ByteField>(header.Tag));

            case Type_Short:
                return(ReadField <ShortField>(header.Tag));

            case Type_Int:
                return(ReadField <IntField>(header.Tag));

            case Type_Long:
                return(ReadField <LongField>(header.Tag));

            case Type_Float:
                return(ReadField <FloatField>(header.Tag));

            case Type_Double:
                return(ReadField <DoubleField>(header.Tag));

            case Type_String1:
            case Type_String4:
                return(ReadField <StringField>(header.Tag));

            case Type_Map:
                return(ReadField <MapField>(header.Tag));

            case Type_List:
                return(ReadField <ListField>(header.Tag));

            case Type_StructBegin:
                return(ReadField <StructField>(header.Tag));

            case Type_StructEnd:
                throw new Exception("Got struct end field without struct begin tag.");

            case Type_Zero:
                return(ReadField <ZeroField>(header.Tag));

            case Type_ByteArray:
                ByteArrayField field = ReadField <ByteArrayField>(header.Tag);

                /* Maybe we should decode it by ourself.
                 * using(JceStream stream = new JceStream(field.Data))
                 * {
                 *      try
                 *      {
                 *              return stream.ReadAll();
                 *      }
                 *      catch { }
                 * }
                 */
                return(field);
            }
            throw new Exception("Unknown type.");
        }
 public DecryptCommand() :
     base("Decrypt",
          "Decrypt standard input using the given recipient private key and sender public key. The nonce must be given on the command line, and the box (hex) on standard input. Prints the decrypted message to standard output.")
 {
     this.privateKeyField = this.CreatePrivateKeyField("privateKey");
     this.publicKeyField  = this.CreatePublicKeyField("publicKey");
     this.nonceField      = this.CreateByteArrayField("nonce");
 }
Example #5
0
 public HistoricDecisionOutputInstanceEntity()
 {
     if (!InstanceFieldsInitialized)
     {
         InitializeInstanceFields();
         InstanceFieldsInitialized = true;
     }
     byteArrayField = new ByteArrayField(this, ResourceTypes.HISTORY);
 }
Example #6
0
 public HistoricDecisionOutputInstanceEntity(string rootProcessInstanceId, DateTime removalTime)
 {
     if (!InstanceFieldsInitialized)
     {
         InitializeInstanceFields();
         InstanceFieldsInitialized = true;
     }
     this.rootProcessInstanceId = rootProcessInstanceId;
     this.removalTime           = removalTime;
     byteArrayField             = new ByteArrayField(this, ResourceTypes.HISTORY, RootProcessInstanceId, RemovalTime);
 }
 public DecryptAndDownloadCommand() :
     base("Decrypt and download",
          "Decrypt a box (box from the stdin) message and download (if the message is a image or file message) the file(s) to the defined directory")
 {
     this.threemaId         = this.CreateThreemaId("id");
     this.fromField         = this.CreateThreemaId("from");
     this.secretField       = this.CreateTextField("secret");
     this.privateKeyField   = this.CreatePrivateKeyField("privateKey");
     this.messageIdField    = this.CreateTextField("messageId");
     this.nonceField        = this.CreateByteArrayField("nonce");
     this.outputFolderField = this.CreateFolderField("outputFolder", false);
 }
Example #8
0
 private void InitializeInstanceFields()
 {
     byteArrayField  = new ByteArrayField(this, ResourceTypes.HISTORY);
     typedValueField = new TypedValueField(this, false);
 }
Example #9
0
 private void InitializeInstanceFields()
 {
     byteArrayField  = new ByteArrayField(this, ResourceTypes.RUNTIME);
     typedValueField = new TypedValueField(this, true);
 }
 private void InitializeInstanceFields()
 {
     typedValueField = new TypedValueField(this, false);
     //throw new NotImplementedException();
     byteArrayField = new ByteArrayField(this);
 }
Example #11
0
 private void InitializeInstanceFields()
 {
     byteArrayField  = new ByteArrayField(this);
     typedValueField = new TypedValueField(this, false);
 }
Example #12
0
 private void InitializeInstanceFields()
 {
     configuration = new ByteArrayField(this, ResourceTypes.RUNTIME);
 }
Example #13
0
 private void InitializeInstanceFields()
 {
     configuration = new ByteArrayField(this);
 }