Untitled

mail@pastecode.io avatar
unknown
csharp
2 years ago
2.1 kB
6
Indexable
```cs
 static void Main(string[] args)
        {
            // ONLY CHANGE THE FOLLOWING 3 LINES
            string path1 = "C:\\Users\\shadi\\OneDrive\\Desktop\\ToastedShoesMods1.tar";
            string path2 = "C:\\Users\\shadi\\OneDrive\\Desktop\\ToastedShoesMods.tar";
            long fileSize = 8984306689;
            string reportLocation = "C:\\Users\\shadi\\OneDrive\\Desktop\\report.txt";

            // create a txt file in report location
            File.Create(reportLocation);

            int byte1;
            int byte2;

            FileStream stream1 = new FileStream(path1, FileMode.Open);
            FileStream stream2 = new FileStream(path2, FileMode.Open);



            for (int i = 0; i < fileSize + 1; i++)
            {
                stream1.Seek(i, SeekOrigin.Begin);
                stream2.Seek(i, SeekOrigin.Begin);

                byte1 = stream1.ReadByte();
                byte2 = stream2.ReadByte();

                var byte1hex = ConvertToHex(byte1);
                var byte2hex = ConvertToHex(byte2);


                if (byte1 != byte2)
                {
                    GenerateReport(i, byte1, byte2, reportLocation);
                }

            }

            //string byteHex = "19463DBA6";
            //long dec = ConvertToDecimal(byteHex);
            //ModifyFile(dec);
            //ReadJsonBytes();
            //ModifyFile();
        }

static void GenerateReport(int dec, int byte1, int byte2, string reportLocation)
        {
            string hex = ConvertToHex(dec);

            //StreamWriter writer = new StreamWriter(reportLocation);

            using (StreamWriter writer = new StreamWriter(reportLocation, true))
            {
                writer.Write(hex);
                writer.Write(" ");
                writer.Write(dec);
                writer.Write(" ");
                writer.Write(byte1);
                writer.Write(" ");
                writer.Write(byte1);
                writer.WriteLine();

                writer.Close();
            }

            
        }