Initial commit lol

This commit is contained in:
Ciastex 2022-05-26 22:09:42 +02:00
commit 1d31dbc2f8
31 changed files with 1535 additions and 0 deletions

6
.gitignore vendored Normal file
View file

@ -0,0 +1,6 @@
bin/
obj/
/packages/
riderModule.iml
/_ReSharper.Caches/
.idea/

3
.gitmodules vendored Normal file
View file

@ -0,0 +1,3 @@
[submodule "Glitonea"]
path = Glitonea
url = https://github.com/Ciastex/Glitonea

1
Glitonea Submodule

@ -0,0 +1 @@
Subproject commit 6f7db236c74d30e988c83aa2ca558f20784be86f

22
Saradomin.sln Normal file
View file

@ -0,0 +1,22 @@

Microsoft Visual Studio Solution File, Format Version 12.00
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Saradomin", "Saradomin\Saradomin.csproj", "{29C8B474-5AE6-4B2D-9BE4-4764AFC50E16}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Glitonea", "Glitonea\Glitonea.csproj", "{D2884654-2246-4AC0-B53B-5F1DF33DEDD7}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{29C8B474-5AE6-4B2D-9BE4-4764AFC50E16}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{29C8B474-5AE6-4B2D-9BE4-4764AFC50E16}.Debug|Any CPU.Build.0 = Debug|Any CPU
{29C8B474-5AE6-4B2D-9BE4-4764AFC50E16}.Release|Any CPU.ActiveCfg = Release|Any CPU
{29C8B474-5AE6-4B2D-9BE4-4764AFC50E16}.Release|Any CPU.Build.0 = Release|Any CPU
{D2884654-2246-4AC0-B53B-5F1DF33DEDD7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D2884654-2246-4AC0-B53B-5F1DF33DEDD7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D2884654-2246-4AC0-B53B-5F1DF33DEDD7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D2884654-2246-4AC0-B53B-5F1DF33DEDD7}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal

454
Saradomin/.gitignore vendored Normal file
View file

@ -0,0 +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/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

70
Saradomin/App.axaml Normal file
View file

@ -0,0 +1,70 @@
<Application xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="clr-namespace:Saradomin.Views.Controls"
x:Class="Saradomin.App">
<Application.Styles>
<StyleInclude Source="avares://Avalonia.Themes.Default/Accents/BaseDark.xaml" />
<StyleInclude Source="avares://Avalonia.Themes.Default/DefaultTheme.xaml" />
<StyleInclude Source="avares://Saradomin/Resources/Styles/TopBarNavigation.axaml" />
<StyleInclude Source="avares://Saradomin/Resources/Styles/CloseButton.axaml" />
<StyleInclude Source="avares://Saradomin/Resources/Styles/OutsideNavigatorButton.axaml" />
<StyleInclude Source="avares://Saradomin/Resources/Styles/GroupBox.axaml" />
<StyleInclude Source="avares://Saradomin/Resources/Styles/CheckBox.axaml" />
<StyleInclude Source="avares://Saradomin/Resources/Styles/TextBox.axaml" />
<Style Selector="TextBlock.MenuPreviewEntry">
<Setter Property="Height" Value="18" />
<Setter Property="HorizontalAlignment" Value="Stretch" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="FontSize" Value="16" />
<Setter Property="FontFamily" Value="avares://Saradomin/Resources/Fonts/runescape_uf.ttf#RuneScape UF" />
</Style>
<Style Selector="ScrollBar:vertical">
<Setter Property="Width" Value="10" />
<Setter Property="Template">
<ControlTemplate>
<Border Background="#998468"
ClipToBounds="True"
CornerRadius="0,6,0,0">
<Grid RowDefinitions="Auto,*,Auto"
Background="#4B4535">
<Track Grid.Row="1"
Grid.Column="1"
Minimum="{TemplateBinding Minimum}"
Maximum="{TemplateBinding Maximum}"
Value="{TemplateBinding Value, Mode=TwoWay}"
ViewportSize="{TemplateBinding ViewportSize}"
Orientation="{TemplateBinding Orientation}"
IsDirectionReversed="True">
<Thumb Name="thumb"
Width="4"
Margin="0,10,0,10" />
</Track>
</Grid>
</Border>
</ControlTemplate>
</Setter>
</Style>
<Style Selector="Thumb#thumb">
<Setter Property="Background" Value="#6F5D45" />
</Style>
<Style Selector="Thumb#thumb:pointerover">
<Setter Property="Background" Value="White" />
</Style>
<Style Selector="Thumb#thumb:pressed">
<Setter Property="Background" Value="#F2C954" />
</Style>
</Application.Styles>
<Application.Resources>
<ResourceDictionary>
<Image x:Key="MainApplicationIcon"
Source="avares://Saradomin/Resources/Icons/09logo.png" />
</ResourceDictionary>
</Application.Resources>
</Application>

