Пример #1
0
        public void blur_Gauss(
            fx_Quad quad,
            int blur_amount, float blur_angle,
            Texture texture_to_blur, FrameBuffer texture_frame_buffer, DrawBuffersEnum attachement,
            float destination_scale = 1)
        {
            Vector2 angle_mod = EngineHelper.createRotationVector(blur_angle);

            blur_Gauss(
                quad,
                blur_amount,
                angle_mod, angle_mod,
                texture_to_blur, texture_frame_buffer, attachement,
                destination_scale);
        }
 void InternetUserControl_Load(object sender, EventArgs e)
 {
     _myControllersTitle  = MyControllersTabPage.Text;
     _globalSettingsTitle = SummariesTabPage.Text;
     EngineHelper.EnableDoubleBuffering(MySettingsDataGridView);
     EngineHelper.EnableDoubleBuffering(SummariesDataGridView);
     EngineHelper.EnableDoubleBuffering(PresetsDataGridView);
     MySettingsDataGridView.AutoGenerateColumns = false;
     SummariesDataGridView.AutoGenerateColumns  = false;
     _Summaries.ListChanged           += new ListChangedEventHandler(_Summaries_ListChanged);
     _Settings.ListChanged            += new ListChangedEventHandler(_Settings_ListChanged);
     MySettingsDataGridView.DataSource = _Settings;
     SummariesDataGridView.DataSource  = _Summaries;
     InternetCheckBox_CheckedChanged(null, null);
 }
Пример #3
0
        void SummariesDataGridView_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
        {
            if (e.RowIndex < 0 || e.ColumnIndex < 0)
            {
                return;
            }
            var grid   = (DataGridView)sender;
            var item   = (Summary)grid.Rows[e.RowIndex].DataBoundItem;
            var column = grid.Columns[e.ColumnIndex];

            if (column == SummariesSidColumn)
            {
                e.Value = EngineHelper.GetID(item.PadSettingChecksum);
            }
        }
Пример #4
0
 public MainViewModel()
 {
     if (!App.IsValidGamePath(Properties.Settings.Default.GamePath))
     {
         return;
     }
     Realm        = new ARealmReversed(Properties.Settings.Default.GamePath, SaintCoinach.Ex.Language.English);
     EngineHelper = new EngineHelper();
     Equipment    = new EquipmentViewModel(this);
     Furniture    = new FurnitureViewModel(this);
     Monsters     = new MonstersViewModel(this);
     Maps         = new MapsViewModel(this);
     Demihuman    = new DemihumanViewModel(this);
     Data         = new DataViewModel(Realm);
 }
Пример #5
0
        void Bind(List <x360ce.Engine.Data.Program> programs)
        {
            var selection = JocysCom.ClassLibrary.Controls.ControlsHelper.GetSelection <string>(GlobalSettingsDataGridView, "FileName");

            SettingsFile.Current.Programs.Clear();
            foreach (var item in programs)
            {
                item.FileProductName = EngineHelper.FixName(item.FileProductName, item.FileName);
                SettingsFile.Current.Programs.Add(item);
            }
            var header = string.Format("{0: yyyy-MM-dd HH:mm:ss}: '{1}' program(s) loaded.", DateTime.Now, programs.Count());

            MainForm.Current.UpdateHelpHeader(header, MessageBoxIcon.Information);
            JocysCom.ClassLibrary.Controls.ControlsHelper.RestoreSelection <string>(GlobalSettingsDataGridView, "FileName", selection);
        }
Пример #6
0
        //------------------------------------------------------
        // Gaussian Blur Functions
        //------------------------------------------------------

        public void blur_Gauss(
            fx_Quad quad,
            int blur_amount, float blur_angle,
            Texture texture_to_blur,
            float destination_scale = 1)
        {
            Vector2 angle_mod = EngineHelper.createRotationVector(blur_angle);

            blur_Gauss(
                quad,
                blur_amount,
                angle_mod, angle_mod,
                texture_to_blur, _fSpecial, DrawBuffersEnum.ColorAttachment1,
                destination_scale);
        }
