void Bw_DoWork(object sender, DoWorkEventArgs e) { try { BackgroundWorker bw = sender as BackgroundWorker; MType type = (MType)e.Argument; switch (type) { case MType.Win: DataService.Default.Load(bw, type); break; } e.Result = type; } catch (Exception ex) { ex.Log(); e.Result = ex.Message(); } finally { IStop = true; } }
public override int GetHashCode() { int hash = 1; if (MType != 0) { hash ^= MType.GetHashCode(); } if (baseOneofCase_ == BaseOneofOneofCase.BvInt) { hash ^= BvInt.GetHashCode(); } if (baseOneofCase_ == BaseOneofOneofCase.BvFloat) { hash ^= BvFloat.GetHashCode(); } if (baseOneofCase_ == BaseOneofOneofCase.BvDouble) { hash ^= BvDouble.GetHashCode(); } if (baseOneofCase_ == BaseOneofOneofCase.BvString) { hash ^= BvString.GetHashCode(); } if (baseOneofCase_ == BaseOneofOneofCase.BvBool) { hash ^= BvBool.GetHashCode(); } if (baseOneofCase_ == BaseOneofOneofCase.BvLong) { hash ^= BvLong.GetHashCode(); } hash ^= (int)baseOneofCase_; return(hash); }
public MLambda(MPat arg_pat, MType arg_type, MExpr body) : base("") { ArgPat = arg_pat; ArgType = arg_type; Body = body; }
public MEETRecvPacket(MType type, BinaryReader br, DateTime dt, MEETSockConnection conn) : base(type) { m_br = br; m_recvTime = dt; m_conn = conn; }
/// <summary> /// Local Parameter Message – m /// Delete Local Parameter (code 2) , Change Order Priority (code 4) or Connect Allocated Vehicle (code 5( /// </summary> /// <param name="index"></param> /// <param name="func"></param> /// <param name="value"></param> public Message_m(int index, byte func, byte value) : base("m") { m_Func = func; switch (func) { case 2: m_MType = MType.DeleteLocalParameter; m_Index = index; m_ParNo = value; break; case 4: m_MType = MType.ChangeOrderPriority; m_Index = index; m_Prio = value; break; case 5: m_MType = MType.ConnectAllocatedVehicle; m_Index = index; m_AgvId = value; break; default: throw new ArgumentException("Illegal function code"); } }
public override int GetHashCode() { int hash = 1; if (MTo.Length != 0) { hash ^= MTo.GetHashCode(); } if (MFrom.Length != 0) { hash ^= MFrom.GetHashCode(); } if (MType != 0) { hash ^= MType.GetHashCode(); } if (MSize != 0) { hash ^= MSize.GetHashCode(); } if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }
void Start() { Application.runInBackground = true; // Initialization to open socket on port specified by socketId. NetworkTransport.Init(); // init transport using default values ConnectionConfig config = new ConnectionConfig(); // create connection config + channel channelId = config.AddChannel(QosType.Reliable); HostTopology topology = new HostTopology(config, maxConnections); // create topology based on connection config socketId = NetworkTransport.AddHost(topology, socketPort); // create host based on topology, listening on port 8888 Debug.Log("Socket Open. SocketId is: " + socketId); // print socket ID to console userList = new Dictionary <int, HashSet <MType> >(); revUserList = new Dictionary <MType, HashSet <int> >(); try { foreach (MType value in MType.GetValues(typeof(MType))) // initialize each message type list { revUserList.Add(value, new HashSet <int>()); } } catch (ArgumentException) { Debug.Log("Tried to add duplicate message type to revUserList!"); } }
public FieldInfo SearchField(string name) { var fieldArray = MType.GetFields(); foreach (FieldInfo field in fieldArray) { if (ReflectionUtil.IsDeclare(MType, field)) { MappingCodeAttribute propertyAttr = Attribute.GetCustomAttribute(field, typeof(MappingCodeAttribute)) as MappingCodeAttribute; if (propertyAttr == null) { if (field.Name == name) { return(field); } } else { if (propertyAttr.Code == name) { return(field); } } } } return(null); }
public PropertyInfo SearchProperty(string name) { var propertyArray = MType.GetProperties(/*BindingFlags.DeclaredOnly*/); foreach (var property in propertyArray) { if (ReflectionUtil.IsDeclare(MType, property)) { MappingCodeAttribute propertyAttr = Attribute.GetCustomAttribute(property, typeof(MappingCodeAttribute)) as MappingCodeAttribute; if (propertyAttr == null) { if (property.Name == name) { return(property); } } else { if (propertyAttr.Code == name) { return(property); } } } } return(null); }
public Message(XElement element) { this.Body = element.Element("body").Value; switch (element.Element("type").Value) { case "TextMessage": case "PasteMessage": this.Type = MType.TextMessage; break; case "EnterMessage": this.Type = MType.EnterMessage; break; default: this.Type = MType.Unknown; break; } Int32.TryParse(element.Element("id").Value, out this.Id); Int32.TryParse(element.Element("user-id").Value, out this.UserId); Int32.TryParse(element.Element("room-id").Value, out this.RoomId); // <created-at type="datetime">2010-04-15T11:03:08Z</created-at> string dtString = element.Element("created-at").Value; DateTime dt; if (!DateTime.TryParse(dtString, out dt)) { dt = System.Xml.XmlConvert.ToDateTime(dtString, "yyyy-MM-dd'T'HH:mm:ssZ"); } this.PostedAt = dt; }
private static string GetObjectTitle(DObject obj, MType type) { if (type.Id == MType.SMART_FOLDER_ID && obj.Attributes.ContainsKey(SystemAttributes.SMART_FOLDER_TITLE)) { return(obj.Attributes[SystemAttributes.SMART_FOLDER_TITLE].ToString()); } if (obj.Id == DObject.RootId) { return(type.Title); } var sb = new StringBuilder(); var attibutes = AttributeFormatter.Format(type, obj.Attributes); foreach (var displayableAttr in type.GetDisplayAttributes()) { var attributeText = GetAttributeText(obj, attibutes, displayableAttr); if (sb.Length != 0 && !string.IsNullOrEmpty(attributeText)) { sb.Append(Constants.PROJECT_TITLE_ATTRIBUTES_DELIMITER); } sb.Append(attributeText); } return(sb.ToString()); }
// Skips internal void Skip(MProto proto, MType type) { switch (type) { case MType.Binary: proto.ReadBinary(); break; case MType.Bool: proto.ReadBool(); break; case MType.Byte: proto.ReadByte(); break; case MType.Double: proto.ReadDouble(); break; case MType.Float: proto.ReadFloat(); break; case MType.I16: proto.ReadI16(); break; case MType.I32: proto.ReadI32(); break; case MType.I64: proto.ReadI64(); break; case MType.List: SkipList(proto, proto.ReadListBegin()); break; case MType.Map: SkipMap(proto, proto.ReadMapBegin()); break; case MType.Null: break; case MType.Set: SkipList(proto, proto.ReadListBegin()); break; case MType.String: proto.ReadString(); break; case MType.Struct: SkipStruct(proto, proto.ReadStructBegin()); break; } }
public MCons(string pos, MExpr head, MExpr tail) : base(pos) { Head = head; Tail = tail; ItemType = new TypeVar(); }
public ExPropertyInfo SearchExProperty(string name) { var propertyArray = MType.GetProperties(/*BindingFlags.DeclaredOnly*/); foreach (var property in propertyArray) { if (ReflectionUtil.IsDeclare(MType, property)) { CodeAttribute propertyAttr = Attribute.GetCustomAttribute(property, typeof(CodeAttribute)) as CodeAttribute; if (propertyAttr == null) { if (property.Name == name) { return(GclUtil.CreatExPropertyInfo(property, ForType)); //return property; } } else { if (propertyAttr.Code == name) { return(GclUtil.CreatExPropertyInfo(property, ForType)); //return property; } } } } if (ParentMapping != null) { return(ParentMapping.SearchExProperty(name)); } return(null); }
/*****************************************************************************/ #region generate custom variables //variables required for NuSMV model public static void generateCustomVariables(KPsystem kpSystem, MType kpType, Module module) { if (module.HasDivisionRule || module.HasDissolutionRule) { Variable status = generateStatusVariable(module, kpType); if (status != null) { module.Status = status; } } Variable turn = generateTurnVariable(module, kpType); if (turn != null) { module.Turn = turn; } if (module.HasConnection) { List <NoNextVar> connections = generateConnectionVariable(kpSystem, kpType, module); if (connections != null) { module.Connections = connections; } } }
protected void evalMask() { bool periodSeen = false; bool dateMaybe = false; bool nmrcMaybe = false; char[] cc = mask.ToCharArray(); for (int i = 0; i < cc.Length; i++) { if ("dmyDMY".IndexOf(cc[i]) > -1) { dateMaybe = true; } else if ("#0".IndexOf(cc[i]) > -1) { nmrcMaybe = true; if (periodSeen) { prec++; } } else if (cc[i] == '.' && nmrcMaybe) { periodSeen = true; } } if (dateMaybe) { mType = MType.Date; } else if (nmrcMaybe) { mType = MType.Nmrc; } }
public POr(string pos, MPat pat1, MPat pat2) : base(pos) { Pat1 = pat1; Pat2 = pat2; Type = new TypeVar(); }
public MMemberRefMethod(MType parentType, string name, MType returnType, int genericParameterCount, ImmutableArray <MType> parameterTypes) : base(parentType, name) { ReturnType = returnType; GenericParameterCount = genericParameterCount; ParameterTypes = parameterTypes; }
public PCons(string pos, MPat head, MPat tail) : base(pos) { Head = head; Tail = tail; ItemType = new TypeVar(); }
public ExFieldInfo SearchExField(string name) { var fieldArray = MType.GetFields(); foreach (FieldInfo field in fieldArray) { if (ReflectionUtil.IsDeclare(MType, field)) { CodeAttribute propertyAttr = Attribute.GetCustomAttribute(field, typeof(CodeAttribute)) as CodeAttribute; if (propertyAttr == null) { if (field.Name == name) { return(GclUtil.CreatExFieldInfo(field, ForType)); //return field; } } else { if (propertyAttr.Code == name) { return(GclUtil.CreatExFieldInfo(field, ForType)); //return field; } } } } if (ParentMapping != null) { return(ParentMapping.SearchExField(name)); } return(null); }
private MTypeMeta create(MType mtype) { MTypeMeta mtm; if (typeMeta.TryGetValue(mtype, out mtm)) { return(mtm); } int id = nextTypeId(); mtm = new MTypeMeta(this, mtype, id, false); tm.Add(id, mtm); typeMeta.Add(mtype, mtm); mtm.build(); HasCommunication = HasCommunication || mtm.HasCommunication; HasDissolution = HasDissolution || mtm.HasDissolution; HasDivision = HasDivision || mtm.HasDivision; HasLinkCreation = HasLinkCreation || mtm.HasLinkCreation; HasLinkDestruction = HasLinkDestruction || mtm.HasLinkDestruction; InstanceCount += mtm.Instances.Length; RuleCount += mtm.RuleSet.Length; MTypeCount++; return(mtm); }
internal MField(string name, MType type, int id) : this() { this.Name = name; this.Type = type; this.ID = id; }
/// <summary> /// Determines how many child instances will eventually be generated after running all division rules. For each child /// instance, it generates KPChildInstance (sub class of MInstance) object and adds them as MInstance(regular /// instances) to MType. For each MInstance (including KPChildInstances) an SMV module will be generated. /// </summary> /// <param name="type">KP type (MType)</param> /// <returns>List of child instance of KPChildInstance type</returns> internal static List <KPChildInstance> generateKPChildInstances(MType type) { List <KPChildInstance> kpChildInstances = new List <KPChildInstance>(); //After all divisions, how many child will be generated. int totalChildNumber = 1; ExecutionStrategy eS = type.ExecutionStrategy; while (eS != null) { foreach (var rule in eS.Rules) { if (rule.Type == RuleType.MEMBRANE_DIVISION) { DivisionRule divisionRule = (DivisionRule)rule; totalChildNumber *= divisionRule.Rhs.Count; } } eS = eS.Next; } //for each parent instance, totalChildNumber, child instance will be generated foreach (MInstance kpInstance in type.Instances) { for (int childCount = 1; childCount <= totalChildNumber; childCount++) { KPChildInstance kpChildInstance = new KPChildInstance(kpInstance); kpChildInstance.Order = childCount; kpChildInstance.Name = kpInstance.Name + SMVPreFix.CHILD + childCount; kpChildInstances.Add(kpChildInstance); } } return(kpChildInstances); }
private static void extractVarFromBasicGuards(KPsystem kpSystem, MType kpType, Module module, BasicGuard basicGuard) { Multiset ms = basicGuard.Multiset; NuSMV.RelationalOperator oper = SMVUtil.getRelationalOperator(basicGuard.Operator); Variable variable = null; foreach (var varName in ms.Objects) { if (!module.isVariableExist(varName)) { variable = new Variable(varName); int upperBound = ms[varName]; //if the guard requires a number greater, or greaterEqual, then it upperbound should be at least one number greater then, //the condition if (oper.Operator == NuSMV.RelationalOperator.GEQ || oper.Operator == NuSMV.RelationalOperator.GT) { upperBound = upperBound + 1; } variable.Type = new BoundInt(0, upperBound); setBoundIntType(kpSystem, kpType, module, variable); variable.Behaviour = VariableBehaviour.REWRITING; variable.Init = setOrUpdateInit(module, variable); module.Variables.Add(variable); } } }
internal MMap(MType keytype, MType valuetype, int count) : this() { this.KeyType = keytype; this.ValueType = valuetype; this.Count = count; }
public MType GetInstanceType(MInstance instance) { MType type = null; instanceTypes.TryGetValue(instance, out type); return(type); }
public async Task <IActionResult> Edit(long id, [Bind("TypeId,TypeCode,TypeText,TypeType")] MType mType) { if (id != mType.TypeId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(mType); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!MTypeExists(mType.TypeId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(mType)); }
public TKTProcDesc SearchProc(TKTProcDesc procDesc) { var methodArray = MType.GetMethods( ); foreach (var method in methodArray) { CodeAttribute procAttr = Attribute.GetCustomAttribute(method, typeof(CodeAttribute)) as CodeAttribute; if (procAttr == null) { ExMethodInfo exMethod = GclUtil.CreatExMethodInfo(method, this.ForType); TKTProcDesc typeProcDesc = ProcDescHelper.CreateProcDesc(exMethod); if (typeProcDesc.Eq(procDesc)) { return(typeProcDesc); } } else { ProcDescCodeParser parser = new ProcDescCodeParser(); parser.InitType(ForType, method); TKTProcDesc typeProcDesc = parser.Parser(WordDict, procAttr.Code); if (typeProcDesc.Eq(procDesc)) { ExMethodInfo exMethod = GclUtil.CreatExMethodInfo(method, this.ForType); typeProcDesc.ExMethod = exMethod; return(typeProcDesc); } } } if (ParentMapping != null) { return(ParentMapping.SearchProc(procDesc)); } return(null); }
private void ConvertToType(UnitTypeViewModel typeVM, MType type) { type.TypeName = typeVM.TypeName; type.TypeStatus = typeVM.TypeStatus; type.TypeDesc = typeVM.TypeDesc; type.MerkId = string.IsNullOrEmpty(typeVM.MerkId) ? null : _merkTasks.One(typeVM.MerkId); }
public PAs(string pos, MPat pat, string name) : base(pos) { Pat = pat; Name = name; Type = new TypeVar(); }
/// <summary> /// Constructors used for test purposes. /// </summary> public Message(int id, MType type, int roomId, int userId, string msg) { this.Id = id; this.Type = type; this.RoomId = roomId; this.UserId = userId; this.Body = msg; this.PostedAt = DateTime.Now; }
public int Deregister(MType type) { int retval = 99; return retval; }
public IMessage Receive(Boolean ignore) { IConnection args = this; IMessage retval = new Message(); byte[] header = new byte[8]; int count; lock (args) { count = 0; try { count = args.Socket.Receive(header); } catch { retval.Type = "Error.Message.Corrupted"; args.Vampire = true; } switch (count) { case 8: byte[] _length = new byte[2]; byte[] _conversation = new byte[2]; byte[] _typeid = new byte[2]; byte[] _sequence = new byte[2]; _length[0] = header[0]; _length[1] = header[1]; _conversation[0] = header[2]; _conversation[1] = header[3]; _typeid[0] = header[4]; _typeid[1] = header[5]; _sequence[0] = header[6]; _sequence[1] = header[7]; UInt16 plength; UInt16 pconversation; UInt16 ptypeid; UInt16 psequence; plength = SimpleMesh.Utility.ToHostOrder(_length); pconversation = SimpleMesh.Utility.ToHostOrder(_conversation); ptypeid = SimpleMesh.Utility.ToHostOrder(_typeid); psequence = SimpleMesh.Utility.ToHostOrder(_sequence); if (plength > 0) { byte[] payload = new byte[plength]; try { count = args.Socket.Receive(payload); } catch { retval.Type = "Error.Message.Corrupted"; args.Vampire = true; return retval; } if (count == plength) { retval.Sequence = psequence; retval.Conversation = pconversation; retval.Type = args.TypeList.ByID(ptypeid).Name; retval.Payload = payload; } else { retval.Type = "Error.Message.Corrupted"; args.Vampire = true; return retval; } } break; case 0: retval.Type = "Control.Empty"; break; default: retval.Type = "Error.Message.Corrupted"; args.Vampire = true; break; } } MsgOut("R", retval); if (ignore == false) { switch (retval.Type) { case "Control.GetTypeID": if (retval.Conversation == 0) { MType type = new MType(); TextMessage msg = new TextMessage(retval); type.Name = msg.Data; type.TypeID = msg.Sequence; msg.Type = "Control.TypeID"; if (this.TypeList.Contains(type) == false) { if (this.TypeList.ContainsID(type) == true) { type.TypeID = 0; ushort value; this.TypeList.Add(type, out value); msg.Sequence = value; this.Send(msg); } else { this.TypeList.Add(type); this.Send(msg); } } } retval = new Message("Control.Empty"); break; case "Control.Ping": retval.Type = "Control.Pong"; this.Send(retval); retval = new Message("Control.Empty"); break; case "Control.Pong": lock (this) { Time time; if (this.OutstandingPings.TryGetValue(retval.Sequence, out time)) { this.OutstandingPings.Remove(retval.Sequence); } } retval = new Message("Control.Empty"); break; default: if ((retval.Type.Length == 6) && (retval.Type.Substring(0, 6) == "Error.")) { } else { } break; } } return retval; }
internal MType SaveMType(MType MType) { try { SetService(); return SerClient.SaveMType(MType); } finally { SerClient.Close(); if (SerClient.State == CommunicationState.Faulted) SerClient.Abort(); } }
public int Register(MType type) { int retval = 99; if (this.TypeList.Contains(type) == false) { TextMessage message = new TextMessage("Control.GetTypeID"); message.Sequence = type.TypeID; message.Data = type.Name; this.Send(message); retval = 0; } return retval; }
internal void DeleteMType(MType MType) { try { SetService(); SerClient.DeleteMType(MType); } finally { SerClient.Close(); if (SerClient.State == CommunicationState.Faulted) SerClient.Abort(); } }
internal Mio(MType type) { this.Type = type; }
internal MSet(MType elemtype, int count) : this() { this.ElementType = elemtype; this.Count = count; }