Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I answer my own question, if someone will have the same problem.</p> <p>Following <em>craftworkgame</em>'s suggestion, I saved my data using byte streams, but due to the absence of <code>File</code> class, I had to use WinRT functions:</p> <pre><code>private async void SaveColorArray(string filename, Color[] array) { StorageFile sampleFile = await Windows.Storage.ApplicationData.Current.LocalFolder.CreateFileAsync(filename + ".dat", CreationCollisionOption.ReplaceExisting); IRandomAccessStream writeStream = await sampleFile.OpenAsync(FileAccessMode.ReadWrite); IOutputStream outputSteam = writeStream.GetOutputStreamAt(0); DataWriter dataWriter = new DataWriter(outputSteam); for (int i = 0; i &lt; array.Length; i++) { dataWriter.WriteByte(array[i].R); dataWriter.WriteByte(array[i].G); dataWriter.WriteByte(array[i].B); dataWriter.WriteByte(array[i].A); } await dataWriter.StoreAsync(); await outputSteam.FlushAsync(); } protected async Task&lt;Color[]&gt; LoadColorArray(string filename) { StorageFile sampleFile = await Windows.Storage.ApplicationData.Current.LocalFolder.CreateFileAsync(filename + ".dat", CreationCollisionOption.OpenIfExists); IRandomAccessStream readStream = await sampleFile.OpenAsync(FileAccessMode.Read); IInputStream inputSteam = readStream.GetInputStreamAt(0); DataReader dataReader = new DataReader(inputSteam); await dataReader.LoadAsync((uint)readStream.Size); Color[] levelArray = new Color[dataReader.UnconsumedBufferLength / 4]; int i = 0; while (dataReader.UnconsumedBufferLength &gt; 0) { byte[] colorArray = new byte[4]; dataReader.ReadBytes(colorArray); levelArray[i++] = new Color(colorArray[0], colorArray[1], colorArray[2], colorArray[3]); } return levelArray; } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload