예제 #1
0
        static void Main(string[] args)
        {
            EngineOption option = new EngineOption();

#if !DEBUG
            option.IsFullScreen = true;
#endif
            Engine.Initialize("Aero Groovers", 1280, 800, option);

            Engine.File.AddRootDirectory("Resources/");
            // Engine.File.AddRootPackageWithPassword("Resources.pack", "AERO_GROOVERS");

            Engine.ChangeSceneWithTransition(new TitleScene(), new TransitionFade(0, 1));

            while (Engine.DoEvents())
            {
                Engine.Update();

                if (Engine.Keyboard.GetKeyState(Keys.Escape) == ButtonState.Push)
                {
                    break;
                }
            }

            Engine.Terminate();
        }
예제 #2
0
        public override void Test(GraphicsDeviceType graphicsType)
        {
            Time = 0;

            Console.WriteLine("[{0}_{1}]", Title, graphicsType);

            var option = new EngineOption
            {
                IsFullScreen   = false,
                GraphicsDevice = graphicsType,
            };

            var result = Engine.Initialize(Title, 640, 480, option);

            if (!result)
            {
                throw new Exception("Altseedの初期化に失敗しました。");
            }

            try
            {
                OnStart();

                while (Engine.DoEvents())
                {
                    OnUpdating();
                    Engine.Update();
                    OnUpdated();

                    if (Time == ExitTime)
                    {
                        if (!Directory.Exists(PathOfSS))
                        {
                            Directory.CreateDirectory(PathOfSS);
                        }
                        var path = string.Format("{0}/{1}_{2}.png", PathOfSS, Title, graphicsType);
                        Engine.TakeScreenshot(path);
                    }
                    else if (Time == ExitTime + 2)
                    {
                        break;
                    }

                    ++Time;
                }

                OnFinish();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
                throw;
            }
            finally
            {
                Engine.Terminate();
            }
        }
        private HtmlNodeCollection GetResultNodes(EngineOption engine)
        {
            var path = $"./TestData/{engine.Name}.htm";

            var doc = new HtmlDocument();

            doc.Load(path);

            return(doc.DocumentNode.SelectNodes(engine.ResultPath));
        }
예제 #4
0
        public ResultBuilder(EngineOption engine)
        {
            var parsingOption = engine.ParsingOption;

            EngineName     = engine.Name;
            TitleXPath     = XPathExpression.Compile(parsingOption.TitlePath);
            UrlXPath       = XPathExpression.Compile(parsingOption.UrlPath);
            UrlViewXPath   = XPathExpression.Compile(parsingOption.UrlViewPath);
            ParagraphXPath = XPathExpression.Compile(parsingOption.ParagraphPath);
        }
예제 #5
0
        private async Task <IEnumerable <SearchResult> > GetResults(EngineOption engine)
        {
            var client   = _httpClientFactory.CreateClient(engine.Name);
            var response = await client.GetAsync(string.Format(engine.SearchPath, SearchString, PageNumber *engine.PageMultiplier));

            var doc = new HtmlDocument();

            doc.LoadHtml(await response.Content.ReadAsStringAsync());
            var results = doc.DocumentNode.SelectNodes(engine.ResultPath);
            var builder = new ResultBuilder(engine);

            return(results?.Select(builder.Create) ?? new List <SearchResult>());
        }
예제 #6
0
        public override void Test(GraphicsType graphicsType)
        {
            Console.WriteLine("[{0}_{1}]", Title, graphicsType);

            int time   = 0;
            var option = new EngineOption
            {
                IsFullScreen         = false,
                GraphicsType         = graphicsType,
                IsMultithreadingMode = true,
            };

            var result = Engine.Initialize(Title, 640, 480, option);

            if (!result)
            {
                throw new Exception("ACEの初期化に失敗しました。");
            }

            OnStart();

            while (Engine.DoEvents())
            {
                OnUpdating();
                Engine.Update();
                OnUpdated();

                if (time == TimeForExit)
                {
                    if (!Directory.Exists(PathOfSS))
                    {
                        Directory.CreateDirectory(PathOfSS);
                    }
                    var path = string.Format("{0}/{1}_{2}.png", PathOfSS, Title, graphicsType);
                    Engine.TakeScreenshot(path);
                }
                else if (time == TimeForExit + 2)
                {
                    break;
                }

                ++time;
            }

            OnFinish();

            Engine.Terminate();
        }
