public override bool View(TabPageModel tabPage) { try { AvalonEditTextOutput output = new AvalonEditTextOutput(); BitmapImage image = new BitmapImage(); image.BeginInit(); image.StreamSource = OpenStream(); image.EndInit(); output.AddUIElement(() => new Image { Source = image }); output.WriteLine(); output.AddButton(Images.Save, Resources.Save, delegate { Save(null); }); tabPage.ShowTextView(textView => textView.ShowNode(output, this)); tabPage.SupportsLanguageSwitching = false; return(true); } catch (Exception) { return(false); } }
public override bool View(DecompilerTextView textView) { try { AvalonEditTextOutput output = new AvalonEditTextOutput(); Data.Position = 0; BitmapImage image = new BitmapImage(); //HACK: windows imaging does not understand that .cur files have the same layout as .ico // so load to data, and modify the ResourceType in the header to make look like an icon... byte[] curData = ((MemoryStream)Data).ToArray(); curData[2] = 1; using (Stream stream = new MemoryStream(curData)) { image.BeginInit(); image.StreamSource = stream; image.EndInit(); } output.AddUIElement(() => new Image { Source = image }); output.WriteLine(); output.AddButton(Images.Save, "Save", delegate { Save(null); }); textView.ShowNode(output, this, null); return(true); } catch (Exception) { return(false); } }
public static void Display(DecompilerTextView textView) { AvalonEditTextOutput output = new AvalonEditTextOutput() { EnableHyperlinks = true }; output.WriteLine(Resources.ILSpyVersion + RevisionClass.FullVersion); output.AddUIElement( delegate { StackPanel stackPanel = new StackPanel(); stackPanel.HorizontalAlignment = HorizontalAlignment.Center; stackPanel.Orientation = Orientation.Horizontal; if (latestAvailableVersion == null) { AddUpdateCheckButton(stackPanel, textView); } else { // we already retrieved the latest version sometime earlier ShowAvailableVersion(latestAvailableVersion, stackPanel); } CheckBox checkBox = new CheckBox(); checkBox.Margin = new Thickness(4); checkBox.Content = Resources.AutomaticallyCheckUpdatesEveryWeek; UpdateSettings settings = new UpdateSettings(ILSpySettings.Load()); checkBox.SetBinding(CheckBox.IsCheckedProperty, new Binding("AutomaticUpdateCheckEnabled") { Source = settings }); return(new StackPanel { Margin = new Thickness(0, 4, 0, 0), Cursor = Cursors.Arrow, Children = { stackPanel, checkBox } }); }); output.WriteLine(); foreach (var plugin in App.ExportProvider.GetExportedValues <IAboutPageAddition>()) { plugin.Write(output); } output.WriteLine(); using (Stream s = typeof(AboutPage).Assembly.GetManifestResourceStream(typeof(AboutPage), "README.txt")) { using (StreamReader r = new StreamReader(s)) { string line; while ((line = r.ReadLine()) != null) { output.WriteLine(line); } } } output.AddVisualLineElementGenerator(new MyLinkElementGenerator("SharpDevelop", "http://www.icsharpcode.net/opensource/sd/")); output.AddVisualLineElementGenerator(new MyLinkElementGenerator("MIT License", "resource:license.txt")); output.AddVisualLineElementGenerator(new MyLinkElementGenerator("LGPL", "resource:LGPL.txt")); output.AddVisualLineElementGenerator(new MyLinkElementGenerator("MS-PL", "resource:MS-PL.txt")); textView.ShowText(output); }
public static void Display(DecompilerTextView textView) { AvalonEditTextOutput output = new AvalonEditTextOutput(); output.WriteLine("ILSpy version " + RevisionClass.FullVersion); output.AddUIElement( delegate { StackPanel stackPanel = new StackPanel(); stackPanel.HorizontalAlignment = HorizontalAlignment.Center; stackPanel.Orientation = Orientation.Horizontal; if (latestAvailableVersion == null) { AddUpdateCheckButton(stackPanel, textView); } else { // we already retrieved the latest version sometime earlier ShowAvailableVersion(latestAvailableVersion, stackPanel); } CheckBox checkBox = new CheckBox(); checkBox.Margin = new Thickness(4); checkBox.Content = "Automatically check for updates every week"; UpdateSettings settings = new UpdateSettings(ILSpySettings.Load()); checkBox.SetBinding(CheckBox.IsCheckedProperty, new Binding("AutomaticUpdateCheckEnabled") { Source = settings }); return(new StackPanel { Margin = new Thickness(0, 4, 0, 0), Cursor = Cursors.Arrow, Children = { stackPanel, checkBox } }); }); output.WriteLine(); foreach (var plugin in App.CompositionContainer.GetExportedValues <IAboutPageAddition>()) { plugin.Write(output); } output.WriteLine(); using (Stream s = typeof(AboutPage).Assembly.GetManifestResourceStream(typeof(AboutPage), "README.txt")) { using (StreamReader r = new StreamReader(s)) { string line; while ((line = r.ReadLine()) != null) { output.WriteLine(line); } } } textView.Show(output); }
public override bool View(TabPageModel tabPage) { try { AvalonEditTextOutput output = new AvalonEditTextOutput(); BitmapImage image = new BitmapImage(); byte[] curData; using (var data = OpenStream()) { if (data == null) { return(false); } //HACK: windows imaging does not understand that .cur files have the same layout as .ico // so load to data, and modify the ResourceType in the header to make look like an icon... MemoryStream s = data as MemoryStream; if (s == null) { // data was stored in another stream type (e.g. PinnedBufferedMemoryStream) s = new MemoryStream(); data.CopyTo(s); } curData = s.ToArray(); } curData[2] = 1; using (Stream stream = new MemoryStream(curData)) { image.BeginInit(); image.StreamSource = stream; image.EndInit(); } output.AddUIElement(() => new Image { Source = image }); output.WriteLine(); output.AddButton(Images.Save, Resources.Save, delegate { Save(null); }); tabPage.ShowTextView(textView => textView.ShowNode(output, this)); tabPage.SupportsLanguageSwitching = false; return(true); } catch (Exception) { return(false); } }
internal override bool View(DecompilerTextView textView) { try { AvalonEditTextOutput output = new AvalonEditTextOutput(); data.Position = 0; BitmapImage image = new BitmapImage(); image.BeginInit(); image.StreamSource = data; image.EndInit(); output.AddUIElement(() => new Image { Source = image }); output.WriteLine(); output.AddButton(Images.Save, "Save", delegate { Save(null); }); textView.Show(output, null); return(true); } catch (Exception) { return(false); } }
public override bool View(DecompilerTextView textView) { try { AvalonEditTextOutput output = new AvalonEditTextOutput(); Data.Position = 0; BitmapImage image = new BitmapImage(); //HACK: windows imaging does not understand that .cur files have the same layout as .ico // so load to data, and modify the ResourceType in the header to make look like an icon... MemoryStream s = Data as MemoryStream; if (null == s) { // data was stored in another stream type (e.g. PinnedBufferedMemoryStream) s = new MemoryStream(); Data.CopyTo(s); } byte[] curData = s.ToArray(); curData[2] = 1; using (Stream stream = new MemoryStream(curData)) { image.BeginInit(); image.StreamSource = stream; image.EndInit(); } output.AddUIElement(() => new Image { Source = image }); output.WriteLine(); output.AddButton(ImageCache.Instance.GetImage("Save", BackgroundType.Button), "Save", delegate { Save(null); }); textView.ShowNode(output, this); return(true); } catch (Exception) { return(false); } }
public override bool View(DecompilerTextView textView) { try { AvalonEditTextOutput output = new AvalonEditTextOutput(); Data.Position = 0; BitmapImage image = new BitmapImage(); image.BeginInit(); image.StreamSource = Data; image.EndInit(); output.AddUIElement(() => new Image { Source = image }); output.WriteLine(); output.AddButton(ImageCache.Instance.GetImage("Save", BackgroundType.Button), "Save", delegate { Save(null); }); textView.ShowNode(output, this); return(true); } catch (Exception) { return(false); } }
public static void Display(DecompilerTextView textView) { AvalonEditTextOutput output = new AvalonEditTextOutput() { Title = Resources.About, EnableHyperlinks = true }; output.WriteLine(Resources.ILSpyVersion + RevisionClass.FullVersion); if (WindowsVersionHelper.HasPackageIdentity) { output.WriteLine($"Package Name: {WindowsVersionHelper.GetPackageFamilyName()}"); } else // if we're running in an MSIX, updates work differently { output.AddUIElement( delegate { StackPanel stackPanel = new StackPanel(); stackPanel.HorizontalAlignment = HorizontalAlignment.Center; stackPanel.Orientation = Orientation.Horizontal; if (latestAvailableVersion == null) { AddUpdateCheckButton(stackPanel, textView); } else { // we already retrieved the latest version sometime earlier ShowAvailableVersion(latestAvailableVersion, stackPanel); } CheckBox checkBox = new CheckBox(); checkBox.Margin = new Thickness(4); checkBox.Content = Resources.AutomaticallyCheckUpdatesEveryWeek; UpdateSettings settings = new UpdateSettings(ILSpySettings.Load()); checkBox.SetBinding(CheckBox.IsCheckedProperty, new Binding("AutomaticUpdateCheckEnabled") { Source = settings }); return(new StackPanel { Margin = new Thickness(0, 4, 0, 0), Cursor = Cursors.Arrow, Children = { stackPanel, checkBox } }); }); output.WriteLine(); } foreach (var plugin in App.ExportProvider.GetExportedValues <IAboutPageAddition>()) { plugin.Write(output); } output.WriteLine(); output.Address = new Uri("resource://AboutPage"); using (Stream s = typeof(AboutPage).Assembly.GetManifestResourceStream(typeof(AboutPage), Resources.ILSpyAboutPageTxt)) { using (StreamReader r = new StreamReader(s)) { string line; while ((line = r.ReadLine()) != null) { output.WriteLine(line); } } } output.AddVisualLineElementGenerator(new MyLinkElementGenerator("MIT License", "resource:license.txt")); output.AddVisualLineElementGenerator(new MyLinkElementGenerator("third-party notices", "resource:third-party-notices.txt")); textView.ShowText(output); }
public static void Display(DecompilerTextView textView) { AvalonEditTextOutput output = new AvalonEditTextOutput(); output.WriteLine(string.Format("dnSpy version {0}", currentVersion.ToString()), TextTokenType.Text); var decVer = typeof(ICSharpCode.Decompiler.Ast.AstBuilder).Assembly.GetName().Version; output.WriteLine(string.Format("ILSpy Decompiler version {0}.{1}.{2}", decVer.Major, decVer.Minor, decVer.Build), TextTokenType.Text); if (checkForUpdateCode) { output.AddUIElement( delegate { StackPanel stackPanel = new StackPanel(); stackPanel.HorizontalAlignment = HorizontalAlignment.Center; stackPanel.Orientation = Orientation.Horizontal; if (latestAvailableVersion == null) { AddUpdateCheckButton(stackPanel, textView); } else { // we already retrieved the latest version sometime earlier ShowAvailableVersion(latestAvailableVersion, stackPanel); } CheckBox checkBox = new CheckBox(); checkBox.Margin = new Thickness(4); checkBox.Content = "Automatically check for updates every week"; UpdateSettings settings = new UpdateSettings(ILSpySettings.Load()); checkBox.SetBinding(CheckBox.IsCheckedProperty, new Binding("AutomaticUpdateCheckEnabled") { Source = settings }); return(new StackPanel { Margin = new Thickness(0, 4, 0, 0), Cursor = Cursors.Arrow, Children = { stackPanel, checkBox } }); }); } if (checkForUpdateCode) { output.WriteLine(); } foreach (var plugin in App.CompositionContainer.GetExportedValues <IAboutPageAddition>()) { plugin.Write(output); } output.WriteLine(); using (Stream s = typeof(AboutPage).Assembly.GetManifestResourceStream(typeof(AboutPage), "README.txt")) { using (StreamReader r = new StreamReader(s)) { string line; while ((line = r.ReadLine()) != null) { output.WriteLine(line, TextTokenType.Text); } } } output.AddVisualLineElementGenerator(new MyLinkElementGenerator("SharpDevelop", "http://www.icsharpcode.net/opensource/sd/")); output.AddVisualLineElementGenerator(new MyLinkElementGenerator("MIT License", "resource:license.txt")); output.AddVisualLineElementGenerator(new MyLinkElementGenerator("LGPL", "resource:LGPL.txt")); output.AddVisualLineElementGenerator(new MyLinkElementGenerator("COPYING", "resource:COPYING")); textView.ShowText(output); MainWindow.Instance.SetTitle(textView, "About"); //reset icon bar textView.manager.Bookmarks.Clear(); }
private static void AddIcon(AvalonEditTextOutput output, BitmapFrame frame) { output.AddUIElement(() => new Image { Source = frame }); }