Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 684dd1bb50 | |||
| d7f2391fe8 | |||
| 2b42f43b6e | |||
| e5cb9c2d28 |
+18
-17
@@ -2,33 +2,34 @@
|
||||
<!-- https://learn.microsoft.com/en-us/nuget/consume-packages/central-package-management -->
|
||||
<PropertyGroup>
|
||||
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
|
||||
<Version>1.0.0.0</Version>
|
||||
<Version>1.1.1.0</Version>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<!-- Avalonia packages -->
|
||||
<!-- Important: keep version in sync! -->
|
||||
<PackageVersion Include="Avalonia" Version="11.3.12" />
|
||||
<PackageVersion Include="Avalonia.AvaloniaEdit" Version="11.4.1" />
|
||||
<PackageVersion Include="Avalonia.Themes.Fluent" Version="11.3.12" />
|
||||
<PackageVersion Include="Avalonia.Fonts.Inter" Version="11.3.12" />
|
||||
<PackageVersion Include="Avalonia.Diagnostics" Version="11.3.12" />
|
||||
<PackageVersion Include="Avalonia.Desktop" Version="11.3.12" />
|
||||
<PackageVersion Include="Avalonia.iOS" Version="11.3.12" />
|
||||
<PackageVersion Include="Avalonia.Browser" Version="11.3.12" />
|
||||
<PackageVersion Include="Avalonia.Android" Version="11.3.12" />
|
||||
<PackageVersion Include="AvaloniaEdit.TextMate" Version="11.4.1" />
|
||||
<PackageVersion Include="Deadpikle.AvaloniaProgressRing" Version="0.10.11-preview20251127001" />
|
||||
<PackageVersion Include="DialogHost.Avalonia" Version="0.10.4" />
|
||||
<PackageVersion Include="Avalonia" Version="12.0.3" />
|
||||
<PackageVersion Include="Avalonia.AvaloniaEdit" Version="12.0.0" />
|
||||
<PackageVersion Include="Avalonia.Themes.Fluent" Version="12.0.3" />
|
||||
<PackageVersion Include="Avalonia.Fonts.Inter" Version="12.0.3" />
|
||||
<PackageVersion Include="AvaloniaUI.DiagnosticsSupport" Version="2.2.1" />
|
||||
<PackageVersion Include="Avalonia.Diagnostics" Version="11.3.16" />
|
||||
<PackageVersion Include="Avalonia.Desktop" Version="12.0.3" />
|
||||
<PackageVersion Include="Avalonia.iOS" Version="12.0.3" />
|
||||
<PackageVersion Include="Avalonia.Browser" Version="12.0.3" />
|
||||
<PackageVersion Include="Avalonia.Android" Version="12.0.3" />
|
||||
<PackageVersion Include="AvaloniaEdit.TextMate" Version="12.0.0" />
|
||||
<PackageVersion Include="Deadpikle.AvaloniaProgressRing" Version="0.11.0" />
|
||||
<PackageVersion Include="DialogHost.Avalonia" Version="0.12.2" />
|
||||
<PackageVersion Include="Jint" Version="4.5.0" />
|
||||
<PackageVersion Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="11.0.0-preview.1.26104.118" />
|
||||
<PackageVersion Include="Microsoft.Extensions.Configuration.Json" Version="11.0.0-preview.1.26104.118" />
|
||||
<PackageVersion Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="11.0.0-preview.4.26230.115" />
|
||||
<PackageVersion Include="Microsoft.Extensions.Configuration.Json" Version="11.0.0-preview.4.26230.115" />
|
||||
<PackageVersion Include="Microsoft.Maui.Graphics" Version="10.0.11" />
|
||||
<PackageVersion Include="Microsoft.Maui.Graphics.Skia" Version="10.0.11" />
|
||||
<PackageVersion Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.23.0" />
|
||||
<PackageVersion Include="Newtonsoft.Json" Version="13.0.4" />
|
||||
<PackageVersion Include="PanAndZoom" Version="11.3.9.1" />
|
||||
<PackageVersion Include="PanAndZoom" Version="12.0.0.1" />
|
||||
<PackageVersion Include="SkiaSharp" Version="3.116.1" />
|
||||
<PackageVersion Include="SkiaSharp.NativeAssets.Linux" Version="3.116.1" />
|
||||
<PackageVersion Include="SkiaSharp.NativeAssets.Linux" Version="4.147.0-preview.2.1" />
|
||||
<PackageVersion Include="SkiaSharp.NativeAssets.WebAssembly" Version="3.116.1" />
|
||||
<PackageVersion Include="Xamarin.AndroidX.Core.SplashScreen" Version="1.2.0.1" />
|
||||
</ItemGroup>
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
using Android.App;
|
||||
using Android.Runtime;
|
||||
using Avalonia;
|
||||
using Avalonia.Android;
|
||||
using Progrart;
|
||||
|
||||
namespace Progrart.Android
|
||||
{
|
||||
[Application]
|
||||
public class Application : AvaloniaAndroidApplication<App>
|
||||
{
|
||||
protected Application(nint javaReference, JniHandleOwnership transfer) : base(javaReference, transfer)
|
||||
{
|
||||
}
|
||||
|
||||
protected override AppBuilder CustomizeAppBuilder(AppBuilder builder)
|
||||
{
|
||||
return base.CustomizeAppBuilder(builder)
|
||||
.WithInterFont();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -12,11 +12,12 @@ namespace Progrart.Android;
|
||||
RoundIcon = "@drawable/app_icon",
|
||||
MainLauncher = true,
|
||||
ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.ScreenSize | ConfigChanges.UiMode)]
|
||||
public class MainActivity : AvaloniaMainActivity<App>
|
||||
//public class MainActivity : AvaloniaMainActivity<App>
|
||||
public class MainActivity : AvaloniaMainActivity//<App>
|
||||
{
|
||||
protected override AppBuilder CustomizeAppBuilder(AppBuilder builder)
|
||||
{
|
||||
return base.CustomizeAppBuilder(builder)
|
||||
.WithInterFont();
|
||||
}
|
||||
//protected override AppBuilder CustomizeAppBuilder(AppBuilder builder)
|
||||
//{
|
||||
// return base.CustomizeAppBuilder(builder)
|
||||
// .WithInterFont();
|
||||
//}
|
||||
}
|
||||
|
||||
@@ -11,6 +11,9 @@ internal sealed partial class Program
|
||||
App.SettingsProvider=new BrowserSettingsProvider();
|
||||
return BuildAvaloniaApp()
|
||||
.WithInterFont()
|
||||
#if DEBUG
|
||||
.WithDeveloperTools()
|
||||
#endif
|
||||
.StartBrowserAppAsync("out");
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Avalonia.Browser" />
|
||||
<PackageReference Include="SkiaSharp.NativeAssets.WebAssembly" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -83,6 +83,36 @@ namespace Progrart.Core.JSExecution
|
||||
_obj.Set("floor", JsObject.FromObject(Engine, (object)MathFunctions.floor));
|
||||
_obj.Set("sinh", JsObject.FromObject(Engine, (object)MathFunctions.sinh));
|
||||
_obj.Set("cosh", JsObject.FromObject(Engine, (object)MathFunctions.cosh));
|
||||
Engine.SetValue("random", JsObject.FromObject(Engine, (int seed) =>
|
||||
{
|
||||
var obj = new JsObject(Engine);
|
||||
Random random = new Random(seed);
|
||||
obj.Set("Next", JsObject.FromObject(Engine, () =>
|
||||
{
|
||||
return random.Next();
|
||||
}));
|
||||
obj.Set("NextMax", JsObject.FromObject(Engine, (int max) =>
|
||||
{
|
||||
return random.Next(max);
|
||||
}));
|
||||
obj.Set("NextFloat", JsObject.FromObject(Engine, () => random.NextDouble()));
|
||||
return obj;
|
||||
}));
|
||||
Engine.SetValue("random_undetermined", JsObject.FromObject(Engine, () =>
|
||||
{
|
||||
var obj = new JsObject(Engine);
|
||||
Random random = new Random();
|
||||
obj.Set("Next", JsObject.FromObject(Engine, () =>
|
||||
{
|
||||
return random.Next();
|
||||
}));
|
||||
obj.Set("NextMax", JsObject.FromObject(Engine, (int max) =>
|
||||
{
|
||||
return random.Next(max);
|
||||
}));
|
||||
obj.Set("NextFloat", JsObject.FromObject(Engine, () => random.NextDouble()));
|
||||
return obj;
|
||||
}));
|
||||
}
|
||||
string formSymbol(Dictionary<string, string> symbols)
|
||||
{
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Newtonsoft.Json;
|
||||
using System.Diagnostics;
|
||||
using Newtonsoft.Json;
|
||||
using Progrart.Core.JSExecution;
|
||||
using Progrart.Core.Storage;
|
||||
|
||||
@@ -33,7 +34,14 @@ namespace Progrart.Core.ProjectSystem
|
||||
return;
|
||||
using var reader = new StreamReader(stream);
|
||||
var img = executor.RenderImage(item.Size, reader.ReadToEnd(), args);
|
||||
var outputFile= Path.Combine(project.OutputDir, item.Target ?? item.Source + ".png");
|
||||
string outputFile;
|
||||
if (config.OutputDir != null)
|
||||
outputFile = Path.Combine(project.OutputDir, config.OutputDir ?? "", item.Target ?? item.Source + ".png");
|
||||
else
|
||||
{
|
||||
outputFile = Path.Combine(project.OutputDir, item.Target ?? item.Source + ".png");
|
||||
}
|
||||
|
||||
using var img_stream = await provider.TryOpenWrite(outputFile);
|
||||
if (img_stream is null)
|
||||
return;
|
||||
@@ -66,8 +74,15 @@ namespace Progrart.Core.ProjectSystem
|
||||
};
|
||||
|
||||
await Parallel.ForEachAsync(config.Items, options, async (item, token) =>
|
||||
{
|
||||
try
|
||||
{
|
||||
await Execute(config, item);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Trace.WriteLine(e);
|
||||
}
|
||||
|
||||
int currentCount = Interlocked.Increment(ref index);
|
||||
OnProgressUpdate?.Invoke(config.Items.Count, currentCount);
|
||||
|
||||
@@ -1,38 +1,33 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<!--If you are willing to use platform-specific APIs, use conditional compilation.
|
||||
<OutputType>WinExe</OutputType><!--If you are willing to use platform-specific APIs, use conditional compilation.
|
||||
See https://docs.avaloniaui.net/docs/guides/platforms/platform-specific-code/dotnet for more details.-->
|
||||
<TargetFramework>net10.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<PublishAot>true</PublishAot>
|
||||
<AssemblyName>ProgrartDesktop</AssemblyName>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<ApplicationManifest>app.manifest</ApplicationManifest>
|
||||
<ApplicationIcon>progrart_app_icon.ico</ApplicationIcon>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Include="progrart_app_icon.ico"/>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<TrimmerRootAssembly Include="Progrart"/>
|
||||
<TrimmerRootAssembly Include="Progrart.Core"/>
|
||||
<TrimmerRootAssembly Include="Jint"/>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Avalonia.Desktop" />
|
||||
<!--Condition below is needed to remove Avalonia.Diagnostics package from build output in Release configuration.-->
|
||||
<PackageReference Include="Avalonia.Diagnostics">
|
||||
<PackageReference Include="Avalonia.Desktop"/><!--Condition below is needed to remove Avalonia.Diagnostics package from build output in Release configuration.-->
|
||||
|
||||
<PackageReference Include="AvaloniaUI.DiagnosticsSupport" >
|
||||
<IncludeAssets Condition="'$(Configuration)' != 'Debug'">None</IncludeAssets>
|
||||
<PrivateAssets Condition="'$(Configuration)' != 'Debug'">All</PrivateAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="SkiaSharp.NativeAssets.Linux"/>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Progrart\Progrart.csproj"/>
|
||||
</ItemGroup>
|
||||
|
||||
+12
-12
@@ -84,7 +84,7 @@ public partial class App : Application
|
||||
// Avoid duplicate validations from both Avalonia and the CommunityToolkit.
|
||||
// More info: https://docs.avaloniaui.net/docs/guides/development-guides/data-validation#manage-validationplugins
|
||||
isDesktop = true;
|
||||
DisableAvaloniaDataAnnotationValidation();
|
||||
//DisableAvaloniaDataAnnotationValidation();
|
||||
desktop.MainWindow = new MainWindow();
|
||||
}
|
||||
else if (ApplicationLifetime is ISingleViewApplicationLifetime singleViewPlatform)
|
||||
@@ -95,16 +95,16 @@ public partial class App : Application
|
||||
base.OnFrameworkInitializationCompleted();
|
||||
}
|
||||
|
||||
private void DisableAvaloniaDataAnnotationValidation()
|
||||
{
|
||||
// Get an array of plugins to remove
|
||||
var dataValidationPluginsToRemove =
|
||||
BindingPlugins.DataValidators.OfType<DataAnnotationsValidationPlugin>().ToArray();
|
||||
//private void DisableAvaloniaDataAnnotationValidation()
|
||||
//{
|
||||
// // Get an array of plugins to remove
|
||||
// var dataValidationPluginsToRemove =
|
||||
// BindingPlugins.DataValidators.OfType<DataAnnotationsValidationPlugin>().ToArray();
|
||||
|
||||
// remove each entry found
|
||||
foreach (var plugin in dataValidationPluginsToRemove)
|
||||
{
|
||||
BindingPlugins.DataValidators.Remove(plugin);
|
||||
}
|
||||
}
|
||||
// // remove each entry found
|
||||
// foreach (var plugin in dataValidationPluginsToRemove)
|
||||
// {
|
||||
// BindingPlugins.DataValidators.Remove(plugin);
|
||||
// }
|
||||
//}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
using Avalonia.Platform.Storage;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
@@ -35,6 +36,12 @@ namespace Progrart.Core.Storage
|
||||
{
|
||||
return await file.OpenWriteAsync();
|
||||
}
|
||||
var parentPath = Path.GetDirectoryName(path);
|
||||
if (parentPath is not null)
|
||||
if ((await baseFolder.GetFolderAsync(parentPath)) == null)
|
||||
{
|
||||
await baseFolder.CreateFolderAsync(parentPath);
|
||||
}
|
||||
file = await baseFolder.CreateFileAsync(path);
|
||||
if (file is not null)
|
||||
return await file.OpenWriteAsync();
|
||||
|
||||
@@ -202,7 +202,6 @@ public partial class ProgrartEditorPage : UserControl, ITabPage, IEditorPage
|
||||
{
|
||||
if (LayoutButtonV.IsChecked == true)
|
||||
{
|
||||
|
||||
direction = LayoutDirection.Vertical;
|
||||
ApplyLayout();
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
<PackageReference Include="Avalonia.Themes.Fluent" />
|
||||
<PackageReference Include="Avalonia.Fonts.Inter" />
|
||||
<!--Condition below is needed to remove Avalonia.Diagnostics package from build output in Release configuration.-->
|
||||
<PackageReference Include="Avalonia.Diagnostics">
|
||||
<PackageReference Include="AvaloniaUI.DiagnosticsSupport">
|
||||
<IncludeAssets Condition="'$(Configuration)' != 'Debug'">None</IncludeAssets>
|
||||
<PrivateAssets Condition="'$(Configuration)' != 'Debug'">All</PrivateAssets>
|
||||
</PackageReference>
|
||||
|
||||
@@ -274,7 +274,16 @@ public partial class MainView : UserControl
|
||||
{
|
||||
if (App.LoadedProject is not null)
|
||||
{
|
||||
Builder builder = new Builder(App.LoadedProject, new AvaloniaStorageProvider(App.CurrentOpenFolder));
|
||||
Builder builder;
|
||||
|
||||
var localPath = App.CurrentOpenFolder?.TryGetLocalPath();
|
||||
if (localPath != null)
|
||||
{
|
||||
builder = new Builder(App.LoadedProject, new ClassicStorageProvider(new DirectoryInfo(localPath)));
|
||||
}
|
||||
else
|
||||
builder = new Builder(App.LoadedProject, new AvaloniaStorageProvider(App.CurrentOpenFolder));
|
||||
|
||||
var config = App.LoadedProject.Configurations[ConfigBox.SelectedIndex];
|
||||
var name = config.Name;
|
||||
if (config is null) return;
|
||||
|
||||
@@ -8,7 +8,8 @@ public partial class MainWindow : Window
|
||||
{
|
||||
InitializeComponent();
|
||||
this.ExtendClientAreaToDecorationsHint = true;
|
||||
this.ExtendClientAreaChromeHints = Avalonia.Platform.ExtendClientAreaChromeHints.PreferSystemChrome;
|
||||
//this.WindowDecorations= WindowDecorations.
|
||||
//this.ExtendClientAreaChromeHints = Avalonia.Platform.ExtendClientAreaChromeHints.PreferSystemChrome;
|
||||
this.Closing += MainWindow_Closing;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user