Exemplo n.º 1
0
        private void Form1_Load(object sender, EventArgs e)
        {
            FileVersionInfo ver = FileVersionInfo.GetVersionInfo(Assembly.GetExecutingAssembly().Location);

            this.Text = $"FX2 Device Server {ver.ProductMajorPart}.{ver.ProductMinorPart}.{ver.ProductPrivatePart}";

            if (Environment.OSVersion.Platform == PlatformID.Win32NT)
            {
                using (Process p = Process.GetCurrentProcess())
                {
                    p.PriorityClass = ProcessPriorityClass.RealTime;
                }

                deviceServer = new DeviceServer();
            }
            else if (Environment.OSVersion.Platform == PlatformID.Unix)
            {
                try
                {
                    using (Process p = Process.GetCurrentProcess())
                    {
                        p.PriorityClass = ProcessPriorityClass.RealTime;
                    }
                }
                catch (Exception)
                {
                    Console.WriteLine("Usage: sudo mono Fx2DeviceServer.exe");
                    return;
                }

                monoDeviceServer = new MonoDeviceServer();
            }
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            try
            {
                using (Process p = Process.GetCurrentProcess())
                {
                    p.PriorityClass = ProcessPriorityClass.RealTime;
                }
            }
            catch (Exception)
            {
                Console.WriteLine("Usage: sudo mono CuiFx2DeviceServer.exe");
                return;
            }

            using (MonoDeviceServer monoDeviceServer = new MonoDeviceServer())
            {
                while (true)
                {
                    Thread.Sleep(1000);
                }
            }
        }