33
Saradomin/App.axaml.cs Normal file
View file

@ -0,0 +1,33 @@
using Avalonia;
using Avalonia.Controls.ApplicationLifetimes;
using Avalonia.Markup.Xaml;
using Glitonea;
using Glitonea.Mvvm;
using PropertyChanged;
using Saradomin.Views.Windows;
namespace Saradomin
{
[DoNotNotify]
public class App : Application
{
public static Messenger Messenger { get; private set; }
public override void Initialize()
{
AvaloniaXamlLoader.Load(this);
GlitoneaCore.Initialize();
Messenger = new Messenger();
}
public override void OnFrameworkInitializationCompleted()
{
if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
{
desktop.MainWindow = new MainWindow();
}
base.OnFrameworkInitializationCompleted();
}
}
}

View file

@ -0,0 +1,3 @@
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
<PropertyChanged />
</Weavers>

View file

@ -0,0 +1,14 @@
using Avalonia.Controls.Html;
namespace Saradomin.Messaging
{
public class MainViewLoadedMessage
{
public HtmlControl HtmlView { get; }
public MainViewLoadedMessage(HtmlControl htmlView)
{
HtmlView = htmlView;
}
}
}

17
Saradomin/Program.cs Normal file
View file

@ -0,0 +1,17 @@
using System;
using Avalonia;
namespace Saradomin
{
internal class Program
{
[STAThread]
public static void Main(string[] args) => BuildAvaloniaApp()
.StartWithClassicDesktopLifetime(args);
public static AppBuilder BuildAvaloniaApp()
=> AppBuilder.Configure<App>()
.UsePlatformDetect()
.LogToTrace();
}
}

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 261 B

View file

@ -0,0 +1,63 @@
<Styles xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Style Selector="CheckBox.SettingsCheckBox">
<Setter Property="Foreground" Value="#3E3529" />
<Setter Property="Background" Value="#998468" />
<Setter Property="Template">
<ControlTemplate TargetType="CheckBox">
<Grid ColumnDefinitions="Auto,*">
<Canvas Grid.Column="0"
Background="{TemplateBinding Background}"
Width="24"
Height="24">
<Path Fill="{TemplateBinding Foreground}"
Data="M19,3H5C3.89,3 3,3.89 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V5C21,3.89 20.1,3 19,3M19,5V19H5V5H19Z" />
</Canvas>
<ContentPresenter Grid.Column="1"
TextBlock.Foreground="{TemplateBinding Foreground}"
TextBlock.FontSize="13"
Margin="2,0,0,0"
ContentTemplate="{TemplateBinding ContentTemplate}"
Content="{TemplateBinding Content}"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" />
</Grid>
</ControlTemplate>
</Setter>
</Style>
<Style Selector="CheckBox.SettingsCheckBox:pointerover">
<Setter Property="Foreground" Value="White" />
</Style>
<Style Selector="CheckBox.SettingsCheckBox:checked">
<Setter Property="Template">
<ControlTemplate TargetType="CheckBox">
<Grid ColumnDefinitions="Auto,*">
<Canvas Grid.Column="0"
Background="{TemplateBinding Background}"
Width="24"
Height="24">
<Path Fill="{TemplateBinding Foreground}"
Data="M10,17L5,12L6.41,10.58L10,14.17L17.59,6.58L19,8M19,3H5C3.89,3 3,3.89 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V5C21,3.89 20.1,3 19,3Z" />
</Canvas>
<ContentPresenter Grid.Column="1"
TextBlock.Foreground="{TemplateBinding Foreground}"
TextBlock.FontSize="13"
Margin="2,0,0,0"
ContentTemplate="{TemplateBinding ContentTemplate}"
Content="{TemplateBinding Content}"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" />
</Grid>
</ControlTemplate>
</Setter>
</Style>
<Style Selector="CheckBox.SettingsCheckBox:pressed">
<Setter Property="Foreground" Value="#F2C954" />
</Style>
</Styles>

View file

