コード例 #1
0
        public Wp7ConnectionDriver(Runtime.Runtime runtime, MemoryStream memStream)
            : base(false)
        {
            try
            {
                _memStream = memStream;
                _runtime = runtime;

                _runtime.Driver = this;

                _incoming = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);

                SocketAsyncEventArgs args = new SocketAsyncEventArgs();
                args.Completed += new EventHandler<SocketAsyncEventArgs>(OnConnected);
                args.RemoteEndPoint = new DnsEndPoint(HOST, PORT);

                if (!_incoming.ConnectAsync(args))
                {
                    OnConnected(null, args);
                }
            }
            catch (SocketException e)
            {
                throw new ConnectionException(e);
            }
        }
コード例 #2
0
        private void OnInitialize()
        {
            string openModDirectory = Path.GetFullPath($"Servers/{Dedicator.serverID}/OpenMod/");

            if (!Directory.Exists(openModDirectory))
            {
                Directory.CreateDirectory(openModDirectory);
            }

            var parameters = new RuntimeInitParameters
            {
                CommandlineArgs  = Environment.GetCommandLineArgs(),
                WorkingDirectory = openModDirectory
            };

            var assemblies = new List <Assembly>
            {
                typeof(OpenMod.UnityEngine.UnityMainThreadDispatcher).Assembly,
                typeof(OpenModUnturnedHost).Assembly
            };

            var runtime = new Runtime.Runtime();

            runtime.Init(assemblies, parameters);
        }
コード例 #3
0
        public Wp7ConnectionDriver(Runtime.Runtime runtime, MemoryStream memStream)
            : base(false)
        {
            try
            {
                _memStream = memStream;
                _runtime   = runtime;

                _runtime.Driver = this;

                _incoming = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);

                SocketAsyncEventArgs args = new SocketAsyncEventArgs();
                args.Completed     += new EventHandler <SocketAsyncEventArgs>(OnConnected);
                args.RemoteEndPoint = new DnsEndPoint(HOST, PORT);

                if (!_incoming.ConnectAsync(args))
                {
                    OnConnected(null, args);
                }
            }
            catch (SocketException e)
            {
                throw new ConnectionException(e);
            }
        }
コード例 #4
0
        private static async Task Main(string[] args)
        {
            Console.OutputEncoding = System.Text.Encoding.UTF8;

            var path    = Path.Combine(AppContext.BaseDirectory, "openmod");
            var runtime = new Runtime.Runtime();
            var host    = await runtime.InitAsync(new List <Assembly> {
                typeof(Program).Assembly
            }, new RuntimeInitParameters
            {
                CommandlineArgs  = args,
                WorkingDirectory = path
            });

            var applifecycle = host.Services.GetRequiredService <IHostApplicationLifetime>();

            applifecycle.ApplicationStopping.Register(StandaloneConsoleIo.StopListening);

            var autoCompletionHandler = host.Services.GetRequiredService <IAutoCompleteHandler>();

            ReadLine.AutoCompletionHandler = autoCompletionHandler;
            ReadLine.HistoryEnabled        = true;

            StandaloneConsoleIo.StartListening();
        }
コード例 #5
0
        private void OnInitialize()
        {
            System.Environment.CurrentDirectory = ReadWrite.PATH;
            var openModDirectory = Path.Combine(ReadWrite.PATH, $"Servers/{Dedicator.serverID}/OpenMod/");

            if (!Directory.Exists(openModDirectory))
            {
                Directory.CreateDirectory(openModDirectory);
            }

            var parameters = new RuntimeInitParameters
            {
                CommandlineArgs  = System.Environment.GetCommandLineArgs(),
                WorkingDirectory = openModDirectory
            };

            var assemblies = new List <Assembly>
            {
                typeof(OpenModUnityEnginePlugin).Assembly,
                typeof(OpenModUnturnedHost).Assembly
            };

            OpenModRuntime = new Runtime.Runtime();
            OpenModRuntime.Init(assemblies, parameters);
            m_SharedModule.OnPostInitialize();
        }
