Ejemplo n.º 1
0
        public IXDListener CreateListener(XDListener.XDMessageHandler handler)
        {
            IXDListener listener = XDListener.CreateListener(Mode, !Propagate);

            listener.RegisterChannel(Name);
            listener.MessageReceived += handler;
            return(listener);
        }
        /// <summary>
        /// Default constructor.
        /// </summary>
        internal XDIOStreamListener()
        {
            this.watcherList = new Dictionary <string, FileSystemWatcher>(StringComparer.InvariantCultureIgnoreCase);

            // ensure there is a network watcher for this mode, the implementation ensures only one is active at
            // any one time
            this.networkRelay = new NetworkRelayListener(XDBroadcast.CreateBroadcast(XDTransportMode.IOStream),
                                                         XDListener.CreateListener(XDTransportMode.MailSlot));
        }
Ejemplo n.º 3
0
 public static void StartPrcMessaging()
 {
     if (_broadcast != null)
     {
         return;
     }
     _broadcast = XDBroadcast.CreateBroadcast(XDTransportMode.WindowsMessaging, false);
     _listener  = XDListener.CreateListener(XDTransportMode.WindowsMessaging);
     _listener.MessageReceived += Listener_MessageReceived;
     _listener.RegisterChannel(channel);
 }
        /// <summary>
        /// Default constructor.
        /// </summary>
        public TestService()
        {
            InitializeComponent();
            this.ServiceName = "Test Service";

            //only the following mode is supported in windows services
            broadcast = XDBroadcast.CreateBroadcast(XDTransportMode.IOStream);
            listener  = XDListener.CreateListener(XDTransportMode.IOStream);
            listener.MessageReceived += new XDListener.XDMessageHandler(OnMessageReceived);
            listener.RegisterChannel("Status");
            listener.RegisterChannel("Channel1");
            listener.RegisterChannel("Channel2");
        }
