Skip to content

Commit 9a25dcc

Browse files
committed
Merge branch 'release/v1.1.0'
2 parents 248e48b + 4c9aa25 commit 9a25dcc

21 files changed

Lines changed: 681 additions & 325 deletions

README.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
11
## Zerial is a RS232 (COM Port Devices) Exchange software
22

3+
Zerial is a cross-platform GUI utility for interact with `COM` (`RS232`) devices.
4+
35
### 1. Key Feautes
4-
Zerial is:
5-
1. Fast like a lighting and a low resources consumption utility:
6+
`Zerial` is:
7+
1. Fast like a lighting and a low resources consumption RS232 exchange `GUI` utility:
68
* fast start, warm start < `3s`
79
* **low memory consumption** < `100 Mb`
810
* close to 0 `CPU` consumption (with a **properly working COM devices**)
911
2. Convenient:
1012
* Exchange data with devices **in a binary format** in Hex mode
1113
* Support **multiple device at same time** (not really tested)
12-
* Support **multiple platforms** where Net6 could be installed (Avalonia is a Cross-Platform WPF)
14+
* Support **multiple platforms** where `Net6` could be installed (`Avalonia` is a Cross-Platform WPF)
15+
* Support multiple localizations that could be added without re-compilation (see folder `./Assets/Languages`)
1316

1417
![Main window](img/MainWindow.png)
1518

