internal void Connect(string arguments, Channel channel)
        {
            Logger.Debug($"Current arguments: {arguments}.");
            Arguments = !string.IsNullOrEmpty(arguments) ? arguments.Split(new char[] { ' ' }) : new string[0];

            Logger.Debug($"Current config: {channel.GetType().Name}.");
            Channel = channel;

            // waiting for storm to send connect message
            Logger.Debug("Waiting for connect message.");
            ConnectMessage message = (ConnectMessage)Channel.Receive <ConnectMessage>();

            int pid = Process.GetCurrentProcess().Id;

            // storm requires to create empty file named with PID
            if (!string.IsNullOrEmpty(message.PidDir) && Directory.Exists(message.PidDir))
            {
                Logger.Debug($"Creating pid file. PidDir: {message.PidDir}; PID: {pid}");
                string path = Path.Combine(message.PidDir, pid.ToString());
                File.WriteAllText(path, "");
            }

            Logger.Debug($"Current context: {JsonConvert.SerializeObject(message.Context)}.");
            Context = message.Context;

            Logger.Debug($"Current config: {JsonConvert.SerializeObject(message.Configuration)}.");
            Configuration = message.Configuration;

            // send PID back to storm
            Channel.Send(new PidMessage(pid));

            OnInitialized?.Invoke(this, EventArgs.Empty);
        }
예제 #2
0
    public async Task Initialize()
    {
        clientNodeSpecification = new Ubii.Clients.Client
        {
            Name = clientName,
            IsDedicatedProcessingNode = isDedicatedProcessingNode
        };

        List <Ubii.Processing.ProcessingModule> pmDatabaseList = processingModuleDatabase.GetAllSpecifications();

        //Debug.Log("Node init PM list: " + pmDatabaseList.Count);
        foreach (Ubii.Processing.ProcessingModule pm in pmDatabaseList)
        {
            clientNodeSpecification.ProcessingModules.Add(pm);
        }

        bool success = await InitNetworkConnection();

        if (success)
        {
            OnConnected?.Invoke();

            processingModuleManager = new ProcessingModuleManager(this.GetID(), null, this.processingModuleDatabase, this.topicDataProxy);
            await SubscribeSessionInfo();

            OnInitialized?.Invoke();
            Debug.Log("Node client specs: " + clientNodeSpecification);
        }
        else
        {
            Debug.LogError("UbiiNode.Initialize() - failed to establish network connection to master node");
        }
    }
예제 #3
0
        public static void Init()
        {
            LinkAssemblies();

            IsInitialized = true;
            OnInitialized?.Invoke(null, EventArgs.Empty);
        }
예제 #4
0
        public bool Initialize(Engine engine)
        {
            this.engine = engine;
            if (!TryOpenMpq(out mpq))
            {
                OnFailedInitialize?.Invoke();
                waitForInitialized.SetResult(false);
                waitForInitialized = new();
                return(false);
            }
            coroutineManager    = new();
            NotificationsCenter = new NotificationsCenter(this);
            TimeManager         = new TimeManager(this);
            ScreenSpaceSelector = new ScreenSpaceSelector(this);
            DbcManager          = new DbcManager(this, databaseClientFileOpener);
            CurrentMap          = DbcManager.MapStore.FirstOrDefault(m => m.Id == 1) ?? Map.Empty;
            TextureManager      = new WoWTextureManager(this);
            MeshManager         = new WoWMeshManager(this);
            MdxManager          = new MdxManager(this);
            WmoManager          = new WmoManager(this);
            ChunkManager        = new ChunkManager(this);
            CameraManager       = new CameraManager(this);
            LightingManager     = new LightingManager(this);
            AreaTriggerManager  = new AreaTriggerManager(this);
            RaycastSystem       = new RaycastSystem(engine);
            ModuleManager       = new ModuleManager(this, gameView); // must be last

            OnInitialized?.Invoke();
            IsInitialized = true;
            waitForInitialized.SetResult(true);
            return(true);
        }
 private void SetSettings()
 {
     FirebaseApp.SetEditorDatabaseUrl("https://textquest-test.firebaseio.com/");
     DbRoot = FirebaseDatabase.DefaultInstance.RootReference;
     DbRoot.ValueChanged += OnRootChanges;
     OnInitialized.Invoke();
 }
