Inheritance: MonoBehaviour
 static void Main(string[] args)
 {
     string line = null;
     while ((line = Console.ReadLine()) != "RUN")
     {
         string num = null;
         for (int i = 0; i < line.Length; i++)
         {
             if (line[i].ToString() != " ")
             {
                 num += line[i].ToString();
             }
             else
             {
                 line = line.Replace(num, "");
                 Lines code = new Lines();
                 code.LineNumber = int.Parse(num);
                 code.Code = line;
                 BasicCode.Add(code);
                 break;
             }
         }
     }
     for (int i = 0; i < BasicCode.Count; i++)
     {
         ExecuteLines(i);
     }
 }
示例#2
0
        public string type = ""; // type of undo operation (delete, create, edit, move, changeLineColor, changeLineWidth, changeNodeColor)

        #endregion Fields

        #region Constructors

        /*************************************************************************************************************************/
        // CONSTRUCTORS
        public UndoOperation(
            string type, 
            Nodes nodes = null, 
            Lines lines = null, 
            int group = 0, 
            Position position = null, 
            int layer = 0
        )
        {
            this.type = type;
            this.group = group;
            this.position.set(position);
            this.layer = layer;

            if (nodes != null)
            {
                foreach (Node node in nodes)
                {
                    this.nodes.Add(new Node(node));
                }
            }

            if (lines != null)
            {
                foreach (Line line in lines)
                {
                    this.lines.Add(new Line(line));
                }
            }
        }
示例#3
0
 public override Lines ConstructContent(ReportTemplateParser parser)
 {
     var lines = new Lines();
     try
     {
         if (Body != null)
         {
             parser.RunFor(Each, In,
                           delegate
                               {
                                   foreach (BasePlainElement element in Body)
                                   {
                                       lines.AddRange(element.ConstructContent(parser));
                                   }
                               });
         }
     }
     catch (ReportTemplateParserException pex)
     {
         lines.Add(new ReportLine(
             new[] {"-+- FOR: " + pex.Reason + " (" + pex.Type + "." + pex.Name + ") -!-" },
             LineAlign.Left, "0", false, false, false, false, -1));
     }
     return lines;
 }
示例#4
0
        public static IEnumerable<Page> Layout(Unit pageHeight, Lines lines)
        {
            if (pageHeight <= 0.cm())
                throw new ArgumentException("Page height must be larger than zero");

            var pagingLayouter = new PagingLayouter(pageHeight);
            return pagingLayouter.Layout(lines);
        }
示例#5
0
        public static Page Layout(Lines root)
        {
            var currentPage = Page.First();
            foreach (var line in root)
            {
                currentPage.Add(line, 0.cm());
            }

            return currentPage;
        }
示例#6
0
 public override Lines ConstructContent(ReportTemplateParser parser)
 {
     var lines = new Lines();
     if (parser.Check(Condition, Not))
     {
         if (Columns == null || Columns.Length <= 0)
         {
             var text = new[]
             {
                 parser.Format(LinePart.ConstructLine(parser, Part, Text ?? String.Empty))
             };
             if (!string.IsNullOrEmpty(SplitChar))
             {
                 text = text[0].Split(SplitChar.ToCharArray());
             }
             foreach (string s in text)
             {
                 lines.Add(
                     new ReportLine(new[] {NeedTrim ? s.Trim() : s},
                                    Align ?? LineAlign.Left,
                                    FontSize, IsBold, IsItalic, false, false, IsLineDotted));
             }
         }
         else
         {
             var columns = new ArrayList();
             foreach (LinePart t in Columns)
             {
                 if (parser.Check(t.Condition, t.Not))
                 {
                     if (t.In != null && t.Each != null)
                     {
                         parser.RunFor(t.Each, t.In,
                                       () => columns.Add(parser.Format(
                                           LinePart.ConstructLine
                                               (parser, t.Part, t.Text ?? String.Empty))));
                     }
                     else
                     {
                         columns.Add(parser.Format(
                             LinePart.ConstructLine(parser, t.Part, t.Text ?? String.Empty)));
                     }
                 }
             }
             var arr = new string[columns.Count];
             columns.CopyTo(arr);
             lines.Add(new ReportLine(arr,
                                      Align ?? LineAlign.Left,
                                      FontSize, IsBold, IsItalic, NewPage, ResetPageNumber, IsLineDotted));
         }
     }
     return lines;
 }
示例#7
0
 public override Lines ConstructContent(ReportTemplateParser parser)
 {
     Lines lines = new Lines();
     int rowNumber = 0;
     if (!Int32.TryParse(Value, out rowNumber))
     {
         if (!Int32.TryParse(parser.Format(Value), out rowNumber))
         {
             rowNumber = 0;
         }
     }
     lines.Add(new ServiceLine(rowNumber));
     return lines;
 }
示例#8
0
文件: IfClause.cs 项目: nico-izo/KOIB
 public override Lines ConstructContent(ReportTemplateParser parser)
 {
     var lines = new Lines();
     try
     {
         BasePlainElement[] branch = parser.Check(Condition, Not) ? Then : Else;
         if (branch != null)
         {
             foreach (BasePlainElement element in branch)
             {
                 lines.AddRange(element.ConstructContent(parser));
             }
         }
     }
     catch (ReportTemplateParserException pex)
     {
         lines.Add(new ReportLine(
             new[]{"-+- IF: " + pex.Reason + " (" + pex.Type + "." + pex.Name + ") -!-"},
             LineAlign.Left, "0", false, false, false, false, -1));
     }
     return lines;
 }
示例#9
0
        IEnumerable<Page> Layout(Lines root)
        {
            var pagedDocument = new List<Page>();
            var currentPage = Page.First();
            var currentPageNumer = 1;
            foreach (var line in from lines in root.FitTo(pageHeight, pageHeight)
                                 from line in lines
                                 select line)
            {
                if (line.Top >= TopOfNextPage(currentPageNumer))
                {
                    pagedDocument.Add(currentPage);
                    currentPage = currentPage.Next();
                    currentPageNumer++;
                }

                currentPage.Add(line, TopOfPage(currentPageNumer));
            }

            pagedDocument.Add(currentPage);
            return pagedDocument;
        }
示例#10
0
        public void Export()
        {
            var item = Lines.FirstOrDefault();

            MessageBox.Show($"{item.Text}");
        }
示例#11
0
        // all nodes contain nodes and all sublayer nodes, allLines contain all node lines and all sublayer lines
        public void getAllNodesAndLines(Nodes nodes, ref Nodes allNodes, ref Lines allLines)
        {
            foreach (Node node in nodes)
            {
                // add node itself to output
                allNodes.Add(node);

                if (node.haslayer)
                {
                    Layer layer = this.getLayer(node.id);
                    getAllNodesAndLines(layer.nodes, ref allNodes, ref allLines);
                }

                Lines lines = getAllLinesFromNode(node);
                foreach (Line line in lines)
                {
                    bool found = false;

                    foreach (Line subline in allLines)
                    {
                        if (line.start == subline.start && line.end == subline.end)
                        {
                            found = true;
                            break;
                        }
                    }

                    if (!found)
                    {
                        allLines.Add(line);
                    }
                }
            }
        }
示例#12
0
        private void Form1_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
        {
            x = Convert.ToInt32((e.X - p.StagePos.X) / p.dpi);
            y = Convert.ToInt32((e.Y - p.StagePos.Y) / p.dpi);

            //hittest states
            hitState = stateList.FirstOrDefault(x => x.Bounds.Contains(new Point(this.x, this.y)));

            #region drag bezier handles
            if (dragState != null && e.Button == MouseButtons.Left)
            {
                //FLogger.Log(LogType.Debug, "bezierHandleStart");
                Lines.EdgePoints myEdgePoints = Lines.GetEdgePoints(State.Center(p.bezierEdit.highlightTransition.startState.Bounds), State.Center(p.bezierEdit.highlightTransition.endState.Bounds), 40, 40, 0.0);
                if (dragState == "bezierStart")
                {
                    p.bezierEdit.highlightTransition.startBezierPoint = new Point(this.x - myEdgePoints.A.X, this.y - myEdgePoints.A.Y);
                }
                if (dragState == "bezierEnd")
                {
                    p.bezierEdit.highlightTransition.endBezierPoint = new Point(this.x - myEdgePoints.B.X, this.y - myEdgePoints.B.Y);
                }
            }
            #endregion

            #region drag things

            //drag stage
            if (selectedState == null && e.Button == MouseButtons.Right)
            {
                Point mousePos = MousePosition;
                int   deltaX   = (mousePos.X - previousPosition.X);
                int   deltaY   = (mousePos.Y - previousPosition.Y);
                previousPosition = MousePosition;
                p.StagePos.X    += deltaX;
                p.StagePos.Y    += deltaY;
            }

            //drag state
            if (selectedState != null && e.Button == MouseButtons.Left && dragState == null)
            {
                selectedState.Move(new Point(Convert.ToInt32(e.X / p.dpi) - (p.StateSize / 2) - Convert.ToInt32(p.StagePos.X / p.dpi), Convert.ToInt32(e.Y / p.dpi) - (p.StateSize / 2) - Convert.ToInt32(p.StagePos.Y / p.dpi)));
            }

            //drag region
            if (selectedState == null && hitRegion != null && e.Button == MouseButtons.Left && hitsizeHandle == null && dragState == null)
            {
                Point mousePos = MousePosition;
                int   deltaX   = (mousePos.X - previousPosition.X);
                int   deltaY   = (mousePos.Y - previousPosition.Y);
                previousPosition     = MousePosition;
                hitRegion.Bounds     = new Rectangle(hitRegion.Bounds.X + deltaX, hitRegion.Bounds.Y + deltaY, hitRegion.Bounds.Width, hitRegion.Bounds.Height);
                hitRegion.SizeHandle = new Rectangle(hitRegion.SizeHandle.X + deltaX, hitRegion.SizeHandle.Y + deltaY, 10, 10);
            }

            //drag size

            if (e.Button == MouseButtons.Left && hitsizeHandle != null)
            {
                Point mousePos = MousePosition;
                int   deltaX   = (mousePos.X - previousPosition.X);
                int   deltaY   = (mousePos.Y - previousPosition.Y);
                previousPosition = MousePosition;


                int sizeX = hitsizeHandle.SizeHandle.X + deltaX;
                int sizeY = hitsizeHandle.SizeHandle.Y + deltaY;

                if ((sizeX - hitsizeHandle.Bounds.X + 10) < 100)
                {
                    sizeX = hitsizeHandle.Bounds.X + 90;
                }
                if ((sizeY - hitsizeHandle.Bounds.Y + 10) < 100)
                {
                    sizeY = hitsizeHandle.Bounds.Y + 90;
                }

                hitsizeHandle.SizeHandle = new Rectangle(sizeX, sizeY, 10, 10);
                hitsizeHandle.Bounds     = new Rectangle(hitsizeHandle.Bounds.X, hitsizeHandle.Bounds.Y, sizeX - hitsizeHandle.Bounds.X + 10, sizeY - hitsizeHandle.Bounds.Y + 10);
            }


            #endregion

            #region startConnection

            if (startConnectionState != null && hitState != null)
            {
                targetConnectionState = hitState;
            }
            else
            {
                targetConnectionState = null;
            }
            #endregion

            SetSelectionRectangle(e);

            this.Invalidate(); //redraw
        }
