Exemple #1
0
        public void modifycoords(int id, string newcoord, PointF[] newpoints)
        {
            StructNFA[] tmpdata = new StructNFA[this.data.Length];
            int         index   = 0;

            for (int i = 0; i < this.data.Length; i++)
            {
                if (data[i].id == id)
                {
                    index                 = i;
                    tmpdata[i]            = new StructNFA();
                    tmpdata[i]            = data[i];
                    tmpdata[i].points     = newpoints;
                    tmpdata[i].coord      = newcoord;
                    tmpdata[i].coordcount = newpoints.Length - 1;
                }
                else
                {
                    tmpdata[i] = new StructNFA();
                    tmpdata[i] = data[i];
                }
            }
            this.edit = true;
            updateCoordstxt(index);
        }
Exemple #2
0
 private void loadData()
 {
     try
     {
         FileStream   fileStream   = File.Open(this.fullpath, FileMode.Open, FileAccess.Read, FileShare.Read);
         BinaryReader binaryReader = new BinaryReader(fileStream, Encoding.ASCII);
         this.cnt = binaryReader.ReadInt32();
         data     = new StructNFA[this.cnt];
         for (int i = 1; i <= this.cnt; i++)
         {
             data[i - 1]            = new StructNFA();
             data[i - 1].id         = i;
             data[i - 1].coordcount = binaryReader.ReadInt32();
             data[i - 1].points     = new PointF[data[i - 1].coordcount + 1];
             int stringcnt = 0;
             for (int j = 1; j <= data[i - 1].coordcount; j++)
             {
                 data[i - 1].points[j - 1] = new Point();
                 int x = binaryReader.ReadInt32();
                 int y = mirrory(binaryReader.ReadInt32());
                 data[i - 1].points[j - 1].X = x;
                 data[i - 1].points[j - 1].Y = y;
                 data[i - 1].coord           = data[i - 1].coord + j + ". (" + ((x * 5.25) + Hexcnv.GetCoords(this.filename, 1)).ToString() + ", "
                                               + (((3072 - y) * 5.25) + Hexcnv.GetCoords(this.filename, 2)).ToString() + ")";
                 if (stringcnt == 7)
                 {
                     data[i - 1].coord = data[i - 1].coord + "\n";
                     stringcnt         = 0;
                 }
                 else
                 {
                     stringcnt++;
                 }
             }
             data[i - 1].points[data[i - 1].coordcount]   = new Point();
             data[i - 1].points[data[i - 1].coordcount].X = data[i - 1].points[0].X;
             data[i - 1].points[data[i - 1].coordcount].Y = data[i - 1].points[0].Y;
         }
         binaryReader.Close();
         fileStream.Close();
         this.error = false;
         this.check = true;
     }
     catch
     {
         this.error  = true;
         this.MapImg = new Bitmap(3072, 3072);
         this.check  = false;
     }
 }
Exemple #3
0
 public void updateStructNFA(StructNFA tmp)
 {
     StructNFA[] tmpdata = new StructNFA[this.data.Length + 1];
     for (int i = 0; i < this.data.Length; i++)
     {
         tmpdata[i] = new StructNFA();
         tmpdata[i] = data[i];
     }
     tmpdata[this.data.Length] = new StructNFA();
     tmpdata[this.data.Length] = tmp;
     this.data = tmpdata;
     updateCoordstxt(this.data.Length - 1);
     this.cnt  = cnt + 1;
     this.edit = true;
 }
Exemple #4
0
        public void deleteNFA(int id)
        {
            StructNFA[] tmpdata = new StructNFA[this.data.Length - 1];
            int         j       = 0;

            for (int i = 0; i < this.data.Length; i++)
            {
                if (data[i].id != id)
                {
                    tmpdata[j]    = new StructNFA();
                    tmpdata[j]    = data[i];
                    tmpdata[j].id = j + 1;
                    j++;
                }
            }
            this.data = tmpdata;
            this.cnt  = cnt - 1;
            this.edit = true;
        }