Esempio n. 1
0
        public void Init()
        {
            try
            {
                log         = "Listening";
                conn        = new Connection();
                sqlite_conn = conn.CreateConnect();

                dataStream   = new byte[1024];
                updateStatus = new UpdateStatusDelegate(UpdateStatus);
                updateLog    = new UpdateLogDelegate(UpdateLog);
                serverSocket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
                IPEndPoint server = new IPEndPoint(IPAddress.Any, PORT_NUM);
                serverSocket.Bind(server);
                IPEndPoint clients  = new IPEndPoint(IPAddress.Any, 0);
                EndPoint   epSender = (EndPoint)clients;

                serverSocket.BeginReceiveFrom(dataStream, 0, dataStream.Length, SocketFlags.None, ref epSender, new AsyncCallback(ReceiveCallback), epSender);
            }
            catch (Exception e)
            {
                XtraMessageBox.Show(string.Format("Error:{0}", e.Message));
                log = string.Format("Error:{0}", e.Message);
            }
        }
Esempio n. 2
0
        public MainForm()
        {
            InitializeComponent();

            delUpdateLog = new UpdateLogDelegate(UpdateLog);
            delAddClient = new AddClientDelegate(AddClient);
            delRemoveClient = new RemoveClientDelegate(RemoveClient);
            lstClientInfo = new List<ClientInfo>();
            lstTcpClient = new List<TcpClient>();

            grdClientList.AutoGenerateColumns = false;
        }
Esempio n. 3
0
 /// <summary>
 /// Display Logging Messages to Admin
 /// </summary>
 /// <param name="Message"></param>
 private void Log(string Message)
 {
     if (this.rtbConOut.InvokeRequired)
     {
         UpdateLogDelegate d = new UpdateLogDelegate(Log);
         this.rtbConOut.Invoke(d, new object[] { Message });
     }
     else
     {
         rtbConOut.AppendText(Message + Environment.NewLine);
         rtbConOut.Focus();
     }
 }
Esempio n. 4
0
        /// <summary>
        /// Constructor
        /// </summary>
        public Gui()
        {
            InitializeComponent();

            notifyIcon1.Visible = false;

            FillCombobox(comboBoxSource, typeof(Source));         //screencap combobox
            comboBoxSource.SelectedIndex = 1;
            FillCombobox(comboBoxAMode, typeof(ArduinoModes));    //arduino modes combobox
            FillCombobox(comboBoxMethode, typeof(RegioMethodes)); //select regio combobox

            deleg = new UpdateLogDelegate(addToLog);
            deleg("Application started");

            // make business layer object
            bl = new BL(deleg);
        }
Esempio n. 5
0
 public LogWindow()
 {
     UpdateLogBox = new UpdateLogDelegate(toLogBox);
 }
Esempio n. 6
0
 public FormMain()
 {
     InitializeComponent();
     this.updateLogDelegate = new UpdateLogDelegate(this.UpdateLog);
     UpdateUI();
 }
Esempio n. 7
0
 /// <summary>
 /// Threadsafe function to add a text item to the first position of listbox
 /// </summary>
 /// <param name="text">Text to add to listbox</param>
 private void UpdateLogAsync(string text)
 {
     // if attemping to access the listbox form a separate thread, use delegate
     if (InvokeRequired)
     {
         // catch any errors that may occur while attempting to update listbox
         // (ex. ObjectDisplosedException)
         try
         {
             UpdateLogDelegate uld = new UpdateLogDelegate(UpdateLog);
             Invoke(uld, text);
         }
         catch { }
     }
     // else, update listbox directly
     else
         UpdateLog(text);
 }
Esempio n. 8
0
 /// <summary>
 /// Non-default Constructor
 /// </summary>
 /// <param name="deleg">A delegate to update a log</param>
 public BL(UpdateLogDelegate deleg)
 {
     this.deleg = deleg;
 }
Esempio n. 9
0
 /// <summary>
 /// Non-Default Constructor for the delegate
 /// </summary>
 /// <param name="deleg">Delegate that updates the log</param>
 public Server(UpdateLogDelegate deleg) : this()
 {
     this.deleg = deleg;
 }
Esempio n. 10
0
 /// <summary>
 /// Non-Default Constructor
 /// </summary>
 /// <param name="comport">The COM port</param>
 /// <param name="baudrate">The Baudrate</param>
 /// <param name="deleg">The log delegate</param>
 public SerialCom(string comport, int baudrate, UpdateLogDelegate deleg) : this(comport, baudrate)
 {
     this.deleg = deleg;
     deleg("Connected to " + comport);
 }
