Exemple #1
0
 private Net.Vpc.Upa.Types.DataTypeTransformConfig CreateDataTypeTransformConfig(string name, string[] args) /* throws Net.Vpc.Upa.Exceptions.UPAException */
 {
     if (name.Equals("ToByteArray", System.StringComparison.InvariantCultureIgnoreCase))
     {
         Net.Vpc.Upa.Types.StringEncoderTransformConfig c = new Net.Vpc.Upa.Types.StringEncoderTransformConfig();
         if (args.Length == 0)
         {
             return(c);
         }
         else if (args.Length == 1)
         {
             Net.Vpc.Upa.Config.StringEncoderType t = default(Net.Vpc.Upa.Config.StringEncoderType);
             try {
                 t = (Net.Vpc.Upa.Config.StringEncoderType)(System.Enum.Parse(typeof(Net.Vpc.Upa.Config.StringEncoderType), args[0].ToUpper()));
             } catch (System.Exception e) {
             }
             //
             if (t != default(Net.Vpc.Upa.Config.StringEncoderType))
             {
                 c.SetEncoder(t);
             }
             else
             {
                 c.SetEncoder(args[0]);
             }
             return(c);
         }
         else
         {
             throw new System.ArgumentException("ToString: Invalid argument count");
         }
     }
     if (name.Equals("ToByteArray", System.StringComparison.InvariantCultureIgnoreCase))
     {
         Net.Vpc.Upa.Types.ByteArrayEncoderTransformConfig c = new Net.Vpc.Upa.Types.ByteArrayEncoderTransformConfig();
         if (args.Length == 0)
         {
             return(c);
         }
         else if (args.Length == 1)
         {
             c.SetEncoder(args[0]);
             return(c);
         }
         else
         {
             throw new System.ArgumentException("ToByteArray: Invalid argument count");
         }
     }
     if (name.Equals("Converter", System.StringComparison.InvariantCultureIgnoreCase))
     {
         if (args.Length == 1)
         {
             return(new Net.Vpc.Upa.Types.CustomTypeDataTypeTransform(args[0]));
         }
         else
         {
             throw new System.ArgumentException("Config: Invalid argument count");
         }
     }
     if (name.Equals("Password", System.StringComparison.InvariantCultureIgnoreCase))
     {
         if (args.Length == 0)
         {
             return(new Net.Vpc.Upa.PasswordTransformConfig());
         }
         else if (args.Length == 1)
         {
             Net.Vpc.Upa.PasswordTransformConfig c = new Net.Vpc.Upa.PasswordTransformConfig();
             Net.Vpc.Upa.PasswordStrategyType    t = default(Net.Vpc.Upa.PasswordStrategyType);
             try {
                 t = (Net.Vpc.Upa.PasswordStrategyType)(System.Enum.Parse(typeof(Net.Vpc.Upa.PasswordStrategyType), args[0].ToUpper()));
             } catch (System.Exception e) {
             }
             //
             if (t != default(Net.Vpc.Upa.PasswordStrategyType))
             {
                 c.SetCipherStrategy(t);
             }
             else
             {
                 c.SetCipherStrategy(args[0]);
             }
             return(c);
         }
         else if (args.Length == 2)
         {
             Net.Vpc.Upa.PasswordTransformConfig c = new Net.Vpc.Upa.PasswordTransformConfig();
             Net.Vpc.Upa.PasswordStrategyType    t = default(Net.Vpc.Upa.PasswordStrategyType);
             try {
                 t = (Net.Vpc.Upa.PasswordStrategyType)(System.Enum.Parse(typeof(Net.Vpc.Upa.PasswordStrategyType), args[0].ToUpper()));
             } catch (System.Exception e) {
             }
             //
             if (t != default(Net.Vpc.Upa.PasswordStrategyType))
             {
                 c.SetCipherStrategy(t);
             }
             else
             {
                 c.SetCipherStrategy(args[0]);
             }
             c.SetCipherValue(args[1]);
             return(c);
         }
         else
         {
             throw new System.ArgumentException("Password: Invalid argument count");
         }
     }
     if (name.Equals("Secret", System.StringComparison.InvariantCultureIgnoreCase))
     {
         if (args.Length == 0)
         {
             return(new Net.Vpc.Upa.Types.SecretTransformConfig());
         }
         else if (args.Length == 1)
         {
             Net.Vpc.Upa.Types.SecretTransformConfig c = new Net.Vpc.Upa.Types.SecretTransformConfig();
             Net.Vpc.Upa.SecretStrategyType          t = default(Net.Vpc.Upa.SecretStrategyType);
             try {
                 t = (Net.Vpc.Upa.SecretStrategyType)(System.Enum.Parse(typeof(Net.Vpc.Upa.SecretStrategyType), args[0].ToUpper()));
             } catch (System.Exception e) {
             }
             //
             if (t != default(Net.Vpc.Upa.SecretStrategyType))
             {
                 c.SetSecretStrategy(t);
             }
             else
             {
                 c.SetSecretStrategy(args[0]);
             }
             return(c);
         }
         else if (args.Length == 2)
         {
             Net.Vpc.Upa.Types.SecretTransformConfig c = new Net.Vpc.Upa.Types.SecretTransformConfig();
             Net.Vpc.Upa.SecretStrategyType          t = default(Net.Vpc.Upa.SecretStrategyType);
             try {
                 t = (Net.Vpc.Upa.SecretStrategyType)(System.Enum.Parse(typeof(Net.Vpc.Upa.SecretStrategyType), args[0].ToUpper()));
             } catch (System.Exception e) {
             }
             //
             if (t != default(Net.Vpc.Upa.SecretStrategyType))
             {
                 c.SetSecretStrategy(t);
             }
             else
             {
                 c.SetSecretStrategy(args[0]);
             }
             c.SetSize(System.Convert.ToInt32(args[1]));
             return(c);
         }
         else if (args.Length == 3)
         {
             Net.Vpc.Upa.Types.SecretTransformConfig c = new Net.Vpc.Upa.Types.SecretTransformConfig();
             Net.Vpc.Upa.SecretStrategyType          t = default(Net.Vpc.Upa.SecretStrategyType);
             try {
                 t = (Net.Vpc.Upa.SecretStrategyType)(System.Enum.Parse(typeof(Net.Vpc.Upa.SecretStrategyType), args[0].ToUpper()));
             } catch (System.Exception e) {
             }
             //
             if (t != default(Net.Vpc.Upa.SecretStrategyType))
             {
                 c.SetSecretStrategy(t);
             }
             else
             {
                 c.SetSecretStrategy(args[0]);
             }
             c.SetSize(System.Convert.ToInt32(args[1]));
             c.SetEncodeKey(args[2]);
             c.SetDecodeKey(args[2]);
             return(c);
         }
         else if (args.Length == 4)
         {
             Net.Vpc.Upa.Types.SecretTransformConfig c = new Net.Vpc.Upa.Types.SecretTransformConfig();
             Net.Vpc.Upa.SecretStrategyType          t = default(Net.Vpc.Upa.SecretStrategyType);
             try {
                 t = (Net.Vpc.Upa.SecretStrategyType)(System.Enum.Parse(typeof(Net.Vpc.Upa.SecretStrategyType), args[0].ToUpper()));
             } catch (System.Exception e) {
             }
             //
             if (t != default(Net.Vpc.Upa.SecretStrategyType))
             {
                 c.SetSecretStrategy(t);
             }
             else
             {
                 c.SetSecretStrategy(args[0]);
             }
             c.SetSize(System.Convert.ToInt32(args[1]));
             c.SetEncodeKey(args[2]);
             c.SetDecodeKey(args[3]);
             return(c);
         }
         else
         {
             throw new System.ArgumentException("Password: Invalid argument count");
         }
     }
     else
     {
         throw new System.ArgumentException("Invalid converter " + name);
     }
 }
Exemple #2
0
 public virtual void SetCipherStrategy(Net.Vpc.Upa.PasswordStrategyType cipherStrategy)
 {
     this.SetObjectCipherStrategy(cipherStrategy);
 }