Browse Source

Dropped support for old file format

CPKreuz 4 years ago
parent
commit
070b2789f7

+ 0 - 16
PixiEditor/Models/IO/Importer.cs

@@ -71,22 +71,6 @@ namespace PixiEditor.Models.IO
             }
         }
 
-        public static Document ImportOldDocument(string path)
-        {
-            try
-            {
-                using FileStream stream = new FileStream(path, FileMode.Open, FileAccess.Read);
-
-                Document doc = PixiParser.DeserializeOld(stream).ToDocument();
-                doc.DocumentFilePath = path;
-                return doc;
-            }
-            catch (SerializationException)
-            {
-                throw new CorruptedFileException();
-            }
-        }
-
         public static bool IsSupportedFile(string path)
         {
             path = path.ToLower();

+ 4 - 25
PixiEditor/ViewModels/SubViewModels/Main/FileViewModel.cs

@@ -195,23 +195,11 @@ namespace PixiEditor.ViewModels.SubViewModels.Main
             }
             catch (CorruptedFileException ex)
             {
-                MessageBox.Show(ex.Message, "Failed to open file.", MessageBoxButton.OK, MessageBoxImage.Error);
+                NoticeDialog.Show(ex.Message, "Failed to open file.");
             }
             catch (OldFileFormatException)
             {
-                MessageBoxResult result = MessageBox.Show("This pixi file uses the old file format and is insecure.\nOnly continue if you trust the source of the file", "Old file format", MessageBoxButton.OKCancel);
-
-                if (result == MessageBoxResult.OK)
-                {
-                    try
-                    {
-                        OpenDocument(path, true);
-                    }
-                    catch (CorruptedFileException ex)
-                    {
-                        MessageBox.Show(ex.Message, "Failed to open file.", MessageBoxButton.OK, MessageBoxImage.Error);
-                    }
-                }
+                NoticeDialog.Show("This pixi file uses the old file format and can't be opened", "Old file format");
             }
         }
 
@@ -240,18 +228,9 @@ namespace PixiEditor.ViewModels.SubViewModels.Main
             }
         }
 
-        private void OpenDocument(string path, bool openOld = false)
+        private void OpenDocument(string path)
         {
-            Document document;
-
-            if (openOld)
-            {
-                document = Importer.ImportOldDocument(path);
-            }
-            else
-            {
-                document = Importer.ImportDocument(path);
-            }
+            Document document = Importer.ImportDocument(path);
 
             if (Owner.BitmapManager.Documents.Select(x => x.DocumentFilePath).All(y => y != path))
             {