Skip to content

Commit

Permalink
🔥 Prepare for v0.4.5
Browse files Browse the repository at this point in the history
  • Loading branch information
SydneyOwl committed Jan 18, 2025
1 parent 4495173 commit 5276cf2
Show file tree
Hide file tree
Showing 43 changed files with 225 additions and 273 deletions.
9 changes: 3 additions & 6 deletions Constants/Common/TIPS.cs
Original file line number Diff line number Diff line change
@@ -1,20 +1,17 @@
using System;
using System.Collections.Generic;
using Avalonia.Controls.Shapes;
using System.Collections.Generic;
using SenhaixFreqWriter.Properties;
using Path = System.IO.Path;

namespace SenhaixFreqWriter.Constants.Common;

public class Tips
{
private static string _backupRootPath = Settings.Load().BackupPath;
private static readonly string _backupRootPath = Settings.Load().BackupPath;

public static List<string> TipList = new()
{
"Tips: 对信道进行拖动或清空等操作后序号可能会出现序号异常或字段被清空等问题,此时上下拉动右侧滚动条刷新界面即可!",
"Tips: 如遇到任何问题,欢迎在github中提出issue或PR!",
$"Tips: 软件版本:{(Properties.Version.VersionTag == "@TAG_NAME@" ? "(内部版本)" : Properties.Version.VersionTag)},可在github上检查、获取更新!",
$"Tips: 软件版本:{(Version.VersionTag == "@TAG_NAME@" ? "(内部版本)" : Version.VersionTag)},可在github上检查、获取更新!",
"Tips: 体谅、忠诚、进步、友爱、适度、爱国",
"Tips: 目前仅8800支持蓝牙写频!",
$"可以在{_backupRootPath}查看到自动备份记录!"
Expand Down
4 changes: 2 additions & 2 deletions Constants/Gt12/FUNCTION_CHOICE.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,12 @@ public class FunctionChoice
{
Language.GetString("off"), Language.GetString("on")
};

public static ObservableCollection<string> RelayMode = new()
{
Language.GetString("off"), Language.GetString("on")
};

public static ObservableCollection<string> RelaySpeaker = new()
{
Language.GetString("off"), Language.GetString("on")
Expand Down
20 changes: 10 additions & 10 deletions DataModels/Gt12/AppData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,16 @@ public AppData()
}
}

public void SaveToFile(Stream s)
{
var serializer = new JsonSerializer();
serializer.Formatting = Formatting.Indented;
using (var streamWriter = new StreamWriter(s, Encoding.UTF8))
{
serializer.Serialize(streamWriter, Instance);
}
}

public static AppData GetInstance()
{
if (Instance != null) return Instance;
Expand All @@ -53,16 +63,6 @@ public static AppData ForceNewInstance()
return Instance;
}

public void SaveToFile(Stream s)
{
var serializer = new JsonSerializer();
serializer.Formatting = Formatting.Indented;
using (var streamWriter = new StreamWriter(s, Encoding.UTF8))
{
serializer.Serialize(streamWriter, Instance);
}
}


public static void CreatObjFromFile(Stream s)
{
Expand Down
8 changes: 5 additions & 3 deletions DataModels/Gt12/Function.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ public partial class Function : ObservableObject
[ObservableProperty] private int _powerOnDisType;
[ObservableProperty] private int _powerUpDisTime = 3;
[ObservableProperty] private int _pttDly = 6;

[ObservableProperty] private int _relaySpeakerSw;

// 中转相关
[ObservableProperty] private int _relaySw;
[ObservableProperty] private int _roger;
[ObservableProperty] private int _rptTailClear = 5;
[ObservableProperty] private int _rptTailDet = 5;
Expand All @@ -43,7 +48,4 @@ public partial class Function : ObservableObject
[ObservableProperty] private int _vox = 1;
[ObservableProperty] private int _voxDlyTime = 5;
[ObservableProperty] private int _voxSw;
// 中转相关
[ObservableProperty] private int _relaySw;
[ObservableProperty] private int _relaySpeakerSw;
}
20 changes: 10 additions & 10 deletions DataModels/Shx8800Pro/AppData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,16 @@ public AppData()
}
}

public void SaveToFile(Stream s)
{
var serializer = new JsonSerializer();
serializer.Formatting = Formatting.Indented;
using (var streamWriter = new StreamWriter(s, Encoding.UTF8))
{
serializer.Serialize(streamWriter, Instance);
}
}

