Exemple #1
0
        public override bool Run(string[] args)
        {
            Byt3.ADL.Debug.DefaultInitialization();
            EmbeddedFileIOManager.Initialize();

            OpenFLDebugConfig.Settings.MinSeverity = Verbosity.Level3;

            ManifestReader.RegisterAssembly(Assembly
                                            .GetExecutingAssembly());            //Register this assembly(where the files will be embedded in)
            ManifestReader.RegisterAssembly(typeof(OpenFLDebugConfig).Assembly); //Register the OpenFL.Common Assembly as it contains the CL kernels
            ManifestReader.PrepareManifestFiles(false);                          //First Read Assembly files
            ManifestReader
            .PrepareManifestFiles(true);                                         //Replace Any Loaded assembly files with files on the file system.


            if (IOManager.FileExists("assemblyList.txt")) //Alternative, load assembly list to register from text file.
            {
                Logger.Log(DebugChannel.Log, "Loading Assembly List", 1);

                ManifestReader.LoadAssemblyListFromFile("assemblyList.txt");
            }


            GameEngine engine = new GameEngine(EngineSettings.DefaultSettings);

            engine.Initialize();
            engine.InitializeScene <HoBMenuScene>();
            engine.Run();
            engine.Dispose();

            HandleBase.DisposeAllHandles();
            EngineStatisticsManager.DisposeAllHandles();

            return(true);
        }
Exemple #2
0
        public override bool Run(string[] args)
        {
            ADL.Debug.DefaultInitialization();
            EmbeddedFileIOManager.Initialize();

            ManifestReader.RegisterAssembly(Assembly
                                            .GetExecutingAssembly()); //Register this assembly(where the files will be embedded in)
            ManifestReader.PrepareManifestFiles(false);               //First Read Assembly files
            ManifestReader
            .PrepareManifestFiles(true);                              //Replace Any Loaded assembly files with files on the file system.


            if (IOManager.FileExists("assemblyList.txt")) //Alternative, load assembly list to register from text file.
            {
                Logger.Log(DebugChannel.Log, "Loading Assembly List", 1);

                ManifestReader.LoadAssemblyListFromFile("assemblyList.txt");
            }


            GameEngine engine = new GameEngine(EngineSettings.DefaultSettings);

            engine.Initialize();
            engine.InitializeScene <PhysicsDemoScene>();
            engine.Run();
            engine.Dispose();

            HandleBase.DisposeAllHandles();
            EngineStatisticsManager.DisposeAllHandles();

            return(true);
        }
Exemple #3
0
        public static void WriteStatistics(string file)
        {
            Stream     s  = File.Create(file);
            TextWriter tw = new StreamWriter(s);

            tw.WriteLine("Total Updates:" + TotalUpdates);
            tw.WriteLine("\tMin Update Time:" + SmallestUpdateTime);
            tw.WriteLine("\tMax Update Time:" + BiggestUpdateTime);
            tw.WriteLine("Total Frames:" + TotalFrames);
            tw.WriteLine("Total Render Time:" + TotalRenderTime);
            tw.WriteLine("\tMin Render Time:" + SmallestRenderTime);
            tw.WriteLine("\tMax Render Time:" + BiggestRenderTime);
            tw.WriteLine("OpenGL Stats:");
            tw.WriteLine("Total Objects Created:" + TotalGLObjectsCreated);
            tw.WriteLine("\tUndisposed Objects: " + objects.Count);
            for (int i = 0; i < objects.Count; i++)
            {
                tw.WriteLine($"\t\tObject {i} : " + objects[i].HandleIdentifier);
            }


            tw.Write(HandleBase.WriteStatistics());

            tw.Close();
            s.Close();
        }
Exemple #4
0
        private void StartScene(Type t)
        {
            ge.Initialize();
            ge.InitializeScene(t);
            ge.Run();

            //Clean up our mess
            EngineStatisticsManager.DisposeAllHandles(); //Dispose GL Handles
            HandleBase.DisposeAllHandles();              //Dispose CL Handles
        }
Exemple #5
0
        private void Walk_Callback(IntPtr intPtr, IntPtr intPtr2)
        {
            if (intPtr == IntPtr.Zero)
            {
                return;
            }
            HandleBase handleBase = HandleBase.GetObjectFromHandel <HandleBase>(intPtr);

            if (!handleBase.IsInvalid && !handleBase.IsClosed && handleBase != _asyncHand1 && handleBase != _asyncHand2)
            {
                handleBase.Dispose();
            }
        }
