public TextResendMessageViewModel(EventInfo eventInfo) { this._eventInfo = eventInfo; DataDirection direction = (eventInfo.ProxyConnection.HasConnection(eventInfo.Direction) && DataDirection.Origin == eventInfo.Direction) ? eventInfo.Direction : DataDirection.Target; Direction = (string)(new EnumToStringConverter().Convert(direction, typeof(DataDirection))); }
public void InitializeConnection(BaseNode _node, DataDirection _direction, VarType _varType, int _num) { node = _node; dataDirection = _direction; varType = _varType; num = _num; }
public OneDasModule(OneDasDataType dataType, DataDirection dataDirection, Endianness endianness, int size) { this.DataType = dataType; this.DataDirection = dataDirection; this.Endianness = endianness; this.Size = size; }
private void DmaTransfer(byte[] data, int bytes, DataDirection direction) { Place source, destination; uint currentDescriptorAddress = descriptorListBaseAddress; int bytesTransferred = 0; while (bytesTransferred < bytes) { int bytesLeft = bytes - bytesTransferred; var currentDescriptor = new SunxiDMADescriptor(currentDescriptorAddress, dmaEngine); int bytesToTransfer = currentDescriptor.BufferSize > bytesLeft ? bytesLeft : (int)currentDescriptor.BufferSize; if (direction == DataDirection.ReadFromSD) { destination = currentDescriptor.BufferAddress; source = new Place(data, bytesTransferred); } else { destination = new Place(data, bytesTransferred); source = currentDescriptor.BufferAddress; } var request = new Request(source, destination, bytesToTransfer, TransferType.DoubleWord, TransferType.DoubleWord); dmaEngine.IssueCopy(request); currentDescriptor.Release(); bytesTransferred += bytesToTransfer; currentDescriptorAddress = currentDescriptor.NextDescriptor; } }
/// <summary> /// Resolves the <see cref="ApiSerializer"/> for the type provided /// </summary> public ApiSerializer Resolve(Type objectType, DataDirection direction) { if (!objectType.IsClass) { // at this point in time, we only support non-generic class // this is because this isn't designed to filter generic types return(Default); } var mapping = direction switch { DataDirection.In => DeserializerMap, DataDirection.Out => SerializerMap, _ => throw new ArgumentException(nameof(direction)) }; // if the map has the type registered, check the type in cache if (mapping.TryGetValue(objectType, out var serializerType)) { return(_serializerCache.GetOrAdd(serializerType, _ => (ApiSerializer)Activator.CreateInstance(serializerType))); } // use generic return(Default); }
public static ControlWord BuildCommand(int address, DataDirection direction, int subaddress, int lengthOrCode) { address.CheckMask(0x1F, nameof(address)); subaddress.CheckMask(0x1F, nameof(subaddress)); lengthOrCode.CheckMask(0x1F, nameof(lengthOrCode)); return(new ControlWord((ushort)((address << 11) | ((int)direction << 10) | (subaddress << 5) | lengthOrCode))); }
public static IEnumerable <HistoricalBar <double> > ToHistoricalBars( this IEnumerable <ITickMessage <double> > tickMessages, TimeSpan interval, DataDirection direction = DataDirection.Newest) { return(direction == DataDirection.Newest ? ToHistoricalBarsDescending(tickMessages, interval) : ToHistoricalBarsAscending(tickMessages, interval)); }
public static IEnumerable <HistoricalBar> ToHistoricalBarsUncompressed( this IEnumerable <IIntervalMessage> intervalMessages, TimeSpan interval, DataDirection dataDirection = DataDirection.Newest) { return(dataDirection == DataDirection.Newest ? intervalMessages.ToHistoricalBarsUncompressedDescending(interval) : intervalMessages.ToHistoricalBarsUncompressedAscending(interval)); }
public static IEnumerable <HistoricalBar> ToHistoricalBarsUncompressed( this IEnumerable <ITickMessage> tickMessages, TimeSpan interval, DataDirection direction = DataDirection.Newest) { return(direction == DataDirection.Newest ? ToHistoricalBarsUncompressedDescending(tickMessages, interval) : ToHistoricalBarsUncompressedAscending(tickMessages, interval)); }
public DataPort(string name, OneDasDataType dataType, DataDirection dataDirection, Endianness endianness) { this.Name = name; this.DataType = dataType; this.DataDirection = dataDirection; this.Endianness = endianness; this.BitOffset = -1; // i.e. bool is treated as byte-oriented }
public static IEnumerable <HistoricalBar> ToHistoricalBars( this IEnumerable <ITickMessage> tickMessages, int ticks, DataDirection direction = DataDirection.Newest) { return(direction == DataDirection.Newest ? ToHistoricalBarsDescending(tickMessages, ticks) : ToHistoricalBarsAscending(tickMessages, ticks)); }
/// <inheritdoc /> public IPipelinedDecryptor CreateDecryptor(PipeReader source, DataDirection direction) { if (direction == DataDirection.ClientToServer) { return(new PipelinedDecryptor(source, PipelinedSimpleModulusDecryptor.DefaultServerKey, Xor32Key)); } return(new PipelinedSimpleModulusDecryptor(source, PipelinedSimpleModulusDecryptor.DefaultClientKey)); }
public static IEnumerable <HistoricalBar <double> > ToHistoricalBars( this IEnumerable <IIntervalMessage <double> > intervalMessages, TimeSpan interval, DataDirection dataDirection = DataDirection.Newest) { return(dataDirection == DataDirection.Newest ? intervalMessages.ToHistoricalBarsDescending(interval) : intervalMessages.ToHistoricalBarsAscending(interval)); }
public static string GetFileName(TestDataType type, DataDirection direction) { var filename = $@"{type.ToString().ToLower()}_{direction.ToString().ToLower()}"; var path = Path.Combine(TestContext.CurrentContext.TestDirectory, "TestData", $@"{filename}.zip"); var tmpDir = GetTemporaryDirectory(); ZipFile.ExtractToDirectory(path, tmpDir); return(Path.Combine(tmpDir, $@"{filename}.csv")); }
/// <inheritdoc /> public IPipelinedEncryptor CreateEncryptor(PipeWriter target, DataDirection direction) { if (direction == DataDirection.ServerToClient) { return(new PipelinedEncryptor(target)); } return(new PipelinedXor32Encryptor(new PipelinedSimpleModulusEncryptor(target, PipelinedSimpleModulusEncryptor.DefaultClientKey).Writer, Xor32Key)); }
public Rule(int Address, DataDirection Direction, int Subaddress, int Length, string Name, Color Color) { this.Address = Address; this.Direction = Direction; this.Subaddress = Subaddress; this.Length = Length; this.Name = Name; this.Color = Color.ToString(); }
/// <summary> /// Constructor /// </summary> /// <param name="Type"></param> /// <param name="DataMember"></param> /// <param name="Name"></param> /// <param name="DataDirection"></param> public DataContractMemberInfo(Type Type, MemberInfo DataMember, string Name, DataDirection DataDirection) { this.DeclaringType = Type; this.DataDirection = DataDirection; Member = DataMember; _Name = Name; Field = DataMember as FieldInfo; Property = DataMember as PropertyInfo; }
/// <summary> /// 增加参数 /// </summary> /// <param name="name">名称</param> /// <param name="value">值</param> /// <param name="type">数据类型</param> /// <param name="direction">数据方向</param> public void Add(string name, object value, DataType type, DataDirection direction) { DbParameter param = this.cmd.CreateParameter(); param.ParameterName = name; param.DbType = this.ConvertToDbType(type); param.Value = value; param.Direction = this.ConvertToParameterDirection(direction); this.cmd.Parameters.Add(param); }
public void DisconnectChannel(DataDirection direction) { if (direction == DataDirection.Origin) { DisconnectOriginChannel(); } else { DisconnectTargetChannel(); } }
public void AddData(DataDirection direction, byte[] data) { if (direction == DataDirection.Origin) { AddToOriginData(data); } else { AddToTargetData(data); } }
//public ControlWord(int address, DataDirection direction, int subaddress, int length) //{ // length.CheckRange(1, 32, nameof(length)); // Value = BuildCommand(address, direction, subaddress, length == 32 ? 0 : 1).Value; //} //Зачем нужен тернарный? //TODO public ControlWord(int address, DataDirection direction, int subaddress, int length) { //length.CheckRange(1, 32, nameof(length)); if (length == 32) { Value = BuildCommand(address, direction, subaddress, 0).Value; } else { Value = BuildCommand(address, direction, subaddress, length).Value; } }
/// <summary> /// Removes the registered serializer for the type. This applies to all <see cref="ApiClient"/>s /// </summary> /// <param name="direction">Whether this serializer should be removed from incoming/outgoing data</param> /// <typeparam name="T">The object type to remove the serializer for</typeparam> public static void Unregister <T>(DataDirection direction = DataDirection.All) where T : class { if (direction.HasFlag(DataDirection.In)) { DeserializerMap.Remove(typeof(T)); } if (direction.HasFlag(DataDirection.Out)) { SerializerMap.Remove(typeof(T)); } }
/// <summary> /// Registers a serializer for the specified type. This applies to all <see cref="ApiClient"/>s /// </summary> /// <param name="direction">Whether this serializer should apply to incoming/outgoing data</param> /// <typeparam name="T">The object type to specify the serializer for</typeparam> /// <typeparam name="TSerializer">The serializer to apply</typeparam> public static void Register <T, TSerializer>(DataDirection direction = DataDirection.All) where T : class where TSerializer : ApiSerializer, new() { if (direction.HasFlag(DataDirection.In)) { DeserializerMap[typeof(T)] = typeof(TSerializer); } if (direction.HasFlag(DataDirection.Out)) { SerializerMap[typeof(T)] = typeof(TSerializer); } }
/// <summary> /// Try to get data member name for column name. /// </summary> /// <param name="columnName">The database column name</param> /// <param name="memberName">The data member name</param> /// <param name="dataDirection">The required data direction (only non-zero is tested)</param> /// <returns></returns> public bool TryGetDataMemberName(string columnName, out string memberName, DataDirection dataDirection = 0) { if (Key.DynamicNullContract) { memberName = columnName; return(true); } if (TryGetDataMemberInfo(columnName, out DataContractMemberInfo memberInfo, dataDirection)) { memberName = memberInfo.Name; return(true); } memberName = null; return(false); }
public void FormatData(IDataPacket[] dataPackets, RichTextBox richTextBox) { if (dataPackets == null || dataPackets.Length == 0) { return; } richTextBox.Clear(); ScatterGatherStream sgStream = new ScatterGatherStream(); DataDirection dir = dataPackets[0].Direction; Color color = dataPackets[0].Direction == DataDirection.Received ? Color.Purple : Color.Blue; BinaryFormatReader bfr = new BinaryFormatReader(); int dataCount = 0; for (int i = 0; i < dataPackets.Length; i++) { IDataPacket dataPacket = dataPackets[i]; if (dataPacket.Direction != dir) { if (dataCount > 0) { StringWriter writer = new StringWriter(); bfr.ReadAndDump(sgStream, writer); richTextBox.SelectionColor = color; richTextBox.AppendText(writer.ToString()); richTextBox.AppendText("\n----------------------------------------------\n"); } sgStream = new ScatterGatherStream(); dir = dataPacket.Direction; color = dir == DataDirection.Received ? Color.Purple : Color.Blue; dataCount = 0; } byte[] data = dataPacket.Data; if (data != null && data.Length > 0) { if (data[0] == 0x2E && data[1] == 0x4E && data[2] == 0x45 && data[3] == 0x54) { richTextBox.SelectionColor = color; richTextBox.AppendText("\nHeader For " + dir.ToString()); richTextBox.AppendText("\n----------------------------------------------\n"); } else { sgStream.Add(data); dataCount += data.Length; } } } }
public ScsiPassThroughWrapper(byte[] cdb = null, DataDirection direction = DataDirection.SCSI_IOCTL_DATA_UNSPECIFIED, UInt32 dataTransferLength = 0) { this.sptBuffered = new ScsiPassThroughBuffered(); this.sptBuffered.Spt.Cdb = new byte[16]; this.SetCdb(cdb); this.sptBuffered.Spt.Length = (UInt16)Marshal.SizeOf(this.sptBuffered.Spt); this.sptBuffered.Spt.CommandDescriptorBlockLength = 16; this.sptBuffered.Spt.TimeOutValue = 60; this.sptBuffered.Spt.DataIn = (byte)direction; this.SetDataLength(dataTransferLength); this.sptBuffered.Spt.DataBufferOffset = new IntPtr(Marshal.SizeOf(this.sptBuffered) - 65536); }
public ChooseCrypto(DataDirection dir) { InitializeComponent(); if (dir == DataDirection.Download) { Text = "Choose a decryption algorithm"; checkBoxDepadChoice.Visible = true; } else if (dir == DataDirection.Upload) { Text = "Choose an encryption algorithm"; checkBoxDepadChoice.Visible = false; } else { throw new ArgumentOutOfRangeException(); } }
/// <summary> /// 将方向转换成参数方向 /// </summary> /// <param name="direction"></param> /// <returns></returns> private ParameterDirection ConvertToParameterDirection(DataDirection direction) { switch (direction) { case DataDirection.Input: return(ParameterDirection.Input); case DataDirection.Output: return(ParameterDirection.Output); case DataDirection.InputOutput: return(ParameterDirection.InputOutput); case DataDirection.ReturnValue: return(ParameterDirection.ReturnValue); default: return(ParameterDirection.Input); } }
public void ThenSetValue_Perform_SetDataDirectionTest() { DataDirection direction = DataDirection.Target; Mock <EventInfo> mockEventInfo = new Mock <EventInfo>(); Mock <VariableString> mockToTargetTextString = new Mock <VariableString>(It.IsAny <string>(), null); EventInfo eventInfo = mockEventInfo.Object; VariableString toTargetTextString = mockToTargetTextString.Object; mockToTargetTextString.Setup(mock => mock.GetText(It.IsAny <Variables>())).Returns(direction.ToString()); ThenSetValue then = new ThenSetValue() { Text = toTargetTextString, DestinationMessageValue = MessageValue.DataDirection }; Assert.AreEqual(ThenResponse.Continue, then.Perform(eventInfo)); mockEventInfo.VerifySet(mock => mock.Direction = DataDirection.Target, Times.Once); }
protected virtual unsafe (IntPtr BufferPtr, int Size) CreateBuffer(int size, DataDirection dataDirection) { IntPtr ptr; switch (dataDirection) { case DataDirection.Input: _freeInputBufferPtr = true; break; case DataDirection.Output: _freeOutputBufferPtr = true; break; default: throw new ArgumentException(); } ptr = Marshal.AllocHGlobal(size); new Span <bool>(ptr.ToPointer(), size).Clear(); return(ptr, size); }
/// <summary> /// Try to get data member info for column name. /// </summary> /// <param name="columnName">The database column name</param> /// <param name="memberInfo">The data member info</param> /// <param name="dataDirection">The required data direction (only non-zero is tested)</param> /// <returns></returns> public bool TryGetDataMemberInfo(string columnName, out DataContractMemberInfo memberInfo, DataDirection dataDirection = 0) { if (!TryGetDataMemberInfo(columnName, out memberInfo)) { return(false); } if (dataDirection != 0 && memberInfo.DataDirection != 0 && (memberInfo.DataDirection | dataDirection) == 0) { memberInfo = null; } return(memberInfo != null); }
/// <summary> /// Compare a modified document node (this) to a previous one and look for breaking as well as non-breaking changes. /// </summary> /// <param name="context">The modified document context.</param> /// <param name="previous">The original document model.</param> /// <returns>A list of messages from the comparison.</returns> public override IEnumerable<ComparisonMessage> Compare(ComparisonContext context, SwaggerBase previous) { var priorSchema = previous as Schema; if (priorSchema == null) { throw new ArgumentNullException("priorVersion"); } if (context == null) { throw new ArgumentNullException("context"); } int referenced = 0; var thisSchema = this; if (!string.IsNullOrWhiteSpace(thisSchema.Reference)) { thisSchema = FindReferencedSchema(thisSchema.Reference, (context.CurrentRoot as ServiceDefinition).Definitions); referenced += 1; } if (!string.IsNullOrWhiteSpace(priorSchema.Reference)) { priorSchema = FindReferencedSchema(priorSchema.Reference, (context.PreviousRoot as ServiceDefinition).Definitions); referenced += 1; } // Avoid doing the comparison repeatedly by marking for which direction it's already been done. if (context.Direction != DataDirection.None && referenced == 2) { // Comparing two referenced schemas in the context of a parameter or response -- did we already do this? if (thisSchema._compareDirection == context.Direction || thisSchema._compareDirection == DataDirection.Both) { return new ComparisonMessage[0]; } _compareDirection |= context.Direction; } if (thisSchema != this || priorSchema != previous) { return thisSchema.Compare(context, priorSchema); } base.Compare(context, previous); if (priorSchema.ReadOnly != ReadOnly) { context.LogBreakingChange(ComparisonMessages.ReadonlyPropertyChanged2, priorSchema.ReadOnly.ToString().ToLower(CultureInfo.CurrentCulture), ReadOnly.ToString().ToLower(CultureInfo.CurrentCulture)); } if ((priorSchema.Discriminator == null && Discriminator != null) || (priorSchema.Discriminator != null && !priorSchema.Discriminator.Equals(Discriminator))) { context.LogBreakingChange(ComparisonMessages.DifferentDiscriminator); } if ((priorSchema.Extends == null && Extends != null) || (priorSchema.Extends != null && !priorSchema.Extends.Equals(Extends))) { context.LogBreakingChange(ComparisonMessages.DifferentExtends); } if ((priorSchema.AllOf == null && AllOf != null) || (priorSchema.AllOf != null && AllOf == null)) { context.LogBreakingChange(ComparisonMessages.DifferentAllOf); } else if (priorSchema.AllOf != null) { CompareAllOfs(context, priorSchema); } context.Push("properties"); CompareProperties(context, priorSchema); context.Pop(); return context.Messages; }
public virtual VarPass GetConnection(VarType _varType, DataDirection _direction, int _n) { if (_direction == DataDirection.IncomeData) { for (int i = 0; i < inConnections.Count; i++) { if (inConnections [i].varType == _varType && inConnections [i].num == _n) { return inConnections [i]; } } return null; } if (_direction == DataDirection.OutcomeData) { for (int i = 0; i < outConnections.Count; i++) { if (outConnections[i].varType == _varType && outConnections[i].num == _n){ return outConnections[i]; } } return null; } return null; }
public void LogData(string level, byte[] data, int offset, int count, DataDirection direction, string decoded) { }
private void DmaTransfer(byte[] data, int bytes, DataDirection direction) { Place source, destination; uint currentDescriptorAddress = descriptorListBaseAddress; int bytesTransferred = 0; while(bytesTransferred < bytes) { int bytesLeft = bytes - bytesTransferred; var currentDescriptor = new SunxiDMADescriptor(currentDescriptorAddress, dmaEngine); int bytesToTransfer = currentDescriptor.BufferSize > bytesLeft ? bytesLeft : (int) currentDescriptor.BufferSize; if(direction == DataDirection.ReadFromSD) { destination = currentDescriptor.BufferAddress; source = new Place(data, bytesTransferred); } else { destination = new Place(data, bytesTransferred); source = currentDescriptor.BufferAddress; } var request = new Request(source, destination, bytesToTransfer, TransferType.DoubleWord, TransferType.DoubleWord); dmaEngine.IssueCopy(request); currentDescriptor.Release(); bytesTransferred += bytesToTransfer; currentDescriptorAddress = currentDescriptor.NextDescriptor; } }