public DataService ToDataService(string flowId, string modifiedById, DateTime modifiedOn) { ExecutableInfo executableInfo = null; if (!string.IsNullOrEmpty(PluginImplementerString)) { executableInfo = new ExecutableInfo(PluginImplementerString); } DataService dataService = new DataService(Name, flowId, IsActive, EnumUtils.ParseEnum <ServiceType>(ServiceType), executableInfo, EnumUtils.ParseEnum <DataServicePublishFlags>(PublishFlags)); dataService.ModifiedById = modifiedById; dataService.ModifiedOn = modifiedOn; Dictionary <string, DataProviderInfo> dataSources = null; CollectionUtils.ForEach(DataSources, delegate(KeyedDataSourceSetting dataSource) { DataProviderInfo dataProviderInfo = dataSource.ToDataProviderInfo(modifiedById, modifiedOn); CollectionUtils.Add(dataSource.Key, dataProviderInfo, ref dataSources); }); dataService.DataSources = (dataSources == null) ? null : dataSources; Dictionary <string, string> args = null; CollectionUtils.ForEach(Args, delegate(KeyValueSetting setting) { CollectionUtils.Add(setting.Key, setting.Value, ref args); }); dataService.Args = (args == null) ? null : args; return(dataService); }
public TMXTileGroup(XMLElement element) { name = element.GetAttribute("name", null); width = element.GetIntAttribute("width", 0); height = element.GetIntAttribute("height", 0); objects = new List <TMXTile>(); XMLElement propsElement = element.GetChildrenByName("properties"); if (propsElement != null) { List <XMLElement> properties = propsElement.List("property"); if (properties != null) { props = new TMXProperty(); for (int p = 0; p < properties.Count; p++) { XMLElement propElement = properties[p]; string name_0 = propElement.GetAttribute("name", null); string value_ren = propElement.GetAttribute("value", null); props.SetProperty(name_0, value_ren); } } } List <XMLElement> objectNodes = element.List("object"); for (int i = 0; i < objectNodes.Count; i++) { XMLElement objElement = objectNodes[i]; TMXTile obj0 = new TMXTile(objElement); obj0.index = i; CollectionUtils.Add(objects, obj0); } }
public void Set(float sx, float sy) { CollectionUtils.Add(localPoints, new float[] { sx, sy }); cx = sx; cy = sy; pointsDirty = true; }
public IList <string> GetProtectedFlowNamesForUser(string username) { List <string> flowNames = null; UserAccount account = _accountDao.GetByName(username); if (account == null) { return(null); } if (account.Role == SystemRoleType.Admin) { return(GetAllProtectedDataFlowNames()); } else { DoSimpleQueryWithRowCallbackDelegate( string.Format("{0} a;{1} ap", Windsor.Node2008.WNOS.Data.AccountDao.TABLE_NAME, Windsor.Node2008.WNOS.Data.AccountDao.POLICY_TABLE_NAME), "a.NAASAccount;ap.Type;a.Id=ap.AccountId", new object[] { username, ServiceRequestAuthorizationType.Flow.ToString() }, "ap.Qualifier", "ap.Qualifier", delegate(IDataReader reader) { CollectionUtils.Add(reader.GetString(0), ref flowNames); }); } return(flowNames); }
public IList <Column> TryGetColumns(Type elementType, string elementMemberName) { List <Column> columns = TryGetColumnsSelf(elementType, elementMemberName); if (IsVirtualTable && (CollectionUtils.Count(DataColumns) == 1)) { // If this is a virtual table (i.e., representing a string[], for example), we need to check // if this table represents columns/fields that are really part of the parent table CollectionUtils.ForEach(ForeignKeys, delegate(ForeignKeyColumn fkColumn) { if ((fkColumn.ForeignTable != null) && (fkColumn.ForeignTable.TableRootType == elementType)) { ChildRelationInfo ftChildRelationInfo = null; CollectionUtils.ForEachBreak(fkColumn.ForeignTable.ChildRelationMembers, delegate(ChildRelationInfo childRelationInfo) { if (childRelationInfo.ChildTable == this) { ftChildRelationInfo = childRelationInfo; return(false); } return(true); }); if ((ftChildRelationInfo != null) && (ftChildRelationInfo.MemberInfo != null) && (ftChildRelationInfo.MemberInfo.DeclaringType == elementType) && (ftChildRelationInfo.MemberInfo.Name == elementMemberName)) { CollectionUtils.Add(DataColumns[0], ref columns); } } }); } return(columns); }
public void GetAssetFromOtherSource() { var assets = Many(100, i => CreateAsset(i)); var sources = Many(10, i => CreateSource(assets.Skip(i * 10).Take(10))); const int testAssetId = 101; TestAsset testAsset = null; var delegateSource = new DelegateSource <Asset>(context => { testAsset = new TestAsset(testAssetId, Array.Empty <IComponent>()) { Reference = context.Get(90) }; return(new[] { testAsset }); }); CollectionUtils.Add(ref sources, delegateSource); StartEnumeration(sources); var actual = (TestAsset)_context .Invoking(context => context.Get(testAssetId)) .Should().NotThrow() .Which; actual.Should().Be(testAsset); }
public ServiceSetting(DataService dataService, string flowName) { Name = dataService.Name; FlowName = flowName; IsActive = dataService.IsActive; ServiceType = dataService.Type.ToString(); PublishFlags = dataService.PublishFlags.ToString(); if (dataService.PluginInfo != null) { PluginImplementerString = dataService.PluginInfo.ImplementerString; } List <KeyedDataSourceSetting> dataSources = null; CollectionUtils.ForEach(dataService.DataSources, delegate(KeyValuePair <string, DataProviderInfo> pair) { CollectionUtils.Add(new KeyedDataSourceSetting(pair.Key, pair.Value), ref dataSources); }); DataSources = (dataSources == null) ? null : dataSources.ToArray(); List <KeyValueSetting> args = null; CollectionUtils.ForEach(dataService.Args, delegate(KeyValuePair <string, string> pair) { CollectionUtils.Add(new KeyValueSetting(pair.Key, pair.Value), ref args); }); Args = (args == null) ? null : args.ToArray(); }
public void SetSchedules(IEnumerable <ScheduledItem> schedules, IDictionary <string, string> flowIdToNameMap, IDictionary <string, string> serviceIdToNameMap, IDictionary <string, string> partnerIdToNameMap, out string errorMessage) { List <ScheduleSetting> list = null; StringBuilder errors = new StringBuilder(); CollectionUtils.ForEach(schedules, delegate(ScheduledItem scheduledItem) { string itemErrorMessage; ScheduleSetting scheduleSetting = new ScheduleSetting(scheduledItem, flowIdToNameMap, serviceIdToNameMap, partnerIdToNameMap, out itemErrorMessage); if (itemErrorMessage == null) { CollectionUtils.Add(scheduleSetting, ref list); } else { errors.AppendFormat("The schedule \"{0}\" could not be exported: {1}", scheduledItem.Name, itemErrorMessage); errors.AppendLine(); } }); Schedules = (list == null) ? null : list.ToArray(); errorMessage = (errors.Length == 0) ? null : errors.ToString(); }
public List <XMLElement> Find(string n) { List <XMLElement> v = new List <XMLElement>(); for (IIterator e = Elements(); e.HasNext();) { object o = e.Next(); if ((!(o is XMLElement))) { continue; } XMLElement ele = (XMLElement)o; if (!ele.Equals(ele.GetName())) { IIterator it = ele.Elements(n); for (; it.HasNext();) { XMLElement child = (XMLElement)it.Next(); child.parent = ele; CollectionUtils.Add(v, child); } continue; } else if (ele.Equals(ele.GetName())) { CollectionUtils.Add(v, (XMLElement)o); continue; } } return(v); }
public void Commits() { bool changes = false; int additionCount = pendingAdd.Count; if (additionCount > 0) { Gravity[] additionsArray = pendingAdd.ToArray(); for (int i = 0; i < additionCount; i++) { Gravity obj0 = additionsArray[i]; CollectionUtils.Add(objects, obj0); } CollectionUtils.Clear(pendingAdd); changes = true; } int removalCount = pendingRemove.Count; if (removalCount > 0) { object[] removalsArray = CollectionUtils.ToArray(pendingRemove); for (int i_0 = 0; i_0 < removalCount; i_0++) { Gravity object_1 = (Gravity)removalsArray[i_0]; CollectionUtils.Remove(objects, object_1); } CollectionUtils.Clear(pendingRemove); changes = true; } if (changes) { lazyObjects = objects.ToArray(); } }
private bool CheckOtherType(DType otherType, TexlNode otherArg, DType expectedType, IErrorContainer errors, ref Dictionary <TexlNode, DType> nodeToCoercedTypeMap) { Contracts.Assert(otherType.IsValid); Contracts.AssertValue(otherArg); Contracts.Assert(expectedType == DType.Color || expectedType == DType.Number); Contracts.AssertValue(errors); if (otherType.IsTable) { // Ensure we have a one-column table of numerics/color values based on expected type. return(expectedType == DType.Number ? CheckNumericColumnType(otherType, otherArg, errors, ref nodeToCoercedTypeMap) : CheckColorColumnType(otherType, otherArg, errors, ref nodeToCoercedTypeMap)); } if (expectedType.Accepts(otherType)) { return(true); } if (otherType.CoercesTo(expectedType)) { CollectionUtils.Add(ref nodeToCoercedTypeMap, otherArg, expectedType); return(true); } errors.EnsureError(DocumentErrorSeverity.Severe, otherArg, TexlStrings.ErrTypeError_Ex1_Ex2_Found, TableKindString, expectedType.GetKindString(), otherType.GetKindString()); return(false); }
public List <Vector2f> Neighbors(Vector2f pos, bool flag) { if (result == null) { result = new List <Vector2f>(8); } else { CollectionUtils.Clear(result); } int x = pos.X(); int y = pos.Y(); CollectionUtils.Add(result, new Vector2f(x, y - 1)); CollectionUtils.Add(result, new Vector2f(x + 1, y)); CollectionUtils.Add(result, new Vector2f(x, y + 1)); CollectionUtils.Add(result, new Vector2f(x - 1, y)); if (flag) { CollectionUtils.Add(result, new Vector2f(x - 1, y - 1)); CollectionUtils.Add(result, new Vector2f(x + 1, y - 1)); CollectionUtils.Add(result, new Vector2f(x + 1, y + 1)); CollectionUtils.Add(result, new Vector2f(x - 1, y + 1)); } return(result); }
public int PutAnimationTile(int id, Animation animation, Attribute attribute) { if (active) { TileMap.Tile tile = new TileMap.Tile(); tile.id = id; tile.imgId = -1; tile.attribute = attribute; if (animation != null && animation.GetTotalFrames() > 0) { tile.isAnimation = true; tile.animation = animation; playAnimation = true; } CollectionUtils.Add(animations, animation); CollectionUtils.Add(arrays, tile); dirty = true; return(tile.imgId); } else { throw new Exception( "Map is no longer active, you can not add new tiles !"); } }
public int[][] GetArray2D(string name, int[][] fallback) { string v = null; lock (pConfigItems) { v = (string)CollectionUtils.Get(pConfigItems, name); } if (v != null) { bool pFlag = false; char[] chars = v.ToCharArray(); int size = chars.Length; StringBuilder sbr = new StringBuilder(128); List <int[]> records = new List <int[]>( CollectionUtils.INITIAL_CAPACITY); for (int i = 0; i < size; i++) { char pValue = chars[i]; switch ((int)pValue) { case '{': pFlag = true; break; case '}': pFlag = false; string row = sbr.ToString(); string[] strings = StringUtils.Split(row, ","); int length = strings.Length; int[] arrays = new int[length]; for (int j = 0; j < length; j++) { arrays[j] = Int32.Parse(strings[j]); } CollectionUtils.Add(records, arrays); sbr.Remove(0, sbr.Length - (0)); break; case ' ': break; default: if (pFlag) { sbr.Append(pValue); } break; } } int col = records.Count; int[][] result = new int[col][]; for (int i_0 = 0; i_0 < col; i_0++) { result[i_0] = records[i_0]; } return(result); } return(fallback); }
internal void Update(GameTime gameTime) { if (isClear) { return; } if (collectionsToUpdate.Count > 0) { CollectionUtils.Clear(collectionsToUpdate); } foreach (IGameComponent drawable in collections) { CollectionUtils.Add(collectionsToUpdate, drawable); } IGameComponent _drawable; int screenIndex; for (; collectionsToUpdate.Count > 0;) { screenIndex = collectionsToUpdate.Count - 1; _drawable = collectionsToUpdate[screenIndex]; CollectionUtils.RemoveAt(collectionsToUpdate, screenIndex); if (_drawable is IUpdateable) { IUpdateable comp = (IUpdateable)_drawable; comp.Update(gameTime); } } }
private void CallMethod(int index, params float[] f) { float[] result; for (float pd = this.pointDistance, t = pd; t <= 1; t += pd) { t = MathUtils.Round(t * 1f / pd) / (1f / pd); switch (index) { case BEZIER: result = Bezier(t, f[0], f[1], f[2], f[3], f[4], f[5], f[6], f[7]); break; case ARC: result = Arc(t, f[0], f[1], f[2], f[3], f[4]); break; case LINE: result = Line(t, f[0], f[1], f[2], f[3]); break; default: result = new float[] { 0f, 0f }; break; } CollectionUtils.Add(points, new CycleProgress(result[0], result[1], t)); } }
public override void Draw(GLEx g) { if (IsOnLoadComplete()) { batch.Begin(); gameCollection.Draw(batch, gameTime); if (drawablesToDraw.Count > 0) { CollectionUtils.Clear(drawablesToDraw); } foreach (Drawable drawable in drawables) { CollectionUtils.Add(drawablesToDraw, drawable); } foreach (Drawable drawable in drawablesToDraw) { if (drawable._enabled) { if (drawable.GetDrawableState() == Painting.DrawableState.Hidden) { continue; } drawable.Draw(batch, gameTime); } } Draw(batch); batch.End(); } }
public virtual void AfterLoadFromDatabase() { List <object> items = null; List <ItemsChoiceType> itemsElementName = null; if (DMRNoDischargeIndicator != null) { CollectionUtils.Add(DMRNoDischargeIndicator, ref items); CollectionUtils.Add(ItemsChoiceType.DMRNoDischargeIndicator, ref itemsElementName); } if (DMRNoDischargeReceivedDateSpecified) { CollectionUtils.Add(DMRNoDischargeReceivedDate, ref items); CollectionUtils.Add(ItemsChoiceType.DMRNoDischargeReceivedDate, ref itemsElementName); } CollectionUtils.ForEach(ReportParameter, delegate(ReportParameter reportParameter) { CollectionUtils.Add(reportParameter, ref items); CollectionUtils.Add(ItemsChoiceType.ReportParameter, ref itemsElementName); }); if (items != null) { Items = items.ToArray(); ItemsElementName = itemsElementName.ToArray(); } }
public static void PrepareAsset(Asset asset) { if (asset != null) { CollectionUtils.Add(_assetList, asset); } }
public StatusBar AddBar(int value_ren, int maxValue, int x, int y, int w, int h) { lock (barCaches) { StatusBar bar = new StatusBar(value_ren, maxValue, x, y, w, h); CollectionUtils.Add(barCaches, bar); return(bar); } }
/// <summary> /// Add the specified key to the Bundle. /// </summary> /// <note> /// A call to this method must be externally synchronized /// for this Bundle object. /// </note> /// <param name="key"> /// The key to add to this Bundle. /// </param> /// <returns> /// True if this Bundle was empty prior to this call. /// </returns> public bool Add(Object key) { ICollection setKeys = m_setKeys; bool isFirst = setKeys.Count == 0; CollectionUtils.Add(setKeys, key); return(isFirst); }
public void AddPath(int type, params float[] f) { object[] o = new object[2]; o[0] = type; o[1] = f; CollectionUtils.Add(data, o); isUpdate = true; }
public void AddFrameStruct(string fs, float time) { LNFrameStruct item = Node.LNDataCache.GetFrameStruct(fs); CollectionUtils.Add(this._fsList, item); CollectionUtils.Add(this._timeList, time); this._totalDuration += time; }
public void AddToEnd(int value) { var array = new int[0]; CollectionUtils.Add(ref array, value); array.Should().Contain(value); array.Length.Should().Be(1); }
public bool GetErrors(ref List <TexlError> rgerr) { if (CollectionUtils.Size(_errors) == 0) { return(false); } CollectionUtils.Add(ref rgerr, _errors); return(true); }
public void SetGlobalArguments(IEnumerable <ConfigItem> configItems) { List <GlobalArgumentSetting> list = null; CollectionUtils.ForEach(configItems, delegate(ConfigItem configItem) { CollectionUtils.Add(new GlobalArgumentSetting(configItem), ref list); }); GlobalArguments = (list == null) ? null : list.ToArray(); }
public void RemoveAll() { int count = objects.Count; for (int i = 0; i < count; i++) { CollectionUtils.Add(pendingRemove, objects[i]); } CollectionUtils.Clear(pendingAdd); }
public void SetDataSources(IEnumerable <DataProviderInfo> dataSources) { List <DataSourceSetting> list = null; CollectionUtils.ForEach(dataSources, delegate(DataProviderInfo dataSource) { CollectionUtils.Add(new DataSourceSetting(dataSource), ref list); }); DataSources = (list == null) ? null : list.ToArray(); }
public void SetNetworkPartners(IEnumerable <PartnerIdentity> partners) { List <NetworkPartnerSetting> list = null; CollectionUtils.ForEach(partners, delegate(PartnerIdentity partnerIdentity) { CollectionUtils.Add(new NetworkPartnerSetting(partnerIdentity), ref list); }); NetworkPartners = (list == null) ? null : list.ToArray(); }
public void SetExchanges(IEnumerable <DataFlow> flows) { List <ExchangeSetting> list = null; CollectionUtils.ForEach(flows, delegate(DataFlow dataFlow) { CollectionUtils.Add(new ExchangeSetting(dataFlow), ref list); }); Exchanges = (list == null) ? null : list.ToArray(); }