private void OpenFile_OnClick(object sender, RoutedEventArgs e) { // Dictionary<string, Dictionary<string, string>> Library = new Dictionary<string, Dictionary<string, string>>(); Lang = Parsel.Parser(0); for (int i = 0; i < 4; i++) { if (Parsel.err[i] != null) { TextBlock error = new TextBlock { Text = "Не найден файл:" + Parsel.err[i] }; Func.Children.Add(error); Grid.SetColumn(error, 0); Grid.SetRow(error, 2 + (i + 1) * 2); } } Zapoln(Lang); }
private async void SaveFile_OnClick(object sender, RoutedEventArgs e) { FolderPicker folderPicker = new FolderPicker(); folderPicker.SuggestedStartLocation = PickerLocationId.Desktop; folderPicker.FileTypeFilter.Add("*"); StorageFolder folder = await folderPicker.PickSingleFolderAsync(); Lang[0] = WorkEN; Lang[1] = WorkAR; Lang[2] = WorkMN; Lang[3] = WorkRU; string[] SaveText = Parsel.LOC(); if (folder != null) { string[] lang = new string[] { "", "-ar", "-mn", "-ru" }; for (int i = 0; i < 4; i++) { try { int k = 0; string[] text = SaveText[i].Split('\n'); string Save = ""; for (int j = 0; j < text.Length - 1; j++) { if (text[j] != null) { if (text[j] != "\r" && text[j][0] != '#') { string[] temptext; temptext = text[j].Split('='); Dictionary <string, string> temp = (Dictionary <string, string>)Lang[i]; if (i == 0) { Save = Save + temptext[0] + "=" + Work1[k].Text + "\r\n"; } if (i == 1) { Save = Save + temptext[0] + "=" + Work2[k].Text + "\r\n"; } if (i == 2) { Save = Save + temptext[0] + "=" + Work3[k].Text + "\r\n"; } if (i == 3) { Save = Save + temptext[0] + "=" + Work4[k].Text + "\r\n"; } k++; } else { Save = Save + text[j] + "\n"; } } else { Save = Save + null + "\n"; } } StorageFile save = await folder.CreateFileAsync("Messages1" + lang[i] + ".lst", CreationCollisionOption.ReplaceExisting); if (save != null) { CachedFileManager.DeferUpdates(save); await FileIO.WriteTextAsync(save, Save); await CachedFileManager.CompleteUpdatesAsync(save); } } catch { TextBlock error = new TextBlock { Text = "Файл не сохранён: Messages1" + lang[i] + ".lst" }; Func.Children.Add(error); Grid.SetColumn(error, 0); Grid.SetRow(error, 10 + (i + 1) * 2); } } } }