Пример #7
0
        public AccountConfig(BetTabControl betTabControl, BcWin bcWin)
        {
            InitializeComponent();
            ID = Guid.NewGuid();

            _betTabControl = betTabControl;
            _bcWin         = bcWin;

            CoreProcessor.InitConfig();

            cboIBetDomain.DataSource = EngineHelper.GetIbetServers();
            cboSboDomain.DataSource  = EngineHelper.GetSboServers();

            cboCompareValue.SelectedIndex = 0;
        }
Пример #8
0
        public override void Fix()
        {
            if (FixType > 0)
            {
                var appArchitecture = Assembly.GetExecutingAssembly().GetName().ProcessorArchitecture;
                var resourceName    = EngineHelper.GetXInputResoureceName(appArchitecture);
                var file            = EngineHelper.GetDefaultDll();
                var fileName        = file == null
                                        ? Attributes.GetDescription(XInputMask.XInput13_x86)
                                        : file.Name;

                AppHelper.WriteFile(resourceName, fileName);
            }
            RaiseFixApplied();
        }
Пример #9
0
        public Tournament(int rounds, int secondsPerMove, string crossTableFile, string gameDataFile, EngineHelper engines, List <string> players, bool allowSelfPlay)
        {
            _rounds         = rounds;
            _secondsPerMove = secondsPerMove;
            _crossTableFile = crossTableFile;
            _gameDataFile   = gameDataFile;
            _engines        = engines;
            _players        = players;
            _allowSelfPlay  = allowSelfPlay;

            worker = new BackgroundWorker();
            worker.WorkerReportsProgress = true;
            worker.DoWork             += Worker_DoWork;
            worker.RunWorkerCompleted += Worker_RunWorkerCompleted;
            worker.ProgressChanged    += Worker_ProgressChanged;
        }
Пример #10
0
 private static string getLogFilePath()
 {
     if (_current_log_file == "")
     {
         string logs_path = Path.GetFullPath(EngineHelper.getPath_ProjectBase() + "Debug/Logs");
         _current_log_file = logs_path + "/engine_log-" + DateTime.Now.ToString("yyyy-MM-dd") + ".log";
         using (StreamWriter w = File.AppendText(getLogFilePath()))
         {
             w.WriteLine(Environment.NewLine +
                         "==================================================================================" + Environment.NewLine +
                         DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss") + Environment.NewLine +
                         "==================================================================================" + Environment.NewLine);
         }
     }
     return(_current_log_file);
 }
Пример #11
0
        /// <summary>
        /// 保存数据字典
        /// </summary>
        /// <param name="source"></param>
        private void SaveDictionarys(List <DictionaryModel> source)
        {
            if (VerifyHelper.IsEmpty(source))
            {
                return;
            }

            ShowStatusText("正在保存数据字典信..", isConsoleWrite: false);

            var datas = EngineHelper.Map <List <DictionaryEntity> >(source);

            var genres = datas.GroupBy(x => x.Genre).Select(x => x.Key).ToArray();

            dictionaryService.DeleteByGenres(genres);
            dictionaryService.BatchInsert(datas);
        }
Пример #12
0
        private async Task TraverseBreadth()
        {
            EngineHelper.CheckStackTrace();
            while (queue.Count > 0)
            {
                totalcounter++;
                Console.WriteLine($"TotalCounter={totalcounter}");
                Console.WriteLine($"QueueCount={queue.Count}");
                Console.WriteLine($"ElapsedMilliseconds={_sw.Elapsed}");
                queue.TryDequeue(out var href);
                Console.WriteLine(href);
                Log.Information(href);
                await _throttler.WaitAsync();

                allTasks.Add(
                    Task.Run(async() =>
                {
                    try
                    {
                        string traverseWebContent;
                        using (var client = new HttpClient())
                        {
                            client.DefaultRequestHeaders.Add("user-agent", _userAgent);
                            HttpResponseMessage response = await client.GetAsync(EngineHelper.EnsureCompleteUrl(_siteBaseUrl, href));
                            traverseWebContent           = await response.Content.ReadAsStringAsync();
                            var document = new HtmlDocument();
                            document.LoadHtml(traverseWebContent);
                            if (_htmlLinkHandler.IsItemPage(href))
                            {
                                await _scrapper.Process(new HtmlResponse(document, href));
                            }
                        }
                        AddLink(href);
                        AddUrlsToQueue(traverseWebContent);
                    }
                    catch (Exception ex)
                    {
                        Log.Error(ex.ToString());
                    }
                    finally
                    {
                        _throttler.Release();
                    }
                }));
            }
        }
