Beispiel #1
0
 public void updateStructNFC(StructNFC tmp)
 {
     StructNFC[] tmpdata;
     if (this.cnt > 0)
     {
         tmpdata = new StructNFC[this.data.Length + 1];
     }
     else
     {
         tmpdata = new StructNFC[1];
     }
     for (int i = 0; i < tmpdata.Length - 1; i++)
     {
         tmpdata[i] = new StructNFC();
         tmpdata[i] = data[i];
     }
     tmpdata[tmpdata.Length - 1] = new StructNFC();
     tmpdata[tmpdata.Length - 1] = tmp;
     if (this.loadstrings && tmpdata[tmpdata.Length - 1].script.Contains("call_lc"))
     {
         Match match   = Regex.Match(tmpdata[tmpdata.Length - 1].script, @".*\((?<inner>.*)\).*");
         int   name_id = Convert.ToInt32(match.Groups["inner"].Value);
         tmpdata[tmpdata.Length - 1].name = strings.get_Wname(name_id + 70000000);
     }
     else
     {
         tmpdata[tmpdata.Length - 1].name = "No StringResource found or unable to parse script!";
     }
     this.data = tmpdata;
     updatecoordstring(this.data.Length - 1);
     this.cnt  = cnt + 1;
     this.edit = true;
 }
Beispiel #2
0
 public void modifycoords(int id, string newcoord, NFCCoords[] points)
 {
     StructNFC[] tmpdata = new StructNFC[this.data.Length];
     for (int i = 0; i < this.data.Length; i++)
     {
         if (data[i].id == id)
         {
             tmpdata[i]            = new StructNFC();
             tmpdata[i]            = data[i];
             tmpdata[i].cnt_coords = points.Length;
             tmpdata[i].coords     = points;
             tmpdata[i].coord      = newcoord;
             for (int j = 0; j < tmpdata[i].coords.Length; j++)
             {
                 tmpdata[i].coords[j].cnt_coords = tmpdata[i].coords[j].cnt_coords - 1;
             }
             updatecoordstring(i);
         }
         else
         {
             tmpdata[i] = new StructNFC();
             tmpdata[i] = data[i];
         }
     }
     this.edit = true;
 }
Beispiel #3
0
        public void deleteNFC(int id)
        {
            StructNFC[] tmpdata = new StructNFC[this.data.Length - 1];
            int         j       = 0;

            for (int i = 0; i < this.data.Length; i++)
            {
                if (data[i].id != id)
                {
                    tmpdata[j]    = new StructNFC();
                    tmpdata[j]    = data[i];
                    tmpdata[j].id = j + 1;
                    j++;
                }
            }
            this.data = tmpdata;
            this.cnt  = cnt - 1;
            this.edit = true;
        }
Beispiel #4
0
 private void loadData()
 {
     try
     {
         if (File.Exists(this.fullpath))
         {
             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 StructNFC[this.cnt];
             for (int i = 1; i <= this.cnt; i++)
             {
                 data[i - 1]            = new StructNFC();
                 data[i - 1].id         = i;
                 data[i - 1].type       = binaryReader.ReadInt32();
                 data[i - 1].unknown1   = binaryReader.ReadInt32();
                 data[i - 1].unknown2   = binaryReader.ReadInt32();
                 data[i - 1].unknown3   = binaryReader.ReadInt32();
                 data[i - 1].unknown4   = binaryReader.ReadInt32();
                 data[i - 1].cnt_name   = binaryReader.ReadInt32();
                 data[i - 1].name       = new string(binaryReader.ReadChars(data[i - 1].cnt_name));
                 data[i - 1].cnt_script = binaryReader.ReadInt32();
                 data[i - 1].script     = new string(binaryReader.ReadChars(data[i - 1].cnt_script));
                 if (this.loadstrings && data[i - 1].script.Contains("call_lc"))
                 {
                     Match match   = Regex.Match(data[i - 1].script, @".*\((?<inner>.*)\).*");
                     int   name_id = Convert.ToInt32(match.Groups["inner"].Value);
                     data[i - 1].name = strings.get_Wname(name_id + 70000000);
                 }
                 else
                 {
                     data[i - 1].name = "No StringResource found or unable to parse script!";
                 }
                 data[i - 1].cnt_name   = data[i - 1].name.Length;
                 data[i - 1].cnt_coords = binaryReader.ReadInt32();
                 data[i - 1].coords     = new NFCCoords[data[i - 1].cnt_coords];
                 for (int k = 1; k <= data[i - 1].cnt_coords; k++)
                 {
                     data[i - 1].coords[k - 1]            = new NFCCoords();
                     data[i - 1].coords[k - 1].cnt_coords = binaryReader.ReadInt32();
                     data[i - 1].coords[k - 1].coords     = new PointF[data[i - 1].coords[k - 1].cnt_coords + 1];
                     data[i - 1].coord = data[i - 1].coord + k + ": {";
                     int stringcnt = 0;
                     for (int j = 1; j <= data[i - 1].coords[k - 1].cnt_coords; j++)
                     {
                         int x = binaryReader.ReadInt32();
                         int y = mirrory(binaryReader.ReadInt32());
                         data[i - 1].coords[k - 1].coords[j - 1].X = x;
                         data[i - 1].coords[k - 1].coords[j - 1].Y = y;
                         data[i - 1].coord = data[i - 1].coord + j + ". (" + ((x * 5.25) + Hexcnv.GetCoords(this.filename, 1)) + ", " + (((3072 - y) * 5.25) + Hexcnv.GetCoords(this.filename, 2)) + ") ";
                         if (stringcnt == 7)
                         {
                             data[i - 1].coord = data[i - 1].coord + "\n";
                             stringcnt         = 0;
                         }
                         else
                         {
                             stringcnt++;
                         }
                         if (j - 1 == 0)
                         {
                             data[i - 1].coords[k - 1].coords[data[i - 1].coords[k - 1].cnt_coords] = new Point(x, y);
                         }
                     }
                     data[i - 1].coord = data[i - 1].coord + "} ";
                     if (this.data[i - 1].cnt_coords > 1)
                     {
                         this.data[i - 1].coord = data[i - 1].coord + "\n";
                     }
                 }
             }
             binaryReader.Close();
             fileStream.Close();
         }
         this.check = true;
         this.error = false;
     }
     catch
     {
         this.error  = true;
         this.MapImg = new Bitmap(3072, 3072);
         this.check  = false;
     }
 }