示例#13
0
 public DiagramBlock(Nodes nodes = null, Lines lines = null)
 {
     this.nodes = nodes;
     this.lines = lines;
 }
示例#14
0
 /// <inheritdoc/>
 public override int GetHashCode()
 {
     return(Lines.GetHashCode() ^ (Shadow.GetHashCode() + 16) ^ ShadowColor.GetHashCode() ^
            (ShadowWidth.GetHashCode() + 32) ^ (LeftLine.GetHashCode() << 1) ^ (TopLine.GetHashCode() << 2) ^
            (RightLine.GetHashCode() << 3) ^ (BottomLine.GetHashCode() << 4));
 }
示例#15
0
 public Lines GetLongestLines(int h, int d, int w)
 {
     // check all 13 directions
     Coords here = new Coords(this, h, d, w);
     Coords[] directions = new Coords[]{
         new Coords(this, 1, 0, 0),
         new Coords(this, 0, 1, 0),
         new Coords(this, 0, 0, 1),
         new Coords(this, 1, 1, 0),
         new Coords(this, 1, 0, 1),
         new Coords(this, 0, 1, 1),
         new Coords(this, 1, -1, 0),
         new Coords(this, 1, 0, -1),
         new Coords(this, 0, 1, -1),
         new Coords(this, 1, 1, 1),
         new Coords(this, 1, -1, -1),
         new Coords(this, -1, 1, -1),
         new Coords(this, 1, 1, -1),};
     Lines max = new Lines();
     max.Count = 0;
     max.Length = 0;
     for (int i = 0; i < directions.Length; i++)
     {
         Coords n = here;
         if (!Visited[h, d, w, i])
         {
             Visited[h, d, w, i] = true;
             int length = 1;
             while (n.Plus(directions[i]))
             {
                 Visited[n.Height, n.Depth, n.Width, i] = true;
                 length++;
             }
             n = here;
             while (n.Minus(directions[i]))
             {
                 Visited[n.Height, n.Depth, n.Width, i] = true;
                 length++;
             }
             if (max.Length < length)
             {
                 max.Length = length;
                 max.Count = 1;
             }
             else if (max.Length == length)
             {
                 max.Count++;
             }
         }
     }
     return max;
 }
示例#16
0
 public static string Achivements()
 {
     return(Score.ToString("00000000") + "|" + Lines.ToString("000") + "|" + Level.ToString("00"));
 }
示例#17
0
 public void add(string type, Line line, Position position = null, int layer = 0)
 {
     Lines lines = new Lines();
     if (line != null)
     {
         lines.Add(new Line(line));
     }
     this.add(type, null, lines, position, layer);
 }
示例#18
0
        public override float GetVerticalExtent(Window refWnd)
        {
            // TODO: Cache at format time.

            return(Lines.Sum(i => i.GetVerticalExtent(refWnd)));
        }
示例#19
0
 /// <summary>
 /// Returns an enumerator that enumerates through the lines.
 /// </summary>
 public IEnumerator <string> GetEnumerator()
 {
     return(Lines.GetEnumerator());
 }
示例#20
0
    public void Update()
    {
        Tests.Screenshot(600, 400, "GuideUserInterface.jpg", new Vec3(-0.363f, 0.010f, 0.135f), new Vec3(-0.743f, -0.414f, -0.687f));
        Tests.Screenshot(400, 600, "GuideUserInterfaceCustom.jpg", new Vec3(0.225f, 0.0f, .175f), new Vec3(.4f, 0.0f, 0));

        /// :CodeDoc: Guides User Interface
        /// Then we'll move over to the application step where we'll do the
        /// rest of the UI code!
        ///
        /// We'll start with a window titled "Window" that's 20cm wide, and
        /// auto-resizes on the y-axis. The U class is pretty helpful here,
        /// as it allows us to reason more visually about the units we're
        /// using! StereoKit uses meters as its base unit, which look a
        /// little awkward as raw floats, especially in the millimeter range.
        ///
        /// We'll also use a toggle to turn the window's header on and off!
        /// The value from that toggle is passed in here via the showHeader
        /// field.
        ///
        UI.WindowBegin("Window", ref windowPose, new Vec2(20, 0) * U.cm, showHeader?UIWin.Normal:UIWin.Body);
        ///
        /// When you begin a window, all visual elements are now relative to
        /// that window! UI takes advantage of the Hierarchy class and pushes
        /// the window's pose onto the Hierarchy stack. Ending the window
        /// will pop the pose off the hierarchy stack, and return things to
        /// normal!
        ///
        /// Here's that toggle button! You'll also notice our use of 'ref'
        /// values in a lot of the UI code. UI functions typically follow the
        /// pattern of returning true/false to indicate they've been
        /// interacted with during the frame, so you can nicely wrap them in
        /// 'if' statements to react to change!
        ///
        /// Then with the 'ref' parameter, we let you pass in the current
        /// state of the UI element. The UI element will update that value
        /// for you based on user interaction, but you can also change it
        /// yourself whenever you want to!
        ///
        UI.Toggle("Show Header", ref showHeader);
        ///
        /// Here's an example slider! We start off with a label element, and
        /// tell the UI to keep the next item on the same line. The slider
        /// clamps to the range [0,1], and will step at intervals of 0.2. If
        /// you want it to slide continuously, you can just set the `step`
        /// value to 0!
        ///
        UI.Label("Slide");
        UI.SameLine();
        UI.HSlider("slider", ref slider, 0, 1, 0.2f, 72 * U.mm);
        ///
        /// Here's how you use a simple button! Just check it with an 'if'.
        /// Any UI method will return true on the frame when their value or
        /// state has changed.
        ///
        if (UI.ButtonRound("Exit", powerSprite))
        {
            SK.Quit();
        }
        ///
        /// And for every begin, there must also be an end! StereoKit will
        /// log errors when this occurs, so keep your eyes peeled for that!
        ///
        UI.WindowEnd();
        ///
        /// ## Custom Windows
        ///
        /// ![Simple UI]({{site.url}}/img/screenshots/GuideUserInterfaceCustom.jpg)
        ///
        /// Mixed Reality also provides us with the opportunity to turn
        /// objects into interfaces! Instead of using the old 'window'
        /// paradigm, we can create 3D models and apply UI elements to their
        /// surface! StereoKit uses 'handles' to accomplish this, a grabbable
        /// area that behaves much like a window, but with a few more options
        /// for customizing layout and size.
        ///
        /// We'll load up a clipboard, so we can attach an interface to that!
        ///
        /// ```csharp
        /// Model clipboard = Model.FromFile("Clipboard.glb");
        /// ```
        ///
        /// And, similar to the window previously, here's how you would turn
        /// it into a grabbable interface! This behaves the same, except
        /// we're defining where the grabbable region is specifically, and
        /// then drawing our own model instead of a plain bar. You'll also
        /// notice we're drawing using an identity matrix. This takes
        /// advantage of how HandleBegin pushes the handle's pose onto the
        /// Hierarchy transform stack!
        ///
        UI.HandleBegin("Clip", ref clipboardPose, clipboard.Bounds);
        Renderer.Add(clipboard, Matrix.Identity);
        ///
        /// Once we've done that, we also need to define the layout area of
        /// the model, where UI elements will go. This is different for each
        /// model, so you'll need to plan this around the size of your
        /// object!
        ///
        UI.LayoutArea(new Vec3(12, 15, 0) * U.cm, new Vec2(24, 30) * U.cm);
        ///
        /// Then after that? We can just add UI elements like normal!
        ///
        UI.Image(logoSprite, new Vec2(22, 0) * U.cm);

        UI.Toggle("Toggle", ref clipToggle);
        UI.HSlider("Slide", ref clipSlider, 0, 1, 0, 22 * U.cm);
        ///
        /// And while we're at it, here's a quick example of doing a radio
        /// button group! Not much 'radio' actually happening, but it's still
        /// pretty simple. Pair it with an enum, or an integer, and have fun!
        ///
        if (UI.Radio("Radio1", clipOption == 1))
        {
            clipOption = 1;
        }
        UI.SameLine();
        if (UI.Radio("Radio2", clipOption == 2))
        {
            clipOption = 2;
        }
        UI.SameLine();
        if (UI.Radio("Radio3", clipOption == 3))
        {
            clipOption = 3;
        }
        ///
        /// As with windows, Handles need an End call.
        ///
        UI.HandleEnd();
        ///
        /// And there you go! That's how UI works in StereoKit, pretty
        /// simple, huh? For further reference, and more UI methods, check
        /// out the [UI class documentation]({{site.url}}/Pages/Reference/UI.html).
        ///
        /// If you'd like to see the complete code for this sample,
        /// [check it out on Github](https://github.com/maluoi/StereoKit/blob/master/Examples/StereoKitTest/DemoUI.cs)!
        /// :End:


        /// :CodeSample: UI.InteractVolume
        /// This code will draw an axis at the index finger's location when
        /// the user pinches while inside an InteractVolume.
        ///
        /// ![UI.InteractVolume]({{site.screen_url}}/InteractVolume.jpg)
        ///
        // Draw a transparent volume so the user can see this space
        Vec3  volumeAt   = new Vec3(0, 0.2f, -0.4f);
        float volumeSize = 0.2f;

        Default.MeshCube.Draw(volumeMat, Matrix.TS(volumeAt, volumeSize));

        BtnState volumeState = UI.InteractVolume(new Bounds(volumeAt, Vec3.One * volumeSize), out Handed hand);

        if (volumeState != BtnState.Inactive)
        {
            // If it just changed interaction state, make it jump in size
            float scale = volumeState.IsChanged()
                                ? 0.1f
                                : 0.05f;
            Lines.AddAxis(Input.Hand(hand)[FingerId.Index, JointId.Tip].Pose, scale);
        }
        /// :End:

        Tests.Screenshot(1, 600, 600, "InteractVolume.jpg", new Vec3(-0.102f, 0.306f, -0.240f), new Vec3(0.410f, -0.248f, -0.897f));
    }