public static AppData GetInstance()
{
if (Instance != null) return Instance;
Expand All @@ -51,16 +61,6 @@ public static AppData ForceNewInstance()
return Instance;
}

public void SaveToFile(Stream s)
{
var serializer = new JsonSerializer();
serializer.Formatting = Formatting.Indented;
using (var streamWriter = new StreamWriter(s, Encoding.UTF8))
{
serializer.Serialize(streamWriter, Instance);
}
}


public static void CreatObjFromFile(Stream s)
{
Expand Down
2 changes: 1 addition & 1 deletion DataModels/Shx8800Pro/Channel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ namespace SenhaixFreqWriter.DataModels.Shx8800Pro;
public partial class Channel : ObservableObject
{
[ObservableProperty] private int _bandwide; //
[ObservableProperty] private int _busyLock;

[ObservableProperty]
// Useless member: id
Expand All @@ -19,7 +20,6 @@ public partial class Channel : ObservableObject
[ObservableProperty] private string _rxFreq = ""; //
[ObservableProperty] private int _scanAdd; //
[ObservableProperty] private int _signalGroup; //
[ObservableProperty] private int _busyLock;
[ObservableProperty] private string _strRxCtsDcs = "OFF"; //
[ObservableProperty] private string _strTxCtsDcs = "OFF"; //
[ObservableProperty] private string _txFreq = ""; //
Expand Down
2 changes: 1 addition & 1 deletion DataModels/Shx8800Pro/DTMF.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ public partial class Dtmf : ObservableObject
[ObservableProperty] private string[] _groupName = new string[15]; //seems useless...
[ObservableProperty] private int _idleTime = 1;
[ObservableProperty] private string _localId = "100";
[ObservableProperty] private int _pttid;
[ObservableProperty] private int _wordTime = 1;
[ObservableProperty] private int _pttid = 0;

public Dtmf()
{
Expand Down
2 changes: 1 addition & 1 deletion DataModels/Shx8800Pro/Function.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ public partial class Function : ObservableObject
[ObservableProperty] private int _menuQuitTime = 1; //
[ObservableProperty] private int _micGain = 1; //
[ObservableProperty] private int _powerOnDisType; //
[ObservableProperty] private int _pwrOnDlyTime; //
[ObservableProperty] private int _pttDly = 4; //
[ObservableProperty] private int _pwrOnDlyTime; //
[ObservableProperty] private int _roger; //
[ObservableProperty] private int _rptTailClear = 5; //
[ObservableProperty] private int _rptTailDet = 5; //
Expand Down
4 changes: 2 additions & 2 deletions Utils/BLE/Platforms/RPC/WSRPCBLE.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ namespace SenhaixFreqWriter.Utils.BLE.Platforms.RPC;
public class Wsrpcble : IBluetooth
{
private readonly bool _manual;
private Process _rpcClient;

private readonly WsrpcUtil _wsrpc;
private Settings _settings = Settings.Load();
private Process _rpcClient;
private readonly Settings _settings = Settings.Load();

public Wsrpcble(bool useManual)

Check warning on line 28 in Utils/BLE/Platforms/RPC/WSRPCBLE.cs

View workflow job for this annotation

GitHub Actions / build_FreqWriter

Non-nullable field '_rpcClient' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the field as nullable.
{
Expand Down
1 change: 1 addition & 0 deletions Utils/BLE/Platforms/Windows/WindowsSHXBLE.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Note: this is deprecated. all platforms use ble plugin(RPC).

#if false
using System;
using System.Collections.Generic;
Expand Down
17 changes: 8 additions & 9 deletions Utils/HID/HIDBootImage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,16 @@ namespace SenhaixFreqWriter.Utils.HID;

public class HidBootImage
{
private int _address;

private int _blockOfErase;

// private ComInfoIssue progressUpdate = new ComInfoIssue();

private readonly byte[] _bufferBmpData = new byte[1048576];

private readonly HidTools _hid = HidTools.GetInstance();
private readonly SKBitmap _img;
private int _address;

private int _blockOfErase;

private byte[] _bufForData = new byte[2048];

private uint _byteOfData;
Expand All @@ -31,15 +33,10 @@ public class HidBootImage

private string _curFilePath = "";

public ConcurrentQueue<int> CurrentProg = new();

private bool _flagOverTime;

private DataHelper _helper;

private readonly HidTools _hid = HidTools.GetInstance();
private readonly SKBitmap _img;

private Timer _overTimer;

private int _packageId;
Expand All @@ -58,6 +55,8 @@ public class HidBootImage

private CancellationTokenSource _wriImgTokenSource;

public ConcurrentQueue<int> CurrentProg = new();


// public ComInfoIssue ProgressUpdate
// {
Expand Down
6 changes: 3 additions & 3 deletions Utils/HID/HIDCommunication.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ public class HidCommunication
{
private readonly DataHelper _helper;

private readonly HidTools _hid = HidTools.GetInstance();

private readonly OpType _opType;

private readonly string[] _tblCtsdcs = new string[210]
Expand Down Expand Up @@ -47,8 +49,6 @@ public class HidCommunication

private bool _flagTransmitting;

private readonly HidTools _hid = HidTools.GetInstance();

private string _progressCont = "";

private int _progressVal;
Expand Down Expand Up @@ -229,7 +229,7 @@ private bool Write(CancellationToken token)
ushort num = 0;
byte b = 0;
var num2 = 0;

// 中转模式误触发保护功能:强制覆盖VFO设定,设定为航空频段防止误触发中转发射
// deprecated!!
// AppData.Vfos.VfoAFreq = "120.00000";
Expand Down
4 changes: 2 additions & 2 deletions Utils/HID/HIDTools.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ public class HidTools

private readonly CancellationTokenSource _pollTokenSource = new();

private readonly Settings _settings = Settings.Load();

public int BtDeviceMtu = 23;

public DeviceList DevList;
Expand All @@ -47,8 +49,6 @@ public class HidTools

public WriteValueAsync WriteBle;

private Settings _settings = Settings.Load();

private void UpdateChanDebugInfo(string a)
{
if (_settings.EnableDebugChanDataOutput) DebugWindow.GetInstance().UpdateDebugContent(a);
Expand Down
5 changes: 3 additions & 2 deletions Utils/Other/Language.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
using System.Resources;
using SenhaixFreqWriter.Properties;

namespace SenhaixFreqWriter.Utils.Other;

public class Language
{
public static ResourceManager manager = new(Properties.Resources.ResourceManager.BaseName,
typeof(Properties.Resources).Assembly);
public static ResourceManager manager = new(Resources.ResourceManager.BaseName,
typeof(Resources).Assembly);

public static string GetString(string key)
{
Expand Down
2 changes: 1 addition & 1 deletion Utils/Other/SysFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace SenhaixFreqWriter.Utils.Other;

public class SysFile
{
private static Settings _settings = Settings.Load();
private static readonly Settings _settings = Settings.Load();


private static bool DirCheck(string path)
Expand Down
4 changes: 2 additions & 2 deletions Utils/Other/WSRPCUtil.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ public class RpcResponse
public class WsrpcUtil
{
private static WsrpcUtil _instance;
private IWebSocketConnection _currentClient;
private readonly Queue<string> _normalDataQueue = new();
private IWebSocketConnection _currentClient;
private readonly Settings _settings = Settings.Load();
private WebSocketServer _wsServer;
private Settings _settings = Settings.Load();


public WsrpcUtil()
Expand Down
3 changes: 1 addition & 2 deletions Utils/Serial/DataHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@ namespace SenhaixFreqWriter.Utils.Serial;

public class DataHelper
{
private byte _command;

private ushort _args;
private byte _command;

public byte[] Payload = new byte[68];

Expand Down
6 changes: 3 additions & 3 deletions Utils/Serial/MySerialPort.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ public class MySerialPort : SerialPort

private Queue<byte> _rxData = new(1024);

public WriteValueAsync WriteBle;
private readonly Settings _settings = Settings.Load();

private Settings _settings = Settings.Load();
public WriteValueAsync WriteBle;
public int BtDeviceMtu { get; set; } = 23;

public int BytesToReadFromCache
Expand Down Expand Up @@ -96,7 +96,7 @@ private string WinSelectSerialByName()

return ccName;
}

// 同时存在两个USB串口,则不予选择
private string LinuxSelectSerialByName()
{
Expand Down
Loading

0 comments on commit 5276cf2

Please sign in to comment.