@ -0,0 +1,29 @@
<Styles xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Style Selector="Button.CloseButton">
<Setter Property="Foreground" Value="#6F5D45" />
<Setter Property="Background" Value="#3E3529" />
<Setter Property="Template">
<ControlTemplate TargetType="Button">
<Border CornerRadius="5"
Background="{TemplateBinding Background}">
<Path Name="PART_CloseVisual"
Width="24"
Height="24"
Fill="{TemplateBinding Foreground}"
Data="M19,3H16.3H7.7H5A2,2 0 0,0 3,5V7.7V16.4V19A2,2 0 0,0 5,21H7.7H16.4H19A2,2 0 0,0 21,19V16.3V7.7V5A2,2 0 0,0 19,3M15.6,17L12,13.4L8.4,17L7,15.6L10.6,12L7,8.4L8.4,7L12,10.6L15.6,7L17,8.4L13.4,12L17,15.6L15.6,17Z" />
</Border>
</ControlTemplate>
</Setter>
</Style>
<Style Selector="Button.CloseButton:pointerover">
<Setter Property="Foreground" Value="White" />
</Style>
<Style Selector="Button.CloseButton:pressed">
<Setter Property="Foreground" Value="#F2C954" />
</Style>
</Styles>

View file

@ -0,0 +1,34 @@
<Styles xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Style Selector="HeaderedContentControl.GroupBox">
<Setter Property="Margin" Value="2,2,0,0" />
<Setter Property="BorderBrush" Value="#7D694E" />
<Setter Property="Template">
<ControlTemplate>
<Border Grid.Row="1"
BorderBrush="{TemplateBinding BorderBrush}"
CornerRadius="{TemplateBinding CornerRadius}"
BorderThickness="1">
<Grid RowDefinitions="Auto,*">
<Border BorderBrush="#7D694E"
BorderThickness="0,0,0,1"
Padding="0,0,0,2"
Margin="4">
<TextBlock FontWeight="500"
FontSize="13"
Foreground="#3E3529"
UseLayoutRounding="False"
Margin="2,0,0,0"
Text="{TemplateBinding Header}" />
</Border>
<ContentPresenter Grid.Row="1"
Margin="4,0"
Content="{TemplateBinding Content}" />
</Grid>
</Border>
</ControlTemplate>
</Setter>
</Style>
</Styles>

View file

@ -0,0 +1,26 @@
<Styles xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Style Selector="Button.OutsideNavigator">
<Setter Property="BorderThickness" Value="0" />
<Setter Property="FontSize" Value="14" />
<Setter Property="FontWeight" Value="Light" />
<Setter Property="Height" Value="20" />
<Setter Property="Padding" Value="6 0" />
<Setter Property="Width" Value="95" />
<Setter Property="Margin" Value="1,0,0,0" />
<Setter Property="HorizontalContentAlignment" Value="Center" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="Background" Value="#7D694E" />
<Setter Property="Foreground" Value="#F0F0F0" />
</Style>
<Style Selector="Button.OutsideNavigator:pointerover /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="Background" Value="White" />
<Setter Property="TextBlock.Foreground" Value="#3E3529" />
</Style>
<Style Selector="Button.OutsideNavigator:pressed /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="Background" Value="#F2C954" />
<Setter Property="TextBlock.Foreground" Value="#3E3529" />
</Style>
</Styles>

View file

@ -0,0 +1,30 @@
<Styles xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Style Selector="TextBox.SettingsTextBox">
<Setter Property="BorderBrush" Value="#3E3529" />
<Setter Property="BorderThickness" Value="1" />
<Setter Property="CornerRadius" Value="2" />
<Setter Property="Background" Value="#6F5D45" />
<Setter Property="CaretBrush" Value="#F2C954" />
<Setter Property="Foreground" Value="#F2C954" />
<Setter Property="SelectionBrush" Value="#4F463A" />
<Setter Property="Margin" Value="0,0,0,4" />
</Style>
<Style Selector="TextBox.SettingsTextBox /template/ Border#watermark">
<Setter Property="Opacity" Value="0.3" />
</Style>
<Style Selector="TextBox.SettingsTextBox:focus /template/ Border#border">
<Setter Property="BorderBrush" Value="#4F463A" />
</Style>
<Style Selector="TextBox.SettingsTextBox:pointerover /template/ Border#border">
<Setter Property="BorderBrush" Value="#4F463A" />
</Style>
<Style Selector="TextBox.SettingsTextBox:focus">
<Setter Property="CaretBrush" Value="#F2C954" />
<Setter Property="Foreground" Value="#F2C954" />
</Style>
</Styles>

View file

