当前位置: 首页>>代码示例>>C#>>正文


C# Renderer.Start方法代码示例

本文整理汇总了C#中Renderer.Start方法的典型用法代码示例。如果您正苦于以下问题:C# Renderer.Start方法的具体用法?C# Renderer.Start怎么用?C# Renderer.Start使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Renderer的用法示例。


在下文中一共展示了Renderer.Start方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Main

        static void Main(string[] args)
        {
            if (args.Length == 0 && Environment.UserInteractive)
            {
                // UI mode
                Console.WriteLine("Starting UI mode...");
                ToolServer.Start();
                App app = new App();
                app.Run();
            }
            else
            {
                // command mode
                var options = new CommandOptions();
                if (CommandLine.Parser.Default.ParseArguments(args, options))
                {
                    ToolServer.Start();
                    using (var r = new Renderer()
                    {
                        PdfFile = options.InputFile,
                        DPI = options.DPI,
                        SaveFolder = options.OutFolder,
                        Verbose = options.Verbose,
                    })
                    {
                        while (!r.CanStart) { Thread.Sleep(100); }
                        r.Start();
                        while (r.IsBusy) { Thread.Sleep(100); }
                    }
                }

            #if DEBUG
                Console.ReadLine();
            #endif
            }
        }
开发者ID:soukoku,项目名称:PdfJsRenderer,代码行数:36,代码来源:Program.cs

示例2: Run

        /// <summary>
        /// Runs this client instance.
        /// </summary>
        public bool Run()
        {
            // A logger must be set and this should be set as the current client in RwCore
            if (RwCore.Client != this)
                throw new InvalidOperationException("RwClient.Start: RwCore.Client must reference this client instance before calling Start().");

            if (Logger == null)
                throw new InvalidOperationException("RwClient.Start: An ILogger instance must be attached before calling Start().");

            if (HasStarted)
                throw new InvalidOperationException("RwClient.Start: Client is already started.");

            Logger.Out("RozWorld client starting...", LogLevel.Info);
            Logger.Out("Initialising directories...", LogLevel.Info);

            FileSystem.MakeDirectory(DIRECTORY_RENDERERS);

            // Load configs
            Logger.Out("Setting configs...", LogLevel.Info);

            if (!File.Exists(FILE_CONFIG))
                MakeDefaultConfigs(FILE_CONFIG);

            DisplayResolutions = new Dictionary<byte, Size>();

            // Load defaults first then load the file on disk
            LoadConfigs(Properties.Resources.DefaultConfigs.Split('\n'));
            LoadConfigs(FileSystem.GetTextFile(FILE_CONFIG));

            // Load renderers
            Logger.Out("Loading renderers...", LogLevel.Info);

            Renderers = new List<Type>();

            foreach (string file in Directory.GetFiles(DIRECTORY_RENDERERS))
            {
                try
                {
                    Assembly assembly = Assembly.LoadFrom(file);
                    Type[] detectedObjects = assembly.GetTypes();

                    foreach (var detectedObject in detectedObjects)
                    {
                        if (detectedObject.BaseType == typeof(Renderer))
                            Renderers.Add(detectedObject);
                    }
                }
                catch (ReflectionTypeLoadException reflectionEx)
                {
                    Logger.Out("An error occurred trying to enumerate the types inside of the library \"" +
                        Path.GetFileName(file) + "\", renderers from this library cannot be loaded. It may " +
                        "have been built with a different version of the RozWorld API.", LogLevel.Error);
                }
                catch (Exception ex)
                {
                    Logger.Out("An error occurred trying to load library \"" + Path.GetFileName(file) +
                        "\", renderers from this library cannot be loaded. The exception that occurred " +
                        "reported the following:\n" + ex.Message + "\nStack:\n" + ex.StackTrace, LogLevel.Error);
                }
            }

            // TODO: Replace this bit so that renderer choice will be loaded from configs
            if (Renderers.Count == 0)
            {
                Logger.Out("No renderers were loaded! Cannot continue.", LogLevel.Fatal);
                return false;
            }

            ActiveRenderer = (Renderer)Activator.CreateInstance(Renderers[0]);
            ActiveRenderer.Initialise();
            //////////////////////////////////////////////////////////////////////////////

            // Load the rest and then start/run the game
            ActiveRenderer.Start();

            while (true) { } // for now

            return true;
        }
开发者ID:rozniak,项目名称:RozWorld,代码行数:82,代码来源:RwClient.cs


注:本文中的Renderer.Start方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。