public void RemoveWorks()
        {
            EditorConfigFile editorConfigFile = PrepareTest("remove", out var file, out var workingFile);

            const int TestSection = 0;
            var       sectionName = editorConfigFile.Sections[TestSection].Name;

            // Find aftercomment property line
            editorConfigFile.TryGetProperty("aftercomment", editorConfigFile.Sections[TestSection], out var afterProp).Should().BeTrue();
            var lineNumber = afterProp !.LineNumber;

            // Remove beforecommment
            editorConfigFile.TryGetProperty("beforecomment", editorConfigFile.Sections[TestSection], out var prop).Should().BeTrue();
            using (var editContext = editorConfigFile.Edit(new EditorConfigFileOptions {
                EndSectionWithBlankLineOrComment = false
            }))
            {
                editContext.Sections[sectionName].Remove(prop !).Should().BeTrue();

                editContext.SaveChanges();
            }

            editorConfigFile.TryGetProperty("beforecomment", editorConfigFile.Sections[TestSection], out _).Should().BeFalse();

            // Confirm aftercomment has moved up a line
            editorConfigFile.TryGetProperty("aftercomment", editorConfigFile.Sections[TestSection], out var updatedProperty).Should().BeTrue();
            updatedProperty !.LineNumber.Should().Be(lineNumber - 1);

            // Confirm the file is one line shorter
            var fileLength        = File.ReadAllLines(file).Length;
            var workingFileLength = File.ReadAllLines(workingFile).Length;

            workingFileLength.Should().Be(fileLength - 1);
        }
Example #2
0
 public override int GetHashCode()
 {
     unchecked
     {
         return((LineNumber.GetHashCode() * 397) ^ (RowText != null ? RowText.GetHashCode() : 0));
     }
 }
Example #3
0
        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);
        }
Example #4
0
        /// +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
        /// <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);
            }
        }
Example #5
0
 public override string ToString() =>
 string.Join(' ',
             LineNumber.ToString(),
             CharacterNumber.ToString(),
             Symbol.ToString(),
             TextValue,
             NumericValue.ToString());
Example #6
0
        /// <summary>
        ///     Compare the position to another position.
        /// </summary>
        /// <param name="other">
        ///     The other position.
        /// </param>
        /// <returns>
        ///     0 if the positions are equal, greater than 0 if the other position is less than the current position, less than 0 if the other position is greater than the current position.
        /// </returns>
        public int CompareTo(Position other)
        {
            if (other == null)
            {
                throw new ArgumentNullException(nameof(other));
            }

            if (IsOneBased)
            {
                other = other.ToOneBased();
            }
            else if (IsZeroBased)
            {
                other = other.ToZeroBased();
            }

            int lineComparison = LineNumber.CompareTo(other.LineNumber);

            if (lineComparison != 0)
            {
                return(lineComparison);
            }

            return(ColumnNumber.CompareTo(other.ColumnNumber));
        }
Example #7
0
 public bool Equals(DebugStackFrame other)
 {
     return(other != null &&
            FileName.Equals(other.FileName) &&
            LineNumber.Equals(other.LineNumber) &&
            Call.Equals(other.Call));
 }
Example #8
0
 partial void OnLineNumberChanged()
 {
     if (xcuda_PreviousItem != null)
     {
         xcuda_PreviousItem.Current_item_number = LineNumber.ToString();
     }
 }
Example #9
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (LineNumber != 0L)
            {
                hash ^= LineNumber.GetHashCode();
            }
            if (timestampTime_ != null)
            {
                hash ^= TimestampTime.GetHashCode();
            }
            if (StreamType.Length != 0)
            {
                hash ^= StreamType.GetHashCode();
            }
            if (Text.Length != 0)
            {
                hash ^= Text.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
Example #10
0
        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);
        }
Example #11
0
        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());
        }
Example #12
0
 public InvoiceLine(LineNumber lineNumber, Quantity quantity, Amount itemPrice, string description)
 {
     LineNumber  = lineNumber;
     Quantity    = quantity;
     ItemPrice   = itemPrice;
     Description = description;
 }
        /// <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);
        }
Example #14
0
        public override int GetHashCode()
        {
            int hashItemId     = ItemId == 0 ? 0 : ItemId.GetHashCode();
            int hashLineNumber = LineNumber == 0 ? 0 : LineNumber.GetHashCode();
            int hashShipmentId = ShipmentId == "" ? 0 : ShipmentId.GetHashCode();

            return(hashItemId * hashLineNumber * hashShipmentId);
        }
Example #15
0
            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");
            }
Example #16
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hash = (int)2166136261;
         hash = (hash * 16777619) ^ LineNumber.GetHashCode();
         return((hash * 16777619) ^ VisitCount.GetHashCode());
     }
 }
 public string[] ToJQueryDataTableResult()
 {
     return(new []
     {
         FdpImportErrorId.ToString(),
         LineNumber.TrimStart('0'),
         ErrorTypeDescription,
         ErrorMessage
     });
 }
Example #18
0
        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));
        }