@ -0,0 +1,39 @@
<Styles xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Style Selector="TabControl.PageSelector">
<Setter Property="Background" Value="#F0F0F0"/>
<Setter Property="HorizontalAlignment" Value="Stretch" />
<Setter Property="VerticalAlignment" Value="Stretch" />
</Style>
<Style Selector="TabControl.PageSelector WrapPanel">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Margin" Value="4,0,0,0" />
</Style>
<Style Selector="TabControl.PageSelector > TabItem">
<Setter Property="FontSize" Value="14"/>
<Setter Property="FontWeight" Value="Light" />
<Setter Property="Height" Value="20"/>
<Setter Property="VerticalAlignment" Value="Top"/>
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="Background" Value="#7D694E"/>
<Setter Property="Foreground" Value="#F0F0F0"/>
<Setter Property="Margin" Value="0 0 0 0"/>
<Setter Property="Padding" Value="6 0"/>
</Style>
<Style Selector="TabControl.PageSelector > TabItem:pointerover /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="Background" Value="#6F5D45"/>
</Style>
<Style Selector="TabControl.PageSelector > TabItem:focus /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="Background" Value="#3E3529"/>
</Style>
<Style Selector="TabControl.PageSelector > TabItem:selected">
<Setter Property="Foreground" Value="#F2C954"/>
</Style>
<Style Selector="TabControl.PageSelector > TabItem:selected /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="Background" Value="#3E3529"/>
</Style>
</Styles>

View file

@ -0,0 +1,53 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<None Remove=".gitignore" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Avalonia" Version="0.10.14" />
<PackageReference Include="Avalonia.Desktop" Version="0.10.14" />
<!--Condition below is needed to remove Avalonia.Diagnostics package from build output in Release configuration.-->
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="0.10.14" />
<PackageReference Include="Avalonia.HtmlRenderer" Version="0.10.0" />
<PackageReference Include="AvaloniaColorPicker" Version="1.3.2" />
<PackageReference Include="HtmlAgilityPack" Version="1.11.42" />
<PackageReference Include="PropertyChanged.Fody" Version="4.0.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Glitonea\Glitonea.csproj" />
</ItemGroup>
<ItemGroup>
<None Remove="Resources\Icons\09logo.png" />
<AvaloniaResource Include="Resources\Icons\09logo.png" />
<None Remove="Resources\Icons\settings.png" />
<AvaloniaResource Include="Resources\Icons\settings.png" />
<None Remove="Resources\Fonts\runescape_uf.ttf" />
<AvaloniaResource Include="Resources\Fonts\runescape_uf.ttf" />
</ItemGroup>
<ItemGroup>
<Compile Update="Views\Windows\MainWindow.axaml.cs">
<DependentUpon>MainWindow.axaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Update="Views\Controls\SettingsView.axaml.cs">
<DependentUpon>MainWindow.axaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Update="Views\Controls\HeaderedTextBox.axaml.cs">
<DependentUpon>HeaderedTextBox.axaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Update="Views\Controls\MenuPreview.axaml.cs">
<DependentUpon>MenuPreview.axaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
</ItemGroup>
</Project>

View file

@ -0,0 +1,24 @@
using System.Diagnostics;
using System.Runtime.InteropServices;
namespace Saradomin.Utilities
{
public static class CrossPlatform
{
public static void LaunchURL(string url)
{
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
Process.Start(url);
}
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
{
Process.Start("xdg-open", url);
}
else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
{
Process.Start("open", url);
}
}
}
}

View file

@ -0,0 +1,9 @@
using Glitonea.Mvvm;
namespace Saradomin.ViewModel.Controls
{
public class SettingsViewModel : ViewModelBase
{
public bool UseRuneScape3StyleBorder { get; set; }
}
}

View file

@ -0,0 +1,52 @@
using System;
using System.Net.Http;
using Glitonea.Mvvm;
using HtmlAgilityPack;
using Saradomin.Messaging;
using Saradomin.Utilities;
namespace Saradomin.ViewModel.Windows
{
public class MainWindowViewModel : ViewModelBase
{
public string Title { get; set; } = "2009scape launcher";
public MainWindowViewModel()
{
App.Messenger.Register<MainViewLoadedMessage>(this, MainViewLoaded);
}
public void ExitApplication()
{
Environment.Exit(0);
}
public async void MainViewLoaded(MainViewLoadedMessage msg)
{
msg.HtmlView.BaseStylesheet = "* { font-size: 18px; }";
using (var httpClient = new HttpClient())
{
var response = await httpClient.GetAsync("https://2009scape.org/services/m=news/archives/latest.html");
var doc = new HtmlDocument();
doc.Load(await response.Content.ReadAsStreamAsync());
var node = doc.DocumentNode.SelectSingleNode("//div[@class='msgcontents']");
msg.HtmlView.Text = node.InnerHtml;
}
}
public void LaunchPage(string parameter)
{
var url = parameter switch
{
"news" => "https://2009scape.org/services/m=news/archives/latest.html",
"issues" => "https://gitlab.com/2009scape/2009scape/-/issues",
"hiscores" => "https://2009scape.org/services/m=hiscore/hiscores.html?world=2",
"discord" => "https://discord.gg/YY7WSttN7H",
_ => throw new ArgumentException($"{parameter} is not a valid page parameter.")
};
CrossPlatform.LaunchURL(url);
}
}
}

