/// <summary> /// 解析设置 /// </summary> /// <param name="settings"> 待解析的字符串 </param> /// <returns></returns> public ParseResult Parse(IEnumerable <string> settings) { if (settings == null) { return(new ParseResult(new NameDictionary())); } try { var items = new NameDictionary(); var builder = new DbConnectionStringBuilder(); foreach (var setting in settings) { builder.ConnectionString = setting; foreach (string key in builder.Keys) { items[key] = builder[key]; } } return(new ParseResult(items)); } catch (Exception ex) { return(new ParseResult(ex)); } }
public static String GetDescription(this uint identifier, ContainerType map, Dictionary <uint, string> customDict = null) { Dictionary <uint, string> NameDictionary = new Dictionary <uint, string>(); if (customDict == null) { switch (map) { case ContainerType.SummaryInfo: NameDictionary = CommonIdentifiers.PropertyIdentifiersSummaryInfo; break; case ContainerType.DocumentSummaryInfo: NameDictionary = CommonIdentifiers.PropertyIdentifiersDocumentSummaryInfo; break; } } else { NameDictionary = customDict; } if (NameDictionary.ContainsKey(identifier)) { return(NameDictionary[identifier]); } return("0x" + identifier.ToString("x8")); }
public VmdExpressionFrame(BinaryReader reader) { byte[] buf = reader.ReadBytes(15); expressionName = FileEncoding.GetString(buf, 0, Array.IndexOf(buf, (byte)0)); expressionName = NameDictionary.ToEnglish(expressionName); frameNumber = reader.ReadInt32(); weight = reader.ReadSingle(); }
public DataRecordConverterTypeBuilder(DataRecordConverterSpec queryInfo) { _queryInfo = Verify.ArgumentNotNull(queryInfo, "queryInfo"); PropertyInfo[] properties = queryInfo.RecordType.GetProperties(); var propertyMap = new NameDictionary<PropertyInfo>(); var dataRecordMap = new NameDictionary<DataRecordFieldInfo>(); foreach (DataRecordFieldInfo field in queryInfo.Fields) { dataRecordMap.Add(field.FieldName, field); } foreach (PropertyInfo property in properties) { if (property.HasPublicSetter()) { propertyMap.Add(property.Name, property); } } foreach (DataRecordFieldInfo field in queryInfo.Fields) { var propertyList = new PropertyList(queryInfo.RecordType, field.FieldName); if (propertyList.HasErrors) { _errors.AddRange(propertyList.Errors); } else if (DataRecordConverterMethod.CanHandleConversion(field.FieldType, propertyList.PropertyType)) { _mapFieldToProperty.Add(field, propertyList); } else { _errors.Add(string.Format("Cannot convert from {0} to {1} for {2}", field.FieldType.Name, propertyList.PropertyType.Name, field.FieldName)); } } foreach (PropertyInfo property in properties) { if (property.HasPublicSetter()) { DataRecordFieldInfo field; if (dataRecordMap.TryGetValue(property.Name, out field)) { _mapPropertyToField.Add(property, field); } else { _errors.Add(string.Format("Query result does not have a column named '{0}'", property.Name)); } } } }
public Selector(ApiContainer container, string urlTemplate) { if (urlTemplate == null) { throw new ArgumentNullException(nameof(urlTemplate)); } _urlTemplate = urlTemplate.ToLowerInvariant(); _container = container ?? throw new ArgumentNullException(nameof(container)); Data = new NameDictionary(); }
public object DoConvert(string path, CodeTree codeTree, object value, Type targetType, object parameter, CultureInfo culture) { var parameters = new NameDictionary { { "@Value", value }, { "@TargetType", targetType }, { "@Parameter", parameter }, { "@Culture", culture }, }; return new Engine().FrameFunc(this, parameters, engine => engine.GetPath(path, codeTree)); }
public PmdSkin(BinaryReader reader) { byte[] buf = reader.ReadBytes(20); name = FileEncoding.GetString(buf, 0, Array.IndexOf(buf, (byte)0)); name = NameDictionary.ToEnglish(name); skinSize = reader.ReadUInt32(); parm = reader.ReadByte(); for (int i = 0; i < skinSize; i++) { verts.Add(new PmdSkinVertex(reader)); } }
public ContextClass(ContextFile fileContext) { FileContext = fileContext; PropertyContext = new PropertyContextCollection(); PropertyContext.ClassContext = this; ProcManagerContext = new ProcContextCollection(); ProcManagerContext.ClassContext = this; EmitContext = new ClassEmitContext(); MemberDictionary = new NameDictionary <SymbolDefMember>(); CurrentTable = new ClassSymbolTable("Class"); }
public MemorySession(string sessionid, int expireSeconds, Func <string> getNewSessionId) { _getNewSessionId = getNewSessionId ?? throw new ArgumentNullException(nameof(getNewSessionId)); SessionId = string.IsNullOrWhiteSpace(sessionid) ? getNewSessionId() : sessionid; _dictionary = _cache[SessionId] as NameDictionary; if (_dictionary == null) { _dictionary = new NameDictionary(); _cache.Add(SessionId, _dictionary, new CacheItemPolicy { SlidingExpiration = TimeSpan.FromSeconds(expireSeconds), }); IsNewSession = true; } }
public List <Tuple <string, string, string> > Elaborate() { var result = new List <Tuple <string, string, string> >(); foreach (var fn in FullNames) { var tokens = FullNamePart.Tokenize(fn).ToArray(); var surnames = SurnameDictionary.GetPart(fn, tokens).ToArray(); var names = NameDictionary.GetPart(fn, tokens).Except(surnames).ToArray(); var unclassified = tokens.Except(names).Except(surnames).ToArray(); var t = ChoosingStrategy(names, surnames, unclassified, tokens, Separator); result.Add(Tuple.Create(fn, t.Item1, t.Item2)); } return(result); }
public VmdHeader(BinaryReader reader) { byte[] buf; buf = reader.ReadBytes(26); headerString = FileEncoding.GetString(buf, 0, Array.IndexOf(buf, (byte)0)); padding = reader.ReadBytes(4); if (headerString == "Vocaloid Motion Data file") { pmdModelNameLength = 10; } else { pmdModelNameLength = 20; } buf = reader.ReadBytes(pmdModelNameLength); pmdModelName = FileEncoding.GetString(buf, 0, Array.IndexOf(buf, (byte)0)); pmdModelName = NameDictionary.ToEnglish(pmdModelName); }
/// <summary> /// .NET目标框架的版本属性构造函数 /// </summary> /// <param name="frameworkName"></param> /// <param name="displayName"></param> public TargetFramework(string frameworkName, string?displayName) { const string vStartsWith = "Version=v"; Version? version = null; var array = Split(frameworkName); if (array?.Length >= 2) { FrameworkName = NameDictionary.FirstOrDefault(x => x.Value == array[0]).Key; if (FrameworkName == Name.Xamarin_iOS) { version = SetVersionByFindSdkAssemblyVersionAttribute("Xamarin.iOS"); } if (FrameworkName == Name.MonoAndroid) { version = SetVersionByFindSdkAssemblyVersionAttribute("Mono.Android"); } if (version == null) { var versionString = array[1]; if (versionString.StartsWith(vStartsWith)) { version = GetVersion(versionString[vStartsWith.Length..]);
public VmdBoneFrame(BinaryReader reader) { byte[] buf = reader.ReadBytes(15); boneName = FileEncoding.GetString(buf, 0, Array.IndexOf(buf, (byte)0)); boneName = NameDictionary.ToEnglish(boneName); frameNumber = reader.ReadInt32(); float x, y, z, w; x = reader.ReadSingle(); y = reader.ReadSingle(); z = reader.ReadSingle(); position = new Vector3D(x, y, z); x = reader.ReadSingle(); y = reader.ReadSingle(); z = reader.ReadSingle(); w = reader.ReadSingle(); orientation = new Quaternion(x, y, z, w); padding = reader.ReadBytes(64); }
public PmdBone(BinaryReader reader) { byte[] buf = reader.ReadBytes(20); name = FileEncoding.GetString(buf, 0, Array.IndexOf(buf, (byte)0)); name = NameDictionary.ToEnglish(name); for (int i = 0; i < data.Length; i++) { int v = reader.ReadUInt16(); if (v == UInt16.MaxValue) { v = -1; } data[i] = v; } kind = reader.ReadByte(); knum = reader.ReadUInt16(); for (int i = 0; i < pos.Length; i++) { pos[i] = reader.ReadSingle(); } }
private IDictionary<string, object> GetBasicVariables() { var viewModel = new BasicViewModel { String1 = "Test1", Object1 = new BasicViewModel { String1 = "Test2" }, }; var names = new NameDictionary { { Engine.ContextKey, viewModel }, { "$variable1", "Value1" }, }; return names; }
protected Convert3Proxy(string name) { Name = name; Data = new NameDictionary(); }
static DataManager() { using (FileStream fs = new FileStream(@".\Data\data_large.json", FileMode.Open, FileAccess.Read)) using (StreamReader sr = new StreamReader(fs)) using (JsonTextReader reader = new JsonTextReader(sr)) { reader.Read(); if (reader.TokenType == JsonToken.StartObject) { while (reader.Read()) { if (reader.TokenType == JsonToken.StartObject) { JsonSerializer serializer = new JsonSerializer(); var place = serializer.Deserialize <Place>(reader); PlaceDictionary[place.ID] = place; } else if (reader.TokenType == JsonToken.EndArray) { break; } } } while (reader.Read()) { if (reader.TokenType == JsonToken.StartObject) { JsonSerializer serializer = new JsonSerializer(); var person = serializer.Deserialize <Person>(reader); if (person.Place_Id.HasValue && PlaceDictionary.ContainsKey(person.Place_Id.Value)) { person.PlaceObj = PlaceDictionary[person.Place_Id.Value]; } PersonDictionary[person.ID] = person; if (!NameDictionary.ContainsKey(person.Name)) { NameDictionary[person.Name] = person.ID; } if (!DirectAncestors.ContainsKey(person.ID)) { DirectAncestors[person.ID] = new HashSet <int>(); } var fatherId = person.Father_Id ?? -1; if (fatherId != -1) { if (!DirectDesendants.ContainsKey(fatherId)) { DirectDesendants[fatherId] = new HashSet <int>(); } DirectAncestors[person.ID].Add(fatherId); DirectDesendants[fatherId].Add(person.ID); } var motherId = person.Mother_Id ?? -1; if (motherId != -1) { if (!DirectDesendants.ContainsKey(motherId)) { DirectDesendants[motherId] = new HashSet <int>(); } DirectAncestors[person.ID].Add(motherId); DirectDesendants[motherId].Add(person.ID); } } } } }
public DefaultInvoker() { Data = new NameDictionary(); }
public Selector(ApiContainer container) { _container = container ?? throw new ArgumentNullException(nameof(container)); Data = new NameDictionary(); _route = new RouteTable(_container.Apis); }
protected DescriptorBase() { Extends = new NameDictionary(); }
private DefaultIApiClassDescriptorFactory() { Data = new NameDictionary(); }