private void Init(string[] args) { m_NameHandleCallback = this.OnNameHandleChanged; m_MsgCallback = this.OnMessage; m_CmdCallback = this.OnCommand; m_MsgResultCallback = this.OnMessageResult; CenterClientApi.Init("store", args.Length, args, m_NameHandleCallback, m_MsgCallback, m_MsgResultCallback, m_CmdCallback); m_Channel = new PBChannel(DashFire.DataStore.MessageMapping.Query, DashFire.DataStore.MessageMapping.Query); m_Channel.DefaultServiceName = "Lobby"; LogSys.Init("./config/logconfig.xml"); DataStoreConfig.Init(); ArkCrossEngine.GlobalVariables.Instance.IsClient = false; FileReaderProxy.RegisterReadFileHandler((string filePath) => { byte[] buffer = null; try { buffer = File.ReadAllBytes(filePath); } catch (Exception e) { LogSys.Log(LOG_TYPE.ERROR, "Exception:{0}\n{1}", e.Message, e.StackTrace); return(null); } return(buffer); }, (string filepath) => { return(File.Exists(filepath)); }); LogSystem.OnOutput += (Log_Type type, string msg) => { switch (type) { case Log_Type.LT_Debug: LogSys.Log(LOG_TYPE.DEBUG, msg); break; case Log_Type.LT_Info: LogSys.Log(LOG_TYPE.INFO, msg); break; case Log_Type.LT_Warn: LogSys.Log(LOG_TYPE.WARN, msg); break; case Log_Type.LT_Error: case Log_Type.LT_Assert: LogSys.Log(LOG_TYPE.ERROR, msg); break; } }; DbThreadManager.Instance.Init(DataStoreConfig.LoadThreadNum, DataStoreConfig.SaveThreadNum); DataOpSystem.Instance.Init(m_Channel); DataCacheSystem.Instance.Init(); LogSys.Log(LOG_TYPE.INFO, "DataStore initialized"); }
private static void Main(string[] args) { XDocument dsCfgSample = DataStoreConfig.Sample(); string element = dsCfgSample.ToString(); DataStoreConfig dsCfg = DataStoreConfig.Deserialize(dsCfgSample); XDocument serialize = dsCfg.Serialize( ); return; }
public Form1() { this.InitializeComponent( ); // DataStoreConfig.Info += this.DataStoreConfig_Info; dsCfg = DataStoreConfig.Deserialize(dsCfgSample); this.InitializeGrid( ); // ToolTipController.DefaultController.GetActiveObjectInfo += this.DefaultController_GetActiveObjectInfo; }
public void SetConfig(DataStoreConfig dsCfg) { this.dsCfg = dsCfg; if (this.dsCfg != null) { this.gridControl1.DataSource = this.dsCfg.DataStoreList; this._colStagePathDir = this.gridView1.Columns[DataStore.StagePathDir_FldName]; this.gridView1.CustomColumnDisplayText += this.GridView1_CustomColumnDisplayText; //this.gridView1.CustomRowCellEdit += this.GridView1_CustomRowCellEdit; this.gridView1.InitNewRow += this.GridView1_InitNewRow; this.gridView1.CalcPreviewText += this.GridView1_CalcPreviewText; this.InitializeGrid( ); } }
protected void Application_Start() { AreaRegistration.RegisterAllAreas(); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); // LightInject initially configure var container = new ServiceContainer(); container.RegisterControllers(); ApplicationConfig.Bootstrap(container); container.EnableMvc(); //Initialize data store DataStoreConfig.Initialize(); }
//private string GetDefaultFilePath() //{ // // this routine appears to have the only purpose of find a file!? // string x = Path.Combine( this.DefaultPath, "SomeSubDir", this.DefaultFileName ); // return Path.GetDirectoryName( FilesHelper.FindingFileName( Application.StartupPath, x, true ) ); //} #endregion #region --- New File --- private void fileNewBarButtonItem_ItemClick(object sender, ItemClickEventArgs e) { if (this.SaveFileDialogHelper() != DialogResult.OK) { return; } if (this.SetWorkingFolderDialogHelper() != DialogResult.OK) { this.MsgCollXuc.Info("New file cancelled!"); return; } this.DefaultFileName = this.builtinDefaultFilename; this.dsCfg = new DataStoreConfig(this.DefaultPath); this.MsgCollXuc.Info("New file '{0}'!", Path.Combine(this.DefaultPath, this.DefaultFileName)); this.UpdateFileNameLabel(); this.UpdateFileStatusLabel(); return; }
public string[] GetQuerySqlList(DataQueryParamObject DataQueryParam, DataStoreConfig DataStoreItem) { string[] querySqlList = null; switch (DataStoreItem.SpliteTableType) { case SPLITE_TABLE_TYPE.SPLITE_DEFAULT: break; case SPLITE_TABLE_TYPE.SPLITE_MONTH: break; case SPLITE_TABLE_TYPE.SPLITE_YEAR: break; default: break; } return(querySqlList); }
private void fileOpenBarButtonItem_ItemClick(object sender, ItemClickEventArgs e) { switch (this.SaveFileDialogHelper()) { case DialogResult.OK: case DialogResult.Ignore: break; default: return; } if (sender != this && this.OpenFileDialogHelper() != DialogResult.OK) { return; } string fqn = Path.Combine(this.DefaultPath, this.DefaultFileName); this.dsCfg = DataStoreConfig.Load(fqn); if (this.dsCfg == null) { return; } this.DsCollXuc.SetConfig(this.dsCfg); { this.tabbedView1.Controller.Activate(this.dsCollDocument); this.dsCollDockPanel.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Visible; } // if (this.FileOpened) { this.UpdateOpenRecentList(fqn); } this.FileOpened = true; this.MsgCollXuc.Info("File '{0}' opened.", fqn); this.UpdateFileNameLabel(); this.UpdateFileStatusLabel(); }
private string[] AnalyzeMonthSpliteSql(DataQueryParamObject DataQueryParam, DataStoreConfig DataStoreItem) { string[] querySqlList = null; List <QueryCondition> queryConditionList = new List <QueryCondition>(); DateTime dtStart = Convert.ToDateTime(DataQueryParam.StartDate); DateTime dtEnd = Convert.ToDateTime(DataQueryParam.EndDate); int Months = (dtStart.Year - dtEnd.Year) * 12 + (dtStart.Month - dtEnd.Month) + 1; int StartMonth = dtStart.Month; int currYear = dtStart.Year; string QueryTableNamePrex = $"[datastore]-[{ DataStoreItem.DeviceCode}]-[{ DataStoreItem.DefaultTableName}]"; for (int i = 0; i < Months; i++) { QueryCondition tempQueryCondition = new QueryCondition(); string startDate; string endDate; int currMonth = StartMonth + i; if (currMonth > 12) { currYear++; currMonth = 1; } string QueryTableNameSuffix = $"-{currYear}-{currMonth}"; string tempQueryTableName = QueryTableNamePrex + QueryTableNameSuffix; tempQueryCondition.TableName = tempQueryTableName; if (i == 0) { startDate = $"{currYear}-{currMonth}-{dtStart.Day} {dtStart.Hour}:{dtStart.Minute}:{dtStart.Second}"; } else { startDate = $"{currYear}-{currMonth}-{dtStart.Day} 00:00:00"; } if (i == (Months - 1)) { endDate = $"{currYear}-{currMonth}-{dtEnd.Day} {dtEnd.Hour}:{dtEnd.Minute}:{dtEnd.Second}"; } else { DateTime d1 = new DateTime(currYear, currMonth, 1); DateTime d2 = d1.AddMonths(1).AddDays(-1); endDate = $"{currYear}-{currMonth}-{d2.Day} 23:59:59"; } tempQueryCondition.SelectCondition = $"between '{startDate} 'and '{endDate}'"; queryConditionList.Add(tempQueryCondition); } return(querySqlList); }
private string[] AnalyzeYearSpliteSql(DataQueryParamObject DataQueryParam, DataStoreConfig DataStoreItem) { string[] querySqlList = null; return(querySqlList); }
private static void LoadConfiguration() { // // [Configuration files] are used to control and manage the behavior of a [desktop and web application]. // // [Machine.config] : [machine level configuration file] // This is automatically installed when you install Visual Studio.Net. Only one [Machine.config] file exists on // a server. This file is at the highest level in the configuration hierarchy. // // [App.config] : [application level configuration file] // This is automatically created when you create a [Desktop application] project. This file inherits setting // from the [Machine.config] // // [Web.config] : [web application level configuration file] // This is automatically created when you create an [ASP.Net web application] project. This file inherits setting // from the [Machine.config] // // Difference between [(App|Web).config] and [Machine.config]: // // The settings made in the [(App|Web).config] file are applied to that particular desktop/web application only, // whereas the settings of [Machine.config] file are applied to the ALL Desktop or whole ASP.net application. // // [(App|Web).config] file are settings of desktop/asp.net application project level. [Machine.config] are settings // of server level. // // [(App|Web).config] will be for that particular desktop/web application whereas the [Machine.config] will for // the whole machine. // // Every Desktop/ASP.NET application that you has a [(App|Web).config] file . The settings specified in this will // imply only to that application. Whereas "Your System" will have a [Machine.config] file in folder: // [[ Microsoft.NET\Framework\v1.1.4322\CONFIG ]] // which contains specifications and settings at a system level. // // [Web.config] file is to override the settings from the [Machine.config] file. [Machine.config] file settings are // applied to all the web applications residing on the server while [Web.config] settings are application specific. // // [Machine.config] is configuration file for all the application in the IIS. but [Web.config] is a configuration // file for a application or folder. // // [Machine.config] for machine level configuration.but [Web.config] for a application/folder level configuration. // // Add reference to : System.Configuration and System.ComponentModel.DataAnnotations // { // #1 WAY (App.config + Machine.config) System.Configuration.ConnectionStringSettingsCollection css = System.Configuration.ConfigurationManager.ConnectionStrings; } { // #2 WAY (App.config + Machine.config) string str = System.Configuration.ConfigurationManager.AppSettings["UrlToPing"].ToString( ); } { // #3 WAY (App.config + Machine.config) DataPhilosophiaeSection dps = System.Configuration.ConfigurationManager.GetSection(nameof(DataPhilosophiaeSection)) as DataPhilosophiaeSection; } { // #4 WAY (Proprietary File) string configFilePath = @"D:\TEMP\CS\"; string configFileName = @"dsConfig.xml"; string configFileFullPathName = Path.Combine(configFilePath, configFileName);; { XDocument dsCfgSample = DataStoreConfig.Sample( ); dsCfgSample.Save(configFileFullPathName, SaveOptions.None); } XDocument xDoc = XDocument.Load(configFileFullPathName, LoadOptions.None); DataStoreConfig dsCfg = DataStoreConfig.Deserialize(xDoc); } { //RegistryKey key = Registry.LocalMachine.OpenSubKey( "Software", true ); //RegistryKey key = Registry.CurrentUser.OpenSubKey( "Software", true ); //key.CreateSubKey( "AppName" ); //key = key.OpenSubKey( "AppName", true ); //key.CreateSubKey( "AppVersion" ); //key = key.OpenSubKey( "AppVersion", true ); //key.SetValue( "yourkey", "yourvalue" ); } }