public ControlManifestDetails FetchTypeGroups(ControlManifestDetails controlDetails) { XmlDocument manifestFile = new XmlDocument(); manifestFile.Load(controlDetails.ManifestFilePath); XmlNodeList tgNodes = manifestFile.SelectNodes("/manifest/control/type-group"); foreach (XmlNode node in tgNodes) { TypeGroup typegroup = new TypeGroup(); try { typegroup.Name = (node.Attributes["name"]?.Value) ?? string.Empty; XmlNodeList typeNodes = manifestFile.SelectNodes($"manifest/control/type-group[@name='{typegroup.Name}']/type"); foreach (XmlNode type in typeNodes) { typegroup.Types.Add(type.InnerText); } controlDetails.TypeGroups.Add(typegroup); } catch (Exception ex) { } } return(controlDetails); }
public static object Call(CodeContext/*!*/ context, TypeGroup/*!*/ self, params object[] args) { return PythonCalls.Call( context, DynamicHelpers.GetPythonTypeFromType(self.NonGenericType), args ?? ArrayUtils.EmptyObjects ); }
private TypeGroup _typeGroup; // тип нефтепродукта public FindPlotnostForAreometr(IAreometr areometr, double plotnostAreometr, double tIzm, TypeGroup typeGroup) { _tIzm = tIzm; _areometr = areometr; _plotnostAreometr = plotnostAreometr; _typeGroup = typeGroup; }
/*------------------------------------------------------------------------- * 타입の그룹を문자열に변환する * ---------------------------------------------------------------------------*/ static public string ToString(TypeGroup tg) { switch (tg) { case TypeGroup.All: return("전종류"); case TypeGroup.CityName: return("도시명"); case TypeGroup.UseLang: return("사용언어"); case TypeGroup.Trade: return("교역품"); case TypeGroup.Item: return("아이템"); case TypeGroup.Equip: return("장비"); case TypeGroup.Ship: return("배"); case TypeGroup.Rigging: return("艤装"); case TypeGroup.Skill: return("스킬"); case TypeGroup.Report: return("보고"); case TypeGroup.Technic: return("테크닉"); default: return("불명"); } }
public static Type ConvertToType(object value) { if (value == null) { return(null); } Type TypeVal = value as Type; if (TypeVal != null) { return(TypeVal); } PythonType pythonTypeVal = value as PythonType; if (pythonTypeVal != null) { return(pythonTypeVal.UnderlyingSystemType); } TypeGroup typeCollision = value as TypeGroup; if (typeCollision != null) { Type nonGenericType; if (typeCollision.TryGetNonGenericType(out nonGenericType)) { return(nonGenericType); } } throw MakeTypeError("Type", value); }
/*------------------------------------------------------------------------- * ItemDb.txt から구축 * ---------------------------------------------------------------------------*/ public bool CreateFromString(string line) { string[] tmp = line.Split(new char[] { ',' }); if (tmp.Length < 4) { return(false); } try{ m_id = Useful.ToInt32(tmp[0].Trim(), 0); m_type = tmp[1].Trim(); m_name = tmp[2].Trim(); m_document = ""; for (int i = 3; i < tmp.Length; i++) { m_document += tmp[i].Trim() + "\n"; } if (m_document.IndexOf("다시사용시간:") >= 0) { // 다시사용시간:が含まれれば陸戦아이템とする m_is_combat_item = true; } // 교역품時の카테고리 m_categoly = ItemDatabase.GetCategolyFromType(m_type); // 종류の그룹 m_type_group = ItemDatabase.GetTypeGroupFromType(m_type); m_type_group2 = ItemDatabase.GetTypeGroupFromType2(m_type); }catch { return(false); } return(true); }
/*------------------------------------------------------------------------- * タイプのグループを文字列に変換する * ---------------------------------------------------------------------------*/ static public string ToString(TypeGroup tg) { switch (tg) { case TypeGroup.All: return("全ての種類"); case TypeGroup.CityName: return("街名等"); case TypeGroup.UseLang: return("使用言語"); case TypeGroup.Trade: return("交易品"); case TypeGroup.Item: return("アイテム"); case TypeGroup.Equip: return("装備"); case TypeGroup.Ship: return("船"); case TypeGroup.Rigging: return("艤装"); case TypeGroup.Skill: return("スキル"); case TypeGroup.Report: return("報告"); case TypeGroup.Technic: return("陸戦テクニック"); default: return("不明"); } }
public static PythonType GetItem(TypeGroup self, params object[] types) { PythonType[] pythonTypes = new PythonType[types.Length]; for (int i = 0; i < types.Length; i++) { object t = types[i]; if (t is PythonType) { pythonTypes[i] = (PythonType)t; continue; } else if (t is TypeGroup) { TypeGroup typeGroup = t as TypeGroup; Type nonGenericType; if (!typeGroup.TryGetNonGenericType(out nonGenericType)) { throw PythonOps.TypeError("cannot use open generic type {0} as type argument", typeGroup.Name); } pythonTypes[i] = DynamicHelpers.GetPythonTypeFromType(nonGenericType); } else { throw PythonOps.TypeErrorForTypeMismatch("type", t); } } return(GetItemHelper(self, pythonTypes)); }
public static MutableString /*!*/ Inspect(RubyContext /*!*/ context, TypeGroup /*!*/ self) { var result = MutableString.CreateMutable(context.GetIdentifierEncoding()); result.Append("#<TypeGroup: "); bool isFirst = true; foreach (var entry in self.TypesByArity.ToSortedList((x, y) => x.Key - y.Key)) { Type type = entry.Value; if (!isFirst) { result.Append(", "); } else { isFirst = false; } result.Append(context.GetTypeName(type, true)); } result.Append('>'); return(result); }
/// <summary> /// 更新TypeGroup /// </summary> /// <param name="TypeGroup">type_group</param> public int UpdateTypeGroup(TypeGroup typegroup) { int i = ExecuteUpdate("UpdateTypeGroup", typegroup); typegroup.IdOld = typegroup.Id; return(i); }
private static void TypeInfo(object value, Type fieldType, out TypeGroup typeGroup, out Type valueType) { if (fieldType == typeof(object)) { if (value != null) { if (value.GetType() == typeof(string)) { typeGroup = TypeGroup.Value; valueType = typeof(string); return; } if (value.GetType() == typeof(int) || value.GetType() == typeof(double) || value.GetType() == typeof(Int64)) { typeGroup = TypeGroup.Value; valueType = typeof(double); return; } if (value.GetType() == typeof(bool)) { typeGroup = TypeGroup.Value; valueType = typeof(bool); return; } } } if (fieldType.GetTypeInfo().IsValueType) { typeGroup = TypeGroup.Value; valueType = fieldType; return; } if (fieldType.GetTypeInfo().IsGenericType&& fieldType.GetTypeInfo().GetGenericTypeDefinition() == typeof(List <>)) { typeGroup = TypeGroup.List; valueType = fieldType.GetTypeInfo().GetGenericArguments().First(); return; } if (fieldType.GetTypeInfo().IsGenericType&& fieldType.GetTypeInfo().GetGenericTypeDefinition() == typeof(Dictionary <,>)) { typeGroup = TypeGroup.Dictionary; valueType = fieldType.GetTypeInfo().GetGenericArguments()[1]; return; } if (fieldType == typeof(string)) { typeGroup = TypeGroup.Value; valueType = fieldType; return; } if (fieldType.GetTypeInfo().GetConstructors().Count() > 0) { typeGroup = TypeGroup.Object; valueType = fieldType; return; } valueType = null; typeGroup = TypeGroup.None; }
private TypeGroup _typeGroup; // тип нефтепродукта public FindPlotnostForPlotnometr(double davlenie, double plotnostPlotnometr, double tIzm, double pogreshnost, TypeGroup typeGroup) { _tIzm = tIzm; _davlenie = davlenie; _plotnostPlotnometr = plotnostPlotnometr; _pogreshnost = pogreshnost; _typeGroup = typeGroup; }
public static object Call(CodeContext/*!*/ context, TypeGroup/*!*/ self, [ParamDictionary]PythonDictionary kwArgs, params object[] args) { return PythonCalls.CallWithKeywordArgs( context, DynamicHelpers.GetPythonTypeFromType(self.NonGenericType), args ?? ArrayUtils.EmptyObjects, kwArgs ?? new PythonDictionary() ); }
public static object Call(CodeContext /*!*/ context, TypeGroup /*!*/ self, params object[] args) { return(PythonCalls.Call( context, DynamicHelpers.GetPythonTypeFromType(self.GetNonGenericType()), args ?? ArrayUtils.EmptyObjects )); }
/// <summary> /// Instantiates a new operation. /// </summary> /// <param name="name">Conditions name.</param> /// <param name="numberOfValues">Number of values supported by the operation.</param> /// <param name="typeGroups">TypeGroup(s) which the operation supports.</param> /// <param name="active">Determines if the operation is active.</param> /// <param name="supportsLists">Determines if the operation supports arrays.</param> /// <param name="expectNullValues"></param> protected ConditionBase(string name, int numberOfValues, TypeGroup typeGroups, bool active = true, bool supportsLists = false, bool expectNullValues = false) { Name = name; NumberOfValues = numberOfValues; TypeGroup = typeGroups; Active = active; SupportsLists = supportsLists; ExpectNullValues = expectNullValues; }
public static PythonType GetItem(TypeGroup self, PythonTuple tuple) { if (tuple.__len__() == 0) { return(DynamicHelpers.GetPythonTypeFromType(self.GetNonGenericType())); } return(GetItem(self, tuple._data)); }
/// <summary> /// Initializes a new instance of the <see cref="OperationBase"/> class. /// Instantiates a new operation. /// </summary> /// <param name="name">Operations name.</param> /// <param name="numberOfValues">Number of values supported by the operation.</param> /// <param name="typeGroups">TypeGroup(s) which the operation supports.</param> /// <param name="active">Determines if the operation is active.</param> /// <param name="supportsLists">Determines if the operation supports arrays.</param> /// <param name="expectNullValues"></param> protected OperationBase(string name, int numberOfValues, TypeGroup typeGroups, bool active = true, bool supportsLists = false, bool expectNullValues = false) { this.Name = name; this.NumberOfValues = numberOfValues; this.TypeGroup = typeGroups; this.Active = active; this.SupportsLists = supportsLists; this.ExpectNullValues = expectNullValues; }
public static object Call(CodeContext /*!*/ context, TypeGroup /*!*/ self, [ParamDictionary] PythonDictionary kwArgs, params object[] args) { return(PythonCalls.CallWithKeywordArgs( context, DynamicHelpers.GetPythonTypeFromType(self.GetNonGenericType()), args ?? ArrayUtils.EmptyObjects, kwArgs ?? new PythonDictionary() )); }
public static RubyClass /*!*/ GetNonGenericClass(RubyContext /*!*/ context, TypeGroup /*!*/ typeGroup) { Type type = GetNonGenericType(typeGroup); if (type.IsInterface) { throw RubyExceptions.CreateTypeError("cannot instantiate an interface"); } return(context.GetClass(type)); }
private void Initialise(Type baseType) { this.baseType = baseType; baseTypeGroup = new TypeGroup(baseType, TargetAssembly.GetTypes().Where(type => type.IsSubclassOf(baseType) || (type == baseType)).ToArray()); currentTargetName = $"New{this.baseType.Name}"; if (!TryGetPredictedPath()) { currentTargetPath = $"{Application.dataPath}/{SETTINGS_FOLDER}"; } }
private static object New(string /*!*/ methodName, CallSiteStorage <Func <CallSite, object, object, object, object> > /*!*/ storage, BlockParam block, TypeGroup /*!*/ self, params object[] /*!*/ args) { var cls = GetNonGenericClass(storage.Context, self); var site = storage.GetCallSite(methodName, new RubyCallSignature(1, RubyCallFlags.HasImplicitSelf | RubyCallFlags.HasSplattedArgument | RubyCallFlags.HasBlock) ); return(site.Target(site, cls, block != null ? block.Proc : null, RubyOps.MakeArrayN(args))); }
public static RubyModule /*!*/ Of(RubyContext /*!*/ context, TypeGroup /*!*/ self, int genericArity) { TypeTracker tracker = self.GetTypeForArity(genericArity); if (tracker == null) { throw RubyExceptions.CreateArgumentError("Type group `{0}' does not contain a type of generic arity {1}", self.Name, genericArity); } return(context.GetModule(tracker.Type)); }
private TypeGroup GetTypeGroup(Type type) { TypeGroup typeGroup; if (!this.typeGroupsByType.TryGetValue(type, out typeGroup)) { typeGroup = TypeGroup.Create(type); this.typeGroupsByType[type] = typeGroup; } return(typeGroup); }
private static Type /*!*/ GetNonGenericType(TypeGroup /*!*/ self) { TypeTracker type = self.GetTypeForArity(0); if (type == null) { throw RubyExceptions.CreateTypeError("type group doesn't include non-generic type"); } return(type.Type); }
public int Compare(object obj1, object obj2) { Type t1 = obj1 as Type; Type t2 = obj2 as Type; // these are used to group by (for example all enums together) TypeGroup t1Group = TypeComparer.GetGroupForType(t1); TypeGroup t2Group = TypeComparer.GetGroupForType(t2); if (t2Group != t1Group) { return(((int)t1Group) < ((int)t2Group) ? -1 : 1); } return(t1.Name.CompareTo(t2.Name)); }
public TypeGroup GetChildGroup(string name) { for (int i = 0; i < this.SubGroups.Count; i++) { if (this.SubGroups[i].Name == name) { return(this.SubGroups[i]); } } TypeGroup newGroup = new TypeGroup(name); this.SubGroups.Add(newGroup); return(newGroup); }
public static string __repr__(TypeGroup self) { StringBuilder sb = new StringBuilder("<types "); bool pastFirstType = false; foreach(Type type in self.Types) { if (pastFirstType) { sb.Append(", "); } PythonType dt = DynamicHelpers.GetPythonTypeFromType(type); sb.Append('\''); sb.Append(dt.Name); sb.Append('\''); pastFirstType = true; } sb.Append(">"); return sb.ToString(); }
private bool SetInventoryTargets(Agent agent, Mapping mapping, InputCondition inputCondition) { List <Entity> possibleTargets; List <KeyValuePair <Entity, float> > targetsRanked; List <TypeGroup> groupings = inputCondition.InventoryTypeGroups(mapping.mappingType, out List <int> indexesToSet); // Target is from the agent's inventory if the input condition does not require an Entity Target if (!inputCondition.RequiresEntityTarget()) { List <EntityType> allAgentInventoryEntityTypes = agent.inventoryType.GetAllEntityTypes(agent); List <Entity> allAgentInventoryEntities = agent.inventoryType.GetAllEntities(agent, true); List <EntityType> entityTypes = TypeGroup.InAllTypeGroups(groupings, allAgentInventoryEntityTypes); possibleTargets = allAgentInventoryEntities.Where(x => entityTypes.Contains(x.entityType)).ToList(); } else { List <EntityType> entityTypes = mapping.target.inventoryType.GetAllEntityTypes(mapping.target); entityTypes = TypeGroup.InAllTypeGroups(groupings, entityTypes); possibleTargets = mapping.target.inventoryType.GetAllEntities(mapping.target, entityTypes, false); } if (possibleTargets.Count == 0) { return(false); } targetsRanked = SelectTarget(agent, mapping, possibleTargets, true); if (targetsRanked != null) { // TODO: Handle more selection algorithms - this is just best Entity target = targetsRanked[0].Key; foreach (int index in indexesToSet) { mapping.inventoryTargets[index] = target; } } else { Debug.Log(agent.name + ": UtilityAIPT.BestInventoryTargets unable to find target - MT = " + mapping.mappingType); return(false); } return(true); }
private static PythonType GetItemHelper(TypeGroup self, PythonType[] types) { TypeTracker genType = self.GetTypeForArity(types.Length); if (genType == null) { throw new ValueErrorException(String.Format("could not find compatible generic type for {0} type arguments", types.Length)); } Type res = genType.Type; if (types.Length != 0) { res = res.MakeGenericType(PythonTypeOps.ConvertToTypes(types)); } return(DynamicHelpers.GetPythonTypeFromType(res)); }
private void Calc(TypeGroup typeGroup, double plotnost) { if (typeGroup == TypeGroup.Neft && plotnost >= 611.2 && plotnost < 1163.8) { K0 = 613.9723; K1 = 0; K2 = 0; } else if (typeGroup == TypeGroup.NefteProdukt) { if (plotnost >= 611.2 && plotnost < 770.9) { K0 = 346.4228; K1 = 0.43884; K2 = 0; } else if (plotnost >= 770.9 && plotnost < 788) { K0 = 2690.7440; K1 = 0; K2 = -0.0033762; } else if (plotnost >= 788 && plotnost < 838.7) { K0 = 594.5418; K1 = 0; K2 = 0; } else if (plotnost >= 838.7 && plotnost < 1163.9) { K0 = 186.9696; K1 = 0.4862; K2 = 0; } } else if (typeGroup == TypeGroup.Maslo && plotnost >= 838.7 && plotnost < 1163.9) { K0 = 186.9696; K1 = 0.4862; K2 = 0; } }
private static IEnumerable <TypeDrawerPair> GetEditorsForCompilation(TypeGroup group) { foreach (var type in group.SubTypes) { var editor = InspectorConfig.Instance.DrawingConfig.GetEditorType(type.DrawnType); if (editor != null && editor != typeof(InspectorTypeDrawingConfig.MissingEditor)) { yield return(new TypeDrawerPair(type.DrawnType, editor)); } } foreach (var subGroup in group.SubGroups) { foreach (var pair in GetEditorsForCompilation(subGroup)) { yield return(pair); } } }
public static string __repr__(TypeGroup self) { StringBuilder sb = new StringBuilder("<types "); bool pastFirstType = false; foreach (Type type in self.Types) { if (pastFirstType) { sb.Append(", "); } PythonType dt = DynamicHelpers.GetPythonTypeFromType(type); sb.Append('\''); sb.Append(dt.Name); sb.Append('\''); pastFirstType = true; } sb.Append(">"); return(sb.ToString()); }
/// <summary> /// 插入type_group /// </summary> /// <param name="typegroup">type_group</param> public void InsertTypeGroup(TypeGroup typegroup) { try { _daoManager.BeginTransaction(); _iTypeGroupDao.InsertTypeGroup(typegroup); if (typegroup.NewsType != null) { foreach (NewsType newstype in typegroup.NewsType) { _iNewsTypeDao.InsertNewsType(newstype); } } _daoManager.CommitTransaction(); } catch (Exception ex) { _daoManager.RollBackTransaction(); throw ex; } }
public static PythonType GetItem(TypeGroup self, params object[] types) { PythonType[] pythonTypes = new PythonType[types.Length]; for(int i = 0; i < types.Length; i++) { object t = types[i]; if (t is PythonType) { pythonTypes[i] = (PythonType)t; continue; } else if (t is TypeGroup) { TypeGroup typeGroup = t as TypeGroup; Type nonGenericType; if (!typeGroup.TryGetNonGenericType(out nonGenericType)) { throw PythonOps.TypeError("cannot use open generic type {0} as type argument", typeGroup.Name); } pythonTypes[i] = DynamicHelpers.GetPythonTypeFromType(nonGenericType); } else { throw PythonOps.TypeErrorForTypeMismatch("type", t); } } return GetItemHelper(self, pythonTypes); }
public static PythonType GetItem(TypeGroup self, PythonTuple tuple) { if (tuple.__len__() == 0) { return DynamicHelpers.GetPythonTypeFromType(self.NonGenericType); } return GetItem(self, tuple._data); }
/// <summary> /// Добавляет колонку в Footer /// </summary> /// <param name="value">имя колонки</param> public void AddFooter(string value) { if (type == TypeGroup.HEADER) { type = TypeGroup.HEADERFOOTER; }else if (type != TypeGroup.HEADERFOOTER) type = TypeGroup.FOOTER; if (arrayF == null) { arrayF = new ArrayList(); } arrayF.Add(new ValueGroup(value)); }
/// <summary> /// Добавляет колонку в Header /// </summary> /// <param name="value">Имя колонки</param> public void AddHeader(string value) { type = TypeGroup.HEADER; if (arrayH == null) { arrayH = new ArrayList(); } arrayH.Add(new ValueGroup(value)); }
public static PythonType GetItem(TypeGroup self, params PythonType[] types) { return GetItemHelper(self, types); }
private static PythonType GetItemHelper(TypeGroup self, PythonType[] types) { TypeTracker genType = self.GetTypeForArity(types.Length); if (genType == null) { throw new ValueErrorException(String.Format("could not find compatible generic type for {0} type arguments", types.Length)); } Type res = genType.Type; if (types.Length != 0) { res = res.MakeGenericType(PythonTypeOps.ConvertToTypes(types)); } return DynamicHelpers.GetPythonTypeFromType(res); }
/// <summary> /// Добавлет колонку в Contain /// </summary> /// <param name="value">Имя колонки</param> public void AddContain(string value) { type = TypeGroup.CONTAIN; if (arrayH == null) { arrayH = new ArrayList(); } arrayH.Add(new ValueGroup(value)); }