mirror of
https://github.com/mRemoteNG/mRemoteNG.git
synced 2026-02-17 22:11:48 +08:00
Merge pull request #2396 from BlueBlock/fix_load_misssing_localconnectionproperties_xml_file
Fix load misssing localconnectionproperties xml file
This commit is contained in:
@@ -17,6 +17,7 @@ namespace mRemoteNG.App.Info
|
||||
public static string LayoutFileName { get; } = "pnlLayout.xml";
|
||||
public static string ExtAppsFilesName { get; } = "extApps.xml";
|
||||
public static string ThemesFileName { get; } = "Themes.xml";
|
||||
public static string LocalConnectionProperties { get; } = "LocalConnectionProperties.xml";
|
||||
|
||||
public static string ThemeFolder { get; } =
|
||||
SettingsPath != null ? Path.Combine(SettingsPath, "Themes") : String.Empty;
|
||||
|
||||
@@ -21,6 +21,11 @@ namespace mRemoteNG.Config.DataProviders
|
||||
var fileContents = "";
|
||||
try
|
||||
{
|
||||
if (!File.Exists(FilePath))
|
||||
{
|
||||
CreateMissingDirectories();
|
||||
File.WriteAllLines(FilePath, new []{ $@"<?xml version=""1.0"" encoding=""UTF-8""?>", $@"<LocalConnections/>" });
|
||||
}
|
||||
fileContents = File.ReadAllText(FilePath);
|
||||
}
|
||||
catch (FileNotFoundException ex)
|
||||
|
||||
@@ -113,7 +113,7 @@ namespace mRemoteNG.Config.Serializers.ConnectionSerializers.MsSql
|
||||
// ANSI SQL way. Works in PostgreSQL, MSSQL, MySQL.
|
||||
var cmd = databaseConnector.DbCommand("select case when exists((select * from information_schema.tables where table_name = '" + tableName + "')) then 1 else 0 end");
|
||||
cmd.ExecuteNonQuery();
|
||||
exists = (int)cmd.ExecuteScalar()! == 1;
|
||||
exists = (int)(long)cmd.ExecuteScalar()! == 1;
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
||||
@@ -44,13 +44,8 @@ namespace mRemoteNG.Connection
|
||||
|
||||
public ConnectionsService(PuttySessionsManager puttySessionsManager)
|
||||
{
|
||||
if (puttySessionsManager == null)
|
||||
throw new ArgumentNullException(nameof(puttySessionsManager));
|
||||
|
||||
_puttySessionsManager = puttySessionsManager;
|
||||
var path = SettingsFileInfo.SettingsPath;
|
||||
_localConnectionPropertiesDataProvider =
|
||||
new FileDataProvider(Path.Combine(path, "LocalConnectionProperties.xml"));
|
||||
_puttySessionsManager = puttySessionsManager ?? throw new ArgumentNullException(nameof(puttySessionsManager));
|
||||
_localConnectionPropertiesDataProvider = new FileDataProvider(Path.Combine(SettingsFileInfo.SettingsPath, SettingsFileInfo.LocalConnectionProperties));
|
||||
_localConnectionPropertiesSerializer = new LocalConnectionPropertiesXmlSerializer();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user