Lines changed: 24 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
using System;
22
using System.IO;
3+
using System.Globalization;
34
using Avalonia;
45
using Avalonia.Controls.ApplicationLifetimes;
56
using Avalonia.Markup.Xaml;
7+
using Jeek.Avalonia.Localization;
68
using Microsoft.Extensions.Configuration;
79
using Microsoft.Extensions.DependencyInjection;
810
using Wissance.Zerial.Desktop.Views;
@@ -11,47 +13,42 @@ namespace Wissance.Zerial.Desktop
1113
{
1214
public class App : Application
1315
{
14-
/*static App()
15-
{
16-
// appsettings is optional due to we don't actually know install dir i.e. in Snap, but we could execute from any working dir
17-
IConfigurationBuilder builder = new ConfigurationBuilder();
18-
try
19-
{
20-
builder = new ConfigurationBuilder()
21-
.SetBasePath(Directory.GetCurrentDirectory())
22-
.AddJsonFile(AppSettingsFile, optional: true, reloadOnChange: false);
23-
}
24-
catch (Exception e)
25-
{
26-
builder = new ConfigurationBuilder();
27-
}
28-
29-
Configuration = builder.Build();
30-
31-
ServiceCollection services = new ServiceCollection();
32-
// services.AddLogging();
33-
34-
ServiceProvider = services.BuildServiceProvider();
35-
}*/
36-
3716
public override void Initialize()
3817
{
3918
AvaloniaXamlLoader.Load(this);
4019
}
4120

4221
public override void OnFrameworkInitializationCompleted()
4322
{
23+
Localizer.SetLocalizer(new JsonLocalizer(LocalizationJsonDir));
24+
SetDefaultLanguage();
25+
4426
if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
4527
{
4628
desktop.MainWindow = new SplashScreenWindow();
4729
}
4830

4931
base.OnFrameworkInitializationCompleted();
5032
}
51-
52-
//public static IServiceProvider ServiceProvider { get; private set; }
53-
//public static IConfiguration Configuration { get; private set; }
5433

55-
//private const string AppSettingsFile = "appsettings.json";
34+
private void SetDefaultLanguage()
35+
{
36+
string countryCode = DefaultCountryCode;
37+
try
38+
{
39+
string currentCulture = CultureInfo.CurrentUICulture.Name;
40+
string[] parts = currentCulture.Split("-");
41+
if (Localizer.Languages.Contains(parts[0].ToLower()))
42+
{
43+
countryCode = parts[0].ToLower();
44+
}
45+
}
46+
catch (Exception e) { }
47+
48+
Localizer.Language = countryCode;
49+
}
50+
51+
private const string DefaultCountryCode = "en";
52+
private const string LocalizationJsonDir = "./Assets/Languages";
5653
}
5754
}
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
{
2+
"Zerial_Version_Label": "Version:",
3+
"Zerial_Version": "1.1.0",
4+
"Zerial_Authors_Label": "Authors:",
5+
"Zerial_Authors": "M.V.Ushakov",
6+
"Zerial_Owner_Label": "Owner:",
7+
"Zerial_Owner": "Wissance LLC",
8+
"Zerial_Owner_Website_Label": "Owner website:",
9+
"Zerial_Owner_Website": "https://wissance.com/en",
10+
"Zerial_Product_Url_Label": "Product website:",
11+
"Zerial_Product_Url": "https://github.com/Wissance/Zerial",
12+
"Zerial_Support_Url": "https://github.com/Wissance/Zerial/blob/master/Support.md",
13+
"Zerial_About_Title": "About Zerial community version software",
14+
"Zerial_Designed_By": "Software designed by:",
15+
"Zerial_Support_Us": "Support Us:",
16+
"Zerial_See_Support_Ways": "See Ways...",
17+
"Zerial_Seсonds_To_Start": " seconds to start ...",
18+
"Zerial_Splash_Title": "Zerial (Community Edition) - serial (RS232/COM) device communications utility",
19+
"Zerial_File_Menu_Header": "_File",
20+
"Zerial_File_Sub_Menu_Header": "Coming soon ...",
21+
"Zerial_Help_Menu_Header": "_Help",
22+
"Zerial_Help_About_Sub_Menu_Header": "_About",
23+
"Zerial_Help_Support_Sub_Menu_Header": "_Support",
24+
"Zerial_Languages_Menu_Header": "_Languages",
25+
"Zerial_Main_Title": "Zerial (Community Edition) - serial (RS232/COM) device communications utility",
26+
"Zerial_Port_Label": "Port:",
27+
"Zerial_Baud_Rate_Label": "Baud rate:",
28+
"Zerial_Byte_Length_Label": "Byte length:",
29+
"Zerial_Stop_Bits_Label": "Stop bits:",
30+
"Zerial_Parity_Label": "Parity:",
31+
"Zerial_Flow_Control_Label": "Flow control:",
32+
"Zerial_Connect_Button_Connect": "Connect",
33+
"Zerial_Connect_Button_Disconnect": "Disconnect",
34+
"Zerial_Send_Button": "Send",
35+
"Zerial_Clear_Button": "Clear",
36+
"Zerial_No_Stop_Bits": "None",
37+
"Zerial_One_Stop_Bits": "One",
38+
"Zerial_One_And_Half_Stop_Bits": "One and half",
39+
"Zerial_Two_Stop_Bits": "Two",
40+
"Zerial_No_Parity": "No parity",
41+
"Zerial_Mark_Parity": "Mark",
42+
"Zerial_Space_Parity": "Space",
43+
"Zerial_Even_Parity": "Even",
44+
"Zerial_Odd_Parity": "Odd",
45+
"Zerial_No_Flow_Control": "No",
46+
"Zerial_RTS_CTS_Flow_Control": "RTS/CTS",
47+
"Zerial_Xon_Xoff_Flow_Control": "Xon/Xoff",
48+
"Zerial_Device_Connected_State": "Connected",
49+
"Zerial_Device_Disconnected_State": "Disconnected",
50+
"Zerial_Device_Not_Exist": "Device does not exists",
51+
"Zerial_Selected_Port_Status_Bar": "Selected Port: {0}",
52+
"Zerial_Device_Status_In_Status_Bar": "Status: {0}",
53+
"Zerial_Device_Application_Status_Message": "Application started",
54+
"Zerial_Data_Conversion_Error_Message": "Unable to send data to Serial (COM, USB-COM) device, due to it can't be converted into bytes",
55+
"Zerial_Data_Not_Send_Error_Message": "Data wasn't send to device",
56+
"Zerial_Date_Time_Format": "yyyy-MM-dd HH:mm:ss",
57+
"Zerial_Data_Read_Message_Prefix": "Read",
58+
"Zerial_Data_Write_Message_Prefix": "Write",
59+
"Zerial_Bit_Unit": "bit",
60+
"Zerial_Bit_Per_Sec_Unit": "b/s",
61+
"Zerial_Stop_Bit_Designation" : "Sb",
62+
"Zerial_No_Parity_Designation" : "No P",
63+
"Zerial_No_Flow_Control_Designation" : "No FC",
64+
"Zerial_Bytes_Sent_Stats_Template" : "Bytes sent: {0}",
65+
"Zerial_Bytes_Received_Stats_Template" : "Bytes received: {0}"
66+
}
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
{
2+
"Zerial_Version_Label": "Версия:",
3+
"Zerial_Version": "1.1.0",
4+
"Zerial_Authors_Label": "Авторы:",
5+
"Zerial_Authors": "М.В.Ушаков",
6+
"Zerial_Owner_Label": "Владелец:",
7+
"Zerial_Owner": "ООО \"Висанс\"",
8+
"Zerial_Owner_Website_Label": "Сайт владельца:",
9+
"Zerial_Owner_Website": "https://wissance.com",
10+
"Zerial_Product_Url_Label": "Сайт проекта:",
11+
"Zerial_Product_Url": "https://github.com/Wissance/Zerial",
12+
"Zerial_Support_Url": "https://github.com/Wissance/Zerial/blob/master/Support.md",
13+
"Zerial_About_Title": "О программе Zerial комьюнити версии",
14+
"Zerial_Designed_By": "Утилита разработана:",
15+
"Zerial_Support_Us": "Поддержать нас:",
16+
"Zerial_See_Support_Ways": "Смотреть способы...",
17+
"Zerial_Seсonds_To_Start": " секунд(ы) до старта ...",
18+
"Zerial_Splash_Title": "Zerial (Community версия) - утилита для взаимодействия с устройствами с последовательными (RS232/COM) портами",
19+
"Zerial_File_Menu_Header": "_Файл",
20+
"Zerial_File_Sub_Menu_Header": "Ожидается в скором времени ...",
21+
"Zerial_Help_Menu_Header": "_Помощь",
22+
"Zerial_Help_About_Sub_Menu_Header": "_О Прогамме",
23+
"Zerial_Help_Support_Sub_Menu_Header": "_Поддержка",
24+
"Zerial_Languages_Menu_Header": "_Языки",
25+
"Zerial_Main_Title": "Zerial (Community версия) - утилита для взаимодействия с устройствами с последовательными (RS232/COM) портами",
26+
"Zerial_Port_Label": "Порт:",
27+
"Zerial_Baud_Rate_Label": "Скорость:",
28+
"Zerial_Byte_Length_Label": "Длина байта:",
29+
"Zerial_Stop_Bits_Label": "Cтоп бит:",
30+
"Zerial_Parity_Label": "Четность:",
31+
"Zerial_Flow_Control_Label": "Упр. потоком:",
32+
"Zerial_Connect_Button_Connect": "Открыть",
33+
"Zerial_Connect_Button_Disconnect": "Закрыть",
34+
"Zerial_Send_Button": "Отправить",
35+
"Zerial_Clear_Button": "Очистить",
36+
"Zerial_No_Stop_Bits": "Нет",
37+
"Zerial_One_Stop_Bits": "Один",
38+
"Zerial_One_And_Half_Stop_Bits": "Полтора",
39+
"Zerial_Two_Stop_Bits": "Два",
40+
"Zerial_No_Parity": "Нет",
41+
"Zerial_Mark_Parity": "Марк",
42+
"Zerial_Space_Parity": "Спэйс",
43+
"Zerial_Even_Parity": "Четн",
44+
"Zerial_Odd_Parity": "Нечетн",
45+
"Zerial_No_Flow_Control": "Нет",
46+
"Zerial_RTS_CTS_Flow_Control": "RTS/CTS",
47+
"Zerial_Xon_Xoff_Flow_Control": "Xon/Xoff",
48+
"Zerial_Device_Connected_State": "Подключено",
49+
"Zerial_Device_Disconnected_State": "Отключено",
50+
"Zerial_Device_Not_Exist": "Устройство отсутсвует в системе",
51+
"Zerial_Selected_Port_Status_Bar": "Выбранное устройство: {0}",
52+
"Zerial_Device_Status_In_Status_Bar": "Статус: {0}",
53+
"Zerial_Device_Application_Status_Message": "Приложение запущено",
54+
"Zerial_Data_Conversion_Error_Message": "Невозможно отправить сообщение в последовательное (COM, USB-COM) устройство, видду того, что данные не могут быть преобразованы в массив байт",
55+
"Zerial_Data_Not_Send_Error_Message": "Данные не были отправлены в устройство",
56+
"Zerial_Date_Time_Format": "yyyy-MM-dd HH:mm:ss",
57+
"Zerial_Data_Read_Message_Prefix": "Чтение",
58+
"Zerial_Data_Write_Message_Prefix": "Запись",
59+
"Zerial_Bit_Unit": "бит",
60+
"Zerial_Bit_Per_Sec_Unit": "б/с",
61+
"Zerial_Stop_Bit_Designation" : "Сб",
62+
"Zerial_No_Parity_Designation" : "Б/ч",
63+
"Zerial_No_Flow_Control_Designation" : "Б/упр",
64+
"Zerial_Bytes_Sent_Stats_Template" : "Байт отправлено: {0}",
65+
"Zerial_Bytes_Received_Stats_Template" : "Байт получено: {0}"
66+
}
Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,29 @@
1+
using Jeek.Avalonia.Localization;
12
using Wissance.Zerial.Desktop.Models;
23

