コード例 #1
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="label">The label of the node</param>
 /// <param name="guid">Unique ID of the node</param>
 /// <param name="color">The color of the log entry to use in a gui</param>
 /// <param name="convertToBytes">True indicates all packets are converted to bytes before being logged</param>
 /// <param name="tag">A textual tag to log</param>
 public LogPacketNodeFactory(string label, Guid guid, ColorValue color, string tag, bool convertToBytes)
     : base(label, guid)
 {
     Color = color;
     Tag = tag;
     ConvertToBytes = convertToBytes;
 }
コード例 #2
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="tag">The log tag</param>
 /// <param name="netId">The log network ID</param>
 /// <param name="frame">The log frame</param>
 /// <param name="color">The log colour</param>
 /// <param name="networkDescription">The log description</param>
 public LogPacketEventArgs(string tag, Guid netId, DataFrame frame, ColorValue color, string networkDescription)
 {
     Tag = tag;
     NetId = netId;
     Frame = frame;
     Color = color;
     NetworkDescription = networkDescription;
     Timestamp = DateTime.Now;
 }
コード例 #3
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="frame">The data frame to edit</param>
 /// <param name="selectPath">Path to select a node to edit</param>
 /// <param name="sender">The sending node</param>
 /// <param name="color">The colour to show in an edit window</param>
 /// <param name="tag">The textual tag to show in an edit window</param>
 public EditPacketEventArgs(DataFrame frame, string selectPath, BasePipelineNode sender, ColorValue color, string tag)
     : base()
 {
     Frame = frame;
     SelectPath = selectPath;
     Sender = sender;
     Color = color;
     Tag = tag;
 }
コード例 #4
0
ファイル: LogPacket.cs プロジェクト: michyer/canape
 /// <summary>
 /// Private Constructor
 /// </summary>
 /// <param name="tag"></param>
 /// <param name="netid"></param>
 /// <param name="uuid"></param>
 /// <param name="network"></param>
 /// <param name="frame"></param>
 /// <param name="color"></param>
 /// <param name="timestamp"></param>
 public LogPacket(string tag, Guid netid, Guid uuid, string network, DataFrame frame, ColorValue color, DateTime timestamp)
 {
     Tag = tag;
     NetId = netid;
     Uuid = uuid;
     Network = network;
     Frame = frame;
     Color = color;
     Timestamp = timestamp;
 }
コード例 #5
0
ファイル: ColorValue.cs プロジェクト: michyer/canape
        private static bool FindColor(string name, out ColorValue cv)
        {
            cv = new ColorValue();

            foreach (PropertyInfo pi in typeof(ColorValue).GetProperties(BindingFlags.Public | BindingFlags.Static))
            {
                if (pi.Name.Equals(name, StringComparison.OrdinalIgnoreCase))
                {
                    cv = (ColorValue)pi.GetValue(null, null);

                    return true;
                }
            }

            return false;
        }
コード例 #6
0
ファイル: ColorValue.cs プロジェクト: michyer/canape
        /// <summary>
        /// Try parsing the string
        /// </summary>
        /// <param name="str">The string to parse, should be in form of #RRGGBB where values are hex or an X11 color name</param>
        /// <param name="color">The output color value</param>
        /// <returns>True if could parse the string</returns>
        public static bool TryParse(string str, out ColorValue color)
        {
            bool ret = false;

            str = str.Trim();

            color = new ColorValue();

            if (str.StartsWith("#") && (str.Length == 7))
            {
                byte r = 0;
                byte g = 0;
                byte b = 0;

                if (ParseHex(str, 0, out r) && ParseHex(str, 2, out g) && ParseHex(str, 4, out b))
                {
                    color = new ColorValue(r, g, b);
                    ret = true;
                }
            }
            else
            {
                ret = FindColor(str, out color);
            }

            return ret;
        }
コード例 #7
0
ファイル: NetGraph.cs プロジェクト: michyer/canape
        /// <summary>
        /// Log a packet from the graph
        /// </summary>
        /// <param name="tag">A textual tag for the frame</param>
        /// <param name="color">The color to display the frame (if applicable)</param>
        /// <param name="frame">The frame to log, note this must be cloned to preserve its value</param>
        /// <param name="logAsBytes">Indicates whether the packet should be logged as a byte array</param>
        /// <param name="path">Selection path for which part of the packet to log</param>
        private void OnLogPacket(string tag, ColorValue color, DataFrame frame, bool logAsBytes, string path)
        {
            EventHandler<LogPacketEventArgs> logPacketEvent = LogPacketEvent;

            if (logPacketEvent != null)
            {
                DataFrame logFrame = null;
                if (path != "/")
                {
                    DataNode node = frame.SelectSingleNode(path);

                    if (node != null)
                    {
                        node = node.CloneNode();

                        DataKey key = node as DataKey;
                        if (key != null)
                        {
                            logFrame = new DataFrame(key);
                        }
                        else
                        {
                            logFrame = new DataFrame();
                            logFrame.Root.AddSubNode(node);
                        }

                        if (logAsBytes)
                        {
                            logFrame.ConvertToBasic();
                        }
                    }
                }
                else
                {
                    logFrame = logAsBytes ? new DataFrame(frame.ToArray()) : frame.CloneFrame();
                }

                if (logFrame != null)
                {
                    logPacketEvent(this, new LogPacketEventArgs(tag, Uuid, logFrame, color, NetworkDescription));
                }
            }
        }
