示例#1
0
        /// <summary>
        /// Called by the Loader, once when the library is loaded.
        /// </summary>
        /// <param name="logFile">Where to write log output</param>
        public static void OnInit(TextWriter logFile)
        {
            LogFile = logFile;
            TotalTime.Start();
            GameVersion = (VersionNum)GetGameVersion();
            Log($"Initializing game version {GameVersion}...");
            // Create all the scripts first so they can order themselves, using their DependsOn attribute
            Assembly.GetExecutingAssembly().GetTypes().Each(CreateScript);
            Log("Script Order: " + string.Join(" ", Script.Order.Select(s => s.GetType().Name.Split('.').Last())));
            // Then use OnInit() on each of them in their preferred order.
            // Loop using manual LinkedList methods so we can use RemoveAndContinue
            LinkedListNode <Script> cur = Script.Order.First;

            while (cur != null && cur.Value != null)
            {
                try {
                    cur.Value.OnInit();
                    cur = cur.Next;
                } catch (Exception err) {
                    Log($"Failed to init {cur.Value.GetType().Name}: {err.Message}");
                    Log(err.StackTrace);
                    Log(err.InnerException?.ToString());
                    cur = Script.Order.RemoveAndContinue(cur);
                }
            }
            Controls.OnInit();
        }
        protected override void BeginProcessing()
        {
            TotalTime.Start();

            //total files: CObject.Files.Length
            CObject = new ConverterOptions
            {
                Files           = Directory.GetFiles(Input, "*.CR2"),
                OutputDirectory = Output
            };

            base.BeginProcessing();
        }
示例#3
0
        private void MonoCefBrowser_Paint(object sender, OnPaintEventArgs e)
        {
            if (e.DirtyRect.Width == 0 || e.DirtyRect.Height == 0)
            {
                return;
            }
            TotalTime.Start();
            var       bmp     = this.ScreenshotOrNull(PopupBlending.Main);
            Texture2D texture = null;

            if (bmp != null)
            {
                texture = GetTexture(bmp, e.DirtyRect);
                RenderCount++;
                //Console.WriteLine($"{TotalTime.ElapsedMilliseconds / (double)RenderCount}");
            }
            TotalTime.Stop();
            if (texture != null)
            {
                this.NewFrame?.Invoke(this, new NewFrameEventArgs(texture));
            }
        }
示例#4
0
 public void Simulate()
 {
     TotalTime.Reset();
     TotalTime.Start();
 }