View file

@ -0,0 +1,18 @@
<UserControl xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:glitonea="clr-namespace:Glitonea;assembly=Glitonea"
xmlns:mvvm="clr-namespace:Glitonea.Mvvm;assembly=Glitonea"
xmlns:vm="clr-namespace:Saradomin.ViewModel.Controls"
xmlns:controls="clr-namespace:Saradomin.Views.Controls"
x:Class="Saradomin.Views.Controls.HeaderedTextBox">
<Grid RowDefinitions="Auto,Auto">
<TextBlock Grid.Row="0"
Foreground="#3E3529"
Text="{Binding $parent[controls:HeaderedTextBox].Header}"
Margin="0,0,0,2" />
<TextBox Grid.Row="1"
Classes="SettingsTextBox"
Text="{Binding $parent[controls:HeaderedTextBox].Text}" />
</Grid>
</UserControl>

View file

@ -0,0 +1,45 @@
using Avalonia;
using Avalonia.Controls;
using Avalonia.Markup.Xaml;
using PropertyChanged;
namespace Saradomin.Views.Controls
{
[DoNotNotify]
public class HeaderedTextBox : UserControl
{
public static readonly StyledProperty<string> HeaderProperty = new(
nameof(Header),
typeof(HeaderedTextBox),
new StyledPropertyMetadata<string>("i_am_a_lazy_piece_of_shit")
);
public static readonly StyledProperty<string> TextProperty = new(
nameof(Text),
typeof(HeaderedTextBox),
new StyledPropertyMetadata<string>(string.Empty)
);
public string Header
{
get => GetValue(HeaderProperty);
set => SetValue(HeaderProperty, value);
}
public string Text
{
get => GetValue(TextProperty);
set => SetValue(TextProperty, value);
}
public HeaderedTextBox()
{
InitializeComponent();
}
private void InitializeComponent()
{
AvaloniaXamlLoader.Load(this);
}
}
}

View file

@ -0,0 +1,69 @@
<UserControl xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="clr-namespace:Saradomin.Views.Controls"
x:Class="Saradomin.Views.Controls.MenuPreview">
<Grid RowDefinitions="Auto,Auto">
<Border Name="RS3Border"
BorderBrush="{Binding $parent[controls:MenuPreview].BorderColor}"
BorderThickness="{Binding $parent[controls:MenuPreview].RuneScape3StyleBorderThickness, Mode=TwoWay}">
<Grid RowDefinitions="Auto,Auto">
<Grid Grid.Row="0"
Background="{Binding $parent[controls:MenuPreview].TitleBarColor}">
<TextBlock Margin="1,1,0,0"
Foreground="{Binding $parent[controls:MenuPreview].TitleFontColor}"
Classes="MenuPreviewEntry"
Text="Choose Option" />
</Grid>
<Border Grid.Row="1"
BorderBrush="{Binding $parent[controls:MenuPreview].BorderColor}"
BorderThickness="{Binding $parent[controls:MenuPreview].OldStyleBorderThickness, Mode=TwoWay}"
Margin="0,-1,0,0">
<Grid RowDefinitions="Auto,Auto,Auto,Auto"
Background="{Binding $parent[controls:MenuPreview].BackgroundColor}">
<Grid Grid.Row="0"
ColumnDefinitions="*,Auto"
Margin="1,1,1,0">
<TextBlock Grid.Column="0"
Classes="MenuPreviewEntry"
Text="Take"
Foreground="#F0F0F0" />
<TextBlock Grid.Column="1"
Classes="MenuPreviewEntry"
Foreground="#AD622F"
Text="Abyssal whip" />
</Grid>
<TextBlock Grid.Row="1"
Margin="1,1,1,0"
Classes="MenuPreviewEntry"
Text="Walk here"
Foreground="#F0F0F0" />
<Grid Grid.Row="2"
ColumnDefinitions="*,Auto"
Margin="1,1,1,0">
<TextBlock Grid.Column="0"
Classes="MenuPreviewEntry"
Text="Examine"
Foreground="#F0F0F0" />
<TextBlock Grid.Column="1"
Classes="MenuPreviewEntry"
Foreground="#AD622F"
Text="Abyssal whip" />
</Grid>
<TextBlock Grid.Row="3"
Margin="1,1,1,0"
Classes="MenuPreviewEntry"
Text="Cancel"
Foreground="#F0F0F0" />
</Grid>
</Border>
</Grid>
</Border>
</Grid>
</UserControl>

