/// <summary> /// Change the text in the source file /// </summary> public override void ApplyTranslation() { if (!Applied) { ResXResourceWriter writer = null; MemoryStream stream = null; try { stream = new MemoryStream(); writer = new ResXResourceWriter(stream); writer.BasePath = Path.GetDirectoryName(Filename); // change resource values in all BufferTranslateInfoItems BufferTranslateInfoItem i = this; while (true) { if (i == null || i.Applied) { break; } writer.AddResource(i.ResourceKey, i.Value); i.Applied = true; i = i.Prev; } foreach (ResXDataNode node in GlobalTranslateItem.NonStringData) { writer.AddResource(node); } writer.Generate(); writer.Close(); VLDocumentViewsManager.SaveStreamToBuffer(stream, IVsTextLines, false); } finally { if (stream != null) { stream.Close(); } } } }