コード例 #8
0
ファイル: NetGraph.cs プロジェクト: michyer/canape
 /// <summary>
 /// Log a packet from the graph
 /// </summary>
 /// <param name="tag">A textual tag for the frame</param>
 /// <param name="color">The color to display the frame (if applicable)</param>
 /// <param name="frame">The frame to log, note this must be cloned to preserve its value</param>
 /// <param name="logAsBytes">Indicates whether the packet should be logged as a byte array</param>
 public void DoLogPacket(string tag, ColorValue color, DataFrame frame, bool logAsBytes)
 {
     DoLogPacket(tag, color, frame, logAsBytes, "/");
 }
コード例 #9
0
ファイル: NetGraph.cs プロジェクト: michyer/canape
 /// <summary>
 /// Log a packet from the graph
 /// </summary>
 /// <param name="tag">A textual tag for the frame</param>
 /// <param name="color">The color to display the frame (if applicable)</param>
 /// <param name="frame">The frame to log, note this must be cloned to preserve its value</param>
 /// <param name="logAsBytes">Indicates whether the packet should be logged as a byte array</param>
 /// <param name="path">Selection path for which part of the packet to log</param>
 public void DoLogPacket(string tag, ColorValue color, DataFrame frame, bool logAsBytes, string path)
 {
     GetTopGraph().OnLogPacket(tag, color, frame, logAsBytes, path);
 }
コード例 #10
0
ファイル: NetGraph.cs プロジェクト: michyer/canape
        /// <summary>
        /// Edit a packet from the graph
        /// </summary>
        /// <param name="frame">The frame to edit</param>
        /// <param name="selectPath">A path to select when editing</param>
        /// <param name="sender">The sending nod</param>
        /// <param name="color">The colour to show in an edit window (if applicable)</param>
        /// <param name="tag">The textual tag to show in an edit window (if applicable)</param>
        /// <returns>The returned frame, this may or may not be the same frame as sent</returns>        
        public DataFrame DoEditPacket(DataFrame frame, string selectPath, BasePipelineNode sender, ColorValue color, string tag)
        {
            NetGraph top = GetTopGraph();

            EditPacketEventArgs args = new EditPacketEventArgs(frame, selectPath, sender, color, tag);

            top.OnEditPacket(this, args);

            return args.Frame;
        }
コード例 #11
0
 /// <summary>
 /// Constructor
 /// </summary>        
 /// <param name="color">The colour to show in an edit window</param>
 /// <param name="tag">The textual tag to show in an edit window</param>
 public EditPacketPipelineNode(ColorValue color, string tag)
 {
     _color = color;
     _tag = tag;
 }
コード例 #12
0
 /// <summary>
 /// Constructor
 /// </summary>
 public EditPacketNodeConfig()
 {
     Color = new ColorValue(255, 255, 255, 255);
 }
コード例 #13
0
ファイル: BasePipelineNode.cs プロジェクト: michyer/canape
 /// <summary>
 /// Wrapper method to log a packet
 /// </summary>
 /// <param name="tag">The logging tag</param>
 /// <param name="color">The logging colour</param>
 /// <param name="frame">The frame to log</param>
 /// <param name="logAsBytes">Indicates whether to log the packet as a byte array</param>
 protected void LogPacket(string tag, ColorValue color, DataFrame frame, bool logAsBytes)
 {
     Graph.DoLogPacket(tag, color, frame, false);
 }
コード例 #14
0
ファイル: BasePipelineNode.cs プロジェクト: michyer/canape
 /// <summary>
 /// Edit a packet from the graph
 /// </summary>
 /// <param name="frame">The frame to edit</param>
 /// <param name="selectPath">A path to select when editing</param>        
 /// <param name="color">The colour to show in an edit window (if applicable)</param>
 /// <param name="tag">The textual tag to show in an edit window (if applicable)</param>
 /// <returns>The returned frame, this may or may not be the same frame as sent</returns>        
 public DataFrame EditPacket(DataFrame frame, string selectPath, ColorValue color, string tag)
 {
     return Graph.DoEditPacket(frame, selectPath, this, color, tag);
 }
コード例 #15
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="label"></param>
 /// <param name="guid"></param>
 /// <param name="color">The colour to show in an edit window</param>
 /// <param name="tag">The textual tag to show in an edit window</param>
 public EditPacketNodeFactory(string label, Guid guid, ColorValue color, string tag)
     : base(label, guid)
 {
     _color = color;
     _tag = tag;
 }
コード例 #16
0
ファイル: StateGraphDocument.cs プロジェクト: michyer/canape
 internal StateGraphEntry(StateGraphDocument parent)
 {
     _parent = parent;
     _color = new ColorValue(255, 255, 255);
     _stateName = "CHANGE ME";
     _sslConfig = null;
     _layers = new INetworkLayerFactory[0];
 }
コード例 #17
0
ファイル: LogPacket.cs プロジェクト: michyer/canape
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="tag"></param>
 /// <param name="netid"></param>
 /// <param name="network"></param>
 /// <param name="frame"></param>
 /// <param name="color"></param>
 public LogPacket(string tag, Guid netid, string network, DataFrame frame, ColorValue color)
     : this(tag, netid, Guid.NewGuid(), network, frame, color, DateTime.Now)
 {
 }
コード例 #18
0
ファイル: LogPacketConfig.cs プロジェクト: michyer/canape
 /// <summary>
 /// Constructor
 /// </summary>
 public LogPacketConfig()
 {
     Color = new ColorValue(255, 255, 255, 255);
 }