예제 #6
0
 /// <summary>
 /// The initializer for MainViewModel.
 /// </summary>
 /// <param name="uiDispatcher">The UI dispatcher.</param>
 public void Initialize(CoreDispatcher uiDispatcher)
 {
     RunOnUiThread(() =>
     {
         OnInitialized?.Invoke();
     });
 }
예제 #7
0
 private void _asr_OnInitialized(object sender, EventArgs e)
 {
     if (OnInitialized != null)
     {
         try { OnInitialized.Invoke(sender, e); } catch { }   // 防止内部异常影响到这里
     }
 }
예제 #8
0
 // 建立连接事件
 private void _client_OnConnected(object sender, EventArgs e)
 {
     if (OnInitialized != null)
     {
         OnInitialized.Invoke(sender, e);
     }
 }
예제 #9
0
 public void Init()
 {
     TryRefreshData();
     if (OnInitialized != null)
     {
         OnInitialized.Invoke();
     }
 }
예제 #10
0
 static void Init()
 {
     IsInitialized = true;
     Application   = Windows.UI.Xaml.Application.Current;
     FormsGestures.UWP.Settings.Init(Windows.UI.Xaml.Application.Current);
     OnInitialized?.Invoke(null, EventArgs.Empty);
     LinkAssemblies();
 }
예제 #11
0
 /// <summary>
 /// 初始化
 /// </summary>
 public void Initialize()
 {
     // 此方法在 AsrProxy 中使用,这里不需要做任何动作
     if (OnInitialized != null)
     {
         OnInitialized.Invoke(this, new EventArgs());
     }
 }
예제 #12
0
파일: GameGrid.cs 프로젝트: korfas/vertigo
    public void Init()
    {
        GenerateCommonItems(false);
        SetSelectionButtons();

        isInitialized = true;
        OnInitialized?.Invoke();
    }
예제 #13
0
        /// <summary>
        ///     Initializes the Plugin System.
        /// </summary>
        /// <param name="internalConfigPath">The Path that is used by internal config files by the Plugin System</param>
        /// <param name="pluginDirectory">The Path used as "Install Directory" for Plugins/Packages</param>
        public static void Initialize(
            string internalConfigPath, string pluginDirectory, Func <string, string, bool> updateDialog,
            Action <string, int, int> setStatus, string staticDataConfig = null, bool checkUpdates = true)
        {
            if (IsInitialized)
            {
                throw new Exception("Can not Initialize the Plugin System Twice");
            }

            SendLog("Initializing Plugin System");

            //TODO: Process Things like updates before the plugin system loads the libraries.

            PluginPaths.InternalSystemConfigPath = Path.GetFullPath(internalConfigPath);
            PluginPaths.PluginDirectory          = Path.GetFullPath(pluginDirectory);
            PluginPaths.EnsureInternalDirectoriesExist();
            PluginPaths.CreateInternalFilesIfMissing();
            ErrorHandler.Initialize();

            LoadOrder.Initialize();
            if (staticDataConfig != null && File.Exists(staticDataConfig))
            {
                StaticData.SetState(File.ReadAllText(staticDataConfig));
            }


            IsInitialized = true;

            SendLog("Updating..");

            PluginHost = new PluginSystemHost();

            HelperClass.ReloadDefaultPlugins();

            OnInitialized?.Invoke();
            if (File.Exists(PluginPaths.InternalStartupInstructionPath))
            {
                SendLog("Running Start Actions..");
                ActionRunner.RunActions();
            }

            if (checkUpdates)
            {
                ListHelper.LoadList(PluginPaths.PluginListFile).Select(x => new BasePluginPointer(x)).ToList()
                .ForEach(x => UpdateManager.CheckAndUpdate(x, updateDialog, setStatus));
            }

            SendLog("Registering System Host..");


            LoadPlugins(PluginHost);
            SendLog("Registered System Host..");
            SendLogDivider();

            //Everything Finished
            SendLog("Initialization Complete.");
            SendLogDivider();
        }
예제 #14
0
        public static void Init(Context context, Bundle bundle)
        {
            LinkAssemblies();

            Context = context;

            IsInitialized = true;
            OnInitialized?.Invoke(null, EventArgs.Empty);
        }
