internal SingleContainerInterface(World.WorldManager world, InterfaceType interfaceType, UniversalCoords coords, sbyte slotCount) : base(world, interfaceType, slotCount) { Coords = coords; Load(); }
internal PersistentContainerInterface(World.WorldManager world, InterfaceType interfaceType, sbyte slotCount) : base(interfaceType, slotCount) { this.World = world; EnsureDirectory(); }
internal Interface(InterfaceType type, sbyte slotCount) { Type = type; Handle = NextHandle; Slots = new ItemStack[slotCount]; Title = "C#raft Interface"; NextHandle = NextHandle == 127 ? (sbyte)0 : (sbyte)(NextHandle + 1); }
internal Interface(InterfaceType type, sbyte slotCount) { Type = type; Handle = NextHandle; Slots = new ItemStack[slotCount]; Title = "C#raft Interface"; NextHandle = NextHandle == 127 ? (sbyte)1 : (sbyte)(NextHandle + 1); // Handles between 1 and 127. 0 is reserved for Inventory }
public InterfaceConfiguration() { _keyboardInterfacePresent = false; _xBoxControllerInterfacePresent = false; _tcpInterfacePresent = false; _masterInterface = InterfaceType.Keyboard; _tcpPort = 11235; }
private void ExtractDefinitionGuid(InterfaceType.Factory iftFactory, Type t) { var guids = t.GetCustomAttributes(typeof(DefinitionGuidAttribute), false).OfType<DefinitionGuidAttribute>().ToArray(); if (guids.Length > 0) { _typeMap[guids[0].Guid] = iftFactory(t).ToSerializableType(); } }
/// <summary> /// Constructor /// </summary> /// <param name="useLogicalNameReferencing">Is Logical or short name referencing used.</param> /// <param name="clientAddress">Client address. Default is 16 (0x10)</param> /// <param name="serverAddress">Server ID. Default is 1.</param> /// <param name="interfaceType">Interface type. Default is general.</param> public GXDLMSSecureNotify(bool useLogicalNameReferencing, int clientAddress, int serverAddress, InterfaceType interfaceType) : base(useLogicalNameReferencing, clientAddress, serverAddress, interfaceType) { Ciphering = new GXCiphering(ASCIIEncoding.ASCII.GetBytes("ABCDEFGH")); Settings.Cipher = Ciphering; }
internal SingleContainerInterface(World.WorldManager world, InterfaceType interfaceType, int x, int y, int z, sbyte slotCount) : base(world, interfaceType, slotCount) { this.X = x; this.Y = y; this.Z = z; Load(); }
/// <summary> /// Constructor /// </summary> /// <param name="useLogicalNameReferencing">Is Logical or short name referencing used.</param> /// <param name="clientAddress">Client address. Default is 16 (0x10)</param> /// <param name="serverAddress">Server ID. Default is 1.</param> /// <param name="authentication">Authentication type. Default is None</param> /// <param name="password">Password if authentication is used.</param> /// <param name="interfaceType">Interface type. Default is general.</param> public GXDLMSSecureClient(bool useLogicalNameReferencing, int clientAddress, int serverAddress, Authentication authentication, string password, InterfaceType interfaceType) : base(useLogicalNameReferencing, clientAddress, serverAddress, authentication, password, interfaceType) { Ciphering = new GXCiphering(ASCIIEncoding.ASCII.GetBytes("ABCDEFGH")); Settings.Cipher = Ciphering; }
public ThermoCam(SerializationInfo info, StreamingContext ctxt) { this._name = (string) info.GetValue("Nombre" , typeof(string)); this._address = (string) info.GetValue("Address" , typeof(string)); this._camType = (CameraType) info.GetValue("CamType" , typeof(CameraType)); this._devType = (DeviceType) info.GetValue("DevType" , typeof(DeviceType)); this._interfaceType = (InterfaceType) info.GetValue("InterType", typeof(InterfaceType)); this.SubZonas = (List<SubZona>) info.GetValue("SubZonas" , typeof(List<SubZona>)); }
/// <summary> /// Constructor /// </summary> /// <param name="useLogicalNameReferencing">Is Logical or short name referencing used.</param> /// <param name="clientAddress">Client address. Default is 0x10</param> /// <param name="ServerAddress">Server ID. Default is 1.</param> /// <param name="interfaceType">Interface type. Default is general.</param> public GXDLMSNotify(bool useLogicalNameReferencing, int clientAddress, int serverAddress, InterfaceType interfaceType) { Settings = new GXDLMSSettings(true); Settings.UseLogicalNameReferencing = useLogicalNameReferencing; Settings.InterfaceType = interfaceType; Settings.ServerAddress = serverAddress; Settings.ClientAddress = clientAddress; }
private void RemoteClient_PacketReceived(Client sender, Client.PacketReceivedEventArgs e) { PacketType packetType = (PacketType)e.Reader.ReadInt16(); //Disconnect the user if he attempts to do anything else before authenticating. if (packetType != PacketType.Authenticate && !Authenticated) { Disconnect("Your attempt at sending packets before authenticating has been ignored!"); return; } switch (packetType) { case PacketType.Authenticate: InterfaceType = (InterfaceType)e.Reader.ReadByte(); int major = e.Reader.ReadInt32(); int minor = e.Reader.ReadInt32(); if (Rtc.buildVersion.Major != major || Rtc.buildVersion.Minor != minor) { Disconnect($"Your version ({major}.{minor}) is incompatible with the server's version ({Rtc.buildVersion.Major}.{Rtc.buildVersion.Minor})."); return; } string Username = e.Reader.ReadString(); string Password = e.Reader.ReadString(); TSUser = TShock.Users.GetUserByName(Username); if (TSUser == null || !TSUser.VerifyPassword(Password)) { Disconnect("Invalid username/password or insufficient privileges."); return; } Group g = TShock.Groups.GetGroupByName(TSUser.Group); if (!g.HasPermission("*")) { Disconnect("Invalid username/password or insufficient privileges."); return; } Authenticated = true; Packet pck = new Packet((short)PacketType.MessageBuffer, (short)Rtc.MessagesBuffer.Length); for (int i = 0; i < Rtc.MessagesBuffer.Length; i++) { if (!string.IsNullOrEmpty(Rtc.MessagesBuffer[i])) pck.Write(Rtc.ColorBuffer[i], Rtc.MessagesBuffer[i]); } sender.Send(pck); break; case PacketType.Input: string text = e.Reader.ReadString(); Rtc.ConsoleInput.SendText(text); break; } }
/// <summary> /// Constructor /// </summary> /// <param name="useLogicalNameReferencing">Is Logical or short name referencing used.</param> /// <param name="clientID">Client ID. Default is 0x21</param> /// <param name="ServerID">Server ID. Default is 3.</param> /// <param name="authentication">Authentication type. Default is None</param> /// <param name="password">Password if authentication is used.</param> /// <param name="interfaceType">Interface type. Default is general.</param> public GXDLMSClient(bool useLogicalNameReferencing, object clientID, object ServerID, Authentication authentication, string password, InterfaceType interfaceType) { m_Base = new GXDLMS(false); Objects = new GXDLMSObjectCollection(); this.UseLogicalNameReferencing = useLogicalNameReferencing; this.InterfaceType = interfaceType; this.Authentication = authentication; this.ClientID = clientID; this.ServerID = ServerID; this.Password = ASCIIEncoding.ASCII.GetBytes(password); }
public TypeMap(InterfaceType.Factory iftFactory, IEnumerable<TypeMapAssembly> assemblies) { if (iftFactory == null) throw new ArgumentNullException("iftFactory"); if (assemblies == null) throw new ArgumentNullException("assemblies"); _typeMap = new Dictionary<Guid, SerializableType>(); foreach (var t in assemblies.SelectMany(a => a.Value.GetTypes())) { ExtractDefinitionGuid(iftFactory, t); } _guidMap = _typeMap.ToDictionary(k => k.Value, v => v.Key); }
public ThermoCam(System.Windows.Forms.Form f, CameraType camType, DeviceType devType, InterfaceType interfaceType) { this._camType = camType; this._devType = devType; this._interfaceType = interfaceType; //Crear nueva lista de zonas this.SubZonas = new List<SubZona>(); ((System.ComponentModel.ISupportInitialize)(camara)).BeginInit(); camara.Visible = false; f.Controls.Add(camara); camara.CameraEvent += camara_CameraEvent; ((System.ComponentModel.ISupportInitialize)(camara)).EndInit(); }
public static string GetInterfaceString(InterfaceType type) { string sType = string.Empty; switch (type) { case InterfaceType.CBus: sType = "CBus"; break; case InterfaceType.Internal: sType = "Internal"; break; case InterfaceType.Isa: sType = "Isa"; break; default: sType = "Invalid"; break; } return sType; }
public void DecrementQuery(InterfaceType ifType, int objectCount, long startTicks, long endTicks) { if (!initialized) return; _Queries.Decrement(objectCount, startTicks, endTicks); }
public MirrorPointImplementation() { var keyX = new NameKey("x"); var localX = MemberDefinition.CreateAndBuild(keyX, new AnyType(), Access.ReadWrite); var keyY = new NameKey("y"); var localY = MemberDefinition.CreateAndBuild(keyY, new AnyType(), Access.ReadWrite); var contextKey = new NameKey("context"); var context = MemberDefinition.CreateAndBuild( contextKey, InterfaceType.CreateAndBuild( Scope.CreateAndBuild( new List <IsStatic>() { new IsStatic(localX, false), new IsStatic(localY, false), }).Members.Values.Select(x => x.Value).ToList()), Access.ReadWrite);; var inputKey = new NameKey("input"); var input = MemberDefinition.CreateAndBuild(inputKey, new EmptyType(), Access.ReadWrite); var tempKey = new NameKey("temp"); var temp = MemberDefinition.CreateAndBuild(tempKey, new AnyType(), Access.ReadWrite); var implementationScope = Scope.CreateAndBuild( new List <IsStatic> { new IsStatic(input, false), new IsStatic(temp, false) }); var intermediateScope = Scope.CreateAndBuild( new List <IsStatic> { new IsStatic(context, false) }); RootScope = Model.Instantiated.RootScope.CreateAndBuild( Scope.CreateAndBuild( new List <IsStatic>() { new IsStatic(MemberDefinition.CreateAndBuild(new NameKey("mirror"), new AnyType(), Access.ReadWrite), false) }), new[] { AssignOperation.CreateAndBuild( ImplementationDefinition.CreateAndBuild( new EmptyType(), context, input, implementationScope, new ICodeElement[] { AssignOperation.CreateAndBuild( PathOperation.CreateAndBuild(MemberReference.CreateAndBuild(context), MemberReference.CreateAndBuild(localX)), MemberReference.CreateAndBuild(temp) ), AssignOperation.CreateAndBuild( PathOperation.CreateAndBuild(MemberReference.CreateAndBuild(context), MemberReference.CreateAndBuild(localY)), PathOperation.CreateAndBuild(MemberReference.CreateAndBuild(context), MemberReference.CreateAndBuild(localX)) ), AssignOperation.CreateAndBuild( MemberReference.CreateAndBuild(temp), PathOperation.CreateAndBuild(MemberReference.CreateAndBuild(context), MemberReference.CreateAndBuild(localY)) ) }, Array.Empty <ICodeElement>(), intermediateScope), MemberReference.CreateAndBuild(MemberDefinition.CreateAndBuild(new NameKey("mirror"), new AnyType(), Access.ReadWrite))) }, EntryPointDefinition.CreateAndBuild(new EmptyType(), MemberDefinition.CreateAndBuild(new NameKey("input"), new NumberType(), Access.ReadWrite), Scope.CreateAndBuild(Array.Empty <IsStatic>()), Array.Empty <ICodeElement>(), Array.Empty <ICodeElement>())); }
// ================================ internal static void Reset(bool ResetLogs) { // track manager TrackManager.CurrentTrack = new TrackManager.Track(); // train manager TrainManager.Trains = new TrainManager.Train[] { }; // game Interface.ClearMessages(); CurrentInterface = InterfaceType.Normal; RouteComment = ""; RouteImage = ""; RouteAccelerationDueToGravity = 9.80665; RouteRailGauge = 1.435; RouteInitialAirPressure = 101325.0; RouteInitialAirTemperature = 293.15; RouteInitialElevation = 0.0; RouteSeaLevelAirPressure = 101325.0; RouteSeaLevelAirTemperature = 293.15; Stations = new Station[] { }; Sections = new Section[] { }; BufferTrackPositions = new double[] { }; Messages = new Message[] { }; MarkerTextures = new Textures.Texture[] { }; PointsOfInterest = new PointOfInterest[] { }; PrecedingTrainTimeDeltas = new double[] { }; PrecedingTrainSpeedLimit = double.PositiveInfinity; BogusPretrainInstructions = new BogusPretrainInstruction[] { }; TrainName = ""; TrainStart = TrainStartMode.EmergencyBrakesNoAts; NoFogStart = (float)Math.Max(1.33333333333333 * Interface.CurrentOptions.ViewingDistance, 800.0); NoFogEnd = (float)Math.Max(2.66666666666667 * Interface.CurrentOptions.ViewingDistance, 1600.0); PreviousFog = new Fog(NoFogStart, NoFogEnd, new Color24(128, 128, 128), 0.0); CurrentFog = new Fog(NoFogStart, NoFogEnd, new Color24(128, 128, 128), 0.5); NextFog = new Fog(NoFogStart, NoFogEnd, new Color24(128, 128, 128), 1.0); InfoTotalTriangles = 0; InfoTotalTriangleStrip = 0; InfoTotalQuads = 0; InfoTotalQuadStrip = 0; InfoTotalPolygon = 0; InfoStaticOpaqueFaceCount = 0; if (ResetLogs) { LogRouteName = ""; LogTrainName = ""; LogDateTime = DateTime.Now; CurrentScore = new Score(); ScoreMessages = new ScoreMessage[] { }; ScoreLogs = new ScoreLog[64]; ScoreLogCount = 0; BlackBoxEntries = new BlackBoxEntry[256]; BlackBoxEntryCount = 0; BlackBoxNextUpdate = 0.0; } // renderer Renderer.Reset(); }
public ServerImplementationTypeMock(Type t, InterfaceType.Factory iftFactory) : base(t, iftFactory, new Zetbox.API.Mocks.MockImplementationTypeChecker()) { }
private IDictionary <string, Unit> loadUnits(Component c) { IDictionary <string, Unit> units = new Dictionary <string, Unit>(); AbstractComponentFunctorApplication absCapp_ = br.ufc.pargo.hpe.backend.DGAC.BackEnd.acfadao.retrieve(c.Id_functor_app); AbstractComponentFunctorApplication absCapp = null; while (absCapp_ != null) { absCapp = absCapp_; absCapp_ = br.ufc.pargo.hpe.backend.DGAC.BackEnd.acfadao.retrieve_next(absCapp_.Id_functor_app); } int id_abstract = absCapp.Id_abstract; // for each unit ... foreach (UnitType u in unit) { string uref = u.uRef; string iRef = u.iRef; int partition_index = u.replicaSpecified ? u.replica : 0; string uRefSuper = u.super.Length == 0 ? "" : u.super[0].uRef; for (int j = 1; j < u.super.Length; j++) { uRefSuper += "+" + u.super[j].uRef; } Interface i = br.ufc.pargo.hpe.backend.DGAC.BackEnd.idao.retrieve(id_abstract, uref); InterfaceType ui = lookForInterface(iRef); Unit uu = new Unit(); uu.Id_concrete = c.Id_concrete; uu.Id_unit = uref; uu.Id_abstract = id_abstract; uu.Id_interface = uref; uu.Id_unit_super = uRefSuper; // uu.Unit_replica = partition_index; uu.Class_name = xc.header.packagePath + "." + xc.header.name + "." + iRef; uu.Class_nargs = i.Class_nargs; uu.Assembly_string = uu.Class_name + ", Culture=neutral, Version=0.0.0.0"; // In the current implementation, the name of the dll is the name of the class of the unit. uu.Order = i.Order; units.Add(uu.Id_unit, uu); //Console.WriteLine("ui.sources={0}",ui.sources); //Console.WriteLine("ui.protocol={0}",ui.protocol); //Console.WriteLine("{0}={1}", c.Kind, Constants.KIND_COMPUTATION_NAME); if (ui.sources == null && (c.Kind.Equals(Constants.KIND_COMPUTATION_NAME) || c.Kind.Equals(Constants.KIND_SYNCHRONIZER_NAME))) { Console.WriteLine("ENTER WRAPPER GENERATOR " + c.Library_path); } else if (ui.sources != null) { int order = 0; foreach (SourceFileType sft in ui.sources[ui.sources.Length - 1].file) { if (sft.srcType.Equals("user") || sft.srcType.Equals("base")) { Console.WriteLine("loadUnits - 1 " + sft.name); SourceCode ss = new SourceCode(); ss.Type_owner = 'u'; ss.Id_owner_container = uu.Id_concrete; ss.Id_owner = uu.Id_unit; ss.Contents = sft.contents; ss.File_type = "dll"; ss.File_name = sft.name; ss.Order = order++; br.ufc.pargo.hpe.backend.DGAC.BackEnd.scdao.insert(ss); Console.WriteLine("loadUnits - 2"); int size = (sft.externalDependency == null ? 0 : sft.externalDependency.Length) + (ui.externalReferences == null ? 0 : ui.externalReferences.Length); Console.WriteLine("loadUnits - 3"); if (size > 0) { Console.WriteLine("loadUnits - 4"); string[] allRefs = new string[size]; if (ui.externalReferences != null) { ui.externalReferences.CopyTo(allRefs, 0); } if (sft.externalDependency != null) { sft.externalDependency.CopyTo(allRefs, ui.externalReferences == null ? 0 : ui.externalReferences.Length); } Console.WriteLine("loadUnits - 5"); foreach (string extRef in allRefs) { Console.WriteLine("loadUnits - 6 - " + extRef); SourceCodeReference ssr = new SourceCodeReference(); ssr.Type_owner = ss.Type_owner; ssr.Id_owner_container = ss.Id_owner_container; ssr.Id_owner = ss.Id_owner; ssr.File_name = ss.File_name; ssr.Reference = extRef; if (br.ufc.pargo.hpe.backend.DGAC.BackEnd.scrdao.retrieve(ssr) == null) { br.ufc.pargo.hpe.backend.DGAC.BackEnd.scrdao.insert(ssr); } Console.WriteLine("loadUnits - 7 - " + extRef); } } } else if (sft.srcType.Equals("platform.settings")) { SourceCode ss = new SourceCode(); ss.Type_owner = 'u'; ss.Id_owner_container = uu.Id_concrete; ss.Id_owner = uu.Id_unit; ss.Contents = sft.contents; ss.File_type = "platform.settings"; ss.File_name = sft.name; ss.Order = order++; br.ufc.pargo.hpe.backend.DGAC.BackEnd.scdao.insert(ss); } } } else { throw new Exception("Unit " + uu.Id_unit + " neither has a source code nor is a connector."); } UnitDAO udao = new UnitDAO(); udao.insert(uu); } return(units); }
///<summary> ///CodeData ///</summary> internal void CodeData(List<byte> data, InterfaceType interfaceType, byte[] challenge) { //AARQ APDU Tag data.Add(GXCommon.AARQTag); //Length int LenPos = data.Count; data.Add(0); /////////////////////////////////////////// // Add Application context name. ApplicationContextName.CodeData(data); GetAuthenticationString(data, challenge); UserInformation.CodeData(data); //Add extra tags... if (Tags != null) { for (int a = 0; a < Tags.Count; ++a) { GXDLMSTag tag = Tags[a]; if (tag != null) { //Add data ID. data.Add((byte)tag.ID); //Add data len. data.Add((byte)tag.Data.Length); //Add data. data.AddRange(tag.Data); } } } data[LenPos] = (byte)(data.Count() - LenPos - 1); }
private void Form1_Load(object sender, EventArgs e) { Hide(); CameraSelectionDialog camSlnDlg = new CameraSelectionDialog(); bool retVal = camSlnDlg.ShowModal(); if (retVal) { try { ManagedPGRGuid[] selectedGuids = camSlnDlg.GetSelectedCameraGuids(); ManagedPGRGuid guidToUse = selectedGuids[0]; ManagedBusManager busMgr = new ManagedBusManager(); InterfaceType ifType = busMgr.GetInterfaceTypeFromGuid(guidToUse); if (ifType == InterfaceType.GigE) { m_camera = new ManagedGigECamera(); } else { m_camera = new ManagedCamera(); } // Connect to the first selected GUID m_camera.Connect(guidToUse); m_camCtlDlg.Connect(m_camera); CameraInfo camInfo = m_camera.GetCameraInfo(); UpdateFormCaption(camInfo); // Set embedded timestamp to on EmbeddedImageInfo embeddedInfo = m_camera.GetEmbeddedImageInfo(); embeddedInfo.timestamp.onOff = true; m_camera.SetEmbeddedImageInfo(embeddedInfo); m_camera.StartCapture(); m_grabImages = true; StartGrabLoop(); } catch (FC2Exception ex) { Debug.WriteLine("Failed to load form successfully: " + ex.Message); Environment.ExitCode = -1; Application.Exit(); return; } toolStripButtonStart.Enabled = false; toolStripButtonStop.Enabled = true; } else { Environment.ExitCode = -1; Application.Exit(); return; } Show(); }
public Zetbox.App.Base.ObjectClass GetObjectClass(InterfaceType ifType) { return new ObjectClassMock() { Name = ifType.Type.Name, ExportGuid = Guid.NewGuid(), TableName = ifType.Type.Name, IsFrozenObject = true }; }
public static IEnumerable<InterfaceType> GetAllInterfaces(string cleanString, SpecData specificationData) { var interfaces = new List<InterfaceType>(); foreach (Match iface in InterfaceParser.Matches(cleanString)) { var interfaceDefinition = new InterfaceType { Name = iface.Groups["name"].Value.Trim(), IsPartial = !string.IsNullOrWhiteSpace(iface.Groups["partial"].Value.Trim()), IsCallback = !string.IsNullOrWhiteSpace(iface.Groups["callback"].Value.Trim()), ExtendedAttribute = CleanString(iface.Groups["extended"].Value), SpecNames = new[] { specificationData.Name } }; if (!string.IsNullOrWhiteSpace(interfaceDefinition.ExtendedAttribute)) { var constructors = interfaceDefinition.Constructors.ToList(); var namedConstructors = interfaceDefinition.NamedConstructors.ToList(); var exposed = interfaceDefinition.Exposed.ToList(); var globals = interfaceDefinition.Globals.ToList(); var primaryGlobals = interfaceDefinition.PrimaryGlobals.ToList(); foreach (Match m in InterfaceExtendedParser.Matches(interfaceDefinition.ExtendedAttribute)) { interfaceDefinition.IsGlobal = interfaceDefinition.IsGlobal || !string.IsNullOrWhiteSpace(m.Groups["global"].Value.Trim()); interfaceDefinition.ImplicitThis = interfaceDefinition.ImplicitThis || !string.IsNullOrWhiteSpace(m.Groups["implicitthis"].Value.Trim()); interfaceDefinition.ArrayClass = interfaceDefinition.ArrayClass || !string.IsNullOrWhiteSpace(m.Groups["arrayclass"].Value.Trim()); interfaceDefinition.LegacyArrayClass = interfaceDefinition.LegacyArrayClass || !string.IsNullOrWhiteSpace(m.Groups["legacyarrayclass"].Value.Trim()); interfaceDefinition.LegacyUnenumerableNamedProperties = interfaceDefinition.LegacyUnenumerableNamedProperties || !string.IsNullOrWhiteSpace(m.Groups["legacyunenumerablenamedproperties"].Value.Trim()); interfaceDefinition.NoInterfaceObject = interfaceDefinition.NoInterfaceObject || !string.IsNullOrWhiteSpace(m.Groups["nointerfaceobject"].Value.Trim()); interfaceDefinition.OverrideBuiltins = interfaceDefinition.OverrideBuiltins || !string.IsNullOrWhiteSpace(m.Groups["overridebuiltins"].Value.Trim()); interfaceDefinition.IsPrimaryGlobal = interfaceDefinition.IsPrimaryGlobal || !string.IsNullOrWhiteSpace(m.Groups["primaryglobal"].Value.Trim()); interfaceDefinition.SecureContext = interfaceDefinition.SecureContext || !string.IsNullOrWhiteSpace(m.Groups["securecontext"].Value.Trim()); interfaceDefinition.Unforgeable = interfaceDefinition.Unforgeable || !string.IsNullOrWhiteSpace(m.Groups["unforgeable"].Value.Trim()); var constructor = m.Groups["constructor"].Value.Trim(); if (!string.IsNullOrWhiteSpace(constructor)) { constructors.Add(RegexLibrary.ParenCleaner.Replace(constructor, string.Empty)); } var named = m.Groups["namedconstructor"].Value.Trim(); if (!string.IsNullOrWhiteSpace(named)) { namedConstructors.Add(named); } var exposedValue = RegexLibrary.GroupingCleaner.Replace(m.Groups["exposed"].Value, string.Empty); if (!string.IsNullOrWhiteSpace(exposedValue)) { exposed.AddRange(exposedValue.Split(new[] { "," }, StringSplitOptions.RemoveEmptyEntries).Select(api => api.Trim())); } var globalsValue = RegexLibrary.GroupingCleaner.Replace(m.Groups["globals"].Value, string.Empty); if (!string.IsNullOrWhiteSpace(globalsValue)) { globals.AddRange(globalsValue.Split(new[] { "," }, StringSplitOptions.RemoveEmptyEntries).Select(api => api.Trim())); } var primaryGlobalsValue = RegexLibrary.GroupingCleaner.Replace(m.Groups["primaryglobals"].Value, string.Empty); if (!string.IsNullOrWhiteSpace(primaryGlobalsValue)) { primaryGlobals.AddRange(primaryGlobalsValue.Split(new[] { "," }, StringSplitOptions.RemoveEmptyEntries).Select(api => api.Trim())); } } interfaceDefinition.Constructors = constructors.Distinct(); interfaceDefinition.NamedConstructors = namedConstructors.Distinct(); interfaceDefinition.Exposed = exposed.Distinct(); interfaceDefinition.Globals = globals.Distinct(); interfaceDefinition.PrimaryGlobals = primaryGlobals.Distinct(); } var inherits = iface.Groups["inherits"].Value; interfaceDefinition.Inherits = inherits.Split(new[] { "," }, StringSplitOptions.RemoveEmptyEntries).Select(api => api.Trim()); interfaceDefinition.Members = iface.Groups["members"].Length > 0 ? GetAllInterfaceMembers(iface.Groups["members"].Value, specificationData, ref interfaceDefinition) : new List<Member>(); if (!interfaces.Contains(interfaceDefinition)) { interfaces.Add(interfaceDefinition); } else { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("Duplicate interface: " + interfaceDefinition.Name); Console.ForegroundColor = ConsoleColor.Gray; } } return interfaces; }
private static IEnumerable<Member> GetAllInterfaceMembers(string memberItems, SpecData specificationData, ref InterfaceType interfaceDefinition) { var memberList = new List<Member>(); memberItems = CleanString(memberItems); var members = memberItems.Split(new[] { ";" }, StringSplitOptions.RemoveEmptyEntries).Select(m => m.Trim()).ToArray(); foreach (var item in members.Where(item => !string.IsNullOrWhiteSpace(item))) { if (IndividualInterfaceMember.IsMatch(item)) { var m = IndividualInterfaceMember.Match(item); var isProperty = !string.IsNullOrWhiteSpace(m.Groups["attribute"].Value) && string.IsNullOrWhiteSpace(m.Groups["function"].Value) && string.IsNullOrWhiteSpace(m.Groups["maplike"].Value) && string.IsNullOrWhiteSpace(m.Groups["setlike"].Value) && !(RegexLibrary.TypeCleaner.Replace(m.Groups["type"].Value, "?") .Trim()) .Equals("function", StringComparison.OrdinalIgnoreCase); var name = m.Groups["item"].Value.Trim(); //Skip special CSSOM definitions if (new[] { "_camel_cased_attribute", "_webkit_cased_attribute", "_dashed_attribute" }.Contains(name)) { continue; } var memberItem = new Member(name) { Type = RegexLibrary.OldTypeCleaner.Replace(RegexLibrary.TypeCleaner.Replace(m.Groups["type"].Value.Replace("≺", "<").Replace("≻", ">"), "?"), string.Empty).Trim(), Args = m.Groups["args"].Value.Trim(), Function = !string.IsNullOrWhiteSpace(m.Groups["function"].Value), Attribute = !string.IsNullOrWhiteSpace(m.Groups["attribute"].Value), ExtendedAttribute = m.Groups["extended"].Value.Trim(), Static = !string.IsNullOrWhiteSpace(m.Groups["static"].Value), HasGet = isProperty, Getter = !string.IsNullOrWhiteSpace(m.Groups["getter"].Value), Setter = !string.IsNullOrWhiteSpace(m.Groups["setter"].Value), Creator = !string.IsNullOrWhiteSpace(m.Groups["creator"].Value), Deleter = !string.IsNullOrWhiteSpace(m.Groups["deleter"].Value), LegacyCaller = !string.IsNullOrWhiteSpace(m.Groups["legacycaller"].Value), Stringifier = !string.IsNullOrWhiteSpace(m.Groups["stringifier"].Value), Serializer = !string.IsNullOrWhiteSpace(m.Groups["serializer"].Value), Inherit = !string.IsNullOrWhiteSpace(m.Groups["inherit"].Value), MapLike = !string.IsNullOrWhiteSpace(m.Groups["maplike"].Value), SetLike = !string.IsNullOrWhiteSpace(m.Groups["setlike"].Value), Readonly = !string.IsNullOrWhiteSpace(m.Groups["readonly"].Value) || !string.IsNullOrWhiteSpace(m.Groups["setraises"].Value), Required = !string.IsNullOrWhiteSpace(m.Groups["required"].Value), Iterable = !string.IsNullOrWhiteSpace(m.Groups["iterable"].Value), LegacyIterable = !string.IsNullOrWhiteSpace(m.Groups["legacyiterable"].Value), Bracket = m.Groups["bracket"].Value.Trim(), Const = !string.IsNullOrWhiteSpace(m.Groups["const"].Value), Value = m.Groups["value"].Value.Trim(), SpecNames = new[] { specificationData.Name } }; if (!string.IsNullOrWhiteSpace(memberItem.ExtendedAttribute)) { var exposed = new List<string>(); foreach (Match mep in MemberExtendedParser.Matches(memberItem.ExtendedAttribute)) { memberItem.Clamp = memberItem.Clamp || !string.IsNullOrWhiteSpace(mep.Groups["clamp"].Value.Trim()); memberItem.EnforceRange = memberItem.EnforceRange || !string.IsNullOrWhiteSpace(mep.Groups["enforcerange"].Value.Trim()); memberItem.LenientSetter = memberItem.LenientSetter || !string.IsNullOrWhiteSpace(mep.Groups["lenientsetter"].Value.Trim()); memberItem.LenientThis = memberItem.LenientThis || !string.IsNullOrWhiteSpace(mep.Groups["lenientthis"].Value.Trim()); memberItem.NewObject = memberItem.NewObject || !string.IsNullOrWhiteSpace(mep.Groups["newobject"].Value.Trim()); memberItem.PutForwards = mep.Groups["putforwards"].Value.Trim(); memberItem.Replaceable = memberItem.Replaceable || !string.IsNullOrWhiteSpace(mep.Groups["replaceable"].Value.Trim()); memberItem.SameObject = memberItem.SameObject || !string.IsNullOrWhiteSpace(mep.Groups["sameobject"].Value.Trim()); memberItem.SecureContext = memberItem.SecureContext || !string.IsNullOrWhiteSpace(mep.Groups["securecontext"].Value.Trim()); memberItem.TreatNullAs = mep.Groups["treatnullas"].Value.Trim(); memberItem.TreatUndefinedAs = mep.Groups["treatundefinedas"].Value.Trim(); memberItem.Unforgeable = memberItem.Unforgeable || !string.IsNullOrWhiteSpace(mep.Groups["unforgeable"].Value.Trim()); memberItem.Unscopeable = memberItem.Unscopeable || !string.IsNullOrWhiteSpace(mep.Groups["unscopeable"].Value.Trim()); var exposedValue = RegexLibrary.GroupingCleaner.Replace(mep.Groups["exposed"].Value, string.Empty); if (!string.IsNullOrWhiteSpace(exposedValue)) { exposed.AddRange(exposedValue.Split(new[] { "," }, StringSplitOptions.RemoveEmptyEntries).Select(api => api.Trim())); } } memberItem.Exposed = exposed.Distinct(); } try { memberItem.ArgTypes = GetArgTypes(memberItem.Args); } catch (ArgumentException) { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("Fail argument for member- " + item); Console.ForegroundColor = ConsoleColor.Gray; continue; } memberItem.HasSet = (!memberItem.Readonly & isProperty) || (memberItem.Readonly && memberItem.ExtendedAttribute.IndexOf("replaceable", StringComparison.OrdinalIgnoreCase) > -1); if (!memberList.Contains(memberItem)) { memberList.Add(memberItem); } } else { //detect if its an interface extended attribute if ((item.StartsWith("constructor", StringComparison.InvariantCultureIgnoreCase)) && (InterfaceExtendedParser.IsMatch(item))) { var constructors = interfaceDefinition.Constructors.ToList(); constructors.AddRange(from Match m in InterfaceExtendedParser.Matches(item) select m.Groups["constructor"].Value.Trim() into constructor where !string.IsNullOrWhiteSpace(constructor) select RegexLibrary.ParenCleaner.Replace(constructor, string.Empty)); interfaceDefinition.Constructors = constructors.Distinct(); continue; } Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("Fail member- " + item); Console.ForegroundColor = ConsoleColor.Gray; } } return memberList.OrderBy(a => a.Name).ToList(); }
public string GetCommandLineParameters() { StringBuilder sb = new StringBuilder(); if (communicator.media is GXNet n) { if (n.HostName == null) { n.Settings = MediaSettings; } sb.Append("-h " + n.HostName); sb.Append(" -p " + n.Port); } if (communicator.media is GXSerial s) { if (s.PortName == null) { s.Settings = MediaSettings; } sb.Append("-S " + s.PortName); sb.Append(":" + s.BaudRate); sb.Append(":" + s.DataBits); sb.Append(s.Parity); sb.Append(s.StopBits); } if (!UseLogicalNameReferencing) { sb.Append(" -r sn"); } if (InterfaceType != InterfaceType.HDLC) { sb.Append(" -i" + InterfaceType.ToString()); } if (ClientAddress != 16) { sb.Append(" -c " + ClientAddress); } if (HDLCAddressing == HDLCAddressType.Default) { if (PhysicalAddress != 1 && LogicalAddress != 0) { if (InterfaceType == InterfaceType.HDLC || InterfaceType == InterfaceType.HdlcWithModeE || InterfaceType == InterfaceType.PlcHdlc) { sb.Append(" -s " + GXDLMSClient.GetServerAddress(LogicalAddress, Convert.ToInt32(PhysicalAddress))); } else { sb.Append(" -s " + communicator.client.ServerAddress); } } } else if (HDLCAddressing == HDLCAddressType.SerialNumber) { if (PhysicalAddress != 1) { sb.Append(" -n " + PhysicalAddress); } } if (Authentication != Authentication.None) { sb.Append(" -a " + Authentication); if (!string.IsNullOrEmpty(Password)) { string pw = ASCIIEncoding.ASCII.GetString(CryptHelper.Decrypt(Password, GXDLMSDirector.Password.Key)); if (!string.IsNullOrEmpty(pw)) { sb.Append(" -P " + pw); } } if (HexPassword != null && HexPassword.Length != 0) { sb.Append(" -P 0x" + ASCIIEncoding.ASCII.GetString(CryptHelper.Decrypt(HexPassword, GXDLMSDirector.Password.Key))); } } if (Security != Security.None) { sb.Append(" -C " + Security); } if (SecuritySuite != SecuritySuite.Suite0) { sb.Append(" -V " + SecuritySuite); } if (Signing != Signing.None) { sb.Append(" -K " + Signing); } if (Authentication == Authentication.HighSHA256 || Authentication == Authentication.HighECDSA || Security != Security.None) { if (!string.IsNullOrEmpty(SystemTitle)) { sb.Append(" -T " + SystemTitle); } if (!string.IsNullOrEmpty(ServerSystemTitle)) { sb.Append(" -M " + ServerSystemTitle); } if (Security != Security.None) { if (!string.IsNullOrEmpty(AuthenticationKey)) { sb.Append(" -A " + AuthenticationKey); } if (!string.IsNullOrEmpty(BlockCipherKey)) { sb.Append(" -B " + BlockCipherKey); } if (!string.IsNullOrEmpty(DedicatedKey)) { sb.Append(" -D " + DedicatedKey); } } if (!string.IsNullOrEmpty(FrameCounter)) { sb.Append(" -v " + FrameCounter); } } if (Standard != Standard.DLMS) { sb.Append(" -d " + Standard); } if (InterfaceType == InterfaceType.HDLC || InterfaceType == InterfaceType.HdlcWithModeE) { if (GbtWindowSize != 1) { sb.Append(" -W " + GbtWindowSize); } if (WindowSizeRX != 128) { sb.Append(" -w " + WindowSizeRX); } if (MaxInfoTX != 1) { sb.Append(" -f " + MaxInfoRX); } } sb.Append(" -t Verbose"); return(sb.ToString()); }
public void IncrementQuery(InterfaceType ifType) { if (!initialized) return; _Queries.Increment(); }
public void DecrementGetList(InterfaceType ifType, int resultSize, long startTicks, long endTicks) { if (!initialized) return; _GetList.Decrement(resultSize, startTicks, endTicks); }
public void IncrementFetchRelation(InterfaceType ifType) { if (!initialized) return; _FetchRelation.Increment(); }
public void IncrementGetListOf(InterfaceType ifType) { if (!initialized) return; _GetListOf.Increment(); }
public override void Read(BigEndianStream stream) { WindowId = stream.ReadSByte(); InventoryType = (InterfaceType)stream.ReadSByte(); WindowTitle = stream.ReadString16(100); SlotCount = stream.ReadSByte(); }
public void DecrementFetchRelation(InterfaceType ifType, int resultSize, long startTicks, long endTicks) { if (!initialized) return; _FetchRelation.Decrement(resultSize, startTicks, endTicks); }
public void FindTypeProperties() { var result = InterfaceType.NewProxy <TestInteface>(); var nameProperty = result.GetType().GetProperty("Name"); var attrs = nameProperty.GetCustomAttributes(); }
internal CraftingInterface(InterfaceType type, sbyte craftingSlots, sbyte slotCount) : base(type, slotCount) { CraftingSlotCount = craftingSlots; }
internal PersistentContainerInterface(WorldManager world, UniversalCoords coords, InterfaceType interfaceType, sbyte slotCount) : base(interfaceType, slotCount) { World = world; Coords = coords; }