Exemplo n.º 1
0
        protected FolderField CreateFolderField(string key, bool required)
        {
            FolderField field = new FolderField(key, required);

            this.AddField(field);
            return(field);
        }
 public static FolderField CreateFolderFieldFromName(string name)
 {
     FolderField ff = new FolderField();
     ff.FName = name;
     ff.FType = GetFieldType(name);
     ff.RealName = GetRealName(name);
     return ff;
 }
 public SendE2EImageMessageCommand() :
     base("Send End-to-End Encrypted Image Message",
          "Encrypt standard input and send the message to the given ID. 'from' is the API identity and 'secret' is the API secret. Prints the message ID on success.")
 {
     this.toField         = this.CreateThreemaId("to", true);
     this.fromField       = this.CreateThreemaId("from", true);
     this.secretField     = this.CreateTextField("secret", true);
     this.privateKeyField = this.CreatePrivateKeyField("privateKey", true);
     this.imageFilePath   = this.CreateFolderField("imageFilePath", true);
 }
 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);
 }
 public FolderField SaveFolderField(FolderField folderfield)
 {
     if (folderfield.ID == 0)
     {
         context.FolderFields.Add(folderfield);
         context.SaveChanges();
     }
     else
     {
         var ff = context.FolderFields.FirstOrDefault(a => a.ID == folderfield.ID);
         ff.AccountID = folderfield.AccountID;
         ff.FType = folderfield.FType;
         ff.FName = folderfield.FName;
         ff.FolderID = folderfield.FolderID;
         ff.RealName = folderfield.RealName;
         ff.MappedFieldID = folderfield.MappedFieldID;
         ff.TType = folderfield.TType;
         context.SaveChanges();
     }
     return folderfield;
 }