diff --git a/src/KOAStudio.Core/Helpers/GithubVersion.cs b/src/KOAStudio.Core/Helpers/GithubVersion.cs new file mode 100644 index 0000000..497bd3f --- /dev/null +++ b/src/KOAStudio.Core/Helpers/GithubVersion.cs @@ -0,0 +1,19 @@ +using System.Net.Http; +using System.Net.Http.Headers; +using System.Net.Http.Json; + +namespace KOAStudio.Core.Helpers +{ + public record GithubTagInfo(string html_url, string tag_name, string name, string published_at, string body); + public static class GithubVersion + { + public static Task?> GetRepoTagInfos(string Username, string Repository) + { + // 깃헙 릴리즈 태그에서 가져오기 + HttpClient client = new(); + var pih = ProductInfoHeaderValue.Parse(Repository); + client.DefaultRequestHeaders.UserAgent.Add(pih); + return client.GetFromJsonAsync>($"https://api.github.com/repos/{Username}/{Repository}/releases"); + } + } +} diff --git a/src/KOAStudio.Core/Helpers/OcxPathHelper.cs b/src/KOAStudio.Core/Helpers/OcxPathHelper.cs index 4071ef1..3809b88 100644 --- a/src/KOAStudio.Core/Helpers/OcxPathHelper.cs +++ b/src/KOAStudio.Core/Helpers/OcxPathHelper.cs @@ -23,7 +23,7 @@ private static string GetDefaultRegistryValue(RegistryKey rootKey, string regPat using var regKey = rootKey.OpenSubKey(regPath); if (regKey != null) { - string defaultValue = (string)regKey.GetValue(""); + if (regKey.GetValue("") is string defaultValue) { return defaultValue; } diff --git a/src/KOAStudio.Core/KOAStudio.Core.csproj b/src/KOAStudio.Core/KOAStudio.Core.csproj index f099ce4..013ec5d 100644 --- a/src/KOAStudio.Core/KOAStudio.Core.csproj +++ b/src/KOAStudio.Core/KOAStudio.Core.csproj @@ -1,14 +1,13 @@  - default - net48 + net8.0-windows enable true enable x86;x64 - $(NoWarn);MA0048;MA0053;MA0069 + $(NoWarn);MA0048;MA0053;MA0069;IDE1006 @@ -21,6 +20,7 @@ + diff --git a/src/KOAStudio.Core/ViewModels/KOAWindowViewModel.cs b/src/KOAStudio.Core/ViewModels/KOAWindowViewModel.cs index 2f47c0a..175aa71 100644 --- a/src/KOAStudio.Core/ViewModels/KOAWindowViewModel.cs +++ b/src/KOAStudio.Core/ViewModels/KOAWindowViewModel.cs @@ -1,8 +1,10 @@ using CommunityToolkit.Mvvm.ComponentModel; using CommunityToolkit.Mvvm.Input; using CommunityToolkit.Mvvm.Messaging; +using KOAStudio.Core.Helpers; using KOAStudio.Core.Models; using KOAStudio.Core.Services; +using KOAStudio.Core.Views; using System.Windows.Controls; namespace KOAStudio.Core.ViewModels @@ -11,19 +13,19 @@ internal partial class KOAWindowViewModel : ObservableObject { private readonly IUIRequest _uiRequest; private readonly string _baseTitle; + private readonly string _appVersion; + private IList? _releaseTags; public KOAWindowViewModel(IUIRequest uiRequest) { var assemblyName = System.Windows.Application.ResourceAssembly.GetName(); - _baseTitle = $"{assemblyName.Name} v{assemblyName.Version.Major}.{assemblyName.Version.Minor} - {(Environment.Is64BitProcess ? "64비트" : "32비트")}"; + _appVersion = $"{assemblyName.Version!.Major}.{assemblyName.Version.Minor}"; + _baseTitle = $"{assemblyName.Name} v{_appVersion} - {(Environment.Is64BitProcess ? "64비트" : "32비트")}"; _uiRequest = uiRequest; _title = _baseTitle; _menuCustomizeHeaderText = "Custom"; - _searchText = string.Empty; - _resultText = string.Empty; - _statusText = "준비됨"; WeakReferenceMessenger.Default.Register(this, (r, m) => { @@ -65,6 +67,8 @@ public KOAWindowViewModel(IUIRequest uiRequest) { UserContent = m.Control; }); + + _ = CheckVersionAsync(); } [ObservableProperty] @@ -77,12 +81,15 @@ public KOAWindowViewModel(IUIRequest uiRequest) private List? _menuCustomizeItems; [ObservableProperty] - private string _statusText; + private string _statusText = "준비됨"; + + [ObservableProperty] + private string _statusUrl = string.Empty; [ObservableProperty] - private string _searchText; + private string _searchText = string.Empty; - private string _resultText; + private string _resultText = string.Empty; public string ResultText { get => _resultText; @@ -122,6 +129,47 @@ private void Closed() _uiRequest.Close(); } + [RelayCommand] + static void Hyperlink_RequestNavigate(Uri url) + { + var sInfo = new System.Diagnostics.ProcessStartInfo(url.AbsoluteUri) + { + UseShellExecute = true, + }; + System.Diagnostics.Process.Start(sInfo); + } + + private async Task CheckVersionAsync() + { + // 깃헙에서 최신 버전 정보 가져오기 + + _releaseTags = await GithubVersion.GetRepoTagInfos("teranum", "KOAStudio").ConfigureAwait(true); + if (_releaseTags != null && _releaseTags.Count > 0) + { + var lastTag = _releaseTags[0]; + if (string.Equals(lastTag.tag_name, _appVersion)) + { + StatusText = "최신 버전입니다."; + } + else + { + StatusUrl = lastTag.html_url; + StatusText = $"새로운 버전({lastTag.tag_name})이 있습니다."; + } + } + } + + [RelayCommand] + void Menu_Version() + { + // 버젼 정보 + if (_releaseTags != null && _releaseTags.Count != 0) + { + var versionView = new VersionView(_releaseTags); + versionView.ShowDialog(); + } + } + [RelayCommand(CanExecute = nameof(CanMenuLogin))] private void MenuLogin() { diff --git a/src/KOAStudio.Core/Views/KOAWindow.xaml b/src/KOAStudio.Core/Views/KOAWindow.xaml index ee68e59..3775975 100644 --- a/src/KOAStudio.Core/Views/KOAWindow.xaml +++ b/src/KOAStudio.Core/Views/KOAWindow.xaml @@ -55,6 +55,9 @@ + + + @@ -116,6 +119,17 @@ VerticalAlignment="Bottom" Background="#FF0C4B73"> + + + + + + + diff --git a/src/KOAStudio.Core/Views/VersionView.xaml b/src/KOAStudio.Core/Views/VersionView.xaml new file mode 100644 index 0000000..2d2d6f2 --- /dev/null +++ b/src/KOAStudio.Core/Views/VersionView.xaml @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/KOAStudio.Core/Views/VersionView.xaml.cs b/src/KOAStudio.Core/Views/VersionView.xaml.cs new file mode 100644 index 0000000..53bd9b4 --- /dev/null +++ b/src/KOAStudio.Core/Views/VersionView.xaml.cs @@ -0,0 +1,34 @@ +using KOAStudio.Core.Helpers; +using System.Diagnostics; +using System.Windows; +using System.Windows.Navigation; + +namespace KOAStudio.Core.Views +{ + /// + /// Interaction logic for VersionView.xaml + /// + public partial class VersionView : Window + { + public IList TagInfos { get; } + + public VersionView(IList tagInfos) + { + InitializeComponent(); + Owner = Application.Current.MainWindow; + TagInfos = tagInfos; + + this.DataContext = this; + } + + private void Hyperlink_RequestNavigate(object sender, RequestNavigateEventArgs e) + { + var sInfo = new ProcessStartInfo(e.Uri.AbsoluteUri) + { + UseShellExecute = true, + }; + Process.Start(sInfo); + e.Handled = true; + } + } +} diff --git a/src/KOAStudio/App.xaml.cs b/src/KOAStudio/App.xaml.cs index 003bfd5..01980d1 100644 --- a/src/KOAStudio/App.xaml.cs +++ b/src/KOAStudio/App.xaml.cs @@ -4,6 +4,7 @@ using KOAStudio.Core.Services; using KOAStudio.Core.Views; using Microsoft.Extensions.DependencyInjection; +using System.Text; using System.Windows; namespace KOAStudio @@ -15,6 +16,7 @@ public partial class App : Application { public App() { + Encoding.RegisterProvider(CodePagesEncodingProvider.Instance); Ioc.Default.ConfigureServices( new ServiceCollection() diff --git a/src/KOAStudio/Business/BusinessLogic.ApiEvents.cs b/src/KOAStudio/Business/BusinessLogic.ApiEvents.cs index f322036..62a473e 100644 --- a/src/KOAStudio/Business/BusinessLogic.ApiEvents.cs +++ b/src/KOAStudio/Business/BusinessLogic.ApiEvents.cs @@ -1,5 +1,4 @@ using KHOpenApi.NET; -using KOAStudio.Core.Helpers; using KOAStudio.Core.Models; using KOAStudio.Core.ViewModels; using System.Diagnostics; diff --git a/src/KOAStudio/Business/BusinessLogic.UIRequest.cs b/src/KOAStudio/Business/BusinessLogic.UIRequest.cs index 484eba0..32a42df 100644 --- a/src/KOAStudio/Business/BusinessLogic.UIRequest.cs +++ b/src/KOAStudio/Business/BusinessLogic.UIRequest.cs @@ -70,7 +70,7 @@ public void ItemSelectedChanged(int tabIndex, IdTextItem selectedItem) case TAB_TREE_KIND.TR목록: { if (selectedItem.Id != 4 && selectedItem.Id != 14) return; - string selected_code = SelectedText.Substring(0, 8); + string selected_code = SelectedText[..8]; TR_SPECIAL? trData = _trDatas.Find(t => t.Code.Equals(selected_code, StringComparison.CurrentCultureIgnoreCase)); if (trData != null) { @@ -396,7 +396,7 @@ public void ReqTRHistory(int tabIndex, string text) int nSubPos = text.IndexOf(" : "); if (nSubPos != -1) { - codeName = text.Substring(nSubPos + " : ".Length); + codeName = text[(nSubPos + " : ".Length)..]; } } } @@ -404,7 +404,7 @@ public void ReqTRHistory(int tabIndex, string text) int nPos = codeName.IndexOf(" : "); if (nPos != -1) { - string code = codeName.Substring(0, nPos); + string code = codeName[..nPos]; for (int i = 0; i < _trDatas.Count; i++) { var trData = _trDatas[i]; @@ -437,9 +437,9 @@ public void QueryApiAction(string reqText, object parameters, bool bNext) if (SelectedText.Length < 7) return; if (parameters is not IList datagrid_PropertiesItems || _axOpenAPI == null || !_axOpenAPI.Created) return; - if (string.Equals(SelectedText.Substring(0, 2).ToUpper(), "OP")) // TR요청 + if (string.Equals(SelectedText[..2].ToUpper(), "OP")) // TR요청 { - string OptCode = SelectedText.Substring(0, SelectedText.IndexOf(" : ")); + string OptCode = SelectedText[..SelectedText.IndexOf(" : ")]; for (int i = 0; i < datagrid_PropertiesItems.Count; i++) { var nvd = datagrid_PropertiesItems[i]; @@ -457,7 +457,7 @@ public void QueryApiAction(string reqText, object parameters, bool bNext) szActionMsg = $" lRet = {lRet}"; } } - else if (string.Equals(SelectedText.Substring(0, 7), "조건검색 : ")) // 조건검색 + else if (string.Equals(SelectedText[..7], "조건검색 : ")) // 조건검색 { string? szScrNum = datagrid_PropertiesItems[0].Value; string? szCondName = datagrid_PropertiesItems[1].Value; @@ -477,9 +477,9 @@ public void QueryApiAction(string reqText, object parameters, bool bNext) szActionMsg = $"<조건검색 ({szCondName}) 요청: 실패> lRet = {lRet}"; } } - else if (string.Equals(SelectedText.Substring(0, 7), "함수호출 : ")) // 함수호출 + else if (string.Equals(SelectedText[..7], "함수호출 : ")) // 함수호출 { - string szFuncName = SelectedText.Substring("함수호출 : ".Length); + string szFuncName = SelectedText["함수호출 : ".Length..]; VariantWrapper[] Params = new VariantWrapper[datagrid_PropertiesItems.Count]; string parameter_text = string.Empty; diff --git a/src/KOAStudio/Business/BusinessLogic.UserContent.cs b/src/KOAStudio/Business/BusinessLogic.UserContent.cs index 1ec552c..6072b07 100644 --- a/src/KOAStudio/Business/BusinessLogic.UserContent.cs +++ b/src/KOAStudio/Business/BusinessLogic.UserContent.cs @@ -1,5 +1,4 @@ -using KOAStudio.Core.Helpers; -using KOAStudio.Core.Models; +using KOAStudio.Core.Models; using KOAStudio.Core.ViewModels; using KOAStudio.Core.Views; using System.Diagnostics; diff --git a/src/KOAStudio/Business/BusinessLogic.cs b/src/KOAStudio/Business/BusinessLogic.cs index ab04f30..6f67ede 100644 --- a/src/KOAStudio/Business/BusinessLogic.cs +++ b/src/KOAStudio/Business/BusinessLogic.cs @@ -13,7 +13,7 @@ namespace KOAStudio.Business; internal sealed partial class BusinessLogic(IAppRegistry appRegistry) : BaseAppLogic, IUIRequest { - [DllImport("kernel32")] private static extern int GetPrivateProfileString(string section, string key, string def, StringBuilder retVal, int size, string filePath); + [DllImport("kernel32", CharSet = CharSet.Unicode)] private static extern int GetPrivateProfileString(string section, string key, string def, StringBuilder retVal, int size, string filePath); private static string GetProfileString(string section, string key, string file) { StringBuilder temp = new(255); @@ -174,15 +174,16 @@ public void Initialize() OutputLogResetAllChangeState(); // - string[] FIDLines = Properties.Resources.FID_KORNAME.Split(['\r', '\n'], StringSplitOptions.RemoveEmptyEntries); + char[] separator = ['\r', '\n']; + string[] FIDLines = Properties.Resources.FID_KORNAME.Split(separator, StringSplitOptions.RemoveEmptyEntries); int nFIDLines = FIDLines.Length; foreach (string line in FIDLines) { int nPos = line.IndexOf('='); if (nPos > 0) { - string key = line.Substring(0, nPos); - string name = line.Substring(nPos + 1); + string key = line[..nPos]; + string name = line[(nPos + 1)..]; _map_FidToName.Add(key, name); } } @@ -306,7 +307,7 @@ private async void Load_TR목록Async() using var zip = new ZipArchive(file, ZipArchiveMode.Read); foreach (var entry in zip.Entries) { - string entruTitle = entry.Name.Substring(0, entry.Name.Length - 4); + string entruTitle = entry.Name[..^4]; if (entruTitle.Equals(FileTitle.ToUpper())) { using var stream = entry.Open(); @@ -324,11 +325,11 @@ private async void Load_TR목록Async() nPos = text.IndexOf("@START_", nPos); nPos += "@START_".Length; nPosEnd = text.IndexOf("\r\n", nPos); - string TRName = text.Substring(nPos, nPosEnd - nPos); + string TRName = text[nPos..nPosEnd]; trData.Name = TRName; nPos = nPosEnd + "\r\n".Length; nPosEnd = text.IndexOf("@END_", nPos); - string InputBody = text.Substring(nPos, nPosEnd - nPos); + string InputBody = text[nPos..nPosEnd]; trData.Inputs = GetKeyNames(InputBody); // [OUTPUT] nPos = nPosEnd; @@ -339,10 +340,10 @@ private async void Load_TR목록Async() OutName = text.Substring(nPos + 7, nPosEnd - nPos - 7); nPos = nPosEnd + 1; nPosEnd = text.IndexOf("\r\n", nPos); - OutIdent = text.Substring(nPos, nPosEnd - nPos); + OutIdent = text[nPos..nPosEnd]; nPos = nPosEnd + "\r\n".Length; nPosEnd = text.IndexOf("@END_", nPos); - string namebody = text.Substring(nPos, nPosEnd - nPos); + string namebody = text[nPos..nPosEnd]; if (OutIdent.Equals("*,*,*")) { trData.OutputSingle = GetKeyNames(namebody); @@ -353,7 +354,7 @@ private async void Load_TR목록Async() nPosEnd = text.IndexOf("\r\n", nPos); nPos = nPosEnd + "\r\n".Length; nPosEnd = text.IndexOf("@END_", nPos); - string ortherbody = text.Substring(nPos, nPosEnd - nPos); + string ortherbody = text[nPos..nPosEnd]; trData.OutputMuti = GetKeyNames(ortherbody); } } @@ -396,7 +397,7 @@ private async void Load_TR목록Async() // Outnput Single if (trData.OutputSingle != null) { - var hOutputSingle = new IdTextItem(8, $"싱글데이터 [{trData.Name.Substring(0, trData.Name.Length - 2)}]"); + var hOutputSingle = new IdTextItem(8, $"싱글데이터 [{trData.Name[..^2]}]"); foreach (var item in trData.OutputSingle) { hOutputSingle.AddChild(new IdTextItem(6, item)); @@ -406,7 +407,7 @@ private async void Load_TR목록Async() // Outnput Multi if (trData.OutputMuti != null) { - var hOutputMuti = new IdTextItem(8, $"멀티데이터 [{trData.Name.Substring(0, trData.Name.Length - 2)}]"); + var hOutputMuti = new IdTextItem(8, $"멀티데이터 [{trData.Name[..^2]}]"); foreach (var item in trData.OutputMuti) { hOutputMuti.AddChild(new IdTextItem(9, item)); @@ -439,7 +440,7 @@ static List GetKeyNames(string s) int pos = line.IndexOf('='); if (pos != -1) { - sections.Add(line.Substring(0, pos).Trim()); + sections.Add(line[..pos].Trim()); } } return sections; @@ -643,7 +644,7 @@ private async void Load_화면목록Async() { if (KeyAndValue.Key.Contains("TR_")) { - int nIndex = Convert.ToInt32(KeyAndValue.Key.Substring(3, KeyAndValue.Key.Length - 3)); + int nIndex = Convert.ToInt32(KeyAndValue.Key[3..]); if (ScrnSpecial.TRs != null && nIndex >= 0 && nIndex < ScrnSpecial.TRs.Length) ScrnSpecial.TRs[nIndex] = KeyAndValue.Value; } @@ -693,7 +694,7 @@ KEY_VALUE GetKeyAndValue(string s) { KEY_VALUE result; int nEndPos = s.IndexOf('='); - result.Key = s.Substring(0, nEndPos); + result.Key = s[..nEndPos]; result.Value = s.Substring(nEndPos + 1, s.Length - nEndPos - 1); return result; } @@ -701,7 +702,7 @@ KEY_VALUE GetKeyAndValue(string s) string GetSection(string s) { int nEndPos = s.IndexOf(']'); - return s.Substring(1, nEndPos - 1); + return s[1..nEndPos]; } } diff --git a/src/KOAStudio/KOAStudio.csproj b/src/KOAStudio/KOAStudio.csproj index c07cdab..ceede8d 100644 --- a/src/KOAStudio/KOAStudio.csproj +++ b/src/KOAStudio/KOAStudio.csproj @@ -2,8 +2,7 @@ WinExe - default - net48 + net8.0-windows enable enable @@ -11,7 +10,7 @@ app.ico $(SolutionDir)bin\ x86;x64 - 1.1 + 1.2 false $(NoWarn);MA0048 @@ -20,10 +19,6 @@ - - - - True diff --git a/src/WKOAStudio/App.xaml.cs b/src/WKOAStudio/App.xaml.cs index c9c9558..a9085d7 100644 --- a/src/WKOAStudio/App.xaml.cs +++ b/src/WKOAStudio/App.xaml.cs @@ -3,6 +3,7 @@ using KOAStudio.Core.Services; using KOAStudio.Core.Views; using Microsoft.Extensions.DependencyInjection; +using System.Text; using System.Windows; using WKOAStudio.Business; @@ -15,6 +16,7 @@ public partial class App : Application { public App() { + Encoding.RegisterProvider(CodePagesEncodingProvider.Instance); Ioc.Default.ConfigureServices( new ServiceCollection() diff --git a/src/WKOAStudio/AssemblyInfo.cs b/src/WKOAStudio/AssemblyInfo.cs index 7aee22a..8b5504e 100644 --- a/src/WKOAStudio/AssemblyInfo.cs +++ b/src/WKOAStudio/AssemblyInfo.cs @@ -1,4 +1,3 @@ -using System.Reflection; using System.Windows; [assembly: ThemeInfo( diff --git a/src/WKOAStudio/Business/BusinessLogic.ApiEvents.cs b/src/WKOAStudio/Business/BusinessLogic.ApiEvents.cs index b0d3123..b691c72 100644 --- a/src/WKOAStudio/Business/BusinessLogic.ApiEvents.cs +++ b/src/WKOAStudio/Business/BusinessLogic.ApiEvents.cs @@ -1,5 +1,4 @@ using KFOpenApi.NET; -using KOAStudio.Core.Helpers; using KOAStudio.Core.Models; using KOAStudio.Core.ViewModels; using System.Diagnostics; diff --git a/src/WKOAStudio/Business/BusinessLogic.UIRequests.cs b/src/WKOAStudio/Business/BusinessLogic.UIRequests.cs index 494b24b..844d19d 100644 --- a/src/WKOAStudio/Business/BusinessLogic.UIRequests.cs +++ b/src/WKOAStudio/Business/BusinessLogic.UIRequests.cs @@ -71,7 +71,7 @@ public void ItemSelectedChanged(int tabIndex, IdTextItem selectedItem) case TAB_TREE_KIND.TR목록: { if (selectedItem.Id != 4 && selectedItem.Id != 14) return; - string selected_code = SelectedText.Substring(0, 8); + string selected_code = SelectedText[..8]; TR_SPECIAL? trData = _trDatas.Find(t => t.Code.Equals(selected_code, StringComparison.CurrentCultureIgnoreCase)); if (trData != null) { @@ -158,7 +158,7 @@ public void ItemSelectedChanged(int tabIndex, IdTextItem selectedItem) int nFindPos = SelectedText.IndexOf(':'); if (nFindPos > 0) { - string trCode = SelectedText.Substring(0, nFindPos).Trim(); + string trCode = SelectedText[..nFindPos].Trim(); var trData = _trDatas.Find(tr => tr.Code.Equals(trCode, StringComparison.OrdinalIgnoreCase)); if (trData != null) { @@ -367,7 +367,7 @@ public void ReqTRHistory(int tabIndex, string text) int nSubPos = text.IndexOf(" : "); if (nSubPos != -1) { - codeName = text.Substring(nSubPos + " : ".Length); + codeName = text[(nSubPos + " : ".Length)..]; } } } @@ -375,7 +375,7 @@ public void ReqTRHistory(int tabIndex, string text) int nPos = codeName.IndexOf(" : "); if (nPos != -1) { - string code = codeName.Substring(0, nPos); + string code = codeName[..nPos]; for (int i = 0; i < _trDatas.Count; i++) { var trData = _trDatas[i]; @@ -409,9 +409,9 @@ public void QueryApiAction(string reqText, object parameters, bool bNext) if (SelectedText.Length < 7) return; if (parameters is not IList datagrid_PropertiesItems || _axOpenAPI == null || !_axOpenAPI.Created) return; - if (string.Equals(SelectedText.Substring(0, 2).ToUpper(), "OP")) // TR요청 + if (string.Equals(SelectedText[..2].ToUpper(), "OP")) // TR요청 { - string OptCode = SelectedText.Substring(0, SelectedText.IndexOf(" : ")); + string OptCode = SelectedText[..SelectedText.IndexOf(" : ")]; for (int i = 0; i < datagrid_PropertiesItems.Count; i++) { var nvd = datagrid_PropertiesItems[i]; @@ -429,9 +429,9 @@ public void QueryApiAction(string reqText, object parameters, bool bNext) szActionMsg = $" lRet = {lRet}"; } } - else if (string.Equals(SelectedText.Substring(0, 7), "함수호출 : ")) // 함수호출 + else if (string.Equals(SelectedText[..7], "함수호출 : ")) // 함수호출 { - string szFuncName = SelectedText.Substring("함수호출 : ".Length); + string szFuncName = SelectedText["함수호출 : ".Length..]; VariantWrapper[] Params = new VariantWrapper[datagrid_PropertiesItems.Count]; string parameter_text = string.Empty; diff --git a/src/WKOAStudio/Business/BusinessLogic.UserContent.cs b/src/WKOAStudio/Business/BusinessLogic.UserContent.cs index 026a737..162c2b3 100644 --- a/src/WKOAStudio/Business/BusinessLogic.UserContent.cs +++ b/src/WKOAStudio/Business/BusinessLogic.UserContent.cs @@ -1,5 +1,4 @@ -using KOAStudio.Core.Helpers; -using KOAStudio.Core.Models; +using KOAStudio.Core.Models; using KOAStudio.Core.ViewModels; using KOAStudio.Core.Views; using System.Diagnostics; diff --git a/src/WKOAStudio/Business/BusinessLogic.cs b/src/WKOAStudio/Business/BusinessLogic.cs index ca3d511..991f880 100644 --- a/src/WKOAStudio/Business/BusinessLogic.cs +++ b/src/WKOAStudio/Business/BusinessLogic.cs @@ -11,7 +11,7 @@ namespace WKOAStudio.Business; internal sealed partial class BusinessLogic(IAppRegistry appRegistry) : BaseAppLogic, IUIRequest { - [DllImport("kernel32")] private static extern int GetPrivateProfileString(string section, string key, string def, StringBuilder retVal, int size, string filePath); + [DllImport("kernel32", CharSet = CharSet.Unicode)] private static extern int GetPrivateProfileString(string section, string key, string def, StringBuilder retVal, int size, string filePath); private static string GetProfileString(string section, string key, string file, int buflength = 255) { StringBuilder temp = new(buflength); @@ -145,7 +145,7 @@ private void GetIniFileData(string ini_path, IDictionary { IniFile_Info[section] = key_vals; } - section = line.Substring(1, line.Length - 2); + section = line[1..^1]; key_vals = []; } else @@ -427,7 +427,7 @@ private async void Load_TR목록Async() int size = 0; int pos = key_value.Value.IndexOf(','); if (pos >= 0) - size = Convert.ToInt32(key_value.Value.Substring(0, pos)); + size = Convert.ToInt32(key_value.Value[..pos]); trData.SizeSingle.Add(size); } } @@ -453,7 +453,7 @@ private async void Load_TR목록Async() int size = 0; int pos = key_value.Value.IndexOf(','); if (pos >= 0) - size = Convert.ToInt32(key_value.Value.Substring(0, pos)); + size = Convert.ToInt32(key_value.Value[..pos]); trData.SizeMuti.Add(size); } } @@ -477,7 +477,7 @@ private async void Load_TR목록Async() int size = 0; int pos = key_value.Value.IndexOf(','); if (pos >= 0) - size = Convert.ToInt32(key_value.Value.Substring(0, pos)); + size = Convert.ToInt32(key_value.Value[..pos]); trData.SizeMuti.Add(size); } } @@ -495,7 +495,7 @@ private async void Load_TR목록Async() int size = 0; int pos = key_value.Value.IndexOf(','); if (pos >= 0) - size = Convert.ToInt32(key_value.Value.Substring(0, pos)); + size = Convert.ToInt32(key_value.Value[..pos]); trData.SizeMuti_add.Add(size); } } @@ -602,7 +602,7 @@ private async void Load_개발가이드Async() int nPos = item.IndexOf('('); if (nPos > 0) { - string Title = item.Substring(0, nPos); + string Title = item[..nPos]; string path = item.Substring(nPos + 1, item.Length - nPos - 2); hChild.AddChild(new IdTextItem(9, Title)); string Content = string.Empty; diff --git a/src/WKOAStudio/WKOAStudio.csproj b/src/WKOAStudio/WKOAStudio.csproj index 2c440f8..cc8cc40 100644 --- a/src/WKOAStudio/WKOAStudio.csproj +++ b/src/WKOAStudio/WKOAStudio.csproj @@ -2,16 +2,15 @@ WinExe - default - net48 + net8.0-windows enable enable true app.ico $(SolutionDir)bin\ x86;x64 - 1.1 + 1.2 false $(NoWarn);MA0048 @@ -23,8 +22,4 @@ - - - -