示例#21
0
 public void WriteLine(string text)
 {
     Lines.Add(text);
 }
示例#22
0
        public double DiffFromAverage()
        {
            var avg = TotalLength / Lines.Count;

            return(Lines.Sum(line => Math.Abs(avg - line.Length)));
        }
示例#23
0
        private void EmitBits(string bits, int index = 0)
        {
            var steps = bits.Split('|');
            var tabs  = "\t\t\t\t\t\t\t\t\t\t".Substring(0, index + 3);

            foreach (var s in steps)
            {
                if (string.IsNullOrWhiteSpace(s))
                {
                    continue;
                }

                if (s.StartsWith("["))                 // ignore these
                {
                    continue;
                }

                if (s.StartsWith("0x") | s.StartsWith("x"))
                {
                    // hex
                    string hex = s.StartsWith("x") ? s.Substring(1) : s.Substring(2);

                    Lines.Append(tabs);

                    switch (hex.Length)
                    {
                    case 1:
                        Lines.AppendLine("emitter.OpcodeEncoder.Append4Bits(0x" + hex + ");");
                        break;

                    case 2:
                        Lines.AppendLine("emitter.OpcodeEncoder.Append8Bits(0x" + hex + ");");
                        break;

                    case 3:
                        Lines.AppendLine("emitter.OpcodeEncoder.Append8Bits(0x" + hex.Substring(0, 2) + ");");
                        Lines.Append(tabs);
                        Lines.AppendLine("emitter.OpcodeEncoder.Append4Bits(0x" + hex.Substring(1) + ");");
                        break;

                    case 4:
                        Lines.AppendLine("emitter.OpcodeEncoder.AppendShort(0x" + hex + ");");
                        break;

                    case 5:
                        Lines.AppendLine("emitter.OpcodeEncoder.AppendShort(0x" + hex.Substring(0, 4) + ");");
                        Lines.Append(tabs);
                        Lines.AppendLine("emitter.OpcodeEncoder.Append4Bits(0x" + hex.Substring(5) + ");");
                        break;

                    case 8:
                        Lines.AppendLine("emitter.OpcodeEncoder.Append32Bits(0x" + hex + ");");
                        break;

                    default: throw new Exception("ERROR!");
                    }
                }
                else if (s.StartsWith("0b") | s.StartsWith("b") | s.StartsWith("0") | s.StartsWith("1"))
                {
                    // binary
                    string binary = s;

                    if (binary.StartsWith("0b"))
                    {
                        binary = s.Substring(2);
                    }

                    if (binary.StartsWith("b"))
                    {
                        binary = s.Substring(1);
                    }

                    Lines.Append(tabs);

                    switch (binary.Length)
                    {
                    case 1:
                        Lines.AppendLine("emitter.OpcodeEncoder.Append1Bit(0b" + binary + ");");
                        break;

                    case 2:
                        Lines.AppendLine("emitter.OpcodeEncoder.Append2Bits(0b" + binary + ");");
                        break;

                    case 3:
                        Lines.AppendLine("emitter.OpcodeEncoder.Append3Bits(0b" + binary + ");");
                        break;

                    case 4:
                        Lines.AppendLine("emitter.OpcodeEncoder.Append4Bits(0b" + binary + ");");
                        break;

                    case 5:
                        Lines.AppendLine("emitter.OpcodeEncoder.Append4Bits(0b" + binary.Substring(0, 4) + ");");
                        Lines.Append(tabs);
                        Lines.AppendLine("emitter.OpcodeEncoder.Append1Bit(0b" + binary.Substring(4) + ");");
                        break;

                    case 6:
                        Lines.AppendLine("emitter.OpcodeEncoder.Append4Bits(0b" + binary.Substring(0, 4) + ");");
                        Lines.Append(tabs);
                        Lines.AppendLine("emitter.OpcodeEncoder.Append2Bits(0b" + binary.Substring(4) + ");");
                        break;

                    case 7:
                        Lines.AppendLine("emitter.OpcodeEncoder.Append4Bits(0b" + binary.Substring(0, 4) + ");");
                        Lines.Append(tabs);
                        Lines.AppendLine("emitter.OpcodeEncoder.Append3Bits(0b" + binary.Substring(4) + ");");
                        break;

                    case 8:
                        Lines.AppendLine("emitter.OpcodeEncoder.Append4Bits(0b" + binary.Substring(0, 4) + ");");
                        Lines.Append(tabs);
                        Lines.AppendLine("emitter.OpcodeEncoder.Append4Bits(0b" + binary.Substring(4) + ");");
                        break;

                    default: throw new Exception("ERROR!");
                    }
                }
                else
                {
                    var parts = s.Split(':');

                    var code     = string.Empty;
                    var postcode = string.Empty;

                    GetCodes(parts[0], ref code, ref postcode);

                    var operand  = (parts.Length > 1) ? GetOperand(parts[1]) : string.Empty;
                    var operand2 = (parts.Length > 2) ? GetOperand(parts[2]) : null;

                    Lines.Append(tabs);

                    if (operand2 == null)
                    {
                        Lines.AppendLine("emitter.OpcodeEncoder." + code + "(" + operand + postcode + ");");
                    }
                    else
                    {
                        Lines.AppendLine("emitter.OpcodeEncoder." + code + "(" + operand + postcode + ", " + operand2 + ");");
                    }
                }
            }
        }
示例#24
0
        public void add(string type, Node node, Line line, Position position = null, int layer = 0)
        {
            Nodes nodes = new Nodes();
            if (node != null)
            {
                nodes.Add(new Node(node));
            }

            Lines lines = new Lines();
            if (line != null)
            {
                lines.Add(new Line(line));
            }
            this.add(type, nodes, lines, position, layer);
        }
 public virtual void DeleteLine(ReassessmentLine line)
 {
     line.SrcStock.Release(line.Quantity);
     line.DstStock.ReservedQuantity -= line.Quantity;
     Lines.Remove(line);
 }
示例#26
0
        public void add(string type, Nodes nodes = null, Lines lines = null, Position position = null, int layer = 0)
        {
            operations.Push(
                new UndoOperation(
                    type,
                    (nodes != null) ? new Nodes(nodes) : null,
                    (lines != null) ? new Lines(lines) : null,
                    (grouping) ? group : 0, // add multiple operations into one undo group
                    position,
                    layer
                )
            );

            this.saved++;

            // forgot undo operation
            if (reverseOperations.Count() > 0)
            {
                if (this.saved > 0) // save is in redo but if redo is cleared theh save is lost
                {
                    this.saveLost = true;
                }
                reverseOperations.Clear();
            }
        }
示例#27
0
 public Ubi(FileInfo file, Lines lines)
     : base(file, lines)
 {
 }
示例#28
0
        public bool doUndo(DiagramView view = null)
        {
            if (operations.Count() == 0)
            {
                return false;
            }

            int group = 0;

            bool result = false;

            do
            {
                UndoOperation operation = operations.First();

                // first restore position where change occurred
                if (view != null && !view.isOnPosition(operation.position, operation.layer))
                {
                    view.goToShift(operation.position);
                    view.goToLayer(operation.layer);
                    view.Invalidate();
                    return false;
                }

                // process all operations in same group
                if (group != 0 && operation.group != group)
                {
                    group = 0;
                    break;
                }

                group = operation.group;

                if (operation.type == "delete")
                {
                    this.doUndoDelete(operation);
                    reverseOperations.Push(operation);
                }

                if (operation.type == "create")
                {
                    this.doUndoCreate(operation);
                    reverseOperations.Push(operation);
                }

                if (operation.type == "edit" ||
                    operation.type == "move" ||
                    operation.type == "changeLineColor" ||
                    operation.type == "changeLineWidth" ||
                    operation.type == "changeNodeColor"
                )
                {
                    Nodes nodes = new Nodes();
                    foreach (Node node in operation.nodes)
                    {
                        nodes.Add(this.diagram.GetNodeByID(node.id));
                    }

                    Lines lines = new Lines();
                    foreach (Line line in operation.lines)
                    {
                        lines.Add(this.diagram.getLine(line.start, line.end));
                    }

                    UndoOperation roperation = new UndoOperation(
                        operation.type,
                        nodes,
                        lines,
                        operation.group,
                        operation.position,
                        operation.layer
                    );
                    reverseOperations.Push(roperation);
                    this.doUndoEdit(operation);
                }

                operations.Pop();
                result = true;
            } while (group != 0 && operations.Count() > 0);

            if (result)
            {
                this.saved--;
                if (!this.saveLost && this.saved == 0)
                {
                    this.diagram.restoresave();
                }
                else
                {
                    this.diagram.unsave();
                }
            }

            return result;
        }
示例#29
0
    public override void Process()
    {
        Rect rect = Rect;

        m_Lines.Clear();
        m_LineGroup.Clear();
        m_Line.Clear();

        foreach (BitmapLine line in Lines)
        {
            if (CalcWidth(line) <= rect.width)
            {
                m_Lines.Add(line);
                continue;
            }

            float lineWidth = 0;

            foreach (BitmapCharacter[] word in line.GetWords())
            {
                float wordWidth = CalcWidth(word);

                if (m_Line.Count > 0 && lineWidth + wordWidth > rect.width)
                {
                    lineWidth = 0;

                    m_LineGroup.Add(new BitmapLine(m_Line));
                    m_Line.Clear();
                }

                lineWidth += wordWidth + CharSpacing;

                m_Line.AddRange(word);
            }
            m_LineGroup.Add(new BitmapLine(m_Line));
            m_Line.Clear();

            if (m_LineGroup.Count >= 2)
            {
                m_LineGroup[0].TrimEnd();

                for (int i = 1; i < m_LineGroup.Count - 1; i++)
                {
                    m_LineGroup[i].Trim();
                }

                m_LineGroup[m_LineGroup.Count - 1].TrimStart();

                for (int i = m_LineGroup.Count - 1; i >= 0; i--)
                {
                    if (m_LineGroup[i].IsEmpty)
                    {
                        m_LineGroup.RemoveAt(i);
                    }
                }
            }

            m_Lines.AddRange(m_LineGroup);
            m_LineGroup.Clear();
        }

        Lines.Clear();
        Lines.AddRange(m_Lines);

        m_PositionProcessor.Process();
    }