Пример #13
0
        public JsonResult Text(string source, string mediaId)
        {
            string speechText = "";
            string appId      = EngineHelper.Configuration.Settings.GetValue("WeiXinAppId");
            string appSecret  = EngineHelper.Configuration.Settings.GetValue("WeiXinSecret");

            var            accessToken    = AccessTokenContainer.TryGetAccessToken(appId, appSecret);
            var            downFileUrl    = string.Format("http://file.api.weixin.qq.com/cgi-bin/media/get?access_token={0}&media_id={1}", accessToken, mediaId);
            HttpWebRequest httpWebRequest = (HttpWebRequest)WebRequest.Create(downFileUrl);

            httpWebRequest.Method = "GET";
            HttpWebResponse httpWebResponse;

            try
            {
                httpWebResponse = (HttpWebResponse)httpWebRequest.GetResponse();
                using (Stream responseStream = httpWebResponse.GetResponseStream())
                {
                    byte[] bytes = GetMemoryStream(responseStream).ToArray();
                    responseStream.Close();
                    var model = PlugCoreHelper.Speech(source, Convert.ToBase64String(bytes));
                    if (model != null)
                    {
                        if (model.Code == 0 && !string.IsNullOrEmpty(model.Obj))
                        {
                            speechText = model.Obj;
                        }
                        else
                        {
                            EngineHelper.LoggingError($"语音识别Error:OpenApi{model.Message ?? "未知错误"}");
                        }
                    }
                    else
                    {
                        EngineHelper.LoggingError($"语音识别Error:OpenApi返回对象Null");
                    }
                }
            }
            catch (Exception ex)
            {
                EngineHelper.LoggingError($"语音识别Error:{ExceptionHelper.GetMessage(ex)}");
            }

            return(new JsonResult(speechText));
        }
        public void rotate(float x_angle, float y_angle, float z_angle, float smooth_factor)
        {
            _spatial.rotation_angles = new Vector3(x_angle, y_angle, z_angle);

            Quaternion current_rotation = EngineHelper.createQuaternion(x_angle, y_angle, z_angle);

            current_rotation = Quaternion.Slerp(_previous_rotation, current_rotation, smooth_factor);

            _spatial.rotation_matrix = Matrix4.CreateFromQuaternion(current_rotation);
            _spatial.rotation_matrix = Matrix4.Transpose(_spatial.rotation_matrix);


            _spatial.look   = (_spatial.rotation_matrix).Column2.Xyz;
            _spatial.up     = (_spatial.rotation_matrix).Column1.Xyz;
            _spatial.strafe = (_spatial.rotation_matrix).Column0.Xyz;

            _previous_rotation = current_rotation;
        }
Пример #15
0
        public static Program FromDisk(string fileName)
        {
            var item = new Program();
            var fi   = new FileInfo(fileName);
            var vi   = System.Diagnostics.FileVersionInfo.GetVersionInfo(fi.FullName);

            item.Comment         = vi.Comments;
            item.DateCreated     = DateTime.Now;
            item.DateUpdated     = item.DateCreated;
            item.FileName        = fi.Name;
            item.FileProductName = EngineHelper.FixName(vi.ProductName, item.FileName);
            item.HookMask        = 0;
            item.InstanceCount   = 0;
            item.IsEnabled       = true;
            item.ProgramId       = Guid.NewGuid();
            item.XInputMask      = 0;
            return(item);
        }