View file

@ -0,0 +1,131 @@
using Avalonia;
using Avalonia.Controls;
using Avalonia.Markup.Xaml;
using Avalonia.Media;
using PropertyChanged;
namespace Saradomin.Views.Controls
{
[DoNotNotify]
public class MenuPreview : UserControl
{
public static readonly StyledProperty<SolidColorBrush> BackgroundColorProperty = new(
nameof(BackgroundColor),
typeof(MenuPreview),
new StyledPropertyMetadata<SolidColorBrush>(
new(SolidColorBrush.Parse("#5D5447"))
)
);
public static readonly StyledProperty<SolidColorBrush> TitleBarColorProperty = new(
nameof(TitleBarColor),
typeof(MenuPreview),
new(SolidColorBrush.Parse("#000000"))
);
public static readonly StyledProperty<SolidColorBrush> TitleFontColorProperty = new(
nameof(TitleFontColor),
typeof(MenuPreview),
new(SolidColorBrush.Parse("#FFFFFF"))
);
public static readonly StyledProperty<SolidColorBrush> BorderColorProperty = new(
nameof(TitleFontColor),
typeof(MenuPreview),
new(SolidColorBrush.Parse("#FFFFFF"))
);
public static readonly StyledProperty<bool> UseRuneScape3StyleBorderProperty = new(
nameof(UseRuneScape3StyleBorder),
typeof(MenuPreview),
new(false)
);
private static readonly StyledProperty<Thickness> OldStyleBorderThicknessProperty = new(
nameof(OldStyleBorderThickness),
typeof(MenuPreview),
new(Thickness.Parse("1"))
);
private static readonly StyledProperty<Thickness> RuneScape3StyleBorderThicknessProperty = new(
nameof(RuneScape3StyleBorderThickness),
typeof(MenuPreview),
new(Thickness.Parse("0"))
);
public SolidColorBrush BackgroundColor
{
get => GetValue(BackgroundColorProperty);
set => SetValue(BackgroundColorProperty, value);
}
public SolidColorBrush TitleBarColor
{
get => GetValue(TitleBarColorProperty);
set => SetValue(TitleBarColorProperty, value);
}
public SolidColorBrush TitleFontColor
{
get => GetValue(TitleFontColorProperty);
set => SetValue(TitleFontColorProperty, value);
}
public SolidColorBrush BorderColor
{
get => GetValue(BorderColorProperty);
set => SetValue(BorderColorProperty, value);
}
public bool UseRuneScape3StyleBorder
{
get => GetValue(UseRuneScape3StyleBorderProperty);
set => SetValue(UseRuneScape3StyleBorderProperty, value);
}
private Thickness OldStyleBorderThickness
{
get => GetValue(OldStyleBorderThicknessProperty);
set => SetValue(OldStyleBorderThicknessProperty, value);
}
private Thickness RuneScape3StyleBorderThickness
{
get => GetValue(RuneScape3StyleBorderThicknessProperty);
set => SetValue(RuneScape3StyleBorderThicknessProperty, value);
}
public MenuPreview()
{
InitializeComponent();
}
private void InitializeComponent()
{
AvaloniaXamlLoader.Load(this);
PropertyChanged += OnPropertyChanged;
}
private void OnPropertyChanged(object sender, AvaloniaPropertyChangedEventArgs e)
{
switch (e.Property.Name)
{
case nameof(UseRuneScape3StyleBorder):
{
if (UseRuneScape3StyleBorder)
{
OldStyleBorderThickness = new(0);
RuneScape3StyleBorderThickness = new(1);
}
else
{
OldStyleBorderThickness = new(1);
RuneScape3StyleBorderThickness = new(0);
}
break;
}
}
}
}
}

View file

