public void MissingManifestResource() { // NOTE: the cause of this issue was an incorrect namespace in SR.designer.cs // Appears to only be triggered when it tries to load an error message string from resource file Assert.Throws <InvalidOperationException>(() => { using (var writeStream = new System.IO.MemoryStream()){ ResXResourceWriter writer = new ResXResourceWriter(writeStream); writer.Generate(); writer.Generate(); // writer.AddResource("this is name", new byte[0]); } }); }
private void ExtensionToResx(string filePath, ResXResourceWriter resourceWriter, int pos) { var str = File.ReadAllText(filePath); str = str.Replace("msgid \"\"\r\n", "msgid "); str = str.Replace("\"\r\n\"", " "); var regex = new Regex(Expression); // Find matches. var matches = regex.Matches(str); // Report on each match. var dico = new Dictionary <string, string>(); foreach (Match match in matches) { var groups = match.Groups; var key = ToCamelCase(groups[1].Value).Trim(); var lowerKey = key.ToLower(); if (!string.IsNullOrWhiteSpace(groups[1].Value) && !string.IsNullOrWhiteSpace(key) && dico.Keys.All(k => k.ToLower() != lowerKey)) { dico.Add(key, groups[pos].Value); } } foreach (var lst in dico) { resourceWriter.AddResource(lst.Key, lst.Value); } ExtensionPluralToResx(filePath, resourceWriter, pos); resourceWriter.Generate(); resourceWriter.Close(); }
private static void PoToResx(string poFilePath) { var info = new System.IO.FileInfo(poFilePath); var derectoriinfo = new System.IO.DirectoryInfo(poFilePath); var str = System.IO.File.ReadAllText(poFilePath); var regex = new Regex(Expression); // Find matches. var matches = regex.Matches(str); // Report on each match. var resourceWriter = new ResXResourceWriter(poFilePath.Replace(".po", $".{derectoriinfo.Parent.Name}.resx")); var dico = new Dictionary <string, string>(); foreach (Match match in matches) { var groups = match.Groups; var key = ToCamelCase(groups[1].Value); if (!string.IsNullOrWhiteSpace(key) && !dico.ContainsKey(key)) { dico.Add(key, groups[2].Value); } } foreach (var lst in dico) { resourceWriter.AddResource(lst.Key, lst.Value); } resourceWriter.Generate(); resourceWriter.Close(); }
public static void Update(string className, string folderPath, List <LanguageModel> languageResources) { foreach (var languageResource in languageResources) { XmlDocument document = new XmlDocument(); var xmlPath = GetResxPath(className, folderPath, languageResource.Name); if (!File.Exists(xmlPath)) { throw new Exception("Cannot find 'Resouce' file"); } var resxItems = new List <DictionaryEntry>(); using (var reader = new ResXResourceReader(xmlPath)) { resxItems = reader.Cast <DictionaryEntry>().ToList(); } using (var writer = new ResXResourceWriter(xmlPath)) { foreach (var item in resxItems) { var value = item.Value; if (languageResource.Values.Any(x => x.Key.Equals(item.Key.ToString()))) { value = languageResource.Values.FirstOrDefault(x => x.Key.Equals(item.Key.ToString())).Value; } writer.AddResource(item.Key.ToString(), item.Value); } writer.Generate(); } } }
public static void RemoveRole(string rolename) { var reader = new ResXResourceReader(path); var node = reader.GetEnumerator(); var writer = new ResXResourceWriter(path); bool roleIn = false; while (node.MoveNext()) { if (!node.Key.ToString().Equals(rolename)) { writer.AddResource(node.Key.ToString(), node.Value.ToString()); } else { roleIn = true; } } if (!roleIn) { Console.Write("Ne postoji role {0}, nije", rolename); } else { Console.Write("Uspesno"); } writer.Generate(); writer.Close(); }
public static bool AddImageToResources(string name, Image img) { try { var reader = new ResXResourceReader(RESOURCES_FILE_NAME); var writer = new ResXResourceWriter(RESOURCES_FILE_NAME); var node = reader.GetEnumerator(); var nodeKeys = new List <String>(); while (node.MoveNext()) { var nodeKey = node.Key.ToString(); nodeKeys.Add(nodeKey); writer.AddResource(nodeKey, (Bitmap)node.Value); } if (!nodeKeys.Contains(name)) { writer.AddResource(name, img); } writer.Generate(); writer.Close(); } catch { return(false); } return(true); }
public static void UpdateResourceFile(string resourceKey, string value, string appConfigKeyForResourceFile) { var resx = new List <DictionaryEntry>(); using (var reader = new ResXResourceReader(appConfigKeyForResourceFile)) { resx = reader.Cast <DictionaryEntry>().ToList(); var existingResource = resx.Where(r => r.Key.ToString() == resourceKey).FirstOrDefault(); var modifiedResx = new DictionaryEntry() { Key = existingResource.Key, Value = value }; resx.Remove(existingResource); // REMOVING RESOURCE! resx.Add(modifiedResx); // AND THEN ADDING RESOURCE! } using (var writer = new ResXResourceWriter(appConfigKeyForResourceFile)) { resx.ForEach(r => { // Again Adding all resource to generate with final items writer.AddResource(r.Key.ToString(), r.Value.ToString()); }); writer.Generate(); } }
public void Test() { Thread.CurrentThread.CurrentCulture = Thread.CurrentThread.CurrentUICulture = new CultureInfo("de-DE"); ResXResourceWriter w = new ResXResourceWriter(fileName); w.AddResource("point", new Point(42, 43)); w.Generate(); w.Close(); int count = 0; ResXResourceReader r = new ResXResourceReader(fileName); IDictionaryEnumerator e = r.GetEnumerator(); while (e.MoveNext()) { if ((string)e.Key == "point") { Assert.AreEqual(typeof(Point), e.Value.GetType(), "#1"); Point p = (Point)e.Value; Assert.AreEqual(42, p.X, "#2"); Assert.AreEqual(43, p.Y, "#3"); count++; } } r.Close(); Assert.AreEqual(1, count, "#100"); }
public static void AddImage(string name, Image myImage) { //using (ResXResourceReader rsRed = new ResXResourceReader(WeddingStoreData.WeddingStoreResource.ResourceManager.BaseName)) //{ // IDictionaryEnumerator e = rsRed.GetEnumerator(); // while (e.MoveNext()) // { // string ahihi = e.Value.ToString(); // } //} //ResXResourceWriter myResWritter = new ResXResourceWriter(@".\WeddingStoreResource.resx"); //using (ResXResourceWriter myResWritter = new ResXResourceWriter(Properties.Resources.ResourceManager.BaseName)) //{ // myResWritter.AddResource(name, myUrl); // myResWritter.Generate(); //} //ResXResourceWriter RwX = new ResXResourceWriter("WeddingStoreData.WeddingStoreResource.resx"); //RwX.AddResource("ahihi", "Texssssss"); //RwX.Generate(); //RwX.Close(); //ResXResourceWriter res = new ResXResourceWriter(Assembly.GetExecutingAssembly().GetManifestResourceStream("WeddingStoreData.WeddingStoreResource.resx")); using (ResXResourceWriter res = new ResXResourceWriter("WeddingStoreData.WeddingStoreData.WeddingStoreResource.resx")) { res.AddResource(name, myImage); res.Generate(); } }
private void saveToolStripMenuItem_Click(object sender, EventArgs e) { using (var sfd = new SaveFileDialog() { InitialDirectory = Directory.GetCurrentDirectory(), Filter = @"resx files (*.resx)|*.resx|All files (*.*)|*.*", FilterIndex = 1, RestoreDirectory = true }) { if (sfd.ShowDialog() != DialogResult.OK) { return; } var path = sfd.FileName; File.Delete(path); var res = new ResXResourceWriter(path); int i = 1; foreach (DataGridViewRow row in dataGridView.Rows) { res.AddResource(i.ToString(), row.Cells["value"].Value); i++; } res.Generate(); res.Close(); MessageBox.Show(@"Vos traductions ont bien étés sauvegardés! Merci!"); } }
/// <summary> /// Записать зничения в файл. /// </summary> private void SaveNewValue(ResXResourceReader targetResourceReader, ResXResourceWriter targetResourceWriter, Dictionary <string, string> keyValuePairs) { try { var node = targetResourceReader.GetEnumerator(); while (node.MoveNext()) { targetResourceWriter.AddResource(node.Key.ToString(), node.Value.ToString()); } foreach (var keyValuePair in keyValuePairs) { targetResourceWriter.AddResource(new ResXDataNode(keyValuePair.Key, keyValuePair.Value)); _logService.AddMessage($"Добавлен ключ: {keyValuePair.Key} со значением: {keyValuePair.Value}"); } targetResourceWriter.Generate(); targetResourceWriter.Close(); _logService.AddMessage($"Все значения записаны."); } catch (Exception ex) { System.Windows.Forms.MessageBox.Show(ex.Message); } }
public void AddResource_WithComment() { ResXResourceWriter w = new ResXResourceWriter(fileName); ResXDataNode node = new ResXDataNode("key", "value"); node.Comment = "comment is preserved"; w.AddResource(node); w.Generate(); w.Close(); ResXResourceReader r = new ResXResourceReader(fileName); ITypeResolutionService typeres = null; r.UseResXDataNodes = true; int count = 0; foreach (DictionaryEntry o in r) { string key = o.Key.ToString(); node = (ResXDataNode)o.Value; string value = node.GetValue(typeres).ToString(); string comment = node.Comment; Assert.AreEqual("key", key, "key"); Assert.AreEqual("value", value, "value"); Assert.AreEqual("comment is preserved", comment, "comment"); Assert.AreEqual(0, count, "too many nodes"); count++; } r.Close(); File.Delete(fileName); }
public void SaveResourceFile(String FileName) { this.FileName = FileName; String x = Path.GetExtension(FileName); if ((String.Compare(x, ".xml", true) == 0) || (String.Compare(x, ".resX", true) == 0)) { ResXResourceWriter r = new ResXResourceWriter(FileName); IDictionaryEnumerator n = Resource.GetEnumerator(); while (n.MoveNext()) { r.AddResource((string)n.Key, (object)n.Value); } r.Generate(); r.Close(); } else { ResourceWriter r = new ResourceWriter(FileName); IDictionaryEnumerator n = Resource.GetEnumerator(); while (n.MoveNext()) { r.AddResource((string)n.Key, (object)n.Value); } r.Generate(); r.Close(); } }
public static void AddOrUpdateResource(string resourceFilepath, string newKey, string newValue) { string resourcesFile = resourceFilepath + @"\Resources.resx"; var reader = new ResXResourceReader(resourcesFile); //same fileName reader.BasePath = resourceFilepath; // this is very important var node = reader.GetEnumerator(); var writer = new ResXResourceWriter(resourcesFile);//same fileName(not new) while (node.MoveNext()) { string nodeKey = node.Key.ToString(); string nodeValue = node.Value.ToString(); if (nodeKey == "alter") { nodeValue += "\r\n" + newKey;//add new script name } writer.AddResource(nodeKey, nodeValue); } var newNode = new ResXDataNode(newKey, newValue); writer.AddResource(newNode); writer.Generate(); writer.Close(); }
public static void AddResource(Dictionary <string, object> res, string inputPath, string outputPath) { var dic = new Dictionary <string, ResXDataNode>(); using (var reader = new ResXResourceReader(inputPath) { UseResXDataNodes = true }) { dic = reader.Cast <DictionaryEntry>().ToDictionary(e => e.Key.ToString(), e => e.Value as ResXDataNode); foreach (var kv in res) { if (!dic.ContainsKey(kv.Key) && !SkipList.Contains(kv.Key)) { dic.Add(kv.Key, new ResXDataNode(kv.Key, kv.Value) { Comment = kv.Value.ToString() }); } } } using (var writer = new ResXResourceWriter(outputPath)) { foreach (var kv in dic) { writer.AddResource(kv.Key, kv.Value); } writer.Generate(); } }
public static void AddRole(string rolename) { var reader = new ResXResourceReader(path); var node = reader.GetEnumerator(); var writer = new ResXResourceWriter(path); bool roleIn = false; while (node.MoveNext()) { if (node.Key.ToString().Equals(rolename)) { roleIn = true; } writer.AddResource(node.Key.ToString(), node.Value.ToString()); } if (roleIn) { Console.Write("Već postoji role {0}, nije", rolename); } else { var newNode = new ResXDataNode(rolename, ""); writer.AddResource(newNode); Console.Write("Uspešno dodata role {0},", rolename); } writer.Generate(); writer.Close(); }
/// <summary> /// Saves current data from GUI to specified file /// </summary> public override void SaveFile(string path, uint format) { base.SaveFile(path, format); ResXResourceWriter writer = null; try { // get data from GUI Dictionary <string, ResXDataNode> data = UIControl.GetData(true); writer = new ResXResourceWriter(path); writer.BasePath = Path.GetDirectoryName(path); foreach (var o in data) { writer.AddResource(o.Value); } writer.Generate(); VLOutputWindow.VisualLocalizerPane.WriteLine("Saved file \"{0}\"", path); } catch (Exception ex) { VLOutputWindow.VisualLocalizerPane.WriteException(ex); VisualLocalizer.Library.Components.MessageBox.ShowException(ex); throw; } finally { if (writer != null) { writer.Close(); } } }
private static void GenResfile(List <ResxStrings> list, List <string> langs) { string path = System.IO.Directory.GetCurrentDirectory(); path = Path.Combine(path, @"data\resdata"); if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } else { Directory.Delete(path, true); Directory.CreateDirectory(path); } string pattern = "Resources";//Path.GetFileNameWithoutExtension(xlsxPath); foreach (string lang in langs) { string resxPath = Path.Combine(path, pattern + (lang != "DEFAULT" ? "." + lang : string.Empty) + ".resx"); using (ResXResourceWriter rsxw = new ResXResourceWriter(resxPath)) { foreach (var data in list) { ResXDataNode node = new ResXDataNode(data.Key, data.Strings[lang]); node.Comment = data.Comment; rsxw.AddResource(node); } rsxw.Generate(); rsxw.Close(); } } }
public override Task Save(FileSaveInformation info) { ResXDataNode[] nodes = widget.GetResxInfo(info.FileName); using (var stream = new MemoryStream()) { var resxWriter = new ResXResourceWriter(stream); foreach (var node in nodes) { resxWriter.AddResource(node); } resxWriter.Generate(); stream.Flush(); stream.Position = 0; //pretty xml var document = new XmlDocument(); document.Load(stream); document.Save(info.FileName); } ContentName = info.FileName; IsDirty = false; return(Task.FromResult(true)); }
/// <summary> /// Allow to load pictures in the folder View/Icons in a ressource file /// </summary> public void loadPictureInResource() { ResXResourceWriter rw = new ResXResourceWriter("Resources.resx"); foreach (string s in Directory.EnumerateFiles(@"..\..\View\Icons")) { FileStream byteStream = new FileStream(s, FileMode.Open); byte[] bytes = new byte[(int)byteStream.Length]; byteStream.Read(bytes, 0, (int)byteStream.Length); Bitmap bp = new Bitmap(byteStream); rw.AddResource(Path.GetFileNameWithoutExtension(s), bp); byteStream.Close(); } foreach (string s in Directory.EnumerateFiles(@"..\..\View\Icons\soundTexture")) { FileStream byteStream = new FileStream(s, FileMode.Open); byte[] bytes = new byte[(int)byteStream.Length]; byteStream.Read(bytes, 0, (int)byteStream.Length); Bitmap bp = new Bitmap(byteStream); rw.AddResource(Path.GetFileNameWithoutExtension(s), bp); byteStream.Close(); } foreach (string s in Directory.EnumerateFiles(@"..\..\View\Audience")) { FileStream byteStream = new FileStream(s, FileMode.Open); byte[] bytes = new byte[(int)byteStream.Length]; byteStream.Read(bytes, 0, (int)byteStream.Length); Bitmap bp = new Bitmap(byteStream); rw.AddResource(Path.GetFileNameWithoutExtension(s), bp); byteStream.Close(); } rw.Generate(); rw.Close(); }
public static void AddOrUpdateResource(DictionaryEntry newElement, string resourceFilepath) { var resx = new List <DictionaryEntry>(); using (var reader = new ResXResourceReader(resourceFilepath)) { resx = reader.Cast <DictionaryEntry>().ToList(); var existingResource = resx.Where(r => r.Key == newElement.Key).FirstOrDefault(); if (existingResource.Key == null && existingResource.Value == null) // NEW! { resx.Add(newElement); } else // MODIFIED RESOURCE! { var modifiedResx = new DictionaryEntry() { Key = existingResource.Key, Value = newElement.Value }; resx.Remove(existingResource); // REMOVING RESOURCE! resx.Add(modifiedResx); // AND THEN ADDING RESOURCE! } } using (var writer = new ResXResourceWriter(resourceFilepath)) { resx.ForEach(r => { // Again Adding all resource to generate with final items writer.AddResource(r.Key.ToString(), r.Value.ToString()); }); writer.Generate(); writer.Close(); } }
private void btnMakeResx_Click(object sender, System.EventArgs e) { if (txtResxFile.Text.Length == 0 || txtZipFile.Text.Length == 0 || txtResxTag.Text.Length == 0) { MessageBox.Show("You have left some of the fields empty. FIX THEM!!!"); return; } if (!ZipFileOk(txtZipFile.Text)) { MessageBox.Show("Zip file corrupt - try zipping with different tool!"); return; } FileStream fs = new FileStream(txtZipFile.Text, System.IO.FileMode.Open); BinaryReader br = new BinaryReader(fs, System.Text.Encoding.ASCII); byte[] buff = br.ReadBytes((int)fs.Length); fs.Close(); ResXResourceWriter resource = new ResXResourceWriter(txtResxFile.Text); resource.AddResource(txtResxTag.Text, buff); resource.Generate(); resource.Close(); MessageBox.Show("You're done, so quit the program already."); }
private static void TranslateFile(ResourceFile resourceFile, string outputFilename) { if (resourceFile.EntriesToTranslate.Count > 0 || (resourceFile.IncludeAllEntries && resourceFile.EntriesUntranslated.Count > 0)) { ResXResourceWriter writer = new ResXResourceWriter(outputFilename); if (resourceFile.EntriesToTranslate.Count > 0) { var resourceGroups = GetGroups(resourceFile, resourceFile.EntriesToTranslate); foreach (var resourceGroup in resourceGroups) { TranslateGroup(resourceFile, writer, resourceGroup); } } if (resourceFile.IncludeAllEntries && resourceFile.EntriesUntranslated.Count > 0) { foreach (var entry in resourceFile.EntriesUntranslated) { writer.AddResource(entry.Key, entry.OriginalValue); } } writer.Generate(); writer.Dispose(); } }
public void WriteResxWithCultureName(string filePath, Hashtable translatedHashTable) { var path = filePath; if (filePath.Contains("aspx.resx")) { path = filePath.Insert( filePath.LastIndexOf("aspx.", StringComparison.Ordinal) + "aspx.".Length, this.Translator.DestinationLanguage.Value + "."); } else if (filePath.Contains("aspx." + this.Translator.SourceLanguage.Value + ".resx")) { path = filePath.Replace("aspx." + this.Translator.SourceLanguage.Value + ".resx", "aspx." + this.Translator.DestinationLanguage.Value + ".resx"); } var resourceWriter = new ResXResourceWriter(path); foreach (string key in translatedHashTable.Keys) { resourceWriter.AddResource(key, translatedHashTable[key]); } resourceWriter.Generate(); resourceWriter.Close(); }
private static bool OutputAltResx(string file, string locale) { Console.WriteLine("Processing: " + file); ResXResourceReader resxReader = new ResXResourceReader(file); FileInfo currentResxFile = new FileInfo(file); string newResxFileName = String.Format("{0}.{1}{2}", currentResxFile.FullName.Substring(0, currentResxFile.FullName.Length - 5), locale, currentResxFile.Extension); ResXResourceWriter resxWriter = new ResXResourceWriter(newResxFileName); foreach (DictionaryEntry resource in resxReader) { if ("Sidebar.WidthInPixels".Equals(resource.Key)) { resxWriter.AddResource(resource.Key.ToString(), "225"); continue; } if (resource.Value.GetType() == typeof(string)) { resxWriter.AddResource(resource.Key.ToString(), MungeResource(resource.Value as string, StaticKeyValue(resource.Key.ToString()))); } else { resxWriter.AddResource(resource.Key.ToString(), resource.Value); } } resxWriter.Generate(); resxWriter.Close(); return(true); }
private void btnSave_Click(object sender, EventArgs e) { EnableControls(false); using (SaveFileDialog sfd = new SaveFileDialog()) { if (FilesToDiff?.Length > 0) { sfd.InitialDirectory = Path.GetDirectoryName(FilesToDiff[0]); } sfd.Filter = "Resource files|*.resx|All files|*.*"; sfd.ShowDialog(); if (sfd.FileName != "") { String savePath = sfd.FileName; dgv.Cursor = Cursors.WaitCursor; try { if (dgv.IsCurrentCellDirty | dgv.IsCurrentRowDirty) { dgv.EndEdit(); } dgv.Sort(colKey, ListSortDirection.Ascending); ResXResourceWriter resX = new ResXResourceWriter(Path.Combine(Directory.GetCurrentDirectory(), savePath)); for (int i = 0; i <= dgv.RowCount - 1; i++) { if (dgv.Rows[i].IsNewRow) { continue; } if (chkAutoRemoveBaseOnly.Checked && ((ResXSourceType)dgv.Rows[i].Cells[colSourceVal.Index].Value) == ResXSourceType.BASE) { continue; } ResXDataNode n = new ResXDataNode(Convert.ToString(dgv[colKey.Index, i].Value), dgv[colValue.Index, i].Value) { Comment = Convert.ToString(dgv[colComment.Index, i].Value) }; resX.AddResource(n); } resX.Generate(); resX.Close(); Properties.Settings.Default.AutoRemoveBaseOnly = chkAutoRemoveBaseOnly.Checked; Properties.Settings.Default.Save(); } catch (Exception ex) { MessageBox.Show($"The ResX file '{savePath}' failed to save properly: " + ex.Message); } } } EnableControls(true); }
/// <summary> /// UPDATE APPLICATION THEME /// </summary> /// <param name="theme"></param> public void SetThemeValue(string theme) { ResXResourceWriter reswriter = new ResXResourceWriter("../../LocalResources/ThemeSettings.resx"); reswriter.AddResource("Theme", theme); reswriter.Generate(); reswriter.Close(); }
public static void EBSresxYazText(string dosyayolu, RichTextBox rc, string Value) { res = new ResXResourceWriter(dosyayolu); res.AddResource(Value, rc.Text); res.Generate(); res.Close(); MessageBox.Show("Yazı Oluşturuldu."); }
public static void UpdateResourceFile(Hashtable data, String path) { Hashtable resourceEntries = new Hashtable(); //Get existing resources ResXResourceReader reader = new ResXResourceReader(path); if (reader != null) { IDictionaryEnumerator id = reader.GetEnumerator(); foreach (DictionaryEntry d in reader) { if (d.Value == null) { resourceEntries.Add(d.Key.ToString(), ""); } else { resourceEntries.Add(d.Key.ToString(), d.Value.ToString()); } } reader.Close(); } //Modify resources here... foreach (String key in data.Keys) { if (!resourceEntries.ContainsKey(key)) { String value = data[key].ToString(); if (value == null) { value = ""; } resourceEntries.Add(key, value); } else { String value = data[key].ToString(); if (value == null) { value = ""; } resourceEntries.Remove(key); resourceEntries.Add(key, data[key].ToString()); } } //Write the combined resource file ResXResourceWriter resourceWriter = new ResXResourceWriter(path); foreach (String key in resourceEntries.Keys) { resourceWriter.AddResource(key, resourceEntries[key]); } resourceWriter.Generate(); resourceWriter.Close(); }
public static void RemovePermissions(string rolename, params string[] permissions) { var reader = new ResXResourceReader(path); var node = reader.GetEnumerator(); var writer = new ResXResourceWriter(path); bool roleIn = false; bool permIn = false; while (node.MoveNext()) { if (!node.Key.ToString().Equals(rolename)) { writer.AddResource(node.Key.ToString(), node.Value.ToString()); } else { roleIn = true; List <string> currentPermissions = (node.Value.ToString().Split(',').ToList()); foreach (string permToDelete in permissions) { for (int i = 0; i < currentPermissions.Count(); i++) { if (currentPermissions[i].Equals(permToDelete)) { currentPermissions.RemoveAt(i); permIn = true; break; } } } string value = currentPermissions[0]; for (int i = 1; i < currentPermissions.Count(); i++) { value += "," + currentPermissions[i]; } writer.AddResource(node.Key.ToString(), value); } } writer.Generate(); writer.Close(); if (!roleIn) { Console.Write("Ne postoji role {0}, pa ne može ni biti", rolename); } else if (!permIn) { Console.Write("{0} nema bar jednu od unetih permisija, pa ne može ni biti", rolename); } else { Console.Write("Uspešno"); } }
/// <summary> /// Write a ResX file to disk /// </summary> /// <param name="fileName"></param> protected void WriteResX(string fileName, Dictionary<string, string> dict) { try { using (ResXResourceWriter writer = new ResXResourceWriter(fileName)) { foreach (string key in dict.Keys) writer.AddResource(key, dict[key]); writer.Generate(); } } catch { throw new Exception("Error while saving " + fileName); } }