protected static void GuerillaPreProcessMethod(BinaryReader binaryReader, IList<tag_field> fields) { var index = (from field in fields where field.Name == "Object Data" select fields.IndexOf(field)).Single(); fields.Insert(++index, new tag_field() { type = field_type._field_pad, Name = "indexer", definition = 4 }); }
private static void CheckActionList(IList<IBfsAction> actions, IBfsDataBlock block) { if (actions == null) return; for( int index = 0; index < actions.Count; index++) { IBfsAction action = actions[index]; if (action is BfsActionUnresolvedAssignment) { BfsActionUnresolvedAssignment unresolved = action as BfsActionUnresolvedAssignment; BfsActionAssignment assignment = new BfsActionAssignment(); assignment.Expression = unresolved.Expression; assignment.SourceRange = unresolved.SourceRange; if (block.LocalFields.ContainsKey(unresolved.UnresolvedVariableName)) assignment.LocalVariable = block.LocalFields[unresolved.UnresolvedVariableName]; else BfsCompiler.ReportError(assignment.SourceRange, "Could not find local variable: '"+unresolved.UnresolvedVariableName+"'"); actions.Insert(index, assignment); actions.Remove(action); } } }
public void Update(ICacheService cacheService, Account selectedAccount, WorkPeriod currentWorkPeriod) { var accountType = cacheService.GetAccountTypeById(selectedAccount.AccountTypeId); var transactions = Dao.Query(GetCurrentRange(accountType.DefaultFilterType, x => x.AccountId == selectedAccount.Id, currentWorkPeriod)).OrderBy(x => x.Date); Transactions = transactions.Select(x => new AccountDetailData(x, selectedAccount)).ToList(); if (accountType.DefaultFilterType > 0) { var pastDebit = Dao.Sum(x => x.Debit, GetPastRange(accountType.DefaultFilterType, x => x.AccountId == selectedAccount.Id, currentWorkPeriod)); var pastCredit = Dao.Sum(x => x.Credit, GetPastRange(accountType.DefaultFilterType, x => x.AccountId == selectedAccount.Id, currentWorkPeriod)); var pastExchange = Dao.Sum(x => x.Exchange, GetPastRange(accountType.DefaultFilterType, x => x.AccountId == selectedAccount.Id, currentWorkPeriod)); if (pastCredit > 0 || pastDebit > 0) { Summaries.Add(new AccountSummaryData(Resources.Total, Transactions.Sum(x => x.Debit), Transactions.Sum(x => x.Credit))); var detailValue = new AccountDetailData( new AccountTransactionValue { Name = Resources.PastTransactions, Credit = pastCredit, Debit = pastDebit, Exchange = pastExchange }, selectedAccount) { IsBold = true }; Transactions.Insert(0, detailValue); } } Summaries.Add(new AccountSummaryData(Resources.GrandTotal, Transactions.Sum(x => x.Debit), Transactions.Sum(x => x.Credit))); for (var i = 0; i < Transactions.Count; i++) { Transactions[i].Balance = (Transactions[i].Debit - Transactions[i].Credit); if (i > 0) (Transactions[i].Balance) += (Transactions[i - 1].Balance); } }
public static void RotateRight(IList sequence, int count) { //This method makes a swap of the list elements to the right object tmp = sequence[count - 1]; sequence.RemoveAt(count - 1); sequence.Insert(0, tmp); }
public void Update(Account selectedAccount, DateTime? start, DateTime? end) { Start = start; End = end; var transactions = Dao.Query(GetCurrentRange(start, end, x => x.AccountId == selectedAccount.Id)).OrderBy(x => x.Date); Transactions = transactions.Select(x => new AccountDetailData(x, selectedAccount)).ToList(); if (start.HasValue) { var pastDebit = Dao.Sum(x => x.Debit, GetPastRange(start, x => x.AccountId == selectedAccount.Id)); var pastCredit = Dao.Sum(x => x.Credit, GetPastRange(start, x => x.AccountId == selectedAccount.Id)); var pastExchange = Dao.Sum(x => x.Exchange, GetPastRange(start, x => x.AccountId == selectedAccount.Id)); if (pastCredit > 0 || pastDebit > 0) { Summaries.Add(new AccountSummaryData(Resources.TransactionTotal, Transactions.Sum(x => x.Debit), Transactions.Sum(x => x.Credit))); var detailValue = new AccountDetailData( new AccountTransactionValue { Date = start.GetValueOrDefault(), Name = Resources.BalanceBroughtForward, Credit = pastCredit, Debit = pastDebit, Exchange = pastExchange }, selectedAccount) { IsBold = true }; Transactions.Insert(0, detailValue); } } if (end.HasValue && end != start) { var futureDebit = Dao.Sum(x => x.Debit, GetFutureRange(end, x => x.AccountId == selectedAccount.Id)); var futureCredit = Dao.Sum(x => x.Credit, GetFutureRange(end, x => x.AccountId == selectedAccount.Id)); var futureExchange = Dao.Sum(x => x.Exchange, GetFutureRange(end, x => x.AccountId == selectedAccount.Id)); if (futureCredit > 0 || futureDebit > 0) { Summaries.Add(new AccountSummaryData(Resources.DateRangeTotal, Transactions.Sum(x => x.Debit), Transactions.Sum(x => x.Credit))); var detailValue = new AccountDetailData( new AccountTransactionValue { Date = end.GetValueOrDefault(), Name = Resources.BalanceAfterDate, Credit = futureCredit, Debit = futureDebit, Exchange = futureExchange }, selectedAccount) { IsBold = true }; Transactions.Add(detailValue); } } Summaries.Add(new AccountSummaryData(Resources.GrandTotal, Transactions.Sum(x => x.Debit), Transactions.Sum(x => x.Credit))); for (var i = 0; i < Transactions.Count; i++) { Transactions[i].Balance = (Transactions[i].Debit - Transactions[i].Credit); if (i > 0) (Transactions[i].Balance) += (Transactions[i - 1].Balance); } }
// Arg(ControllerName),Param(..),.. -> Arg(ControllerName),Arg('Index'),... public static IList<Token> Rewrite(IList<Token> tokens) { //"--command" if (tokens.Count() >= 2 && tokens[0].TokenType==TokenType.Argument && tokens[0].Value.EqualsIC("help") && tokens[1].TokenType==TokenType.Argument) { tokens[1] = new Token(tokens[1].Value,TokenType.ParameterValue,tokens[1].Index); tokens.Insert(1,new Token("command",TokenType.Parameter,1)); //index:2 if (tokens.Count() >= 4) { tokens[3] = new Token(tokens[3].Value, TokenType.ParameterValue, tokens[1].Index); } tokens.Insert(3, new Token("action", TokenType.Parameter, 2)); } //help maps to index (should have routing here) if (tokens.Count() == 0) { tokens.Add(new Token("help",TokenType.Argument,0)); } //Index rewrite: var indexToken= new Token("Index", TokenType.Argument,1); if (tokens.Count()>=2 && tokens[1].TokenType!=TokenType.Argument && tokens[0].TokenType==TokenType.Argument) { tokens.Insert(1,indexToken); } else if (tokens.Count()==1 && tokens[0].TokenType==TokenType.Argument) { tokens.Add(indexToken); } return tokens; }
protected static void GuerillaPreProcessMethod(BinaryReader binaryReader, IList<tag_field> fields) { fields.Insert(0, new tag_field() { type = field_type._field_long_integer, Name = "Block Length" }); fields.Insert(1, new tag_field() { type = field_type._field_long_integer, Name = "SBSP virtual start address" }); fields.Insert(2, new tag_field() { type = field_type._field_long_integer, Name = "LTMP virtual start address" }); fields.Insert(3, new tag_field() { type = field_type._field_tag, Name = "SBSP class" }); }
private void ModifyListForTest(IList<string> list) { list[0] = "OneModified"; list.Insert(0, "Zero"); list.RemoveAt(0); list.Insert(0, "ZeroAgain"); list.Insert(4, "Four"); list.RemoveAt(4); list.Insert(4, "FourAgain"); }
public IList <Position> GetPath(Position source, Position destination, bool[,] visited) { if (source == destination) { return(new List <Position> { source }); } IList <Position> minPath = null; foreach (var neighbor in field.GetNeighbors(source)) { if (!field.IsVisited(neighbor, visited) && field.GetBallColorAt(neighbor.Row, neighbor.Column) == BallColor.Empty) { visited[neighbor.Row, neighbor.Column] = true; var path = GetPath(neighbor, destination, visited); if (path != null && (minPath == null || minPath.Count > path.Count)) { minPath = path; } } } minPath?.Insert(0, source); return(minPath); }
private void ReplayChanges(IndividualCollectionChange change, IList ilist) { CefCoreSessionSingleton.Session.Dispatcher.Run(() => { switch (change.CollectionChangeType) { case CollectionChangeType.Add: if (change.Index == ilist.Count) { ilist.Add(change.Object.CValue); Items.Add(change.Object); } else { ilist.Insert(change.Index, change.Object.CValue); Items.Insert(change.Index, change.Object); } break; case CollectionChangeType.Remove: ilist.RemoveAt(change.Index); Items.RemoveAt(change.Index); break; } }); }
public Expression Parse(IList<Token> tokens) { if (tokens.Count > 1 && tokens[0].Type == Symbol.Subtract) { if (tokens[1].Type == Symbol.Number) { tokens.RemoveAt(0); double num = double.Parse(tokens[0].Value); num *= -1; tokens[0].Value = num.ToString(); } else { tokens[0].Type = Symbol.Number; tokens[0].Value = "-1"; tokens.Insert(1, new Token(Symbol.Multiply)); } } int index = 0; return sums(tokens, ref index); }
public ClassMethodHandler(MethodInfo method) { this.method = method; parameters = method.GetParameters ().Select (x => new ProcedureParameter (x)).ToList (); parameters.Insert (0, new ProcedureParameter (typeof(ulong), "this")); parametersArray = Parameters.ToArray (); }
/// <summary> /// Adds an empty Dropdown Option at the start of the list /// If the list is null then null will be returned and nothing happens /// </summary> /// <param name="list"> /// List of dropdown options /// </param> /// <returns >The list of dropdown options with the prepended empty option</returns> public static IList <SelectListItem> AddEmpty(this IList <SelectListItem> list) { list?.Insert(0, new SelectListItem { Value = string.Empty, Text = Resources.Labels.ChooseListItem }); return(list); }
public virtual void AddAtIndexPropulsionTypeCost(int index, PropulsionTypeCost __item) { if (__item == null) { return; } propulsionTypeCost?.Insert(index, __item); }
public virtual void AddAtIndexAppNotificationActions(int index, AppNotificationAction __item) { if (__item == null) { return; } appNotificationActions?.Insert(index, __item); }
public virtual void AddAtIndexItemParameters(int index, ItemParameter __item) { if (__item == null) { return; } itemParameters?.Insert(index, __item); }
public virtual void AddAtIndexVolumeComposition(int index, VolumeComposition __item) { if (__item == null) { return; } volumeComposition?.Insert(index, __item); }
public virtual void AddAtIndexActivities(int index, Activity __item) { if (__item == null) { return; } activities?.Insert(index, __item); }
public IndexViewModel(IList<State> states) { var state = new State(); state.Id = 0; state.Name = ""; states.Insert(0, state); States = new SelectList(states, "Id", "Name"); }
public virtual void AddAtIndexRoutes(int index, Route __item) { if (__item == null) { return; } routes?.Insert(index, __item); }
public virtual void AddAtIndexLegs(int index, LegVolumeDetails __item) { if (__item == null) { return; } legs?.Insert(index, __item); }
public virtual void AddAtIndexProducts(int index, OrderProduct __item) { if (__item == null) { return; } products?.Insert(index, __item); }
public virtual void AddAtIndexOrders(int index, ShippingOrder __item) { if (__item == null) { return; } orders?.Insert(index, __item); }
public virtual void AddAtIndexAgreementStatuses(int index, AgreementStatus __item) { if (__item == null) { return; } agreementStatuses?.Insert(index, __item); }
public virtual void AddAtIndexAcceptedConditions(int index, Condition __item) { if (__item == null) { return; } acceptedConditions?.Insert(index, __item); }
public virtual void AddAtIndexAreaSupport(int index, GeoArea __item) { if (__item == null) { return; } areaSupport?.Insert(index, __item); }
public virtual void AddAtIndexComments(int index, Comment __item) { if (__item == null) { return; } comments?.Insert(index, __item); }
public virtual void AddAtIndexPath(int index, Point __item) { if (__item == null) { return; } path?.Insert(index, __item); }
public virtual void AddAtIndexShipmentStatus(int index, ShipmentStatus __item) { if (__item == null) { return; } shipmentStatus?.Insert(index, __item); }
public virtual void AddAtIndexTransactions(int index, Transaction __item) { if (__item == null) { return; } transactions?.Insert(index, __item); }
public virtual void AddAtIndexStatistics(int index, Statistics __item) { if (__item == null) { return; } statistics?.Insert(index, __item); }
public virtual void AddAtIndexOrderForecastStatistics(int index, OrderForecastStatistic __item) { if (__item == null) { return; } orderForecastStatistics?.Insert(index, __item); }
public virtual void AddAtIndexAnnualTransactionVolumes(int index, AnnualTransactionVolume __item) { if (__item == null) { return; } annualTransactionVolumes?.Insert(index, __item); }
public virtual void AddAtIndexTransportUnCaps(int index, TransportUnCap __item) { if (__item == null) { return; } transportUnCaps?.Insert(index, __item); }
public virtual void AddAtIndexActualVolume(int index, CustomVolume __item) { if (__item == null) { return; } actualVolume?.Insert(index, __item); }
public virtual void AddAtIndexStatusEvolution(int index, StatusEvolution __item) { if (__item == null) { return; } statusEvolution?.Insert(index, __item); }
public virtual void AddAtIndexTurnoverStatistics(int index, TurnoverStatistic __item) { if (__item == null) { return; } turnoverStatistics?.Insert(index, __item); }
public static void AddItemsStaff(IList<tStaff> list, Type type, string valueMember, string displayMember, string displayText) { var obj = Activator.CreateInstance(type); var displayProperty = type.GetProperty(displayMember); displayProperty.SetValue(obj, displayText, null); var valueProperty = type.GetProperty(valueMember); valueProperty.SetValue(obj, -1, null); list.Insert(0, obj as tStaff); }
// private private void Visit (Node node, IList list) { node.marked = true; foreach (Node adj in node.edges) { if (!adj.marked) Visit (adj, list); } list.Insert (0, node.value); }
//public static SqlParameterCollection Sqlparams; public static void AddItem(IList list, Type type, string valueMember,string displayMember, string displayText) { Object obj = Activator.CreateInstance(type); PropertyInfo displayProperty = type.GetProperty(displayMember); displayProperty.SetValue(obj, displayText, null); PropertyInfo valueProperty = type.GetProperty(valueMember); valueProperty.SetValue(obj, -1, null); list.Insert(0, obj); }
public static void Insert(IList list, int index, IIndexable item) { item.Index = index; for (int i = index; i < list.Count - 1; i++) { list[i].As<IIndexable>().Index++; } list.Insert(index, item); }
public static void ReorderableList(IList list, System.Action<int> GUICallback, UnityObject unityObject = null) { if (list.Count == 1){ GUICallback(0); return; } if (!pickedObjectList.ContainsKey(list)) pickedObjectList[list] = null; var e = Event.current; var lastRect = new Rect(); var picked = pickedObjectList[list]; GUILayout.BeginVertical(); for (var i= 0; i < list.Count; i++){ GUILayout.BeginVertical(); GUICallback(i); GUILayout.EndVertical(); GUI.color = Color.white; GUI.backgroundColor = Color.white; lastRect = GUILayoutUtility.GetLastRect(); EditorGUIUtility.AddCursorRect(lastRect, MouseCursor.MoveArrow); if (picked != null && picked == list[i]) GUI.Box(lastRect, ""); if (picked != null && lastRect.Contains(e.mousePosition) && picked != list[i]){ var markRect = new Rect(lastRect.x,lastRect.y-2,lastRect.width, 2); if (list.IndexOf(picked) < i) markRect.y = lastRect.yMax - 2; GUI.Box(markRect, ""); if (e.type == EventType.MouseUp){ if (unityObject != null) Undo.RecordObject(unityObject, "Reorder"); list.Remove(picked); list.Insert(i, picked); pickedObjectList[list] = null; if (unityObject != null) EditorUtility.SetDirty(unityObject); } } if (lastRect.Contains(e.mousePosition) && e.type == EventType.MouseDown) pickedObjectList[list] = list[i]; } GUILayout.EndVertical(); if (e.type == EventType.MouseUp) pickedObjectList[list] = null; }
/*--------------------------------------------------------------------------------------------*/ public static void SplitTrackSegments(ReadOnlyCollection<TrackSegment> pSegments, ReadOnlyCollection<TrackSegment> pCuts, IList<TrackSegment> pSliceResults) { pSliceResults.Clear(); for ( int segI = 0 ; segI < pSegments.Count ; segI++ ) { TrackSegment seg = pSegments[segI]; pSliceResults.Add(seg); } for ( int cutI = 0 ; cutI < pCuts.Count ; cutI++ ) { TrackSegment cut = pCuts[cutI]; for ( int sliceI = 0 ; sliceI < pSliceResults.Count ; sliceI++ ) { TrackSegment slice = pSliceResults[sliceI]; if ( cut.StartValue >= slice.StartValue && cut.EndValue <= slice.EndValue ) { var slice2 = new TrackSegment(); slice2.StartValue = cut.EndValue; slice2.EndValue = slice.EndValue; slice2.IsFill = slice.IsFill; pSliceResults.Insert(sliceI+1, slice2); slice.EndValue = cut.StartValue; pSliceResults[sliceI] = slice; continue; } if ( cut.StartValue >= slice.StartValue && cut.StartValue <= slice.EndValue ) { slice.EndValue = cut.StartValue; pSliceResults[sliceI] = slice; continue; } if ( cut.EndValue <= slice.EndValue && cut.EndValue >= slice.StartValue ) { slice.StartValue = cut.EndValue; pSliceResults[sliceI] = slice; continue; } if ( cut.StartValue <= slice.StartValue && cut.EndValue >= slice.EndValue ) { pSliceResults.RemoveAt(sliceI); sliceI--; } } } for ( int sliceI = 0 ; sliceI < pSliceResults.Count ; sliceI++ ) { TrackSegment slice = pSliceResults[sliceI]; if ( Math.Abs(slice.StartValue-slice.EndValue) <= 0.01f ) { pSliceResults.RemoveAt(sliceI); sliceI--; } } }
public JobLogger(IEnumerable<ILogger> loggers) { logOutput = new List<bool> (Constants.Output.Count); logOutput.Insert((int)LogOutputType.Console, GetBooleanValue (Constants.Output.Console)); logOutput.Insert((int)LogOutputType.Database, GetBooleanValue (Constants.Output.Database)); logOutput.Insert((int)LogOutputType.File, GetBooleanValue (Constants.Output.File)); if (logOutput.All (outputFlag => !outputFlag)) { throw new NotSupportedLogTypeException (); } logLevel = new List<bool> (Constants.Level.Count); logLevel.Insert((int)LogMessageLevel.Message, GetBooleanValue (Constants.Level.Message)); logLevel.Insert((int)LogMessageLevel.Warning, GetBooleanValue (Constants.Level.Warning)); logLevel.Insert((int)LogMessageLevel.Error, GetBooleanValue (Constants.Level.Error)); if (logLevel.All (levelFlag => !levelFlag)) { throw new NotSupportedLogLevelException (); } this.Loggers = loggers.ToArray(); }
public void SetCompanyList(IList<Company> companies) { CompanyList = companies.OrderBy(x => x.Name) .Select(x => new SelectListItem { Value = x.Id.ToString(), Text = x.Name }) .ToList(); CompanyList.Insert(0, new SelectListItem { Value = "0", Text = "<None Selected>" }); }
public void AddStartStopSymbols(IList<string> tokens) { if (extractor.MaxNGramSize <= 1) return; for (int i = 0; i < extractor.MaxNGramSize - 1; i++) { string index = (i).ToString(); tokens.Insert(0, Start.Insert(2, index)); } tokens.Add(Stop); }
/// <summary> /// Appends a single part, including (useless) optimizations /// </summary> /// <param name="parts"></param> /// <param name="index"></param> /// <param name="part"></param> public static void InsertPart(IList<SqlPart> parts, int index, SqlPart part) { // optimization if top part is a literal, and the one we're adding is a literal too // in this case, we combine both // (this is useless, just pretty) if (part is SqlLiteralPart && index > 0 && parts[index - 1] is SqlLiteralPart) { parts[index - 1] = new SqlLiteralPart(parts[index - 1].Sql + part.Sql); } else parts.Insert(index, part); }
internal static string TryGetMemberName(this IExpressionNode target, bool allowIndexer, bool allowDynamicMember, IList <IExpressionNode> nodes = null, List <string> members = null) { if (target == null) { return(null); } if (members == null) { members = new List <string>(); } while (target != null) { nodes?.Insert(0, target); var expressionNode = target as IMemberExpressionNode; if (expressionNode == null) { if (target is ResourceExpressionNode) { if (!allowDynamicMember || members.Count == 0) { return(null); } break; } if (!allowIndexer) { return(null); } var indexExpressionNode = target as IIndexExpressionNode; if (indexExpressionNode == null || indexExpressionNode.Arguments.Any(arg => arg.NodeType != ExpressionNodeType.Constant)) { return(null); } IEnumerable <string> args = indexExpressionNode .Arguments .Cast <IConstantExpressionNode>() .Select(node => node.Value.ToStringValue()); members.Insert(0, "[" + string.Join(",", args).Trim() + "]"); target = indexExpressionNode.Object; } else { string memberName = expressionNode.Member.Trim(); members.Insert(0, memberName); target = expressionNode.Target; } } return(MergePath(members)); }
/// <inheritdoc/> public override void Split(int splitVisualColumn, IList<VisualLineElement> elements, int elementIndex) { if (splitVisualColumn <= VisualColumn || splitVisualColumn >= VisualColumn + VisualLength) throw new ArgumentOutOfRangeException("splitVisualColumn", splitVisualColumn, "Value must be between " + (VisualColumn + 1) + " and " + (VisualColumn + VisualLength - 1)); if (elements == null) throw new ArgumentNullException("elements"); if (elements[elementIndex] != this) throw new ArgumentException("Invalid elementIndex - couldn't find this element at the index"); int relativeSplitPos = splitVisualColumn - VisualColumn; VisualLineText splitPart = CreateInstance(DocumentLength - relativeSplitPos); SplitHelper(this, splitPart, splitVisualColumn, relativeSplitPos + RelativeTextOffset); elements.Insert(elementIndex + 1, splitPart); }
public static DefaultResponse BuildFailedResponseWithMessages(this APIException exception, IList<string> modelErrors) { if (!string.IsNullOrWhiteSpace(exception.Message)) { modelErrors.Insert(0, exception.Message); } return new DefaultResponse { Success = false, Message = string.Join(" ", modelErrors) }; }
/// <summary> /// Add true objects for the Specified fields /// </summary> /// <param name="args">List of parameters for a methodcall</param> /// <param name="m">Methodinfo</param> public static void addTrueForSpecified(IList<object> args, MethodInfo m) { ParameterInfo[] paraminfo = m.GetParameters(); if (paraminfo.Length <= args.Count && paraminfo.Length < 2 && args.Count <= 0) return; int i = 0; while (i + 1 < paraminfo.Length) { String paramName = paraminfo[i].Name + "Specified"; if ((paraminfo[i + 1].ParameterType.Equals(typeof(System.Boolean))) && paramName.Equals(paraminfo[i + 1].Name)) args.Insert(i + 1, true); i = i + 2; } }
public void FilterErrorList(IList<ICssError> errors, ICssCheckerContext context) { for (int i = errors.Count - 1; i > -1; i--) { ICssError error = errors[i]; Declaration dec = error.Item.FindType<Declaration>(); if (dec != null && dec.IsValid && dec.PropertyName.Text == "-ms-filter") { errors.RemoveAt(i); errors.Insert(i, CreateNewError(error)); } } }
/// <summary> /// 初始化dbcode的集合,依赖于数据库的shardingNum /// </summary> private void setDbCodeCollection() { dbCodeCollection = new List<string>(shardingNum); int codeLength = Integer.toBinaryString(shardingNum - 1).length(); for (int i = 0; i < shardingNum; i++) { string dbcode = Integer.toBinaryString(i); for (int j = dbcode.Length; j < codeLength; j++) { dbcode = "0" + dbcode; } dbCodeCollection.Insert(i, dbcode); } }
/// <summary> /// Reads the contents of the "loca" table from the supplied stream /// at the current position. /// </summary> /// <param name="reader"></param> protected internal override void Read(FontFileReader reader) { FontFileStream stream = reader.Stream; // Glyph offsets can be stored in either short of long format bool isShortFormat = reader.GetHeaderTable().IsShortFormat; // Number of glyphs including extra entry int glyphCount = reader.GetMaximumProfileTable().GlyphCount + 1; offsets = new ArrayList(glyphCount); for (int i = 0; i < glyphCount; i++) { offsets.Insert(i, (isShortFormat) ? (uint) (stream.ReadUShort() << 1) : stream.ReadULong()); } }
public void FilterErrorList(IList<ICssError> errors, ICssCheckerContext context) { for (int i = errors.Count - 1; i > -1; i--) { ICssError error = errors[i]; if (error.Item.IsValid) { Declaration dec = error.Item.FindType<Declaration>(); if (dec != null && dec.IsValid && dec.PropertyName.Text == "cursor") { if (error.Item.Text == "hand") { errors.RemoveAt(i); errors.Insert(i, CreateNewError(error, "cursorhand")); } else if (error.Item.Text == "normal") { errors.RemoveAt(i); errors.Insert(i, CreateNewError(error, "cursornormal")); } } } } }
/// <summary> /// This extension method replaces an item in a collection that implements the IList interface. /// </summary> /// <typeparam name="T">The type of the field that we are manipulating</typeparam> /// <param name="thisList">The input list</param> /// <param name="position">The position of the old item</param> /// <param name="item">The item we are goint to put in it's place</param> /// <returns>True in case of a replace, false if failed</returns> public static bool Replace <T>([CanBeNull][ItemCanBeNull] this IList <T> thisList, int position, [CanBeNull] T item) { // only process if inside the range of this list if (thisList == null || position > thisList.Count - 1) { return(false); } // remove the old item thisList?.RemoveAt(position); // insert the new item at its position thisList?.Insert(position, item); // return success return(true); }
public virtual void AddAtIndexProperties(int index, AuditPropertyConfiguration __item) { if (__item == null) { return; } properties?.Insert(index, __item); disableInternalAdditions = true; try { if (__item.Entity != this) { __item.Entity = this; } } finally { disableInternalAdditions = false; } }
public virtual void AddAtIndexSubCategory(int index, SubCategory __item) { if (__item == null) { return; } subCategory?.Insert(index, __item); disableInternalAdditions = true; try { if (__item.Category != this) { __item.Category = this; } } finally { disableInternalAdditions = false; } }
public virtual void AddAtIndexDeliveryNoteProducts(int index, DeliveryNoteProduct __item) { if (__item == null) { return; } deliveryNoteProducts?.Insert(index, __item); disableInternalAdditions = true; try { if (__item.DeliveryNote != this) { __item.DeliveryNote = this; } } finally { disableInternalAdditions = false; } }
public static void RegisterDisplayModes(IList<IDisplayMode> modes) { modes.Insert(0, new DefaultDisplayMode("android") { ContextCondition = (context => context.GetOverriddenUserAgent().IndexOf ("Android", StringComparison.OrdinalIgnoreCase) >= 0) }); modes.Insert(1, new DefaultDisplayMode("iPhone") { ContextCondition = (context => context.GetOverriddenUserAgent().IndexOf ("iPhone", StringComparison.OrdinalIgnoreCase) >= 0) }); }