Ejemplo n.º 1
0
        ////////////////////////////////////////////////////////////////////////////////
        //////////
        ////////// Bundle Related Methods
        //////////
        /////
        ///// Methods that change the state of the program by manipulating the Bundle
        ///// directly.
        /////
        ////////////////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Saves the currently loaded bundle to the given path on disk
        /// </summary>
        /// <param name="savePath">The path to save the currently bundle to</param>
        public void SaveBundle(string savePath)
        {
            CurrentBundle.SaveFile = savePath;
            PixelariaSaverLoader.SaveBundleToDisk(CurrentBundle, savePath);

            MarkUnsavedChanges(false);
        }
Ejemplo n.º 2
0
        public void TestPersistenceClass()
        {
            // Generate a dummy file name
            _testFilePath = Path.GetTempFileName();

            Bundle originalBundle = BundleGenerator.GenerateTestBundle(0);

            // Test new file format saving and loading
            PixelariaSaverLoader.SaveBundleToDisk(originalBundle, _testFilePath);
            Bundle newBundle = PixelariaSaverLoader.LoadBundleFromDisk(_testFilePath);

            Assert.AreEqual(originalBundle, newBundle, "After persisting a new (>= v8) file to disk and loading it back up again, the bundles must be equal");

            // Test old file format loading
            SaveBundle(originalBundle, _testFilePath);
            newBundle = PixelariaSaverLoader.LoadBundleFromDisk(_testFilePath);

            Assert.AreEqual(originalBundle, newBundle, "After loading a legacy (< v8) file to disk and loading it back up again, the bundles must be equal");

            // Now load the bundle using the LoadFileFromDisk
            newBundle = PixelariaSaverLoader.LoadFileFromDisk(_testFilePath).LoadedBundle;
            Assert.AreEqual(originalBundle, newBundle, "After loading a legacy (< v8) file to disk and loading it back up again, the bundles must be equal");
        }