diff options
author | Lluis Sanchez <lluis@xamarin.com> | 2014-01-20 19:32:53 +0400 |
---|---|---|
committer | Lluis Sanchez Gual <lluis@xamarin.com> | 2014-10-21 18:39:14 +0400 |
commit | f73b2a9990495587d514aa1856919c21170a3940 (patch) | |
tree | 9842411ee8644ead5915a715ee7e53984a601df4 /main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/SelectEncodingsDialog.cs | |
parent | a2046b6331a271e8203df7d3d0f14500d33d60fa (diff) |
Initial drop of the new project model
Diffstat (limited to 'main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/SelectEncodingsDialog.cs')
-rw-r--r-- | main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/SelectEncodingsDialog.cs | 39 |
1 files changed, 4 insertions, 35 deletions
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/SelectEncodingsDialog.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/SelectEncodingsDialog.cs index 1bd10c36ef..7bd95d1488 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/SelectEncodingsDialog.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/SelectEncodingsDialog.cs @@ -32,40 +32,10 @@ using Gtk; using MonoDevelop.Core; using System.Text; using System.Collections.Generic; +using MonoDevelop.Projects.Text; namespace MonoDevelop.Ide { - public static class SelectedEncodings - { - static int[] conversionEncodings = null; - public static int[] ConversionEncodings { - get { - if (conversionEncodings == null) { - string propertyEncodings = PropertyService.Get ("MonoDevelop.Ide.SelectEncodingsDialog.ConversionEncodings", string.Join (",", DefaultEncodings)); - try { - conversionEncodings = propertyEncodings.Split (',').Select (e => int.Parse (e.Trim ())).ToArray (); - } catch (Exception) { - conversionEncodings = DefaultEncodings; - } - } - - return conversionEncodings; - } - set { - conversionEncodings = value; - PropertyService.Set ("MonoDevelop.Ide.SelectEncodingsDialog.ConversionEncodings", string.Join (",", value)); - Console.WriteLine ("set to:" + string.Join (",", value)); - } - } - - const int ISO_8859_15 = 28605; - public readonly static int[] DefaultEncodings = new int[] { - Encoding.UTF8.CodePage, - ISO_8859_15, - Encoding.Unicode.CodePage - }; - } - internal partial class SelectEncodingsDialog: Gtk.Dialog { ListStore storeAvail; @@ -86,13 +56,12 @@ namespace MonoDevelop.Ide listSelected.AppendColumn ("Encoding", new Gtk.CellRendererText (), "text", 1); foreach (var e in Encoding.GetEncodings ()) { - // if (!((IList)TextEncoding.ConversionEncodings).Contains (e)) var enc = e.GetEncoding (); storeAvail.AppendValues (enc.EncodingName, enc.WebName, e.CodePage); } - foreach (var e in SelectedEncodings.ConversionEncodings) { - var enc = Encoding.GetEncoding (e); + foreach (var e in TextEncoding.ConversionEncodings) { + var enc = Encoding.GetEncoding (e.CodePage); storeSelected.AppendValues (enc.EncodingName, enc.WebName, enc.CodePage); } } catch (Exception ex) { @@ -115,7 +84,7 @@ namespace MonoDevelop.Ide list.Add (enc); } while (storeSelected.IterNext (ref iter)); } - SelectedEncodings.ConversionEncodings = list.ToArray (); + TextEncoding.ConversionEncodings = list.Select ((id) => TextEncoding.GetEncoding (id)).ToArray (); } protected void OnAddClicked (object ob, EventArgs args) |