├── .gitattributes
├── .gitignore
├── Build
├── build-debug.cmd
├── build-release.cmd
└── pack-release.cmd
├── Doc
├── Attributions.txt
├── Copyright-SharpDevelop.txt
├── Links.txt
└── Screenshot1.png
├── LICENSE.md
├── README.md
├── Scripts
├── Empty.cs
├── Empty.csx
├── Emtpy.txt
├── Scratchpad.csx
└── Tutorial.csx
└── Src
├── .nuget
├── NuGet.Config
├── NuGet.exe
├── NuGet.targets
└── packages.config
├── CShell.Completion
├── CSharpCompletion.cs
├── CSharpCompletionContext.cs
├── CSharpCompletionDataFactory.cs
├── CSharpInsightItem.cs
├── CSharpOverloadProvider.cs
├── CShell.Completion.csproj
├── CodeTextEditor.cs
├── DataItems
│ ├── CompletionData.cs
│ ├── EntityCompletionData.cs
│ ├── ImportCompletionData.cs
│ ├── OverrideCompletionData.cs
│ └── VariableCompletionData.cs
├── Images
│ ├── Class.png
│ ├── CompletionImage.cs
│ ├── Constructor.png
│ ├── Delegate.png
│ ├── Enum.png
│ ├── EnumValue.png
│ ├── Event.png
│ ├── ExtensionMethod.png
│ ├── Field.png
│ ├── FieldReadOnly.png
│ ├── Indexer.png
│ ├── Interface.png
│ ├── Literal.png
│ ├── Method.png
│ ├── NameSpace.png
│ ├── Operator.png
│ ├── OverlayInternal.png
│ ├── OverlayPrivate.png
│ ├── OverlayProtected.png
│ ├── OverlayProtectedInternal.png
│ ├── OverlayStatic.png
│ ├── PInvokeMethod.png
│ ├── Property.png
│ ├── StaticClass.png
│ ├── Struct.png
│ └── VirtualMethod.png
├── Properties
│ └── AssemblyInfo.cs
├── SegmentTrackingOutputFormatter.cs
├── Settings.StyleCop
├── app.config
└── packages.config
├── CShell.Core
├── CShell.Core.csproj
├── Constants.cs
├── Framework
│ ├── Controls
│ │ ├── AutoGreyableImage.cs
│ │ ├── LayoutInitializer.cs
│ │ ├── Menu.cs
│ │ ├── MenuItem.cs
│ │ ├── PanesStyleSelector.cs
│ │ ├── PanesTemplateSelector.cs
│ │ └── ToolBar.cs
│ ├── Converters
│ │ ├── ActiveDocumentConverter.cs
│ │ └── UriConverter.cs
│ ├── Document.cs
│ ├── IDocument.cs
│ ├── IModule.cs
│ ├── ISink.cs
│ ├── ITextDocument.cs
│ ├── ITool.cs
│ ├── LICENCE.txt
│ ├── LayoutItemBase.cs
│ ├── Menus
│ │ ├── CheckableMenuItem.cs
│ │ ├── IMenu.cs
│ │ ├── IToolBar.cs
│ │ ├── MenuItem.cs
│ │ ├── MenuItemBase.cs
│ │ ├── MenuItemSeparator.cs
│ │ ├── MenuModel.cs
│ │ ├── StandardMenuItem.cs
│ │ └── ToolBarModel.cs
│ ├── ModuleBase.cs
│ ├── RelayCommand.cs
│ ├── Results
│ │ ├── ChangeWorkspaceResult.cs
│ │ ├── CloseShellResult.cs
│ │ ├── IOpenResult.cs
│ │ ├── OpenDocumentResult.cs
│ │ ├── OpenResultBase.cs
│ │ ├── ResultBase.cs
│ │ ├── ResultExtensions.cs
│ │ ├── Run.cs
│ │ ├── RunCodeResult.cs
│ │ ├── SaveDocumentResult.cs
│ │ ├── Show.cs
│ │ ├── ShowCommonDialogResult.cs
│ │ ├── ShowDialogResult.cs
│ │ ├── ShowFolderDialogResult.cs
│ │ └── ShowToolResult.cs
│ ├── Services
│ │ ├── Execute.cs
│ │ ├── ExtensionMethods.cs
│ │ ├── IDocumentProvider.cs
│ │ ├── IInputManager.cs
│ │ ├── IOutput.cs
│ │ ├── IPropertyGrid.cs
│ │ ├── IReplOutput.cs
│ │ ├── IResourceManager.cs
│ │ ├── IShell.cs
│ │ ├── ISinkProvider.cs
│ │ ├── IStatusBar.cs
│ │ ├── InputBindingTrigger.cs
│ │ ├── InputManager.cs
│ │ ├── LoggerDebug.cs
│ │ ├── LoggerNLog.cs
│ │ ├── PaneLocation.cs
│ │ ├── ResourceManager.cs
│ │ └── WorkspaceActivator.cs
│ ├── Sink.cs
│ └── Tool.cs
├── ICompletion.cs
├── IDefaultReferences.cs
├── IReplExecutorFactory.cs
├── IReplScriptExecutor.cs
├── Properties
│ └── AssemblyInfo.cs
├── References.cs
├── Scripts.cs
├── Shell.Documents.cs
├── Shell.Sinks.cs
├── Shell.Tools.cs
├── Shell.Workspace.cs
├── Shell.cs
├── Test.cs
├── Util
│ ├── FusionNative.cs
│ ├── GlobalAssemblyCache.cs
│ └── PathHelper.cs
├── Workspace.Serialization.cs
├── Workspace.cs
├── WorkspaceEvents.cs
├── WorkspaceException.cs
├── app.config
└── packages.config
├── CShell.Hosting.Tests
├── CShell.Hosting.Tests.csproj
├── Properties
│ └── AssemblyInfo.cs
├── ReplScriptExecutorTests.cs
├── TestObjFactory.cs
├── app.config
└── packages.config
├── CShell.Hosting
├── CShell.Hosting.csproj
├── DefaultReferences.cs
├── FileSystem.cs
├── HostingHelpers.cs
├── ObjectSerializer.cs
├── Package
│ ├── NugetInstallationProvider.cs
│ ├── NugetMachineWideSettings.cs
│ ├── PackageContainer.cs
│ ├── PackageInstaller.cs
│ └── PackageObject.cs
├── Properties
│ └── AssemblyInfo.cs
├── ReplCommands
│ ├── ClearCommand.cs
│ ├── HelpCommand.cs
│ ├── InstallCommand.cs
│ └── ResetCommand.cs
├── ReplLogProvider.cs
├── ReplScriptExecutor.cs
├── ReplScriptExecutorFactory.cs
├── ReplScriptHost.cs
├── ScriptResultExtensions.cs
├── app.config
└── packages.config
├── CShell.Sinks.Chart
├── CShell.Sinks.Charting.csproj
├── ChartSink.cs
├── ChartSinkProvider.cs
├── ChartSinkView.xaml
├── ChartSinkView.xaml.cs
├── ChartSinkViewModel.cs
├── HistogramChartHelper.cs
├── Module.cs
├── Properties
│ └── AssemblyInfo.cs
├── app.config
└── packages.config
├── CShell.Sinks.Grid
├── CShell.Sinks.Grid.csproj
├── GridSink.cs
├── GridSinkProvider.cs
├── GridSinkView.xaml
├── GridSinkView.xaml.cs
├── GridSinkViewModel.cs
├── Module.cs
├── Properties
│ └── AssemblyInfo.cs
├── app.config
└── packages.config
├── CShell.Sinks.Xhtml
├── CShell.Sinks.Xhtml.csproj
├── Module.cs
├── Properties
│ ├── AssemblyInfo.cs
│ ├── Resources.Designer.cs
│ └── Resources.resx
├── Resources
│ └── StyleSheet.css
├── XhtmlDumper
│ ├── BasicXhtmlRenderer.cs
│ ├── IXhtmlRenderer.cs
│ ├── ObjectXhtmlRenderer.cs
│ └── XhtmlDumper.cs
├── XhtmlSink.cs
├── XhtmlSinkProvider.cs
├── XhtmlSinkView.xaml
├── XhtmlSinkView.xaml.cs
├── XhtmlSinkViewModel.cs
├── app.config
└── packages.config
├── CShell.Tests
├── CShell.Tests.csproj
├── CommandQueueTest.cs
├── Properties
│ └── AssemblyInfo.cs
└── packages.config
├── CShell.sln
├── CShell.sln.DotSettings
├── CShell
├── App.xaml
├── App.xaml.cs
├── AppBootstrapper.cs
├── CShell.csproj
├── Default
│ └── Default.cshell
├── Icon.ico
├── Modules
│ ├── Editors
│ │ ├── Controls
│ │ │ └── CodeCompletionTextEditor.cs
│ │ ├── EditorProvider.cs
│ │ ├── Module.cs
│ │ ├── ViewModels
│ │ │ └── EditorViewModel.cs
│ │ └── Views
│ │ │ ├── EditorView.xaml
│ │ │ └── EditorView.xaml.cs
│ ├── Help
│ │ ├── Module.cs
│ │ ├── ViewModels
│ │ │ └── AboutViewModel.cs
│ │ └── Views
│ │ │ ├── AboutView.xaml
│ │ │ └── AboutView.xaml.cs
│ ├── Repl
│ │ ├── Controls
│ │ │ ├── CSRepl.xaml
│ │ │ ├── CSRepl.xaml.cs
│ │ │ ├── CSReplTextEditor.cs
│ │ │ ├── CommandHistory.cs
│ │ │ ├── CommandQueue.cs
│ │ │ ├── ConsoleStream.cs
│ │ │ └── OffsetColorizer.cs
│ │ ├── Module.cs
│ │ ├── ViewModels
│ │ │ ├── OutputViewModel.cs
│ │ │ └── ReplViewModel.cs
│ │ └── Views
│ │ │ ├── IOutputView.cs
│ │ │ ├── IReplView.cs
│ │ │ ├── OutputView.xaml
│ │ │ ├── OutputView.xaml.cs
│ │ │ ├── ReplView.xaml
│ │ │ └── ReplView.xaml.cs
│ ├── Shell
│ │ ├── Module.cs
│ │ ├── ViewModels
│ │ │ ├── MainMenuViewModel.cs
│ │ │ ├── ShellViewModel.cs
│ │ │ ├── StatusBarViewModel.cs
│ │ │ └── ToolBarViewModel.cs
│ │ └── Views
│ │ │ ├── IShellView.cs
│ │ │ ├── ShellView.xaml
│ │ │ └── ShellView.xaml.cs
│ └── Workspace
│ │ ├── Controls
│ │ ├── EditableTextBlock.xaml
│ │ └── EditableTextBlock.xaml.cs
│ │ ├── Module.cs
│ │ ├── Results
│ │ ├── AddFilesResult.cs
│ │ ├── AddFolderResult.cs
│ │ ├── AddReferencesResult.cs
│ │ └── CopyReferencesResult.cs
│ │ ├── ViewModels
│ │ ├── AssemblyGacViewModel.cs
│ │ ├── AssemblyPackagesViewModel.cs
│ │ ├── AssemblyReferenceViewModel.cs
│ │ ├── AssemblyReferencesViewModel.cs
│ │ ├── FilePackagesViewModel.cs
│ │ ├── FileViewModel.cs
│ │ ├── FolderBinViewModel.cs
│ │ ├── FolderPackagesViewModel.cs
│ │ ├── FolderRootViewModel.cs
│ │ ├── FolderViewModel.cs
│ │ ├── TreeViewModel.cs
│ │ └── WorkspaceViewModel.cs
│ │ └── Views
│ │ ├── AssemblyGacView.xaml
│ │ ├── AssemblyGacView.xaml.cs
│ │ ├── AssemblyPackagesView.xaml
│ │ ├── AssemblyPackagesView.xaml.cs
│ │ ├── RootFolderSettingsView.xaml
│ │ ├── RootFolderSettingsView.xaml.cs
│ │ ├── WorkspaceView.xaml
│ │ └── WorkspaceView.xaml.cs
├── Properties
│ ├── AssemblyInfo.cs
│ ├── Resources.Designer.cs
│ ├── Resources.resx
│ ├── Settings.Designer.cs
│ └── Settings.settings
├── Resources
│ ├── Icon.png
│ ├── Icons
│ │ ├── ClearOutputWindow.png
│ │ ├── FileBrowser.png
│ │ ├── Folder.Closed.png
│ │ ├── Folder.Open.png
│ │ ├── Icons.16x16.Assembly.png
│ │ ├── Icons.16x16.CSFile.png
│ │ ├── Icons.16x16.CommentRegion.png
│ │ ├── Icons.16x16.CopyIcon.png
│ │ ├── Icons.16x16.CutIcon.png
│ │ ├── Icons.16x16.DeleteIcon.png
│ │ ├── Icons.16x16.FindIcon.png
│ │ ├── Icons.16x16.Indent.png
│ │ ├── Icons.16x16.MiscFiles.png
│ │ ├── Icons.16x16.PasteIcon.png
│ │ ├── Icons.16x16.Property.png
│ │ ├── Icons.16x16.RedoIcon.png
│ │ ├── Icons.16x16.Reference.png
│ │ ├── Icons.16x16.ReferenceModule.png
│ │ ├── Icons.16x16.RunAllIcon.png
│ │ ├── Icons.16x16.RunProgramIcon.png
│ │ ├── Icons.16x16.SaveAllIcon.png
│ │ ├── Icons.16x16.SaveIcon.png
│ │ ├── Icons.16x16.TextFileIcon.png
│ │ ├── Icons.16x16.UndoIcon.png
│ │ ├── Icons.16x16.XMLFileIcon.png
│ │ ├── Open.png
│ │ ├── Output.png
│ │ ├── ReferenceFolder.Closed.png
│ │ ├── ReferenceFolder.Open.png
│ │ ├── Toolbar.Refresh.png
│ │ ├── page_go.png
│ │ └── page_white_go.png
│ ├── Menu.xaml
│ └── Styles.xaml
├── SplashScreen.png
├── Templates
│ └── Empty.cshell
├── app.config
└── packages.config
├── NuGet.config
└── SetupProject
├── LicenseAgreement.rtf
├── LicenseAgreement.rtf.docx
├── Product.wxs
└── SetupProject.wixproj
/.gitattributes:
--------------------------------------------------------------------------------
1 | # Auto detect text files and perform LF normalization
2 | * text=auto
3 |
4 | # Custom for Visual Studio
5 | *.cs diff=csharp
6 | *.sln merge=union
7 | *.csproj merge=union
8 | *.vbproj merge=union
9 | *.fsproj merge=union
10 | *.dbproj merge=union
11 |
12 | # Standard to msysgit
13 | *.doc diff=astextplain
14 | *.DOC diff=astextplain
15 | *.docx diff=astextplain
16 | *.DOCX diff=astextplain
17 | *.dot diff=astextplain
18 | *.DOT diff=astextplain
19 | *.pdf diff=astextplain
20 | *.PDF diff=astextplain
21 | *.rtf diff=astextplain
22 | *.RTF diff=astextplain
23 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Build Folders (you can keep bin if you'd like, to store dlls and pdbs)
2 | [Bb]in/
3 | [Oo]bj/
4 |
5 | # mstest test results
6 | TestResults
7 |
8 | ## Ignore Visual Studio temporary files, build results, and
9 | ## files generated by popular Visual Studio add-ons.
10 |
11 | # User-specific files
12 | *.suo
13 | *.user
14 | *.sln.docstates
15 |
16 | # Build results
17 | [Dd]ebug/
18 | [Rr]elease/
19 | x64/
20 | *_i.c
21 | *_p.c
22 | *.ilk
23 | *.meta
24 | *.obj
25 | *.pch
26 | *.pdb
27 | *.pgc
28 | *.pgd
29 | *.rsp
30 | *.sbr
31 | *.tlb
32 | *.tli
33 | *.tlh
34 | *.tmp
35 | *.log
36 | *.vspscc
37 | *.vssscc
38 | .builds
39 |
40 | # Visual C++ cache files
41 | ipch/
42 | *.aps
43 | *.ncb
44 | *.opensdf
45 | *.sdf
46 |
47 | # Visual Studio profiler
48 | *.psess
49 | *.vsp
50 | *.vspx
51 |
52 | # Guidance Automation Toolkit
53 | *.gpState
54 |
55 | # ReSharper is a .NET coding add-in
56 | _ReSharper*
57 | *.resharper
58 |
59 | # NCrunch
60 | *.ncrunch*
61 | .*crunch*.local.xml
62 |
63 | # Installshield output folder
64 | [Ee]xpress
65 |
66 | # DocProject is a documentation generator add-in
67 | DocProject/buildhelp/
68 | DocProject/Help/*.HxT
69 | DocProject/Help/*.HxC
70 | DocProject/Help/*.hhc
71 | DocProject/Help/*.hhk
72 | DocProject/Help/*.hhp
73 | DocProject/Help/Html2
74 | DocProject/Help/html
75 |
76 | # Click-Once directory
77 | publish
78 |
79 | # Publish Web Output
80 | *.Publish.xml
81 |
82 | # NuGet Packages Directory
83 | packages
84 |
85 | # Windows Azure Build Output
86 | csx
87 | *.build.csdef
88 |
89 | # Windows Store app package directory
90 | AppPackages/
91 |
92 | # Others
93 | [Ll]ib
94 | [Bb]in
95 | [Oo]bj
96 | sql
97 | TestResults
98 | [Tt]est[Rr]esult*
99 | *.Cache
100 | ClientBin
101 | [Ss]tyle[Cc]op.*
102 | ~$*
103 | *.dbmdl
104 | Generated_Code #added for RIA/Silverlight projects
105 | Ankh.NoLoad
106 | Thumbs.db
107 |
108 | # Backup & report files from converting an old project file to a newer
109 | # Visual Studio version. Backup files are not needed, because we have git ;-)
110 | _UpgradeReport_Files/
111 | Backup*/
112 | UpgradeLog*.XML
113 |
--------------------------------------------------------------------------------
/Build/build-debug.cmd:
--------------------------------------------------------------------------------
1 | call "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" x86
2 |
3 | MSBuild ../Src/CShell.sln /t:Build /p:Configuration=Debug
4 |
--------------------------------------------------------------------------------
/Build/build-release.cmd:
--------------------------------------------------------------------------------
1 | call "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" x86
2 |
3 | MSBuild ../Src/CShell.sln /t:Build /p:Configuration=Release
4 |
--------------------------------------------------------------------------------
/Build/pack-release.cmd:
--------------------------------------------------------------------------------
1 | rmdir /S /Q "../Bin/Release/de"
2 | rmdir /S /Q "../Bin/Release/es"
3 | rmdir /S /Q "../Bin/Release/fr"
4 | rmdir /S /Q "../Bin/Release/hu"
5 | rmdir /S /Q "../Bin/Release/it"
6 | rmdir /S /Q "../Bin/Release/pt-BR"
7 | rmdir /S /Q "../Bin/Release/ro"
8 | rmdir /S /Q "../Bin/Release/ru"
9 | rmdir /S /Q "../Bin/Release/sv"
10 | rmdir /S /Q "../Bin/Release/zh-Hans"
11 | rmdir /S /Q "../Bin/Release/Logs"
12 |
13 | "C:\Program Files\7-Zip\7z.exe" a -tzip "..\Bin\CShell.zip" "..\Bin\Release\*"
--------------------------------------------------------------------------------
/Doc/Attributions.txt:
--------------------------------------------------------------------------------
1 | Many thanks to everybody who contributed to the opensource projects that made CShell possible!
2 |
3 | WPF Framework
4 | =============================
5 | Carliburn.Micro: http://caliburnmicro.codeplex.com/
6 | Gemini: https://github.com/tgjones/gemini
7 | AvalonDock: http://avalondock.codeplex.com/
8 |
9 | Scripting
10 | =============================
11 | The project builds on ScriptCS for most scripting and REPL stuff
12 | http://scriptcs.net/
13 | Which uses Roslyn and/or the mono compiler under the hood.
14 |
15 | Text Editor & Code Completion
16 | =============================
17 | Avalon Edit: https://github.com/icsharpcode/SharpDevelop/wiki/AvalonEdit
18 | NRefactory: https://github.com/icsharpcode/NRefactory
19 |
20 | Others
21 | =============================
22 | GAC Interop: From SharpDevelop: https://github.com/icsharpcode/SharpDevelop
23 | Some Icons: From SharpDevelop: https://github.com/icsharpcode/SharpDevelop
24 |
25 | Application Icon
26 | =============================
27 | Part of 'FS Icons Ubuntu' icon set.
28 | http://franksouza183.deviantart.com/
29 | http://www.iconfinder.com/icondetails/79650/128/arrow_right_icon
--------------------------------------------------------------------------------
/Doc/Copyright-SharpDevelop.txt:
--------------------------------------------------------------------------------
1 | For the code copied from SharpDevelop & NRefactory
2 |
3 | Copyright 2002-2012 by
4 |
5 | AlphaSierraPapa, Christoph Wille
6 | Vordernberger Strasse 27/8
7 | A-8700 Leoben
8 | Austria
9 |
10 | email: office@alphasierrapapa.com
11 | court of jurisdiction: Landesgericht Leoben
12 |
13 |
--------------------------------------------------------------------------------
/Doc/Links.txt:
--------------------------------------------------------------------------------
1 | mono
2 | http://tirania.org/blog/archive/2008/Aug-26.html Line editor
3 | https://github.com/mono/mono/tree/master/mcs/tools/csharp csharp repl source
4 |
5 | avalon edit code completion
6 | - http://community.sharpdevelop.net/forums/t/15802.aspx
7 | - http://nuget.org/packages/SharpDevelopCodeCompletion
8 |
9 | - https://github.com/icsharpcode/NRefactory
10 | - http://www.codeproject.com/Articles/408663/Using-NRefactory-for-analyzing-Csharp-code
11 | Read:
12 | - http://stackoverflow.com/questions/12506646/c-sharp-code-completion-with-nrefactory-5
13 |
14 | avalon edit
15 | - http://community.sharpdevelop.net/forums/t/14310.aspx (remove ctrl-x)
16 |
17 | controls
18 | http://www.codeproject.com/Articles/173509/A-Universal-WPF-Find-Replace-Dialog
19 |
20 |
21 | app domains
22 | http://stackoverflow.com/questions/1277346/net-problem-with-raising-and-handling-events-using-appdomains
23 | http://msdn.microsoft.com/en-us/library/dd153782.aspx
24 |
25 | tree view
26 | http://www.codeproject.com/Articles/31592/Editable-TextBlock-in-WPF-for-In-place-Editing
27 |
28 |
29 | settings are saved here:
30 | %USERPROFILE%\AppData\Local\
31 |
32 |
33 | time series
34 | http://opentsdb.net/
35 | http://code.google.com/p/timeseriesdb/
36 | http://www.codeproject.com/Articles/382245/Time-Series-Analysis-in-Csharp-NET-Part-II
37 |
38 | f#
39 | http://fsxplat.codeplex.com/SourceControl/changeset/view/4d371abd932f#samples/compiler/fsintellisense/Program.fs
40 | http://stackoverflow.com/questions/11589990/f-intellisense-in-a-custom-editor
41 |
42 |
43 |
44 |
45 |
--------------------------------------------------------------------------------
/Doc/Screenshot1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lukebuehler/CShell/a02a0414ed8fb42bbacb8ba72542bcdcaac233e9/Doc/Screenshot1.png
--------------------------------------------------------------------------------
/LICENSE.md:
--------------------------------------------------------------------------------
1 | Copyright 2015 Lukas Buhler
2 |
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | CShell Readme
2 | =============
3 |
4 | **Website and binaries:** http://cshell.net
5 |
6 | CShell is an interactive C# scripting environment. It allows you to use C# without any fluff right in a console like environment called a read-eval-print-loop (REPL). Your code is directly evaluated and executed in a shell window, no separate executable has to be compiled and then run in a different process. More elaborate code can be written in a C# script and then evaluated as one file, only one line, or a selection. Then, your results can be easily dumped to HTML (like LINQPad) or viewed as a data grid or plotted to a chart.
7 |
8 | CShell is perfect to explore data and quickly drill deeper into information since you can write one line of code, evaluate it, check out the results, and then write some more code, evaluate it again, and so forth.
9 |
10 | If you just want to test one or two lines of C# code without creating a new console project in Visual Studio just fire up CShell, type the code you wanna test and you immediately can see if it works the way you want.
11 |
12 | 
13 |
14 | System Requirements
15 | ------------
16 | CShell needs the .NET Framework 4.5 installed. Supported Windows versions: Windows 7, 8, 8.1 and Vista SP2. Windows XP is not supported.
17 |
18 | How to Build
19 | ------------
20 | To build Visual Studio 2013 or higher is required. Open the solution and build the project or configure the build script in the /Build folder to point to the right Visual Studio 'vcvarsall' script.
21 |
22 | For the first build some NuGet packages have to be downloaded make sure you have NuGet installed and package restore enabled (Tools>Options>Package Manager>Package Restore).
23 |
24 | License
25 | -------
26 | CShell is released under the [Apache 2.0 license](http://www.apache.org/licenses/LICENSE-2.0).
27 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/Scripts/Empty.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using CShell;
6 |
7 | public class NewClass
8 | {
9 | }
10 |
--------------------------------------------------------------------------------
/Scripts/Empty.csx:
--------------------------------------------------------------------------------
1 | // C# Script
2 | // Press Alt+Enter to evaluate a single line or selection
3 | // Press Alt+Shift+Enter to evaluate the whole script
--------------------------------------------------------------------------------
/Scripts/Emtpy.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lukebuehler/CShell/a02a0414ed8fb42bbacb8ba72542bcdcaac233e9/Scripts/Emtpy.txt
--------------------------------------------------------------------------------
/Scripts/Scratchpad.csx:
--------------------------------------------------------------------------------
1 | // C# Script
2 | // Press Alt+Enter to evaluate a single line or selection
3 | // Press Alt+Shift+Enter to evaluate the whole script
--------------------------------------------------------------------------------
/Src/.nuget/NuGet.Config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Src/.nuget/NuGet.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lukebuehler/CShell/a02a0414ed8fb42bbacb8ba72542bcdcaac233e9/Src/.nuget/NuGet.exe
--------------------------------------------------------------------------------
/Src/.nuget/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/Src/CShell.Completion/DataItems/ImportCompletionData.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
2 | // This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
3 |
4 | using ICSharpCode.NRefactory.CSharp.Refactoring;
5 | using ICSharpCode.NRefactory.CSharp.Resolver;
6 | using ICSharpCode.NRefactory.CSharp.TypeSystem;
7 | using ICSharpCode.NRefactory.TypeSystem;
8 |
9 | namespace CShell.Completion.DataItems
10 | {
11 | ///
12 | /// Completion item that introduces a using declaration.
13 | ///
14 | class ImportCompletionData : EntityCompletionData
15 | {
16 | string insertUsing;
17 | string insertionText;
18 |
19 | public ImportCompletionData(ITypeDefinition typeDef, CSharpTypeResolveContext contextAtCaret, bool useFullName)
20 | : base(typeDef)
21 | {
22 | this.Description = "using " + typeDef.Namespace + ";";
23 | if (useFullName)
24 | {
25 | var astBuilder = new TypeSystemAstBuilder(new CSharpResolver(contextAtCaret));
26 | insertionText = astBuilder.ConvertType(typeDef).GetText();
27 | }
28 | else
29 | {
30 | insertionText = typeDef.Name;
31 | insertUsing = typeDef.Namespace;
32 | }
33 | }
34 | } //end class ImportCompletionData
35 | }
36 |
--------------------------------------------------------------------------------
/Src/CShell.Completion/DataItems/VariableCompletionData.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
2 | // This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
3 |
4 | using System;
5 | using CShell.Completion.Images;
6 | using ICSharpCode.NRefactory.Completion;
7 | using ICSharpCode.NRefactory.CSharp;
8 | using ICSharpCode.NRefactory.TypeSystem;
9 |
10 | namespace CShell.Completion.DataItems
11 | {
12 | internal class VariableCompletionData : CompletionData, IVariableCompletionData
13 | {
14 | public VariableCompletionData(IVariable variable)
15 | {
16 | if (variable == null) throw new ArgumentNullException("variable");
17 | Variable = variable;
18 |
19 | IAmbience ambience = new CSharpAmbience();
20 | DisplayText = variable.Name;
21 | Description = ambience.ConvertVariable(variable);
22 | CompletionText = Variable.Name;
23 | this.Image = CompletionImage.Field.BaseImage;
24 | }
25 |
26 | public IVariable Variable { get; private set; }
27 | } //end class VariableCompletionData
28 |
29 | }
30 |
--------------------------------------------------------------------------------
/Src/CShell.Completion/Images/Class.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lukebuehler/CShell/a02a0414ed8fb42bbacb8ba72542bcdcaac233e9/Src/CShell.Completion/Images/Class.png
--------------------------------------------------------------------------------
/Src/CShell.Completion/Images/Constructor.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lukebuehler/CShell/a02a0414ed8fb42bbacb8ba72542bcdcaac233e9/Src/CShell.Completion/Images/Constructor.png
--------------------------------------------------------------------------------
/Src/CShell.Completion/Images/Delegate.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lukebuehler/CShell/a02a0414ed8fb42bbacb8ba72542bcdcaac233e9/Src/CShell.Completion/Images/Delegate.png
--------------------------------------------------------------------------------
/Src/CShell.Completion/Images/Enum.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lukebuehler/CShell/a02a0414ed8fb42bbacb8ba72542bcdcaac233e9/Src/CShell.Completion/Images/Enum.png
--------------------------------------------------------------------------------
/Src/CShell.Completion/Images/EnumValue.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lukebuehler/CShell/a02a0414ed8fb42bbacb8ba72542bcdcaac233e9/Src/CShell.Completion/Images/EnumValue.png
--------------------------------------------------------------------------------
/Src/CShell.Completion/Images/Event.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lukebuehler/CShell/a02a0414ed8fb42bbacb8ba72542bcdcaac233e9/Src/CShell.Completion/Images/Event.png
--------------------------------------------------------------------------------
/Src/CShell.Completion/Images/ExtensionMethod.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lukebuehler/CShell/a02a0414ed8fb42bbacb8ba72542bcdcaac233e9/Src/CShell.Completion/Images/ExtensionMethod.png
--------------------------------------------------------------------------------
/Src/CShell.Completion/Images/Field.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lukebuehler/CShell/a02a0414ed8fb42bbacb8ba72542bcdcaac233e9/Src/CShell.Completion/Images/Field.png
--------------------------------------------------------------------------------
/Src/CShell.Completion/Images/FieldReadOnly.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lukebuehler/CShell/a02a0414ed8fb42bbacb8ba72542bcdcaac233e9/Src/CShell.Completion/Images/FieldReadOnly.png
--------------------------------------------------------------------------------
/Src/CShell.Completion/Images/Indexer.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lukebuehler/CShell/a02a0414ed8fb42bbacb8ba72542bcdcaac233e9/Src/CShell.Completion/Images/Indexer.png
--------------------------------------------------------------------------------
/Src/CShell.Completion/Images/Interface.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lukebuehler/CShell/a02a0414ed8fb42bbacb8ba72542bcdcaac233e9/Src/CShell.Completion/Images/Interface.png
--------------------------------------------------------------------------------
/Src/CShell.Completion/Images/Literal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lukebuehler/CShell/a02a0414ed8fb42bbacb8ba72542bcdcaac233e9/Src/CShell.Completion/Images/Literal.png
--------------------------------------------------------------------------------
/Src/CShell.Completion/Images/Method.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lukebuehler/CShell/a02a0414ed8fb42bbacb8ba72542bcdcaac233e9/Src/CShell.Completion/Images/Method.png
--------------------------------------------------------------------------------
/Src/CShell.Completion/Images/NameSpace.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lukebuehler/CShell/a02a0414ed8fb42bbacb8ba72542bcdcaac233e9/Src/CShell.Completion/Images/NameSpace.png
--------------------------------------------------------------------------------
/Src/CShell.Completion/Images/Operator.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lukebuehler/CShell/a02a0414ed8fb42bbacb8ba72542bcdcaac233e9/Src/CShell.Completion/Images/Operator.png
--------------------------------------------------------------------------------
/Src/CShell.Completion/Images/OverlayInternal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lukebuehler/CShell/a02a0414ed8fb42bbacb8ba72542bcdcaac233e9/Src/CShell.Completion/Images/OverlayInternal.png
--------------------------------------------------------------------------------
/Src/CShell.Completion/Images/OverlayPrivate.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lukebuehler/CShell/a02a0414ed8fb42bbacb8ba72542bcdcaac233e9/Src/CShell.Completion/Images/OverlayPrivate.png
--------------------------------------------------------------------------------
/Src/CShell.Completion/Images/OverlayProtected.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lukebuehler/CShell/a02a0414ed8fb42bbacb8ba72542bcdcaac233e9/Src/CShell.Completion/Images/OverlayProtected.png
--------------------------------------------------------------------------------
/Src/CShell.Completion/Images/OverlayProtectedInternal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lukebuehler/CShell/a02a0414ed8fb42bbacb8ba72542bcdcaac233e9/Src/CShell.Completion/Images/OverlayProtectedInternal.png
--------------------------------------------------------------------------------
/Src/CShell.Completion/Images/OverlayStatic.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lukebuehler/CShell/a02a0414ed8fb42bbacb8ba72542bcdcaac233e9/Src/CShell.Completion/Images/OverlayStatic.png
--------------------------------------------------------------------------------
/Src/CShell.Completion/Images/PInvokeMethod.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lukebuehler/CShell/a02a0414ed8fb42bbacb8ba72542bcdcaac233e9/Src/CShell.Completion/Images/PInvokeMethod.png
--------------------------------------------------------------------------------
/Src/CShell.Completion/Images/Property.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lukebuehler/CShell/a02a0414ed8fb42bbacb8ba72542bcdcaac233e9/Src/CShell.Completion/Images/Property.png
--------------------------------------------------------------------------------
/Src/CShell.Completion/Images/StaticClass.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lukebuehler/CShell/a02a0414ed8fb42bbacb8ba72542bcdcaac233e9/Src/CShell.Completion/Images/StaticClass.png
--------------------------------------------------------------------------------
/Src/CShell.Completion/Images/Struct.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lukebuehler/CShell/a02a0414ed8fb42bbacb8ba72542bcdcaac233e9/Src/CShell.Completion/Images/Struct.png
--------------------------------------------------------------------------------
/Src/CShell.Completion/Images/VirtualMethod.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lukebuehler/CShell/a02a0414ed8fb42bbacb8ba72542bcdcaac233e9/Src/CShell.Completion/Images/VirtualMethod.png
--------------------------------------------------------------------------------
/Src/CShell.Completion/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("CShell.Completion")]
9 | [assembly: AssemblyDescription("A Simple C# Scripting IDE")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("Arnova")]
12 | [assembly: AssemblyProduct("CShell")]
13 | [assembly: AssemblyCopyright("Copyright © Arnova Asset Management Ltd 2015")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("380faaad-c726-4460-8667-998e05e10c33")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("0.1.3.*")]
36 | [assembly: AssemblyFileVersion("0.1.3.*")]
37 |
--------------------------------------------------------------------------------
/Src/CShell.Completion/SegmentTrackingOutputFormatter.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.IO;
3 | using System.Text;
4 | using ICSharpCode.AvalonEdit.Document;
5 | using ICSharpCode.NRefactory.CSharp;
6 |
7 | namespace CShell.Completion
8 | {
9 | ///
10 | /// Output formatter that creates a dictionary from AST nodes to segments in the output text.
11 | ///
12 | public class SegmentTrackingOutputFormatter : TextWriterTokenWriter
13 | {
14 | Dictionary segments = new Dictionary();
15 | Stack startOffsets = new Stack();
16 | readonly StringWriter stringWriter;
17 |
18 | public IDictionary Segments
19 | {
20 | get { return segments; }
21 | }
22 |
23 | public SegmentTrackingOutputFormatter(StringWriter stringWriter)
24 | : base(stringWriter)
25 | {
26 | this.stringWriter = stringWriter;
27 | }
28 |
29 | public static IDictionary WriteNode(StringWriter writer, AstNode node, CSharpFormattingOptions policy, ICSharpCode.AvalonEdit.TextEditorOptions options)
30 | {
31 | var formatter = new SegmentTrackingOutputFormatter(writer);
32 | formatter.IndentationString = options.IndentationString;
33 | var visitor = new CSharpOutputVisitor(formatter, policy);
34 | node.AcceptVisitor(visitor);
35 | return formatter.Segments;
36 | }
37 |
38 | public override void StartNode(AstNode node)
39 | {
40 | base.StartNode(node);
41 | startOffsets.Push(stringWriter.GetStringBuilder().Length);
42 | }
43 |
44 | public override void EndNode(AstNode node)
45 | {
46 | int startOffset = startOffsets.Pop();
47 | StringBuilder b = stringWriter.GetStringBuilder();
48 | int endOffset = b.Length;
49 | while (endOffset > 0 && b[endOffset - 1] == '\r' || b[endOffset - 1] == '\n')
50 | endOffset--;
51 | segments.Add(node, new TextSegment { StartOffset = startOffset, EndOffset = endOffset });
52 | base.EndNode(node);
53 | }
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/Src/CShell.Completion/Settings.StyleCop:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/Src/CShell.Completion/app.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/Src/CShell.Completion/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Src/CShell.Core/Constants.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace CShell
7 | {
8 | public static class Constants
9 | {
10 | public const string CShellHelp = "https://github.com/ArnovaAssetManagement/CShell";
11 |
12 |
13 | public const string FileFilter = "C# Files|*.csx;*.cs;|All Files|*.*";
14 | public const string FileTypes = "C# Script|*.csx|C# File|*.cs|Text File|*.txt|Other|*.*";
15 | public const string DefaultExtension = ".csx";
16 |
17 | public const string AssemblyFileFilter = "Component Files|*.dll;*.exe|All Files|*.*";
18 | public const string AssemblyFileExtension = ".dll";
19 |
20 | public const string WorkspaceFileExtension = ".xml";
21 | public const string WorkspaceFilter = "*.xml *.dll *.cshell";
22 |
23 | public const string ModulesPath = "Modules";
24 | public const string TemplatesPath = "Templates";
25 | public const string DefaultWorkspacePath = "Default\\";
26 | public const string ReferencesFile = "references.csx";
27 | public const string LayoutFile = "layout.config";
28 | public const string ConfigFile = "config.csx";
29 |
30 | public const string PackagesFile = "packages.config";
31 | public const string NugetFile = "nuget.config";
32 | public const string PackagesFolder = "packages";
33 | public const string DefaultRepositoryUrl = "https://nuget.org/api/v2/";
34 |
35 | public const string BinFolder = "bin";
36 | public const string DllCacheFolder = "cache";
37 |
38 | public const string NetFrameworkName = ".NETFramework,Version=v4.5";
39 |
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/Src/CShell.Core/Framework/Controls/Menu.cs:
--------------------------------------------------------------------------------
1 | using System.Windows;
2 |
3 | namespace CShell.Framework.Controls
4 | {
5 | public class Menu : System.Windows.Controls.Menu
6 | {
7 | private object _currentItem;
8 |
9 | protected override bool IsItemItsOwnContainerOverride(object item)
10 | {
11 | _currentItem = item;
12 | return base.IsItemItsOwnContainerOverride(item);
13 | }
14 |
15 | protected override DependencyObject GetContainerForItemOverride()
16 | {
17 | return MenuItem.GetContainer(this, _currentItem);
18 | }
19 | }
20 | }
--------------------------------------------------------------------------------
/Src/CShell.Core/Framework/Controls/MenuItem.cs:
--------------------------------------------------------------------------------
1 | using System.Windows;
2 | using System.Windows.Controls;
3 | using CShell.Framework.Menus;
4 |
5 | namespace CShell.Framework.Controls
6 | {
7 | public class MenuItem : System.Windows.Controls.MenuItem
8 | {
9 | private object _currentItem;
10 |
11 | protected override bool IsItemItsOwnContainerOverride(object item)
12 | {
13 | _currentItem = item;
14 | return base.IsItemItsOwnContainerOverride(item);
15 | }
16 |
17 | protected override DependencyObject GetContainerForItemOverride()
18 | {
19 | return GetContainer(this, _currentItem);
20 | }
21 |
22 | internal static DependencyObject GetContainer(FrameworkElement frameworkElement, object item)
23 | {
24 | if (item is MenuItemSeparator)
25 | return new Separator { Style = (Style)frameworkElement.FindResource(SeparatorStyleKey) };
26 |
27 | string styleKey = (item is CheckableMenuItem) ? "CheckableMenuItem" : "MenuItem";
28 | return new MenuItem { Style = (Style)frameworkElement.FindResource(styleKey) };
29 | }
30 | }
31 | }
--------------------------------------------------------------------------------
/Src/CShell.Core/Framework/Controls/PanesStyleSelector.cs:
--------------------------------------------------------------------------------
1 | using System.Windows;
2 | using System.Windows.Controls;
3 |
4 | namespace CShell.Framework.Controls
5 | {
6 | public class PanesStyleSelector : StyleSelector
7 | {
8 | public Style ToolStyle
9 | {
10 | get;
11 | set;
12 | }
13 |
14 | public Style DocumentStyle
15 | {
16 | get;
17 | set;
18 | }
19 |
20 | public override Style SelectStyle(object item, DependencyObject container)
21 | {
22 | if (item is ITool)
23 | return ToolStyle;
24 |
25 | if (item is IDocument)
26 | return DocumentStyle;
27 |
28 | return base.SelectStyle(item, container);
29 | }
30 | }
31 | }
--------------------------------------------------------------------------------
/Src/CShell.Core/Framework/Controls/PanesTemplateSelector.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using System.Windows;
7 | using System.Windows.Controls;
8 |
9 | namespace CShell.Framework.Controls
10 | {
11 | public class PanesTemplateSelector : DataTemplateSelector
12 | {
13 | public DataTemplate ToolTemplate
14 | {
15 | get;
16 | set;
17 | }
18 |
19 | public DataTemplate DocumentTemplate
20 | {
21 | get;
22 | set;
23 | }
24 |
25 | public override DataTemplate SelectTemplate(object item, DependencyObject container)
26 | {
27 | if (item is ITool)
28 | return ToolTemplate;
29 |
30 | if (item is IDocument)
31 | return DocumentTemplate;
32 |
33 | return base.SelectTemplate(item, container);
34 | }
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/Src/CShell.Core/Framework/Controls/ToolBar.cs:
--------------------------------------------------------------------------------
1 | using System.Windows;
2 | using System.Windows.Controls;
3 | using CShell.Framework.Menus;
4 |
5 | namespace CShell.Framework.Controls
6 | {
7 | public class ToolBar : System.Windows.Controls.ToolBar
8 | {
9 | private object _currentItem;
10 |
11 | protected override bool IsItemItsOwnContainerOverride(object item)
12 | {
13 | _currentItem = item;
14 | return base.IsItemItsOwnContainerOverride(item);
15 | }
16 |
17 | protected override DependencyObject GetContainerForItemOverride()
18 | {
19 | if(_currentItem is MenuItemSeparator)
20 | return new Separator { Style = (Style)FindResource(SeparatorStyleKey) };
21 | return base.GetContainerForItemOverride();
22 | }
23 | }
24 | }
--------------------------------------------------------------------------------
/Src/CShell.Core/Framework/Converters/ActiveDocumentConverter.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Globalization;
3 | using System.Windows.Data;
4 |
5 | namespace CShell.Framework.Converters
6 | {
7 |
8 | public class ActiveDocumentConverter : IValueConverter
9 | {
10 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
11 | {
12 | if (value is IDocument)
13 | return value;
14 |
15 | return Binding.DoNothing;
16 | }
17 |
18 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
19 | {
20 | if (value is IDocument)
21 | return value;
22 |
23 | return Binding.DoNothing;
24 | }
25 | }
26 | }
--------------------------------------------------------------------------------
/Src/CShell.Core/Framework/Converters/UriConverter.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Globalization;
3 | using System.Windows.Data;
4 |
5 | namespace CShell.Framework.Converters
6 | {
7 | [ValueConversion(typeof(Uri), typeof(string))]
8 | public class UriConverter : IValueConverter
9 | {
10 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
11 | {
12 | var uri = value as Uri;
13 | if (uri != null)
14 | return uri.ToString();
15 | return "";
16 | }
17 |
18 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
19 | {
20 | var uriString = value as string;
21 | if (uriString != null)
22 | {
23 | Uri uri;
24 | if (Uri.TryCreate(uriString, UriKind.RelativeOrAbsolute, out uri))
25 | return uri;
26 | }
27 | return null;
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/Src/CShell.Core/Framework/Document.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Windows.Input;
3 |
4 | namespace CShell.Framework
5 | {
6 | public abstract class Document : LayoutItemBase, IDocument
7 | {
8 | private ICommand _closeCommand;
9 | public ICommand CloseCommand
10 | {
11 | get
12 | {
13 | return _closeCommand ?? (_closeCommand = new RelayCommand(p => TryClose(), p => true));
14 |
15 | //documents can be closed all the time, if dirty, a dialog will be presented to ask if close is allowed
16 | //{
17 | // bool canClose = false;
18 | // CanClose(r => canClose = r);
19 | // return canClose;
20 | //});
21 | }
22 | }
23 |
24 | public virtual Uri Uri { get; set; }
25 | public virtual bool IsDirty { get; set; }
26 |
27 | public virtual void Save()
28 | { }
29 | public virtual void SaveAs(string newFile)
30 | { }
31 | }
32 | }
--------------------------------------------------------------------------------
/Src/CShell.Core/Framework/IDocument.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Windows.Input;
3 | using Caliburn.Micro;
4 |
5 | namespace CShell.Framework
6 | {
7 | public interface IDocument : IScreen
8 | {
9 | ICommand CloseCommand { get; }
10 |
11 | Uri Uri { get; }
12 |
13 | bool IsDirty { get; }
14 | void Save();
15 | void SaveAs(string newFile);
16 | }
17 | }
--------------------------------------------------------------------------------
/Src/CShell.Core/Framework/IModule.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.ComponentModel.Composition.Hosting;
3 | using System.Reflection;
4 | using ScriptCs.Contracts;
5 |
6 | namespace CShell.Framework
7 | {
8 | public interface IModule : System.IDisposable
9 | {
10 | int Order { get; }
11 |
12 | void Configure();
13 | void Start();
14 | }
15 | }
--------------------------------------------------------------------------------
/Src/CShell.Core/Framework/ISink.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Windows.Input;
6 | using CShell.Framework.Services;
7 | using Caliburn.Micro;
8 |
9 | namespace CShell.Framework
10 | {
11 | public interface ISink : IDocument
12 | {
13 | PaneLocation PreferredLocation { get; }
14 | bool IsVisible { get; set; }
15 |
16 | void Dump(object o);
17 | void Clear();
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/Src/CShell.Core/Framework/ITextDocument.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace CShell.Framework
7 | {
8 | public interface ITextDocument : IDocument
9 | {
10 | void Undo();
11 | void Redo();
12 | void Cut();
13 | void Copy();
14 | void Paste();
15 | void SelectAll();
16 |
17 | ///
18 | /// Selects a section in the text.
19 | ///
20 | /// The start index of the selection.
21 | /// The length of the selection.
22 | void Select(int start, int length);
23 |
24 | void Comment();
25 | void Uncomment();
26 |
27 | void Append(string text);
28 | void Prepend(string text);
29 |
30 | string Text { get; set; }
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/Src/CShell.Core/Framework/ITool.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Windows.Input;
3 | using CShell.Framework.Services;
4 | using Caliburn.Micro;
5 |
6 | namespace CShell.Framework
7 | {
8 | public interface ITool : IScreen
9 | {
10 | Uri Uri { get; }
11 | ICommand CloseCommand { get; }
12 | PaneLocation PreferredLocation { get; }
13 | bool IsVisible { get; set; }
14 | }
15 | }
--------------------------------------------------------------------------------
/Src/CShell.Core/Framework/LayoutItemBase.cs:
--------------------------------------------------------------------------------
1 | using Caliburn.Micro;
2 |
3 | namespace CShell.Framework
4 | {
5 | public abstract class LayoutItemBase : Screen
6 | {
7 |
8 | }
9 | }
--------------------------------------------------------------------------------
/Src/CShell.Core/Framework/Menus/CheckableMenuItem.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using Caliburn.Micro;
4 |
5 | namespace CShell.Framework.Menus
6 | {
7 | public class CheckableMenuItem : StandardMenuItem
8 | {
9 | private readonly Func> _execute;
10 |
11 | private bool _isChecked;
12 | public bool IsChecked
13 | {
14 | get { return _isChecked; }
15 | set { _isChecked = value; NotifyOfPropertyChange(() => IsChecked); }
16 | }
17 |
18 | #region Constructors
19 |
20 | public CheckableMenuItem(string text)
21 | : base(text)
22 | {
23 |
24 | }
25 |
26 | public CheckableMenuItem(string text, Func> execute)
27 | : base(text)
28 | {
29 | _execute = execute;
30 | }
31 |
32 | public CheckableMenuItem(string text, Func> execute, Func canExecute)
33 | : base(text, canExecute)
34 | {
35 | _execute = execute;
36 | }
37 |
38 | #endregion
39 |
40 | public IEnumerable Execute()
41 | {
42 | return _execute != null ? _execute(IsChecked) : new IResult[] { };
43 | }
44 | }
45 | }
--------------------------------------------------------------------------------
/Src/CShell.Core/Framework/Menus/IMenu.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using Caliburn.Micro;
3 |
4 | namespace CShell.Framework.Menus
5 | {
6 | public interface IMenu : IObservableCollection
7 | {
8 | IEnumerable All { get; }
9 | }
10 | }
--------------------------------------------------------------------------------
/Src/CShell.Core/Framework/Menus/IToolBar.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using Caliburn.Micro;
3 |
4 | namespace CShell.Framework.Menus
5 | {
6 | public interface IToolBar : IObservableCollection
7 | {
8 | void Add(params MenuItemBase[] menuItems);
9 | }
10 | }
--------------------------------------------------------------------------------
/Src/CShell.Core/Framework/Menus/MenuItem.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using Caliburn.Micro;
4 |
5 | namespace CShell.Framework.Menus
6 | {
7 | public class MenuItem : StandardMenuItem
8 | {
9 | private readonly Func> _execute;
10 |
11 | #region Constructors
12 |
13 | public MenuItem(string text)
14 | : base(text)
15 | {
16 |
17 | }
18 |
19 | public MenuItem(string text, Func> execute)
20 | : base(text)
21 | {
22 | _execute = execute;
23 | }
24 |
25 | public MenuItem(string text, Func> execute, Func canExecute)
26 | : base(text, canExecute)
27 | {
28 | _execute = execute;
29 | }
30 |
31 | #endregion
32 |
33 | public IEnumerable Execute()
34 | {
35 | return _execute != null ? _execute() : new IResult[] { };
36 | }
37 | }
38 | }
--------------------------------------------------------------------------------
/Src/CShell.Core/Framework/Menus/MenuItemBase.cs:
--------------------------------------------------------------------------------
1 | using System.Collections;
2 | using System.Collections.Generic;
3 | using Caliburn.Micro;
4 |
5 | namespace CShell.Framework.Menus
6 | {
7 | public class MenuItemBase : PropertyChangedBase, IEnumerable
8 | {
9 | #region Static stuff
10 |
11 | public static MenuItemBase Separator
12 | {
13 | get { return new MenuItemSeparator(); }
14 | }
15 |
16 | #endregion
17 |
18 | #region Properties
19 |
20 | public IObservableCollection Children { get; private set; }
21 |
22 | public virtual string Name
23 | {
24 | get { return "-"; }
25 | }
26 |
27 | #endregion
28 |
29 | #region Constructors
30 |
31 | protected MenuItemBase()
32 | {
33 | Children = new BindableCollection();
34 | }
35 |
36 | #endregion
37 |
38 | public void Add(params MenuItemBase[] menuItems)
39 | {
40 | menuItems.Apply(Children.Add);
41 | }
42 |
43 | public IEnumerator GetEnumerator()
44 | {
45 | return Children.GetEnumerator();
46 | }
47 |
48 | IEnumerator IEnumerable.GetEnumerator()
49 | {
50 | return GetEnumerator();
51 | }
52 | }
53 | }
--------------------------------------------------------------------------------
/Src/CShell.Core/Framework/Menus/MenuItemSeparator.cs:
--------------------------------------------------------------------------------
1 | namespace CShell.Framework.Menus
2 | {
3 | public class MenuItemSeparator : MenuItemBase
4 | {
5 |
6 | }
7 | }
--------------------------------------------------------------------------------
/Src/CShell.Core/Framework/Menus/MenuModel.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using Caliburn.Micro;
3 |
4 | namespace CShell.Framework.Menus
5 | {
6 | public class MenuModel : BindableCollection, IMenu
7 | {
8 | public IEnumerable All
9 | {
10 | get
11 | {
12 | var queue = new Queue(this);
13 | while (queue.Count > 0)
14 | {
15 | var current = queue.Dequeue();
16 | foreach (var item in current)
17 | queue.Enqueue(item);
18 | yield return current;
19 | }
20 | }
21 | }
22 |
23 | public void Add(params MenuItemBase[] items)
24 | {
25 | items.Apply(Add);
26 | }
27 | }
28 | }
--------------------------------------------------------------------------------
/Src/CShell.Core/Framework/Menus/ToolBarModel.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using Caliburn.Micro;
3 |
4 | namespace CShell.Framework.Menus
5 | {
6 | public class ToolBarModel : BindableCollection, IToolBar
7 | {
8 | public void Add(params MenuItemBase[] items)
9 | {
10 | items.Apply(Add);
11 | }
12 | }
13 | }
--------------------------------------------------------------------------------
/Src/CShell.Core/Framework/ModuleBase.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.ComponentModel.Composition;
3 | using System.ComponentModel.Composition.Hosting;
4 | using System.Reflection;
5 | using CShell.Framework.Menus;
6 | using CShell.Framework.Services;
7 |
8 | namespace CShell.Framework
9 | {
10 | public abstract class ModuleBase : IModule
11 | {
12 | [Import]
13 | private IShell _shell;
14 |
15 | protected IShell Shell
16 | {
17 | get { return _shell; }
18 | }
19 |
20 | protected IMenu MainMenu
21 | {
22 | get { return _shell.MainMenu; }
23 | }
24 |
25 | protected IToolBar ToolBar
26 | {
27 | get { return _shell.ToolBar; }
28 | }
29 |
30 | public int Order { get; set; }
31 |
32 | public virtual void Configure()
33 | {}
34 |
35 | public abstract void Start();
36 |
37 | public void Dispose()
38 | {
39 | Dispose(true);
40 | }
41 |
42 | protected virtual void Dispose(bool disposing)
43 | {}
44 |
45 | }
46 | }
--------------------------------------------------------------------------------
/Src/CShell.Core/Framework/RelayCommand.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Diagnostics;
3 | using System.Windows.Input;
4 |
5 | namespace CShell.Framework
6 | {
7 | ///
8 | /// Used where Caliburn.Micro needs to be interfaced to ICommand.
9 | ///
10 | public class RelayCommand : ICommand
11 | {
12 | #region Fields
13 |
14 | private readonly Action