Пример #1
0
        public DBpedia(DataSampleService sampleService, SettingsService settingsService) : base(CommonDependency.DataType, CommonDependency.Name)
        {
            _sampleService = sampleService;
            _configuration = settingsService.LoadSetting <DBpediaConfiguration>(this, "Settings").Result;

            _cacheLocation = Path.Combine(ModuleEngine.ModulePath(this), "Cache");
            if (!Directory.Exists(_cacheLocation))
            {
                Directory.CreateDirectory(_cacheLocation);
            }
        }
        /// <summary>
        /// Invalidate all game modules.
        /// </summary>
        private void InvalidateModules()
        {
            ModuleEngine?.Dispose();
            ModuleEngine = default;

            ModuleClient?.Dispose();
            ModuleClient = default;

            Process?.Dispose();
            Process = default;
        }
Пример #3
0
        public ConnectionViewModel(ModuleEngine moduleEngine)
        {
            _moduleEngine = moduleEngine;

            SourceTypes = new ObservableCollection <string>(_moduleEngine.SchemaInferenceModules.Select(m => m.SupportedSourceType()).Distinct().ToList());

            Connections = new ObservableCollection <ConnectionInfo>(moduleEngine.Connections);

            CreateConnection = new RelayCommand <ConnectionInfo>(OnCreateConnection);
            RemoveConnection = new RelayCommand <ConnectionInfo>(OnRemoveConnection);

            Connections.CollectionChanged += ConnectionsOnCollectionChanged;
        }
Пример #4
0
        public ViewModelLocator()
        {
            _container = new Container();

            var locatorAdapter = new SimpleInjectorServiceLocatorAdapter(_container);

            ServiceLocator.SetLocatorProvider(() => locatorAdapter);

            ////if (ViewModelBase.IsInDesignModeStatic)
            ////{
            ////    // Create design time view services and models
            ////    SimpleIoc.Default.Register<IDataService, DesignDataService>();
            ////}
            ////else
            ////{
            ////    // Create run time view services and models
            ////    SimpleIoc.Default.Register<IDataService, DataService>();
            ////}

            _container.Register <Container>(() => _container, Lifestyle.Singleton);
            _container.Register <ISnackbarMessageQueue>(() => new SnackbarMessageQueue(), Lifestyle.Singleton);
            _container.Register <ViewModelLocator>(() => this, Lifestyle.Singleton);

            // Windows
            _container.Register <MainViewModel>(Lifestyle.Singleton);

            // Controls
            _container.Register <HomeViewModel>();
            _container.Register <ConnectionViewModel>(Lifestyle.Singleton);
            _container.Register <ExecutionViewModel>(Lifestyle.Singleton);
            _container.Register <ConfigurationViewModel>(Lifestyle.Singleton);
            _container.Register <LogViewModel>(Lifestyle.Singleton);

            SettingsService settingsService = new SettingsService();

            _container.Register <DataSampleService>(Lifestyle.Singleton);
            _container.Register <SettingsService>(() => settingsService, Lifestyle.Singleton);

            _container.Register <ModuleEngine>(() => ModuleEngine.CreateInstance(_container, settingsService).Result, Lifestyle.Singleton);

            try
            {
                _container.Verify();
            }
            catch (Exception e)
            {
                Logger.Log(e);
                throw;
            }
        }
Пример #5
0
        public ExecutionViewModel(ModuleEngine moduleEngine, DataSampleService sampleService)
        {
            _moduleEngine  = moduleEngine;
            _sampleService = sampleService;

            Configurations    = moduleEngine.Configurations;
            CurrConfiguration = moduleEngine.CurrentConfiguration;

            ExecuteConfiguration = new RelayCommand(OnExecuteConfiguration, () => !_isExecuting);
            NextStep             = new RelayCommand(OnNextStep, () => !_isExecuting);
            ShowCommonModel      = new RelayCommand <CommonGraph>(OnShowCommonModel);
            RemoveCommonModel    = new RelayCommand <CommonGraph>(OnRemoveCommonModel);
            ShowStarModel        = new RelayCommand <StarGraph>(OnShowStarModel);
            RemoveStarModel      = new RelayCommand <StarGraph>(OnRemoveStarModel);
        }
Пример #6
0
        private IEnumerator fireBurnOut(ModuleEngine engine)
        {
            yield return(new WaitForSeconds(fireDestroyTime));

            if (engine.engineEnabled)
            {
                StopWarning();

                engine.engineEffects.particleEffects[1].afterburnerOnly = true;
                engine.FailEngine();
            }
            else
            {
                engine.engineEffects.particleEffects[1].afterburnerOnly = true;
                StopWarning();
            }
        }