@ -0,0 +1,99 @@
<UserControl xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:glitonea="clr-namespace:Glitonea;assembly=Glitonea"
xmlns:mvvm="clr-namespace:Glitonea.Mvvm;assembly=Glitonea"
xmlns:vm="clr-namespace:Saradomin.ViewModel.Controls"
xmlns:controls="clr-namespace:Saradomin.Views.Controls"
x:Class="Saradomin.Views.Controls.SettingsView"
DataContext="{mvvm:DataContextSource vm:SettingsViewModel}">
<Grid ColumnDefinitions="*,*"
RowDefinitions="Auto,Auto,Auto,Auto"
Margin="0,0,26,0">
<HeaderedContentControl Grid.Row="0"
Grid.Column="0"
Classes="GroupBox"
CornerRadius="6,0,0,0"
Header="debugging settings">
<StackPanel Orientation="Vertical">
<CheckBox Classes="SettingsCheckBox"
Content="Show item IDs" />
<CheckBox Classes="SettingsCheckBox"
Content="Show object IDs" />
<CheckBox Classes="SettingsCheckBox"
Content="Show NPC IDs" />
</StackPanel>
</HeaderedContentControl>
<HeaderedContentControl Grid.Row="1"
Grid.Column="0"
Classes="GroupBox"
Header="right-click menu settings">
<StackPanel Orientation="Vertical">
<CheckBox Classes="SettingsCheckBox"
Content="Use RS3-style menu border"
IsChecked="{Binding UseRuneScape3StyleBorder, Mode=TwoWay}" />
<Grid ColumnDefinitions="*,*"
Margin="2,4,0,0">
<StackPanel Grid.Column="0"
Orientation="Vertical">
<controls:HeaderedTextBox Header="Title bar background color"
HorizontalAlignment="Stretch" />
<controls:HeaderedTextBox Header="Title bar text color"
HorizontalAlignment="Stretch" />
<controls:HeaderedTextBox Header="Border color"
HorizontalAlignment="Stretch" />
</StackPanel>
<controls:MenuPreview Grid.Column="1"
Width="130"
DataContext="{Binding $parent[controls:SettingsView].DataContext}"
UseRuneScape3StyleBorder="{Binding UseRuneScape3StyleBorder, Mode=TwoWay}" />
</Grid>
</StackPanel>
</HeaderedContentControl>
<HeaderedContentControl Grid.Row="2"
Grid.Column="0"
Classes="GroupBox"
Header="interface settings">
<StackPanel Orientation="Vertical">
<CheckBox Classes="SettingsCheckBox"
Content="Enable Slayer progress tracking" />
<CheckBox Classes="SettingsCheckBox"
Content="Enable left-click attack" />
<CheckBox Classes="SettingsCheckBox"
Content="XP drops enabled" />
</StackPanel>
</HeaderedContentControl>
<HeaderedContentControl Grid.Row="0"
Grid.Column="1"
Classes="GroupBox"
Header="launcher settings">
<StackPanel Orientation="Vertical">
<CheckBox Classes="SettingsCheckBox"
Content="Close the launcher after client starts" />
<CheckBox Classes="SettingsCheckBox"
Content="Let me know about launcher updates" />
</StackPanel>
</HeaderedContentControl>
<HeaderedContentControl Grid.Row="1"
Grid.Column="1"
Classes="GroupBox"
Header="graphics settings">
<StackPanel Orientation="Vertical">
<CheckBox Classes="SettingsCheckBox"
Content="Mini-map smoothing" />
</StackPanel>
</HeaderedContentControl>
</Grid>
</UserControl>

View file

@ -0,0 +1,20 @@
using Avalonia.Controls;
using Avalonia.Markup.Xaml;
using PropertyChanged;
namespace Saradomin.Views.Controls
{
[DoNotNotify]
public class SettingsView : UserControl
{
public SettingsView()
{
InitializeComponent();
}
private void InitializeComponent()
{
AvaloniaXamlLoader.Load(this);
}
}
}

View file

