Example #1
0
        public void Const7to9Test()
        {
            var sm = new StandardModule();

            Assert.True(ModuleReadingState.ConstMatcher.TryMatch(new[] {
                KW("Const"), ID("const7"), KW("As"), ID("Integer"), OP("="), IN("7"),
                OP(","), ID("const8"), OP("="), IN("8"),
                OP(","), ID("const9@"), OP("="), IN("9")
            }, sm));

            {
                var c = sm.Declarations.OfType <ConstantDeclaration>().Single(e => e.Name == "const7");

                Assert.Null(c.IsPublic);
                Assert.Equal("const7", c.Name);
                Assert.Equal(VB6Types.Integer, c.Type);
            }
            {
                var c = sm.Declarations.OfType <ConstantDeclaration>().Single(e => e.Name == "const8");

                Assert.Null(c.IsPublic);
                Assert.Equal("const8", c.Name);
                Assert.Equal(null, c.Type);
            }
            {
                var c = sm.Declarations.OfType <ConstantDeclaration>().Single(e => e.Name == "const9");

                Assert.Null(c.IsPublic);
                Assert.Equal("const9", c.Name);
                Assert.Equal(VB6Types.Currency, c.Type);
            }
        }
Example #2
0
        public void Const6Test()
        {
            var sm = new StandardModule();

            Assert.True(ModuleReadingState.ConstMatcher.TryMatch(new[] { KW("Const"), ID("const6"), KW("As"), ID("Integer"), OP("="), OP("-"), IN("6") }, sm));
            var c = Assert.IsType <ConstantDeclaration>(sm.Declarations.Single());

            Assert.Null(c.IsPublic);
            Assert.Equal("const6", c.Name);
            Assert.Equal(VB6Types.Integer, c.Type);
        }
Example #3
0
        public void Const2Test()
        {
            var sm = new StandardModule();

            Assert.True(ModuleReadingState.ConstMatcher.TryMatch(new[] { KW("Private"), KW("Const"), ID("const2"), OP("="), IN("2") }, sm));
            var c = Assert.IsType <ConstantDeclaration>(sm.Declarations.Single());

            Assert.False(c.IsPublic);
            Assert.Equal("const2", c.Name);
            Assert.Null(c.Type);
        }
Example #4
0
        public void StandardModuleTests_CanLoadModules()
        {
            // Assign
            var module = new StandardModule();
            // Act
            var result = module.Load(out var list);

            // Assert
            Assert.IsTrue(result);
            Assert.IsNotEmpty(list);
            CollectionAssert.AllItemsAreNotNull(list, "Loaded module must not contains null item");
        }
Example #5
0
        public ModuleBase Load()
        {
            ModuleBase m;

            switch (Path.GetExtension(FileName).ToLowerInvariant())
            {
            case ".frm":
                m = new FormModule();
                break;

            case ".cls":
                m = new ClassModule();
                break;

            case ".bas":
                m = new StandardModule();
                break;

            default:
                throw new NotSupportedException();
            }

            _States = new Stack <ISourceReadingState>();
            _States.Push(new ModuleReadingState(m));

            using (var sr = new StreamReader(FileName))
                using (var tp = new TokenParser(sr))
                {
                    Encoding = sr.CurrentEncoding;

                    while (_States.Any() && tp.Read())
                    {
                        if (!tp.Tokens.Any())
                        {
                            continue;
                        }

                        if (!_States.Peek().Accept(this, tp.Tokens))
                        {
                            _States.Pop();
                        }
                    }
                }

            _States = null;

            return(m);
        }
