HandyOrg / HandyWinGet

GUI for installing apps through WinGet and Creating Yaml file
MIT License
380 stars 33 forks source link

Hard coded string caused crash in non-English locale #51

Open hongwen000 opened 3 years ago

hongwen000 commented 3 years ago

In src/HandyWinget/Common/Helper.cs, line 314; "Name" string is hard coded, however, winget process does not always return "Name" as the header. Instead, its output depends on locale.

            try
            {
                string input = _wingetData.Substring(_wingetData.IndexOf("Name"));
                var lines = input.Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries).Skip(2);
                return lines;

            }
hongwen000 commented 3 years ago

Same problems occur in functions for installing/uninstalling applications. Would this project be kind to support non-English locale? (This might be done by importing localization files from winget source code).

ghost1372 commented 3 years ago

Thank you. There is currently no better way to identify installed apps and we have to use substring. I will try to support other languages as well

hongwen000 commented 3 years ago

Thanks for your great work, I think substring with an additional translating function will be fine. I would like to try it when I'm done with my work at hand!

ghost1372 commented 3 years ago

Using the translation method is the last way, we must look for a better way to parse data