private IList <RegisterMeta> ConsumerRegisterMetaFactory(AssemblyPart part) { var types = part.Types; List <RegisterMeta> meta = new List <RegisterMeta>(); RegisterMeta tempMeta = null; foreach (var typeInfo in types) { if (!typeInfo.IsInterface || typeInfo.IsPrimitive) { continue; } foreach (var attr in typeInfo.CustomAttributes) { if (attr.AttributeType.Name != "ServiceConsumerAttribute") { continue; } tempMeta = new RegisterMeta(); foreach (var arg in attr.NamedArguments) { switch (arg.MemberName) { case "name": tempMeta.setName(arg.TypedValue.Value.ToString()); break; case "group": tempMeta.setGroup(arg.TypedValue.Value.ToString()); break; case "version": tempMeta.setVersion(arg.TypedValue.Value.ToString()); break; } } meta.Add(tempMeta); } } return(meta); }
private RegisterMeta parseRegisterMeta(String data) { String[] array_0 = data.Split('/'); RegisterMeta meta = new RegisterMeta(); meta.setGroup(array_0[3]); meta.setName(array_0[4]); meta.setVersion(array_0[5]); String[] array_1 = array_0[6].Split(':'); meta.setHost(array_1[0]); meta.setPort(Convert.ToInt32(array_1[1])); meta.setWeight(Convert.ToInt32(array_1[2])); meta.setConnCount(Convert.ToInt32(array_1[3])); return(meta); }