Skip to content

Commit

Permalink
release 1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
zonetecde committed May 27, 2023
1 parent 14c37bc commit 3962ad0
Show file tree
Hide file tree
Showing 26 changed files with 1,483 additions and 21 deletions.
4 changes: 4 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[*.cs]

# CS8618: Un champ non-nullable doit contenir une valeur non-null lors de la fermeture du constructeur. Envisagez de déclarer le champ comme nullable.
dotnet_diagnostic.CS8618.severity = none
Binary file added Setup/SignaMath.exe
Binary file not shown.
65 changes: 65 additions & 0 deletions Setup/setup.iss
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!

#define MyAppName "SignaMath"
#define MyAppVersion "1.0.0"
#define MyAppPublisher "zonetecde"
#define MyAppURL "github.com/zonetecde/SignaMath"
#define MyAppExeName "SignaMath.exe"

[Setup]
; NOTE: The value of AppId uniquely identifies this application. Do not use the same AppId value in installers for other applications.
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppId={{5A9CF922-3F87-4C7F-99D3-1EB5A4F82D37}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={autopf}\{#MyAppName}
DisableProgramGroupPage=yes
; Remove the following line to run in administrative install mode (install for all users.)
PrivilegesRequired=lowest
OutputDir=E:\Cloud\OneDrive - Conseil régional Grand Est - Numérique Educatif\Programmation\c#\SignaMath\Setup
OutputBaseFilename=SignaMath
SetupIconFile=E:\Cloud\OneDrive - Conseil régional Grand Est - Numérique Educatif\Programmation\c#\SignaMath\SignaMath\assets\icon.ico
Compression=lzma
SolidCompression=yes
WizardStyle=modern
UninstallDisplayIcon={app}\{#MyAppExeName}

[Languages]
Name: "french"; MessagesFile: "compiler:Languages\French.isl"

[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}";

[Files]
Source: "E:\Cloud\OneDrive - Conseil régional Grand Est - Numérique Educatif\Programmation\c#\SignaMath\SignaMath\bin\Debug\net6.0-windows\{#MyAppExeName}"; DestDir: "{app}"; Flags: ignoreversion
Source: "E:\Cloud\OneDrive - Conseil régional Grand Est - Numérique Educatif\Programmation\c#\SignaMath\SignaMath\bin\Debug\net6.0-windows\AngouriMath.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "E:\Cloud\OneDrive - Conseil régional Grand Est - Numérique Educatif\Programmation\c#\SignaMath\SignaMath\bin\Debug\net6.0-windows\Antlr4.Runtime.Standard.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "E:\Cloud\OneDrive - Conseil régional Grand Est - Numérique Educatif\Programmation\c#\SignaMath\SignaMath\bin\Debug\net6.0-windows\GenericTensor.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "E:\Cloud\OneDrive - Conseil régional Grand Est - Numérique Educatif\Programmation\c#\SignaMath\SignaMath\bin\Debug\net6.0-windows\HonkSharp.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "E:\Cloud\OneDrive - Conseil régional Grand Est - Numérique Educatif\Programmation\c#\SignaMath\SignaMath\bin\Debug\net6.0-windows\MathNet.Numerics.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "E:\Cloud\OneDrive - Conseil régional Grand Est - Numérique Educatif\Programmation\c#\SignaMath\SignaMath\bin\Debug\net6.0-windows\Microsoft.WindowsAPICodePack.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "E:\Cloud\OneDrive - Conseil régional Grand Est - Numérique Educatif\Programmation\c#\SignaMath\SignaMath\bin\Debug\net6.0-windows\Microsoft.WindowsAPICodePack.Shell.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "E:\Cloud\OneDrive - Conseil régional Grand Est - Numérique Educatif\Programmation\c#\SignaMath\SignaMath\bin\Debug\net6.0-windows\Numbers.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "E:\Cloud\OneDrive - Conseil régional Grand Est - Numérique Educatif\Programmation\c#\SignaMath\SignaMath\bin\Debug\net6.0-windows\SignaMath.deps.json"; DestDir: "{app}"; Flags: ignoreversion
Source: "E:\Cloud\OneDrive - Conseil régional Grand Est - Numérique Educatif\Programmation\c#\SignaMath\SignaMath\bin\Debug\net6.0-windows\SignaMath.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "E:\Cloud\OneDrive - Conseil régional Grand Est - Numérique Educatif\Programmation\c#\SignaMath\SignaMath\bin\Debug\net6.0-windows\SignaMath.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "E:\Cloud\OneDrive - Conseil régional Grand Est - Numérique Educatif\Programmation\c#\SignaMath\SignaMath\bin\Debug\net6.0-windows\SignaMath.pdb"; DestDir: "{app}"; Flags: ignoreversion
Source: "E:\Cloud\OneDrive - Conseil régional Grand Est - Numérique Educatif\Programmation\c#\SignaMath\SignaMath\bin\Debug\net6.0-windows\SignaMath.runtimeconfig.json"; DestDir: "{app}"; Flags: ignoreversion
Source: "E:\Cloud\OneDrive - Conseil régional Grand Est - Numérique Educatif\Programmation\c#\SignaMath\SignaMath\bin\Debug\net6.0-windows\WpfMath.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "E:\Cloud\OneDrive - Conseil régional Grand Est - Numérique Educatif\Programmation\c#\SignaMath\SignaMath\bin\Debug\net6.0-windows\XamlMath.Shared.dll"; DestDir: "{app}"; Flags: ignoreversion
; NOTE: Don't use "Flags: ignoreversion" on any shared system files

[Icons]
Name: "{autoprograms}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
Name: "{autodesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon
Name: "{autodesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon; IconFilename: "{app}\{#MyAppExeName}"

[Run]
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent

7 changes: 6 additions & 1 deletion SignaMath.sln
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.5.33530.505
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SignaMath", "SignaMath\SignaMath.csproj", "{8645ABF3-FCA9-4899-94F9-AFE1947764B3}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SignaMath", "SignaMath\SignaMath.csproj", "{8645ABF3-FCA9-4899-94F9-AFE1947764B3}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{BE4262EB-E98C-468C-B3EA-5D632E8467D4}"
ProjectSection(SolutionItems) = preProject
.editorconfig = .editorconfig
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down
2 changes: 1 addition & 1 deletion SignaMath/App.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:SignaMath"
StartupUri="MainWindow.xaml">
StartupUri="MainWindow.xaml" DispatcherUnhandledException="Application_DispatcherUnhandledException">
<Application.Resources>

</Application.Resources>
Expand Down
10 changes: 5 additions & 5 deletions SignaMath/App.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;

namespace SignaMath
Expand All @@ -13,5 +8,10 @@ namespace SignaMath
/// </summary>
public partial class App : Application
{
private void Application_DispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e)
{
MessageBox.Show("Désolé, il y a eu une erreur!" + Environment.NewLine + e.Exception.Message + "\n" + e.Exception.StackTrace, "Erreur");
e.Handled = true;
}
}
}
28 changes: 28 additions & 0 deletions SignaMath/Classes/ColumnElement.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
using System.Collections.Generic;

namespace SignaMath.Classes
{
internal class ColumnElement
{
public ColumnElement(string expression, double value, byte position, List<int> fromRows)
{
Expression = expression;
Value = value;
Position = position;
FromRows = fromRows;
ValeurInterdite = false;
ColumnSign = '+';
}

internal string Expression { get; set; }
internal double Value { get; set; }
internal char ColumnSign { get; set; }
internal bool ValeurInterdite { get; set; }
internal byte Position { get; set; }
internal List<int> FromRows { get; set; }

internal static char LastColumnSign = '+';
internal static double IntervalleMin = double.MinValue;
internal static double IntervalleMax = double.MaxValue;
}
}
121 changes: 121 additions & 0 deletions SignaMath/Extension/Extension.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
using System;
using System.Globalization;
using System.IO;
using System.Reflection;
using System.Text.RegularExpressions;
using System.Windows;
using System.Windows.Media;
using System.Windows.Media.Imaging;

namespace SignaMath.Extension
{
internal static class Extension
{
internal static Brush PickBrush()
{
Brush result = Brushes.Transparent;

Random rnd = new Random();

Type brushesType = typeof(Brushes);

PropertyInfo[] properties = brushesType.GetProperties();

int random = rnd.Next(properties.Length);
result = (Brush)properties[random].GetValue(null, null)!;

return result;
}

internal static void WriteToPng(UIElement element, string filename)
{
var rect = new Rect(element.RenderSize);
var visual = new DrawingVisual();

using (var dc = visual.RenderOpen())
{
dc.DrawRectangle(new VisualBrush(element), null, rect);
}

var dpiX = 300; // Résolution horizontale en DPI
var dpiY = 300; // Résolution verticale en DPI

var pixelWidth = (int)(rect.Width * dpiX / 96);
var pixelHeight = (int)(rect.Height * dpiY / 96);

var bitmap = new RenderTargetBitmap(
pixelWidth, pixelHeight, dpiX, dpiY, PixelFormats.Default);
bitmap.Render(visual);

var encoder = new PngBitmapEncoder();
encoder.Frames.Add(BitmapFrame.Create(bitmap));

using (var file = File.OpenWrite(filename))
{
encoder.Save(file);
}
}

internal static double StrToDouble(string expBrute)
{
double approximation;
if (expBrute.Contains('/'))
{
// fraction toujours pas convertie
approximation = ParseDoubleFromString(expBrute);
}
else
{
approximation = double.Parse(expBrute.Replace(",", "."), CultureInfo.InvariantCulture);
}

return approximation;
}

private static double ParseDoubleFromString(string num)
{
//removes multiple spces between characters, cammas, and leading/trailing whitespace
num = Regex.Replace(num.Replace(",", ""), @"\s+", " ").Trim();
double d = 0;
int whole = 0;
double numerator;
double denominator;

//is there a fraction?
if (num.Contains("/"))
{
//is there a space?
if (num.Contains(" "))
{
//seperate the integer and fraction
int firstspace = num.IndexOf(" ");
string fraction = num.Substring(firstspace, num.Length - firstspace);
//set the integer
whole = int.Parse(num.Substring(0, firstspace));
//set the numerator and denominator
numerator = double.Parse(fraction.Split("/".ToCharArray())[0]);
denominator = double.Parse(fraction.Split("/".ToCharArray())[1]);
}
else
{
//set the numerator and denominator
numerator = double.Parse(num.Split("/".ToCharArray())[0]);
denominator = double.Parse(num.Split("/".ToCharArray())[1]);
}

//is it a valid fraction?
if (denominator != 0)
{
d = whole + numerator / denominator;
}
}
else
{
//parse the whole thing
d = double.Parse(num.Replace(" ", ""));
}

return d;
}
}
}
Loading

0 comments on commit 3962ad0

Please sign in to comment.