-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8fd4120
commit f42dcf6
Showing
36 changed files
with
467 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio Version 17 | ||
VisualStudioVersion = 17.2.32516.85 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BrennCode", "BrennCode\BrennCode.csproj", "{9E3A42D3-8BC2-4905-ACE8-5B13BB28CB1F}" | ||
EndProject | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestApp", "TestApp\TestApp.csproj", "{EA26CF40-DF2F-4836-AC8C-BA83C6E39752}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Debug|x64 = Debug|x64 | ||
Release|Any CPU = Release|Any CPU | ||
Release|x64 = Release|x64 | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{9E3A42D3-8BC2-4905-ACE8-5B13BB28CB1F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{9E3A42D3-8BC2-4905-ACE8-5B13BB28CB1F}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{9E3A42D3-8BC2-4905-ACE8-5B13BB28CB1F}.Debug|x64.ActiveCfg = Debug|x64 | ||
{9E3A42D3-8BC2-4905-ACE8-5B13BB28CB1F}.Debug|x64.Build.0 = Debug|x64 | ||
{9E3A42D3-8BC2-4905-ACE8-5B13BB28CB1F}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{9E3A42D3-8BC2-4905-ACE8-5B13BB28CB1F}.Release|Any CPU.Build.0 = Release|Any CPU | ||
{9E3A42D3-8BC2-4905-ACE8-5B13BB28CB1F}.Release|x64.ActiveCfg = Release|x64 | ||
{9E3A42D3-8BC2-4905-ACE8-5B13BB28CB1F}.Release|x64.Build.0 = Release|x64 | ||
{EA26CF40-DF2F-4836-AC8C-BA83C6E39752}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{EA26CF40-DF2F-4836-AC8C-BA83C6E39752}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{EA26CF40-DF2F-4836-AC8C-BA83C6E39752}.Debug|x64.ActiveCfg = Debug|Any CPU | ||
{EA26CF40-DF2F-4836-AC8C-BA83C6E39752}.Debug|x64.Build.0 = Debug|Any CPU | ||
{EA26CF40-DF2F-4836-AC8C-BA83C6E39752}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{EA26CF40-DF2F-4836-AC8C-BA83C6E39752}.Release|Any CPU.Build.0 = Release|Any CPU | ||
{EA26CF40-DF2F-4836-AC8C-BA83C6E39752}.Release|x64.ActiveCfg = Release|Any CPU | ||
{EA26CF40-DF2F-4836-AC8C-BA83C6E39752}.Release|x64.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {1071825F-22DA-422A-A2EC-401B5FD7544A} | ||
EndGlobalSection | ||
EndGlobal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using System.Text.RegularExpressions; | ||
|
||
namespace BrennCode | ||
{ | ||
public class BMath | ||
{ | ||
/// <summary> | ||
/// Add 2 string numbers | ||
/// <br/> If you put something like a point or a letter (Anything it will give you the wrong result) | ||
/// </summary> | ||
/// <param name="n1">First number to add</param> | ||
/// <param name="n2">Second number to add</param> | ||
/// <returns>Returns string</returns> | ||
public static string Add(string n1, string n2) | ||
{ | ||
if (!n1.Contains(".") || !n2.Contains(".")) | ||
{ | ||
// basic sum operation | ||
return StringAdder(n1, n2); | ||
} | ||
else | ||
{ | ||
var Numbers = EqualNumbers(n1, n2); | ||
string[] n1Split = n1.Split('.'); | ||
string[] n2Split = n2.Split('.'); | ||
|
||
return StringAdder(n1Split[0], n2Split[0]) + "." + StringAdder(n1Split[1], n2Split[1]); | ||
} | ||
} | ||
|
||
private static string StringAdder(string n1, string n2) | ||
{ | ||
string[] n1Array = n1.Split(); | ||
string[] n2Array = n2.Split(); | ||
string[] resultArray = { }; | ||
for (int i = 0; i < n1Array.Length; i++) | ||
{ | ||
Int64 n1Parsed; | ||
bool n1Illegal = Int64.TryParse(n1Array[i], out n1Parsed); | ||
Int64 n2Parsed; | ||
bool n2Illegal = Int64.TryParse(n2Array[i], out n2Parsed); | ||
Int64 result = n1Parsed + n2Parsed; | ||
string[] resultStr = { result.ToString() }; | ||
resultArray = resultArray.Concat(resultStr).ToArray(); | ||
if (!n1Illegal || !n2Illegal) | ||
return "0"; | ||
} | ||
return String.Join("", resultArray); | ||
} | ||
private static (string n1Out, string n2Out, int bp) EqualNumbers(string n1, string n2) | ||
{ | ||
if (n1.Length > n2.Length) | ||
{ | ||
string b2 = n2.PadLeft(n1.Length, '0'); | ||
return (b2, n1, 1); | ||
} | ||
else if (n1.Length < n2.Length) | ||
{ | ||
string a2 = n1.PadLeft(n2.Length, '0'); | ||
return (n1, a2, 2); | ||
} | ||
else | ||
{ | ||
return (n1, n2, 0); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> | ||
<PropertyGroup> | ||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
<ProjectGuid>{9E3A42D3-8BC2-4905-ACE8-5B13BB28CB1F}</ProjectGuid> | ||
<OutputType>Library</OutputType> | ||
<AppDesignerFolder>Properties</AppDesignerFolder> | ||
<RootNamespace>BrennCode</RootNamespace> | ||
<AssemblyName>BrennCode</AssemblyName> | ||
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion> | ||
<FileAlignment>512</FileAlignment> | ||
<Deterministic>true</Deterministic> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
<DebugSymbols>true</DebugSymbols> | ||
<DebugType>full</DebugType> | ||
<Optimize>false</Optimize> | ||
<OutputPath>bin\Debug\</OutputPath> | ||
<DefineConstants>DEBUG;TRACE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||
<DebugType>pdbonly</DebugType> | ||
<Optimize>true</Optimize> | ||
<OutputPath>bin\Release\</OutputPath> | ||
<DefineConstants>TRACE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
</PropertyGroup> | ||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'"> | ||
<DebugSymbols>true</DebugSymbols> | ||
<OutputPath>bin\x64\Debug\</OutputPath> | ||
<DefineConstants>DEBUG;TRACE</DefineConstants> | ||
<DebugType>full</DebugType> | ||
<PlatformTarget>x64</PlatformTarget> | ||
<LangVersion>7.3</LangVersion> | ||
<ErrorReport>prompt</ErrorReport> | ||
</PropertyGroup> | ||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'"> | ||
<OutputPath>bin\x64\Release\</OutputPath> | ||
<DefineConstants>TRACE</DefineConstants> | ||
<Optimize>true</Optimize> | ||
<DebugType>pdbonly</DebugType> | ||
<PlatformTarget>x64</PlatformTarget> | ||
<LangVersion>7.3</LangVersion> | ||
<ErrorReport>prompt</ErrorReport> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Reference Include="System" /> | ||
<Reference Include="System.Core" /> | ||
<Reference Include="System.Xml.Linq" /> | ||
<Reference Include="System.Data.DataSetExtensions" /> | ||
<Reference Include="Microsoft.CSharp" /> | ||
<Reference Include="System.Data" /> | ||
<Reference Include="System.Net.Http" /> | ||
<Reference Include="System.Xml" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Compile Include="ColorfulConsole.cs" /> | ||
<Compile Include="Info.cs" /> | ||
<Compile Include="BMath.cs" /> | ||
<Compile Include="Properties\AssemblyInfo.cs" /> | ||
</ItemGroup> | ||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Runtime.InteropServices; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace BrennCode | ||
{ | ||
public class ColorfulConsole | ||
{ | ||
[DllImport("kernel32.dll", SetLastError = true)] | ||
public static extern bool SetConsoleMode(IntPtr hConsoleHandle, int mode); | ||
|
||
[DllImport("kernel32.dll", SetLastError = true)] | ||
public static extern bool GetConsoleMode(IntPtr handle, out int mode); | ||
|
||
|
||
[DllImport("kernel32.dll", SetLastError = true)] | ||
public static extern IntPtr GetStdHandle(int handle); | ||
|
||
/// <summary> | ||
/// Write a line with your RGB color (0-255), Maybe i add a HEX method soon | ||
/// </summary> | ||
/// <param name="text">Your text</param> | ||
/// <param name="r">Red</param> | ||
/// <param name="g">Green</param> | ||
/// <param name="b">Blue</param> | ||
public static void WriteLine(string text, int r, int g, int b) | ||
{ | ||
var handle = GetStdHandle(-11); | ||
int mode; | ||
GetConsoleMode(handle, out mode); | ||
SetConsoleMode(handle, mode | 0x4); | ||
|
||
Console.WriteLine("\x1b[38;2;" + r + ";" + g + ";" + b + "m" + text); | ||
} | ||
public static void Write(string text, int r, int g, int b) | ||
{ | ||
var handle = GetStdHandle(-11); | ||
int mode; | ||
GetConsoleMode(handle, out mode); | ||
SetConsoleMode(handle, mode | 0x4); | ||
|
||
Console.Write("\x1b[38;2;" + r + ";" + g + ";" + b + "m" + text); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace BrennCode | ||
{ | ||
public class Info | ||
{ | ||
/// <summary> | ||
/// Shows in the console a message about BrennCode | ||
/// </summary> | ||
public static void About() | ||
{ | ||
ConsoleColor color = Console.ForegroundColor; | ||
Console.ForegroundColor = ConsoleColor.Green; | ||
|
||
Console.WriteLine("This program is using BrennCode!"); | ||
Console.WriteLine("BrennCode, or BC is a billboard that offers resources for console and WinForms apps"); | ||
Console.WriteLine("Resources offered:"); | ||
Console.WriteLine("MUUUCH More precise math (but slower for complex operations and support only strings)"); | ||
Console.WriteLine("RGB Write & WriteLine for Console apps"); | ||
Console.WriteLine("---DEVELOPED BY BRENNOMATURINO1---"); | ||
Console.WriteLine("GIVE ME IDEAS ON GITHUB!"); | ||
Console.WriteLine("github.com/BrennoMaturino1/BrennCode"); | ||
|
||
Console.ForegroundColor = color; | ||
} | ||
public static void ChangeLog() | ||
{ | ||
ConsoleColor color = Console.ForegroundColor; | ||
Console.ForegroundColor = ConsoleColor.Green; | ||
|
||
Console.WriteLine("Renamed Math to BMath to avoid conflicts"); | ||
Console.WriteLine("BMath.Add updated, now it supports integers AND decimals"); | ||
Console.WriteLine("-"); | ||
Console.WriteLine("-"); | ||
Console.WriteLine("-"); | ||
Console.WriteLine("---DEVELOPED BY BRENNOMATURINO1---"); | ||
Console.WriteLine("GIVE ME IDEAS ON GITHUB!"); | ||
Console.WriteLine("github.com/BrennoMaturino1/BrennCode"); | ||
|
||
Console.ForegroundColor = color; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
using System.Reflection; | ||
using System.Runtime.CompilerServices; | ||
using System.Runtime.InteropServices; | ||
|
||
// As informações gerais sobre um assembly são controladas por | ||
// conjunto de atributos. Altere estes valores de atributo para modificar as informações | ||
// associada a um assembly. | ||
[assembly: AssemblyTitle("BrennCode")] | ||
[assembly: AssemblyDescription("")] | ||
[assembly: AssemblyConfiguration("")] | ||
[assembly: AssemblyCompany("")] | ||
[assembly: AssemblyProduct("BrennCode")] | ||
[assembly: AssemblyCopyright("Copyright © 2022")] | ||
[assembly: AssemblyTrademark("")] | ||
[assembly: AssemblyCulture("")] | ||
|
||
// Definir ComVisible como false torna os tipos neste assembly invisíveis | ||
// para componentes COM. Caso precise acessar um tipo neste assembly de | ||
// COM, defina o atributo ComVisible como true nesse tipo. | ||
[assembly: ComVisible(false)] | ||
|
||
// O GUID a seguir será destinado à ID de typelib se este projeto for exposto para COM | ||
[assembly: Guid("9e3a42d3-8bc2-4905-ace8-5b13bb28cb1f")] | ||
|
||
// As informações da versão de um assembly consistem nos quatro valores a seguir: | ||
// | ||
// Versão Principal | ||
// Versão Secundária | ||
// Número da Versão | ||
// Revisão | ||
// | ||
// É possível especificar todos os valores ou usar como padrão os Números de Build e da Revisão | ||
// usando o "*" como mostrado abaixo: | ||
// [assembly: AssemblyVersion("1.0.*")] | ||
[assembly: AssemblyVersion("1.0.0.0")] | ||
[assembly: AssemblyFileVersion("1.0.0.0")] |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+3.97 KB
BrennCode/BrennCode/obj/Debug/BrennCode.csproj.AssemblyReference.cache
Binary file not shown.
Empty file.
Binary file added
BIN
+6.52 KB
BrennCode/BrennCode/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache
Binary file not shown.
Binary file added
BIN
+3.97 KB
BrennCode/BrennCode/obj/x64/Debug/BrennCode.csproj.AssemblyReference.cache
Binary file not shown.
1 change: 1 addition & 0 deletions
1
BrennCode/BrennCode/obj/x64/Debug/BrennCode.csproj.CoreCompileInputs.cache
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
cc788d70ef9d8a3db504887e269c376042c0e7fa |
6 changes: 6 additions & 0 deletions
6
BrennCode/BrennCode/obj/x64/Debug/BrennCode.csproj.FileListAbsolute.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
C:\Users\c0nta\source\repos\BrennCode\BrennCode\bin\x64\Debug\BrennCode.dll | ||
C:\Users\c0nta\source\repos\BrennCode\BrennCode\bin\x64\Debug\BrennCode.pdb | ||
C:\Users\c0nta\source\repos\BrennCode\BrennCode\obj\x64\Debug\BrennCode.csproj.AssemblyReference.cache | ||
C:\Users\c0nta\source\repos\BrennCode\BrennCode\obj\x64\Debug\BrennCode.csproj.CoreCompileInputs.cache | ||
C:\Users\c0nta\source\repos\BrennCode\BrennCode\obj\x64\Debug\BrennCode.dll | ||
C:\Users\c0nta\source\repos\BrennCode\BrennCode\obj\x64\Debug\BrennCode.pdb |
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+6.52 KB
BrennCode/BrennCode/obj/x64/Debug/DesignTimeResolveAssemblyReferencesInput.cache
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<configuration> | ||
<startup> | ||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" /> | ||
</startup> | ||
</configuration> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Diagnostics; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using BrennCode; | ||
namespace TestApp | ||
{ | ||
internal class Program | ||
{ | ||
static void Main(string[] args) | ||
{ | ||
Info.About(); | ||
Info.ChangeLog(); | ||
ColorfulConsole.WriteLine("hello world", 50, 255, 255); | ||
ColorfulConsole.Write("hello ", 255, 0, 0); | ||
ColorfulConsole.Write("wor", 0, 255, 0); | ||
ColorfulConsole.WriteLine("ld", 0, 0, 255); | ||
Console.ForegroundColor = ConsoleColor.Green; | ||
Console.WriteLine(BMath.Add("1.0", "1.5")); | ||
|
||
Console.ReadKey(); | ||
} | ||
} | ||
} |
Oops, something went wrong.