diff --git a/.gitignore b/.gitignore index cdd6d4f..48cc008 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,454 @@ -obj/ -bin/ - +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. +## +## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore + +# User-specific files +*.rsuser +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Mono auto generated files +mono_crash.* + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +[Ww][Ii][Nn]32/ +[Aa][Rr][Mm]/ +[Aa][Rr][Mm]64/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ +[Ll]ogs/ + +# Visual Studio 2015/2017 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# Visual Studio 2017 auto generated files +Generated\ Files/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUnit +*.VisualState.xml +TestResult.xml +nunit-*.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# Benchmark Results +BenchmarkDotNet.Artifacts/ + +# .NET Core +project.lock.json +project.fragment.lock.json +artifacts/ + +# Tye +.tye/ + +# ASP.NET Scaffolding +ScaffoldingReadMe.txt + +# StyleCop +StyleCopReport.xml + +# Files built by Visual Studio +*_i.c +*_p.c +*_h.h +*.ilk +*.meta +*.obj +*.iobj +*.pch +*.pdb +*.ipdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*_wpftmp.csproj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# Visual Studio Trace Files +*.e2e + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# AxoCover is a Code Coverage Tool +.axoCover/* +!.axoCover/settings.json + +# Coverlet is a free, cross platform Code Coverage Tool +coverage*.json +coverage*.xml +coverage*.info + +# Visual Studio code coverage results +*.coverage +*.coveragexml + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# Note: Comment the next line if you want to checkin your web deploy settings, +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# NuGet Symbol Packages +*.snupkg +# The packages folder can be ignored because of Package Restore +**/[Pp]ackages/* +# except build/, which is used as an MSBuild target. +!**/[Pp]ackages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/[Pp]ackages/repositories.config +# NuGet v3's project.json files produces more ignorable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt +*.appx +*.appxbundle +*.appxupload + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!?*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.jfm +*.pfx +*.publishsettings +orleans.codegen.cs + +# Including strong name files can present a security risk +# (https://github.com/github/gitignore/pull/2483#issue-259490424) +#*.snk + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm +ServiceFabricBackup/ +*.rptproj.bak + +# SQL Server files +*.mdf +*.ldf +*.ndf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings +*.rptproj.rsuser +*- [Bb]ackup.rdl +*- [Bb]ackup ([0-9]).rdl +*- [Bb]ackup ([0-9][0-9]).rdl + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat +node_modules/ + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) +*.vbw + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# CodeRush personal settings +.cr/personal + +# Python Tools for Visual Studio (PTVS) +__pycache__/ +*.pyc + +# Cake - Uncomment if you are using it +# tools/** +# !tools/packages.config + +# Tabs Studio +*.tss + +# Telerik's JustMock configuration file +*.jmconfig + +# BizTalk build output +*.btp.cs +*.btm.cs +*.odx.cs +*.xsd.cs + +# OpenCover UI analysis results +OpenCover/ + +# Azure Stream Analytics local run output +ASALocalRun/ + +# MSBuild Binary and Structured Log +*.binlog + +# NVidia Nsight GPU debugger configuration file +*.nvuser + +# MFractors (Xamarin productivity tool) working folder +.mfractor/ + +# Local History for Visual Studio +.localhistory/ + +# BeatPulse healthcheck temp database +healthchecksdb + +# Backup folder for Package Reference Convert tool in Visual Studio 2017 +MigrationBackup/ + +# Ionide (cross platform F# VS Code tools) working folder +.ionide/ + +# Fody - auto-generated XML schema +FodyWeavers.xsd + +## +## Visual studio for Mac +## + + +# globs +Makefile.in +*.userprefs +*.usertasks +config.make +config.status +aclocal.m4 +install-sh +autom4te.cache/ +*.tar.gz +tarballs/ +test-results/ + +# Mac bundle stuff +*.dmg +*.app + +# content below from: https://github.com/github/gitignore/blob/master/Global/macOS.gitignore +# General +.DS_Store +.AppleDouble +.LSOverride + +# Icon must end with two \r +Icon + + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + +# content below from: https://github.com/github/gitignore/blob/master/Global/Windows.gitignore +# Windows thumbnail cache files +Thumbs.db +ehthumbs.db +ehthumbs_vista.db + +# Dump file +*.stackdump + +# Folder config file +[Dd]esktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Windows Installer files +*.cab +*.msi +*.msix +*.msm +*.msp + +# Windows shortcuts +*.lnk + +# JetBrains Rider +.idea/ +*.sln.iml + +## +## Visual Studio Code +## +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json diff --git a/.vscode/launch.json b/.vscode/launch.json index 8b563a7..898c499 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -9,7 +9,7 @@ "type": "coreclr", "request": "launch", "preLaunchTask": "build", - "program": "${workspaceFolder}/samples/red/bin/Debug/net6.0/red.dll", + "program": "${workspaceFolder}/samples/red/bin/Debug/net7.0/red.dll", "args": [], "cwd": "${workspaceFolder}/samples/red/", "stopAtEntry": false, diff --git a/Directory.Build.props b/Directory.Build.props new file mode 100644 index 0000000..f39656c --- /dev/null +++ b/Directory.Build.props @@ -0,0 +1,6 @@ + + + enable + 11.0.6 + + diff --git a/irules.core/Clause.cs b/irules.core/Clause.cs index 6045299..4b3984a 100644 --- a/irules.core/Clause.cs +++ b/irules.core/Clause.cs @@ -13,7 +13,6 @@ namespace irules.core [Language("IRule", "0.1", "Clauses grammar.")] public class ClauseGrammar : Grammar { - private readonly IdOptions idoptions; public ClauseGrammar() { @@ -26,21 +25,21 @@ namespace irules.core NonTerminal idOrRelation = new NonTerminal("idOrRelation"); NonTerminal SOrOr = new NonTerminal("SOrOr"); IdentifierTerminal id = new IdentifierTerminal("Id"); - + var orExpr = new NonTerminal("OrExpr", typeof(BinaryOperationNode)); var andExpr = new NonTerminal("AndExpr", typeof(BinaryOperationNode)); var neg = new NonTerminal("Negation", typeof(UnaryOperationNode)) { Rule = "^" + singleByOr + ReduceHere() }; - expr.Rule = "(" + expr + ")" | SOrOr ; + expr.Rule = ("(" + expr + ")") | SOrOr; SOrOr.Rule = orExpr | singleByOr; orExpr.Rule = expr + "|" + expr; singleByOr.Rule = andExpr | singleByAnd; andExpr.Rule = expr + "&" + expr; singleByAnd.Rule = neg | idOrRelation; - idOrRelation.Rule = id | id + "(" + idList + ")"; - idList.Rule = id | idList + "," + id; + idOrRelation.Rule = id | (id + "(" + idList + ")"); + idList.Rule = id | (idList + "," + id); RegisterBracePair("(", ")"); RegisterOperators(30, "&|^"); Root = expr; diff --git a/irules.core/ClauseChecker.cs b/irules.core/ClauseChecker.cs index ade7541..28f3532 100644 --- a/irules.core/ClauseChecker.cs +++ b/irules.core/ClauseChecker.cs @@ -35,7 +35,7 @@ namespace irules.core } catch (ScriptException ex) { - // TODO display App Status + throw; } return app.Status; } diff --git a/irules.core/irules.core.csproj b/irules.core/irules.core.csproj index a1aace3..534e51c 100644 --- a/irules.core/irules.core.csproj +++ b/irules.core/irules.core.csproj @@ -1,8 +1,10 @@  - net472 + netstandard2.0;net6.0;net7.0;net8.0;net472 true + latest + diff --git a/irules.sln b/irules.sln index 0e524c4..10e50d3 100644 --- a/irules.sln +++ b/irules.sln @@ -9,14 +9,22 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "irulesc", "irulesc\irulesc. EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "samples", "samples", "{6AF0DBF4-41B6-4BA3-84CF-91A17A6DB031}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "red", "samples\red\red.csproj", "{BFF7C4CD-F466-44E2-A8B6-2839A9FCFB88}" -EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{7037AD79-D459-48AA-B72E-1999A40E6640}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{C3EE7DFC-6829-4E2C-89D6-3F1C8234BE28}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "test.core", "test\test.core\test.core.csproj", "{DA1C56EF-A0F8-4541-B21A-C489CF51A337}" EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "avrules", "avrules", "{7CCA11F9-6B99-44DF-80C4-D2BEB4B9AFD9}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "avrules", "samples\avrules\avrules\avrules.csproj", "{975E9D1A-5C3B-4AA7-B3DC-882C4309C376}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "avrules.Android", "samples\avrules\avrules.Android\avrules.Android.csproj", "{CF00FCD3-3E86-480F-B269-1C5E4C37C591}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "avrules.Browser", "samples\avrules\avrules.Browser\avrules.Browser.csproj", "{473DF2D1-45FA-4D34-B303-425C877DEF0D}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "avrules.Desktop", "samples\avrules\avrules.Desktop\avrules.Desktop.csproj", "{12B1C696-9C12-4BF5-BBEF-E8DA1A505B7D}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -34,19 +42,35 @@ Global {8F0F62E0-1F51-42E2-A50B-D55F70078695}.Debug|Any CPU.Build.0 = Debug|Any CPU {8F0F62E0-1F51-42E2-A50B-D55F70078695}.Release|Any CPU.ActiveCfg = Release|Any CPU {8F0F62E0-1F51-42E2-A50B-D55F70078695}.Release|Any CPU.Build.0 = Release|Any CPU - {BFF7C4CD-F466-44E2-A8B6-2839A9FCFB88}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {BFF7C4CD-F466-44E2-A8B6-2839A9FCFB88}.Debug|Any CPU.Build.0 = Debug|Any CPU - {BFF7C4CD-F466-44E2-A8B6-2839A9FCFB88}.Release|Any CPU.ActiveCfg = Release|Any CPU - {BFF7C4CD-F466-44E2-A8B6-2839A9FCFB88}.Release|Any CPU.Build.0 = Release|Any CPU {DA1C56EF-A0F8-4541-B21A-C489CF51A337}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {DA1C56EF-A0F8-4541-B21A-C489CF51A337}.Debug|Any CPU.Build.0 = Debug|Any CPU {DA1C56EF-A0F8-4541-B21A-C489CF51A337}.Release|Any CPU.ActiveCfg = Release|Any CPU {DA1C56EF-A0F8-4541-B21A-C489CF51A337}.Release|Any CPU.Build.0 = Release|Any CPU + {975E9D1A-5C3B-4AA7-B3DC-882C4309C376}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {975E9D1A-5C3B-4AA7-B3DC-882C4309C376}.Debug|Any CPU.Build.0 = Debug|Any CPU + {975E9D1A-5C3B-4AA7-B3DC-882C4309C376}.Release|Any CPU.ActiveCfg = Release|Any CPU + {975E9D1A-5C3B-4AA7-B3DC-882C4309C376}.Release|Any CPU.Build.0 = Release|Any CPU + {CF00FCD3-3E86-480F-B269-1C5E4C37C591}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {CF00FCD3-3E86-480F-B269-1C5E4C37C591}.Debug|Any CPU.Build.0 = Debug|Any CPU + {CF00FCD3-3E86-480F-B269-1C5E4C37C591}.Release|Any CPU.ActiveCfg = Release|Any CPU + {CF00FCD3-3E86-480F-B269-1C5E4C37C591}.Release|Any CPU.Build.0 = Release|Any CPU + {473DF2D1-45FA-4D34-B303-425C877DEF0D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {473DF2D1-45FA-4D34-B303-425C877DEF0D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {473DF2D1-45FA-4D34-B303-425C877DEF0D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {473DF2D1-45FA-4D34-B303-425C877DEF0D}.Release|Any CPU.Build.0 = Release|Any CPU + {12B1C696-9C12-4BF5-BBEF-E8DA1A505B7D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {12B1C696-9C12-4BF5-BBEF-E8DA1A505B7D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {12B1C696-9C12-4BF5-BBEF-E8DA1A505B7D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {12B1C696-9C12-4BF5-BBEF-E8DA1A505B7D}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(NestedProjects) = preSolution {8F0F62E0-1F51-42E2-A50B-D55F70078695} = {7037AD79-D459-48AA-B72E-1999A40E6640} {3EABC2ED-5C8A-47CD-B161-56F04EF06C4A} = {7037AD79-D459-48AA-B72E-1999A40E6640} - {BFF7C4CD-F466-44E2-A8B6-2839A9FCFB88} = {6AF0DBF4-41B6-4BA3-84CF-91A17A6DB031} {DA1C56EF-A0F8-4541-B21A-C489CF51A337} = {C3EE7DFC-6829-4E2C-89D6-3F1C8234BE28} + {7CCA11F9-6B99-44DF-80C4-D2BEB4B9AFD9} = {6AF0DBF4-41B6-4BA3-84CF-91A17A6DB031} + {975E9D1A-5C3B-4AA7-B3DC-882C4309C376} = {7CCA11F9-6B99-44DF-80C4-D2BEB4B9AFD9} + {CF00FCD3-3E86-480F-B269-1C5E4C37C591} = {7CCA11F9-6B99-44DF-80C4-D2BEB4B9AFD9} + {473DF2D1-45FA-4D34-B303-425C877DEF0D} = {7CCA11F9-6B99-44DF-80C4-D2BEB4B9AFD9} + {12B1C696-9C12-4BF5-BBEF-E8DA1A505B7D} = {7CCA11F9-6B99-44DF-80C4-D2BEB4B9AFD9} EndGlobalSection EndGlobal diff --git a/irulesc/irulesc.csproj b/irulesc/irulesc.csproj index 7d1421e..1fa1c66 100644 --- a/irulesc/irulesc.csproj +++ b/irulesc/irulesc.csproj @@ -2,7 +2,7 @@ Exe - net7.0 + net8.0 enable enable diff --git a/samples/red/.gitignore b/samples/avrules/.gitignore similarity index 79% rename from samples/red/.gitignore rename to samples/avrules/.gitignore index c6ef85f..48cc008 100644 --- a/samples/red/.gitignore +++ b/samples/avrules/.gitignore @@ -1,403 +1,454 @@ -## Ignore Visual Studio temporary files, build results, and -## files generated by popular Visual Studio add-ons. -## -## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore - -# User-specific files -*.rsuser -*.suo -*.user -*.userosscache -*.sln.docstates - -# User-specific files (MonoDevelop/Xamarin Studio) -*.userprefs - -# Mono auto generated files -mono_crash.* - -# Build results -[Dd]ebug/ -[Dd]ebugPublic/ -[Rr]elease/ -[Rr]eleases/ -x64/ -x86/ -[Ww][Ii][Nn]32/ -[Aa][Rr][Mm]/ -[Aa][Rr][Mm]64/ -bld/ -[Bb]in/ -[Oo]bj/ -[Ll]og/ -[Ll]ogs/ - -# Visual Studio 2015/2017 cache/options directory -.vs/ -# Uncomment if you have tasks that create the project's static files in wwwroot -#wwwroot/ - -# Visual Studio 2017 auto generated files -Generated\ Files/ - -# MSTest test Results -[Tt]est[Rr]esult*/ -[Bb]uild[Ll]og.* - -# NUnit -*.VisualState.xml -TestResult.xml -nunit-*.xml - -# Build Results of an ATL Project -[Dd]ebugPS/ -[Rr]eleasePS/ -dlldata.c - -# Benchmark Results -BenchmarkDotNet.Artifacts/ - -# .NET Core -project.lock.json -project.fragment.lock.json -artifacts/ - -# ASP.NET Scaffolding -ScaffoldingReadMe.txt - -# StyleCop -StyleCopReport.xml - -# Files built by Visual Studio -*_i.c -*_p.c -*_h.h -*.ilk -*.meta -*.obj -*.iobj -*.pch -*.pdb -*.ipdb -*.pgc -*.pgd -*.rsp -*.sbr -*.tlb -*.tli -*.tlh -*.tmp -*.tmp_proj -*_wpftmp.csproj -*.log -*.tlog -*.vspscc -*.vssscc -.builds -*.pidb -*.svclog -*.scc - -# Chutzpah Test files -_Chutzpah* - -# Visual C++ cache files -ipch/ -*.aps -*.ncb -*.opendb -*.opensdf -*.sdf -*.cachefile -*.VC.db -*.VC.VC.opendb - -# Visual Studio profiler -*.psess -*.vsp -*.vspx -*.sap - -# Visual Studio Trace Files -*.e2e - -# TFS 2012 Local Workspace -$tf/ - -# Guidance Automation Toolkit -*.gpState - -# ReSharper is a .NET coding add-in -_ReSharper*/ -*.[Rr]e[Ss]harper -*.DotSettings.user - -# TeamCity is a build add-in -_TeamCity* - -# DotCover is a Code Coverage Tool -*.dotCover - -# AxoCover is a Code Coverage Tool -.axoCover/* -!.axoCover/settings.json - -# Coverlet is a free, cross platform Code Coverage Tool -coverage*.json -coverage*.xml -coverage*.info - -# Visual Studio code coverage results -*.coverage -*.coveragexml - -# NCrunch -_NCrunch_* -.*crunch*.local.xml -nCrunchTemp_* - -# MightyMoose -*.mm.* -AutoTest.Net/ - -# Web workbench (sass) -.sass-cache/ - -# Installshield output folder -[Ee]xpress/ - -# DocProject is a documentation generator add-in -DocProject/buildhelp/ -DocProject/Help/*.HxT -DocProject/Help/*.HxC -DocProject/Help/*.hhc -DocProject/Help/*.hhk -DocProject/Help/*.hhp -DocProject/Help/Html2 -DocProject/Help/html - -# Click-Once directory -publish/ - -# Publish Web Output -*.[Pp]ublish.xml -*.azurePubxml -# Note: Comment the next line if you want to checkin your web deploy settings, -# but database connection strings (with potential passwords) will be unencrypted -*.pubxml -*.publishproj - -# Microsoft Azure Web App publish settings. Comment the next line if you want to -# checkin your Azure Web App publish settings, but sensitive information contained -# in these scripts will be unencrypted -PublishScripts/ - -# NuGet Packages -*.nupkg -# NuGet Symbol Packages -*.snupkg -# The packages folder can be ignored because of Package Restore -**/[Pp]ackages/* -# except build/, which is used as an MSBuild target. -!**/[Pp]ackages/build/ -# Uncomment if necessary however generally it will be regenerated when needed -#!**/[Pp]ackages/repositories.config -# NuGet v3's project.json files produces more ignorable files -*.nuget.props -*.nuget.targets - -# Microsoft Azure Build Output -csx/ -*.build.csdef - -# Microsoft Azure Emulator -ecf/ -rcf/ - -# Windows Store app package directories and files -AppPackages/ -BundleArtifacts/ -Package.StoreAssociation.xml -_pkginfo.txt -*.appx -*.appxbundle -*.appxupload - -# Visual Studio cache files -# files ending in .cache can be ignored -*.[Cc]ache -# but keep track of directories ending in .cache -!?*.[Cc]ache/ - -# Others -ClientBin/ -~$* -*~ -*.dbmdl -*.dbproj.schemaview -*.jfm -*.pfx -*.publishsettings -orleans.codegen.cs - -# Including strong name files can present a security risk -# (https://github.com/github/gitignore/pull/2483#issue-259490424) -#*.snk - -# Since there are multiple workflows, uncomment next line to ignore bower_components -# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) -#bower_components/ - -# RIA/Silverlight projects -Generated_Code/ - -# Backup & report files from converting an old project file -# to a newer Visual Studio version. Backup files are not needed, -# because we have git ;-) -_UpgradeReport_Files/ -Backup*/ -UpgradeLog*.XML -UpgradeLog*.htm -ServiceFabricBackup/ -*.rptproj.bak - -# SQL Server files -*.mdf -*.ldf -*.ndf - -# Business Intelligence projects -*.rdl.data -*.bim.layout -*.bim_*.settings -*.rptproj.rsuser -*- [Bb]ackup.rdl -*- [Bb]ackup ([0-9]).rdl -*- [Bb]ackup ([0-9][0-9]).rdl - -# Microsoft Fakes -FakesAssemblies/ - -# GhostDoc plugin setting file -*.GhostDoc.xml - -# Node.js Tools for Visual Studio -.ntvs_analysis.dat -node_modules/ - -# Visual Studio 6 build log -*.plg - -# Visual Studio 6 workspace options file -*.opt - -# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) -*.vbw - -# Visual Studio 6 auto-generated project file (contains which files were open etc.) -*.vbp - -# Visual Studio 6 workspace and project file (working project files containing files to include in project) -*.dsw -*.dsp - -# Visual Studio 6 technical files -*.ncb -*.aps - -# Visual Studio LightSwitch build output -**/*.HTMLClient/GeneratedArtifacts -**/*.DesktopClient/GeneratedArtifacts -**/*.DesktopClient/ModelManifest.xml -**/*.Server/GeneratedArtifacts -**/*.Server/ModelManifest.xml -_Pvt_Extensions - -# Paket dependency manager -.paket/paket.exe -paket-files/ - -# FAKE - F# Make -.fake/ - -# CodeRush personal settings -.cr/personal - -# Python Tools for Visual Studio (PTVS) -__pycache__/ -*.pyc - -# Cake - Uncomment if you are using it -# tools/** -# !tools/packages.config - -# Tabs Studio -*.tss - -# Telerik's JustMock configuration file -*.jmconfig - -# BizTalk build output -*.btp.cs -*.btm.cs -*.odx.cs -*.xsd.cs - -# OpenCover UI analysis results -OpenCover/ - -# Azure Stream Analytics local run output -ASALocalRun/ - -# MSBuild Binary and Structured Log -*.binlog - -# NVidia Nsight GPU debugger configuration file -*.nvuser - -# MFractors (Xamarin productivity tool) working folder -.mfractor/ - -# Local History for Visual Studio -.localhistory/ - -# Visual Studio History (VSHistory) files -.vshistory/ - -# BeatPulse healthcheck temp database -healthchecksdb - -# Backup folder for Package Reference Convert tool in Visual Studio 2017 -MigrationBackup/ - -# Ionide (cross platform F# VS Code tools) working folder -.ionide/ - -# Fody - auto-generated XML schema -FodyWeavers.xsd - -# VS Code files for those working on multiple tools -.vscode/* -!.vscode/settings.json -!.vscode/tasks.json -!.vscode/launch.json -!.vscode/extensions.json -*.code-workspace - -# Local History for Visual Studio Code -.history/ - -# Windows Installer files from build outputs -*.cab -*.msi -*.msix -*.msm -*.msp - -# JetBrains Rider -*.sln.iml - -# Single Target Config -solution-config.props -# Windows Publish Profiles -!**/*.Windows/Properties/PublishProfiles/*.pubxml \ No newline at end of file +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. +## +## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore + +# User-specific files +*.rsuser +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Mono auto generated files +mono_crash.* + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +[Ww][Ii][Nn]32/ +[Aa][Rr][Mm]/ +[Aa][Rr][Mm]64/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ +[Ll]ogs/ + +# Visual Studio 2015/2017 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# Visual Studio 2017 auto generated files +Generated\ Files/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUnit +*.VisualState.xml +TestResult.xml +nunit-*.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# Benchmark Results +BenchmarkDotNet.Artifacts/ + +# .NET Core +project.lock.json +project.fragment.lock.json +artifacts/ + +# Tye +.tye/ + +# ASP.NET Scaffolding +ScaffoldingReadMe.txt + +# StyleCop +StyleCopReport.xml + +# Files built by Visual Studio +*_i.c +*_p.c +*_h.h +*.ilk +*.meta +*.obj +*.iobj +*.pch +*.pdb +*.ipdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*_wpftmp.csproj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# Visual Studio Trace Files +*.e2e + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# AxoCover is a Code Coverage Tool +.axoCover/* +!.axoCover/settings.json + +# Coverlet is a free, cross platform Code Coverage Tool +coverage*.json +coverage*.xml +coverage*.info + +# Visual Studio code coverage results +*.coverage +*.coveragexml + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# Note: Comment the next line if you want to checkin your web deploy settings, +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# NuGet Symbol Packages +*.snupkg +# The packages folder can be ignored because of Package Restore +**/[Pp]ackages/* +# except build/, which is used as an MSBuild target. +!**/[Pp]ackages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/[Pp]ackages/repositories.config +# NuGet v3's project.json files produces more ignorable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt +*.appx +*.appxbundle +*.appxupload + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!?*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.jfm +*.pfx +*.publishsettings +orleans.codegen.cs + +# Including strong name files can present a security risk +# (https://github.com/github/gitignore/pull/2483#issue-259490424) +#*.snk + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm +ServiceFabricBackup/ +*.rptproj.bak + +# SQL Server files +*.mdf +*.ldf +*.ndf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings +*.rptproj.rsuser +*- [Bb]ackup.rdl +*- [Bb]ackup ([0-9]).rdl +*- [Bb]ackup ([0-9][0-9]).rdl + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat +node_modules/ + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) +*.vbw + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# CodeRush personal settings +.cr/personal + +# Python Tools for Visual Studio (PTVS) +__pycache__/ +*.pyc + +# Cake - Uncomment if you are using it +# tools/** +# !tools/packages.config + +# Tabs Studio +*.tss + +# Telerik's JustMock configuration file +*.jmconfig + +# BizTalk build output +*.btp.cs +*.btm.cs +*.odx.cs +*.xsd.cs + +# OpenCover UI analysis results +OpenCover/ + +# Azure Stream Analytics local run output +ASALocalRun/ + +# MSBuild Binary and Structured Log +*.binlog + +# NVidia Nsight GPU debugger configuration file +*.nvuser + +# MFractors (Xamarin productivity tool) working folder +.mfractor/ + +# Local History for Visual Studio +.localhistory/ + +# BeatPulse healthcheck temp database +healthchecksdb + +# Backup folder for Package Reference Convert tool in Visual Studio 2017 +MigrationBackup/ + +# Ionide (cross platform F# VS Code tools) working folder +.ionide/ + +# Fody - auto-generated XML schema +FodyWeavers.xsd + +## +## Visual studio for Mac +## + + +# globs +Makefile.in +*.userprefs +*.usertasks +config.make +config.status +aclocal.m4 +install-sh +autom4te.cache/ +*.tar.gz +tarballs/ +test-results/ + +# Mac bundle stuff +*.dmg +*.app + +# content below from: https://github.com/github/gitignore/blob/master/Global/macOS.gitignore +# General +.DS_Store +.AppleDouble +.LSOverride + +# Icon must end with two \r +Icon + + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + +# content below from: https://github.com/github/gitignore/blob/master/Global/Windows.gitignore +# Windows thumbnail cache files +Thumbs.db +ehthumbs.db +ehthumbs_vista.db + +# Dump file +*.stackdump + +# Folder config file +[Dd]esktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Windows Installer files +*.cab +*.msi +*.msix +*.msm +*.msp + +# Windows shortcuts +*.lnk + +# JetBrains Rider +.idea/ +*.sln.iml + +## +## Visual Studio Code +## +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json diff --git a/samples/avrules/Directory.Build.props b/samples/avrules/Directory.Build.props new file mode 100644 index 0000000..f39656c --- /dev/null +++ b/samples/avrules/Directory.Build.props @@ -0,0 +1,6 @@ + + + enable + 11.0.6 + + diff --git a/samples/avrules/avrules.Android/Icon.png b/samples/avrules/avrules.Android/Icon.png new file mode 100644 index 0000000..41a2a61 Binary files /dev/null and b/samples/avrules/avrules.Android/Icon.png differ diff --git a/samples/avrules/avrules.Android/MainActivity.cs b/samples/avrules/avrules.Android/MainActivity.cs new file mode 100644 index 0000000..ed0c570 --- /dev/null +++ b/samples/avrules/avrules.Android/MainActivity.cs @@ -0,0 +1,23 @@ +using Android.App; +using Android.Content.PM; +using Avalonia; +using Avalonia.Android; +using Avalonia.ReactiveUI; + +namespace avrules.Android; + +[Activity( + Label = "avrules.Android", + Theme = "@style/MyTheme.NoActionBar", + Icon = "@drawable/icon", + MainLauncher = true, + ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.ScreenSize | ConfigChanges.UiMode)] +public class MainActivity : AvaloniaMainActivity +{ + protected override AppBuilder CustomizeAppBuilder(AppBuilder builder) + { + return base.CustomizeAppBuilder(builder) + .WithInterFont() + .UseReactiveUI(); + } +} diff --git a/samples/avrules/avrules.Android/Properties/AndroidManifest.xml b/samples/avrules/avrules.Android/Properties/AndroidManifest.xml new file mode 100644 index 0000000..1efa053 --- /dev/null +++ b/samples/avrules/avrules.Android/Properties/AndroidManifest.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/samples/avrules/avrules.Android/Resources/AboutResources.txt b/samples/avrules/avrules.Android/Resources/AboutResources.txt new file mode 100644 index 0000000..4cedede --- /dev/null +++ b/samples/avrules/avrules.Android/Resources/AboutResources.txt @@ -0,0 +1,44 @@ +Images, layout descriptions, binary blobs and string dictionaries can be included +in your application as resource files. Various Android APIs are designed to +operate on the resource IDs instead of dealing with images, strings or binary blobs +directly. + +For example, a sample Android app that contains a user interface layout (main.axml), +an internationalization string table (strings.xml) and some icons (drawable-XXX/icon.png) +would keep its resources in the "Resources" directory of the application: + +Resources/ + drawable/ + icon.png + + layout/ + main.axml + + values/ + strings.xml + +In order to get the build system to recognize Android resources, set the build action to +"AndroidResource". The native Android APIs do not operate directly with filenames, but +instead operate on resource IDs. When you compile an Android application that uses resources, +the build system will package the resources for distribution and generate a class called "R" +(this is an Android convention) that contains the tokens for each one of the resources +included. For example, for the above Resources layout, this is what the R class would expose: + +public class R { + public class drawable { + public const int icon = 0x123; + } + + public class layout { + public const int main = 0x456; + } + + public class strings { + public const int first_string = 0xabc; + public const int second_string = 0xbcd; + } +} + +You would then use R.drawable.icon to reference the drawable/icon.png file, or R.layout.main +to reference the layout/main.axml file, or R.strings.first_string to reference the first +string in the dictionary file values/strings.xml. \ No newline at end of file diff --git a/samples/avrules/avrules.Android/Resources/drawable-night-v31/avalonia_anim.xml b/samples/avrules/avrules.Android/Resources/drawable-night-v31/avalonia_anim.xml new file mode 100644 index 0000000..1fef3ac --- /dev/null +++ b/samples/avrules/avrules.Android/Resources/drawable-night-v31/avalonia_anim.xml @@ -0,0 +1,66 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/samples/avrules/avrules.Android/Resources/drawable-v31/avalonia_anim.xml b/samples/avrules/avrules.Android/Resources/drawable-v31/avalonia_anim.xml new file mode 100644 index 0000000..4784f80 --- /dev/null +++ b/samples/avrules/avrules.Android/Resources/drawable-v31/avalonia_anim.xml @@ -0,0 +1,71 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/samples/avrules/avrules.Android/Resources/drawable/splash_screen.xml b/samples/avrules/avrules.Android/Resources/drawable/splash_screen.xml new file mode 100644 index 0000000..4cebfe2 --- /dev/null +++ b/samples/avrules/avrules.Android/Resources/drawable/splash_screen.xml @@ -0,0 +1,13 @@ + + + + + + + + + + diff --git a/samples/avrules/avrules.Android/Resources/values-night/colors.xml b/samples/avrules/avrules.Android/Resources/values-night/colors.xml new file mode 100644 index 0000000..0f6f6c8 --- /dev/null +++ b/samples/avrules/avrules.Android/Resources/values-night/colors.xml @@ -0,0 +1,4 @@ + + + #212121 + diff --git a/samples/avrules/avrules.Android/Resources/values-v31/styles.xml b/samples/avrules/avrules.Android/Resources/values-v31/styles.xml new file mode 100644 index 0000000..8075ffa --- /dev/null +++ b/samples/avrules/avrules.Android/Resources/values-v31/styles.xml @@ -0,0 +1,21 @@ + + + + + + + + diff --git a/samples/avrules/avrules.Android/Resources/values/colors.xml b/samples/avrules/avrules.Android/Resources/values/colors.xml new file mode 100644 index 0000000..6fbae25 --- /dev/null +++ b/samples/avrules/avrules.Android/Resources/values/colors.xml @@ -0,0 +1,4 @@ + + + #FFFFFF + diff --git a/samples/avrules/avrules.Android/Resources/values/styles.xml b/samples/avrules/avrules.Android/Resources/values/styles.xml new file mode 100644 index 0000000..77ed2d7 --- /dev/null +++ b/samples/avrules/avrules.Android/Resources/values/styles.xml @@ -0,0 +1,12 @@ + + + + + + + diff --git a/samples/avrules/avrules.Android/avrules.Android.csproj b/samples/avrules/avrules.Android/avrules.Android.csproj new file mode 100644 index 0000000..622530d --- /dev/null +++ b/samples/avrules/avrules.Android/avrules.Android.csproj @@ -0,0 +1,28 @@ + + + Exe + net8.0-android + 21 + enable + com.CompanyName.avrules + 1 + 1.0 + apk + False + + + + + Resources\drawable\Icon.png + + + + + + + + + + + + diff --git a/samples/avrules/avrules.Browser/AppBundle/Logo.svg b/samples/avrules/avrules.Browser/AppBundle/Logo.svg new file mode 100644 index 0000000..7d28229 --- /dev/null +++ b/samples/avrules/avrules.Browser/AppBundle/Logo.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/samples/avrules/avrules.Browser/AppBundle/app.css b/samples/avrules/avrules.Browser/AppBundle/app.css new file mode 100644 index 0000000..c34bee5 --- /dev/null +++ b/samples/avrules/avrules.Browser/AppBundle/app.css @@ -0,0 +1,74 @@ +:root { + --sat: env(safe-area-inset-top); + --sar: env(safe-area-inset-right); + --sab: env(safe-area-inset-bottom); + --sal: env(safe-area-inset-left); +} + +/* HTML styles for the splash screen */ + +.highlight { + color: white; + font-size: 2.5rem; + display: block; +} + +.purple { + color: #8b44ac; +} + +.icon { + opacity: 0.05; + height: 35%; + width: 35%; + position: absolute; + background-repeat: no-repeat; + right: 0px; + bottom: 0px; + margin-right: 3%; + margin-bottom: 5%; + z-index: 5000; + background-position: right bottom; + pointer-events: none; +} + +#avalonia-splash a { + color: whitesmoke; + text-decoration: none; +} + +.center { + display: flex; + justify-content: center; + align-items: center; + height: 100vh; +} + +#avalonia-splash { + position: relative; + height: 100%; + width: 100%; + color: whitesmoke; + background: #1b2a4e; + font-family: 'Nunito', sans-serif; + background-position: center; + background-size: cover; + background-repeat: no-repeat; + justify-content: center; + align-items: center; +} + +.splash-close { + animation: fadeout 0.25s linear forwards; +} + +@keyframes fadeout { + 0% { + opacity: 100%; + } + + 100% { + opacity: 0; + visibility: collapse; + } +} diff --git a/samples/avrules/avrules.Browser/AppBundle/favicon.ico b/samples/avrules/avrules.Browser/AppBundle/favicon.ico new file mode 100644 index 0000000..da8d49f Binary files /dev/null and b/samples/avrules/avrules.Browser/AppBundle/favicon.ico differ diff --git a/samples/avrules/avrules.Browser/AppBundle/index.html b/samples/avrules/avrules.Browser/AppBundle/index.html new file mode 100644 index 0000000..2081af5 --- /dev/null +++ b/samples/avrules/avrules.Browser/AppBundle/index.html @@ -0,0 +1,30 @@ + + + + + avrules.Browser + + + + + + + + + + +
+
+
+

