コード例 #1
0
        public void StartLoading()
        {
            IsLoading = true;

            string path = UtilFunctions.FindFilePath("Resources/resources.dat");

            FileStream fs = new FileStream(path, FileMode.Open);

            BinaryFormatter formatter = new BinaryFormatter();

            try
            {
                using (GZipStream zipStream = new GZipStream(fs, CompressionMode.Decompress, false))
                {
                    _resources = (ResourceData)formatter.Deserialize(zipStream);
                }
            }
            catch (SerializationException e)
            {
                Log.Print("Failed to serialize. Reason: " + e.Message);
                throw;
            }
            finally
            {
                fs.Close();
                Log.Print($"Packaging Successful!");
            }
        }