Beispiel #1
0
        private static void StripEDIDsInternal(Rec r)
        {
            if (r is Record)
            {
                var r2 = (Record)r;
                if (r2.Name != "GMST" && r2.SubRecords.Count > 0 && r2.SubRecords[0].Name == "EDID")
                {
                    r2.DeleteRecord(r2.SubRecords[0]);
                }

                for (int i = 0; i < r2.SubRecords.Count; i++)
                {
                    if (r2.SubRecords[i].Name == "SCTX")
                    {
                        r2.SubRecords.RemoveAt(i--);
                    }
                }
            }
            else
            {
                foreach (Rec r2 in r.Records)
                {
                    StripEDIDsInternal(r2);
                }
            }
        }
        private bool cleanRecurse2(Rec r, ref int count, Dictionary<uint, Record> lookup)
        {
            var r2 = r as Record;
            if (r2 != null)
            {
                if (lookup.ContainsKey(r2.FormID))
                {
                    Record r3 = lookup[r2.FormID];
                    if (r2.Name == r3.Name && r2.Size == r3.Size && r2.SubRecords.Count == r3.SubRecords.Count && r2.Flags1 == r3.Flags1 && r2.Flags2 == r3.Flags2 && r2.Flags3 == r3.Flags3)
                    {
                        for (int i = 0; i < r2.SubRecords.Count; i++)
                        {
                            if (r2.SubRecords[i].Name != r3.SubRecords[i].Name || r2.SubRecords[i].Size != r3.SubRecords[i].Size)
                            {
                                return false;
                            }

                            byte[] data1 = r2.SubRecords[i].GetReadonlyData(), data2 = r3.SubRecords[i].GetReadonlyData();
                            for (int j = 0; j < data1.Length; j++)
                            {
                                if (data1[j] != data2[j])
                                {
                                    return false;
                                }
                            }
                        }

                        return true;
                    }
                }
            }
            else
            {
                var gr = (GroupRecord) r;
                for (int i = 0; i < gr.Records.Count; i++)
                {
                    if (this.cleanRecurse2(gr.Records[i] as Rec, ref count, lookup))
                    {
                        count++;
                        gr.Records.RemoveAt(i--);
                    }
                }
            }

            return false;
        }
 private void DumpEdidsInternal(Rec r, StreamWriter sw)
 {
     if (r is Record)
     {
         var r2 = (Record) r;
         if (r2.SubRecords.Count > 0 && r2.SubRecords[0].Name == "EDID")
         {
             sw.WriteLine(r2.FormID.ToString("x8") + " : " + r2.SubRecords[0].GetStrData());
         }
     }
     else
     {
         foreach (Rec r2 in r.Records)
         {
             this.DumpEdidsInternal(r2, sw);
         }
     }
 }
 private void cleanRecurse(Rec r, uint match, uint mask, Dictionary<uint, Record> lookup)
 {
     var r2 = r as Record;
     if (r2 != null)
     {
         if ((r2.FormID & 0xff000000) == match)
         {
             if (r2.Name != "REFR" && r2.Name != "ACHR" && r2.Name != "NAVM" && r2.Name != "INFO")
             {
                 lookup[(r2.FormID & 0xffffff) | mask] = r2;
             }
         }
     }
     else
     {
         foreach (Rec r3 in r.Records)
         {
             this.cleanRecurse(r3, match, mask, lookup);
         }
     }
 }