+ Powered by + Avalonia UI +

+
+ Avalonia Logo +
+
+ + + + \ No newline at end of file diff --git a/samples/avrules/avrules.Browser/AppBundle/main.js b/samples/avrules/avrules.Browser/AppBundle/main.js new file mode 100644 index 0000000..fcef1d7 --- /dev/null +++ b/samples/avrules/avrules.Browser/AppBundle/main.js @@ -0,0 +1,13 @@ +import { dotnet } from './dotnet.js' + +const is_browser = typeof window != "undefined"; +if (!is_browser) throw new Error(`Expected to be running in a browser`); + +const dotnetRuntime = await dotnet + .withDiagnosticTracing(false) + .withApplicationArgumentsFromQuery() + .create(); + +const config = dotnetRuntime.getConfig(); + +await dotnetRuntime.runMainAndExit(config.mainAssemblyName, [window.location.search]); \ No newline at end of file diff --git a/samples/avrules/avrules.Browser/Program.cs b/samples/avrules/avrules.Browser/Program.cs new file mode 100644 index 0000000..3afc761 --- /dev/null +++ b/samples/avrules/avrules.Browser/Program.cs @@ -0,0 +1,19 @@ +using System.Runtime.Versioning; +using System.Threading.Tasks; +using Avalonia; +using Avalonia.Browser; +using Avalonia.ReactiveUI; +using avrules; + +[assembly: SupportedOSPlatform("browser")] + +internal sealed partial class Program +{ + private static Task Main(string[] args) => BuildAvaloniaApp() + .WithInterFont() + .UseReactiveUI() + .StartBrowserAppAsync("out"); + + public static AppBuilder BuildAvaloniaApp() + => AppBuilder.Configure(); +} \ No newline at end of file diff --git a/samples/avrules/avrules.Browser/Properties/launchSettings.json b/samples/avrules/avrules.Browser/Properties/launchSettings.json new file mode 100644 index 0000000..e8c6f11 --- /dev/null +++ b/samples/avrules/avrules.Browser/Properties/launchSettings.json @@ -0,0 +1,13 @@ +{ + "profiles": { + "avrules.Browser": { + "commandName": "Project", + "launchBrowser": true, + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + }, + "applicationUrl": "https://localhost:5001;http://localhost:5000", + "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/debug?browser={browserInspectUri}" + } + } +} \ No newline at end of file diff --git a/samples/avrules/avrules.Browser/avrules.Browser.csproj b/samples/avrules/avrules.Browser/avrules.Browser.csproj new file mode 100644 index 0000000..bfbf19d --- /dev/null +++ b/samples/avrules/avrules.Browser/avrules.Browser.csproj @@ -0,0 +1,20 @@ + + + net8.0 + browser-wasm + AppBundle\main.js + Exe + + + + + + + + + + + + + + diff --git a/samples/avrules/avrules.Browser/runtimeconfig.template.json b/samples/avrules/avrules.Browser/runtimeconfig.template.json new file mode 100644 index 0000000..cc3f2ae --- /dev/null +++ b/samples/avrules/avrules.Browser/runtimeconfig.template.json @@ -0,0 +1,11 @@ +{ + "wasmHostProperties": { + "perHostConfig": [ + { + "name": "browser", + "html-path": "index.html", + "Host": "browser" + } + ] + } +} \ No newline at end of file diff --git a/samples/red/Program.cs b/samples/avrules/avrules.Desktop/Program.cs similarity index 75% rename from samples/red/Program.cs rename to samples/avrules/avrules.Desktop/Program.cs index 0c22b11..cda5647 100644 --- a/samples/red/Program.cs +++ b/samples/avrules/avrules.Desktop/Program.cs @@ -1,9 +1,10 @@ -using Avalonia; -using System; +using System; +using Avalonia; +using Avalonia.ReactiveUI; -namespace red; +namespace avrules.Desktop; -class Program +sealed class Program { // Initialization code. Don't use any Avalonia, third-party APIs or any // SynchronizationContext-reliant code before AppMain is called: things aren't initialized @@ -17,5 +18,6 @@ class Program => AppBuilder.Configure() .UsePlatformDetect() .WithInterFont() - .LogToTrace(); + .LogToTrace() + .UseReactiveUI(); } diff --git a/samples/red/app.manifest b/samples/avrules/avrules.Desktop/app.manifest similarity index 87% rename from samples/red/app.manifest rename to samples/avrules/avrules.Desktop/app.manifest index 2e8220e..9a7218a 100644 --- a/samples/red/app.manifest +++ b/samples/avrules/avrules.Desktop/app.manifest @@ -1,9 +1,9 @@  - + diff --git a/samples/avrules/avrules.Desktop/avrules.Desktop.csproj b/samples/avrules/avrules.Desktop/avrules.Desktop.csproj new file mode 100644 index 0000000..d8fe278 --- /dev/null +++ b/samples/avrules/avrules.Desktop/avrules.Desktop.csproj @@ -0,0 +1,24 @@ + + + WinExe + + net8.0 + enable + true + + + + app.manifest + + + + + + + + + + + + diff --git a/samples/red/App.axaml b/samples/avrules/avrules/App.axaml similarity index 62% rename from samples/red/App.axaml rename to samples/avrules/avrules/App.axaml index 28d80f0..0fe14e2 100644 --- a/samples/red/App.axaml +++ b/samples/avrules/avrules/App.axaml @@ -1,9 +1,14 @@ + xmlns:local="using:avrules" + x:Class="avrules.App" + RequestedThemeVariant="Default"> + + + + diff --git a/samples/avrules/avrules/App.axaml.cs b/samples/avrules/avrules/App.axaml.cs new file mode 100644 index 0000000..839e3f1 --- /dev/null +++ b/samples/avrules/avrules/App.axaml.cs @@ -0,0 +1,35 @@ +using Avalonia; +using Avalonia.Controls.ApplicationLifetimes; +using Avalonia.Markup.Xaml; +using avrules.ViewModels; +using avrules.Views; + +namespace avrules; + +public partial class App : Application +{ + public override void Initialize() + { + AvaloniaXamlLoader.Load(this); + } + + public override void OnFrameworkInitializationCompleted() + { + if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop) + { + desktop.MainWindow = new MainWindow + { + DataContext = new MainViewModel() + }; + } + else if (ApplicationLifetime is ISingleViewApplicationLifetime singleViewPlatform) + { + singleViewPlatform.MainView = new MainView + { + DataContext = new MainViewModel() + }; + } + + base.OnFrameworkInitializationCompleted(); + } +} \ No newline at end of file diff --git a/samples/avrules/avrules/Assets/avalonia-logo.ico b/samples/avrules/avrules/Assets/avalonia-logo.ico new file mode 100644 index 0000000..da8d49f Binary files /dev/null and b/samples/avrules/avrules/Assets/avalonia-logo.ico differ diff --git a/samples/avrules/avrules/ViewLocator.cs b/samples/avrules/avrules/ViewLocator.cs new file mode 100644 index 0000000..e66e6b5 --- /dev/null +++ b/samples/avrules/avrules/ViewLocator.cs @@ -0,0 +1,30 @@ +using System; +using Avalonia.Controls; +using Avalonia.Controls.Templates; +using avrules.ViewModels; + +namespace avrules; + +public class ViewLocator : IDataTemplate +{ + public Control? Build(object? data) + { + if (data is null) + return null; + + var name = data.GetType().FullName!.Replace("ViewModel", "View", StringComparison.Ordinal); + var type = Type.GetType(name); + + if (type != null) + { + return (Control)Activator.CreateInstance(type)!; + } + + return new TextBlock { Text = "Not Found: " + name }; + } + + public bool Match(object? data) + { + return data is ViewModelBase; + } +} \ No newline at end of file diff --git a/samples/avrules/avrules/ViewModels/MainViewModel.cs b/samples/avrules/avrules/ViewModels/MainViewModel.cs new file mode 100644 index 0000000..c4198e8 --- /dev/null +++ b/samples/avrules/avrules/ViewModels/MainViewModel.cs @@ -0,0 +1,9 @@ +namespace avrules.ViewModels; +using ReactiveUI; + +public class MainViewModel : ViewModelBase +{ + private string sourceCode = ""; + public string SourceCode { get => sourceCode; set { sourceCode = value; this.RaisePropertyChanged(nameof(SourceCode));}} + +} diff --git a/samples/avrules/avrules/ViewModels/ViewModelBase.cs b/samples/avrules/avrules/ViewModels/ViewModelBase.cs new file mode 100644 index 0000000..69d508f --- /dev/null +++ b/samples/avrules/avrules/ViewModels/ViewModelBase.cs @@ -0,0 +1,8 @@ +using ReactiveUI; + +namespace avrules.ViewModels; + +public class ViewModelBase : ReactiveObject +{ + +} diff --git a/samples/avrules/avrules/Views/MainView.axaml b/samples/avrules/avrules/Views/MainView.axaml new file mode 100644 index 0000000..36a2c33 --- /dev/null +++ b/samples/avrules/avrules/Views/MainView.axaml @@ -0,0 +1,24 @@ + + + + + + + + diff --git a/samples/avrules/avrules/Views/MainView.axaml.cs b/samples/avrules/avrules/Views/MainView.axaml.cs new file mode 100644 index 0000000..8bed3c8 --- /dev/null +++ b/samples/avrules/avrules/Views/MainView.axaml.cs @@ -0,0 +1,80 @@ +using System; +using System.Collections.Generic; +using Avalonia.Controls; +using Avalonia.Media; +using AvaloniaEdit; +using AvaloniaEdit.Highlighting; +using Irony.Interpreter; +using Irony.Parsing; +using irules.core; + +namespace avrules.Views; + +public partial class MainView : UserControl +{ + public TextEditor Editor => this.editor; + ClauseChecker checker = new ClauseChecker(); + Dictionary ColorTheme; + public MainView() + { + InitializeComponent(); + HighlightingColor text = new HighlightingColor + { Foreground = new SimpleHighlightingBrush(Color.FromRgb(255,255,250)) }; + HighlightingColor keywork = new HighlightingColor + { Foreground = new SimpleHighlightingBrush(Color.FromRgb(255,155,50)) }; + + HighlightingColor comment = new HighlightingColor + { FontStyle = Avalonia.Media.FontStyle.Italic, + Foreground = new SimpleHighlightingBrush(Color.FromRgb(150,150,150)) }; + HighlightingColor identifier = new HighlightingColor + { Foreground = new SimpleHighlightingBrush(Color.FromRgb(255,195,255)) }; + + ColorTheme = new Dictionary + { + { TokenColor.Text, text}, + { TokenColor.Keyword, keywork}, + { TokenColor.Comment, comment}, + { TokenColor.Identifier, identifier}, + { TokenColor.String, comment}, + { TokenColor.Number, identifier} + }; + } + + private void OnTextChanged(object sender, EventArgs e) + { + var appstatus = checker.Parse(editor.Text); + + switch (appstatus) + { + case AppStatus.Ready: + case AppStatus.SyntaxError: + case AppStatus.WaitingMoreInput: + editor.TextArea.TextView.LineTransformers.Clear(); + RichTextModel model = new RichTextModel(); + + checker.LatestParsedTree.Tokens?.ForEach ( + token => + { + switch(token.Category) + { + case TokenCategory.Error: + case TokenCategory.Directive: + case TokenCategory.Content: + case TokenCategory.Comment: + // token.Location.Line + model.ApplyHighlighting(token.Location.Position, token.Length, + ColorTheme[token.EditorInfo?.Color ?? TokenColor.String]); + + break; + + } + }); + RichTextColorizer transformer = new RichTextColorizer(model); + editor.TextArea.TextView.LineTransformers.Add(transformer); + break; + } + + } + + +} \ No newline at end of file diff --git a/samples/red/MainWindow.axaml b/samples/avrules/avrules/Views/MainWindow.axaml similarity index 56% rename from samples/red/MainWindow.axaml rename to samples/avrules/avrules/Views/MainWindow.axaml index 3facea3..1a10e57 100644 --- a/samples/red/MainWindow.axaml +++ b/samples/avrules/avrules/Views/MainWindow.axaml @@ -1,14 +1,14 @@ - + xmlns:views="clr-namespace:avrules.Views" + mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" + x:Class="avrules.Views.MainWindow" + Icon="/Assets/avalonia-logo.ico" + Title="avrules"> + @@ -27,14 +27,9 @@ - + + - \ No newline at end of file + + + diff --git a/samples/avrules/avrules/Views/MainWindow.axaml.cs b/samples/avrules/avrules/Views/MainWindow.axaml.cs new file mode 100644 index 0000000..e5cab81 --- /dev/null +++ b/samples/avrules/avrules/Views/MainWindow.axaml.cs @@ -0,0 +1,75 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Threading.Tasks; +using Avalonia.Controls; +using Avalonia.Interactivity; +using Avalonia.Media; +using Avalonia.Platform.Storage; +using Avalonia.Threading; +using AvaloniaEdit.Highlighting; +using AvaloniaEdit.Rendering; +using Irony.Interpreter; +using Irony.Parsing; +using irules.core; + +namespace avrules.Views; + +public partial class MainWindow : Window +{ + string sourceFileName=null; + private ITextRunConstructionContext transformerContext; + Dictionary ColorTheme; + public MainWindow() + { + InitializeComponent(); + } + + + public void OnExit(object sender, RoutedEventArgs e) + { + Close(); + } + + + public void OnOpen(object sender, RoutedEventArgs e) + { + Task.Run(async () => + { + FilePickerOpenOptions options = new FilePickerOpenOptions + { + AllowMultiple = false, + Title = "Open a red file" + }; + options.FileTypeFilter = new FilePickerFileType[] + { new("red"){ Patterns = new string[] { "*.red" } } }; + + var result = await StorageProvider.OpenFilePickerAsync(options); + + if (result != null) + { + var item = result.First(); + sourceFileName = + item.Path.AbsolutePath; + Dispatcher.UIThread.Post(() => src.Editor.Text = File.ReadAllText(sourceFileName)); + System.Diagnostics.Debug.WriteLine($"Opened: {sourceFileName}"); + } + }); + } + + public void OnSave(object sender, RoutedEventArgs e) + { + if (sourceFileName==null) OnSaveTo(sender, e); + File.WriteAllText(sourceFileName, src.Editor.Text); + } + public void OnSaveTo(object sender, RoutedEventArgs e) + { + throw new NotImplementedException(); + } + + public void OnRun(object sender, RoutedEventArgs e) + { + + } +} \ No newline at end of file diff --git a/samples/avrules/avrules/avrules.csproj b/samples/avrules/avrules/avrules.csproj new file mode 100644 index 0000000..03543fb --- /dev/null +++ b/samples/avrules/avrules/avrules.csproj @@ -0,0 +1,27 @@ + + + net8.0 + enable + latest + true + + + + + + + + + + + + + + + + + + + + + diff --git a/samples/data.red b/samples/data.red deleted file mode 100644 index d834caa..0000000 --- a/samples/data.red +++ /dev/null @@ -1 +0,0 @@ -Q&A \ No newline at end of file diff --git a/samples/red/.vscode/launch.json b/samples/red/.vscode/launch.json deleted file mode 100644 index 96016c2..0000000 --- a/samples/red/.vscode/launch.json +++ /dev/null @@ -1,53 +0,0 @@ -{ - // Use IntelliSense to find out which attributes exist for C# debugging - // Use hover for the description of the existing attributes - // For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md - "version": "0.2.0", - "configurations": [ - { - "name": "Uno Platform Mobile", - "type": "Uno", - "request": "launch", - // any Uno* task will do, this is simply to satisfy vscode requirement when a launch.json is present - "preLaunchTask": "Uno: android | Debug | android-x64" - }, - { - // Use IntelliSense to find out which attributes exist for C# debugging - // Use hover for the description of the existing attributes - // For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md - "name": "Debug (Chrome, WebAssembly)", - "type": "chrome", - "request": "launch", - "url": "http://localhost:5000", - "webRoot": "${workspaceFolder}/red.Wasm", - "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}", - "timeout": 30000, - "server": { - "runtimeExecutable": "dotnet", - "program": "run", - "outputCapture": "std", - "timeout": 30000, - "cwd": "${workspaceFolder}/red.Wasm" - } - }, - { - // Use IntelliSense to find out which attributes exist for C# debugging - // Use hover for the description of the existing attributes - // For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md - "name": "Skia.GTK (Debug)", - "type": "coreclr", - "request": "launch", - "preLaunchTask": "build-skia-gtk", - // If you have changed target frameworks, make sure to update the program path. - "program": "${workspaceFolder}/red.Skia.Gtk/bin/Debug/net7.0/red.Skia.Gtk.dll", - "args": [], - "env": { - "DOTNET_MODIFIABLE_ASSEMBLIES": "debug" - }, - "cwd": "${workspaceFolder}/red.Skia.Gtk", - // For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console - "console": "internalConsole", - "stopAtEntry": false - }, - ] -} diff --git a/samples/red/.vscode/settings.json b/samples/red/.vscode/settings.json deleted file mode 100644 index 4480d84..0000000 --- a/samples/red/.vscode/settings.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "explorer.fileNesting.enabled": true, - "explorer.fileNesting.expand": false, - "explorer.fileNesting.patterns": { - "*.xaml": "$(capture).xaml.cs" - } -} diff --git a/samples/red/.vscode/tasks.json b/samples/red/.vscode/tasks.json deleted file mode 100644 index 607403c..0000000 --- a/samples/red/.vscode/tasks.json +++ /dev/null @@ -1,53 +0,0 @@ -{ - "version": "2.0.0", - "tasks": [ - { - "label": "build-wasm", - "command": "dotnet", - "type": "process", - "args": [ - "build", - "${workspaceFolder}/red.Wasm/red.Wasm.csproj", - "/property:GenerateFullPaths=true", - "/consoleloggerparameters:NoSummary" - ], - "problemMatcher": "$msCompile" - }, - { - "label": "publish-wasm", - "command": "dotnet", - "type": "process", - "args": [ - "publish", - "${workspaceFolder}/red.Wasm/red.Wasm.csproj", - "/property:GenerateFullPaths=true", - "/consoleloggerparameters:NoSummary" - ], - "problemMatcher": "$msCompile" - }, - { - "label": "build-skia-gtk", - "command": "dotnet", - "type": "process", - "args": [ - "build", - "${workspaceFolder}/red.Skia.Gtk/red.Skia.Gtk.csproj", - "/property:GenerateFullPaths=true", - "/consoleloggerparameters:NoSummary" - ], - "problemMatcher": "$msCompile" - }, - { - "label": "publish-skia-gtk", - "command": "dotnet", - "type": "process", - "args": [ - "publish", - "${workspaceFolder}/red.Skia.Gtk/red.Skia.Gtk.csproj", - "/property:GenerateFullPaths=true", - "/consoleloggerparameters:NoSummary" - ], - "problemMatcher": "$msCompile" - } - ] -} diff --git a/samples/red/.vsconfig b/samples/red/.vsconfig deleted file mode 100644 index c999668..0000000 --- a/samples/red/.vsconfig +++ /dev/null @@ -1,39 +0,0 @@ -{ - "version": "1.0", - "components": [ - "Microsoft.VisualStudio.Component.CoreEditor", - "Microsoft.VisualStudio.Workload.CoreEditor", - "Microsoft.NetCore.Component.SDK", - "Microsoft.NetCore.Component.DevelopmentTools", - "Microsoft.Net.ComponentGroup.DevelopmentPrerequisites", - "Microsoft.VisualStudio.Component.TextTemplating", - "Microsoft.VisualStudio.ComponentGroup.WebToolsExtensions", - "Microsoft.NetCore.Component.Web", - "Microsoft.VisualStudio.Component.IISExpress", - "Component.Microsoft.Web.LibraryManager", - "Microsoft.VisualStudio.ComponentGroup.Web", - "Microsoft.VisualStudio.Component.Web", - "Microsoft.VisualStudio.ComponentGroup.Web.Client", - "Microsoft.VisualStudio.Workload.NetWeb", - "Microsoft.VisualStudio.ComponentGroup.Azure.Prerequisites", - "Microsoft.VisualStudio.Workload.Azure", - "Microsoft.VisualStudio.ComponentGroup.WebToolsExtensions.TemplateEngine", - "Microsoft.VisualStudio.Component.Windows10SDK.19041", - "Microsoft.VisualStudio.ComponentGroup.MSIX.Packaging", - "Microsoft.VisualStudio.Component.ManagedDesktop.Prerequisites", - "Microsoft.VisualStudio.Component.Debugger.JustInTime", - "Microsoft.VisualStudio.Workload.ManagedDesktop", - "Microsoft.Component.NetFX.Native", - "Microsoft.VisualStudio.Component.Graphics", - "Microsoft.VisualStudio.Component.Merq", - "Component.Xamarin.RemotedSimulator", - "Microsoft.VisualStudio.Component.MonoDebugger", - "Component.Xamarin", - "Microsoft.VisualStudio.ComponentGroup.Maui.All", - "Component.Android.SDK34", - "Component.Android.SDK33", - "Component.OpenJDK", - "Microsoft.VisualStudio.Workload.NetCrossPlat", - "Microsoft.VisualStudio.Workload.NetCoreTools" - ] -} diff --git a/samples/red/App.axaml.cs b/samples/red/App.axaml.cs deleted file mode 100644 index 4bb734a..0000000 --- a/samples/red/App.axaml.cs +++ /dev/null @@ -1,35 +0,0 @@ -using Avalonia; -using Avalonia.Controls.ApplicationLifetimes; -using Avalonia.Markup.Xaml; -using Irony.Interpreter; -using System; -using System.Collections.Generic; -using System.Text; -using System.Reflection; -using System.Security; -using Irony.Parsing; -using Irony.Interpreter.Ast; -using Irony; -using irules.core; - -namespace red; - -public partial class App : Application -{ - private readonly ClauseChecker checker = new ClauseChecker(); - - public override void Initialize() - { - AvaloniaXamlLoader.Load(this); - } - - public override void OnFrameworkInitializationCompleted() - { - if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop) - { - desktop.MainWindow = new MainWindow(checker); - } - - base.OnFrameworkInitializationCompleted(); - } -} diff --git a/samples/red/IronyGrammarTransformer.cs b/samples/red/IronyGrammarTransformer.cs deleted file mode 100644 index 40f7f37..0000000 --- a/samples/red/IronyGrammarTransformer.cs +++ /dev/null @@ -1,13 +0,0 @@ -using AvaloniaEdit.Document; -using AvaloniaEdit.Rendering; - -namespace red -{ - internal class IronyGrammarTransformer : DocumentColorizingTransformer - { - protected override void ColorizeLine(DocumentLine line) - { - throw new System.NotImplementedException(); - } - } -} \ No newline at end of file diff --git a/samples/red/MainWindow.axaml.cs b/samples/red/MainWindow.axaml.cs deleted file mode 100644 index eeaf6ef..0000000 --- a/samples/red/MainWindow.axaml.cs +++ /dev/null @@ -1,157 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.IO; -using System.Linq; -using System.Threading.Tasks; -using Avalonia.Controls; -using Avalonia.Interactivity; -using Avalonia.Platform.Storage; -using Avalonia.Rendering; -using Avalonia.Threading; -using Avalonia.VisualTree; -using AvaloniaEdit; -using AvaloniaEdit.Highlighting; -using AvaloniaEdit.Rendering; -using Irony.Interpreter; -using Irony.Parsing; -using irules.core; -using Microsoft.CodeAnalysis.CSharp.Syntax; -using Avalonia.Media; - -namespace red; - -public partial class MainWindow : Window -{ - ClauseChecker checker; - public MainWindow(ClauseChecker checker) - { - this.checker = checker; - InitializeComponent(); - SetupTheme(); - src.Text = "Hello !"; - src.TextChanged += OnTextChanged; - src.TextArea.TextView.VisualLinesChanged += TextView_VisualLinesChanged; - - } - - private void TextView_VisualLinesChanged(object sender, EventArgs e) - { - //throw new NotImplementedException(); - } - - private void SetupTheme() - { - HighlightingColor keywork = new HighlightingColor - { Foreground = new SimpleHighlightingBrush(Color.FromRgb(255,155,50)) }; - - HighlightingColor comment = new HighlightingColor - { FontStyle = Avalonia.Media.FontStyle.Italic, - Foreground = new SimpleHighlightingBrush(Color.FromRgb(150,150,150)) }; - HighlightingColor identifier = new HighlightingColor - { Foreground = new SimpleHighlightingBrush(Color.FromRgb(255,195,255)) }; - - ColorTheme = new Dictionary - { - { TokenColor.Text, keywork}, - { TokenColor.Keyword, keywork}, - { TokenColor.Comment, comment}, - { TokenColor.Identifier, identifier}, - { TokenColor.String, comment}, - { TokenColor.Number, identifier} - }; - - - } - - Dictionary ColorTheme; - - - - private void OnTextChanged(object sender, EventArgs e) - { - var appstatus = checker.Parse(src.Text); - statusMessage.Text = "Parsing :" + - appstatus.ToString(); - switch (appstatus) - { - case AppStatus.Ready: - case AppStatus.SyntaxError: - case AppStatus.WaitingMoreInput: - src.TextArea.TextView.LineTransformers.Clear(); - RichTextModel model = new RichTextModel(); - - - checker.LatestParsedTree.Tokens?.ForEach ( - token => - { - switch(token.Category) - { - case TokenCategory.Error: - case TokenCategory.Directive: - case TokenCategory.Content: - case TokenCategory.Comment: - // token.Location.Line - model.ApplyHighlighting(token.Location.Position, token.Length, - ColorTheme[token.EditorInfo.Color]); - break; - - } - }); - transformer = new RichTextColorizer(model); - src.TextArea.TextView.LineTransformers.Add(transformer); - break; - } - - } - - public void OnExit(object sender, RoutedEventArgs e) - { - Close(); - } - - string sourceFileName=null; - private ITextRunConstructionContext context; - private RichTextColorizer transformer; - private ITextRunConstructionContext transformerContext; - - public void OnOpen(object sender, RoutedEventArgs e) - { - Task.Run(async () => - { - FilePickerOpenOptions options = new FilePickerOpenOptions - { - AllowMultiple = false, - Title = "Open a red file" - }; - options.FileTypeFilter = new FilePickerFileType[] - { new("red"){ Patterns = new string[] { "*.red" } } }; - - var result = await StorageProvider.OpenFilePickerAsync(options); - - if (result != null) - { - var item = result.First(); - sourceFileName = - item.Path.AbsolutePath; - Dispatcher.UIThread.Post(() => src.Text = File.ReadAllText(sourceFileName)); - System.Diagnostics.Debug.WriteLine($"Opened: {sourceFileName}"); - } - }); - } - - public void OnSave(object sender, RoutedEventArgs e) - { - if (sourceFileName==null) OnSaveTo(sender, e); - File.WriteAllText(sourceFileName, src.Text); - } - public void OnSaveTo(object sender, RoutedEventArgs e) - { - throw new NotImplementedException(); - } - - public void OnRun(object sender, RoutedEventArgs e) - { - - } -} \ No newline at end of file diff --git a/samples/red/red.csproj b/samples/red/red.csproj deleted file mode 100644 index f272cf4..0000000 --- a/samples/red/red.csproj +++ /dev/null @@ -1,44 +0,0 @@ - - - WinExe - net6.0 - win7-x64;linux-x64;osx-x64 - false - - - - - %(Filename) - Code - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/samples/red/red.sln b/samples/red/red.sln deleted file mode 100644 index 7b8b239..0000000 --- a/samples/red/red.sln +++ /dev/null @@ -1,25 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 17 -VisualStudioVersion = 17.5.002.0 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "red", "red.csproj", "{66BC4201-F7AF-40A2-BB2A-A5329024C47F}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {66BC4201-F7AF-40A2-BB2A-A5329024C47F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {66BC4201-F7AF-40A2-BB2A-A5329024C47F}.Debug|Any CPU.Build.0 = Debug|Any CPU - {66BC4201-F7AF-40A2-BB2A-A5329024C47F}.Release|Any CPU.ActiveCfg = Release|Any CPU - {66BC4201-F7AF-40A2-BB2A-A5329024C47F}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {7BA738A4-A2F5-4296-AF49-7ACE98EECB16} - EndGlobalSection -EndGlobal diff --git a/test/test.core/test.core.csproj b/test/test.core/test.core.csproj index ba549c7..611e80e 100644 --- a/test/test.core/test.core.csproj +++ b/test/test.core/test.core.csproj @@ -1,7 +1,7 @@ - net6.0 + net8.0 enable enable