public override bool Read() { if (mKeyValueType == KeyValueType.Key) { bool readKey = ReadKey(); return(true); } if (!base.Read()) { EndState(); return(true); } else { ReadValue(); mKeyValueType = KeyValueType.Key; } return(true); }
/// <summary> /// 创建一个int类型的数据 /// </summary> /// <param name="key"></param> /// <param name="defaultValue"></param> public KeyValueItem(string key, int defaultValue) { KeyValueConfigManger.AddUpdateItem(this); defaultIntValue = defaultValue; Key = key; type = KeyValueType.Int; }
public DbRow(int keyIndex, int keyLength, KeyValueType type, int valueIndex, int length) { KeyLocation = keyIndex; KeyLength = keyLength; Location = valueIndex; Length = length; Type = type; }
/// <summary> /// 创建一个int[] 类型的数据 /// </summary> /// <param name="key"></param> /// <param name="defaultValue"></param> public KeyValueItem(string key, string[] defaultValue) { KeyValueConfigManger.AddUpdateItem(this); defaultStringArray = defaultValue; Key = key; type = KeyValueType.StringArray; }
/// <summary> /// 创建一个Double[] 类型的数据 /// </summary> /// <param name="key"></param> /// <param name="defaultValue"></param> public KeyValueItem(string key, double[] defaultValue) { KeyValueConfigManger.AddUpdateItem(this); defaultDoubleArray = defaultValue; Key = key; type = KeyValueType.DoubleArray; }
public bool GetKeyIv(string strDomain, string strApp, ref byte[] key, ref byte[] iv) { bool bSuccess = false; const string HTTP_PRE = "http://"; const string HTTPS_PRE = "https://"; try { if (strDomain.Length == 0 && strApp.Length == 0) { key = default_key; iv = default_iv; } else { if (!keyman_.ContainsKey(strDomain)) { //if (strDomain.IndexOf(HTTP_PRE) == 0) if (strDomain.IndexOf(HTTP_PRE) == 0 || strDomain.IndexOf(HTTPS_PRE) == 0) { CacheKeyRepo(strDomain); } else { CacheKeyRepoFromReg(strDomain); } } KeyType domainKey = new KeyType(); if (!keyman_.TryGetValue(strDomain, out domainKey)) { throw new Exception(); } KeyValueType keyv = new KeyValueType(); if (!domainKey.TryGetValue(strApp, out keyv)) { throw new Exception(); } key = keyv.Key; iv = keyv.Value; if (key == null || iv == null) { throw new Exception(); } } bSuccess = true; } catch (Exception) { } return(bSuccess); }
public void xr_KeyValueType() { Console.Out.WriteLine("serialization xr_KeyValueType"); KeyValueType r = new KeyValueType(); XmlSerializer xr = new XmlSerializer(typeof(KeyValueType)); StringWriter sw = new StringWriter(); xr.Serialize(sw, r); System.Console.Out.WriteLine(sw.ToString()); }
protected override void Proceed() { base.Proceed(); if (mKeyValueType == KeyValueType.Key) { mKeyValueType = KeyValueType.Value; } else { mKeyValueType = KeyValueType.Key; } }
private bool ReadKey() { bool result = TryReadPropertyName(); if (result) { mKeyValueType = KeyValueType.Value; } else { EndState(); } return(result); }
public ConsumerWrapper CreateConsumer(string name, IEnumerable <KeyValuePair <string, string> > config, KeyValueType keyType, KeyValueType valueType, TimeSpan expirationTimeout, string owner = null) { _logger.LogDebug("Creating consumer '{Name}'", name); var effectiveConfig = EffectiveConfig(_defaultConfig, config); var wrapper = new ConsumerWrapper(name, effectiveConfig, keyType, valueType, _schemaRegistryService.Client, expirationTimeout) { Owner = owner }; AddItem(wrapper); return(wrapper); }
private void parse(T t, string[] args) { CmdAttrMd lastMd = null; int noKeyMdIdx = 0; for (int i = 0; i < args.Length; ++i) { if (args[i] == "") { continue; } KeyValueType argType = getKeyValue(args[i], out string key, out string value); if (argType != KeyValueType.Value) { lastMd = findMd(key, ref noKeyMdIdx); } if (argType == KeyValueType.Value && lastMd == null) { lastMd = findMd(key, ref noKeyMdIdx); } if (lastMd == null) { continue; } if (argType == KeyValueType.Key && !lastMd.isBoolType) { continue; } setData(lastMd, t, value); if (lastMd.listMd == null) { lastMd = null; } } }
private bool Extraer(ref authTokenType token, string alias, ref byte[] modulus, ref byte[] exponent) { LunaXml.xmCryptoService client = new xmCryptoService(); try { extract ex = new extract(); ex.KeyAlias = alias; //ex.WrappingOptions = new WrappingOptionsType(); ex.AuthToken = token; var res = client.extract(ex); token = res.AuthToken; if (res.Result.ResultMajor != null && res.Result.ResultMajor == "urn:oasis:names:tc:dss:resultmajor:Success") { KeyValueType type = (KeyValueType)res.KeyInfo.Items[0]; RSAKeyValueType rsatype = (RSAKeyValueType)type.Item; modulus = rsatype.Modulus; exponent = rsatype.Exponent; return(true); } else { Log.Error((res.Result.ResultMessage != null ? res.Result.ResultMessage.Value : "")); return(false); } } catch (Exception ex) { Log.Error("Error al crear la llave privada " + ex); return(false); } finally { client.Dispose(); } }
public bool ReadAsBinary(Stream input) { this.Children = new List <KeyValue>(); try { while (true) { KeyValueType keyValueType = (KeyValueType)input.ReadValueU8(); if (keyValueType != KeyValueType.End) { KeyValue keyValue = new KeyValue(); keyValue.Type = keyValueType; keyValue.Name = input.ReadStringUTF8Z(); switch (keyValueType) { case KeyValueType.None: keyValue.ReadAsBinary(input); break; case KeyValueType.String: keyValue.Valid = true; keyValue.Value = (object)input.ReadStringUTF8Z(); break; case KeyValueType.Int32: keyValue.Valid = true; keyValue.Value = (object)input.ReadValueS32(); break; case KeyValueType.Float32: keyValue.Valid = true; keyValue.Value = (object)input.ReadValueF32(); break; case KeyValueType.Pointer: keyValue.Valid = true; keyValue.Value = (object)input.ReadValueU32(); break; case KeyValueType.WideString: goto label_5; case KeyValueType.Color: keyValue.Valid = true; keyValue.Value = (object)input.ReadValueU32(); break; case KeyValueType.UInt64: keyValue.Valid = true; keyValue.Value = (object)input.ReadValueU64(); break; default: goto label_11; } if (input.Position < input.Length) { this.Children.Add(keyValue); } else { goto label_13; } } else { goto label_15; } } label_5: throw new FormatException("wstring is unsupported"); label_11: throw new FormatException(); label_13: throw new FormatException(); label_15: this.Valid = true; return(input.Position == input.Length); } catch (Exception ex) { return(false); } }
public bool GetKeyIv(string strDomain, string strApp, ref byte[] key, ref byte[] iv) { bool bSuccess = false; const string HTTP_PRE = "http://"; const string HTTPS_PRE = "https://"; try { if (strDomain.Length == 0 && strApp.Length == 0) { key = default_key; iv = default_iv; } else { if (strDomain.IndexOf(HTTP_PRE) == 0 || strDomain.IndexOf(HTTPS_PRE) == 0) { if (!KeyRepo_.ContainsKey(strApp)) { CacheKeyRepo(strDomain); } KeyValueType keyv = new KeyValueType(); if (!KeyRepo_.TryGetValue(strApp, out keyv)) { throw new Exception(); } key = keyv.Key; iv = keyv.Value; } else { string strSubKey = SUBKEYROOT + strDomain; RegistryKey SubKeyDefault = Registry.LocalMachine.OpenSubKey(strSubKey, false); if (SubKeyDefault == null) { throw new Exception(); } RegistryKey RKey = SubKeyDefault.OpenSubKey(strApp, false); if (RKey == null) { throw new Exception(); } key = (byte[])RKey.GetValue("key"); iv = (byte[])RKey.GetValue("iv"); if (key == null || iv == null) { throw new Exception(); } } } bSuccess = true; } catch (Exception) { } return(bSuccess); }
public ValueTypeProxy(KeyValue kv) { _key = kv.Key; _type = kv.Type; _value = kv.GetValue(true); }
public void AppendRow(int keyPos, int keyLength, KeyValueType type, int valuePos, int valueLength) { ref DbRow row = ref AppendRow();