@ -0,0 +1,129 @@
<glitonea:WindowEx xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:glitonea="clr-namespace:Glitonea;assembly=Glitonea"
xmlns:mvvm="clr-namespace:Glitonea.Mvvm;assembly=Glitonea"
xmlns:vm="clr-namespace:Saradomin.ViewModel.Windows"
xmlns:controls="clr-namespace:Saradomin.Views.Controls"
Width="800"
Height="500"
SystemDecorations="None"
x:Class="Saradomin.Views.Windows.MainWindow"
Title="{Binding Title}"
DataContext="{mvvm:DataContextSource vm:MainWindowViewModel}"
WindowStartupLocation="CenterScreen"
Icon="{DynamicResource MainApplicationIcon}"
Name="MainWindow">
<Border BorderThickness="2"
BorderBrush="#3E3529">
<Grid RowDefinitions="24,*,32">
<Grid Grid.Row="0"
Background="#3E3529"
PointerPressed="TitleBar_MouseDown"
ColumnDefinitions="Auto,*,Auto">
<TextBlock Grid.Column="1"
Grid.ColumnSpan="3"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Text="{Binding #MainWindow.Title}"
FontSize="14"
Foreground="#F2C954"
FontFamily="Open Sans"
FontWeight="Light" />
<Button Grid.Column="2"
Classes="CloseButton"
Command="{Binding ExitApplication}" />
</Grid>
<Grid Grid.Row="1"
Grid.ZIndex="1"
Margin="0,2,4,0"
VerticalAlignment="Top"
HorizontalAlignment="Right"
ColumnDefinitions="Auto,Auto,Auto,Auto">
<Button Grid.Column="0"
Classes="OutsideNavigator"
Content="latest news"
CornerRadius="8,0,0,8"
Command="{Binding LaunchPage}"
CommandParameter="news" />
<Button Grid.Column="1"
Classes="OutsideNavigator"
Content="found a bug?"
Command="{Binding LaunchPage}"
CommandParameter="issues" />
<Button Grid.Column="2"
Classes="OutsideNavigator"
Content="hi-scores"
Command="{Binding LaunchPage}"
CommandParameter="hiscores" />
<Button Grid.Column="3"
Classes="OutsideNavigator"
Content="discord"
CornerRadius="0,8,8,0"
Command="{Binding LaunchPage}"
CommandParameter="discord" />
</Grid>
<TabControl Grid.Row="1"
Grid.RowSpan="1"
Classes="PageSelector"
Background="#A1855C"
BorderBrush="#312D25">
<TabItem Header="what's new"
CornerRadius="0,0,0,8"
HorizontalContentAlignment="Center"
Width="95">
<Border CornerRadius="6,6,0,0"
Margin="4,0,4,0"
BorderBrush="#7D694E"
BorderThickness="1,1,1,0"
Background="#998468"
ClipToBounds="True">
<ScrollViewer HorizontalAlignment="Stretch"
VerticalScrollBarVisibility="Visible"
HorizontalScrollBarVisibility="Hidden"
ClipToBounds="True">
<HtmlLabel Name="HtmlView"
AutoSize="False"
AutoSizeHeightOnly="True"
Margin="4,0,4,4"
Width="750"
VerticalAlignment="Stretch" />
</ScrollViewer>
</Border>
</TabItem>
<TabItem Header="settings"
CornerRadius="0,0,8,0"
HorizontalContentAlignment="Center"
Width="95">
<Border CornerRadius="6,6,0,0"
Margin="4,0,4,0"
BorderBrush="#7D694E"
BorderThickness="1,1,1,0"
Background="#998468">
<ScrollViewer VerticalScrollBarVisibility="Visible"
HorizontalScrollBarVisibility="Hidden">
<controls:SettingsView VerticalAlignment="Stretch" />
</ScrollViewer>
</Border>
</TabItem>
</TabControl>
<Border Grid.Row="2"
Background="#A1855C"
BorderBrush="#7D694E"
BorderThickness="0,1,0,0">
<TextBlock Text="And here I would place a progress bar integrated with a button. IF I HAD ONE."
Foreground="#3E3529"
HorizontalAlignment="Center"
VerticalAlignment="Center" />
</Border>
</Grid>
</Border>
</glitonea:WindowEx>

View file

@ -0,0 +1,42 @@
using System;
using Avalonia;
using Avalonia.Controls;
using Avalonia.Controls.Html;
using Avalonia.Input;
using Avalonia.Markup.Xaml;
using PropertyChanged;
using Saradomin.Messaging;
namespace Saradomin.Views.Windows
{
[DoNotNotify]
public class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
#if DEBUG
this.AttachDevTools();
#endif
}
protected override void OnOpened(EventArgs e)
{
App.Messenger.Send(
new MainViewLoadedMessage(
this.FindControl<HtmlControl>("HtmlView")
)
);
}
private void InitializeComponent()
{
AvaloniaXamlLoader.Load(this);
}
private void TitleBar_MouseDown(object _, PointerPressedEventArgs e)
{
BeginMoveDrag(e);
}
}
}