예제 #15
0
 private static void OnAdvertiserIdRequestDone(string id, bool isTrackingEnabled, string errorMsg)
 {
     AdvertiserId      = id;
     IsTrackingEnabled = isTrackingEnabled;
     Log("Advertiser ID requested");
     IsInitialized = true;
     Log($"Initialized | Post schedule file name: {Settings.postScheduleFileName} | App ID: {Settings.appId} | API Key: {Settings.apiKey}");
     OnInitialized.Invoke();
 }
예제 #16
0
 void Init(int tick)
 {
     Toolbox.Log("Init servertick: " + tick);
     // currentTick = tick;
     initialized = true;
     elapsedTime = 0;
     // elapsedTime = serverCurrentTickElapsedTime + (NetworkManager.singleton.client.GetRTT() / 2f / 1000f);
     OnInitialized?.Invoke(currentTick);
 }
예제 #17
0
        public void Initialize(CardStack draw, CardStack discard, PlayerHand inspect, PlayerHand[] playerHands)
        {
            Draw          = draw;
            Discard       = discard;
            Inspect       = inspect;
            PlayerHands   = playerHands;
            IsInitialized = true;

            OnInitialized?.Invoke(this, new OnInitializedArgs(PlayerHands));
        }
 private void Initialize()
 {
     _cleanFingers = (BonePose[])wrapee.Fingers.Clone();
     _cleanHand    = new BonePose()
     {
         boneID   = BoneId.Hand_Start,
         rotation = wrapee.Hand.rotation,
         position = wrapee.Hand.position
     };
     OnInitialized?.Invoke();
 }
예제 #19
0
        public void Initialize()
        {
            if (IsInitialized)
            {
                return;
            }
            IsInitialized = true;

            //UIマネージャーに登録
            UIManager.Instance.Register(this);

            OnInitialized?.Invoke();
        }
예제 #20
0
        private IEnumerator InitializeAsync(ConnectionManager connectionManager)
        {
            this.ConnectionManager = connectionManager ?? throw new ArgumentNullException(nameof(connectionManager));
            Spawner = new GameSpawner(this);

            connectionManager.OnPlayerConnect        += OnPlayerConnect;
            connectionManager.OnActivePlayersUpdated += OnActivePlayersUpdated;
            connectionManager.OnPlayerDisconnect     += OnPlayerDisconnect;

            yield return(connectionManager.Initialize());

            Initialized = true;
            OnInitialized?.Invoke(this, EventArgs.Empty);
        }
예제 #21
0
        private int OnPresent(IntPtr swapChainPointer, int syncInterval, int flags)
        {
            if (Initialized)
            {
                return(_presentHook.OriginalFunction(swapChainPointer, syncInterval, flags));
            }

            var device = new SwapChain(swapChainPointer).GetDevice <Device>();

            OnInitialized?.Invoke(device, device.ImmediateContext);

            Initialized = true;

            return(_presentHook.OriginalFunction(swapChainPointer, syncInterval, flags));
        }
예제 #22
0
 protected virtual void RaiseOnInitialized()
 {
     try
     {
         if (!Initialized && !Unloaded)
         {
             Initialized = true;
             OnInitialized.RaiseEvent(this, null);
         }
     }
     catch (Exception ex)
     {
         Global.Logger.AddItem(new LogItem(ex));
     }
 }
예제 #23
0
        /// <summary>
        /// Init xul and start message loop
        /// </summary>
        private static void InitXul()
        {
            _invoker = new Control();
            _invoker.CreateControl();

            Xpcom.AfterInitalization += () =>
            {
                _initialized = true;

                _initializedSignal?.Release();
                OnInitialized?.Invoke();
            };

            Xpcom.EnableProfileMonitoring = false;
            Xpcom.Initialize(_xulPath);
            Application.Run();
        }
예제 #24
0
 protected virtual void OnInitialize()
 {
     try
     {
         if (!Initialized && !Unloaded)
         {
             Initialized = true;
             OnInitialized.RaiseEvent(this, null);
             var map = Utility.Map.GetMap().Type;
             if (BlacklistedMaps.Any(m => m.Equals(map)))
             {
                 OnUnload(null, new UnloadEventArgs(true));
             }
         }
     }
     catch (Exception ex)
     {
         Global.Logger.AddItem(new LogItem(ex));
     }
 }
