public override string ToString() { StringBuilder strb = new StringBuilder(); strb.Append("Error in :").Append(File).Append(" Line:").Append(LineNumber.ToString()).Append(" ").AppendLine(Error); return(strb.ToString()); }
private string FormPairId() { // Use the line number (in .po) as an ID. var id = LineNumber.ToString(); // A single line can have multiple mdessage defs, though. // Use a, b, c, ... to distinguish them. if (LineNumber > LastLineNumber) { LastLineNumber = LineNumber; LastBranch = 0; } else { string branch = string.Empty; var n = ++LastBranch; while (n > 0) { n--; branch = (char)('a' + n % 26) + branch; n /= 26; } id += branch; } return(id); }
partial void OnLineNumberChanged() { if (xcuda_PreviousItem != null) { xcuda_PreviousItem.Current_item_number = LineNumber.ToString(); } }
public override string ToString() => string.Join(' ', LineNumber.ToString(), CharacterNumber.ToString(), Symbol.ToString(), TextValue, NumericValue.ToString());
/// +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+= /// <summary> /// If we draw a line with an aperture it will not always have linear ends /// for example if the aperture is a circle it will have half circle ends. Each /// line that is drawn calls this to make it look right visually /// </summary> /// <param name="graphicsObj">a graphics object to draw on</param> /// <param name="workingBrush">a brush to draw with</param> /// <param name="workingPen">the pen used for the line, we get the width from this</param> /// <param name="x1">the first x value</param> /// <param name="y1">the first y value</param> /// <param name="x2">the second x value</param> /// <param name="y2">the second y value</param> /// <param name="xyComp">the xy compensation factor</param> /// <returns>z success, nz fail</returns> public void FixupLineEndpointsForGCodePlot(IsoPlotBuilder isoPlotBuilder, GerberFileStateMachine stateMachine, int x1, int y1, int x2, int y2, int radius, int xyComp) { if (isoPlotBuilder == null) { return; } if (stateMachine == null) { return; } if (ADCodeAperture == null) { return; } try { ADCodeAperture.FixupLineEndpointsForGCodePlot(isoPlotBuilder, stateMachine, x1, y1, x2, y2, radius, xyComp); } catch (Exception ex) { // rethrow with line number throw new Exception("Line Number:" + LineNumber.ToString() + ", " + ex.Message); } }
public override string ToString() { string gcodeLineText = ""; gcodeLineText += LineNumber.ToString() + ";"; foreach (string command in Command) { gcodeLineText += command + ";"; } gcodeLineText += XPos.ToString() + SEPERATOR + YPos.ToString() + SEPERATOR + ZPos.ToString() + SEPERATOR + IPos.ToString() + SEPERATOR + JPos.ToString() + SEPERATOR + CRNumber.ToString() + SEPERATOR; foreach (ErrorGCode error in Error) { gcodeLineText += error.ToString() + SEPERATOR; } return(gcodeLineText); }
/// <summary> /// Override the ToString. /// </summary> /// <returns>Information of the line's code and first and last station</returns> public override string ToString() { string str = "Line " + LineNumber.ToString() + ": "; str += "\nFirst station: " + LineStations.First <LineStation>().ToString(); str += "\nLast station: " + LineStations.Last <LineStation>().ToString(); return(str); }
public override void Emit(CompilationContext ctx) { //That showoffy jerk Donald Knuth just *had* to put a quote in a //multiline comment so now I have to fix those up too. var fixedUp = StatementText.Replace("\"", "\\\"").Replace("\r\n", "\" + \r\n\""); ctx.EmitRaw("Lib.Fail(\"" + LineNumber.ToString() + " * " + fixedUp); ctx.EmitRaw("\");\n"); }
/// <summary> /// Routings the populate shipment line fields. /// </summary> /// <param name="schema">The schema.</param> /// <param name="parentShipment">The parent shipment.</param> public void RoutingPopulateShipmentLineFields(TextFieldCollection schema, TDCShipment parentShipment) { schema["Order"].Value = string.Concat(parentShipment.OpCoCode, "-", parentShipment.ShipmentNumber, "-", parentShipment.DespatchNumber); schema["LineCode"].Value = LineNumber.ToString(); schema["Product"].Value = ProductCode; schema["MaximumUnits"].Value = Quantity.ToString(); schema["MaximumWeight"].Value = GrossWeight.ToString("######0.##"); schema["MaximumVolume"].Value = Volume.ToString("###0.###"); schema["Width"].Value = Width.ToString();; schema["Length"].Value = Length.ToString(); }
private JsonException SyntaxError(string message, Exception inner) { if (LineNumber > 0) { message = string.Format( "{0} See line {1}, position {2}.", message, LineNumber.ToString("N0"), LinePosition.ToString("N0")); } return(new JsonException(message, inner)); }
public override string ToString() { var sb = new StringBuilder(); sb.Append("Component type: ").Append(ComponentType.ToString()).Append("\n"); sb.Append("Category: ").Append(Category.ToString()).Append("\n"); sb.Append("Lexeme: ").Append(Lexeme.ToString()).Append("\n"); sb.Append("Line number: ").Append(LineNumber.ToString()).Append("\n"); sb.Append("Initial position: ").Append(InitialPosition.ToString()).Append("\n"); sb.Append("Final position: ").Append(FinalPosition.ToString()).Append("\n"); return(sb.ToString()); }
public XElement ToXml() { var root = new XElement("Line"); root.Add(new XAttribute("Type", Type.ToString())); root.Add(new XAttribute("LineNumber", LineNumber.ToString())); root.Add(new XAttribute("Input", this.GetText())); if (this.Result != null) { root.Add(new XAttribute("Result", this.Result)); } return(root); }
/// <summary> /// Convierte el log en una cadena /// </summary> public string ToString(WriteMode mode, int indent = 0) { string line = $"{GetIndent(indent)}[{Type.ToString().ToUpper()}] [{CreatedAt:HH:mm:ss}] [{Id.ToString()}] [{Parent?.Id.ToString()}]"; // Añade los datos de log line += $" {FileName} | {MethodName} | {LineNumber.ToString()}" + Environment.NewLine; line += $"{GetIndent(indent)}{Message}".Replace('\r', ' ').Replace('\n', ' '); if (mode == WriteMode.Full) { line += Convert(Parameters, indent + 1); } line += Convert(Exception, mode, indent + 1); // Devuelve la línea convertida return(line); }
/// +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+= /// <summary> /// Calculates the width a pen should be for a specific angle. The width /// is returned in pixel units which means all dimensions are scaled up /// by /// </summary> /// <param name="stateMachine">the state machine with gerber file details</param> /// <param name="workingAngle">the angle the aperture will move at in degrees</param> public int GetPenWidthForAngle(GerberFileStateMachine stateMachine, int workingAngle) { if (ADCodeAperture == null) { return(0); } try { return(ADCodeAperture.GetPenWidthForAngle(stateMachine, workingAngle)); } catch (Exception ex) { // rethrow with line number throw new Exception("Line Number:" + LineNumber.ToString() + ", " + ex.Message); } }
/// +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+= /// <summary> /// If we draw a line with an aperture it will not always have linear ends /// for example if the aperture is a circle it will have half circle ends. Each /// line that is drawn calls this to make it look right visually /// </summary> /// <param name="graphicsObj">a graphics object to draw on</param> /// <param name="workingBrush">a brush to draw with</param> /// <param name="workingPen">the pen used for the line, we get the width from this</param> /// <param name="x1">the first x value</param> /// <param name="y1">the first y value</param> /// <param name="x2">the second x value</param> /// <param name="y2">the second y value</param> /// <returns>z success, nz fail</returns> public void FixupLineEndpointsForGerberPlot(GerberFileStateMachine stateMachine, Graphics graphicsObj, Brush workingBrush, Pen workingPen, float x1, float y1, float x2, float y2) { if (ADCodeAperture == null) { return; } try { ADCodeAperture.FixupLineEndpointsForGerberPlot(stateMachine, graphicsObj, workingBrush, workingPen, x1, y1, x2, y2); } catch (Exception ex) { // rethrow with line number throw new Exception("Line Number:" + LineNumber.ToString() + ", " + ex.Message); } }
public virtual string AsNcString(INcMachine ncMachine) { try { string line = ""; if (IsComment) { line += ncMachine.MachineCode.ComStart; } line += ncMachine.MachineCode.LineNumberPrefix + LineNumber.ToString() + " " + Content; return(line); } catch (Exception) { throw; } }
public List <string> ToStringValues() { return(new List <string>() { Id, LineNumber.ToString(), "", // PKG_CNTR, unused ItemId, Code, Quantity.ToString(), UnitPrice.ToString(), Description, Url, PickupBranchId, "" // PICKUP_DROP, unused }); }
public override string ToString() { StringBuilder sb = new StringBuilder(); sb.Append("Date: ").AppendLine(this.DateTimeOccurred.ToString()); if (TemplateFileName != null) { sb.Append("TemplateFileName: ").AppendLine(TemplateFileName); } if (TemplateIdentifier != null) { sb.Append("TemplateIdentifier: ").AppendLine(TemplateIdentifier); } sb.Append("Class: ").AppendLine(Class.ToString()); sb.Append("IsWarning: ").AppendLine(IsWarning.ToString()); sb.Append("IsRuntime: ").AppendLine(IsRuntime.ToString()); sb.Append("IsTemplateCodeSegment: ").AppendLine(IsTemplateCodeSegment.ToString()); if (ErrorNumber != null) { sb.Append("ErrorNumber: ").AppendLine(ErrorNumber); } if (ErrorType != null) { sb.Append("ErrorType: ").AppendLine(ErrorType); } if (SourceFile != null) { sb.Append("SourceFile: ").AppendLine(SourceFile); } if (SourceLine != null) { sb.Append("SourceLine: ").AppendLine(SourceLine); } sb.Append("LineNumber: ").AppendLine(LineNumber.ToString()); sb.Append("ColumnNumber: ").AppendLine(ColumnNumber.ToString()); if (Message != null) { sb.Append("Message: ").AppendLine(Message); } if (Detail != null) { sb.Append("Detail: ").AppendLine(Detail); } return(sb.ToString()); }
int IDebugMemoryContext2.GetInfo(enum_CONTEXT_INFO_FIELDS dwFields, CONTEXT_INFO[] pinfo) { pinfo[0].dwFields = 0; if ((dwFields & enum_CONTEXT_INFO_FIELDS.CIF_ADDRESS) != 0) { pinfo[0].bstrAddress = LineNumber.ToString(); pinfo[0].dwFields |= enum_CONTEXT_INFO_FIELDS.CIF_ADDRESS; } if ((dwFields & enum_CONTEXT_INFO_FIELDS.CIF_FUNCTION) != 0) { pinfo[0].bstrFunction = StackFrame?.StackFrame?.CallingFrame?.Call ?? "<unknown>"; pinfo[0].dwFields |= enum_CONTEXT_INFO_FIELDS.CIF_FUNCTION; } return(VSConstants.S_OK); }
/// +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+= /// <summary> /// If we fill a shape with the aperture at the current coordinates. This /// simulates the aperture flash of a Gerber plotter /// </summary> /// <param name="graphicsObj">a graphics object to draw on</param> /// <param name="workingBrush">a brush to draw with</param> /// <param name="x1">the x center value</param> /// <param name="y1">the y center value</param> /// <returns>z success, nz fail</returns> public void FlashApertureForGerberPlot(GerberFileStateMachine stateMachine, Graphics graphicsObj, Brush workingBrush, float x1, float y1) { if (ADCodeAperture == null) { return; } try { // macros need to reset ADCodeAperture.ResetForFlash(); // flash it ADCodeAperture.FlashApertureForGerberPlot(stateMachine, graphicsObj, workingBrush, x1, y1); } catch (Exception ex) { // rethrow with line number throw new Exception("Line Number:" + LineNumber.ToString() + ", " + ex.Message); } }
/// +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+= /// <summary> /// Flash the aperture /// </summary> /// <param name="isoPlotBuilder">the builder opbject</param> /// <param name="stateMachine">the statemachine</param> /// <param name="xyComp">the xy compensation factor</param> /// <param name="x1">the first x value</param> /// <param name="y1">the first y value</param> /// <returns>z success, nz fail</returns> public void FlashApertureForGCodePlot(IsoPlotBuilder isoPlotBuilder, GerberFileStateMachine stateMachine, int x1, int y1, int xyComp) { if (ADCodeAperture == null) { return; } try { // macros need to reset ADCodeAperture.ResetForFlash(); // flash it ADCodeAperture.FlashApertureForGCodePlot(isoPlotBuilder, stateMachine, x1, y1, xyComp); } catch (Exception ex) { // rethrow with line number throw new Exception("Line Number:" + LineNumber.ToString() + ", " + ex.Message); } }
public override string AsNcString(INcMachine ncMachine) { try { string line = ncMachine.MachineCode.LineNumberPrefix + LineNumber.ToString() + " "; if (Feedrate.Inverted) { line += ncMachine.MachineCode.InverseFeed + " "; } line += ncMachine.MoveGCode(this.moveType, this.blockType) + " "; line += MachinePosition.AsNcString(ncMachine, prevPosition, blockType, moveType) + " " + Feedrate.AsNcString(ncMachine); return(line); } catch (Exception) { throw; } }
internal Dictionary <string, string> GetProperties() { var properties = new Dictionary <string, string>(); if (!string.IsNullOrWhiteSpace(SourcePath)) { properties.Add("sourcepath", SourcePath); } if (LineNumber.HasValue) { properties.Add("linenumber", LineNumber.ToString()); } if (ColumnNumber.HasValue) { properties.Add("columnnumber", ColumnNumber.ToString()); } if (ErrorCode.HasValue) { properties.Add("code", ErrorCode.ToString()); } return(properties); }
protected override void WriteEndOfLine(string value, int index, int endIndex, OutputSymbols symbols) { LineNumber++; WriteNewLine(value, index); if (IncludeEndingIndent || index < endIndex) { Write(Indent); if (IncludeEndingLineNumber || index < endIndex) { Write(LineNumber.ToString(), Colors.LineNumber); Write(" "); } else { PendingLineNumber = true; } } }
public override string ToString() { return(LineNumber.ToString()); }
public override string ToString() { return(LineNumber.ToString().PadRight(5, ' ') + LineText); }
public override string ToString() { return(Invariant($"{Call ?? "<null>"} at {FileName ?? "<null>"}:{(LineNumber != null ? LineNumber.ToString() : "<null>")}")); }
/// +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+= /// <summary> /// Parses out the line and gets the required information from it /// </summary> /// <param name="processedLineStr">a line string without block terminator or format parameters</param> /// <param name="stateMachine">The state machine containing the implied modal values</param> /// <returns>z success, nz fail</returns> public override int ParseLine(string processedLineStr, ExcellonFileStateMachine stateMachine) { float outFloat = 0; int outInt = 0; int nextStartPos = 0; bool retBool; //LogMessage("ParseLine(XY) started"); if (processedLineStr == null) { return(100); } if (processedLineStr.StartsWith("R") == false) { return(200); } // now the line will have some combination of R, X and Y tags in some order // LOOK FOR THE X TAG nextStartPos = 0; nextStartPos = GerberParseUtils.FindCharacterReturnNextPos(processedLineStr, 'R', nextStartPos); if ((nextStartPos < 0) || (nextStartPos > processedLineStr.Length)) { // we have to have this LogMessage("ParseLine(R) lineNumber=" + LineNumber.ToString() + " failed. No R repeat quantity found."); return(3331); } else { // this will have a integer number retBool = GerberParseUtils.ParseNumberFromString_TillNonDigit_RetInteger(processedLineStr, nextStartPos, ref outInt, ref nextStartPos); if (retBool != true) { LogMessage("ParseLine(R) failed on call to ParseNumberFromString_TillNonDigit_RetInteger"); return(3332); } else { // set the value now repeatCount = outInt; } } // LOOK FOR THE X TAG nextStartPos = 0; nextStartPos = GerberParseUtils.FindCharacterReturnNextPos(processedLineStr, 'X', nextStartPos); if ((nextStartPos < 0) || (nextStartPos > processedLineStr.Length)) { // we have to have this LogMessage("ParseLine(R) lineNumber=" + LineNumber.ToString() + " failed. No X coordinate found."); return(1331); } else { // this will have a float number retBool = GerberParseUtils.ParseNumberFromString_TillNonDigit_RetFloat(processedLineStr, nextStartPos, ref outFloat, ref nextStartPos); if (retBool != true) { // just means not found } else { // set the value now xOffset = DecimalScaleNumber(outFloat, stateMachine.ExcellonFileManager.DrillingNumberOfDecimalPlaces, stateMachine.ExcellonFileManager.DrillingCoordinateZerosMode); } } // LOOK FOR THE Y TAG nextStartPos = 0; nextStartPos = GerberParseUtils.FindCharacterReturnNextPos(processedLineStr, 'Y', nextStartPos); if ((nextStartPos < 0) || (nextStartPos > processedLineStr.Length)) { // just means not found } else { // this will have a float number retBool = GerberParseUtils.ParseNumberFromString_TillNonDigit_RetFloat(processedLineStr, nextStartPos, ref outFloat, ref nextStartPos); if (retBool != true) { LogMessage("ParseLine(R) failed on call to ParseNumberFromString_TillNonDigit_RetFloat"); return(2332); } else { // set the value now yOffset = DecimalScaleNumber(outFloat, stateMachine.ExcellonFileManager.DrillingNumberOfDecimalPlaces, stateMachine.ExcellonFileManager.DrillingCoordinateZerosMode); } } return(0); }
/// +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+= /// <summary> /// Converts the excellon line into a GCode line and returns it /// </summary> /// <param name="stateMachine">the state machine with the configuration</param> /// <param name="gcLineList">a list of the equivalent gcode line object. This can be /// empty if there is no direct conversion</param> /// <returns>z success, nz fail</returns> public override int GetGCodeCmd(ExcellonFileStateMachine stateMachine, out List <GCodeCmd> gcLineList) { gcLineList = null; GCodeCmd_ZMove zLine = null; GCodeCmd_RapidMove rmLine = null; gcLineList = new List <GCodeCmd>(); int workingXCoord; int workingYCoord; int workingXOffset; int workingYOffset; if (RepeatCount < 0) { LogMessage("GetGCodeCmd (R) invalid repeat count of " + RepeatCount.ToString() + " on line " + LineNumber.ToString()); return(101); } // setup our offsets now workingXOffset = GetOffsetInPlotCoords_X(stateMachine); workingYOffset = GetOffsetInPlotCoords_Y(stateMachine); // now put out our loop for (int i = 0; i < RepeatCount; i++) { workingXCoord = stateMachine.LastPlotXCoord; workingYCoord = stateMachine.LastPlotYCoord; // calculate the new coordinate now workingXCoord += workingXOffset; workingYCoord += workingYOffset; // G00 rapid move tool head to the xOffset, yCoord rmLine = new GCodeCmd_RapidMove(workingXCoord, workingYCoord); gcLineList.Add(rmLine); stateMachine.LastXCoord = workingXCoord; stateMachine.LastYCoord = workingYCoord; // set the drill width float workingDrillWidth = stateMachine.LastDrillWidth * stateMachine.IsoPlotPointsPerAppUnit; // G00 - put the bit into the work piece zLine = new GCodeCmd_ZMove(GCodeCmd_ZMove.GCodeZMoveHeightEnum.GCodeZMoveHeight_ZCoordForCut); zLine.SetGCodePlotDrillValues(workingXCoord, workingYCoord, workingDrillWidth); gcLineList.Add(zLine); // G00 - pull the bit out of the work piece zLine = new GCodeCmd_ZMove(GCodeCmd_ZMove.GCodeZMoveHeightEnum.GCodeZMoveHeight_ZCoordForClear); zLine.SetGCodePlotDrillValues(workingXCoord, workingYCoord, workingDrillWidth); gcLineList.Add(zLine); } return(0); }
/// +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+= /// <summary> /// Performs the action the plot requires based on the current context /// </summary> /// <param name="graphicsObj">a graphics object on which to plot</param> /// <param name="stateMachine">the excellon plot state machine</param> /// <param name="errorString">the error string we return on fail</param> /// <param name="errorValue">the error value we return on fail, z success, nz fail </param> /// <returns>an enum value indicating what next action to take</returns> public override PlotActionEnum PerformPlotExcellonAction(Graphics graphicsObj, ExcellonFileStateMachine stateMachine, ref int errorValue, ref string errorString) { int workingXCoord; int workingYCoord; int workingXOffset; int workingYOffset; if (RepeatCount < 0) { LogMessage("PerformPlotExcellonAction (R) invalid repeat count of " + RepeatCount.ToString() + " on line " + LineNumber.ToString()); errorValue = 101; errorString = "PerformPlotExcellonAction(R) invalid repeat count of " + RepeatCount.ToString() + " on line " + LineNumber.ToString(); return(PlotActionEnum.PlotAction_FailWithError); } // setup our offsets now workingXOffset = GetOffsetInPlotCoords_X(stateMachine); workingYOffset = GetOffsetInPlotCoords_Y(stateMachine); // set the drill width float workingDrillWidth = stateMachine.LastDrillWidth * stateMachine.IsoPlotPointsPerAppUnit; // remember this LastDrillWidth = stateMachine.LastDrillWidth; // now put out our loop for (int i = 0; i < RepeatCount; i++) { workingXCoord = stateMachine.LastPlotXCoord; workingYCoord = stateMachine.LastPlotYCoord; // calculate the new coordinate now workingXCoord += workingXOffset; workingYCoord += workingYOffset; stateMachine.LastPlotXCoord = workingXCoord; stateMachine.LastPlotYCoord = workingYCoord; stateMachine.LastXCoord = (float)(workingXCoord / stateMachine.IsoPlotPointsPerAppUnit); stateMachine.LastYCoord = (float)(workingYCoord / stateMachine.IsoPlotPointsPerAppUnit); MiscGraphicsUtils.FillEllipseCenteredOnPoint(graphicsObj, stateMachine.ExcellonHoleBrush, workingXCoord, workingYCoord, workingDrillWidth, workingDrillWidth); } errorValue = 0; errorString = "Successful End"; return(PlotActionEnum.PlotAction_Continue); }