|
| 1 | +using System; |
1 | 2 | using System.Globalization; |
2 | 3 |
|
3 | 4 | namespace CalibreImport |
4 | 5 | { |
5 | 6 | public static class ResourceStrings |
6 | 7 | { |
7 | | - public static string NameAppRes; |
8 | | - public static string MenuTextRes; |
9 | | - public static string InvalidSelectionRes; |
10 | | - public static string SettingsRes; |
| 8 | + public static string AlsoDebugLogRes; |
| 9 | + public static string CalibreProcessesRunningRes; |
| 10 | + public static string CalibreRunning2Res; |
11 | 11 | public static string CalibreRunningRes; |
12 | | - public static string ImportSuccessRes; |
13 | | - public static string ImportFailureRes; |
| 12 | + public static string CancelRes; |
| 13 | + public static string DoYouWantToProceedRes; |
| 14 | + public static string DuplicatesWhatRes; |
| 15 | + public static string ErrorLaunchingRes; |
| 16 | + public static string ErrorRes; |
| 17 | + public static string HideLibrariesRes; |
14 | 18 | public static string ImportBtnRes; |
| 19 | + public static string ImportFailureRes; |
| 20 | + public static string ImportFormRes; |
15 | 21 | public static string ImportingRes; |
| 22 | + public static string ImportSuccessRes; |
16 | 23 | public static string InvalidFilesRes; |
17 | | - public static string CalibreProcessesRunningRes; |
18 | | - public static string DoYouWantToProceedRes; |
19 | | - public static string CalibreRunning2Res; |
20 | | - public static string ErrorLaunchingRes; |
21 | | - public static string UseSubmenuRes; |
22 | | - public static string LogEbooksRes; |
23 | | - public static string AlsoDebugLogRes; |
| 24 | + public static string InvalidSelectionRes; |
24 | 25 | public static string KillCalibreRes; |
25 | | - public static string HideLibrariesRes; |
26 | | - public static string SetEntryNameRes; |
27 | | - public static string PathToCalibreRes; |
28 | | - public static string DuplicatesWhatRes; |
| 26 | + public static string LogEbooksRes; |
| 27 | + public static string MenuTextRes; |
| 28 | + public static string NameAppRes; |
29 | 29 | public static string NameSettingsFormRes; |
30 | | - public static string RegistrationFailedRes; |
31 | 30 | public static string NoLibrariesRes; |
32 | | - public static string ErrorRes; |
33 | | - public static string SettingsSavedRes; |
34 | | - public static string ImportFormRes; |
35 | | - public static string SelectLanguageRes; |
36 | | - public static string SelectLibraryRes; |
| 31 | + public static string PathToCalibreRes; |
37 | 32 | public static string PleaseSelectLibraryRes; |
| 33 | + public static string RegistrationFailedRes; |
38 | 34 | public static string SaveRes; |
39 | | - public static string CancelRes; |
| 35 | + public static string SelectLanguageRes; |
| 36 | + public static string SelectLibraryRes; |
| 37 | + public static string SetEntryNameRes; |
| 38 | + public static string SettingsRes; |
| 39 | + public static string SettingsSavedRes; |
| 40 | + public static string UseSubmenuRes; |
40 | 41 |
|
41 | 42 | static ResourceStrings() |
42 | 43 | { |
43 | | - LoadResourceStrings(); |
| 44 | + try |
| 45 | + { |
| 46 | + LoadResourceStrings(); |
| 47 | + } |
| 48 | + catch (Exception ex) |
| 49 | + { |
| 50 | + // Log the exception and rethrow |
| 51 | + Logger.LogThis($"Error initializing ResourceStrings: {ex.Message}", true); |
| 52 | + throw; |
| 53 | + } |
44 | 54 | } |
45 | 55 |
|
46 | 56 | public static void LoadResourceStrings() |
47 | 57 | { |
48 | | - NameAppRes = Locales.GetString("NameApp"); |
49 | | - MenuTextRes = Locales.GetString("MenuText"); |
50 | | - InvalidSelectionRes = Locales.GetString("InvalidSelection"); |
51 | | - SettingsRes = Locales.GetString("Settings"); |
52 | | - CalibreRunningRes = Locales.GetString("CalibreRunning"); |
53 | | - ImportBtnRes = Locales.GetString("Import"); |
54 | | - ImportSuccessRes = Locales.GetString("ImportSuccess"); |
55 | | - ImportFailureRes = Locales.GetString("ImportFailure"); |
56 | | - InvalidFilesRes = Locales.GetString("InvalidFiles"); |
57 | | - ImportingRes = Locales.GetString("Importing"); |
58 | | - CalibreProcessesRunningRes = Locales.GetString("CalibreProcessesRunning"); |
59 | | - DoYouWantToProceedRes = Locales.GetString("DoYouWantToProceed"); |
60 | | - CalibreRunning2Res = Locales.GetString("CalibreRunning2"); |
61 | | - ErrorLaunchingRes = Locales.GetString("ErrorLaunching"); |
62 | | - UseSubmenuRes = Locales.GetString("UseSubmenu"); |
63 | | - LogEbooksRes = Locales.GetString("LogEbooks"); |
64 | | - AlsoDebugLogRes = Locales.GetString("AlsoDebugLog"); |
65 | | - KillCalibreRes = Locales.GetString("KillCalibre"); |
66 | | - HideLibrariesRes = Locales.GetString("HideLibraries"); |
67 | | - SetEntryNameRes = Locales.GetString("SetEntryName"); |
68 | | - PathToCalibreRes = Locales.GetString("PathToCalibre"); |
69 | | - DuplicatesWhatRes = Locales.GetString("DuplicatesWhat"); |
70 | | - NameSettingsFormRes = Locales.GetString("NameSettingsForm"); |
71 | | - RegistrationFailedRes = Locales.GetString("RegistrationFailed"); |
72 | | - NoLibrariesRes = Locales.GetString("NoLibraries"); |
73 | | - ErrorRes = Locales.GetString("Error"); |
74 | | - SettingsSavedRes = Locales.GetString("SettingsSaved"); |
75 | | - ImportFormRes = Locales.GetString("ImportForm"); |
76 | | - SelectLanguageRes = Locales.GetString("SelectLanguage"); |
77 | | - SelectLibraryRes = Locales.GetString("SelectLibrary"); |
78 | | - PleaseSelectLibraryRes = Locales.GetString("PleaseSelectLibrary"); |
79 | | - SaveRes = Locales.GetString("Save"); |
80 | | - CancelRes = Locales.GetString("Cancel"); |
| 58 | + try |
| 59 | + { |
| 60 | + AlsoDebugLogRes = Locales.GetString("AlsoDebugLog"); |
| 61 | + CalibreProcessesRunningRes = Locales.GetString("CalibreProcessesRunning"); |
| 62 | + CalibreRunning2Res = Locales.GetString("CalibreRunning2"); |
| 63 | + CalibreRunningRes = Locales.GetString("CalibreRunning"); |
| 64 | + CancelRes = Locales.GetString("Cancel"); |
| 65 | + DoYouWantToProceedRes = Locales.GetString("DoYouWantToProceed"); |
| 66 | + DuplicatesWhatRes = Locales.GetString("DuplicatesWhat"); |
| 67 | + ErrorLaunchingRes = Locales.GetString("ErrorLaunching"); |
| 68 | + ErrorRes = Locales.GetString("Error"); |
| 69 | + HideLibrariesRes = Locales.GetString("HideLibraries"); |
| 70 | + ImportBtnRes = Locales.GetString("ImportBtn"); |
| 71 | + ImportFailureRes = Locales.GetString("ImportFailure"); |
| 72 | + ImportFormRes = Locales.GetString("ImportForm"); |
| 73 | + ImportingRes = Locales.GetString("Importing"); |
| 74 | + ImportSuccessRes = Locales.GetString("ImportSuccess"); |
| 75 | + InvalidFilesRes = Locales.GetString("InvalidFiles"); |
| 76 | + InvalidSelectionRes = Locales.GetString("InvalidSelection"); |
| 77 | + KillCalibreRes = Locales.GetString("KillCalibre"); |
| 78 | + LogEbooksRes = Locales.GetString("LogEbooks"); |
| 79 | + MenuTextRes = Locales.GetString("MenuText"); |
| 80 | + NameAppRes = Locales.GetString("NameApp"); |
| 81 | + NameSettingsFormRes = Locales.GetString("NameSettingsForm"); |
| 82 | + NoLibrariesRes = Locales.GetString("NoLibraries"); |
| 83 | + PathToCalibreRes = Locales.GetString("PathToCalibre"); |
| 84 | + PleaseSelectLibraryRes = Locales.GetString("PleaseSelectLibrary"); |
| 85 | + RegistrationFailedRes = Locales.GetString("RegistrationFailed"); |
| 86 | + SaveRes = Locales.GetString("Save"); |
| 87 | + SelectLanguageRes = Locales.GetString("SelectLanguage"); |
| 88 | + SelectLibraryRes = Locales.GetString("SelectLibrary"); |
| 89 | + SetEntryNameRes = Locales.GetString("SetEntryName"); |
| 90 | + SettingsRes = Locales.GetString("Settings"); |
| 91 | + SettingsSavedRes = Locales.GetString("SettingsSaved"); |
| 92 | + UseSubmenuRes = Locales.GetString("UseSubmenu"); |
| 93 | + } |
| 94 | + |
| 95 | + catch (Exception ex) |
| 96 | + { |
| 97 | + // Log the exception and rethrow |
| 98 | + Logger.LogThis($"Error loading resource strings: {ex.Message}", true); |
| 99 | + throw; |
| 100 | + } |
81 | 101 | } |
82 | 102 | } |
83 | 103 | } |
0 commit comments