Exemple #6
0
        public static string GetValue(string val, DataGridColumn dc, string uid)
        {
            if (dc.DataType == "date")
            {
                DateTime dt;
                DateTime.TryParse(val, out dt);
                return(dt.ToShortDateString());
            }
            if (dc.ComboName == "")
            {
                dc.ComboName = GlobalShare.DataPointMappings[dc.dpt.Name].ComboName;
            }
            if (dc.DataType == "calcexpr")
            {
                CalcExpr   ce = new CalcExpr();
                HandleBase hb = ce.GetHandleClass(dc.Method, dc.CalcExpr);
                val = hb.Handle();
            }
            if ((dc.DataType == "combo" || dc.DataType == "datacombo") && dc.ComboName != null && dc.ComboName.Trim().Length > 0)
            {
                DataChoice dcc = null;
                if (dc.DataType == "combo")
                {
                    dcc = GlobalShare.GetGlobalChoice(dc.Owner.frmhandle.strUid, dc.ComboName);
                }
                else
                {
                    DataComboBox dcb = new DataComboBox(dc.ComboName, uid);
                    dcb.TextField             = dc.TextField;
                    dcb.ValueField            = dc.ValueField;
                    dcb.ComboItemsSplitString = dc.ComboItemsSplitString;
                    List <DataChoiceItem> dcis = dcb.GetDataSource();
                    dcc = new DataChoice();
                    dcc.Options.AddRange(dcis.ToArray());
                }
                if (dcc != null)
                {
                    DataChoiceItem dci = dcc.FindChoiceByValue(val);
                    if (dci != null)
                    {
                        return(dci.Text);
                    }
                }
            }

            return(val);
        }
Exemple #7
0
 /// <summary>
 /// 向窗口句柄发送点击指令
 /// </summary>
 /// <param name="Hwnd">窗口句柄</param>
 /// <param name="PXY">坐标</param>
 /// <returns></returns>
 public static bool ClickInHandle(HandleBase Hwnd, Point PXY, Point OffsetXY)
 {
     try
     {
         IntPtr XY = (IntPtr)(PXY.X + (PXY.Y << 16));
         PostMessage(Hwnd.Handle, Msg.WM_MOUSEMOVE, IntPtr.Zero, XY);
         Delay(20 + Random(20, 40));
         PostMessage(Hwnd.Handle, Msg.WM_LBUTTONDOWN, IntPtr.Zero, XY);
         Delay(50 + Random(5, 20));
         PostMessage(Hwnd.Handle, Msg.WM_LBUTTONUP, IntPtr.Zero, XY);
         Delay(20 + Random(20, 40));
         PostMessage(Hwnd.Handle, Msg.WM_MOUSEMOVE, IntPtr.Zero, (IntPtr)((1 + OffsetXY.X) + ((1 + OffsetXY.Y) << 16)));
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }
Exemple #8
0
        private void MainThreadWalkCallBack(IntPtr intPtr, IntPtr intPtr2)
        {
            if (intPtr == IntPtr.Zero)
            {
                return;
            }
            HandleBase handleBase = HandleBase.GetObjectFromHandel <HandleBase>(intPtr);

            try
            {
                if (!handleBase.IsInvalid && !handleBase.IsClosed && handleBase != _asyncHand1 && handleBase != _asyncHand2)
                {
                    handleBase.Dispose();
                }
            }
            catch (Exception source)
            {
                ExceptionDispatchInfo.Capture(source);
            }
        }
Exemple #9
0
        private void StartScene(Type t)
        {
            ge.Initialize();
            ge.InitializeScene(t);

            if (AttachTimeout)
            {
                ge.SetDebugComponents(new AbstractComponent[] { new TimeoutComponent(TimeoutTime), });
            }

            ge.Run();

            if (!Directory.Exists("./logs"))
            {
                Directory.CreateDirectory("./logs");
            }

            EngineStatisticsManager.WriteStatistics("./logs/" + t.Name + ".statistics.log");

            EngineStatisticsManager.DisposeAllHandles();
            HandleBase.DisposeAllHandles();
        }
Exemple #10
0
    public static string GetCookieInternal(string url, bool throwIfNoCookie)
    {
        uint num   = 0u;
        uint flags = 8192u;

        if (HandleBase.InternetGetCookieEx(url, null, null, ref num, flags, IntPtr.Zero))
        {
            num += 1u;
            StringBuilder stringBuilder = new StringBuilder((int)num);
            if (HandleBase.InternetGetCookieEx(url, null, stringBuilder, ref num, flags, IntPtr.Zero))
            {
                new WebPermission(NetworkAccess.Connect, url).Demand();
                return(stringBuilder.ToString());
            }
        }
        int lastWin32Error = Marshal.GetLastWin32Error();

        if (throwIfNoCookie || lastWin32Error != 259)
        {
            throw new Win32Exception(lastWin32Error);
        }
        return(null);
    }
Exemple #11
0
 public bool Equals(HandleBase p)
 {
     // Equals if p not null and handle is the same
     return ((object)p != null && rawPtr == p.rawPtr);
 }
Exemple #12
0
 /// <summary>
 /// 获取句柄窗口图像
 /// </summary>
 /// <returns>窗口图像</returns>
 public static Bitmap PrtGameWindow(HandleBase hwnd)
 {
     return(PrtGameWindow(hwnd.Handle));
 }