diff --git a/data/ConversionStyleSheets/SVNChangelogToXml.xsl b/data/ConversionStyleSheets/SVNChangelogToXml.xsl index 361931e9fa..d8e3db7796 100644 --- a/data/ConversionStyleSheets/SVNChangelogToXml.xsl +++ b/data/ConversionStyleSheets/SVNChangelogToXml.xsl @@ -43,6 +43,9 @@ Nikola Kavaldjiev + + Matt Ward + Mathias Simmack diff --git a/data/resources/StringResources.ar.resources b/data/resources/StringResources.ar.resources index 40d9e32b92..db68add61b 100644 Binary files a/data/resources/StringResources.ar.resources and b/data/resources/StringResources.ar.resources differ diff --git a/data/resources/StringResources.bg.resources b/data/resources/StringResources.bg.resources index 4408d0ab1a..8100659dde 100644 Binary files a/data/resources/StringResources.bg.resources and b/data/resources/StringResources.bg.resources differ diff --git a/data/resources/StringResources.cn-big.resources b/data/resources/StringResources.cn-big.resources index 64c1356272..07c759eccf 100644 Binary files a/data/resources/StringResources.cn-big.resources and b/data/resources/StringResources.cn-big.resources differ diff --git a/data/resources/StringResources.cn-gb.resources b/data/resources/StringResources.cn-gb.resources index 845fe8540c..80b713f978 100644 Binary files a/data/resources/StringResources.cn-gb.resources and b/data/resources/StringResources.cn-gb.resources differ diff --git a/data/resources/StringResources.cz.resources b/data/resources/StringResources.cz.resources index b579343bb2..9256cf1dd8 100644 Binary files a/data/resources/StringResources.cz.resources and b/data/resources/StringResources.cz.resources differ diff --git a/data/resources/StringResources.de.resources b/data/resources/StringResources.de.resources index 89b67de8bf..92152acf11 100644 Binary files a/data/resources/StringResources.de.resources and b/data/resources/StringResources.de.resources differ diff --git a/data/resources/StringResources.dk.resources b/data/resources/StringResources.dk.resources index 590817020e..54fde63993 100644 Binary files a/data/resources/StringResources.dk.resources and b/data/resources/StringResources.dk.resources differ diff --git a/data/resources/StringResources.es-mx.resources b/data/resources/StringResources.es-mx.resources index 72ae891246..c52075cadd 100644 Binary files a/data/resources/StringResources.es-mx.resources and b/data/resources/StringResources.es-mx.resources differ diff --git a/data/resources/StringResources.es.resources b/data/resources/StringResources.es.resources index d751681a7c..3880fe3429 100644 Binary files a/data/resources/StringResources.es.resources and b/data/resources/StringResources.es.resources differ diff --git a/data/resources/StringResources.fi.resources b/data/resources/StringResources.fi.resources index 8476c8af6e..f4734137d7 100644 Binary files a/data/resources/StringResources.fi.resources and b/data/resources/StringResources.fi.resources differ diff --git a/data/resources/StringResources.fr.resources b/data/resources/StringResources.fr.resources index 5f9e7edaee..24b2e2d2c1 100644 Binary files a/data/resources/StringResources.fr.resources and b/data/resources/StringResources.fr.resources differ diff --git a/data/resources/StringResources.hu.resources b/data/resources/StringResources.hu.resources index 2cbfdc038b..c60bee6fb7 100644 Binary files a/data/resources/StringResources.hu.resources and b/data/resources/StringResources.hu.resources differ diff --git a/data/resources/StringResources.it.resources b/data/resources/StringResources.it.resources index 468ced86e7..81020a8282 100644 Binary files a/data/resources/StringResources.it.resources and b/data/resources/StringResources.it.resources differ diff --git a/data/resources/StringResources.jp.resources b/data/resources/StringResources.jp.resources index 0773d88d2f..6b07a4c56f 100644 Binary files a/data/resources/StringResources.jp.resources and b/data/resources/StringResources.jp.resources differ diff --git a/data/resources/StringResources.kr.resources b/data/resources/StringResources.kr.resources index f54a363d8c..c5cd910514 100644 Binary files a/data/resources/StringResources.kr.resources and b/data/resources/StringResources.kr.resources differ diff --git a/data/resources/StringResources.lt.resources b/data/resources/StringResources.lt.resources index 72ec9c28f8..0bb3e7e24d 100644 Binary files a/data/resources/StringResources.lt.resources and b/data/resources/StringResources.lt.resources differ diff --git a/data/resources/StringResources.nl.resources b/data/resources/StringResources.nl.resources index 6fd5450523..928bcaa534 100644 Binary files a/data/resources/StringResources.nl.resources and b/data/resources/StringResources.nl.resources differ diff --git a/data/resources/StringResources.pl.resources b/data/resources/StringResources.pl.resources index 58552fe1f2..6317d6f439 100644 Binary files a/data/resources/StringResources.pl.resources and b/data/resources/StringResources.pl.resources differ diff --git a/data/resources/StringResources.pt-br.resources b/data/resources/StringResources.pt-br.resources index 9b64490f9d..46bc3e56fe 100644 Binary files a/data/resources/StringResources.pt-br.resources and b/data/resources/StringResources.pt-br.resources differ diff --git a/data/resources/StringResources.pt.resources b/data/resources/StringResources.pt.resources index 306601642b..b89074d208 100644 Binary files a/data/resources/StringResources.pt.resources and b/data/resources/StringResources.pt.resources differ diff --git a/data/resources/StringResources.ro.resources b/data/resources/StringResources.ro.resources index 92cb2f29fe..7642193ed2 100644 Binary files a/data/resources/StringResources.ro.resources and b/data/resources/StringResources.ro.resources differ diff --git a/data/resources/StringResources.ru.resources b/data/resources/StringResources.ru.resources index 569e84b016..0640920c13 100644 Binary files a/data/resources/StringResources.ru.resources and b/data/resources/StringResources.ru.resources differ diff --git a/data/resources/StringResources.se.resources b/data/resources/StringResources.se.resources index f1afe4d30d..66345f9733 100644 Binary files a/data/resources/StringResources.se.resources and b/data/resources/StringResources.se.resources differ diff --git a/data/resources/StringResources.sl.resources b/data/resources/StringResources.sl.resources index fda9b2d078..eefb2bb66f 100644 Binary files a/data/resources/StringResources.sl.resources and b/data/resources/StringResources.sl.resources differ diff --git a/data/resources/StringResources.sr.resources b/data/resources/StringResources.sr.resources index 09fde94e1a..5a3296fcaa 100644 Binary files a/data/resources/StringResources.sr.resources and b/data/resources/StringResources.sr.resources differ diff --git a/data/resources/StringResources.tr.resources b/data/resources/StringResources.tr.resources index 386dfe4589..fd4ce00939 100644 Binary files a/data/resources/StringResources.tr.resources and b/data/resources/StringResources.tr.resources differ diff --git a/doc/ChangeLog.xml b/doc/ChangeLog.xml index 0792ad79bf..792fd83847 100644 --- a/doc/ChangeLog.xml +++ b/doc/ChangeLog.xml @@ -1,4 +1,26 @@  + Fixed SD2-458: Tab is always replaced with 4 spaces + Added support for commenting/uncommenting a selection of xml. + Fixed SD2-474: Allow targeting other .NET Framework versions. + Fixed SD2-476. Goto definition now works for unit tests in a test fixture containing a SetUp method. + GotoDefinition executed when double clicking an MbUnitPad test tree node. + Fixed SD2-472 (Cursor disappears off screen whilst pressing right arrow key) and a newly introduce performance problems with large files (>5000 lines). +Added constructor insight support to BooBinding. + Added support for local variables and simple type inference to BooBinding. + Fixed assertion when typing a "RaiseEvent" statement (http://community.sharpdevelop.net/forums/1156/ShowPost.aspx) + Boo implicitly references System.dll and Boo.Lang.dll. + Fixed paths in BooBinding project files. + Add BooBinding. + Fixed SD2-473. A KeyNotFound exception is no longer thrown if the highlighting strategy does not contain a LineComment property. + Improved handling of proportional fonts. + Run MsBuild in a separate thread => you can continue coding while your code is compiling. + Caret is now displayed at the correct position when using non-monospaced fonts. (but selecting with the mouse still doesn't work) + Use use static readonly collection instance for empty attribute, type parameter and parameter collections. + Fixed SD2-470: When there is a using statement for the current namespace, classes are shown twice in Ctrl+Space + Help 2.0: fixed a bug when selecting the previous or next topic button (browser) with a hidden TOC control; there was an exception because, of course, there was no selection in the TOC control. Now I use the Get*FromUrl method with the current browser URL. btw: some other things changed + Fixed SD2-420: Non-generic classes and generic classes with the same name collide in the DOM. + Fixed SD2-460: Parse error (inner classes in generic types) + Fixed code completion bug regarding events. Fixed "run unit test in debugger". Pad layout: included some references for the dynamic help pad to solve issue #2 (http://community.sharpdevelop.net/forums/820/ShowPost.aspx) Allow references to unbound types in typeof/GetType expressions. Improved performance of "Replace all". @@ -29,7 +51,7 @@ Disadvantages: The "Load solution" and "New solution" buttons on the start page now work even when JavaScript is disabled in Internet Explorer. Fixed exception when importing VS.NET project without ".user" file. Fixed bug that prevented recompiling due to files locked by the debugger - MbUnit Pad additions - Goto definition implemented, error list displayed after a test run with errors, and after a build the test tree auto-refreshes. + MbUnit Pad additions - Goto definition implemented, error list displayed after a test run with errors, and after a build the test tree auto-refreshes. Help 2.0: solution structure changed (you can enable the Dynamic Help by copying the new Addin file) dynamic help: some improvements, works with expressions now (ignores documents with more than 1 DevLang attribute) Help 2.0: context.html updated @@ -43,7 +65,7 @@ Enabled AutoComplete for the ProjectImports combo box. Help 2.0: some little fixes Fixed some P/Invoke declarations where FxCop complained they weren't portable to 64bit and some other complaints from FxCop. Applied Fidalgo rev. 2075 - Added 'Stop tests' toolbar button and context menus to the MbUnit pad. Go to definition context menu command is not currently working. + Added 'Stop tests' toolbar button and context menus to the MbUnit pad. Go to definition context menu command is not currently working. Fixed crash when using the "DefaultDebugger" instead of the debugger addin. Fixed SD-371: Adding empty combine to a combine causes exception and worked on SD2-425. @@ -58,11 +80,11 @@ and worked on SD2-425. Application and Signing project options panels now use the translation database. tried to fix a Virtual PC (no SDK) crash; HiliteMatches restored for testing (it doesn't work here :o( ) disable 'highlight matching topics' because it doesn't work with the WebBrowser control - File was not being identified as a 'code behind file' if it existed in a subfolder. + File was not being identified as a 'code behind file' if it existed in a subfolder. Ignore .svn folders when creating setup. Add prepareRelease.bat (creates ChangeLog.xml and REVISION file) Fixed InterfaceImplementorCodeGenerator bug (override keyword). - SD2-438. Form designer now creating, loading and saving resources. + SD2-438. Form designer now creating, loading and saving resources. Fixed SD2-402:Toolbar in bookmark pad. some changes/fixes, LoggingService used Allow addins to have their project/file templates stored in the addin directory. @@ -87,7 +109,7 @@ Overall SD should use ca. 10 MB RAM less when working on a big solution like Sha Fixed SD2-439: VB.Net event handlers are lost. Save layout configuration before switching layout by starting debugger or pressing Shift+Escape. Show error message when going to designer mode in a file with syntax errors instead of displaying an empty form. - SD2-437. Source code now generated in InitializeComponent method for non-visual components. + SD2-437. Source code now generated in InitializeComponent method for non-visual components. dynamic help: some scripting improvements I changed some of the CSharp namespace names; there are no bug fixes in this upload Fixed some bugs. @@ -116,8 +138,8 @@ Fixed crash when two classes with the same name were removed from a project cont Fixed some NRefactory bugs (Generic method invocations in VB.NET and output visitor bugs) Remove quotes from svn:keywords property. Added fullscreen options panel (no features implemented yet) - Fixed properties on newly added xml editor test files - removed quotes from the Revision keyword. - Added xml editor tests from Fidalgo branch. The XmlSchemaCompletionData class is now using the XmlSchemaAttribute's AttributeSchemaType property instead of the obsolete AttributeType which was causing a few of the attribute value tests to fail. + Fixed properties on newly added xml editor test files - removed quotes from the Revision keyword. + Added xml editor tests from Fidalgo branch. The XmlSchemaCompletionData class is now using the XmlSchemaAttribute's AttributeSchemaType property instead of the obsolete AttributeType which was causing a few of the attribute value tests to fail. Fixed bug that prevented VB.Net windows forms applications from compiling. Right click on class and member names (and method invocations) in the text editor now shows the "go to definition" command and the class browser context menu of that item. Core bugfixes: @@ -136,7 +158,7 @@ Tried to fix ExternalException when accessing the clipboard. (implemented JMC - just my code) Added CSharpBinding.Tests project. Add "run in debugger" command to member bookmarks. - Designer generator now parses the form's code every time a component is added. This ensures that the InitializeComponent's position is correct when adding a new component. + Designer generator now parses the form's code every time a component is added. This ensures that the InitializeComponent's position is correct when adding a new component. Applied CSharpOutputVisitor patch from Rodrigo B. de Oliveira. Make go to work with partial classes. Show expression in tooltips while pressing Ctrl. @@ -161,7 +183,7 @@ Project templates can now specify the BuildAction and CopyToOutputDirectory prop External methods can be show/hidden using callstack context menu Local Variables pad cleared when debugger stops Fixed Base classes in Local Variables pad - Added support for included schemas, substitution groups and abstract elements. Tests not ported over from Fidalgo yet. + Added support for included schemas, substitution groups and abstract elements. Tests not ported over from Fidalgo yet. Improve project options panels and prepare editing different configurations. Fixed bug when closing form designer while the property pad was active. Added first debugger test @@ -184,15 +206,15 @@ Removed SharpZipLib. Fixed SD2-415 and SD2-418. Allow writing a space after "+=" completion without closing the completion window. Add NUnit.Framework again. - Removed NUnit project reference from main SharpDevelop solution. - Main menu and toolbar initialised after all the pads so that keyboard shortcuts work for the various View-Pad menu items without needing the menu to be displayed at least once. + Removed NUnit project reference from main SharpDevelop solution. + Main menu and toolbar initialised after all the pads so that keyboard shortcuts work for the various View-Pad menu items without needing the menu to be displayed at least once. Removed nunit and nprof Changed some little translation issues. Re-Arranged tools menu. Update English and German StringResources (combine -> solution). Fixed SD2-410: Goto definition doesn't work for array types Fixed SD2-411: Code completition doesn't show parent class (nested classes) Fixed forms designer to reparse the file when switching to the designer tab. - Show properties (F4) now works in form design mode. + Show properties (F4) now works in form design mode. Ported changes from Fidalgo rev 2038, ivokovacka. Fixed more NRefactory bugs. added very basic event handler code completition (appears after typing '+='); still many things to do here @@ -208,10 +230,10 @@ Included bug fixes from docking suite's bug tracker on SF. Improved C# -> VB converter (For-Statement is converted to ForNextStatement). Fixed VB parser (CSByte, CUShort, CUInt, CULng cast operators were missing). enabled an early version of F1 help - When displaying xml namespaces the autocompletion list now resizes to fit the longest string. + When displaying xml namespaces the autocompletion list now resizes to fit the longest string. SearchAndReplaceDialog remembers it's location and can be closed with Escape. Fixed ExpressionFinder when cursor was at the end of the document. - Changed the namespace for the form designer context menu commands. Added ICSharpCode.SharpDevelop runtime to FormDesigner.addin. Form designer context menus now working. + Changed the namespace for the form designer context menu commands. Added ICSharpCode.SharpDevelop runtime to FormDesigner.addin. Form designer context menus now working. Added F1 help to text editor and forms designer. Fixed SD2-385: After project run Source/Abstract Content tabs are missing Fixed some bugs. diff --git a/src/Main/Base/Project/Src/Gui/Workbench/DefaultWorkbench.cs b/src/Main/Base/Project/Src/Gui/Workbench/DefaultWorkbench.cs index 3aebbc31eb..cdf1e4b361 100644 --- a/src/Main/Base/Project/Src/Gui/Workbench/DefaultWorkbench.cs +++ b/src/Main/Base/Project/Src/Gui/Workbench/DefaultWorkbench.cs @@ -11,6 +11,7 @@ using System.Collections; using System.Collections.Generic; using System.Drawing; using System.Diagnostics; +using System.Globalization; using System.CodeDom.Compiler; using System.Windows.Forms; using System.ComponentModel; @@ -309,7 +310,10 @@ namespace ICSharpCode.SharpDevelop.Gui public Properties CreateMemento() { Properties properties = new Properties(); - properties["bounds"] = normalBounds.X + "," + normalBounds.Y + "," + normalBounds.Width + "," + normalBounds.Height; + properties["bounds"] = normalBounds.X.ToString(NumberFormatInfo.InvariantInfo) + + "," + normalBounds.Y.ToString(NumberFormatInfo.InvariantInfo) + + "," + normalBounds.Width.ToString(NumberFormatInfo.InvariantInfo) + + "," + normalBounds.Height.ToString(NumberFormatInfo.InvariantInfo); if (FullScreen || WindowState == FormWindowState.Minimized) properties["windowstate"] = defaultWindowState.ToString(); @@ -325,7 +329,10 @@ namespace ICSharpCode.SharpDevelop.Gui if (properties != null && properties.Contains("bounds")) { string[] bounds = properties["bounds"].Split(','); if (bounds.Length == 4) { - Bounds = normalBounds = new Rectangle(Int32.Parse(bounds[0]), Int32.Parse(bounds[1]), Int32.Parse(bounds[2]), Int32.Parse(bounds[3])); + Bounds = normalBounds = new Rectangle(int.Parse(bounds[0], NumberFormatInfo.InvariantInfo), + int.Parse(bounds[1], NumberFormatInfo.InvariantInfo), + int.Parse(bounds[2], NumberFormatInfo.InvariantInfo), + int.Parse(bounds[3], NumberFormatInfo.InvariantInfo)); } defaultWindowState = (FormWindowState)Enum.Parse(typeof(FormWindowState), properties["defaultstate"]); diff --git a/src/Main/StartUp/Project/Dialogs/ExceptionBox.cs b/src/Main/StartUp/Project/Dialogs/ExceptionBox.cs index bf4f86ea1c..43de914381 100644 --- a/src/Main/StartUp/Project/Dialogs/ExceptionBox.cs +++ b/src/Main/StartUp/Project/Dialogs/ExceptionBox.cs @@ -12,6 +12,7 @@ using System.Diagnostics; using System.Resources; using System.Reflection; using System.Drawing; +using System.Globalization; using ICSharpCode.Core; namespace ICSharpCode.SharpDevelop @@ -55,6 +56,9 @@ namespace ICSharpCode.SharpDevelop string str = ""; str += ".NET Version : " + Environment.Version.ToString() + Environment.NewLine; str += "OS Version : " + Environment.OSVersion.ToString() + Environment.NewLine; + try { + str += "Current culture : " + CultureInfo.CurrentCulture.EnglishName + Environment.NewLine; + } catch {} try { if (SystemInformation.TerminalServerSession) { str += "Terminal Server Session" + Environment.NewLine; diff --git a/src/Main/StartUp/Project/Resources/StringResources.resources b/src/Main/StartUp/Project/Resources/StringResources.resources index 0b94aad5ca..4497d4f09d 100644 Binary files a/src/Main/StartUp/Project/Resources/StringResources.resources and b/src/Main/StartUp/Project/Resources/StringResources.resources differ diff --git a/src/Tools/StringResourceSniffer/AssemblyInfo.cs b/src/Tools/StringResourceSniffer/AssemblyInfo.cs deleted file mode 100644 index 205aa8a9ad..0000000000 --- a/src/Tools/StringResourceSniffer/AssemblyInfo.cs +++ /dev/null @@ -1,32 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; - -// Information about this assembly is defined by the following -// attributes. -// -// change them to the information which is associated with the assembly -// you compile. - -[assembly: AssemblyTitle("")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("")] -[assembly: AssemblyCopyright("")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// The assembly version has following format : -// -// Major.Minor.Build.Revision -// -// You can specify all values by your own or you can build default build and revision -// numbers with the '*' character (the default): - -[assembly: AssemblyVersion("2.0.0.1")] - -// The following attributes specify the key for the sign of your assembly. See the -// .NET Framework documentation for more information about signing. -// This is not required, if you don't want signing let these attributes like they're. -[assembly: AssemblyDelaySign(false)] -[assembly: AssemblyKeyFile("")] diff --git a/src/Tools/StringResourceSniffer/Main.cs b/src/Tools/StringResourceSniffer/Main.cs deleted file mode 100644 index d35ee31840..0000000000 --- a/src/Tools/StringResourceSniffer/Main.cs +++ /dev/null @@ -1,104 +0,0 @@ -using System; -using System.Resources; -using System.Text.RegularExpressions; -using System.IO; -using System.Collections; -using System.Collections.Generic; - -namespace StringResourceSniffer -{ - class MainClass - { - readonly static Regex pattern = new Regex(@"\$\{res:([^\}]*)\}"); - readonly static Regex resourceService = new Regex(@"ResourceService.GetString\(\""([^\""]*)\""\)"); - readonly static Dictionary resources = new Dictionary(); - static ResourceSet rs; - static string fileName; - - static void TryMatch(string resourceName) - { - if (rs.GetString(resourceName) == null) { - Console.WriteLine("unknown: " + resourceName + " in " + fileName); - } - resources[resourceName] = true; - } - - static void SearchFiles(List files) - { - foreach (string file in files) { - fileName = file; - StreamReader sr = File.OpenText(file); - string content = sr.ReadToEnd(); - sr.Close(); - foreach (Match m in pattern.Matches(content)) { - TryMatch(m.Groups[1].Captures[0].Value); - } - foreach (Match m in resourceService.Matches(content)) { - TryMatch(m.Groups[1].Captures[0].Value); - } - } - - } - - public static void Main(string[] args) - { - rs = new ResourceSet(@"C:\Dokumente und Einstellungen\Omnibrain.DIABLO\Eigene Dateien\trunk\SharpDevelop\src\Main\StartUp\Resources\StringResources.resources"); - SearchFiles(SearchDirectory(@"C:\Dokumente und Einstellungen\Omnibrain.DIABLO\Eigene Dateien\trunk\SharpDevelop\src", - "*.cs")); - SearchFiles(SearchDirectory(@"C:\Dokumente und Einstellungen\Omnibrain.DIABLO\Eigene Dateien\trunk\SharpDevelop\AddIns", - "*.addin")); - - foreach (DictionaryEntry entry in rs) { - if (!resources.ContainsKey(entry.Key.ToString())) { - Console.WriteLine("Unused:" + entry.Key); - } - } - } - - public static List SearchDirectory(string directory, string filemask, bool searchSubdirectories, bool ignoreHidden) - { - List collection = new List(); - SearchDirectory(directory, filemask, collection, searchSubdirectories, ignoreHidden); - return collection; - } - - public static List SearchDirectory(string directory, string filemask, bool searchSubdirectories) - { - return SearchDirectory(directory, filemask, searchSubdirectories, false); - } - - public static List SearchDirectory(string directory, string filemask) - { - return SearchDirectory(directory, filemask, true, false); - } - - /// - /// Finds all files which are valid to the mask in the path - /// and all subdirectories - /// (if is true). - /// The found files are added to the List - /// . - /// If is true, hidden files and folders are ignored. - /// - static void SearchDirectory(string directory, string filemask, List collection, bool searchSubdirectories, bool ignoreHidden) - { - string[] file = Directory.GetFiles(directory, filemask); - foreach (string f in file) { - if (ignoreHidden && (File.GetAttributes(f) & FileAttributes.Hidden) == FileAttributes.Hidden) { - continue; - } - collection.Add(f); - } - - if (searchSubdirectories) { - string[] dir = Directory.GetDirectories(directory); - foreach (string d in dir) { - if (ignoreHidden && (File.GetAttributes(d) & FileAttributes.Hidden) == FileAttributes.Hidden) { - continue; - } - SearchDirectory(d, filemask, collection, searchSubdirectories, ignoreHidden); - } - } - } - } -} diff --git a/src/Tools/StringResourceTool/MainForm.cs b/src/Tools/StringResourceTool/MainForm.cs new file mode 100644 index 0000000000..52fdab9f4d --- /dev/null +++ b/src/Tools/StringResourceTool/MainForm.cs @@ -0,0 +1,381 @@ +/* + * Created by SharpDevelop. + * User: Daniel Grunwald + * Date: 08.10.2005 + * Time: 19:47 + */ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Diagnostics; +using System.IO; +using System.Drawing; +using System.Resources; +using System.Text; +using System.Text.RegularExpressions; +using System.Windows.Forms; + +namespace StringResourceTool +{ + public class MainForm : System.Windows.Forms.Form + { + public MainForm() + { + // + // The InitializeComponent() call is required for Windows Forms designer support. + // + InitializeComponent(); + try { + using (StreamReader r = new StreamReader("password.txt")) { + userNameTextBox.Text = r.ReadLine(); + passwordTextBox.Text = r.ReadLine(); + } + savePasswordCheckBox.Checked = true; + } catch {} + } + + [STAThread] + public static void Main(string[] args) + { + Application.EnableVisualStyles(); + Application.Run(new MainForm()); + } + + #region Windows Forms Designer generated code + /// + /// This method is required for Windows Forms designer support. + /// Do not change the method contents inside the source code editor. The Forms designer might + /// not be able to load this method if it was changed manually. + /// + private void InitializeComponent() + { + // + // MainForm + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(621, 399); + groupBox1 = new System.Windows.Forms.GroupBox(); + // + // groupBox1 + // + deleteStringsButton = new System.Windows.Forms.Button(); + // + // deleteStringsButton + // + deleteStringsButton.Enabled = false; + deleteStringsButton.Location = new System.Drawing.Point(411, 20); + deleteStringsButton.Name = "deleteStringsButton"; + deleteStringsButton.Size = new System.Drawing.Size(144, 23); + deleteStringsButton.TabIndex = 7; + deleteStringsButton.Text = "Delete resource strings"; + deleteStringsButton.Click += new System.EventHandler(this.DeleteStringsButtonClick); + button4 = new System.Windows.Forms.Button(); + // + // button4 + // + button4.Enabled = false; + button4.Location = new System.Drawing.Point(292, 20); + button4.Name = "button4"; + button4.Size = new System.Drawing.Size(113, 23); + button4.TabIndex = 6; + button4.Text = "Download database"; + button4.Click += new System.EventHandler(this.Button4Click); + savePasswordCheckBox = new System.Windows.Forms.CheckBox(); + // + // savePasswordCheckBox + // + savePasswordCheckBox.Location = new System.Drawing.Point(182, 44); + savePasswordCheckBox.Name = "savePasswordCheckBox"; + savePasswordCheckBox.Size = new System.Drawing.Size(104, 24); + savePasswordCheckBox.TabIndex = 5; + savePasswordCheckBox.Text = "Save password"; + button3 = new System.Windows.Forms.Button(); + // + // button3 + // + button3.Location = new System.Drawing.Point(182, 20); + button3.Name = "button3"; + button3.Size = new System.Drawing.Size(75, 23); + button3.TabIndex = 4; + button3.Text = "Login"; + button3.Click += new System.EventHandler(this.Button3Click); + passwordTextBox = new System.Windows.Forms.TextBox(); + // + // passwordTextBox + // + passwordTextBox.Location = new System.Drawing.Point(76, 42); + passwordTextBox.Name = "passwordTextBox"; + passwordTextBox.PasswordChar = '●'; + passwordTextBox.Size = new System.Drawing.Size(100, 21); + passwordTextBox.TabIndex = 3; + passwordTextBox.UseSystemPasswordChar = true; + userNameTextBox = new System.Windows.Forms.TextBox(); + // + // userNameTextBox + // + userNameTextBox.Location = new System.Drawing.Point(76, 19); + userNameTextBox.Name = "userNameTextBox"; + userNameTextBox.Size = new System.Drawing.Size(100, 21); + userNameTextBox.TabIndex = 1; + label2 = new System.Windows.Forms.Label(); + // + // label2 + // + label2.Location = new System.Drawing.Point(6, 40); + label2.Name = "label2"; + label2.Size = new System.Drawing.Size(64, 23); + label2.TabIndex = 2; + label2.Text = "Password:"; + label2.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + label1 = new System.Windows.Forms.Label(); + // + // label1 + // + label1.Location = new System.Drawing.Point(6, 17); + label1.Name = "label1"; + label1.Size = new System.Drawing.Size(64, 23); + label1.TabIndex = 0; + label1.Text = "Username:"; + label1.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + groupBox1.Controls.Add(deleteStringsButton); + groupBox1.Controls.Add(button4); + groupBox1.Controls.Add(savePasswordCheckBox); + groupBox1.Controls.Add(button3); + groupBox1.Controls.Add(passwordTextBox); + groupBox1.Controls.Add(userNameTextBox); + groupBox1.Controls.Add(label2); + groupBox1.Controls.Add(label1); + groupBox1.Location = new System.Drawing.Point(12, 12); + groupBox1.Name = "groupBox1"; + groupBox1.Size = new System.Drawing.Size(597, 74); + groupBox1.TabIndex = 0; + groupBox1.TabStop = false; + groupBox1.Text = "Translation server"; + groupBox1.SuspendLayout(); + groupBox1.ResumeLayout(false); + groupBox1.PerformLayout(); + button2 = new System.Windows.Forms.Button(); + // + // button2 + // + button2.Location = new System.Drawing.Point(142, 92); + button2.Name = "button2"; + button2.Size = new System.Drawing.Size(124, 23); + button2.TabIndex = 2; + button2.Text = "Find missing strings"; + button2.Click += new System.EventHandler(this.Button2Click); + button1 = new System.Windows.Forms.Button(); + // + // button1 + // + button1.Location = new System.Drawing.Point(12, 91); + button1.Name = "button1"; + button1.Size = new System.Drawing.Size(124, 23); + button1.TabIndex = 1; + button1.Text = "Find unused strings"; + button1.Click += new System.EventHandler(this.Button1Click); + outputTextBox = new System.Windows.Forms.TextBox(); + // + // outputTextBox + // + outputTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + outputTextBox.Location = new System.Drawing.Point(12, 120); + outputTextBox.Multiline = true; + outputTextBox.Name = "outputTextBox"; + outputTextBox.ScrollBars = System.Windows.Forms.ScrollBars.Both; + outputTextBox.Size = new System.Drawing.Size(597, 267); + outputTextBox.TabIndex = 3; + this.Controls.Add(groupBox1); + this.Controls.Add(button2); + this.Controls.Add(button1); + this.Controls.Add(outputTextBox); + this.Name = "MainForm"; + this.Text = "StringResourceTool"; + this.SuspendLayout(); + this.ResumeLayout(false); + this.PerformLayout(); + } + private System.Windows.Forms.Button deleteStringsButton; + private System.Windows.Forms.Button button4; + private System.Windows.Forms.CheckBox savePasswordCheckBox; + private System.Windows.Forms.Button button3; + private System.Windows.Forms.TextBox passwordTextBox; + private System.Windows.Forms.TextBox userNameTextBox; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.GroupBox groupBox1; + private System.Windows.Forms.Button button2; + private System.Windows.Forms.Button button1; + private System.Windows.Forms.TextBox outputTextBox; + #endregion + + void Button1Click(object sender, EventArgs e) + { + button1.Enabled = false; + Display(FindMissing(FindResourceStrings(), FindUsedStrings())); + button1.Enabled = true; + } + + void Button2Click(object sender, EventArgs e) + { + button2.Enabled = false; + Display(FindMissing(FindUsedStrings(), FindResourceStrings())); + button2.Enabled = true; + } + + void Display(List list) + { + StringBuilder b = new StringBuilder(); + foreach (string entry in list) { + b.AppendLine(entry); + } + outputTextBox.Text = b.ToString(); + } + + /// Gets entries in t1 that are missing from t2. + List FindMissing(Hashtable t1, Hashtable t2) + { + List result = new List(); + foreach (DictionaryEntry e in t1) { + if (!t2.ContainsKey(e.Key)) { + result.Add(e.Key.ToString()); + } + } + result.Sort(); + return result; + } + + readonly static Regex pattern = new Regex(@"\$\{res:([^\}]*)\}"); + readonly static Regex resourceService = new Regex(@"ResourceService.GetString\(\""([^\""]*)\""\)"); + + Hashtable FindUsedStrings() + { + Hashtable t = new Hashtable(); + FindUsedStrings(t, @"..\..\..\..\.."); + return t; + } + void FindUsedStrings(Hashtable t, string path) + { + foreach (string subPath in Directory.GetDirectories(path)) { + if (subPath.EndsWith(".svn")) { + continue; + } + FindUsedStrings(t, subPath); + } + foreach (string fileName in Directory.GetFiles(path, "*.*")) { + switch (Path.GetExtension(fileName).ToLowerInvariant()) { + case ".cs": + FindUsedStrings(fileName, t, true); + break; + case ".resx": + case ".resources": + case ".dll": + case ".exe": + case ".pdb": + break; + default: + FindUsedStrings(fileName, t, false); + break; + } + } + } + void FindUsedStrings(string fileName, Hashtable t, bool resourceServicePattern) + { + StreamReader sr = File.OpenText(fileName); + string content = sr.ReadToEnd(); + sr.Close(); + foreach (Match m in pattern.Matches(content)) { + t[m.Groups[1].Captures[0].Value] = null; + } + if (resourceServicePattern) { + foreach (Match m in resourceService.Matches(content)) { + t[m.Groups[1].Captures[0].Value] = null; + } + } + } + const string srcDir = @"..\..\..\..\"; + const string dataBaseDir = srcDir + @"..\..\SharpDevelopResources\LanguageResources\"; + Hashtable FindResourceStrings() + { + ResourceSet rs = new ResourceSet(srcDir + @"Main\StartUp\Project\Resources\StringResources.resources"); + Hashtable t = new Hashtable(); + foreach (DictionaryEntry e in rs) { + t.Add(e.Key, null); + } + return t; + } + + TranslationServer server; + + void Button3Click(object sender, EventArgs e) + { + server = new TranslationServer(outputTextBox); + if (savePasswordCheckBox.Checked) { + using (StreamWriter w = new StreamWriter("password.txt")) { + w.WriteLine(userNameTextBox.Text); + w.WriteLine(passwordTextBox.Text); + } + } else { + File.Delete("password.txt"); + } + if (server.Login(userNameTextBox.Text, passwordTextBox.Text)) { + button4.Enabled = true; + deleteStringsButton.Enabled = true; + } + } + + void Button4Click(object sender, EventArgs e) + { + EventHandler onDownloadFinished = delegate { + outputTextBox.Text += "\nBuilding resource files..."; + RunBatch(dataBaseDir, "build.bat", delegate { + BeginInvoke(new MethodInvoker(delegate { + outputTextBox.Text += "\r\nBuilding SharpDevelop..."; + })); + RunBatch(srcDir, "debugbuild.bat", null); + }); + }; + server.DownloadDatabase(dataBaseDir + "LocalizeDb.mdb", onDownloadFinished); + } + + void RunBatch(string dir, string batchFile, MethodInvoker exitCallback) + { + BeginInvoke(new MethodInvoker(delegate { + outputTextBox.Text += "\r\nRun " + dir + batchFile + "..."; + })); + ProcessStartInfo psi = new ProcessStartInfo("cmd", "/c " + batchFile); + psi.WorkingDirectory = dir; + Process p = Process.Start(psi); + if (exitCallback != null) { + p.EnableRaisingEvents = true; + p.Exited += delegate { + p.Dispose(); + exitCallback(); + }; + } + } + + void DeleteStringsButtonClick(object sender, EventArgs e) + { + List list = new List(); + string preview = ""; + foreach (string line in outputTextBox.Lines) { + if (line.Length > 0) { + list.Add(line); + if (preview.Length == 0) { + preview = line; + } else if (preview.Length < 100) { + preview += ", " + line; + } + } + } + if (MessageBox.Show("Do you really want to delete the " + list.Count + " resource strings (" + preview + ")" + , "Delete resources", MessageBoxButtons.YesNo) == DialogResult.Yes) { + server.DeleteResourceStrings(list.ToArray()); + } + } + } +} diff --git a/src/Tools/StringResourceTool/StringResourceTool.csproj b/src/Tools/StringResourceTool/StringResourceTool.csproj new file mode 100644 index 0000000000..564fc1b50e --- /dev/null +++ b/src/Tools/StringResourceTool/StringResourceTool.csproj @@ -0,0 +1,38 @@ + + + WinExe + StringResourceTool + StringResourceTool + Debug + AnyCPU + {197537EA-78F4-4434-904C-C81B19459FE7} + + + bin\Debug\ + False + DEBUG;TRACE + True + Full + True + + + bin\Release\ + True + TRACE + False + None + False + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/Tools/StringResourceTool/StringResourceTool.sln b/src/Tools/StringResourceTool/StringResourceTool.sln new file mode 100644 index 0000000000..4d4dd73a9c --- /dev/null +++ b/src/Tools/StringResourceTool/StringResourceTool.sln @@ -0,0 +1,6 @@ +Microsoft Visual Studio Solution File, Format Version 9.00 +# SharpDevelop 2.0.0.550 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StringResourceTool", "StringResourceTool.csproj", "{197537EA-78F4-4434-904C-C81B19459FE7}" +EndProject +Global +EndGlobal diff --git a/src/Tools/StringResourceTool/TranslationServer.cs b/src/Tools/StringResourceTool/TranslationServer.cs new file mode 100644 index 0000000000..8c3958e410 --- /dev/null +++ b/src/Tools/StringResourceTool/TranslationServer.cs @@ -0,0 +1,123 @@ +/* + * Created by SharpDevelop. + * User: Daniel Grunwald + * Date: 08.10.2005 + * Time: 20:24 + */ + +using System; +using System.IO; +using System.Net; +using System.Windows.Forms; + +namespace StringResourceTool +{ + public class TranslationServer + { + TextBox output; + string baseURL = "http://developer.sharpdevelop.net/corsavy/translation/"; + public TranslationServer(TextBox output) + { + this.output = output; + } + CookieContainer cookieContainer = new CookieContainer(); + public bool Login(string user, string pwd) + { + output.Text = "Contacting server..."; + Application.DoEvents(); + System.Threading.Thread.Sleep(50); + HttpWebRequest request = (HttpWebRequest)WebRequest.Create(baseURL + "logon.asp"); + request.ContentType = "application/x-www-form-urlencoded"; + string postString = "uname=" + user + "&upwd=" + pwd; + request.ContentLength = postString.Length; + request.CookieContainer = cookieContainer; + request.Method = "POST"; + request.AllowAutoRedirect = false; + Stream s = request.GetRequestStream(); + using (StreamWriter w = new StreamWriter(s)) { + w.Write(postString); + } + s.Close(); + string result; + using (StreamReader r = new StreamReader(request.GetResponse().GetResponseStream())) { + result = r.ReadToEnd(); + } + if (result.Contains("You couldn't be logged on")) { + output.Text += "\r\nInvalid username/password."; + return false; + } + output.Text += "\r\nLogin successful."; + return true; + } + public void DownloadDatabase(string targetFile, EventHandler successCallback) + { + WebClient wc = new WebClient(); + wc.Headers.Set("Cookie", cookieContainer.GetCookieHeader(new Uri(baseURL))); + wc.DownloadProgressChanged += delegate(object sender, DownloadProgressChangedEventArgs e) { + output.BeginInvoke(new MethodInvoker(delegate { + output.Text = "Download: " + e.ProgressPercentage + "%"; + })); + }; + wc.DownloadDataCompleted += delegate(object sender, DownloadDataCompletedEventArgs e) { + output.BeginInvoke(new MethodInvoker(delegate { + if (e.Error != null) + output.Text = e.Error.ToString(); + else + output.Text = "Download complete."; + })); + if (e.Error == null) { + using (FileStream fs = new FileStream(targetFile, FileMode.Create, FileAccess.Write)) { + fs.Write(e.Result, 0, e.Result.Length); + } + successCallback(this, EventArgs.Empty); + } + wc.Dispose(); + }; + wc.DownloadDataAsync(new Uri(baseURL + "CompactNdownload.asp")); + } + + public void DeleteResourceStrings(string[] idx) + { + const int threadCount = 3; // 3 parallel calls + output.Text = "Deleting..."; + int index = 0; + int finishCount = 0; + EventHandler callback = null; + callback = delegate { + lock (idx) { + if (index < idx.Length) { + DeleteResourceString(idx[index++], callback); + } else { + finishCount += 1; + if (finishCount == threadCount) { + output.BeginInvoke(new MethodInvoker(delegate { + output.Text += "\r\nFinished."; + output.Text += "\r\nYou have to re-download the database to see the changes."; + })); + } + } + } + }; + for (int i = 0; i < threadCount; i++) { + callback(null, null); + } + } + + public void DeleteResourceString(string idx, EventHandler callback) + { + WebClient wc = new WebClient(); + wc.Headers.Set("Cookie", cookieContainer.GetCookieHeader(new Uri(baseURL))); + wc.Headers.Set("Content-Type", "application/x-www-form-urlencoded"); + wc.UploadStringCompleted += delegate { + output.BeginInvoke(new MethodInvoker(delegate { + output.Text += "\r\nDeleted " + idx; + })); + wc.Dispose(); + if (callback != null) + callback(this, EventArgs.Empty); + }; + wc.UploadStringAsync(new Uri(baseURL + "owners_delete.asp"), + "Idx=" + Uri.EscapeDataString(idx) + "&ReallyDelete=on"); + } + } +}