本文整理汇总了C#中INodePacketTranslator类的典型用法代码示例。如果您正苦于以下问题:C# INodePacketTranslator类的具体用法?C# INodePacketTranslator怎么用?C# INodePacketTranslator使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
INodePacketTranslator类属于命名空间,在下文中一共展示了INodePacketTranslator类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DeserializeAndRoutePacket
/// <summary>
/// Creates and routes a packet with data from a binary stream.
/// </summary>
public void DeserializeAndRoutePacket(int nodeId, NodePacketType packetType, INodePacketTranslator translator)
{
// PERF: Not using VerifyThrow to avoid boxing of packetType in the non-error case
if (!_packetFactories.ContainsKey(packetType))
{
ErrorUtilities.ThrowInternalError("No packet handler for type {0}", packetType);
}
PacketFactoryRecord record = _packetFactories[packetType];
record.DeserializeAndRoutePacket(nodeId, translator);
}
示例2: TranslateTargetFinishedEvent
/// <summary>
/// Translate the TargetOutputs for the target finished event.
/// </summary>
private static void TranslateTargetFinishedEvent(INodePacketTranslator translator, TargetFinishedEventArgs finishedEvent)
{
List<TaskItem> targetOutputs = null;
if (translator.Mode == TranslationDirection.WriteToStream)
{
if (finishedEvent.TargetOutputs != null)
{
targetOutputs = new List<TaskItem>();
foreach (TaskItem item in finishedEvent.TargetOutputs)
{
targetOutputs.Add(item);
}
}
}
translator.Translate<TaskItem>(ref targetOutputs, TaskItem.FactoryForDeserialization);
if (translator.Mode == TranslationDirection.ReadFromStream)
{
finishedEvent.TargetOutputs = targetOutputs;
}
}
示例3:
/// <summary>
/// Writes the packet to the serializer.
/// Always send as ints, even if ushorts are being used: otherwise it'd
/// need a byte to discriminate and the savings would be microscopic.
/// </summary>
void INodePacketTranslatable.Translate(INodePacketTranslator translator)
{
ErrorUtilities.VerifyThrow(translator.Mode == TranslationDirection.WriteToStream, "write only");
string file = File;
int line = Line;
int column = Column;
translator.Translate(ref file);
translator.Translate(ref line);
translator.Translate(ref column);
}
示例4: DeserializeAndRoutePacket
public void DeserializeAndRoutePacket(int nodeId, NodePacketType packetType, INodePacketTranslator translator)
{
throw new NotImplementedException();
}
示例5: DeserializeAndRoutePacket
/// <summary>
/// Deserializes and routes a packet. Not used in the in-proc node.
/// </summary>
public void DeserializeAndRoutePacket(int nodeId, NodePacketType packetType, INodePacketTranslator translator)
{
// Not used
ErrorUtilities.ThrowInternalErrorUnreachable();
}
示例6: Translate
/// <summary>
/// Serializes or deserializes a packet.
/// </summary>
public void Translate(INodePacketTranslator translator)
{
translator.TranslateEnum(ref _reason, (int)_reason);
translator.TranslateDotNet(ref _exception);
}
示例7: Translate
public void Translate(INodePacketTranslator translator)
{
ErrorUtilities.VerifyThrow(translator.Mode == TranslationDirection.WriteToStream, "write only");
string assemblyName = AssemblyName;
string assemblyFile = AssemblyFile;
translator.Translate(ref assemblyName);
translator.Translate(ref assemblyFile);
}
示例8: FactoryForDeserialization
/// <summary>
/// The class factory for deserialization.
/// </summary>
internal static BuildParameters FactoryForDeserialization(INodePacketTranslator translator)
{
return new BuildParameters(translator);
}
示例9: BuildRequest
/// <summary>
/// Private constructor for deserialization
/// </summary>
private BuildRequest(INodePacketTranslator translator)
{
Translate(translator);
}
示例10: FactoryForDeserialization
/// <summary>
/// Factory for deserialization.
/// </summary>
internal static INodePacket FactoryForDeserialization(INodePacketTranslator translator)
{
TaskHostConfiguration configuration = new TaskHostConfiguration();
configuration.Translate(translator);
return configuration;
}
示例11: Translate
/// <summary>
/// Translates the packet to/from binary form.
/// </summary>
/// <param name="translator">The translator to use.</param>
public void Translate(INodePacketTranslator translator)
{
translator.Translate(ref _nodeId);
translator.Translate(ref _startupDirectory);
translator.TranslateDictionary(ref _buildProcessEnvironment, StringComparer.OrdinalIgnoreCase);
translator.TranslateCulture(ref _culture);
translator.TranslateCulture(ref _uiCulture);
translator.TranslateDotNet(ref _appDomainSetup);
translator.Translate(ref _lineNumberOfTask);
translator.Translate(ref _columnNumberOfTask);
translator.Translate(ref _projectFileOfTask);
translator.Translate(ref _taskName);
translator.Translate(ref _taskLocation);
translator.TranslateDictionary(ref _taskParameters, StringComparer.OrdinalIgnoreCase, TaskParameter.FactoryForDeserialization);
translator.Translate(ref _continueOnError);
}
示例12: WorkUnitResult
/// <summary>
/// Translator constructor
/// </summary>
private WorkUnitResult(INodePacketTranslator translator)
{
((INodePacketTranslatable)this).Translate(translator);
}
示例13: FactoryForDeserialization
/// <summary>
/// Factory for serialization.
/// </summary>
static internal WorkUnitResult FactoryForDeserialization(INodePacketTranslator translator)
{
return new WorkUnitResult(translator);
}
示例14: Translate
/// <summary>
/// Translator.
/// </summary>
public void Translate(INodePacketTranslator translator)
{
translator.TranslateEnum(ref _resultCode, (int)_resultCode);
translator.TranslateEnum(ref _actionCode, (int)_actionCode);
translator.TranslateDotNet(ref _exception);
}
示例15: DeserializeAndRoutePacket
/// <summary>
/// Takes a serializer, deserializes the packet and routes it to the appropriate handler.
/// </summary>
/// <param name="nodeId">The node from which the packet was received.</param>
/// <param name="packetType">The packet type.</param>
/// <param name="translator">The translator containing the data from which the packet should be reconstructed.</param>
public void DeserializeAndRoutePacket(int nodeId, NodePacketType packetType, INodePacketTranslator translator)
{
throw new NotSupportedException("not used");
}