示例#30
0
    private void stuff()
    {
        script = (Lines)target; //the script this class is targeting

        //reorderableList = new ReorderableList(script.lines, typeof(string), true, true, true, true);
        reorderableList = new ReorderableList(serializedObject, serializedObject.FindProperty("lines"), true, true, true, true); //a list of all lines
        width1 = 90; //width of item 1, for easy reference
        reorderableList.elementHeight = 40; //this is also the width of item2
        leftCharacter = serializedObject.FindProperty("leftCharacter");
        rightCharacter = serializedObject.FindProperty("rightCharacter");

        //Draws one element of the list
        reorderableList.drawElementCallback = (Rect rect, int index, bool isActive, bool isFocused) => {
            EditorGUI.BeginChangeCheck();

            SerializedProperty element = reorderableList.serializedProperty.GetArrayElementAtIndex(index);

            //edge offset
            rect.x += 2;

            //speaker enum
            float yCenter = (rect.height - EditorGUIUtility.singleLineHeight)/2; //for Y-Centering the enum
            EditorGUI.PropertyField(
                new Rect(rect.x, rect.y + yCenter, width1, rect.height),
                element.FindPropertyRelative("speaker"), GUIContent.none);

            //area of next item, + spacing
            rect.x += width1 + 2;
            rect.width -= width1 + 2;

            //sprite
            SerializedProperty spriteProp = element.FindPropertyRelative("sprite");
            Sprite sprite = (Sprite)spriteProp.objectReferenceValue;
            float width2; //width of the sprite thumbnail
            if (sprite == null) {
                width2 = rect.height;
            } else {
                width2 = sprite.rect.width * (rect.height / sprite.rect.height);
                if (width2 > rect.height) {
                    width2 = rect.height;
                }
            }
            float xCenter = (rect.height - width2)/2; //used to center the sprite
            spriteProp.objectReferenceValue = (Sprite)EditorGUI.ObjectField(new Rect(rect.x + xCenter, rect.y, width2, rect.height),
                 sprite, typeof(Sprite), false);

            //draw next in line
            rect.x += rect.height + 2;
            rect.width -= rect.height + 2;
            rect.y++; //spacing between textboxes
            rect.height--;

            //text
            EditorGUI.PropertyField(rect, element.FindPropertyRelative("text"), GUIContent.none);

            if (EditorGUI.EndChangeCheck()) {
                EditorUtility.SetDirty(target);
            }

        };

        //Now add listeners for the ReorderableList (it's kind of outdated so it doesn't update through onInpectorGUI)

        // Draws the header of the list
        reorderableList.drawHeaderCallback = (Rect rect) => {
            rect.x += 14; //shift everything to the right
            GUI.Label(new Rect(rect.x, rect.y, width1, rect.height), "Speaker:");
            rect.x += width1 + 2;
            rect.width -= width1 + 2;
            GUI.Label(new Rect(rect.x, rect.y, reorderableList.elementHeight, rect.height), "Sprite:");
            rect.x += reorderableList.elementHeight + 2;
            rect.width -= reorderableList.elementHeight + 2;
            GUI.Label(rect, "Lines:");
        };

        reorderableList.onAddCallback = (ReorderableList list) => {
            /*
            script.lines.Add("");
            script.sprites.Add(null);
            */

            var index = list.serializedProperty.arraySize;
            list.serializedProperty.arraySize++;
            list.index = index;
            var element = list.serializedProperty.GetArrayElementAtIndex(index);
            element.FindPropertyRelative("speaker").enumValueIndex = 0;
            element.FindPropertyRelative("sprite").objectReferenceValue = null;
            element.FindPropertyRelative("text").stringValue = "";

            EditorUtility.SetDirty(target);
        };
        reorderableList.onRemoveCallback = (ReorderableList list) => {
            /*
            script.lines.RemoveAt(list.index);
            script.sprites.RemoveAt(list.index);
            */
            ReorderableList.defaultBehaviours.DoRemoveButton(list);
            EditorUtility.SetDirty(target);
        };

        // This could be used aswell, but I only advise this your class inherrits from UnityEngine.Object or has a CustomPropertyDrawer
        // Since you'll find your item using: serializedObject.FindProperty("list").GetArrayElementAtIndex(index).objectReferenceValue
        // which is a UnityEngine.Object
        // reorderableList = new ReorderableList(serializedObject, serializedObject.FindProperty("list"), true, true, true, true);
    }
示例#31
0
        public Lines lines = new Lines();          // all layer lines

        /*************************************************************************************************************************/
        // CONSTRUCTORS

        /// <summary>
        /// LAYER construct
        /// </summary>
        public Layer(Nodes nodes = null, Lines lines = null)
        {
            this.nodes = nodes;
            this.lines = lines;
        }
示例#32
0
        /// <summary>
        /// Check if operation is same as previous operation 
        /// If previous operation is move node (by arrow forexample) is better group operation like one big move instead of many small moves.
        /// </summary>
        public bool isSame(string type, Nodes nodes, Lines lines)
        {
            if (operations.Count()>0)
            {

                UndoOperation operation = operations.First();

                if (operation.type == type)
                {

                    if (operation.nodes.Count() == 0 && nodes == null)
                    {
                    }
                    else if ((operation.nodes == null && nodes != null) || (operation.nodes != null && nodes == null))
                    {
                        return false;
                    }
                    else if (operation.nodes.Count() == nodes.Count())
                    {
                        for (int i = 0; i < nodes.Count(); i++)
                        {
                            if (operation.nodes[i].id != nodes[i].id)
                            {
                                return false;
                            }
                        }
                    }
                    else
                    {
                        return false;
                    }

                    if (operation.lines.Count() == 0 && lines == null)
                    {
                    }
                    else if ((operation.lines == null && lines != null) || (operation.lines != null && lines == null))
                    {
                        return false;
                    }
                    else if (operation.lines.Count() == lines.Count())
                    {
                        for (int i = 0; i < lines.Count(); i++)
                        {
                            if (operation.lines[i].start != lines[i].start || operation.lines[i].end != lines[i].end)
                            {
                                return false;
                            }
                        }
                    }
                    else
                    {
                        return false;
                    }

                    return true;
                }
            }

            return false;
        }
 /// <summary>����Ԓl���̕`��͈͂�ݒ肷��</summary>
 /// <param name="line">����</param>
 /// <param name="lineProperty">����Ԓl���̕`��͈�</param>
 public static void SetLineProperty(Lines line, LineProperty lineProperty)
 {
     if (lineProperties.ContainsKey(line))
     {
         lineProperties[line] = lineProperty;
     }
 }
示例#34
0
        public Graph PopulateLines(params Line[] lines)
        {
            Lines.AddRange(lines);

            return(this);
        }
示例#35
0
        public Lines getAllLinesFromNode(Node node)
        {
            Lines lines = new Lines();

            Layer layer = this.getLayer(node);

            if (layer != null)
            {
                foreach (Line line in layer.lines)
                {
                    if (line.start == node.id || line.end == node.id)
                    {
                        lines.Add(line);
                    }
                }
            }

            return lines;
        }
示例#36
0
        public Graph ChangeAllLinesColor(Color color)
        {
            Lines.ForEach(l => l.ChangeColor(color));

            return(this);
        }
示例#37
0
        // get all lines for all children nodes
        public Lines getAllSubNodeLines(Node node)
        {
            Lines lines = new Lines();

            if (node.haslayer)
            {
                Layer layer = this.getLayer(node.id);

                foreach (Line line in layer.lines)
                {
                    lines.Add(line);
                }

                foreach (Node subNode in layer.nodes)
                {
                    if (node.haslayer)
                    {
                        Lines sublines = this.getAllSubNodeLines(subNode);

                        foreach (Line line in sublines)
                        {
                            lines.Add(line);
                        }
                    }
                }
            }

            return lines;
        }
示例#38
0
 public Restart(Lines lines)//констуктор класса рестарт
 {
     _lines = lines;
 }
