This commit is contained in:
unknown
2026-09-08 15:27:34 -05:00
parent 4a276e9483
commit d261a49213
35 changed files with 189 additions and 19 deletions
+1
View File
@@ -0,0 +1 @@
.vs/
+3 -2
View File
@@ -5,11 +5,12 @@ using System.Text;
namespace Core namespace Core
{ {
enum ComponentType public enum ComponentType
{ {
EQ_ADD, EQ_ADD,
EQ_SUB, EQ_SUB,
EQ_DIV, EQ_DIV,
EQ_MUL EQ_MUL,
QZ_VAR
} }
} }
+10 -4
View File
@@ -1,17 +1,18 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup> <PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.30703</ProductVersion> <ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion> <SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>b198255b-c87f-4484-9511-56c8143cad52</ProjectGuid> <ProjectGuid>{B198255B-C87F-4484-9511-56C8143CAD52}</ProjectGuid>
<OutputType>Library</OutputType> <OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder> <AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Core</RootNamespace> <RootNamespace>Core</RootNamespace>
<AssemblyName>Core</AssemblyName> <AssemblyName>Core</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion> <TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment> <FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols> <DebugSymbols>true</DebugSymbols>
@@ -21,6 +22,7 @@
<DefineConstants>DEBUG;TRACE</DefineConstants> <DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType> <DebugType>pdbonly</DebugType>
@@ -29,6 +31,7 @@
<DefineConstants>TRACE</DefineConstants> <DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="System" /> <Reference Include="System" />
@@ -40,8 +43,11 @@
<Reference Include="System.Xml" /> <Reference Include="System.Xml" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="Class1.cs" /> <Compile Include="ComponentType.cs" />
<Compile Include="IEquationComponent.cs" />
<Compile Include="Operations.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Registrate.cs" />
</ItemGroup> </ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+4 -4
View File
@@ -7,9 +7,9 @@ namespace Core
{ {
interface IEquationComponent interface IEquationComponent
{ {
public ComponentType Type { get; set; } ComponentType Type { get; set; }
public string Arg1 { get; set; } string Arg1 { get; set; }
public string Arg2 { get; set; } string Arg2 { get; set; }
public void Operate(); void Operate();
} }
} }
+88 -3
View File
@@ -7,9 +7,94 @@ namespace Core
{ {
public class Operations public class Operations
{ {
public void EquParserLoop(string equ, out float output) { public Dictionary<string, float> Variables = new Dictionary<string, float>();
if (equ != "") { output = 0.0f; }
else { output = 0.0f; } private float ResolveValue(string value)
{
// Checks if the value contains any letters
if (!value.Any(char.IsLetter))
{
float.TryParse(value, out float result);
return result;
}
else
{
Variables.TryGetValue(value, out float result);
return result;
}
}
public float ExecuteCommand(ComponentType type, string val1, string val2)
{
switch (type)
{
default: return 2;
case ComponentType.EQ_ADD:
float a = ResolveValue(val1);
float b = ResolveValue(val2);
return a + b;
case ComponentType.EQ_SUB:
float aS = ResolveValue(val1);
float bS = ResolveValue(val2);
return aS - bS;
case ComponentType.EQ_MUL:
float aM = ResolveValue(val1);
float bM = ResolveValue(val2);
return aM * bM;
case ComponentType.EQ_DIV:
float aD = ResolveValue(val1);
float bD = ResolveValue(val2);
return aD / bD;
case ComponentType.QZ_VAR:
float val = 0.0f;
float.TryParse(val2, out val);
if (Variables.ContainsKey(val1))
{
Variables[val1] = val;
}
else
{
Variables.Add(val1, val);
}
return val;
}
}
public float EquParserLoop(string equ)
{
if (equ != "")
{
string[] tokens = equ.Split(new char[] { ' ', ',' }, StringSplitOptions.RemoveEmptyEntries);
if (tokens.Length >= 3)
{
string command = tokens[0]; // "ADD" or "VAR"
string val1 = tokens[1]; // "X"
string val2 = tokens[2]; // "0" or "10"
switch (command)
{
default: return 0;
case "ADD":
Console.WriteLine("[CommandParser] Executed command ADD");
return ExecuteCommand(ComponentType.EQ_ADD, val1, val2);
case "SUB":
Console.WriteLine("[CommandParser] Executed command ADD");
return ExecuteCommand(ComponentType.EQ_SUB, val1, val2);
case "MUL":
Console.WriteLine("[CommandParser] Executed command ADD");
return ExecuteCommand(ComponentType.EQ_MUL, val1, val2);
case "DIV":
Console.WriteLine("[CommandParser] Executed command ADD");
return ExecuteCommand(ComponentType.EQ_DIV, val1, val2);
case "VAR":
Console.WriteLine("[CommandParser] Executed command ADD");
return ExecuteCommand(ComponentType.QZ_VAR, val1, val2);
}
}
else { return 0; }
}
else { return 0; }
} }
} }
} }
+1 -1
View File
@@ -5,7 +5,7 @@ using System.Text;
namespace Core namespace Core
{ {
class Class1 class Registrate
{ {
} }
} }
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,4 @@
// <autogenerated />
using System;
using System.Reflection;
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.0", FrameworkDisplayName = ".NET Framework 4")]
@@ -0,0 +1,4 @@
// <autogenerated />
using System;
using System.Reflection;
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
Binary file not shown.
@@ -0,0 +1 @@
3e45e6502454303d51fd05c670a9d135872dffc387ca9c06751f794b9bdd86b7
@@ -0,0 +1,6 @@
C:\Users\Administrator\MathApp\Core\bin\Debug\Core.dll
C:\Users\Administrator\MathApp\Core\bin\Debug\Core.pdb
C:\Users\Administrator\MathApp\Core\obj\Debug\Core.csproj.AssemblyReference.cache
C:\Users\Administrator\MathApp\Core\obj\Debug\Core.csproj.CoreCompileInputs.cache
C:\Users\Administrator\MathApp\Core\obj\Debug\Core.dll
C:\Users\Administrator\MathApp\Core\obj\Debug\Core.pdb
Binary file not shown.
Binary file not shown.
+13 -2
View File
@@ -1,8 +1,12 @@
Microsoft Visual Studio Solution File, Format Version 11.00 Microsoft Visual Studio Solution File, Format Version 12.00
# Visual C# Express 2010 # Visual Studio Version 18
VisualStudioVersion = 18.9.12112.369 stable
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MathLib", "MathLib\MathLib.csproj", "{C2B0D530-4887-4F76-9A50-6C5FF14C4F5C}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MathLib", "MathLib\MathLib.csproj", "{C2B0D530-4887-4F76-9A50-6C5FF14C4F5C}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Core", "Core\Core.csproj", "{B198255B-C87F-4484-9511-56C8143CAD52}"
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x86 = Debug|x86 Debug|x86 = Debug|x86
@@ -13,8 +17,15 @@ Global
{C2B0D530-4887-4F76-9A50-6C5FF14C4F5C}.Debug|x86.Build.0 = Debug|x86 {C2B0D530-4887-4F76-9A50-6C5FF14C4F5C}.Debug|x86.Build.0 = Debug|x86
{C2B0D530-4887-4F76-9A50-6C5FF14C4F5C}.Release|x86.ActiveCfg = Release|x86 {C2B0D530-4887-4F76-9A50-6C5FF14C4F5C}.Release|x86.ActiveCfg = Release|x86
{C2B0D530-4887-4F76-9A50-6C5FF14C4F5C}.Release|x86.Build.0 = Release|x86 {C2B0D530-4887-4F76-9A50-6C5FF14C4F5C}.Release|x86.Build.0 = Release|x86
{B198255B-C87F-4484-9511-56C8143CAD52}.Debug|x86.ActiveCfg = Debug|Any CPU
{B198255B-C87F-4484-9511-56C8143CAD52}.Debug|x86.Build.0 = Debug|Any CPU
{B198255B-C87F-4484-9511-56C8143CAD52}.Release|x86.ActiveCfg = Release|Any CPU
{B198255B-C87F-4484-9511-56C8143CAD52}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE
EndGlobalSection EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {37DEF94F-7526-48A6-B888-C240BF059B1A}
EndGlobalSection
EndGlobal EndGlobal
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup> <PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform> <Platform Condition=" '$(Platform)' == '' ">x86</Platform>
@@ -10,8 +10,9 @@
<AppDesignerFolder>Properties</AppDesignerFolder> <AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>ConsoleApplication1</RootNamespace> <RootNamespace>ConsoleApplication1</RootNamespace>
<AssemblyName>MathLib</AssemblyName> <AssemblyName>MathLib</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion> <TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<TargetFrameworkProfile>Client</TargetFrameworkProfile> <TargetFrameworkProfile>
</TargetFrameworkProfile>
<FileAlignment>512</FileAlignment> <FileAlignment>512</FileAlignment>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
@@ -23,6 +24,7 @@
<DefineConstants>DEBUG;TRACE</DefineConstants> <DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<PlatformTarget>x86</PlatformTarget> <PlatformTarget>x86</PlatformTarget>
@@ -32,6 +34,7 @@
<DefineConstants>TRACE</DefineConstants> <DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="System" /> <Reference Include="System" />
@@ -46,6 +49,15 @@
<Compile Include="Program.cs" /> <Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<None Include="app.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Core\Core.csproj">
<Project>{b198255b-c87f-4484-9511-56c8143cad52}</Project>
<Name>Core</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets. Other similar extension points exist, see Microsoft.Common.targets.
+14
View File
@@ -2,6 +2,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using Core;
namespace MathApp namespace MathApp
{ {
@@ -9,6 +10,19 @@ namespace MathApp
{ {
static void Main(string[] args) static void Main(string[] args)
{ {
Operations ops = new Operations();
Console.WriteLine("[MathLogger] System started!");
while (true)
{
Console.WriteLine("[Input] Enter an equation, using the QuikMath format: ");
string ipt = Console.ReadLine();
if (ipt != "")
{
float ot;
ot = ops.EquParserLoop(ipt);
Console.WriteLine($"[ValueOutBuffer] Result: {ot.ToString()}");
}
}
} }
} }
} }
+3
View File
@@ -0,0 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/></startup></configuration>
Binary file not shown.
Binary file not shown.
Binary file not shown.
+3
View File
@@ -0,0 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/></startup></configuration>
Binary file not shown.
@@ -0,0 +1,4 @@
// <autogenerated />
using System;
using System.Reflection;
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.0,Profile=Client", FrameworkDisplayName = ".NET Framework 4 Client Profile")]
@@ -0,0 +1,4 @@
// <autogenerated />
using System;
using System.Reflection;
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
@@ -0,0 +1 @@
1228403c1cd362b89850b9015f815de0e7abf92f5255368036881f393c4b8087
@@ -0,0 +1,10 @@
C:\Users\Administrator\MathApp\MathLib\bin\Debug\MathLib.exe.config
C:\Users\Administrator\MathApp\MathLib\bin\Debug\MathLib.exe
C:\Users\Administrator\MathApp\MathLib\bin\Debug\MathLib.pdb
C:\Users\Administrator\MathApp\MathLib\bin\Debug\Core.dll
C:\Users\Administrator\MathApp\MathLib\bin\Debug\Core.pdb
C:\Users\Administrator\MathApp\MathLib\obj\x86\Debug\MathLib.csproj.AssemblyReference.cache
C:\Users\Administrator\MathApp\MathLib\obj\x86\Debug\MathLib.csproj.CoreCompileInputs.cache
C:\Users\Administrator\MathApp\MathLib\obj\x86\Debug\MathLib.csproj.Up2Date
C:\Users\Administrator\MathApp\MathLib\obj\x86\Debug\MathLib.exe
C:\Users\Administrator\MathApp\MathLib\obj\x86\Debug\MathLib.pdb
Binary file not shown.
Binary file not shown.