public GameMaster(IModHelper helper, StoryHelper storyHelper, IMonitor monitor) { this.dataHelper = helper.Data; this.StoryHelper = storyHelper; this.Monitor = monitor; this.Scenarios = new List <IScenario>(); }
public DataProcessor(IApiHelper apiHelper, IConfigurationHelper configurationHelper, IEmailHelper emailHelper, IDataHelper dataHelper) { _apiHelper = apiHelper; _configurationHelper = configurationHelper; _emailHelper = emailHelper; _dataHelper = dataHelper; }
/********* ** Public methods *********/ /// <summary>Construct an instance.</summary> /// <param name="dataHelper">An API for reading and storing local mod data.</param> /// <param name="multiplayer">Provides multiplayer utilities.</param> /// <param name="reflection">Simplifies access to private code.</param> /// <param name="enableShippingBin">Whether to support access to the shipping bin.</param> public ChestFactory(IDataHelper dataHelper, IMultiplayerHelper multiplayer, IReflectionHelper reflection, bool enableShippingBin) { this.DataHelper = dataHelper; this.Multiplayer = multiplayer; this.Reflection = reflection; this.EnableShippingBin = enableShippingBin; }
/// <summary> /// Deletes table rows the by where. /// </summary> public static int DeleteByWhere <T>(this IDataHelper dh, string whereCondition, params Params[] paramKeyAndValue) { var sql = dh.GetDeleteSqlByWhere <T>(whereCondition, paramKeyAndValue); var successRows = dh.ExecBatch(new[] { sql }, true, true); return(successRows); }
public Logic(ILogger logger, IDataHelper dataHelper, IDataTransmitter dataTransmitter, IDataReceiver dataReceiver) { this.logger = logger; this.dataHelper = dataHelper; this.dataTransmitter = dataTransmitter; this.dataReceiver = dataReceiver; }
/// <summary> /// Deletes table rows the by primary key. /// </summary> public static int DeleteByPrimaryKey <T>(this IDataHelper dh, string otherWhereCondition, params object[] allParmaryKeysSortByColumnName) { var sql = dh.GetDeleteSqlByPrimaryKey <T>(otherWhereCondition, allParmaryKeysSortByColumnName); var successRows = dh.ExecBatch(new[] { sql }, true, true); return(successRows); }
public static ValidationResult ValidateWritaPost(WritaPost p, IDataHelper d) { WritaPostValidator validator = new WritaPostValidator(d, p); ValidationResult results = validator.Validate(p); return(results); }
public MapViewGoogle(string mapfile) { dataHelper = new GoogleDataHelper("", "m1_"); dataHelper2 = new GoogleDataHelper2("", "m2_"); dataHelper3 = new GoogleDataHelper3("", "m3_"); dataHelper4 = new GoogleDataHelper4("", "m4_"); dataHelper.OnDownCompleted += new DownCompleteEventHandler(dataHelper_OnDownCompleted); dataHelper2.OnDownCompleted += new DownCompleteEventHandler(dataHelper_OnDownCompleted); dataHelper3.OnDownCompleted += new DownCompleteEventHandler(dataHelper_OnDownCompleted); dataHelper4.OnDownCompleted += new DownCompleteEventHandler(dataHelper_OnDownCompleted); mapHelper = new MapLib.GoogleMapHelper(); baseNames = new Dictionary<TileType, string>(); baseNames.Add(TileType.Map, "m1_"); baseNames.Add(TileType.Terrain, "m4_"); baseNames.Add(TileType.Photos, "m2_"); baseNames.Add(TileType.PhotosLabel, "m3_"); dataHelpers.Add(TileType.Map, dataHelper); dataHelpers.Add(TileType.Photos, dataHelper2); dataHelpers.Add(TileType.PhotosLabel, dataHelper3); dataHelpers.Add(TileType.Terrain, dataHelper4); try { //lgm 2012��9��20�ո� //double d1 = double.Parse(ConfigurationManager.AppSettings["offsizejd"]); //double d2 = double.Parse(ConfigurationManager.AppSettings["offsizewd"]); double d1 = MIS.PYJD; double d2 = MIS.PYWD; Offsize = new LongLat(d1, d2); } catch { } }
/// <summary> /// Updates the by by where. /// </summary> public static int UpdateByByWhere <T>(this IDataHelper dh, T model, bool isNullMeansIgnore, string whereCondition, params Params[] paramKeyAndValue) { var sql = dh.GetUpdateSqlByWhere <T>(model, isNullMeansIgnore, whereCondition, paramKeyAndValue); var successRows = dh.ExecBatch(new[] { sql }, true, true); return(successRows); }
/// <summary> /// Updates table by primary key. public static int UpdateByPrimaryKey <T>(this IDataHelper dh, T model, bool isNullMeansIgnore, string otherWhereCondition, params object[] allParmaryKeysSortByColumnName) { var sql = dh.GetUpdateSqlByPrimaryKey <T>(model, isNullMeansIgnore, otherWhereCondition, allParmaryKeysSortByColumnName); var successRows = dh.ExecBatch(new[] { sql }, true, true); return(successRows); }
private void drawImage(System.Drawing.Graphics g, MapTile tile, TileType tileType, ImageAttributes imageA) { ClassImage img = FindImage(baseNames[tileType] + tile.Name); string baseUrl = tile.Url; IDataHelper data = dataHelpers[tileType]; if (img == null) { img = data.GetImage(baseUrl, tile.Name); if (img == null) { img = new ClassImage(); } if (img.PicImage != null) { listImages.Add(img); } } img.IsDiscard = false; img.Left = tile.Left; img.Top = tile.Top; if (img.Left < -nPerWidth || img.Left > _width || img.Top > _height || img.Top < -nPerWidth) { return; } Rectangle rect = new Rectangle(img.Left, img.Top, nPerWidth, nPerWidth); if (img.PicImage != null && g != null) { g.DrawImage(img.PicImage, rect, 0, 0, nPerWidth, nPerWidth, GraphicsUnit.Pixel, imageA); } }
public MapViewObj() { dataHelper = new DataHelper(); //DataHelper.IsDownMap = true; //dataHelper.ImgPath = "mapData.yap"; dataHelper.ImgsvrUrl = "http://mappng.baidu.com/maplite/mapbank/baidu/"; }
public static DataMapper Build(string configFile, Assembly sqlSourceAssembly, string connKey) { DaoConfig daoConfig = DaoConfigProvider.Build(sqlSourceAssembly, configFile, connKey); IDataHelper helper = DataHelperFactory.Create(SqlConnectType.SqlServer, daoConfig.ConnectionString); return(new DataMapper(helper, daoConfig)); }
/********* ** Public methods *********/ /// <summary>Construct an instance.</summary> /// <param name="dataHelper">An API for reading and storing local mod data.</param> /// <param name="reflection">Simplifies access to private code.</param> /// <param name="translations">Provides translations stored in the mod's folder.</param> /// <param name="enableShippingBin">Whether to support access to the shipping bin.</param> public ChestFactory(IDataHelper dataHelper, IReflectionHelper reflection, ITranslationHelper translations, bool enableShippingBin) { this.DataHelper = dataHelper; this.Reflection = reflection; this.Translations = translations; this.EnableShippingBin = enableShippingBin; }
/********* ** Public methods *********/ /// <summary>Migrate legacy container data, if needed.</summary> /// <param name="chestFactory">Encapsulates logic for finding chests.</param> /// <param name="dataHelper">Handles reading and storing local mod data.</param> public static void MigrateLegacyData(ChestFactory chestFactory, IDataHelper dataHelper) { // Migrate container options stored in the chest name from ≤1.19.8 foreach (ManagedChest chest in chestFactory.GetChests(RangeHandler.Unlimited())) { // get underlying item Item item = Migrator.GetStorageItem(chest.Container); if (item == null) { continue; } // migrate legacy data if (Migrator.TryParseLegacyData(item, out string originalName, out ContainerData data)) { item.Name = originalName; data.ToModData(item.modData); } } // Migrate shipping bin options stored in the save file from ≤1.19.8 { ContainerData binData = dataHelper.ReadSaveData <ContainerData>("shipping-bin"); if (binData != null) { Farm farm = Game1.getFarm(); binData.ToModData(farm.modData, discriminator: ShippingBinContainer.ModDataDiscriminator); dataHelper.WriteSaveData <ContainerData>("shipping-bin", null); } } }
public WritaController(IDataHelper d, IBlogSettingsLoader b, ISettingsLoader i, IEmailSend e) { _dbhelper = d; _blogsettings = b; _globalsettings = i; _email = e; }
/// <summary> /// Updates by the specified model. /// </summary> public static int Update <T>(this IDataHelper dh, T model, bool isNullMeansIgnore = true, string otherWhereCondition = null) { var sql = dh.GetUpdateSql <T>(model, isNullMeansIgnore, otherWhereCondition); var successRows = dh.ExecBatch(new[] { sql }, true, true); return(successRows); }
/// <summary> /// Gets the list. /// </summary> public static List <T> GetList <T>(this IDataHelper dh) where T : new() { var tableName = AttributeHelper.GetTableName(typeof(T), true, dh.Driver.SafeName); var tsqlParamed = "SELECT * FROM " + tableName; return(GetList <T>(dh, tsqlParamed)); }
/// <summary> /// Gets the insert or replace SQL. The Save method is not suitable for tables that contain the primary key in the auto-increment column. /// </summary> public static List <SqlBatch> GetSaveSql <T>(this IDataHelper dh, params T[] models) { List <SqlBatch> sqls = new List <SqlBatch>(); if (models == null || models.Length == 0) { return(sqls); } var type = typeof(T); var tableName = AttributeHelper.GetTableName(type, true, dh.Driver.SafeName); var columnNameDic = AttributeHelper.GetProp2ColumnNameDics(dh.Driver.DirverType, type); var primaryKeys = AttributeHelper.GetPrimaryKeys(dh.Driver.DirverType, type, true); foreach (var md in models) { List <string> columnList = new List <string>(); List <Params> param = new List <Params>(); var modelValues = ReflectHelper.GetPropertyValues(type, md, false, true, true); foreach (var key in modelValues.Keys) { columnList.Add(columnNameDic[key]); param.Add(new Params(columnNameDic[key], modelValues[key])); } var sql = dh.Driver.GetSaveSql(tableName, primaryKeys, columnList, param.ToArray()); sqls.Add(sql); } return(sqls); }
public BaseDomainService(IPrincipal principal) { this._principal = principal; this._dataHelper = this.CreateDataHelper(); this._validationHelper = this.CreateValidationHelper(); this._queryHelper = this.CreateQueryHelper(); }
public WritaPostValidator(IDataHelper d, WritaPost current) { _d = d; RuleFor(w => w.PostTitle).NotEmpty().WithMessage("Please specify a post title"); RuleFor(w => w.PostSlug).NotEmpty().WithMessage("Please specify a post url"); RuleFor(w => w.PostId).NotEmpty(); }
public static RunTimeMetadata GetInitializedMetadata(BaseDomainService domainService, IDataHelper dataHelper, IValueConverter valueConverter) { RunTimeMetadata result = _metadataCache.GetOrAdd(domainService.GetType(), (svcType) => { RunTimeMetadata runTimeMetadata = null; try { DesignTimeMetadata designTimeMetadata = ((IMetaDataProvider)domainService).GetDesignTimeMetadata(false); IDataManagerContainer dataManagerContainer = domainService.ServiceContainer.DataManagerContainer; runTimeMetadata = _InitMetadata(domainService, designTimeMetadata, dataHelper, valueConverter, dataManagerContainer); } catch (Exception ex) { domainService._OnError(ex); throw new DummyException(ex.Message, ex); } return(runTimeMetadata); }); return(result); }
public TaskManager(ITaskEvents events, IDataHelper dataHelper) { _events = events; _dataHelper = dataHelper; _data = _dataHelper.ReadGlobalData <TaskData>(DeluxeJournalMod.TASKS_DATA_KEY) ?? new TaskData(); _tasks = new List <ITask>(); }
/// <summary> /// Inserts or Replace into tables by the specified models. The Save method is not suitable for tables that contain the primary key in the auto-increment column. /// </summary> public static int Save <T>(this IDataHelper dh, params T[] models) { var sqls = dh.GetSaveSql <T>(models); var successRows = dh.ExecBatch(sqls, true, true); return(successRows); }
/// <summary> /// Extracts from ParameterInfo all information about method parameter /// </summary> /// <returns>ParamMetadataInfo</returns> public static ParamMetadataInfo FromParamInfo(ParameterInfo pinfo, IDataHelper dataHelper) { Type ptype = pinfo.ParameterType; if (pinfo.IsOut) { throw new DomainServiceException("Out parameters are not supported in service methods"); } ParamMetadataInfo paramInfo = new ParamMetadataInfo(); paramInfo.isNullable = dataHelper.IsNullableType(ptype); paramInfo.name = pinfo.Name; paramInfo.ParameterType = ptype; Type realType = null; if (!paramInfo.isNullable) { realType = ptype; } else { realType = Nullable.GetUnderlyingType(ptype); } object[] dtops = pinfo.GetCustomAttributes(typeof(DateOptionAttribute), false); if (dtops.Length > 0) { paramInfo.dateConversion = (dtops[0] as DateOptionAttribute).dateConversion; } bool isArray = false; paramInfo.dataType = dataHelper.DataTypeFromType(realType, out isArray); paramInfo.isArray = isArray; return(paramInfo); }
public async Task Invoke(InvokeContext <TService> ctx) { IDataHelper <TService> dataHelper = ctx.ServiceContainer.GetDataHelper(); IServiceOperationsHelper <TService> serviceHelper = ctx.ServiceContainer.GetServiceHelper(); RunTimeMetadata metadata = ctx.Service.GetMetadata(); MethodDescription method = metadata.GetInvokeMethod(ctx.Request.methodName); List <object> methParams = new List <object>(); for (int i = 0; i < method.parameters.Count; ++i) { methParams.Add(ctx.Request.paramInfo.GetValue(method.parameters[i].name, method, dataHelper)); } RequestContext req = InvokeContext <TService> .CreateRequestContext(ctx.Service); using (RequestCallContext callContext = new RequestCallContext(req)) { MethodInfoData methodData = method.GetMethodData(); object instance = serviceHelper.GetMethodOwner(methodData); object invokeRes = methodData.MethodInfo.Invoke(instance, methParams.ToArray()); object methodResult = await serviceHelper.GetMethodResult(invokeRes); if (method.methodResult) { ctx.Response.result = methodResult; } } await _next(ctx); }
StringBuilder SetModelInfo(IDataHelper helper, IDictionary <String, Object> sys) { if (sys == null) { return(null); } var sb = new StringBuilder("cmn.setModelInfo(root, {\n"); foreach (var k in sys) { var val = k.Value; if (val is Boolean) { val = val.ToString().ToLowerInvariant(); } else if (val is String) { val = $"'{val}'"; } else if (val is Object) { val = JsonConvert.SerializeObject(val); } else if (val is DateTime) { val = helper.DateTime2StringWrap(val); } sb.Append($"'{k.Key}': {val},"); } sb.RemoveTailComma(); sb.Append("}, rawData);"); return(sb); }
public void Deserialize(IDataHelper helper) { IDictionary <SaveItem, int> saveData = helper.ReadSaveData <IDictionary <SaveItem, int> >(SingleHatStorageProvider.SaveKey) ?? new Dictionary <SaveItem, int>(); this.hatsByCharacter.Clear(); foreach (KeyValuePair <SaveItem, int> kvp in saveData) { GameLocation location = Game1.getLocationFromName(kvp.Key.Location); List <Character> candidateCharacters = new List <Character>(); if (location != null) { if (kvp.Key.Type == typeof(FarmAnimal).FullName && location is AnimalHouse house) { candidateCharacters.AddRange(house.Animals.Values.Where(animal => animal.Name == kvp.Key.Name)); } else { candidateCharacters.AddRange(location.characters.Where(character => character.Name == kvp.Key.Name)); } } this.PlaceHatOn(candidateCharacters, kvp.Key, kvp.Value); } }
/// <summary> /// Gets the Inserts into tables if selectSqlCondition(such as 'select 1 from student where name=@name') has no record SQL. /// </summary> public static SqlBatch GetInsertIfNotExistPrimeryKeySql <T>(this IDataHelper dh, T model, params object[] allParmaryKeysSortByColumnName) { var type = typeof(T); var tableName = AttributeHelper.GetTableName(type, true, dh.Driver.SafeName); var columnNameDic = AttributeHelper.GetProp2ColumnNameDics(dh.Driver.DirverType, type); var primaryKeyProps = AttributeHelper.GetPrimaryKeys(dh.Driver.DirverType, type, false); if (primaryKeyProps.Count <= 0) { throw new NoConfigurePrimaryKeyExceptionException("Not config any primary key in model."); } primaryKeyProps.Sort((s1, s2) => string.Compare(s1, s2)); List <string> wherePropList = new List <string>(); List <Params> paramList = new List <Params>(); List <object> primaryValues = new List <object>(); if (allParmaryKeysSortByColumnName != null && allParmaryKeysSortByColumnName.Length > 0) { primaryValues.AddRange(allParmaryKeysSortByColumnName); } for (int i = 0; i < Math.Min(primaryKeyProps.Count, primaryValues.Count); i++) { var key = primaryKeyProps[i]; var columnName = columnNameDic[key]; wherePropList.Add(string.Format("{0}=@SysWhere{1}", dh.Driver.SafeName(columnName), columnName)); paramList.Add(new Params("SysWhere" + columnName, primaryValues[i])); } var whereSql = "SELECT 1 FROM " + tableName + " WHERE " + string.Join(" AND ", wherePropList); return(GetInsertIfNotExistSql(dh, model, whereSql, paramList.ToArray())); }
/// <summary> /// Gets the delete SQL by primary key. /// </summary> public static SqlBatch GetDeleteSqlByPrimaryKey <T>(this IDataHelper dh, string otherWhereCondition, params object[] allParmaryKeysSortByColumnName) { var type = typeof(T); var columnNameDic = AttributeHelper.GetProp2ColumnNameDics(dh.Driver.DirverType, type); var primaryKeyProps = AttributeHelper.GetPrimaryKeys(dh.Driver.DirverType, type, false); if (primaryKeyProps.Count <= 0) { throw new NoConfigurePrimaryKeyExceptionException("Not config any primary key in model."); } primaryKeyProps.Sort((s1, s2) => string.Compare(s1, s2)); List <string> wherePropList = new List <string>(); List <Params> paramList = new List <Params>(); List <object> primaryValues = new List <object>(); if (allParmaryKeysSortByColumnName != null && allParmaryKeysSortByColumnName.Length > 0) { primaryValues.AddRange(allParmaryKeysSortByColumnName); } for (int i = 0; i < Math.Min(primaryKeyProps.Count, primaryValues.Count); i++) { var key = primaryKeyProps[i]; var columnName = columnNameDic[key]; wherePropList.Add(string.Format("{0}=@SysWhere{1}", dh.Driver.SafeName(columnName), columnName)); paramList.Add(new Params("SysWhere" + columnName, primaryValues[i])); } if (!string.IsNullOrWhiteSpace(otherWhereCondition)) { wherePropList.Add(otherWhereCondition); } var whereSql = string.Join(" AND ", wherePropList); var sql = GetDeleteSqlByWhere <T>(dh, whereSql, paramList.ToArray()); return(sql); }
/// <summary> /// Gets the insert SQL. /// </summary> public static List <SqlBatch> GetInsertSql <T>(this IDataHelper dh, params T[] models) { List <SqlBatch> sqls = new List <SqlBatch>(); if (models == null || models.Length == 0) { return(sqls); } var type = typeof(T); var tableName = AttributeHelper.GetTableName(type, true, dh.Driver.SafeName); var columnNameDic = AttributeHelper.GetProp2ColumnNameDics(dh.Driver.DirverType, type); foreach (var md in models) { List <string> columnList = new List <string>(); List <Params> param = new List <Params>(); var modelValues = ReflectHelper.GetPropertyValues(type, md, false, true, true); foreach (var key in modelValues.Keys) { columnList.Add(columnNameDic[key]); param.Add(new Params(columnNameDic[key], modelValues[key])); } var columnString = string.Join(",", columnList.ConvertToAll(p => dh.Driver.SafeName(p))); var columnParamString = string.Join(",", columnList.ConvertToAll(p => "@" + p)); var sql = string.Format("INSERT INTO {0}({1}) VALUES({2})", tableName, columnString, columnParamString); sqls.Add(new SqlBatch(sql, param.ToArray())); } return(sqls); }
public MapViewGoogle(string mapfile) { dataHelper = new GoogleDataHelper("", "m1_"); dataHelper2 = new GoogleDataHelper2("", "m2_"); dataHelper3 = new GoogleDataHelper3("", "m3_"); dataHelper4 = new GoogleDataHelper4("", "m4_"); dataHelper.OnDownCompleted += new DownCompleteEventHandler(dataHelper_OnDownCompleted); dataHelper2.OnDownCompleted += new DownCompleteEventHandler(dataHelper_OnDownCompleted); dataHelper3.OnDownCompleted += new DownCompleteEventHandler(dataHelper_OnDownCompleted); dataHelper4.OnDownCompleted += new DownCompleteEventHandler(dataHelper_OnDownCompleted); mapHelper = new MapLib.GoogleMapHelper(); baseNames = new Dictionary <TileType, string>(); baseNames.Add(TileType.Map, "m1_"); baseNames.Add(TileType.Terrain, "m4_"); baseNames.Add(TileType.Photos, "m2_"); baseNames.Add(TileType.PhotosLabel, "m3_"); dataHelpers.Add(TileType.Map, dataHelper); dataHelpers.Add(TileType.Photos, dataHelper2); dataHelpers.Add(TileType.PhotosLabel, dataHelper3); dataHelpers.Add(TileType.Terrain, dataHelper4); try { //lgm 2012年9月20日改 //double d1 = double.Parse(ConfigurationManager.AppSettings["offsizejd"]); //double d2 = double.Parse(ConfigurationManager.AppSettings["offsizewd"]); double d1 = MIS.PYJD; double d2 = MIS.PYWD; Offsize = new LongLat(d1, d2); } catch { } }
public RowGenerator(DbSetInfo dbSetInfo, IEnumerable<object> dataSource, IDataHelper dataHelper) { this._dbSetInfo = dbSetInfo; this._dataSource = dataSource; this._dataHelper = dataHelper; this.fieldInfos = this._dbSetInfo.GetInResultFields(); this.fieldCnt = this.fieldInfos.Length; this.pkInfos = this._dbSetInfo.GetPKFields(); }
public static object[] GetPKValues(this RowInfo rowInfo, IDataHelper dataHelper) { Type entityType = rowInfo.dbSetInfo.EntityType; Field[] finfos = rowInfo.dbSetInfo.GetPKFields(); object[] result = new object[finfos.Length]; for (int i = 0; i < finfos.Length; ++i) { ValueChange fv = rowInfo.values.Single(v => v.fieldName == finfos[i].fieldName); result[i] = dataHelper.DeserializeField(entityType, finfos[i], fv.val); } return result; }
public SubResultsGenerator(BaseDomainService domainService) { this._domainService = domainService; this._dataHelper = this._domainService.ServiceContainer.DataHelper; }
public EditController(IDataHelper dataHelper) { _dataHelper = dataHelper; }
public ArticleController(IDataHelper dataHelper) { _dataHelper = dataHelper; }
public HomeController(IDataHelper dataHelper) { _dataHelper = dataHelper; }
public DataHelperForm(IDataHelper dataHelper, IGREETController controller) : this() { _dataHelper = dataHelper; _controller = controller; }
public LoginController(IDataHelper dataHelper) { _dataHelper = dataHelper; }
public EditController() { var storageAccount = CloudStorageAccount.Parse( CloudConfigurationManager.GetSetting("StorageConnectionString")); _dataHelper = new AzureDataHelper(storageAccount); }
public MapViewObj(string database) { dataHelper = new DataHelper(database); dataHelper.ImgsvrUrl = "http://mappng.baidu.com/maplite/mapbank/baidu/"; }
public static void SetDataHelper(IDataHelper helper) { DataHelper = helper; }
public SearchController(IDataHelper dataHelper, ISearchHelper searchHelper ) { _dataHelper = dataHelper; _searchHelper = searchHelper; }