34
namespace Wissance.Zerial.Desktop
45
{
56
public static class Globals
67
{
7-
// todo(UMV): place Links Here
8-
public static AppVersionModel CurrentAppVersion
8+
static Globals()
99
{
10-
get
10+
CurrentAppVersion = new AppVersionModel()
1111
{
12-
return _appVersion;
13-
}
12+
Version = Localizer.Get(VersionKey),
13+
CompanyWebSite = Localizer.Get(CompanyWebsiteKey),
14+
Company = Localizer.Get(CompanyKey),
15+
Author = Localizer.Get(AuthorKey)
16+
};
1417
}
1518

16-
private static readonly AppVersionModel _appVersion = new AppVersionModel()
17-
{
18-
Version = AppVersion,
19-
CompanyWebSite = WissanceWebSiteUrl,
20-
Company = "Wissance LLC (ООО \"Висанс\")",
21-
Author = "M.V.Ushakov"
22-
};
23-
24-
public const string ConnectButtonConnectText = "Connect";
25-
public const string ConnectButtonDisconnectText = "Disconnect";
19+
// todo(UMV): place Links Here
20+
public static AppVersionModel CurrentAppVersion { get; }
2621

27-
public const string AppVersion = "1.0";
28-
public const string WissanceWebSiteUrl = "https://wissance.com/en"; //todo(use from model)
22+
private const string VersionKey = "Zerial_Version";
23+
private const string CompanyKey = "Zerial_Owner";
24+
private const string AuthorKey = "Zerial_Authors";
25+
private const string CompanyWebsiteKey = "Zerial_Owner_Website";
26+
2927
public const string MVUGithubUrl = "https://github.com/EvilLord666";
30-
public const string SupportUrl = "https://github.com/Wissance/Zerial/blob/master/Support.md";
3128
}
3229
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
using System.Collections.Generic;
2+
using System.ComponentModel;
3+
using System.Runtime.CompilerServices;
4+
5+
namespace Wissance.Zerial.Desktop.Models
6+
{
7+
public class AppLanguageModel
8+
{
9+
public string Language { get; set; }
10+
public bool IsSelected { get; set; }
11+
}
12+
}

0 commit comments

Comments
 (0)