From bc5e326d4cebcb9256e30af9c8d41eddb9526ade Mon Sep 17 00:00:00 2001 From: prodigygirl Date: Fri, 2 Dec 2022 09:28:56 +0400 Subject: [PATCH] =?UTF-8?q?=D0=9C=D0=B5=D0=BB=D0=BA=D0=B8=D0=B5=20=D0=B8?= =?UTF-8?q?=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=BB=D0=B5=D0=BD=D0=B8=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/FormMapWithArmoredCars.java | 8 ++++---- src/main/java/MapsCollection.java | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/java/FormMapWithArmoredCars.java b/src/main/java/FormMapWithArmoredCars.java index 347aa79..8a8050e 100644 --- a/src/main/java/FormMapWithArmoredCars.java +++ b/src/main/java/FormMapWithArmoredCars.java @@ -262,7 +262,7 @@ public class FormMapWithArmoredCars extends JFrame{ fd.setVisible(true); String filename = fd.getFile(); if (filename != null) { - if (type.contains("Файл")) { + if (type.equals("Файл")) { if (_mapsCollection.SaveData(fd.getDirectory() + filename)) { JOptionPane.showMessageDialog(null, "Сохранение прошло успешно"); @@ -270,7 +270,7 @@ public class FormMapWithArmoredCars extends JFrame{ else { JOptionPane.showMessageDialog(null, "Не сохранилось"); } - } else if (type.contains("Файл карты")){ + } else if (type.equals("Файл карты")){ if (_mapsCollection.SaveDataMap(fd.getDirectory() + filename, (String) listBoxMaps.getSelectedValue())) { JOptionPane.showMessageDialog(null, "Сохранение прошло успешно"); } else { @@ -286,7 +286,7 @@ public class FormMapWithArmoredCars extends JFrame{ fd.setVisible(true); String filename = fd.getFile(); if (filename != null) { - if (type.contains("Файл")) { + if (type.equals("Файл")) { if (_mapsCollection.LoadData(fd.getDirectory() + filename)) { JOptionPane.showMessageDialog(null, "Загрузка прошла успешно"); @@ -295,7 +295,7 @@ public class FormMapWithArmoredCars extends JFrame{ else { JOptionPane.showMessageDialog(null, "Не загрузилось"); } - } else if (type.contains("Файл карты")){ + } else if (type.equals("Файл карты")){ if (_mapsCollection.LoadDataMap(fd.getDirectory() + filename)) { JOptionPane.showMessageDialog(null, "Загрузка прошла успешно"); ReloadMaps(); diff --git a/src/main/java/MapsCollection.java b/src/main/java/MapsCollection.java index c3dfb0f..6c56a14 100644 --- a/src/main/java/MapsCollection.java +++ b/src/main/java/MapsCollection.java @@ -82,7 +82,7 @@ public class MapsCollection { return false; String line; while ((line = reader.readLine()) != null) { - var elem = line.split(String.valueOf(separatorDict)); + var elem = line.split(String.valueOf(separatorDict), -1); AbstractMap map = null; switch (elem[1]) { case "SimpleMap": @@ -137,7 +137,7 @@ public class MapsCollection { if (!reader.readLine().contains("One Map")) return false; String line = reader.readLine(); - var elem = line.split(String.valueOf(separatorDict)); + var elem = line.split(String.valueOf(separatorDict), -1); AbstractMap map = null; switch (elem[1]) { case "SimpleMap":