Example #6
0
        public static TService Start <TService>(params Type[] types)
        {
            var state       = new ServerState();
            var withAspects = ConfigurationManager.AppSettings["Revenj.AllowAspects"] == "true";
            var dllPlugins  =
                (from key in ConfigurationManager.AppSettings.AllKeys
                 where key.StartsWith("PluginsPath", StringComparison.OrdinalIgnoreCase)
                 let path = ConfigurationManager.AppSettings[key]
                            let pathRelative = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, path)
                                               let chosenPath = Directory.Exists(pathRelative) ? pathRelative : path
                                                                select chosenPath)
                .ToList();
            var container = Container.Autofac;
            var builder   = container == Container.Autofac
                                ? Revenj.Extensibility.Setup.UseAutofac(null, dllPlugins, true, false, withAspects)
                                : Revenj.Extensibility.Setup.UseDryIoc(null, dllPlugins);

            builder.RegisterSingleton <ISystemState>(state);
            if (container == Container.DryIoc)
            {
                StandardModule.Configure(builder, StandardModule.Database.Postgres);
            }
            foreach (var t in types)
            {
                builder.RegisterType(t, InstanceScope.Transient, false, new[] { t }.Union(t.GetInterfaces()).ToArray());
            }
            if (types.Length == 0 && typeof(TService).IsClass)
            {
                builder.RegisterType(typeof(TService), InstanceScope.Transient, false);
            }
            var factory = builder.Build();

            state.IsBooting = false;
            factory.Resolve <IDomainModel>();
            ContainerWcfHost.Resolver = s => factory.GetService(s);
            state.Started(factory);
            return(factory.Resolve <TService>());
        }
Example #7
0
    // Use this for initialization
    void Awake()
    {
        //If clientunity object is already present on the scene, the new one gets destroyed
        if (FindObjectsOfType(GetType()).Length > 1)
        {
            Destroy(gameObject);
            return;
        }

        //The first ClientUnity is common for every scene
        DontDestroyOnLoad(gameObject);

        //FileInfo fileInfo = new System.IO.FileInfo(Application.dataPath + "/Resources/Update/airt-project-0.1.1-.deb");
        //FileStream fs = File.OpenRead(Application.dataPath + "/Resources/Update/airt-project-0.1.1-.deb");
        //ulong fileSize = (ulong)fileInfo.Length;
        //UnityEngine.Debug.Log("File size: " + fileSize);
        //byte[] fileBytes = new byte[4096];
        //
        //BinaryReader br = new BinaryReader(fs);
        //
        //
        //ulong bytesRead = 0;
        //while (bytesRead < fileSize)
        //{
        //    int readCount = br.Read(fileBytes, (int)0, 4096);
        //    bytesRead += 4096;
        //    UnityEngine.Debug.Log("READING");
        //}
        //UnityEngine.Debug.Log("END");
        //Drone ip
        if (GlobalSettings.Instance.getIP() == "")
        {
            //GlobalSettings.Instance.setIP("10.42.0.101");
            GlobalSettings.Instance.setIP("192.168.8.1");
        }

        //GlobalSettings.Instance.setIP("192.168.8.205");
        //GlobalSettings.Instance.setIP("158.42.154.131");
        //Every module
        client = new Client();

        stdManager             = new StandardModule();
        atreyuManager          = new AtreyuModule();
        osManager              = new OSModule(FileManager.debFilePath, FileManager.debFileName + ".deb");
        fpvManager             = new FPVModule();
        FCS_Module             = new FCSModule();
        libraryManager         = new LibraryModule();
        missionExecutorManager = new MissionExecutorModule();
        pozyxManager           = new PozyxModule();
        pointCloudManager      = new MapperModule();
        droneManager           = new DroneModule();
        recCamModule           = new RecCamModule();
        //mhandlers.Add(new MsgHandler((byte)Modules.POINTCLOUD_MODULE, (byte)PointcloudNotificationType.PCL_SINGLE, onPclData));  // data



        cli_thread = new Thread(() => client.run(mhandlers));
        cli_thread.Start();
        //We start quering atreyu state to see if the app should jump to mapping or recording, as the drone can't do anything other than mapping or recording if it is
        //is those states
        if (client.isConnected)
        {
            tryReconnect = false;
            client.SendCommand((byte)Modules.ATREYU_MODULE, (byte)AtreyuCommandType.ATREYU_QUERY_SYSTEM_STATE);
        }
        else
        {
            tryReconnect = true;
        }
        //client.sendCommand((byte)Modules.ATREYU_MODULE, (byte)AtreyuCommandType.ATREYU_QUERY_SERVER_VERSION);
    }