コード例 #6
0
        public override void Load()
        {
            var openModDirectory = Path.Combine(Interface.Oxide.RootDirectory, "openmod");

            if (!Directory.Exists(openModDirectory))
            {
                Directory.CreateDirectory(openModDirectory);
            }

            var parameters = new RuntimeInitParameters
            {
                CommandlineArgs  = Environment.GetCommandLineArgs(),
                WorkingDirectory = openModDirectory
            };

            var assemblies = new List <Assembly>
            {
                typeof(OpenModUnityEnginePlugin).Assembly,
                typeof(OpenModRustOxideHost).Assembly,
                typeof(BaseOpenModRustHost).Assembly
            };

            var openModRuntime = new Runtime.Runtime();

            OpenModRuntime = openModRuntime;
            openModRuntime.Init(assemblies, parameters);
        }
コード例 #7
0
ファイル: frmMain.cs プロジェクト: karpiyon/lightningstools
 private static void DisposeRuntime()
 {
     if (SharedRuntime == null)
     {
         return;
     }
     Common.Util.DisposeObject(SharedRuntime);
     SharedRuntime = null;
 }
コード例 #8
0
        public KeyFrameDriver(IKeyFrame provider, Runtime.Runtime runtime)
            : base(false)
        {
            _runtime        = runtime;
            _runtime.Driver = this;
            _provider       = provider;

            Start();
        }
コード例 #9
0
        public KeyFrameDriver(IKeyFrame provider, Runtime.Runtime runtime)
            : base(false)
        {
            _runtime = runtime;
            _runtime.Driver = this;
            _provider = provider;

            Start();
        }
コード例 #10
0
        private void LogOut(object sender, RoutedEventArgs e)
        {
            SignInWindow signInWindow = new SignInWindow();

            signInWindow.Show();
            this.Close();
            confirmPasswordWindow.Close();
            runtime = null;
            TbIcon.Dispose();
        }
コード例 #11
0
ファイル: frmMain.cs プロジェクト: karpiyon/lightningstools
 private void frmMain_Load(object sender, EventArgs e)
 {
     nfyTrayIcon.Text = Application.ProductName;
     Text             = Application.ProductName + " v" + Application.ProductVersion;
     SharedRuntime    = new Runtime.Runtime();
     PopulateSignalsView();
     if (Settings.Default.StartRunningWhenLaunched)
     {
         Start();
     }
 }
コード例 #12
0
 public SettingsWindow(UserInfoModel user)
 {
     InitializeComponent();
     emailConfirmation = new EmailConfirmationMethods();
     userSettings      = new UserSettingsMethods();
     _user             = user;
     InitializeUserSettings();
     confirmPasswordWindow = new ConfirmPasswordWindow(_user, this);
     Email.Content         = _user.Email;
     runtime = new Runtime.Runtime(_user.EyesTimer, _user.EatingTimer, _user.ExerciseTimer, _user.ShutDownTimer);
 }
コード例 #13
0
        public W8ConnectionDriver(Runtime.Runtime runtime, MemoryStream memStream)
            : base(false)
        {
            _memStream = memStream;
            _runtime = runtime;

            _runtime.Driver = this;

            _socket = new StreamSocket();
            _socket.ConnectAsync(new HostName(HOST), PORT.ToString()).AsTask().Wait();
            OnConnected();
        }
コード例 #14
0
        //private readonly ILog _log = LogManager.GetLogger("FileCapDriver");

        public FileCapDriver(string capFile, MemoryStream memStream, Runtime.Runtime runtime)
            : base(false)
        {
            _memStream = memStream;
#if WINRT
            _path = capFile;
#else
            _fileStream = File.OpenRead(capFile);
#endif
            _runtime        = runtime;
            _runtime.Driver = this;

            Start();
        }
コード例 #15
0
        //private readonly ILog _log = LogManager.GetLogger("FileCapDriver");
        public FileCapDriver(string capFile, MemoryStream memStream, Runtime.Runtime runtime)
            : base(false)
        {
            _memStream = memStream;
            #if WINRT
            _path = capFile;
            #else
            _fileStream = File.OpenRead(capFile);
            #endif
            _runtime = runtime;
            _runtime.Driver = this;

            Start();
        }
