Esempio n. 1
0
    public void DeviceAndInstallRegister()
    {
        FirstStartSetupController.Instance.RedoSetup(true);
        var serverId = new EntityId(1, 1, 1, 0);

        // start
        DevCore.Init(serverId, false, true);
        // servercore won't receive commands
        //DevCore.DevInstance.simulationInstances[serverId].IsConnected = false;

        //var clientCore = DevCore.DevInstance.simulationInstances[serverId];

        // start the client
        ClientCore.Init();

        // Device and Installation should now exist
        Assert.AreNotEqual(default(EntityId), ConfigController.DeviceId);
        Assert.AreNotEqual(default(EntityId), ConfigController.InstallationId);

        // enable network
        DevCore.DevInstance.simulationInstances[serverId].IsConnected = true;

        // cause an update that will attempt to send offline queue

        // Device and Installation should have online ids

        Logger.Log($"DeviceId: {ConfigController.DeviceId}");
        Logger.Log($"InstallationId: {ConfigController.InstallationId}");
    }
Esempio n. 2
0
    // Start is called before the first frame update
    void Start()
    {
        // add the new Commands via the extention
        Coflnet.Core.CoreExtentions.Commands.Add(new TenfaitExtention());

        // "boot it up"
        ClientCore.Init();
    }
Esempio n. 3
0
        /// <summary>
        /// Initialized the global <see cref="CoflnetCore.Instance"/> as a `devCore`.
        /// Will reset the development enviroment when called again (to support multiple unit tests)
        /// </summary>
        /// <param name="id">Application/Server Id to use</param>
        /// <param name="preventDefaultScreens"><c>true</c> when default settings (dummys) should NOT be set such as <see cref="DummyPrivacyScreen"/></param>
        /// <param name="preventInit"><c>true</c> when The Inits of Client and Server-Cores should not be invoked and client should be prepared like a fresh install</param>
        public static void Init(EntityId id, bool preventDefaultScreens = false, bool preventInit = false)
        {
            //[Deprecated]
            ConfigController.ActiveUserId = id;
            // sets the primary managing server
            ConfigController.ApplicationSettings.id = id.FullServerId;

            if (!preventDefaultScreens)
            {
                SetupDefaults();
            }

            // to have instances loaded
            var toLoadInstance = ClientCore.ClientInstance;
            var serverInstance = ServerCore.ServerInstance;

            if (DevInstance == null)
            {
                DevInstance = new DevCore();
                DevInstance.simulationInstances = new Dictionary <EntityId, SimulationInstance> ();
                CoflnetCore.Instance            = DevInstance;
            }
            else
            {
                // reset if there was an devinstance bevore
                DevInstance.simulationInstances.Clear();
                ServerCore.ServerInstance = new ServerCoreProxy();
                ClientCore.ClientInstance = new ClientCoreProxy();
            }

            DevInstance.AddServerCore(id.FullServerId);
            if (!id.IsServer)
            {
                DevInstance.AddClientCore(id);
            }
            else
            {
                DevInstance.AddClientCore(EntityId.Default);
            }

            if (!preventInit)
            {
                ServerCore.Init();
                ClientCore.Init();
            }
        }