示例#39
0
        protected override void Body(dynamic node = null)
        {
            //int id = Identifiers.GetInstructionID();

            Lines.AppendLine("using Mosa.Compiler.Framework;");

            if (node.ResultType != null || node.ResultType2 != null)
            {
                Lines.AppendLine("using Mosa.Compiler.MosaTypeSystem;");
            }

            Lines.AppendLine();
            Lines.AppendLine("namespace Mosa.Platform." + Platform + ".Instructions");
            Lines.AppendLine("{");
            Lines.AppendLine("\t/// <summary>");
            Lines.Append("\t/// " + node.Name);

            if (!string.IsNullOrWhiteSpace(node.Description))
            {
                Lines.Append(" - " + node.Description);
            }

            Lines.AppendLine();
            Lines.AppendLine("\t/// </summary>");
            Lines.AppendLine("\t/// <seealso cref=\"Mosa.Platform." + Platform + "." + NormalizedPlatform + "Instruction\" />");
            Lines.AppendLine("\tpublic sealed class " + node.Name + " : " + NormalizedPlatform + "Instruction");
            Lines.AppendLine("\t{");
            Lines.AppendLine("\t\tinternal " + node.Name + "()");
            Lines.AppendLine("\t\t\t: base(" + node.ResultCount + ", " + node.OperandCount + ")");
            Lines.AppendLine("\t\t{");
            Lines.AppendLine("\t\t}");

            var FlagsUsed      = node.FlagsUsed == null ? string.Empty : node.FlagsUsed.ToUpper();           // tested_f
            var FlagsSet       = node.FlagsSet == null ? string.Empty : node.FlagsSet.ToUpper();             // values_f (upper=set, lower=cleared)
            var FlagsCleared   = node.FlagsCleared == null ? string.Empty : node.FlagsCleared.ToUpper();     // above
            var FlagsModified  = node.FlagsModified == null ? string.Empty : node.FlagsModified.ToUpper();   // modif_f
            var FlagsUndefined = node.FlagsUndefined == null ? string.Empty : node.FlagsUndefined.ToUpper(); // undef_f

            if (node.AlternativeName != null)
            {
                Lines.AppendLine();
                Lines.AppendLine("\t\tpublic override string AlternativeName { get { return \"" + node.AlternativeName + "\"; } }");
            }

            if (node.FlowControl != null && node.FlowControl != "Next")
            {
                Lines.AppendLine();
                Lines.AppendLine("\t\tpublic override FlowControl FlowControl { get { return FlowControl." + node.FlowControl + "; } }");
            }

            if (node.ResultType != null && node.ResultType != "")
            {
                Lines.AppendLine();
                Lines.AppendLine("\t\tpublic override BuiltInType ResultType { get { return BuiltInType." + node.ResultType + "; } }");
            }

            if (node.ResultType2 != null && node.ResultType2 != "")
            {
                Lines.AppendLine();
                Lines.AppendLine("\t\tpublic override BuiltInType ResultType2 { get { return BuiltInType." + node.ResultType2 + "; } }");
            }

            if (node.IgnoreDuringCodeGeneration != null && node.IgnoreDuringCodeGeneration == "true")
            {
                Lines.AppendLine();
                Lines.AppendLine("\t\tpublic override bool IgnoreDuringCodeGeneration { get { return true; } }");
            }

            if (node.IgnoreInstructionBasicBlockTargets != null && node.IgnoreInstructionBasicBlockTargets == "true")
            {
                Lines.AppendLine();
                Lines.AppendLine("\t\tpublic override bool IgnoreInstructionBasicBlockTargets { get { return true; } }");
            }

            if (node.VariableOperands != null && node.VariableOperands == "true")
            {
                Lines.AppendLine();
                Lines.AppendLine("\t\tpublic override bool VariableOperands { get { return true; } }");
            }

            if (node.Commutative != null && node.Commutative == "true")
            {
                Lines.AppendLine();
                Lines.AppendLine("\t\tpublic override bool IsCommutative { get { return true; } }");
            }

            if (node.MemoryWrite != null && node.MemoryWrite == "true")
            {
                Lines.AppendLine();
                Lines.AppendLine("\t\tpublic override bool IsMemoryWrite { get { return true; } }");
            }

            if (node.MemoryRead != null && node.MemoryRead == "true")
            {
                Lines.AppendLine();
                Lines.AppendLine("\t\tpublic override bool IsMemoryRead { get { return true; } }");
            }

            if (node.IOOperation != null && node.IOOperation == "true")
            {
                Lines.AppendLine();
                Lines.AppendLine("\t\tpublic override bool IsIOOperation { get { return true; } }");
            }

            if (node.UnspecifiedSideEffect != null && node.UnspecifiedSideEffect == "true")
            {
                Lines.AppendLine();
                Lines.AppendLine("\t\tpublic override bool HasUnspecifiedSideEffect { get { return true; } }");
            }

            if (node.ThreeTwoAddressConversion != null && node.ThreeTwoAddressConversion == "true")
            {
                Lines.AppendLine();
                Lines.AppendLine("\t\tpublic override bool ThreeTwoAddressConversion { get { return true; } }");
            }

            if (FlagsUsed.Contains("Z") || FlagsUsed == "CONDITIONAL")
            {
                Lines.AppendLine();
                Lines.AppendLine("\t\tpublic override bool IsZeroFlagUsed { get { return true; } }");
            }

            if (FlagsSet.Contains("Z"))
            {
                Lines.AppendLine();
                Lines.AppendLine("\t\tpublic override bool IsZeroFlagSet { get { return true; } }");
            }

            if (FlagsCleared.Contains("Z"))
            {
                Lines.AppendLine();
                Lines.AppendLine("\t\tpublic override bool IsZeroFlagCleared { get { return true; } }");
            }

            if (FlagsModified.Contains("Z") || FlagsSet.Contains("Z") || FlagsCleared.Contains("Z"))
            {
                Lines.AppendLine();
                Lines.AppendLine("\t\tpublic override bool IsZeroFlagModified { get { return true; } }");
            }

            if (FlagsUndefined.Contains("Z"))
            {
                Lines.AppendLine();
                Lines.AppendLine("\t\tpublic override bool IsZeroFlagUnchanged { get { return true; } }");
            }

            if (FlagsUndefined.Contains("Z"))
            {
                Lines.AppendLine();
                Lines.AppendLine("\t\tpublic override bool IsZeroFlagUndefined { get { return true; } }");
            }

            if (FlagsUsed.Contains("C") || FlagsUsed == "CONDITIONAL")
            {
                Lines.AppendLine();
                Lines.AppendLine("\t\tpublic override bool IsCarryFlagUsed { get { return true; } }");
            }

            if (FlagsSet.Contains("C"))
            {
                Lines.AppendLine();
                Lines.AppendLine("\t\tpublic override bool IsCarryFlagSet { get { return true; } }");
            }

            if (FlagsCleared.Contains("C"))
            {
                Lines.AppendLine();
                Lines.AppendLine("\t\tpublic override bool IsCarryFlagCleared { get { return true; } }");
            }

            if (FlagsModified.Contains("C") || FlagsSet.Contains("C") || FlagsCleared.Contains("C"))
            {
                Lines.AppendLine();
                Lines.AppendLine("\t\tpublic override bool IsCarryFlagModified { get { return true; } }");
            }

            if (FlagsUndefined.Contains("C"))
            {
                Lines.AppendLine();
                Lines.AppendLine("\t\tpublic override bool IsCarryFlagUnchanged { get { return true; } }");
            }

            if (FlagsUndefined.Contains("C"))
            {
                Lines.AppendLine();
                Lines.AppendLine("\t\tpublic override bool IsCarryFlagUndefined { get { return true; } }");
            }

            if (FlagsUsed.Contains("S") || FlagsUsed.Contains("N") || FlagsUsed == "CONDITIONAL")
            {
                Lines.AppendLine();
                Lines.AppendLine("\t\tpublic override bool IsSignFlagUsed { get { return true; } }");
            }

            if (FlagsSet.Contains("S") || FlagsSet.Contains("N"))
            {
                Lines.AppendLine();
                Lines.AppendLine("\t\tpublic override bool IsSignFlagSet { get { return true; } }");
            }

            if (FlagsCleared.Contains("S") || FlagsCleared.Contains("N"))
            {
                Lines.AppendLine();
                Lines.AppendLine("\t\tpublic override bool IsSignFlagCleared { get { return true; } }");
            }

            if (FlagsModified.Contains("S") || FlagsSet.Contains("S") || FlagsCleared.Contains("S") ||
                FlagsModified.Contains("N") || FlagsSet.Contains("N") || FlagsCleared.Contains("N")
                )
            {
                Lines.AppendLine();
                Lines.AppendLine("\t\tpublic override bool IsSignFlagModified { get { return true; } }");
            }

            if (FlagsUndefined.Contains("S") || FlagsUndefined.Contains("N"))
            {
                Lines.AppendLine();
                Lines.AppendLine("\t\tpublic override bool IsSignFlagUnchanged { get { return true; } }");
            }

            if (FlagsUndefined.Contains("S") || FlagsUndefined.Contains("N"))
            {
                Lines.AppendLine();
                Lines.AppendLine("\t\tpublic override bool IsSignFlagUndefined { get { return true; } }");
            }

            if (FlagsUsed.Contains("O") || FlagsUsed.Contains("V") || FlagsUsed == "CONDITIONAL")
            {
                Lines.AppendLine();
                Lines.AppendLine("\t\tpublic override bool IsOverflowFlagUsed { get { return true; } }");
            }

            if (FlagsSet.Contains("O") || FlagsSet.Contains("V"))
            {
                Lines.AppendLine();
                Lines.AppendLine("\t\tpublic override bool IsOverflowFlagSet { get { return true; } }");
            }

            if (FlagsCleared.Contains("O") || FlagsCleared.Contains("V"))
            {
                Lines.AppendLine();
                Lines.AppendLine("\t\tpublic override bool IsOverflowFlagCleared { get { return true; } }");
            }

            if (FlagsModified.Contains("O") || FlagsSet.Contains("O") || FlagsCleared.Contains("O") ||
                FlagsModified.Contains("V") || FlagsSet.Contains("V") || FlagsCleared.Contains("V"))
            {
                Lines.AppendLine();
                Lines.AppendLine("\t\tpublic override bool IsOverflowFlagModified { get { return true; } }");
            }

            if (FlagsUndefined.Contains("O") || FlagsUndefined.Contains("V"))
            {
                Lines.AppendLine();
                Lines.AppendLine("\t\tpublic override bool IsOverflowFlagUnchanged { get { return true; } }");
            }

            if (FlagsUndefined.Contains("O") || FlagsUndefined.Contains("V"))
            {
                Lines.AppendLine();
                Lines.AppendLine("\t\tpublic override bool IsOverflowFlagUndefined { get { return true; } }");
            }

            if (FlagsUsed.Contains("P") || FlagsUsed == "CONDITIONAL")
            {
                Lines.AppendLine();
                Lines.AppendLine("\t\tpublic override bool IsParityFlagUsed { get { return true; } }");
            }

            if (FlagsSet.Contains("P"))
            {
                Lines.AppendLine();
                Lines.AppendLine("\t\tpublic override bool IsParityFlagSet { get { return true; } }");
            }

            if (FlagsCleared.Contains("P"))
            {
                Lines.AppendLine();
                Lines.AppendLine("\t\tpublic override bool IsParityFlagCleared { get { return true; } }");
            }

            if (FlagsModified.Contains("P") || FlagsSet.Contains("P") || FlagsCleared.Contains("P"))
            {
                Lines.AppendLine();
                Lines.AppendLine("\t\tpublic override bool IsParityFlagModified { get { return true; } }");
            }

            if (FlagsUndefined.Contains("P"))
            {
                Lines.AppendLine();
                Lines.AppendLine("\t\tpublic override bool IsParityFlagUnchanged { get { return true; } }");
            }

            if (FlagsUndefined.Contains("P"))
            {
                Lines.AppendLine();
                Lines.AppendLine("\t\tpublic override bool IsParityFlagUndefined { get { return true; } }");
            }

            if (FlagsUsed != null && FlagsUsed == "CONDITIONAL")
            {
                Lines.AppendLine();
                Lines.AppendLine("\t\tpublic override bool AreFlagUseConditional { get { return true; } }");
            }

            if (node.StaticEmitMethod != null)
            {
                Lines.AppendLine();
                Lines.AppendLine("\t\tpublic override void Emit(InstructionNode node, BaseCodeEmitter emitter)");
                Lines.AppendLine("\t\t{");

                if (node.VariableOperands == null || node.VariableOperands == "false")
                {
                    Lines.AppendLine("\t\t\tSystem.Diagnostics.Debug.Assert(node.ResultCount == DefaultResultCount);");
                    Lines.AppendLine("\t\t\tSystem.Diagnostics.Debug.Assert(node.OperandCount == DefaultOperandCount);");
                    Lines.AppendLine();
                }

                Lines.AppendLine("\t\t\t" + node.StaticEmitMethod.Replace("%", node.Name) + "(node, emitter);");
                Lines.AppendLine("\t\t}");
            }

            if (node.OpcodeEncoding != null)
            {
                Lines.AppendLine();
                Lines.AppendLine("\t\tpublic override void Emit(InstructionNode node, BaseCodeEmitter emitter)");
                Lines.AppendLine("\t\t{");
                if (node.VariableOperands == null || node.VariableOperands == "false")
                {
                    Lines.AppendLine("\t\t\tSystem.Diagnostics.Debug.Assert(node.ResultCount == " + node.ResultCount + ");");
                    Lines.AppendLine("\t\t\tSystem.Diagnostics.Debug.Assert(node.OperandCount == " + node.OperandCount + ");");

                    if (node.ThreeTwoAddressConversion != null && node.ThreeTwoAddressConversion == "true")
                    {
                        Lines.AppendLine("\t\t\tSystem.Diagnostics.Debug.Assert(node.Result.IsCPURegister);");
                        Lines.AppendLine("\t\t\tSystem.Diagnostics.Debug.Assert(node.Operand1.IsCPURegister);");
                        Lines.AppendLine("\t\t\tSystem.Diagnostics.Debug.Assert(node.Result.Register == node.Operand1.Register);");
                    }
                    Lines.AppendLine();
                }

                CreateEncoding(node);

                Lines.AppendLine("\t\t}");
            }

            Lines.AppendLine("\t}");
            Lines.AppendLine("}");
        }
 /// <summary>
 ///     Recolors the beat snap lines to the appropriate config color
 /// </summary>
 private void RecolorLines() => Lines.ForEach(x => x.Tint = GetLineColor(x.Index % Ruleset.Screen.BeatSnap.Value, x.Index));
 internal string GetContents()
 {
     // Return lines before, plus ordered compile files, plus lines after
     return(string.Join(Environment.NewLine, Lines.Take(ProjectFileIndexStart).Concat(ProjectFiles.Keys).Concat(Lines.Skip(ProjectFileIndexEnd))));
 }
 /// <summary>
 ///     Shows ONLY measure lines if the user wants it in config
 /// </summary>
 private void ShowMeasureLineIfApplicable() => Lines.ForEach(x => x.Visible = ConfigManager.EditorOnlyShowMeasureLines.Value && x.IsMeasureLine ||
                                                                              !ConfigManager.EditorOnlyShowMeasureLines.Value);
