Exemple #1
0
            public string Serialize()
            {
                using (var writer = new BinaryStateWriter())
                {
                    // Header
                    writer.Write(MagicNumber);
                    writer.Write(VersionNumber);

                    // Data
                    writer.Write(Data.Length);
                    foreach (var word in Data)
                    {
                        writer.Write(word);
                    }

                    return(writer.ToString());
                }
            }
Exemple #2
0
            public string Serialize()
            {
                using (var writer = new BinaryStateWriter())
                {
                    // Header
                    writer.Write(MagicNumber);
                    writer.Write(VersionNumber);

                    // Data
                    writer.Write(_sectors.Count);
                    foreach (var sectorKeyValue in _sectors)
                    {
                        var sectorNumber = sectorKeyValue.Key;
                        var sectorData   = sectorKeyValue.Value;
                        writer.Write(sectorNumber);
                        for (var i = 0; i < WordsPerSector; i++)
                        {
                            writer.Write(sectorData[i]);
                        }
                    }

                    return(writer.ToString());
                }
            }