Skip to content

Commit

Permalink
First Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
WorkingRobot committed Apr 29, 2019
1 parent d8f7067 commit b24b13a
Show file tree
Hide file tree
Showing 40 changed files with 3,230 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{10A9ECD3-AE1E-494D-9A27-8A32DD581759}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>AurelienRibon.Ui.SyntaxHighlightBox</RootNamespace>
<AssemblyName>AurelienRibon.Ui.SyntaxHighlightBox</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xaml" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="WindowsBase" />
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="src\SyntaxHighlightBox.xaml.cs">
<DependentUpon>SyntaxHighlightBox.xaml</DependentUpon>
</Compile>
<Compile Include="src\DrawingControl.cs" />
<Compile Include="src\HighlighterManager.cs" />
<Compile Include="src\IHighlighter.cs" />
<Compile Include="src\TextUtilities.cs" />
</ItemGroup>
<ItemGroup>
<Page Include="src\SyntaxHighlightBox.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
</ItemGroup>
<ItemGroup>
<Resource Include="resources\JSON.xml">
<SubType>Designer</SubType>
</Resource>
</ItemGroup>
<ItemGroup>
<Resource Include="resources\syntax.xsd" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
53 changes: 53 additions & 0 deletions AurelienRibon.Ui.SyntaxHighlightBox/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
using System.Reflection;
using System.Runtime.InteropServices;
using System.Windows;

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Silver")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Silver")]
[assembly: AssemblyCopyright("Copyright © WorkingRobot 2019")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]

//In order to begin building localizable applications, set
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
//inside a <PropertyGroup>. For example, if you are using US english
//in your source files, set the <UICulture> to en-US. Then uncomment
//the NeutralResourceLanguage attribute below. Update the "en-US" in
//the line below to match the UICulture setting in the project file.

//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]


[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]


// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
27 changes: 27 additions & 0 deletions AurelienRibon.Ui.SyntaxHighlightBox/resources/JSON.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8" ?>

<Syntax name="JSON">
<AdvancedHighlightRule name="Brackets">
<Expression>[{}\[\],:]</Expression>
<IgnoreCase>false</IgnoreCase>
<Foreground>#0080FF</Foreground>
<FontWeight>Bold</FontWeight>
<FontStyle>Normal</FontStyle>
</AdvancedHighlightRule>

<AdvancedHighlightRule name="Numbers">
<Expression>\d+(?:\.\d+)?</Expression>
<IgnoreCase>false</IgnoreCase>
<Foreground>#307F80</Foreground>
<FontWeight>Normal</FontWeight>
<FontStyle>Normal</FontStyle>
</AdvancedHighlightRule>

<AdvancedHighlightRule name="Strings">
<Expression>\"(?:\\.|[^"\\])*\"</Expression>
<IgnoreCase>false</IgnoreCase>
<Foreground>#F68A1B</Foreground>
<FontWeight>Normal</FontWeight>
<FontStyle>Normal</FontStyle>
</AdvancedHighlightRule>
</Syntax>
52 changes: 52 additions & 0 deletions AurelienRibon.Ui.SyntaxHighlightBox/resources/syntax.xsd
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
<xs:element name="Syntax">
<xs:complexType>
<xs:sequence>
<xs:element ref="HighlightWordsRule" minOccurs="0" maxOccurs="unbounded"/>
<xs:element ref="HighlightLineRule" minOccurs="0" maxOccurs="unbounded"/>
<xs:element ref="AdvancedHighlightRule" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
<xs:attribute name="name" use="required" type="xs:string"/>
</xs:complexType>
</xs:element>

<xs:element name="HighlightWordsRule">
<xs:complexType>
<xs:sequence>
<xs:element name="Words" type="xs:string"/>
<xs:group ref="options"/>
</xs:sequence>
<xs:attribute name="name" use="required" type="xs:string"/>
</xs:complexType>
</xs:element>

<xs:element name="HighlightLineRule">
<xs:complexType>
<xs:sequence>
<xs:element name="LineStart" type="xs:string"/>
<xs:group ref="options"/>
</xs:sequence>
<xs:attribute name="name" use="required" type="xs:string"/>
</xs:complexType>
</xs:element>

<xs:element name="AdvancedHighlightRule">
<xs:complexType>
<xs:sequence>
<xs:element name="Expression" type="xs:string"/>
<xs:group ref="options"/>
</xs:sequence>
<xs:attribute name="name" use="required" type="xs:string"/>
</xs:complexType>
</xs:element>

<xs:group name="options">
<xs:sequence>
<xs:element minOccurs="1" maxOccurs="1" name="IgnoreCase" type="xs:boolean"/>
<xs:element minOccurs="1" maxOccurs="1" name="Foreground" type="xs:string" />
<xs:element minOccurs="1" maxOccurs="1" name="FontWeight" type="xs:string" />
<xs:element minOccurs="1" maxOccurs="1" name="FontStyle" type="xs:string" />
</xs:sequence>
</xs:group>
</xs:schema>
33 changes: 33 additions & 0 deletions AurelienRibon.Ui.SyntaxHighlightBox/src/DrawingControl.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Media;

namespace AurelienRibon.Ui.SyntaxHighlightBox {
public class DrawingControl : FrameworkElement {
private VisualCollection visuals;
private DrawingVisual visual;

public DrawingControl() {
visual = new DrawingVisual();
visuals = new VisualCollection(this);
visuals.Add(visual);
}

public DrawingContext GetContext() {
return visual.RenderOpen();
}

protected override int VisualChildrenCount {
get { return visuals.Count; }
}

protected override Visual GetVisualChild(int index) {
if (index < 0 || index >= visuals.Count)
throw new ArgumentOutOfRangeException();
return visuals[index];
}
}
}
Loading

0 comments on commit b24b13a

Please sign in to comment.