예제 #7
0
        public static TranscodeOption Parse2Conf(this List <TranscodeTemplateEntity> transcodeTemplate)
        {
            if (transcodeTemplate != null && transcodeTemplate.Count > 0)
            {
                List <EngineOption> engineList = new List <EngineOption>();
                foreach (TranscodeTemplateEntity entity in transcodeTemplate)
                {
                    LogoTemplateEntity logoTemplate = entity.LogoTemplate;
                    EngineOption       engine       = new EngineOption(entity.Name);
                    var videoOption = string.IsNullOrEmpty(entity.VideoOption) ? null : JsonConvert.DeserializeObject <VideoOptionModel>(entity.VideoOption);
                    var audioOption = string.IsNullOrEmpty(entity.AudioOption) ? null : JsonConvert.DeserializeObject <AudioOptionModel>(entity.AudioOption);

                    if (logoTemplate != null)
                    {
                        engine.vfilter = VFilterOption.LogoOption($"./etc/{logoTemplate.Id}.png");
                        if (videoOption == null)
                        {
                            videoOption = new VideoOptionModel()
                            {
                                BitRate = 800,
                                Type    = VideoCodeType.Baseline,
                            };
                        }
                    }
                    engine.vcodec   = videoOption == null ? "copy" : "libx264";
                    engine.vprofile = videoOption?.Type.ToString() ?? "";
                    engine.vbitrate = videoOption?.BitRate ?? 0;
                    engine.vfps     = videoOption?.Fps ?? 0;
                    engine.vwidth   = videoOption?.Width ?? 0;
                    engine.vheight  = videoOption?.Height ?? 0;

                    engine.acodec       = audioOption == null ? "copy" : "libfdk_aac";
                    engine.abitrate     = audioOption?.BitRate ?? 0;
                    engine.asample_rate = audioOption?.SampleRate ?? 0;
                    engineList.Add(engine);
                }
                TranscodeOption transcode = new TranscodeOption()
                {
                    enabled       = "on",
                    EngineOptions = engineList,
                };
                return(transcode);
            }
            else
            {
                return(null);
            }
        }
        public void ShouldBuild(EngineOption engine)
        {
            var resultNodes = GetResultNodes(engine);

            var builder = new ResultBuilder(engine);
            var result  = resultNodes.Select(builder.Create).Distinct().ToArray();

            Assert.AreEqual(SEARCH_RESULTS_COUNT, result.Length);
            foreach (var item in result)
            {
                Assert.IsNotNull(item.Title);
                Assert.IsNotNull(item.Paragraph);
                Assert.IsNotNull(item.Url);
                Assert.IsNotNull(item.UrlView);
            }
        }
예제 #9
0
        public override void Test(GraphicsDeviceType graphicsType)
        {
            var option = new EngineOption()
            {
                GraphicsDevice = graphicsType
            };

            Engine.Initialize("DisposeOnTerminate", 640, 480, option);

            var scene = new TestScene();

            Engine.ChangeScene(scene);

            while (Engine.DoEvents())
            {
                Engine.Update();
            }

            Engine.Terminate();

            Assert.AreEqual(true, scene.AlreadyDisposed);
        }
예제 #10
0
        static void Main( string[] args )
        {
            var option = new EngineOption { GraphicsType = GraphicsType.DirectX11, IsFullScreen = false };
            Engine.Initialize( "ペルマニズム", 800, 600, option );

            var model = new PlayingFlow();
            var channel = new Channel<IMessage>( model.Run() );

            var scene = new Scene();
            var layer = new UI.TableLayer( model );
            var view = new TableView( channel, layer );

            scene.AddLayer(layer);
            Engine.ChangeScene( scene );

            var channelTask = channel.RunAsync();

            while( Engine.DoEvents() && !IsFinished )
            {
                Engine.Update();
            }

            Engine.Terminate();
        }
예제 #11
0
 public ObservableEngineOption(EngineOption option)
 {
     Key = option.Key;
 }
예제 #12
0
파일: Program.cs 프로젝트: nodchip/tanuki-
 public Engine(EngineOption opt)
     : this(opt.engineName, opt.fileName, opt.arguments, opt.workingDirectory, opt.optionOverrides)
 {
 }