예제 #1
0
        /// <summary>
        /// Initializes a new instance of <see cref="Kamilla.Network.Viewing.ViewerItem"/> that i
        /// </summary>
        /// <param name="viewer">
        /// The <see cref="Kamilla.Network.Viewing.NetworkLogViewerBase"/> to which
        /// the current instance of <see cref="Kamilla.Network.Viewing.ViewerItem"/> belongs to.
        /// </param>
        /// <param name="log">
        /// Gets the <see cref="Kamilla.Network.Logging.NetworkLog"/> that
        /// stores the underlying <see cref="Kamilla.Network.Packet"/>.
        /// </param>
        /// <param name="index">
        /// Gets the counter of the current instance
        /// of <see cref="Kamilla.Network.Viewing.ViewerItem"/>.
        /// </param>
        /// <param name="packet">
        /// Gets the <see cref="Kamilla.Network.Packet"/> for which the current
        /// instance of <see cref="Kamilla.Network.Viewing.ViewerItem"/> was created.
        /// </param>
        /// <exception cref="System.ArgumentNullException">
        /// viewer is null.
        /// -or-
        /// log is null.
        /// -or-
        /// packet is null.
        /// </exception>
        /// <exception cref="System.ArgumentOutOfRangeException">
        /// index is negative.
        /// </exception>
        public ViewerItem(NetworkLogViewerBase viewer, NetworkLog log, Packet packet, int index)
        {
            if (viewer == null)
                throw new ArgumentNullException("viewer");

            if (log == null)
                throw new ArgumentNullException("log");

            if (packet == null)
                throw new ArgumentNullException("packet");

            if (index < 0)
                throw new ArgumentOutOfRangeException("index");

            m_viewer = viewer;
            m_log = log;
            m_packet = packet;
            m_index = index;
        }
예제 #2
0
        internal void SetLog(NetworkLog value)
        {
            if (m_currentLog == value)
                return;

            this.StopParsing();

            var old = m_currentLog;
            if (old != null)
                old.PacketAdded -= m_packetAddedHandler;

            m_currentLog = value;

            if (this.NetworkLogChanged != null)
                this.NetworkLogChanged(this, EventArgs.Empty);

            if (m_currentLog != null)
                this.StartParsing();
        }
예제 #3
0
 internal void HookLog(NetworkLog value)
 {
     if (value != null)
         value.PacketAdded += m_packetAddedHandler;
 }
예제 #4
0
        void OpenFile(string filename, NetworkLog log, int pos)
        {
            if (filename == null)
                throw new ArgumentNullException("filename");

            if (log == null)
                throw new ArgumentNullException("log");

            this.CloseFile();

            m_currentFile = filename;
            this.ThreadSafeBegin(_ =>
            {
                _.AddRecentFile(filename);
                _.Title = Path.GetFileName(filename) + " – " + Strings.NetworkLogViewer_Title;
            });

            m_implementation.HookLog(log);

            ui_readingWorker.RunWorkerAsync(new Tuple<NetworkLog, int>(log, pos));
            this.LoadingStatePush(new LoadingState(string.Format(Strings.LoadingFile, filename),
                _ => _.ui_readingWorker.CancelAsync()));
        }