示例#43
0
        public void GetBillLines(StreamReader reader, Bill bill)
        {
            var lineCount = 0;

            if (NumberOfBillLines == 0)
            {
                return;
            }

            for (var i = 0; i < NumberOfBillLines; i++)
            {
                var billLine = new Line {
                    Number = i + 1
                };
                string line;
                while (lineCount < 10 && (line = reader.ReadLine()) != null)
                {
                    int    tempInt;
                    double tempDouble;
                    switch (lineCount)
                    {
                    default:
                        billLine.TotalQuantity = int.TryParse(line, out tempInt) ? tempInt : 0;
                        break;

                    case 1:
                        billLine.UnitQuantity = int.TryParse(line, out tempInt) ? tempInt : 0;
                        break;

                    case 2:
                        billLine.Material = line;
                        break;

                    case 3:
                        billLine.SteelGrade = line;
                        break;

                    case 4:
                        billLine.Length = double.TryParse(line, out tempDouble) ? tempDouble : 0;
                        break;

                    case 5:
                        billLine.MinorMark = line;
                        break;

                    case 6:
                        billLine.UnitWeight = double.TryParse(line, out tempDouble) ? tempDouble : 0;
                        break;

                    case 7:
                        billLine.TotalWeight = double.TryParse(line, out tempDouble) ? tempDouble : 0;
                        break;

                    case 8:
                        billLine.Remarks = line;
                        break;

                    case 9:
                        billLine.AdvanceMill = line;
                        break;
                    }

                    lineCount++;
                }

                Lines.Add(billLine);
                lineCount = 0;
            }
        }
示例#44
0
 private void CalculateSubTotal()
 {
     SubTotal = Lines.Sum(a => a.GetLineTotal());
 }
示例#45
0
        //Properties
        //public List<NodeMeta> Data { get; set; }

        //protected NodeMeta GetMetaData(NodeMeta nm)
        //{
        //    return Data.FirstOrDefault((c) => { return c.DataType == nm.DataType && c.SId == nm.SId; });
        //}

        //public override bool AddObject(NodeMeta data)
        //{
        //    if (null == data) return false;
        //    _BindTag = false;
        //    bool result = false;
        //    result = Data.IndexOf(data) < 0;
        //    if (result)
        //        Data.Add(data);
        //    return result;
        //}

        //public List<NodeMeta> GetAllMetaData()
        //{
        //    return new List<NodeMeta>(Data);
        //}
        /// <summary>
        /// ?need some desirable detail for the method
        /// </summary>
        /// <param name="meta"></param>
        public void MegerGraphic(GraphicMeta meta)
        {
            if (subject_id == 0)
            {
                subject_id   = meta.subject_id;
                subject_type = meta.subject_type;
                title        = meta.title;
                Version      = meta.Version;
                base.note    = meta.note;
            }

            //foreach (NodeMeta node in meta.Nodes)
            for (int index = meta.Nodes.Count - 1; index >= 0; index--)
            {
                NodeMeta node      = meta.Nodes[index];
                NodeMeta existNode = GetNoteMetaByInnerId(node.SId, node.DataType);
                if (existNode == null)
                {
                    node.State = MetaState.New;
                    Nodes.Add(node);
                    //AddObject(meta.GetMetaData(node));
                }
                else
                {
                    node.Left = existNode.Left;
                    node.Top  = existNode.Top;
                    meta.Nodes.RemoveAt(index);
                }
            }

            //
            //The line collection whose elements are copied to the new list named copyLines.
            //
            List <LineMeta> copyLines = new List <LineMeta>(Lines);

            //foreach (LineMeta line in meta.Lines)
            for (int index = meta.Lines.Count - 1; index >= 0; index--)
            {
                LineMeta line       = meta.Lines[index];
                bool     lineExists = false;
                foreach (LineMeta l in copyLines)
                {
                    if ((l.FromId == line.FromId && l.FromType == line.FromType &&
                         l.ToId == line.ToId && l.ToType == line.ToType) ||
                        (l.FromId == line.ToId && l.FromType == line.ToType &&
                         l.ToId == line.FromId && l.ToType == line.FromType)
                        )
                    {
                        lineExists = true;
                        break;
                    }
                }
                if (!lineExists)
                {
                    line.State = MetaState.New;
                    Lines.Add(line);
                }
                else
                {
                    meta.Lines.RemoveAt(index);
                }
            }
        }
示例#46
0
    void CheckDrawLine()
    {
        bool wipe = false;

        if (Input.GetMouseButtonDown(0))
        {
            //Started drawing!
            drawing = true;

            //start drawing lines
            Ray        ray = cam.ViewportPointToRay(new Vector3(0.5f, 0.5f, 0));
            RaycastHit hit;
            if (Physics.Raycast(ray, out hit, 1000, mask))
            {
                Nodes.Node n = Nodes.FindNearestNode(hit.point);

                //check this is a valid pos
                if (Nodes.CheckValidNode(n))
                {
                    lineId      = Lines.RegisterNewLine();
                    startPos    = n.pos;
                    startNodeId = n.uId;
                    Lines.AddPoint(n, lineId);
                }
                else
                {
                    //else, fail out
                    drawing = false;
                }
            }
        }
        if (Input.GetMouseButtonUp(0))
        {
            if (drawing)
            {
                //Add last point
                Ray        ray = cam.ViewportPointToRay(new Vector3(0.5f, 0.5f, 0));
                RaycastHit hit;
                if (Physics.Raycast(ray, out hit, 1000, mask))
                {
                    Nodes.Node n = Nodes.FindNearestNode(hit.point);
                    if (n.uId == startNodeId)
                    {
                        wipe = true;
                    }
                    else
                    {
                        //check this is a valid pos
                        if (Nodes.CheckValidNode(n))
                        {
                            Lines.AddPoint(n, lineId);
                        }
                        else
                        {
                            wipe = true;
                        }
                    }
                }

                if (wipe)
                {
                    //kill the line
                    Lines.DeleteLine(lineId);
                }
                else
                {
                    lastLineId = lineId;
                }
                //Released!
                drawing = false;
                lineId  = -1;
            }
        }
        if (Input.GetMouseButton(0))
        {
            if (drawing)
            {
                Ray        ray = cam.ViewportPointToRay(new Vector3(0.5f, 0.5f, 0));
                RaycastHit hit;
                if (Physics.Raycast(ray, out hit, 1000, mask))
                {
                    Vector3 point = hit.point;
                    Debug.DrawLine(startPos, point, Color.red);
                }
            }
        }
    }
示例#47
0
 static void Main()
 {
     Lines3D x = new Lines3D();
     Lines max = new Lines();
     max.Count = 0;
     max.Length = 0;
     for (int h = 0; h < x.H; h++)
     {
         for (int d = 0; d < x.D; d++)
         {
             for (int w = 0; w < x.W; w++)
             {
                 Lines local = x.GetLongestLines(h, d, w);
                 if (max.Length < local.Length)
                 {
                     max.Length = local.Length;
                     max.Count = local.Count;
                 }
                 else if (max.Length == local.Length)
                 {
                     max.Count += local.Count;
                 }
             }
         }
     }
     max.Print();
 }
