public static void DoWithSwDoc(SldWorks swApp, CompType docType, string docId, Act doWithDoc) { var doc = swApp.IActiveDoc2; var select = doc.Extension.SelectByID2(docId + "@" + doc.GetTitle(), DocCompName(docType), 0, 0, 0, true, 0, null, 0); if (!select) return; if (doWithDoc == Act.DoNothing) { doc.ClearSelection2(true); return; } switch (doWithDoc) { case Act.Delete: doc.EditDelete(); break; case Act.DeletWithOption: const int deleteOption = (int)swDeleteSelectionOptions_e.swDelete_Absorbed + (int)swDeleteSelectionOptions_e.swDelete_Children; doc.Extension.DeleteSelection2(deleteOption); break; case Act.Unsuppress: doc.EditUnsuppress2(); break; case Act.Suppress: doc.EditSuppress2(); break; default: break; } doc.ClearSelection2(true); }
public override void Deserialize(GenericReader reader) { base.Deserialize(reader); int version = reader.ReadInt(); mCompetence = (CompType)reader.ReadInt(); }
public CompNamed(string name, CompType type) { this.DisplayName = null; this.name = name; this.type = type; this.todos = new List <string>(); }
/// <summary> /// HELPER: uses foreign object contents to build up a Result record /// </summary> /// <param name="data"> package of foreign objects to de/re-structure </param> /// <returns> result record </returns> public async Task <Result> BuildResultObject(List <object> data) { JObject comp = JObject.Parse(data[0].ToString()); JObject participant = JObject.Parse(data[1].ToString()); JObject compreg = JObject.Parse(data[2].ToString()); Result result = new Result(); result.CompetitorID = (int)participant["WSC_ID"]; CompType a = (CompType)(int)comp["CompType"]; Level b = (Level)(int)comp["Level"]; int c = (int)compreg["EventID"]; EventCompetition d = await GetCompetition(a, b, c); Competitor e = await GetCompetitor(result.CompetitorID); result.EventCompetition = d; result.EventCompetitionID = d.ID; result.Role = (Role)((int)compreg["Role"]); result.Competitor = e; result.Placement = (Placement)((int)compreg["Placement"]); result.ScoreChief = (int)compreg["ChiefJudgeScore"]; result.ScoreOne = (int)compreg["JudgeOneScore"]; result.ScoreTwo = (int)compreg["JudgeTwoScore"]; result.ScoreThree = (int)compreg["JudgeThreeScore"]; result.ScoreFour = (int)compreg["JudgeFourScore"]; result.ScoreFive = (int)compreg["JudgeFiveScore"]; result.ScoreSix = (int)compreg["JudgeSixScore"]; return(result); }
public static LiteralFilter Create(CompType type, object value) { if (value is string) { return(new StringCompareFilter((string)value, type)); } if (value is decimal || value is byte || value is sbyte || value is short || value is ushort || value is int || value is uint || value is long || value is ulong || value is float || value is double) { return(new NumericCompareFilter(((IConvertible)value).ToDecimal(null), type)); } if (value is DateTime) { return(new DateTimeCompareFilter((DateTime)value, type)); } if (value is TimeSpan) { return(new TimeSpanCompareFilter((TimeSpan)value, type)); } throw new ArgumentException("Invalid type: " + value.GetType()); }
public MasterClass(XMLClass cls, CompType type) : base(cls.name, type) { xml_cls = cls; interfaces = new List <CompNamed>(); constructors = new List <CompNamed>(); methods = new List <CompNamed>(); properties = new List <CompNamed>(); fields = new List <CompNamed>(); events = new List <CompNamed>(); MasterUtils.PopulateMemberLists(xml_cls, interfaces, constructors, methods, properties, fields, events); delegate_list = new List <CompNamed>(); enum_list = new List <CompNamed>(); class_list = new List <CompNamed>(); struct_list = new List <CompNamed>(); interface_list = new List <CompNamed>(); MasterUtils.PopulateTypeLists(xml_cls, class_list, enum_list, delegate_list, interface_list, struct_list); }
public static SortEnergie[] getAdaptedComp(SortNubia originale, NubiaPlayer eleve) { //SortNubia newSortNubia = (SortNubia)KonohaHelper.CopyItem(originale); ArrayList compPoss = new ArrayList(); for (int i = 0; i < originale.allowCompetence.Length; i++) { CompType comp = (CompType)originale.allowCompetence[i]; Console.WriteLine("Competence autorisé pour le SortNubia: " + comp.ToString()); //if(eleve.getValueFor(comp) > 0.0) //{ // Console.WriteLine("-- Competence Ok pour l'élève: "+comp.ToString() ); //TODO compPoss.Add(comp); //} } if (compPoss.Count == 0) { return(null); } SortEnergie[] cp = new SortEnergie[compPoss.Count]; for (int f = 0; f < cp.Length; f++) { cp[f] = (SortEnergie)compPoss[f]; } return(cp); }
public List <ComparisonNode> GetChildren(ComparisonNode node) { if (node == null) { throw new ArgumentNullException("node"); } if (node.HasChildren == false || node.Children.Count > 0) { return(node.Children); } using (IDbConnection cnc = GetConnection()) { IDbCommand cmd = GetCommandForProcedure(cnc, "get_children"); AddParameter(cmd, "master_id", MasterID); AddParameter(cmd, "parent_name", node.InternalID); //Console.WriteLine ("call get_children ({0}, '{1}')", MasterID, node.InternalID); using (IDataReader reader = cmd.ExecuteReader()) { while (reader.Read()) { CompType comp_type = (CompType)reader ["comparison_type"]; string display_name = reader ["name"] as string; string type_name = reader ["typename"] as string; ComparisonNode child = new ComparisonNode(comp_type, display_name, type_name); child.Parent = node; SetValuesFromReader(reader, child); node.Children.Add(child); } } GetMessagesForNodeRecursive(cnc, node); } return(node.Children); }
protected BaseComponent(Guid guid, CompType type) { Guid = guid; Type = type; FaultItems = Repo.FaultItems.Where(fi => fi.CompType == Type).ToList().DeepClone(); InferComboItems = Repo.InferCombos.Where(ic => ic.CompType == Type).ToList().DeepClone(); }
public Tree(CompType comp, T[] value) : this(comp) { for (int i = 0; i < value.Length; i++) { insert(value[i]); } }
protected void AddCompetence(CompType c, int value) { if (Competences[c] is NullCompetence) { Competences.LearnCompetence(c); } Competences[c].Achat = value; }
public Computer(CompType type, int CPU, double Freq, int Memory, int HDD) { this.type = type; this.CPU = CPU; this.Freq = Freq; this.Memory = Memory; this.HDD = HDD; }
public ComparisonNode (CompType type, string displayName, string typeName, string extraInfo) { Type = type; Name = displayName; TypeName = typeName; ExtraInfo = extraInfo; Children = new List<ComparisonNode> (); Messages = new List<string> (); Todos = new List<string> (); }
public CompFunc(CompType type, Function lhs, Function rhs) { if (type == CompType.Nest && lhs.IsComp()) { throw new Exception(); } m_type = type; this.lhs = lhs; this.rhs = rhs; }
// ---------------------------------------------------------------------------------------- public static CompType InsertCompType(CompType ct) { // add the user and timestamp PetaPoco.Database db = new PetaPoco.Database("ElecLibConnString"); ct.EnteredBy = "ElecLibUser"; ct.EntryDate = DateTime.Now; int newID = Convert.ToInt32(db.Insert(ct)); ct.Id = newID; return ct; }
public override void Deserialize(GenericReader reader) { base.Deserialize(reader); misBloquant = reader.ReadBool(); mprovocChute = reader.ReadBool(); misTeleport = reader.ReadBool(); mteleportTarget = reader.ReadPoint3D(); mDD = reader.ReadInt(); mComp = (CompType)reader.ReadInt(); }
public ComparisonNode(CompType type, string displayName, string typeName, string extraInfo) { Type = type; Name = displayName; TypeName = typeName; ExtraInfo = extraInfo; Children = new List <ComparisonNode> (); Messages = new List <string> (); Todos = new List <string> (); }
internal bool CompareFilter(int cmp, CompType type) { switch (type) { case CompType.LT: return cmp < 0; case CompType.LE: return cmp <= 0; case CompType.NE: return cmp != 0; case CompType.EQ: return cmp == 0; case CompType.GT: return cmp > 0; case CompType.GE: return cmp >= 0; default: throw new ArgumentException(type.ToString()); } }
// ---------------------------------------------------------------------------------------- public static void UpdateCompType(CompType ct) { // the incoming ct is the updated info PetaPoco.Database db = new PetaPoco.Database("ElecLibConnString"); //SaveHistoryRecord(ct.CompTypeID, "UPDATED"); // now update the record with the new data // touch the update person and time ct.EntryDate = DateTime.Now; ct.EnteredBy = "ElecLibUser"; db.Update(ct); }
private string ExprBarcket(int level, CompType type, string expr) { int itype = (int)type; for (int i = 0; i < level; i++) { if (i >= itype) { return("(" + expr + ")"); } } return(expr); }
public int getCompetence(CompType comp) { int val = 0; foreach (CompetenceMod mod in mCompetences) { if (mod.Comp == CompType.All || mod.Comp == comp) { val = mod.Value; break; } } return(val); }
public NubiaCompetence this[CompType comp] { get { if (mCompetences.ContainsKey(comp)) { return(mCompetences[comp]); } else { return(nullComp); } } }
public bool isComptenceClasse(CompType c) { bool isit = false; for (int i = 0; i < ClasseCompetences.Length; i++) { if (c == ClasseCompetences[i]) { isit = true; break; } } return(isit); }
/// <summary> /// Get all entities with a specific component /// </summary> /// <typeparam name="CompType"></typeparam> /// <returns></returns> internal CompType[] GetEntitiesComponent <CompType>() where CompType : BaseComponent { List <CompType> resEntities = new List <CompType>(); for (int i = 0; i < entities.Count; i++) { CompType entityComponent = entities[i].GetComponent <CompType>(); if (entityComponent != null) { resEntities.Add(entityComponent); } } return(resEntities.ToArray()); }
/// <summary>Performs a comparison with the passed in key value.</summary> /// <param name="key">Key to compare to.</param> /// <param name="cmp">Type of comparison to perform.</param> /// <returns>Returns -1 if less than, 1 if greater than, and 0 if equal.</returns> protected int Compare(TKey key, CompType cmp) { switch (cmp) { case CompType.MIN_CMP: return((Nodes[LEFT] == null) ? 0 : -1); case CompType.MAX_CMP: return((Nodes[RIGHT] == null) ? 0 : 1); case CompType.EQ_CMP: default: return(key.CompareTo(Key)); } }
public new static Company Load(BinaryReader reader) { CompType subType = (CompType)reader.ReadInt32(); int capacity = reader.ReadInt32(); Company ret = null; switch (subType) { case CompType.WAREHOUSE: ret = WareHouse.Load(reader); break; } ret.subType = subType; ret.Capacity = capacity; return(ret); }
public static LiteralFilter Create(CompType type, object value) { if (value is string) return new StringCompareFilter((string)value, type); if (value is decimal || value is byte || value is sbyte || value is short || value is ushort || value is int || value is uint || value is long || value is ulong || value is float || value is double) return new NumericCompareFilter(((IConvertible)value).ToDecimal(null), type); if (value is DateTime) return new DateTimeCompareFilter((DateTime)value, type); if (value is TimeSpan) return new TimeSpanCompareFilter((TimeSpan)value, type); throw new ArgumentException("Invalid type: " + value.GetType()); }
static string DocCompName(CompType docType) { switch (docType) { case CompType.COMPONENT: return "COMPONENT"; case CompType.DIMENSION: return "DIMENSION"; case CompType.BODYFEATURE: return "BODYFEATURE"; case CompType.SKETCH: return "SKETCH"; case CompType.FTRFOLDER: return "FTRFOLDER"; default: return null; } }
internal bool CompareFilter(int cmp, CompType type) { switch (type) { case CompType.LT: return(cmp < 0); case CompType.LE: return(cmp <= 0); case CompType.NE: return(cmp != 0); case CompType.EQ: return(cmp == 0); case CompType.GT: return(cmp > 0); case CompType.GE: return(cmp >= 0); default: throw new ArgumentException(type.ToString()); } }
public override void DrawNode() { EditorGUILayout.Space(); comType = (CompType)EditorGUILayout.EnumPopup("比较类型: ", comType); EditorGUILayout.Space(); EditorGUILayout.Space(); EditorGUILayout.TextField("左操作数: ", _handle[0].node == null ? "" : _handle[0].node.GetValue().ToString()); if (Event.current.type == EventType.Repaint) { _handle[0].area = GUILayoutUtility.GetLastRect(); } EditorGUILayout.Space(); EditorGUILayout.Space(); EditorGUILayout.TextField("右操作数: ", _handle[1].node == null ? "" : _handle[1].node.GetValue().ToString()); if (Event.current.type == EventType.Repaint) { _handle[1].area = GUILayoutUtility.GetLastRect(); } }
public ComparisonNode GetNodeByName(string node_name, bool get_children, bool get_messages) { if (String.IsNullOrEmpty(node_name)) { node_name = "0"; } ComparisonNode node = null; using (IDbConnection cnc = GetConnection()) { IDbCommand cmd = GetCommandForProcedure(cnc, "get_node_by_name"); AddParameter(cmd, "master_id", MasterID); AddParameter(cmd, "nodename", node_name); //Console.WriteLine ("call get_node_by_name ('{0}')", node_name); using (IDataReader reader = cmd.ExecuteReader()) { if (reader.Read()) { CompType comp_type = (CompType)reader ["comparison_type"]; string display_name = reader ["name"] as string; string type_name = reader ["typename"] as string; node = new ComparisonNode(comp_type, display_name, type_name); SetValuesFromReader(reader, node); } } if (node != null) { // Get only this node's messages before calling GetChildren if (get_messages) { GetMessagesForNodeRecursive(cnc, node); } if (get_children) { GetChildren(node); } } } return(node); }
public static void DoWithSwDoc(SldWorks swApp, CompType docType, string docId, Act doWithDoc) { var doc = swApp.IActiveDoc2; var select = doc.Extension.SelectByID2(docId + "@" + doc.GetTitle(), DocCompName(docType), 0, 0, 0, true, 0, null, 0); if (!select) { return; } if (doWithDoc == Act.DoNothing) { doc.ClearSelection2(true); return; } switch (doWithDoc) { case Act.Delete: doc.EditDelete(); break; case Act.DeletWithOption: const int deleteOption = (int)swDeleteSelectionOptions_e.swDelete_Absorbed + (int)swDeleteSelectionOptions_e.swDelete_Children; doc.Extension.DeleteSelection2(deleteOption); break; case Act.Unsuppress: doc.EditUnsuppress2(); break; case Act.Suppress: doc.EditSuppress2(); break; default: break; } doc.ClearSelection2(true); }
public static Champions GetBotCompByType(CompType type) { switch (type) { case CompType.FULLCC: return(FULLCC[0]); case CompType.FULLADC: break; case CompType.FULLTANK: break; case CompType.FULLMAGIC: break; default: break; } return(Champions.Morgana); }
static string DocCompName(CompType docType) { switch (docType) { case CompType.COMPONENT: return("COMPONENT"); case CompType.DIMENSION: return("DIMENSION"); case CompType.BODYFEATURE: return("BODYFEATURE"); case CompType.SKETCH: return("SKETCH"); case CompType.FTRFOLDER: return("FTRFOLDER"); default: return(null); } }
static Control GetTypeImage(CompType type) { WebControl img = new WebControl(HtmlTextWriterTag.Span); img.Controls.Add(new Literal() { Text = " " }); img.CssClass = "icons "; switch (type) { case CompType.Assembly: img.CssClass += "tyy"; break; case CompType.Namespace: img.CssClass += "tyn"; break; case CompType.Attribute: img.CssClass += "tyr"; break; case CompType.Interface: img.CssClass += "tyi"; break; case CompType.Class: img.CssClass += "tyc"; break; case CompType.Struct: img.CssClass += "tys"; break; case CompType.Delegate: img.CssClass += "tyd"; break; case CompType.Enum: img.CssClass += "tyen"; break; case CompType.Method: img.CssClass += "tym"; break; case CompType.Property: img.CssClass += "typ"; break; case CompType.Field: img.CssClass += "tyf"; break; case CompType.Event: img.CssClass += "tye"; break; } return(img); }
/// <summary>Removes a node from the tree below the root node.</summary> /// <param name="root">Node to search for item from.</param> /// <param name="key">Item to use for comparison</param> /// <param name="change">Balance change due to removal.</param> /// <param name="cmp">Comparison Type.</param> public static Node <TKey, TValue> Remove(ref Node <TKey, TValue> root, TKey key, ref int change, CompType cmp) { // See if the tree is empty if (root == null) { change = 0; return(null); } Node <TKey, TValue> nodeReturn = null; AVLNode <TKey, TValue> avlRoot = (AVLNode <TKey, TValue>)root; // Compare items and determine which direction to search int decrease = 0; int result = avlRoot.Compare(key, cmp); uint dir = (result == -1) ? LEFT : RIGHT; if (result != 0) { // Look into the appropriate sub tree nodeReturn = Remove(ref avlRoot.Nodes[dir], key, ref change, cmp); if (nodeReturn == null) { return(nodeReturn); } decrease = result * change; } else { nodeReturn = root; // Delete this node re-arrange the tree if ((root.Left == null) && (root.Right == null)) { // This is a leaf - simply remove it root = null; change = 1; return(nodeReturn); } else if ((root.Left == null) || (root.Right == null)) { // Only a single child, that child is now the root Node <TKey, TValue> toDelete = root; uint child = (root.Left != null) ? LEFT : RIGHT; root = root[child]; change = 1; toDelete.Left = null; toDelete.Right = null; return(nodeReturn); } else { Node <TKey, TValue> tempDelete = Remove(ref avlRoot.Nodes[RIGHT], key, ref decrease, CompType.MIN_CMP); root.Key = tempDelete.Key; root.Value = tempDelete.Value; } } // Rebalance the tree if necessary avlRoot.Balance -= decrease; if (decrease != 0) { if (avlRoot.Balance != 0) { change = ReBalance(ref avlRoot) ? 1 : 0; // rebalance and see if height changed root = avlRoot; } else { change = 1; // balanced because subtree decreased } } else { change = 0; } return(nodeReturn); }
public MasterClass(XMLClass cls, CompType type) : base(cls.name, type) { xml_cls = cls; interfaces = new List<CompNamed>(); constructors = new List<CompNamed>(); methods = new List<CompNamed>(); properties = new List<CompNamed>(); fields = new List<CompNamed>(); events = new List<CompNamed>(); MasterUtils.PopulateMemberLists (xml_cls, interfaces, constructors, methods, properties, fields, events); delegate_list = new List<CompNamed>(); enum_list = new List<CompNamed>(); class_list = new List<CompNamed>(); struct_list = new List<CompNamed>(); interface_list = new List<CompNamed>(); MasterUtils.PopulateTypeLists (xml_cls, class_list, enum_list, delegate_list, interface_list, struct_list); }
public CecilClass(TypeDefinition type_def, CompType type) : base(type_def.Name, type) { this.type_def = type_def; DisplayName = CecilUtils.PrettyTypeDefinition (type_def); nested_classes = new List<CompNamed>(); nested_enums = new List<CompNamed>(); nested_delegates = new List<CompNamed>(); nested_interfaces = new List<CompNamed>(); nested_structs = new List<CompNamed>(); CecilUtils.PopulateTypeLists (type_def, nested_classes, nested_enums, nested_delegates, nested_interfaces, nested_structs); interfaces = new List<CompNamed>(); constructors = new List<CompNamed>(); methods = new List<CompNamed>(); properties = new List<CompNamed>(); fields = new List<CompNamed>(); events = new List<CompNamed>(); if (!type_def.IsNotPublic || type_def.IsPublic || type_def.IsNestedPublic || type_def.IsNestedFamily || type_def.IsNestedFamilyAndAssembly || type_def.IsNestedFamilyOrAssembly) MemberName = type_def.FullName; CecilUtils.PopulateMemberLists (type_def, interfaces, constructors, methods, properties, fields, events); attributes = CecilUtils.GetCustomAttributes (type_def, todos); }
public Component(Guid guid, CompType type) : base(guid, type) { // BuildFMEATrees(); }
public StringCompareFilter(string pattern, CompType type) { Pattern = pattern; Type = type; }
public ComparisonNode (CompType type, string displayName, string typeName) : this (type, displayName, typeName, null) { }
static Control GetTypeImage(CompType type) { WebControl img = new WebControl (HtmlTextWriterTag.Span); img.Controls.Add (new Literal () { Text = " "} ); img.CssClass = "icons "; switch (type) { case CompType.Assembly: img.CssClass += "tyy"; break; case CompType.Namespace: img.CssClass += "tyn"; break; case CompType.Attribute: img.CssClass += "tyr"; break; case CompType.Interface: img.CssClass += "tyi"; break; case CompType.Class: img.CssClass += "tyc"; break; case CompType.Struct: img.CssClass += "tys"; break; case CompType.Delegate: img.CssClass += "tyd"; break; case CompType.Enum: img.CssClass += "tyen"; break; case CompType.Method: img.CssClass += "tym"; break; case CompType.Property: img.CssClass += "typ"; break; case CompType.Field: img.CssClass += "tyf"; break; case CompType.Event: img.CssClass += "tye"; break; } return img; }
public string getModusDescript() { string des = "<br>"; if (m_Freeze) { des += "<br>Paralisant !"; } if (mStr != 0) { des += "<br><i>Force:</i> " + (mStr > 0 ? "+" : "") + mStr + ""; } if (mDex != 0) { des += "<br><i>Dexterité:</i> " + (mDex > 0 ? "+" : "") + mDex + ""; } if (mInt != 0) { des += "<br><i>Intelligence:</i> " + (mInt > 0 ? "+" : "") + mInt + ""; } if (mSag != 0) { des += "<br><i>Sagesse:</i> " + (mSag > 0 ? "+" : "") + mSag + ""; } if (mCons != 0) { des += "<br><i>Constitution:</i> " + (mCons > 0 ? "+" : "") + mCons + ""; } if (mCha != 0) { des += "<br><i>Charisme:</i> " + (mCha > 0 ? "+" : "") + mCha + ""; } if (mDegatBonus != 0) { des += "<br><i>Bonus de dégat:</i> " + (mDegatBonus > 0 ? "+" : "") + mDegatBonus + ""; } for (int s = 0; s < (int)SauvegardeEnum.Reflexe; s++) { SauvegardeEnum save = (SauvegardeEnum)s; int generalVal = -999; for (int i = 0; i <= (int)SortEnergie.Mental; i++) { SortEnergie ecole = (SortEnergie)i; int val = getSauvegarde(save, ecole); if (ecole == SortEnergie.All) { generalVal = val; } if (val != 0 && (val != generalVal || ecole == SortEnergie.All)) { des += "<br><i>" + save.ToString() + ":</i> " + (val > 0 ? "+": "") + val; if (ecole != SortEnergie.All) { des += " <i>( " + ecole.ToString() + " )</i>"; } } } } int compVal = -999; for (int c = -1; c < (int)CompType.Maximum; c++) { CompType comp = (CompType)c; int val = getCompetence(comp); if (comp == CompType.All) { compVal = val; } if (val != 0 && (val != compVal || comp == CompType.All)) { string compName = comp.ToString(); if (!(m_caster.Competences[comp] is NullCompetence)) { compName = m_caster.Competences[comp].Name; } if (comp == CompType.All) { compName = "Compétences"; } des += "<br><i>" + compName + ":</i> " + (val > 0 ? "+" : "") + val; } } return(des); }
public TimeSpanCompareFilter(TimeSpan timespan, CompType type) { Value = timespan; Type = type; }
public CompNamed (string name, CompType type) { this.DisplayName = null; this.name = name; this.type = type; this.todos = new List<string>(); }
public CompMember (string name, CompType type) : base (name, type) { }
public CompClass (string name, CompType type) : base (name, type) { }
public NumericCompareFilter(Decimal number, CompType type) { Number = number; Type = type; }
public DateTimeCompareFilter(DateTime datetime, CompType type) { Value = datetime; Type = type; }