Пример #7
0
        public static void EngineMods(GameObject vehicle)
        {
            engine             = GameObject.Find("f45a-engine").GetComponent <ModuleEngine>();
            engine.startupTime = 0.1f;
            engine.fuelDrain   = 0f;

            if (enableSuperThrust)
            {
                engine.maxThrust    = 4000f;
                engine.idleThrottle = 0.01f;
                engine.abThrustMult = 50f;
            }
            else
            {
                engine.maxThrust    = 208f;
                engine.idleThrottle = 0.03f;
                engine.abThrustMult = 1.12233f;
            }
        }
Пример #8
0
        public ConfigurationViewModel(ModuleEngine moduleEngine)
        {
            _moduleEngine = moduleEngine;

            Categories = new List <ConfigurationCategory>
            {
                new ConfigurationCategory("Metadata phase"),
                new ConfigurationCategory("Refinement phase"),
                new LimitedConfigurationCategory("Star phase (Combination)", 1),
                new ConfigurationCategory("Star phase (Find fact tables)"),
                new ConfigurationCategory("Star phase (Find dimensions)"),
                new ConfigurationCategory("Star refinement phase"),
                new ConfigurationCategory("Generation phase")
            };


            // Configurations
            Configurations    = new ObservableCollection <Configuration>(moduleEngine.Configurations);
            CurrConfiguration = moduleEngine.CurrentConfiguration;

            CreateConfiguration = new RelayCommand(OnCreateConfiguration);
            SaveConfiguration   = new RelayCommand(OnSaveConfiguration, () => !_isSaving);
        }
Пример #9
0
        public virtual void Initialize(bool promiscuous)
        {
            ICaptureDevice device = null;

            //Attempt to load modules in the current directory.
            ModuleEngine.Load(UnixEnvironment.CurrentDirectory);
            ModuleEngine.ScannerShouldExecute += HandleModuleShouldExecute;

            //Open the logger for output.
            try
            {
                Logger.Open();
            }
            catch
            {
                Debugger.Put(1, "Proceeding without logging!", ConsoleColor.DarkMagenta);
                Logger = new NullLogger();
            }

            /*
             * Attempt to open the specified device for capturing.
             */
            try
            {
                //Attempt to open the device interface for capture.
                Debugger.Status("Opening device '" + Device + "' for capture...");

                //Configure device for packet capture.
                device = GetDevice(Device);
                device.OnPacketArrival += HandleOnPacketArrival;

                //Open the device depending on the mode specified.
                if (promiscuous)
                {
                    device.Open(DeviceMode.Promiscuous);
                }
                else
                {
                    device.Open(DeviceMode.Normal);
                }

                Debugger.Success();
            }
            catch (Exception e)
            {
                Debugger.Failure(e);
                Environment.Exit(-1);
            }

            /*
             * Attempt to start capturing packets on the device.
             */
            try
            {
                Debugger.Status("Starting capture on device '" + Device + "'");

                //Wait two seconds for modules to load before starting capture.
                Thread.Sleep(2000);
                device.StartCapture();

                Debugger.Success();
            }
            catch (Exception e)
            {
                Debugger.Failure(e);
                Environment.Exit(-2);
            }

            //Start module scheduler thread.
            ModuleEngine.StartScheduler();

            //Waits for a UNIX kill signal.
            UnixSignal.WaitAny(new UnixSignal [] {
                new UnixSignal(Signum.SIGINT),
                new UnixSignal(Signum.SIGTERM),
                new UnixSignal(Signum.SIGQUIT),
                new UnixSignal(Signum.SIGHUP)
            });

            /*
             * At this point a kill signal has been received and
             * the shutdown process can begin.
             *
             * Stop capturing and stop modules from running.
             */
            Debugger.Put(3, "Terminate signal received");
            ModuleEngine.StopScheduler();
            Logger.Close();
            device.StopCapture();
            Thread.Sleep(2000);

            /*
             * Kill signal received, attempt to close the listening device.
             */
            try
            {
                Debugger.Status("Attempting to close device...");

                //Close the interface from packet capturing.
                device.Close();

                Debugger.Success();
            }
            catch (Exception e)
            {
                Debugger.Failure(e);
            }

            //Exit with success!
            Environment.Exit(0);
        }