예제 #25
0
        public void InitializeBoard(BoardModel StartBoard)
        {
            for (int i = 0; i < StartBoard.Bottom.Length; i++)
            {
                if (StartBoard.Bottom[i] != default)
                {
                    Bottom[i].Add(StartBoard.Bottom[i]);
                }
            }

            for (int i = 0; i < StartBoard.Top.Length; i++)
            {
                if (StartBoard.Top[i] != default)
                {
                    Top[i].Add(StartBoard.Bottom[i]);
                }
            }

            DeckCard = StartBoard.DeckCard;
            OnInitialized?.Invoke(StartBoard);
        }
예제 #26
0
        private void Initialize()
        {
            var temp = Resources.LoadAll <IngredientSo>(INGREDIENT_PATH + specificFolderName);

            //Offsets the elements to form a grid pattern.
            int height = 0;

            for (int i = 0; i < temp.Length; i++)
            {
                IngredientSlice slice = Instantiate(ingredientPrefab, parentTransform).GetComponent <IngredientSlice>();
                slice.Initialize(temp[i]);
                int tempWidth = (i % width);
                slice.transform.localPosition = new Vector3(tempWidth * horizontalPadding, 0, height * verticalPadding);
                if (tempWidth == width - 1)
                {
                    height++;
                }
            }
            //Invocation for ingredient response to update.
            OnInitialized?.Invoke();
        }
예제 #27
0
        public void Initialize(ItemModel itemInformation)
        {
            _itemInformation = itemInformation;

            if (itemName != null)
            {
                itemName.text = _itemInformation.Name;
            }
            if (itemDescription != null)
            {
                itemDescription.text = _itemInformation.Description;
            }

            LoadImage(_itemInformation.ImageUrl);

            if (_itemInformation.IsSubscription())
            {
                AttachRenewSubscriptionHandler();
            }

            OnInitialized?.Invoke(itemInformation);
        }
예제 #28
0
        /// <summary>
        ///     Initializes the network classes, but doesn't establish connection.
        /// </summary>
        /// <param name="peerType">Client, Server or Both.</param>
        /// <param name="port"></param>
        public void InitNetwork(PeerType peerType, int?port = 1777)
        {
            InitializeMessageLoopActions();
            this.LocalPeerType = peerType;

            switch (this.LocalPeerType)
            {
            case PeerType.Client:
                var npConfig = new NetPeerConfiguration(AppName);
                client = new NetClient(npConfig);
                break;

            case PeerType.Server:
                serverConfiguration = new NetPeerConfiguration(AppName);
                if (port != null)
                {
                    serverConfiguration.Port = (int)port;
                }
                server = new NetServer(serverConfiguration);
                break;

            case PeerType.Both:
                serverConfiguration = new NetPeerConfiguration(AppName);
                var cConfig = new NetPeerConfiguration(AppName);
                cConfig.Port = (int)port + 1;
                client       = new NetClient(cConfig);
                if (port != null)
                {
                    serverConfiguration.Port = (int)port;
                }
                server = new NetServer(serverConfiguration);
                server.Start();
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(this.LocalPeerType), this.LocalPeerType, null);
            }
            OnInitialized?.Invoke(this.LocalPeerType);
        }
예제 #29
0
    public void Init()
    {
        InitLists();

        int hexagonCoordinatesCount = transform.childCount;

        _allHexagonCoordinates = new GameObject[hexagonCoordinatesCount];

        for (int i = 0; i < hexagonCoordinatesCount; i++)
        {
            _allHexagonCoordinates[i] = transform.GetChild(i).gameObject;

            GameObject attachedHexagon = _allHexagonCoordinates[i].GetComponent <HexagonCoordinate>().attachedHexagon;

            if (attachedHexagon != null)
            {
                attachedHexagon.GetComponent <Hexagon>().Init();
            }
        }

        isInitialized = true;
        OnInitialized?.Invoke();
    }
예제 #30
0
        private void Instance_Initialized(bool succeeded)
        {
            if (succeeded)
            {
                // Configure application version string format
                var version = Windows.ApplicationModel.Package.Current.Id.Version;
                AppVersion = $"{version.Major}.{version.Minor}.{version.Build}.{version.Revision}";

                Debug.WriteLine($"Application version: {AppVersion}");

                InstallFactories();

                Task.Run(async() =>
                {
                    await Devices.Instance.GetMediaAsync();
                });

                RunOnUiThread(() => OnInitialized?.Invoke());
            }
            else
            {
                RunOnUiThread(async() => await new MessageDialog("Failed to initialize WebRTC library!").ShowAsync());
            }
        }