Example #19
0
        public void Constructor_should_assign_positive_value()
        {
            // Arrange
            const int expected = 2;

            // Act
            var actual = new LineNumber(expected).Value;

            // Assert
            Assert.Equal(expected, actual);
        }
Example #20
0
 public int CompareTo(GrepLine other)
 {
     if (other == null)
     {
         return(1);
     }
     else
     {
         return(LineNumber.CompareTo(other.LineNumber));
     }
 }
 /// <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();
 }
Example #22
0
        public override int GetHashCode()
        {
            int hashCode = -1644089817;

            hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(LeftFileName);

            hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(RightFileName);

            hashCode = hashCode * -1521134295 + LineNumber.GetHashCode();
            hashCode = hashCode * -1521134295 + IsLeftSideLineNumber.GetHashCode();
            return(hashCode);
        }
Example #23
0
        protected override void OnActivated(EventArgs e)
        {
            base.OnActivated(e);

            BlameControl blame = (BlameControl)DataContext;

            Caption.Content = "Line number (1–{0}):".FormatInvariant(blame.TotalLines);

            LineNumber.Text = blame.TopLineNumber.ToString();
            LineNumber.Focus();
            LineNumber.SelectAll();
        }
Example #24
0
        protected override void Read(uint Length, System.IO.BinaryReader Reader, ConstantPool Pool)
        {
            ushort Count = Reader.ReadUInt16BE();

            for (int i = 0; i < Count; i++)
            {
                LineNumber Line = new LineNumber();
                Line.StartPC          = Reader.ReadUInt16BE();
                Line.LineNumberInFile = Reader.ReadUInt16BE();
                Table.Add(Line);
            }
        }
Example #25
0
        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);
        }
Example #27
0
 public override int GetHashCode()
 {
     // Overflow is fine, just wrap
     unchecked
     {
         int hash = 17;
         hash = hash * 23 + (File == null ? 0 : File.GetHashCode());
         hash = hash * 23 + LineNumber.GetHashCode();
         hash = hash * 23 + LinePosition.GetHashCode();
         hash = hash * 23 + (ErrorMessage == null ? 0 : ErrorMessage.GetHashCode());
         return(hash);
     }
 }
Example #28
0
 private void traverseAllCsharpFilesAndExecute(
     Action <Line, LineNumber, FileName> actionOnOneLine)
 {
     traverseAllCsharpFilesAndExecute((lines, fileName) =>
     {
         for (var i = 0; i < lines.GetLines().Count; i++)
         {
             var currentLineNumber = new LineNumber(i);
             var line = lines.GetLine(currentLineNumber);
             // Process line
             actionOnOneLine(line, currentLineNumber, fileName);
         }
     });
 }
        public static void UpdatePageSetup()
        {
            string    name         = "updatePageSetup.docx";;
            int?      sectionIndex = 0;
            string    storage      = null;
            var       marging      = new Margin(20, 20, 20, 20);
            var       linenumber   = new LineNumber(1, 2, LineNumber.RestartModeEnum.Continuous, 20);
            PageSetup pageSetup    = new PageSetup(400, 500, marging, PageSetup.OrientationEnum.Landscape, linenumber);
            string    folder       = "input";
            string    password     = null;
            string    destFilePath = "output/updatePageSetup_output.docx";

            sectionsApi.UpdatePageSetup(name, sectionIndex, pageSetup, destFilePath, folder, storage, password);
        }
        /// <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);
        }
        //---------------------------------------------------------------------------------------//
        public virtual bool WriteLine(LineNumber lineno, String message)
        {
            /*
             * Write the message to the logfile
             */
            String line = String.Format(STRLOG_DeviceLineMessage_arg3, ClassName, (int)lineno, (message != null) ? message : String.Empty);
            Logfile.Write(Logfile.Level.Info, line);
            Trace.WriteLine(line);

            return true;
        }
        //---------------------------------------------------------------------------------------//
        public override bool WriteLine(LineNumber lineno, String message)
        {
            /*
             * Write the message to the logfile
             */
            base.WriteLine(lineno, message);

            /*
             * Pad out the message the the line length and convert to a byte array
             */
            message = this.CreateStringOfLength(message, LINE_LENGTH);
            byte[] data = Encoding.ASCII.GetBytes(message.ToCharArray());

            switch (lineno)
            {
                case LineNumber.One:
                    return this.SendReturnBool((byte)LCDPktType.WriteLine1, data, data.Length);

                case LineNumber.Two:
                    return this.SendReturnBool((byte)LCDPktType.WriteLine2, data, data.Length);
            }

            return false;
        }
        //---------------------------------------------------------------------------------------//
        public override bool WriteLine(LineNumber lineno, String message)
        {
            /*
             * Write the message to the logfile
             */
            base.WriteLine(lineno, message);

            /*
             * Check if simulating delays
             */
            if (this.delaysSimulated == true)
            {
                Delay.MilliSeconds((int)(this.writeLineTime * 1000));
            }

            return true;
        }
 /// <summary>
 /// Add the given line number to the list
 /// </summary>
 internal void Add(LineNumber lineNumber)
 {
     lineNumbers.Add(lineNumber);
     sorted = false;
 }