Пример #10
0
    private void Awake()
    {
        actor             = gameObject.GetComponent <Actor>();
        lastFiringMessage = new Message_WeaponFiring(-1, false, false, networkUID);
        // lastStoppedFiringMessage = new Message_WeaponStoppedFiring(networkUID);
        lastCountermeasureMessage = new Message_FireCountermeasure(true, true, networkUID);
        lastDeathMessage          = new Message_Death(networkUID, false);
        wheelsController          = GetComponent <WheelsController>();
        aeroController            = GetComponent <AeroController>();
        isPlayer       = actor.isPlayer;
        sequenceNumber = 0;
        lastMessage    = new Message_PlaneUpdate(false, 0, 0, 0, 0, 0, 0, false, false, false, networkUID, sequenceNumber);

        engine = gameObject.GetComponentInChildren <ModuleEngine>();
        if (engine == null)
        {
            Debug.Log("engine was null on vehicle " + gameObject.name);
        }

        weaponManager = GetComponent <WeaponManager>();
        if (weaponManager == null)
        {
            Debug.LogError("Weapon Manager was null on vehicle " + gameObject.name);
        }
        else
        {
            traverse             = Traverse.Create(weaponManager);
            Networker.WeaponSet += WeaponSet;
            //weaponManager.OnWeaponEquipped += Rearm;
            //weaponManager.OnWeaponUnequippedHPIdx +=Rearm;

            //detect player rearm
            PlayerVehicleSetup pv = gameObject.GetComponent <PlayerVehicleSetup>();
            if (pv != null)
            {
                pv.OnEndRearming.AddListener(Rearm);
            }

            if (actor.isPlayer && weaponManager.GetIWBForEquip(3) != null)
            {
                iwb = weaponManager.GetIWBForEquip(3);
            }
        }

        cmManager = GetComponentInChildren <CountermeasureManager>();
        if (cmManager == null)
        {
            Debug.LogError("CountermeasureManager was null on vehicle " + gameObject.name);
        }
        else
        {
            cmManager.OnFiredCM += FireCountermeasure;
        }

        fuelTank = GetComponent <FuelTank>();
        if (fuelTank == null)
        {
            Debug.LogError("FuelTank was null on vehicle " + gameObject.name);
        }


        Debug.Log("Done Plane Sender");
        tailhook   = GetComponentInChildren <Tailhook>();
        launchBar  = GetComponentInChildren <CatapultHook>();
        refuelPort = GetComponentInChildren <RefuelPort>();
    }
Пример #11
0
        public override void Run()
        {
            Debug.Log($"TestVAR: {testVar}");
            testVar = "Run";
            Debug.Log($"TestVAR: {testVar}");


            Debug.Log("*******");
            Debug.Log(HUDWarning.warnText.color);
            Debug.Log(HUDWarning.warnText.text);

            base.Run();
            running = true;

            GameObject currentVehicle = VTOLAPI.instance.GetPlayersVehicleGameObject();

            ModuleEngine[] engines = currentVehicle.GetComponentsInChildren <ModuleEngine>();

            System.Random rand  = new System.Random();
            int           index = rand.Next(engines.ToList().Count());

            Debug.Log($"Total Engines: {engines.ToList().Count()}");
            ModuleEngine engine = engines[index];



            UIImageToggle[] lights = currentVehicle.GetComponentsInChildren <UIImageToggle>();
            string          leftOrRight;
            string          leftOrRightCAPS;

            if (index == 0)
            {
                leftOrRight     = "Left";
                leftOrRightCAPS = "LEFT";
            }
            else
            {
                leftOrRight     = "Right";
                leftOrRightCAPS = "RIGHT";
            }

            // Adding warning text to the HUD Warning
            if (engines.ToList().Count() > 0)
            {
                SetHUDWarningText($"-[ {leftOrRightCAPS} ENGINE FIRE ]-");
            }

            StartWarning();


            // THIS DOESN'T SET THE LIGHT TO ON. WHAT GIVES?
            foreach (UIImageToggle light in lights)
            {
                if (light.name.Contains($"EWIndicator_{leftOrRight}"))
                {
                    Traverse.Create(light).Field("color").SetValue(Color.red);
                    light.gameObject.SetActive(true);
                }
            }

            // This is a lazy way to set this. Need to find a better "fire" simulation.
            engine.engineEffects.particleEffects[1].afterburnerOnly = false;



            StartCoroutine(fireBurnOut(engine));
        }