Ejemplo n.º 5
0
        public CommManager()
        {
            this.otherInstances = new List <LogViewerInstance>();

            this.listener  = XDListener.CreateListener(XDTransportMode.WindowsMessaging);
            this.broadcast = XDBroadcast.CreateBroadcast(XDTransportMode.WindowsMessaging, false);

            this.listener.RegisterChannel(myID.ToString());  //Channel only for me
            this.listener.RegisterChannel(ChannelBroadcast); //Channel for everyone

            listener.MessageReceived += new XDListener.XDMessageHandler(listener_MessageReceived);
            this.MainWindowHandle     = System.Diagnostics.Process.GetCurrentProcess().MainWindowHandle;
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Initialize the broadcast and listener mode.
        /// </summary>
        /// <param name="mode">The new mode.</param>
        public static void InitializeMode(XDTransportMode mode)
        {
            if (listener != null)
            {
                // ensure we dispose any previous listeners, dispose should aways be
                // called on IDisposable objects when we are done with it to avoid leaks
                listener.Dispose();
            }
            listener = XDListener.CreateListener(mode);

            // attach the message handler
            listener.MessageReceived += OnMessageReceived;

            listener.RegisterChannel(CHANNEL_NAME);

            // create an instance of IXDBroadcast using the given mode,
            // note IXDBroadcast does not implement IDisposable
            broadcast = XDBroadcast.CreateBroadcast(mode, false);
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Initialize the broadcast and listener mode.
        /// </summary>
        /// <param name="mode">The new mode.</param>
        private void InitializeMode(XDTransportMode mode)
        {
            if (listener != null)
            {
                // ensure we dispose any previous listeners, dispose should aways be
                // called on IDisposable objects when we are done with it to avoid leaks
                listener.Dispose();
            }

            // creates an instance of the IXDListener object using the given implementation
            listener = XDListener.CreateListener(mode);

            // attach the message handler
            listener.MessageReceived += new XDListener.XDMessageHandler(OnMessageReceived);

            // register the channels we want to listen on
            if (statusCheckBox.Checked)
            {
                listener.RegisterChannel("Status");
            }

            // register if checkbox is checked
            if (channel1Check.Checked)
            {
                listener.RegisterChannel("Channel1");
            }

            // register if checkbox is checked
            if (channel2Check.Checked)
            {
                listener.RegisterChannel("Channel2");
            }

            // if we already have a broadcast instance
            if (broadcast != null)
            {
                broadcast.SendToChannel("Status", string.Format("{0} is changing mode to {1}", this.Handle, mode));
            }

            // create an instance of IXDBroadcast using the given mode,
            // note IXDBroadcast does not implement IDisposable
            broadcast = XDBroadcast.CreateBroadcast(mode, propagateCheck.Checked);
        }
        public ProfilerWindow()
        {
            InitializeComponent();

            InitSkinGallery();

            if (!DesignMode)
            {
                // creates an instance of the IXDListener object using the given implementation
                listener = XDListener.CreateListener(XDTransportMode.IOStream);
                listener.MessageReceived += new XDListener.XDMessageHandler(OnMessageReceived);

                listener.RegisterChannel(Channels.Channel_1);
                listener.RegisterChannel(Channels.Channel_2);
                listener.RegisterChannel(Channels.Channel_3);
                listener.RegisterChannel(Channels.Channel_4);
                listener.RegisterChannel(Channels.Channel_5);
                listener.RegisterChannel(Channels.Channel_6);
                listener.RegisterChannel(Channels.Channel_7);
                listener.RegisterChannel(Channels.Channel_8);
                listener.RegisterChannel(Channels.Channel_9);
                listener.RegisterChannel(Channels.Channel_10);

                navChannel1.Tag  = channel_1;
                navChannel2.Tag  = channel_2;
                navChannel3.Tag  = channel_3;
                navChannel4.Tag  = channel_4;
                navChannel5.Tag  = channel_5;
                navChannel6.Tag  = channel_6;
                navChannel7.Tag  = channel_7;
                navChannel8.Tag  = channel_8;
                navChannel9.Tag  = channel_9;
                navChannel10.Tag = channel_10;

                channel_1.NavBarItem  = navChannel1;
                channel_2.NavBarItem  = navChannel2;
                channel_3.NavBarItem  = navChannel3;
                channel_4.NavBarItem  = navChannel4;
                channel_5.NavBarItem  = navChannel5;
                channel_6.NavBarItem  = navChannel6;
                channel_7.NavBarItem  = navChannel7;
                channel_8.NavBarItem  = navChannel8;
                channel_9.NavBarItem  = navChannel9;
                channel_10.NavBarItem = navChannel10;

                currentChannel = channel_1;
                this.Text      = "EntitySpaces Profiler - " + currentChannel.Name;
                esTracePacketBindingSource.DataSource = currentChannel.ChannelData;

                clock = new System.Threading.Timer(TimerCallback, null, 2000, 1500);

                //define color of user customized token
                lzbasetype.gFmtOpt.HighlightingElements[(int)TLzHighlightingElement.sfkUserCustomized].SetForegroundInRGB("#FF00FF");

                foreach (var obj in lzbasetype.gFmtOpt.HighlightingElements)
                {
                    if (obj.Foreground.ToString().ToLower() == "12632256")
                    {
                        obj.SetForegroundInRGB("#000000");
                    }
                }
                lzbasetype.gFmtOpt.AlignAliasInSelectList = false;

                //this.gridView1.BestFitColumns();
            }
        }
Ejemplo n.º 9
0
        public ProfilerWindow()
        {
            InitializeComponent();

            InitSkinGallery();

            bool canRunOffline = false;
            int  result;

            if (!DesignMode)
            {
                proxySettings.Load();

#if !PROFILER_TRIAL
                RegistryKey key = Registry.CurrentUser.OpenSubKey(@"Software\EntitySpaces 2012", true);

                Crypto crypto = new Crypto();

                string id           = licensing.getUniqueID("C");
                string serialNumber = ""; // b69e3783-9f56-47a7-82e0-6eee6d0779bf

                if (key != null)
                {
                    try
                    {
                        serialNumber = (string)key.GetValue("Profiler_Number");
                    }
                    catch { }
                }


                string offlinePath = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData);
                offlinePath += @"\EntitySpaces\ES2012\Interop.ADODB64X.dll";

                // See if we have registered our license
                result = licensing.ValidateLicense("profiler", serialNumber, System.Environment.MachineName, id, version, proxySettings);

                switch (result)
                {
                case 0:

                    // Try Registering it ...
                    int newResult = licensing.RegisterLicense("profiler", serialNumber, System.Environment.MachineName, id, version, proxySettings);

                    if (newResult == 1)
                    {
                        licensing.CreateSerialNumber2Key(key, "Profiler_Number2", id, false);
                        result = 1;
                    }
                    else
                    {
                        result = 0;
                    }
                    break;

                case 1:

                    licensing.CreateSerialNumber2Key(key, "Profiler_Number2", id, false);
                    try
                    {
                        File.Delete(offlinePath);
                    }
                    catch { }

                    break;

                case -1:

                    bool     isOffLine   = false;
                    DateTime offLineDate = DateTime.MinValue;
                    if (licensing.ReadSerialNumber2Key(key, "Profiler_Number2", id, out isOffLine, out offLineDate))
                    {
                        if (isOffLine)
                        {
                            if (File.Exists(offlinePath))
                            {
                                DateTime fileDate = licensing.OpenOfflineFile(offlinePath);

                                if (DateTime.Now > offLineDate)
                                {
                                    TimeSpan ts = DateTime.Now.Subtract(offLineDate);
                                    if (ts.Days < licensing.DaysTheyCanRunOffline)
                                    {
                                        if (fileDate < DateTime.Now)
                                        {
                                            canRunOffline = true;
                                        }
                                    }
                                }
                            }
                        }
                        else
                        {
                            licensing.CreateSerialNumber2Key(key, "Profiler_Number2", id, true);
                            licensing.CreateOfflineFile(offlinePath);
                            canRunOffline = true;
                        }
                    }
                    break;
                }
#else
                Licensing license = new Licensing();
                string    id      = license.getUniqueID("C");

                result = licensing.ValidateLicense("trial", "b69e3783-9f56-47a7-82e0-6eee6d0779bf", System.Environment.MachineName, id, version, proxySettings);

                if (1 != result)
                {
                    result = licensing.RegisterLicense("trial", "b69e3783-9f56-47a7-82e0-6eee6d0779bf", System.Environment.MachineName, id, version, proxySettings);
                }
#endif

                if (result == 1 || (canRunOffline && result == -1))
                {
                    // creates an instance of the IXDListener object using the given implementation
                    listener = XDListener.CreateListener(XDTransportMode.IOStream);
                    listener.MessageReceived += new XDListener.XDMessageHandler(OnMessageReceived);

                    listener.RegisterChannel(Channels.Channel_1);
                    listener.RegisterChannel(Channels.Channel_2);
                    listener.RegisterChannel(Channels.Channel_3);
                    listener.RegisterChannel(Channels.Channel_4);
                    listener.RegisterChannel(Channels.Channel_5);
                    listener.RegisterChannel(Channels.Channel_6);
                    listener.RegisterChannel(Channels.Channel_7);
                    listener.RegisterChannel(Channels.Channel_8);
                    listener.RegisterChannel(Channels.Channel_9);
                    listener.RegisterChannel(Channels.Channel_10);

                    navChannel1.Tag  = channel_1;
                    navChannel2.Tag  = channel_2;
                    navChannel3.Tag  = channel_3;
                    navChannel4.Tag  = channel_4;
                    navChannel5.Tag  = channel_5;
                    navChannel6.Tag  = channel_6;
                    navChannel7.Tag  = channel_7;
                    navChannel8.Tag  = channel_8;
                    navChannel9.Tag  = channel_9;
                    navChannel10.Tag = channel_10;

                    channel_1.NavBarItem  = navChannel1;
                    channel_2.NavBarItem  = navChannel2;
                    channel_3.NavBarItem  = navChannel3;
                    channel_4.NavBarItem  = navChannel4;
                    channel_5.NavBarItem  = navChannel5;
                    channel_6.NavBarItem  = navChannel6;
                    channel_7.NavBarItem  = navChannel7;
                    channel_8.NavBarItem  = navChannel8;
                    channel_9.NavBarItem  = navChannel9;
                    channel_10.NavBarItem = navChannel10;

                    currentChannel = channel_1;
                    this.Text      = "EntitySpaces Profiler - " + currentChannel.Name;
                    esTracePacketBindingSource.DataSource = currentChannel.ChannelData;

                    clock = new System.Threading.Timer(TimerCallback, null, 2000, 1500);

                    //define color of user customized token
                    lzbasetype.gFmtOpt.HighlightingElements[(int)TLzHighlightingElement.sfkUserCustomized].SetForegroundInRGB("#FF00FF");

                    foreach (var obj in lzbasetype.gFmtOpt.HighlightingElements)
                    {
                        if (obj.Foreground.ToString().ToLower() == "12632256")
                        {
                            obj.SetForegroundInRGB("#000000");
                        }
                    }
                    lzbasetype.gFmtOpt.AlignAliasInSelectList = false;
                }


                //this.gridView1.BestFitColumns();
            }
        }