Esempio n. 11
0
 public void UpdateLog(string msg)
 {
     UpdateLogDelegate writer = new UpdateLogDelegate(WriteLog);
     this.Invoke(writer, new object[] { msg });
 }
Esempio n. 12
0
        public Window1()
        {
            InitializeComponent();
            show_log_window();

            ul = new UpdateLogDelegate(debug);

            debug("FFXIAI");
            debug("  author: framerate");
            debug("  version: 0.0.0.1");
            debug("  Starting...");
            ArrayList a = Processes.get_ffxi_processes();
            process_list_cb.Items.Clear();
            foreach (Process obj in a)
            {
                process_list_cb.Items.Add(obj.MainWindowTitle + " - " + obj.Id);
                debug("found PID: " + obj.MainWindowTitle + " - " +obj.Id);

            }

            if (process_list_cb.Items.Count == 1)
            {
                debug("Only one FFXI process found!");
                string polID = process_list_cb.Text;
                debug("Word: " + polID);
                int polIDPosition = polID.IndexOf(" - ");
                polID = polID.Remove(0, polIDPosition + 3);
                int pid = (int)Convert.ToUInt32(polID);
                debug("Attached to Process");
                //Processes.attach_process(pid);
            }

            debug(System.AppDomain.CurrentDomain.BaseDirectory);
            //System.IO.Path.Combine(System.IO.Path.GetDirectoryName(System.Windows.Forms.Application.ExecutablePath), @"settings/nav");
            //system.reflection.assembly.getexecutingassembly().location

            foreach (string Filename in Directory.GetFiles(Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory, "Plugins"), "*.dll"))
            {
                Assembly Asm = Assembly.LoadFile(Filename);
                foreach (Type AsmType in Asm.GetTypes())
                {

                    if (AsmType.GetInterface("IPluginInterface") != null)
                    {

                        IPluginInterface Plugin = (IPluginInterface)Activator.CreateInstance(AsmType);
                        Plugins.Add(Plugin);
                        debug(Plugin.Load() + " Loaded!");
                        //debug("Plugin Loaded!");

                    }
                }
            }

            if (Plugins.Count == 0)
            {
                debug("No plugins found!");
            }

            main_loop = new System.Timers.Timer();
            main_loop.Elapsed += new ElapsedEventHandler(test_func);
            main_loop.Interval = 250;
            main_loop.Enabled = true;
            debug("main loop enabled");
        }
Esempio n. 13
0
        public Window1()
        {
            InitializeComponent();
            show_log_window();

            ul = new UpdateLogDelegate(debug);

            debug("FFXIAI");
            debug("  author: framerate");
            debug("  version: 0.0.0.1");
            debug("  Starting...");
            ArrayList a = Processes.get_ffxi_processes();

            process_list_cb.Items.Clear();
            foreach (Process obj in a)
            {
                process_list_cb.Items.Add(obj.MainWindowTitle + " - " + obj.Id);
                debug("found PID: " + obj.MainWindowTitle + " - " + obj.Id);
            }

            if (process_list_cb.Items.Count == 1)
            {
                debug("Only one FFXI process found!");
                string polID = process_list_cb.Text;
                debug("Word: " + polID);
                int polIDPosition = polID.IndexOf(" - ");
                polID = polID.Remove(0, polIDPosition + 3);
                int pid = (int)Convert.ToUInt32(polID);
                debug("Attached to Process");
                //Processes.attach_process(pid);
            }



            debug(System.AppDomain.CurrentDomain.BaseDirectory);
            //System.IO.Path.Combine(System.IO.Path.GetDirectoryName(System.Windows.Forms.Application.ExecutablePath), @"settings/nav");
            //system.reflection.assembly.getexecutingassembly().location


            foreach (string Filename in Directory.GetFiles(Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory, "Plugins"), "*.dll"))
            {
                Assembly Asm = Assembly.LoadFile(Filename);
                foreach (Type AsmType in Asm.GetTypes())
                {
                    if (AsmType.GetInterface("IPluginInterface") != null)
                    {
                        IPluginInterface Plugin = (IPluginInterface)Activator.CreateInstance(AsmType);
                        Plugins.Add(Plugin);
                        debug(Plugin.Load() + " Loaded!");
                        //debug("Plugin Loaded!");
                    }
                }
            }

            if (Plugins.Count == 0)
            {
                debug("No plugins found!");
            }

            main_loop          = new System.Timers.Timer();
            main_loop.Elapsed += new ElapsedEventHandler(test_func);
            main_loop.Interval = 250;
            main_loop.Enabled  = true;
            debug("main loop enabled");
        }