示例#48
0
        public ActionResult Words(Input data)
        {
            string          urlReferrer = "#@$@#%@$^$@#!@@#!";
            MySqlConnection myConn      = new MySqlConnection(TaqtiController.connectionString);
            MySqlCommand    cmd         = new MySqlCommand(TaqtiController.connectionString);

            cmd             = myConn.CreateCommand();
            cmd.CommandText = "select max(id) as id from iplog;";
            myConn.Open();
            MySqlDataReader dataReader = cmd.ExecuteReader();
            int             id3        = 0;

            while (dataReader.Read())
            {
                id3 = dataReader.GetInt32(0);
            }
            myConn.Close();

            try
            {
                urlReferrer = Request.UrlReferrer.ToString();
            }
            catch
            {
            }

            MySqlConnection myConn2 = new MySqlConnection(TaqtiController.connectionString);
            MySqlCommand    cmd2    = new MySqlCommand(TaqtiController.connectionString);

            myConn2.Open();

            cmd2             = myConn2.CreateCommand();
            cmd2.CommandText = "INSERT into iplog(ID,ip,date,data,referrer) VALUES (@id,@ip,@date,@data,@referrer)";
            cmd2.Parameters.AddWithValue("@id", id3 + 1);
            cmd2.Parameters.AddWithValue("@ip", (string)Request.UserHostAddress);
            cmd2.Parameters.AddWithValue("@date", DateTime.Now);
            cmd2.Parameters.AddWithValue("@data", data.text);
            cmd2.Parameters.AddWithValue("@referrer", urlReferrer);
            cmd2.ExecuteNonQuery();
            myConn2.Close();

            if (isValid())
            {
                Words wrd = new Words();
                wrd.word = Lines.Replace((data.text.Trim()));
                Scansion scn  = new Scansion();
                Words    word = new Words();
                word = scn.wordCode(wrd);
                List <string> str = new List <string>();
                for (int i = 0; i < word.code.Count; i++)
                {
                    str.Add(Meters.Rukn(word.code[i]));
                }
                word.taqti = str;
                return(PartialView("_PartialWords", word));
            }
            else
            {
                return(View());
            }
        }
示例#49
0
 public void CompleteEvent(string id)
 {
     Lines.Add(LinesSupport[id]);
 }
示例#50
0
    void OnEnable()
    {
        script = (Lines)target;

        leftCharacter = serializedObject.FindProperty("leftCharacter");
        rightCharacter = serializedObject.FindProperty("rightCharacter");
    }
        /// <summary>
        /// Called once to load content
        /// </summary>
        /// <param name="GraphicInfo"></param>
        /// <param name="factory"></param>
        /// <param name="contentManager"></param>
        protected override void LoadContent(PloobsEngine.Engine.GraphicInfo GraphicInfo, PloobsEngine.Engine.GraphicFactory factory, PloobsEngine.SceneControl.IContentManager contentManager)
        {
            ///load background texture
            tile = factory.GetTexture2D("Textures/tile");

            //add the 2d primitive draw component
            lines = new Lines();
            Primitive2DDraw.Add2DPrimitive(lines);

            ///recover the physic world reference
            FarseerWorld fworld = this.World.PhysicWorld as FarseerWorld;
            
            ///Ground 1
            Vertices verts = PolygonTools.CreateRectangle(GraphicInfo.BackBufferWidth, 100);
            {
                IModelo2D model = new SpriteFarseer(factory, verts, Color.Red);
                Basic2DTextureMaterial mat = new Basic2DTextureMaterial();
                FarseerObject fs = new FarseerObject(fworld, model, 1, BodyType.Static);
                I2DObject o = new I2DObject(fs, mat, model);
                ///the origin of the created object will be in the center of it, this mean: if we draw it, the center of mass of it will be on the midle of the screen
                ///We need to translate it a bit down                
                o.PhysicObject.Position = new Vector2(0, 250);
                this.World.AddObject(o);
            }

            ///Ground 2
            verts = PolygonTools.CreateRectangle(GraphicInfo.BackBufferWidth, 100);
            {
                IModelo2D model = new SpriteFarseer(factory, verts, Color.Green);
                Basic2DTextureMaterial mat = new Basic2DTextureMaterial();
                FarseerObject fs = new FarseerObject(fworld, model, 1, BodyType.Static);
                I2DObject o = new I2DObject(fs, mat, model);
                ///the origin of the created object will be in the center of it, this mean: if we draw it, the center of mass of it will be on the midle of the screen
                ///We need to translate it a bit down                
                o.PhysicObject.Position = new Vector2(GraphicInfo.BackBufferWidth, 250);
                this.World.AddObject(o);
            }

            ///Ground 3
            verts = PolygonTools.CreateRectangle(GraphicInfo.BackBufferWidth, 100);
            {
                IModelo2D model = new SpriteFarseer(factory, verts, Color.Yellow);
                Basic2DTextureMaterial mat = new Basic2DTextureMaterial();
                FarseerObject fs = new FarseerObject(fworld, model, 1, BodyType.Static);
                I2DObject o = new I2DObject(fs, mat, model);
                ///the origin of the created object will be in the center of it, this mean: if we draw it, the center of mass of it will be on the midle of the screen
                ///We need to translate it a bit down                
                o.PhysicObject.Position = new Vector2(GraphicInfo.BackBufferWidth * 2, 250);
                this.World.AddObject(o);
            }

            ///Support 
            verts = PolygonTools.CreateRectangle(50, 200);
            {
                IModelo2D model = new SpriteFarseer(factory, verts, Color.Yellow);
                Basic2DTextureMaterial mat = new Basic2DTextureMaterial();
                FarseerObject fs = new FarseerObject(fworld, model, 1, BodyType.Static);
                I2DObject o = new I2DObject(fs, mat, model);
                ///the origin of the created object will be in the center of it, this mean: if we draw it, the center of mass of it will be on the midle of the screen
                ///We need to translate it a bit down                
                o.PhysicObject.Position = new Vector2(0, 100);
                this.World.AddObject(o);
            }

            ///plataform  1
            verts = PolygonTools.CreateRectangle(50, 200);
            {
                IModelo2D model = new SpriteFarseer(factory, verts, Color.Green);
                Basic2DTextureMaterial mat = new Basic2DTextureMaterial();
                FarseerObject fs = new FarseerObject(fworld, model, 1, BodyType.Dynamic);
                I2DObject o = new I2DObject(fs, mat, model);
                ///the origin of the created object will be in the center of it, this mean: if we draw it, the center of mass of it will be on the midle of the screen
                ///We need to translate it a bit down                
                o.PhysicObject.Position = new Vector2(GraphicInfo.BackBufferWidth * 1.5f, 100);
                this.World.AddObject(o);
            }

            ///plataform  2
            verts = PolygonTools.CreateRectangle(50, 200);
            {
                IModelo2D model = new SpriteFarseer(factory, verts, Color.Green);
                Basic2DTextureMaterial mat = new Basic2DTextureMaterial();
                FarseerObject fs = new FarseerObject(fworld, model, 1, BodyType.Dynamic);
                I2DObject o = new I2DObject(fs, mat, model);
                ///the origin of the created object will be in the center of it, this mean: if we draw it, the center of mass of it will be on the midle of the screen
                ///We need to translate it a bit down                
                o.PhysicObject.Position = new Vector2(GraphicInfo.BackBufferWidth * 1.6f, 100);
                this.World.AddObject(o);
            }

            ///plataform  3
            verts = PolygonTools.CreateRectangle(200, 50);
            {
                IModelo2D model = new SpriteFarseer(factory, verts, Color.Green);
                Basic2DTextureMaterial mat = new Basic2DTextureMaterial();
                FarseerObject fs = new FarseerObject(fworld, model, 1, BodyType.Dynamic);
                I2DObject o = new I2DObject(fs, mat, model);
                ///the origin of the created object will be in the center of it, this mean: if we draw it, the center of mass of it will be on the midle of the screen
                ///We need to translate it a bit down                
                o.PhysicObject.Position = new Vector2(GraphicInfo.BackBufferWidth * 1.55f, -100);
                this.World.AddObject(o);
            }

            ///objective            
            {
                Texture2D tex = factory.GetTexture2D("Textures//goo");
                tex = factory.GetScaledTexture(tex,new Vector2(2));
                IModelo2D model = new SpriteFarseer(tex);
                Basic2DTextureMaterial mat = new Basic2DTextureMaterial();
                FarseerObject fs = new FarseerObject(fworld, model);                
                goo = new I2DObject(fs, mat, model);
                goo.PhysicObject.Position = new Vector2(GraphicInfo.BackBufferWidth * 1.55f, -175);
                this.World.AddObject(goo);
            }

            ///Ball
            CircleShape circle = new CircleShape(50, 1);
            {
                IModelo2D model = new SpriteFarseer(factory, circle, Color.Orange);
                Basic2DTextureMaterial mat = new Basic2DTextureMaterial();
                FarseerObject fs = new FarseerObject(fworld, model);
                ball = new I2DObject(fs, mat, model);
                ball.PhysicObject.Position = new Vector2(0, -25);
                ball.OnUpdate += new PloobsEngine.SceneControl._2DScene.OnUpdate(ball_OnUpdate);
                this.World.AddObject(ball);
            }            
            
            ///the basic ortographic 2D camera
            Camera2D Camera2D = new Camera2D(GraphicInfo);
            Camera2D.Position = new Vector2(GraphicInfo.BackBufferWidth * 1.6f, 0);
            ///teleport to the given position
            Camera2D.Jump2Target();

            this.World.Camera2D = Camera2D;

            ///go to the desired position but without teleport =P
            Camera2D.IntertiaController = 0.09f;
            Camera2D.Position = new Vector2(0, 0);
            Camera2D.EnablePositionTracking = true;
            Camera2D.ReachedTheTrackingPosition += new Action<PloobsEngine.SceneControl._2DScene.Camera2D>(Camera2D_ReachedTheTrackingPosition);

            base.LoadContent(GraphicInfo, factory, contentManager);

            
        }