コード例 #16
0
        public AsyncConnectionDriver(Runtime.Runtime runtime, MemoryStream memStream)
            : base(false)
        {
            try
            {
                _memStream = memStream;
                _runtime = runtime;

                _runtime.Driver = this;

                IPHostEntry e = Dns.GetHostEntry(HOST);

                _incoming = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);

                _log.InfoFormat("Resolved {0} to {1}.", HOST, e.AddressList[0].ToString());

                _log.Info("Connecting...");

            #if COMPACT
                EndPoint ep = new IPEndPoint(e.AddressList[0], PORT);
                _incoming.Connect(ep);
                _incoming.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReceiveTimeout, 10000);
            #else
                _incoming.Connect(e.AddressList, PORT);
                _incoming.ReceiveTimeout = 10000; // 10 seconds because we may not always be receiving data
            #endif

                //  Queue the first read and write
                CmdQueue.Push(CommandFactory.MakeCommand(DoNextRead, new byte[BLOB_SIZE]));
                CmdQueue.Push(CommandFactory.MakeCommand(DoPing));

                Start();

                //  We've sent the first request so schedule timer to start one interval later
                _timer = new Timer(TimerPingCallback, null, _refreshRate, _refreshRate);

                _log.Info("Connected.");

            }
            catch (SocketException e)
            {
                throw new ConnectionException(e);
            }
        }
コード例 #17
0
        public AsyncConnectionDriver(Runtime.Runtime runtime, MemoryStream memStream)
            : base(false)
        {
            try
            {
                _memStream = memStream;
                _runtime   = runtime;

                _runtime.Driver = this;

                IPHostEntry e = Dns.GetHostEntry(HOST);

                _incoming = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);

                _log.InfoFormat("Resolved {0} to {1}.", HOST, e.AddressList[0].ToString());

                _log.Info("Connecting...");

#if COMPACT
                EndPoint ep = new IPEndPoint(e.AddressList[0], PORT);
                _incoming.Connect(ep);
                _incoming.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReceiveTimeout, 10000);
#else
                _incoming.Connect(e.AddressList, PORT);
                _incoming.ReceiveTimeout = 10000; // 10 seconds because we may not always be receiving data
#endif

                //  Queue the first read and write
                CmdQueue.Push(CommandFactory.MakeCommand(DoNextRead, new byte[BLOB_SIZE]));
                CmdQueue.Push(CommandFactory.MakeCommand(DoPing));

                Start();

                //  We've sent the first request so schedule timer to start one interval later
                _timer = new Timer(TimerPingCallback, null, _refreshRate, _refreshRate);

                _log.Info("Connected.");
            }
            catch (SocketException e)
            {
                throw new ConnectionException(e);
            }
        }
コード例 #18
0
        private static async Task Main(string[] args)
        {
            Console.OutputEncoding = System.Text.Encoding.UTF8;

            var path    = Path.GetFullPath("openmod");
            var runtime = new Runtime.Runtime();
            var host    = await runtime.InitAsync(new List <Assembly> {
                typeof(Program).Assembly
            }, new RuntimeInitParameters
            {
                CommandlineArgs  = args,
                WorkingDirectory = path
            });

            var applifecycle = host.Services.GetRequiredService <IHostApplicationLifetime>();

            applifecycle.ApplicationStopped.Register(StandaloneConsoleIo.StopListening);

            StandaloneConsoleIo.StartListening();
        }
コード例 #19
0
        public static void Initialize()
        {
            string openModDirectory = Path.GetFullPath($"Servers/{Dedicator.serverID}/OpenMod/");

            if (!Directory.Exists(openModDirectory))
            {
                Directory.CreateDirectory(openModDirectory);
            }

#if NUGET_BOOTSTRAP
            Console.WriteLine("Bootstrapping OpenMod for Unturned, this might take a while...");

            var bootrapper = new OpenModDynamicBootstrapper();

            bootrapper.Bootstrap(
                openModDirectory,
                Environment.GetCommandLineArgs(),
                new List <string> {
                "OpenMod.Unturned"
            },
                false,
                new NuGetConsoleLogger());
#else
            var parameters = new RuntimeInitParameters
            {
                CommandlineArgs  = Environment.GetCommandLineArgs(),
                WorkingDirectory = openModDirectory
            };

            var assemblies = new List <Assembly>
            {
                typeof(OpenMod.UnityEngine.UnityMainThreadDispatcher).Assembly,
                typeof(OpenMod.Unturned.OpenModUnturnedHost).Assembly
            };

            var runtime = new Runtime.Runtime();
            runtime.Init(assemblies, parameters);
#endif
        }
コード例 #20
0
 public void shutdown()
 {
     m_SharedModule.Shutdown();
     OpenModRuntime = null;
 }