Changed the assembly name to allow double-click to open in macOS
Added random number generator in JS engine.
This commit is contained in:
@@ -83,6 +83,36 @@ namespace Progrart.Core.JSExecution
|
|||||||
_obj.Set("floor", JsObject.FromObject(Engine, (object)MathFunctions.floor));
|
_obj.Set("floor", JsObject.FromObject(Engine, (object)MathFunctions.floor));
|
||||||
_obj.Set("sinh", JsObject.FromObject(Engine, (object)MathFunctions.sinh));
|
_obj.Set("sinh", JsObject.FromObject(Engine, (object)MathFunctions.sinh));
|
||||||
_obj.Set("cosh", JsObject.FromObject(Engine, (object)MathFunctions.cosh));
|
_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)
|
string formSymbol(Dictionary<string, string> symbols)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,39 +1,33 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<OutputType>WinExe</OutputType>
|
<OutputType>WinExe</OutputType><!--If you are willing to use platform-specific APIs, use conditional compilation.
|
||||||
<!--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.-->
|
See https://docs.avaloniaui.net/docs/guides/platforms/platform-specific-code/dotnet for more details.-->
|
||||||
<TargetFramework>net10.0</TargetFramework>
|
<TargetFramework>net10.0</TargetFramework>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<PublishAot>true</PublishAot>
|
<PublishAot>true</PublishAot>
|
||||||
|
<AssemblyName>ProgrartDesktop</AssemblyName>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<ApplicationManifest>app.manifest</ApplicationManifest>
|
<ApplicationManifest>app.manifest</ApplicationManifest>
|
||||||
<ApplicationIcon>progrart_app_icon.ico</ApplicationIcon>
|
<ApplicationIcon>progrart_app_icon.ico</ApplicationIcon>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Content Include="progrart_app_icon.ico" />
|
<Content Include="progrart_app_icon.ico"/>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<TrimmerRootAssembly Include="Progrart" />
|
<TrimmerRootAssembly Include="Progrart"/>
|
||||||
<TrimmerRootAssembly Include="Progrart.Core" />
|
<TrimmerRootAssembly Include="Progrart.Core"/>
|
||||||
<TrimmerRootAssembly Include="Jint" />
|
<TrimmerRootAssembly Include="Jint"/>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Avalonia.Desktop" />
|
<PackageReference Include="Avalonia.Desktop"/><!--Condition below is needed to remove Avalonia.Diagnostics package from build output in Release configuration.-->
|
||||||
<!--Condition below is needed to remove Avalonia.Diagnostics package from build output in Release configuration.-->
|
|
||||||
<PackageReference Include="Avalonia.Diagnostics">
|
<PackageReference Include="Avalonia.Diagnostics">
|
||||||
<IncludeAssets Condition="'$(Configuration)' != 'Debug'">None</IncludeAssets>
|
<IncludeAssets Condition="'$(Configuration)' != 'Debug'">None</IncludeAssets>
|
||||||
<PrivateAssets Condition="'$(Configuration)' != 'Debug'">All</PrivateAssets>
|
<PrivateAssets Condition="'$(Configuration)' != 'Debug'">All</PrivateAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="SkiaSharp.NativeAssets.Linux" />
|
<PackageReference Include="SkiaSharp.NativeAssets.Linux"/>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\Progrart\Progrart.csproj" />
|
<ProjectReference Include="..\Progrart\Progrart.csproj"/>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
Reference in New Issue
Block a user