示例#52
0
        private void InsertLines(List<string> toInsert, string currentdir)
        {
            uint curline = 1;
            bool in_comment = false, in_asm = false;

            IsLoaded = true;

            for (int i = 0; i < toInsert.Count; i++, curline++)
            {
                string scriptline = Helper.trim(toInsert[i]);
                bool nextline = false;
                int curpos = 0; // for skipping string literals

                while (!nextline)
                {
                    // Handle comments and string literals
                    int linecmt = -1, spancmt = -1, strdel = -1;

                    if (curpos < scriptline.Length)
                    {
                        if (in_comment)
                        {
                            spancmt = 0;
                        }
                        else
                        {
                            int min = -1, tmp;
                            tmp = scriptline.IndexOf("//", curpos);
                            if (tmp < min)
                                min = linecmt = tmp;
                            tmp = scriptline.IndexOf(';', curpos);
                            if (tmp < min)
                                min = linecmt = tmp;
                            tmp = scriptline.IndexOf("/*", curpos);
                            if (tmp < min)
                                min = spancmt = tmp;
                            tmp = scriptline.IndexOf('\"', curpos);
                            if (tmp < min)
                                min = strdel = tmp;

                            curpos = min;

                            if (linecmt != min)
                                linecmt = -1;
                            if (spancmt != min)
                                spancmt = -1;
                            if (strdel != min)
                                strdel = -1;
                        }
                    }

                    if (strdel >= 0)
                    {
                        curpos = scriptline.IndexOf('\"', strdel + 1); // find end of string
                        if (curpos >= 0)
                            curpos++;
                    }
                    else if (linecmt >= 0)
                    {
                        scriptline = scriptline.Remove(linecmt);
                    }
                    else if (spancmt >= 0)
                    {
                        int start = in_comment ? spancmt : spancmt + 2;
                        int end = scriptline.IndexOf("*/", start);
                        in_comment = (end < 0);
                        if (in_comment)
                            scriptline = scriptline.Remove(spancmt);
                        else
                            scriptline = scriptline.Remove(spancmt) + scriptline.Substring(end - spancmt + 2);
                    }
                    else
                    {
                        scriptline = Helper.trim(scriptline);
                        int len = scriptline.Length;

                        if (len != 0)
                        {
                            string lcline = scriptline.ToLowerInvariant();

                            // Check for label
                            if (!in_asm && len > 1 && scriptline[len - 1] == ':')
                            {
                                scriptline = scriptline.Remove(len - 1);
                                Labels[Helper.trim(scriptline)] = (uint)(Lines.Count);
                            }
                            // Check for #inc and include file if it exists
                            else if (0 == lcline.IndexOf("#inc"))
                            {
                                if (len > 5 && Char.IsWhiteSpace(lcline[4]))
                                {
                                    string args = Helper.trim(scriptline.Substring(5));
                                    if (args.Length > 2 && args[0] == '\"' && args.EndsWith("\""))
                                    {
                                        string dir;
                                        string philename = Helper.pathfixup(args.Substring(1, args.Length - 2), false);
                                        if (!Path.IsPathRooted(philename))
                                        {
                                            philename = currentdir + philename;
                                            dir = currentdir;
                                        }
                                        else
                                            dir = Path.GetDirectoryName(philename);

                                        InsertLines(Helper.ReadLinesFromFile(philename), dir);
                                    }
                                    else interpreter.Host.MsgError("Bad #inc directive!");
                                }
                                else this.interpreter.Host.MsgError("Bad #inc directive!");
                            }
                            // Logging
                            else if (!in_asm && lcline == "#log")
                            {
                                Log = true;
                            }
                            // Add line
                            else
                            {
                                Line cur = new Line();

                                if (in_asm && lcline == "ende")
                                    in_asm = false;

                                cur.RawLine = scriptline;
                                cur.LineNumber = curline;
                                cur.IsCommand = !in_asm;

                                if (!in_asm && lcline == "exec")
                                    in_asm = true;

                                ParseArgumentsIntoLine(scriptline, cur);

                                Lines.Add(cur);
                            }
                        }
                        nextline = true;
                    }
                }
            }
        }
示例#53
0
 private Paragraph MakeParagraph(Lines lines)
 {
     var logger = Managers.PrintingManager.Logger;
     logger.LogVerbose(Message.Common_DebugCall);
     var paragraph = new Paragraph();
     paragraph.KeepTogether = true;
     foreach (IReportElement t in lines)
     {
         if (!t.IsPrintable) continue;
         if (paragraph.Chunks.Count > 0)
         {
             paragraph.Add(new Phrase(Chunk.NEWLINE));
         }
         var line = (ReportLine)t;
         if (line.FirstLine.Trim().Length > 0)
         {
             Font tempFont = GetFont(line, _font.BaseFont);
             paragraph.Add(new Phrase(
                             (float)Math.Round(tempFont.Size * DBL_LEADING_FONT),
                             TextAlign(line.FirstLine, tempFont, line.Align, _pdfDocument.Right - _pdfDocument.Left, ' '),
                             tempFont));
         }
         else
         {
             paragraph.Add(new Phrase(Chunk.NEWLINE));
         }
     }
     paragraph.SpacingAfter = 0.0f;
     paragraph.SpacingBefore = 0.0f;
     paragraph.Leading = (float)Math.Round(_font.Size * DBL_LEADING_FONT);
     logger.LogVerbose(Message.Common_DebugReturn);
     return paragraph;
 }
示例#54
0
 internal Method()
 {
     Lines    = new Lines();
     Branches = new Branches();
 }
示例#55
0
 public Csc(FileInfo file, Lines lines)
     : base(file)
 {
     this.lines = lines;
 }
示例#56
0
文件: Utils.cs 项目: liguangshi/UE4
 /// <summary>
 /// Adds a new line to the version file
 /// </summary>
 /// <param name="Line"></param>
 public void AddLine(string Line)
 {
     Lines.Add(Line);
 }
 /// <summary>����Ԓl���̕`��͈͂�擾����</summary>
 /// <param name="line">����</param>
 /// <returns>����Ԓl���̕`��͈�</returns>
 public static LineProperty GetLineProperty(Lines line)
 {
     if (lineProperties.ContainsKey(line))
     {
         return lineProperties[line];
     }
     throw new Exception("�w�肳�ꂽ��ނ̏�Ԑ��͂���܂���");
 }
示例#58
0
        public Lines getAllLines()
        {
            Lines lines = new Lines();

            foreach (Layer l in this.layers)
            {
                lines.AddRange(l.lines);
            }

            return lines;
        }
        public void TestReport()
        {
            CoverageResult result = new CoverageResult();

            result.Identifier = Guid.NewGuid().ToString();

            Lines lines = new Lines();

            lines.Add(1, 1);
            lines.Add(2, 0);

            Branches branches = new Branches();

            branches.Add(new BranchInfo {
                Line = 1, Hits = 1, Offset = 23, EndOffset = 24, Path = 0, Ordinal = 1
            });
            branches.Add(new BranchInfo {
                Line = 1, Hits = 0, Offset = 23, EndOffset = 27, Path = 1, Ordinal = 2
            });

            Methods methods      = new Methods();
            var     methodString = "System.Void Coverlet.Core.Reporters.Tests.CoberturaReporterTests::TestReport()";

            methods.Add(methodString, new Method());
            methods[methodString].Lines    = lines;
            methods[methodString].Branches = branches;

            Classes classes = new Classes();

            classes.Add("Coverlet.Core.Reporters.Tests.CoberturaReporterTests", methods);

            Documents documents = new Documents();

            if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
            {
                documents.Add(@"C:\doc.cs", classes);
            }
            else
            {
                documents.Add(@"/doc.cs", classes);
            }

            result.Modules = new Modules();
            result.Modules.Add("module", documents);

            CultureInfo currentCulture = Thread.CurrentThread.CurrentCulture;

            Thread.CurrentThread.CurrentCulture = new CultureInfo("it-IT");
            try
            {
                // Assert conversion behaviour to be sure to be in a Italian culture context
                // where decimal char is comma.
                Assert.Equal("1,5", (1.5).ToString());

                CoberturaReporter reporter = new CoberturaReporter();
                string            report   = reporter.Report(result);

                Assert.NotEmpty(report);

                var doc = XDocument.Load(new MemoryStream(Encoding.UTF8.GetBytes(report)));

                var matchingRateAttributes = doc.Descendants().Attributes().Where(attr => attr.Name.LocalName.EndsWith("-rate"));
                var rateParentNodeNames    = matchingRateAttributes.Select(attr => attr.Parent.Name.LocalName);
                Assert.Contains("package", rateParentNodeNames);
                Assert.Contains("class", rateParentNodeNames);
                Assert.Contains("method", rateParentNodeNames);
                Assert.All(matchingRateAttributes.Select(attr => attr.Value),
                           value =>
                {
                    Assert.DoesNotContain(",", value);
                    Assert.Contains(".", value);
                    Assert.Equal(0.5, double.Parse(value, CultureInfo.InvariantCulture));
                });

                var matchingComplexityAttributes = doc.Descendants().Attributes().Where(attr => attr.Name.LocalName.Equals("complexity"));
                var complexityParentNodeNames    = matchingComplexityAttributes.Select(attr => attr.Parent.Name.LocalName);
                Assert.Contains("package", complexityParentNodeNames);
                Assert.Contains("class", complexityParentNodeNames);
                Assert.Contains("method", complexityParentNodeNames);
                Assert.All(matchingComplexityAttributes.Select(attr => attr.Value),
                           value =>
                {
                    Assert.Equal(branches.Count, int.Parse(value, CultureInfo.InvariantCulture));
                });
            }
            finally
            {
                Thread.CurrentThread.CurrentCulture = currentCulture;
            }
        }
示例#60
0
            public override string ToString()
            {
                //    OutputString($"outputting {Name}");
                try
                {
                    string ret = "";
                    ret  = $"  (module \"{Name}\" (layer {Layer}) {Tedit} {Tstamp}\n";
                    ret += $"    (at {X} {-Y} {Rotation})\n";
                    ret += $"    (attr {Attr})\n";

                    // this bit is for a particular test board where the idiot had put the Comment as .designator
                    if (Strings != null)
                    {
                        foreach (var str in Strings)
                        {
                            if (str.Value.ToLower() == ".comment")
                            {
                                str.Value = Comment;
                            }
                            if (str.Value.ToLower() == ".designator")
                            {
                                str.Value = Designator;
                            }
                        }
                    }

                    if (Strings != null)
                    {
                        ret += Strings.ToString(X, Y, Rotation);
                    }

                    PadComparer pc = new PadComparer();
                    // put pads in numerical order (not really necessary)
                    Pads.Sort(pc);

                    if (Pads != null)
                    {
                        ret += Pads.ToString(X, Y, Rotation);
                    }
                    // ret += Vias.ToString(X, Y, Rotation); // vias not allowed in modules...yet
                    if (Lines != null)
                    {
                        ret += Lines.ToString(X, Y, -Rotation);
                    }
                    if (Arcs != null)
                    {
                        ret += Arcs.ToString(X, Y, -Rotation);
                    }
                    if (Fills != null)
                    {
                        ret += Fills.ToString(X, Y, -Rotation);
                    }
                    if (Polygons != null)
                    {
                        ret += Polygons.ToString();
                    }
                    if (Regions != null)
                    {
                        ret += Regions.ToString(X, Y, -Rotation);
                    }
                    CurrentLayer = Layer;
                    if (ComponentBodies != null)
                    {
                        ret += ComponentBodies.ToString(X, Y, Rotation);                          // (Layer=="F.Cu")?-Rotation:-(Rotation-180));
                    }
                    if (ShapeBasedModels != null)
                    {
                        ret += ShapeBasedModels.ToString(X, Y, -Rotation);
                    }
                    ret += "  )\n";
                    return(ret);
                }
                catch (Exception Ex)
                {
                    CheckThreadAbort(Ex);
                    return("");
                }
            }