Пример #1
0
 public void ReadMnetFile(string FileName)
 {
     nodes = new List<Node>();
     wires = new List<Wire>();
     string[] tstr = System.IO.File.ReadAllLines(FileName);
     for (int i = 0; i < tstr.Length; i++)
     {
         if (tstr[i].Split(':')[0] == "NODE")
         {
             Node N = new Node();
             N.ReadFromString(tstr[i]);
             nodes.Add(N);
         }
         if (tstr[i].Split(':')[0] == "WIRE")
         {
             Wire W = new Wire();
             W.ReadFromString(tstr[i]);
             wires.Add(W);
         }
     }
 }
Пример #2
0
 private int RepPlaceForward(int tPointIndex, Wire wire)
 {
     bool placed = false;
     while (!placed)
     {
         tPointIndex++;
         bool canplace = CanRepPlace(wire.WirePoints[tPointIndex].x, wire.WirePoints[tPointIndex].y);
         if (canplace)
         {
             placed = true;
             RepPlace(wire.WirePoints[tPointIndex].x, wire.WirePoints[tPointIndex].y);
         }
     }
     return tPointIndex;
 }
Пример #3
0
 private int RepPlaceBack(int tPointIndex, Wire wire)
 {
     bool placed = false;
     while (!placed)
     {
         tPointIndex--;
         bool canplace = CanRepPlace(wire.WirePoints[tPointIndex].x, wire.WirePoints[tPointIndex].y);
         if (canplace)
         {
             placed = true;
             RepPlace(wire.WirePoints[tPointIndex].x, wire.WirePoints[tPointIndex].y);
         }
     }
     //Проверка невозможности установки репитеров
     if (wire == lastWire) lastWireCount++;
     else
     {
         lastWireCount = 0;
     }
     if (lastWireCount > wire.WirePoints.Count) wire.repError = true;
     lastWire = wire;
     return tPointIndex;
 }