Пример #12
0
        static void Main(string[] args)
        {
            //Miminum threshold to continue on with
            double STAR_FACT_THRESHOLD = 0.8;

            Stopwatch timer      = Stopwatch.StartNew();
            Stopwatch phaseTimer = Stopwatch.StartNew();

            Logger.Log("Creating module engine...");
            var moduleEngine = ModuleEngine.CreateInstance(Container, Container.GetInstance <SettingsService>()).Result;

            // ==== Metadata phase ==== //

            Logger.Log("Metadata schemas");
            // Get databases
            var commonModels = moduleEngine.GetDatabases();

            Console.ForegroundColor = ConsoleColor.Cyan;
            Console.WriteLine($"Finished metadata phase in {phaseTimer.Elapsed}");
            phaseTimer.Restart();
            Console.ResetColor();

            // ==== Refinement phase ==== //

            Logger.Log("Refinement phase");
            // Refine databases
            var refinedModels = moduleEngine.RefineDatabases(new List <CommonModel> {
                commonModels
            }).Result;

            foreach (var commonModelsTable in refinedModels.First().Tables)
            {
                foreach (var column in commonModelsTable.Columns)
                {
                    if (column.IsPrimaryKey())
                    {
                        Console.ForegroundColor = ConsoleColor.Cyan;
                    }
                    var dt = column.DataType;
                    //Console.WriteLine($"\t{column.Name.PadRight(25)}{dt.Type.ToString().PadRight(12)} ({dt.Length})({dt.Precision})({dt.Precision})");
                    Console.WriteLine($"{commonModelsTable.Name}#{column.Name}#{dt.Type.ToString()}#{column.KeyString}#{column.ConstraintString}");
                    Console.ResetColor();
                }
                Console.WriteLine();
            }

            Console.WriteLine("===============");
            foreach (var commonModelsTable in refinedModels.First().Tables)
            {
                IEnumerable <Relation> relations = commonModelsTable.Relations.Where(r => r.LinkTable == commonModelsTable);

                foreach (Relation relation in relations)
                {
                    Console.WriteLine(relation.ToString());
                }
            }

            Console.ResetColor();
            Console.WriteLine("Done");
            Console.ReadLine();

            // Group common models depending on relations
            var groupedCommonModels = moduleEngine.GroupCommonModels(refinedModels);

            Logger.Log($"Grouped common models and found {groupedCommonModels.Count} common models");

            Console.ForegroundColor = ConsoleColor.Cyan;
            Console.WriteLine($"Finished refinement phase in {phaseTimer.Elapsed}");
            phaseTimer.Restart();
            Console.ResetColor();

            // ==== Star phase ==== //

            // Combine Tables
            List <CommonModel> combined = new List <CommonModel>();

            foreach (var cm in groupedCommonModels)
            {
                combined.AddRange(moduleEngine.GenerateCombinedCommonModels(cm));
            }
            Logger.Log(Logger.Level.Debug, $"Generated: {combined.Count} common model(s)");
            Logger.Log("Generating Fact tables");

            // Generate fact tables
            List <StarModel> starModels = new List <StarModel>();

            foreach (var groupedModel in combined)
            {
                starModels.AddRange(moduleEngine.GenerateStarModels(groupedModel, STAR_FACT_THRESHOLD));
            }

            Logger.Log($"Generated: {starModels.Count} fact table(s)");
            Logger.Log("Generating Star models");

            var newStarModels = moduleEngine.GenerateStarModelsAfterFact(starModels);

            Logger.Log($"Generated: {newStarModels.Count} star model(s)");

            Console.ForegroundColor = ConsoleColor.Cyan;
            Console.WriteLine($"Finished star phase in {phaseTimer.Elapsed}");
            phaseTimer.Restart();
            Console.ResetColor();

            // ==== Star refinement phase ==== //

            Logger.Log("Refining Star models");
            var refinedStarModels = moduleEngine.RefineStarModels(newStarModels);

            Console.ForegroundColor = ConsoleColor.Cyan;
            Console.WriteLine($"Finished star refinement phase in {phaseTimer.Elapsed}");
            phaseTimer.Restart();
            Console.ResetColor();

            // ==== Generation phase ==== //

            Logger.Log("Generation physical model for star models");
            moduleEngine.GenerateModels(refinedStarModels).Wait();

            Console.ForegroundColor = ConsoleColor.Cyan;
            Console.WriteLine($"Finished generation phase in {phaseTimer.Elapsed}");
            phaseTimer.Restart();
            Console.ResetColor();

            timer.Stop();
            Console.WriteLine(timer.Elapsed);

            Console.WriteLine("Finished");
            Console.ReadLine();
        }