AcManager.Tools.ArgumentsHandler.ProcessGoogleSpreadsheetsLocale C# (CSharp) Method

ProcessGoogleSpreadsheetsLocale() public method

public ProcessGoogleSpreadsheetsLocale ( string id, [ locale, bool around ) : Task
id string
locale [
around bool
return Task
        public async Task<ArgumentHandleResult> ProcessGoogleSpreadsheetsLocale(string id, [CanBeNull] string locale, bool around) {
            if (string.IsNullOrWhiteSpace(id)) {
                throw new InformativeException("ID is missing");
            }

            var url = around ? $@"http://acstuff.ru/u/around?id={id}" : $@"https://docs.google.com/spreadsheets/d/{id}/export?format=xlsx&authuser=0";
            var path = await LoadRemoveFileTo(url, LocaleHelper.GetGoogleSheetsFilename());
            if (string.IsNullOrWhiteSpace(path)) {
                throw new InformativeException("Can’t load file");
            }

            SettingsHolder.Locale.LoadUnpacked = true;
            if (locale != null) {
                SettingsHolder.Locale.LocaleName = locale;
            }

            if (ModernDialog.ShowMessage("Custom locales updated. Would you like to restart app now?", "Locales Updated", MessageBoxButton.YesNo) ==
                    MessageBoxResult.Yes) {
                WindowsHelper.RestartCurrentApplication();
            }

            return ArgumentHandleResult.Successful;
        }