From 83c9cc03bd9c55fd7f4875f9457bf0ec12d667de Mon Sep 17 00:00:00 2001 From: Yisus Date: Sun, 30 Jul 2023 08:39:38 -0400 Subject: [PATCH 01/11] new project structure --- .gitignore | 455 ++++++++++++++++++++++++++++++- Term.sln | 22 ++ Term.csproj => term/Term.csproj | 0 {src => term}/TermInterpreter.cs | 0 4 files changed, 473 insertions(+), 4 deletions(-) create mode 100644 Term.sln rename Term.csproj => term/Term.csproj (100%) rename {src => term}/TermInterpreter.cs (100%) diff --git a/.gitignore b/.gitignore index da5d558..5f6f789 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,452 @@ -# Folders -obj/ -bin/ +# folders test/ -.vscode/ \ No newline at end of file + +# User-specific files +*.rsuser +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Mono auto generated files +mono_crash.* + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +[Ww][Ii][Nn]32/ +[Aa][Rr][Mm]/ +[Aa][Rr][Mm]64/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ +[Ll]ogs/ + +# Visual Studio 2015/2017 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# Visual Studio 2017 auto generated files +Generated\ Files/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUnit +*.VisualState.xml +TestResult.xml +nunit-*.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# Benchmark Results +BenchmarkDotNet.Artifacts/ + +# .NET +project.lock.json +project.fragment.lock.json +artifacts/ + +# Tye +.tye/ + +# ASP.NET Scaffolding +ScaffoldingReadMe.txt + +# StyleCop +StyleCopReport.xml + +# Files built by Visual Studio +*_i.c +*_p.c +*_h.h +*.ilk +*.meta +*.obj +*.iobj +*.pch +*.pdb +*.ipdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*_wpftmp.csproj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# Visual Studio Trace Files +*.e2e + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# AxoCover is a Code Coverage Tool +.axoCover/* +!.axoCover/settings.json + +# Coverlet is a free, cross platform Code Coverage Tool +coverage*.json +coverage*.xml +coverage*.info + +# Visual Studio code coverage results +*.coverage +*.coveragexml + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# Note: Comment the next line if you want to checkin your web deploy settings, +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# NuGet Symbol Packages +*.snupkg +# The packages folder can be ignored because of Package Restore +**/[Pp]ackages/* +# except build/, which is used as an MSBuild target. +!**/[Pp]ackages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/[Pp]ackages/repositories.config +# NuGet v3's project.json files produces more ignorable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt +*.appx +*.appxbundle +*.appxupload + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!?*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.jfm +*.pfx +*.publishsettings +orleans.codegen.cs + +# Including strong name files can present a security risk +# (https://github.com/github/gitignore/pull/2483#issue-259490424) +#*.snk + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm +ServiceFabricBackup/ +*.rptproj.bak + +# SQL Server files +*.mdf +*.ldf +*.ndf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings +*.rptproj.rsuser +*- [Bb]ackup.rdl +*- [Bb]ackup ([0-9]).rdl +*- [Bb]ackup ([0-9][0-9]).rdl + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat +node_modules/ + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) +*.vbw + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# CodeRush personal settings +.cr/personal + +# Python Tools for Visual Studio (PTVS) +__pycache__/ +*.pyc + +# Cake - Uncomment if you are using it +# tools/** +# !tools/packages.config + +# Tabs Studio +*.tss + +# Telerik's JustMock configuration file +*.jmconfig + +# BizTalk build output +*.btp.cs +*.btm.cs +*.odx.cs +*.xsd.cs + +# OpenCover UI analysis results +OpenCover/ + +# Azure Stream Analytics local run output +ASALocalRun/ + +# MSBuild Binary and Structured Log +*.binlog + +# NVidia Nsight GPU debugger configuration file +*.nvuser + +# MFractors (Xamarin productivity tool) working folder +.mfractor/ + +# Local History for Visual Studio +.localhistory/ + +# BeatPulse healthcheck temp database +healthchecksdb + +# Backup folder for Package Reference Convert tool in Visual Studio 2017 +MigrationBackup/ + +# Ionide (cross platform F# VS Code tools) working folder +.ionide/ + +# Fody - auto-generated XML schema +FodyWeavers.xsd + +## +## Visual studio for Mac +## + + +# globs +Makefile.in +*.userprefs +*.usertasks +config.make +config.status +aclocal.m4 +install-sh +autom4te.cache/ +*.tar.gz +tarballs/ +test-results/ + +# Mac bundle stuff +*.dmg +*.app + +# content below from: https://github.com/github/gitignore/blob/master/Global/macOS.gitignore +# General +.DS_Store +.AppleDouble +.LSOverride + +# Icon must end with two \r +Icon + + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + +# content below from: https://github.com/github/gitignore/blob/master/Global/Windows.gitignore +# Windows thumbnail cache files +Thumbs.db +ehthumbs.db +ehthumbs_vista.db + +# Dump file +*.stackdump + +# Folder config file +[Dd]esktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Windows Installer files +*.cab +*.msi +*.msix +*.msm +*.msp + +# Windows shortcuts +*.lnk + +# JetBrains Rider +.idea/ +*.sln.iml + +## +## Visual Studio Code +## +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json diff --git a/Term.sln b/Term.sln new file mode 100644 index 0000000..2e934fb --- /dev/null +++ b/Term.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Term", "term\Term.csproj", "{177DC6C6-EC4A-4B65-A6A5-794ED6818593}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {177DC6C6-EC4A-4B65-A6A5-794ED6818593}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {177DC6C6-EC4A-4B65-A6A5-794ED6818593}.Debug|Any CPU.Build.0 = Debug|Any CPU + {177DC6C6-EC4A-4B65-A6A5-794ED6818593}.Release|Any CPU.ActiveCfg = Release|Any CPU + {177DC6C6-EC4A-4B65-A6A5-794ED6818593}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/Term.csproj b/term/Term.csproj similarity index 100% rename from Term.csproj rename to term/Term.csproj diff --git a/src/TermInterpreter.cs b/term/TermInterpreter.cs similarity index 100% rename from src/TermInterpreter.cs rename to term/TermInterpreter.cs From 79166c989c248bf42ac3bae76140724d1436efae Mon Sep 17 00:00:00 2001 From: Yisus Date: Sun, 30 Jul 2023 08:48:40 -0400 Subject: [PATCH 02/11] some fixes in readme --- README.md | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index cb082bd..7248f91 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@

Save configs in text files and use them in C#!

-**Term** is a simle interpreter that can convert key-value pairs defined in text to C# dictionaries. +**Term** is a simple interpreter that can convert key-value pairs defined in text to C# dictionaries. ***You can find here:*** 1. [Setup](#1-setup) @@ -108,11 +108,10 @@ The interpreter itself. It's important that these `configs` are declared on a **single line**, otherwhise it can cause errors. - `string` values don't need to be surrounded by `""`. - ### Important aspects: 1. Any empty line found in the `Term` file is going to be ignored by the `Interpreter`. - 2. The keys name should be using `snake_case`. + 2. The keys should be named using `snake_case`. + 3. `string` values don't need to be surrounded by `""`. ---------- @@ -165,7 +164,7 @@ In my case, It will be something like this: ```csharp string path = Path.GetFullPath("test.term"); ``` -> Note: This is inside of the `C#`'s `Main` method. +> Note: This is inside of `C#`'s `Main` method. We call `Path.GetFullPath` and we pass in the path to our `Term` file, relative to the project's folder. > Remember: The file structure in this example is like [this](#file-structure). From d80674e378889ac1e6a270ce87b7bcb12d07b4bc Mon Sep 17 00:00:00 2001 From: Yisus Date: Sun, 30 Jul 2023 10:08:41 -0400 Subject: [PATCH 03/11] term project changed & changes to solution --- Term.sln | 6 ++++++ term/Term.csproj | 7 ------- term/TermInterpreter.cs | 20 +++++++++----------- 3 files changed, 15 insertions(+), 18 deletions(-) diff --git a/Term.sln b/Term.sln index 2e934fb..158e9ea 100644 --- a/Term.sln +++ b/Term.sln @@ -5,6 +5,8 @@ VisualStudioVersion = 16.0.30114.105 MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Term", "term\Term.csproj", "{177DC6C6-EC4A-4B65-A6A5-794ED6818593}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "test", "test\test.csproj", "{0115E4B5-0443-4385-8C7F-D0923B6DDBC6}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -18,5 +20,9 @@ Global {177DC6C6-EC4A-4B65-A6A5-794ED6818593}.Debug|Any CPU.Build.0 = Debug|Any CPU {177DC6C6-EC4A-4B65-A6A5-794ED6818593}.Release|Any CPU.ActiveCfg = Release|Any CPU {177DC6C6-EC4A-4B65-A6A5-794ED6818593}.Release|Any CPU.Build.0 = Release|Any CPU + {0115E4B5-0443-4385-8C7F-D0923B6DDBC6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0115E4B5-0443-4385-8C7F-D0923B6DDBC6}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0115E4B5-0443-4385-8C7F-D0923B6DDBC6}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0115E4B5-0443-4385-8C7F-D0923B6DDBC6}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection EndGlobal diff --git a/term/Term.csproj b/term/Term.csproj index 373691a..132c02c 100644 --- a/term/Term.csproj +++ b/term/Term.csproj @@ -6,11 +6,4 @@ enable - - - - - - - diff --git a/term/TermInterpreter.cs b/term/TermInterpreter.cs index 32e7153..28182f7 100644 --- a/term/TermInterpreter.cs +++ b/term/TermInterpreter.cs @@ -5,17 +5,15 @@ namespace Term; public static class TermInterpreter { - /** - - Interpret a TERM config file. - - - The path to the file that will be interpreted. - - - A Dictionary containing the keys and values in the interpreted file. - - */ + /// + /// Interpret a TERM config file. + /// + /// + /// The path to the file that will be interpreted. + /// + /// + /// A Dictionary containing the keys and values in the interpreted file. + /// public static Dictionary Interpret(string path) { Dictionary result = new Dictionary(); From 1231a5453a9c293e66f2390abe89ee4a4b81f568 Mon Sep 17 00:00:00 2001 From: Yisus Date: Sun, 30 Jul 2023 11:19:55 -0400 Subject: [PATCH 04/11] writing to term files --- term/TermInterpreter.cs | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/term/TermInterpreter.cs b/term/TermInterpreter.cs index 28182f7..c603097 100644 --- a/term/TermInterpreter.cs +++ b/term/TermInterpreter.cs @@ -33,4 +33,31 @@ public static Dictionary Interpret(string path) } return result; } + + public static void WriteToFile(string path, Dictionary termContent, bool replaceContent = true) + { + if (!File.Exists(path)) + { + throw new FileNotFoundException("File " + path + " does not exist."); + } + + string fileContent = File.ReadAllText(path); + string newData = ""; + + foreach (string key in termContent.Keys) + { + string keyFormat = key.Trim().ToLower().Replace(' ', '_'); + + newData += keyFormat + " -> " + termContent[key] + "\n"; + } + + if (replaceContent) + { + File.WriteAllText(path, newData, System.Text.Encoding.UTF8); + } + else + { + File.AppendAllText(path, "\n\n# Written from C#:\n" + newData, System.Text.Encoding.UTF8); + } + } } From f415433f361e11d8f250929f3d9baa01f201e20b Mon Sep 17 00:00:00 2001 From: Yisus Date: Sun, 30 Jul 2023 11:44:35 -0400 Subject: [PATCH 05/11] docs written --- term/TermInterpreter.cs | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/term/TermInterpreter.cs b/term/TermInterpreter.cs index c603097..0679729 100644 --- a/term/TermInterpreter.cs +++ b/term/TermInterpreter.cs @@ -34,6 +34,33 @@ public static Dictionary Interpret(string path) return result; } + /// + /// Writes a into a term file. + ///
+ /// It automatically generates + /// based on the dictionary provided. + ///
+ /// The method will also format correctly any key in + /// the dictionary. + /// So if the dictionary contains a key named + /// "" it will be formatted to + /// "" before writing + /// it to the file. + ///
+ /// + /// The path to the term file to write into. + /// + /// + /// The content that will be written in the file. + /// + /// + /// If , replace all the contents in + /// the term file. + ///
+ /// if , append all the contents to + /// the end of the file with a comment + /// "" + /// public static void WriteToFile(string path, Dictionary termContent, bool replaceContent = true) { if (!File.Exists(path)) From d4f9b2a11cea826c5ec81f87d2eb27b622d9c72e Mon Sep 17 00:00:00 2001 From: Yisus Date: Sun, 30 Jul 2023 12:03:00 -0400 Subject: [PATCH 06/11] updated solution --- Term.sln | 6 ------ 1 file changed, 6 deletions(-) diff --git a/Term.sln b/Term.sln index 158e9ea..2e934fb 100644 --- a/Term.sln +++ b/Term.sln @@ -5,8 +5,6 @@ VisualStudioVersion = 16.0.30114.105 MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Term", "term\Term.csproj", "{177DC6C6-EC4A-4B65-A6A5-794ED6818593}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "test", "test\test.csproj", "{0115E4B5-0443-4385-8C7F-D0923B6DDBC6}" -EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -20,9 +18,5 @@ Global {177DC6C6-EC4A-4B65-A6A5-794ED6818593}.Debug|Any CPU.Build.0 = Debug|Any CPU {177DC6C6-EC4A-4B65-A6A5-794ED6818593}.Release|Any CPU.ActiveCfg = Release|Any CPU {177DC6C6-EC4A-4B65-A6A5-794ED6818593}.Release|Any CPU.Build.0 = Release|Any CPU - {0115E4B5-0443-4385-8C7F-D0923B6DDBC6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {0115E4B5-0443-4385-8C7F-D0923B6DDBC6}.Debug|Any CPU.Build.0 = Debug|Any CPU - {0115E4B5-0443-4385-8C7F-D0923B6DDBC6}.Release|Any CPU.ActiveCfg = Release|Any CPU - {0115E4B5-0443-4385-8C7F-D0923B6DDBC6}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection EndGlobal From 7f107477dfd75209841fe4b68e9f648501629787 Mon Sep 17 00:00:00 2001 From: Yisus Date: Sun, 30 Jul 2023 12:12:35 -0400 Subject: [PATCH 07/11] small changes to readme --- README.md | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 7248f91..573322f 100644 --- a/README.md +++ b/README.md @@ -9,12 +9,12 @@ **Term** is a simple interpreter that can convert key-value pairs defined in text to C# dictionaries. ***You can find here:*** -1. [Setup](#1-setup) -2. [Docs](#docs) -3. [Features coming soon](#coming-soon) -4. [License](#license) +- [License](#license) + +---------- + +

Getting Started

-# Getting Started > This guide assumes that your project contains a csproj file. ## 1. Setup @@ -45,9 +45,9 @@ That's it! You've successfully finished the setup. Continue in the [docs](#docs) > Any problems during the setup? **Check the setup guide again**. Still have problems? Post an **issue** so I can help you! -
-

Docs

-
+---------- + +

Docs

Jump to the [example](#example). @@ -82,7 +82,7 @@ The interpreter itself. ---------- -## Term's syntax +

Term's syntax

1. ### Comments Comments in `Term` are really simple. @@ -217,12 +217,11 @@ namespace MyProgram ---------- -# Coming soon -1. New Features like `writing` into `Term` files. +

Coming soon

-2. **In the docs:** New info like Deveploment setup. +1. Arithmethic operations in `Term` values. ---------- -# License +

License

Creative Commons License
Term by YisusGaming is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License. \ No newline at end of file From b7014659ef575df2457f4c4dd616d704b480367f Mon Sep 17 00:00:00 2001 From: Yisus Date: Sun, 30 Jul 2023 12:21:23 -0400 Subject: [PATCH 08/11] readme index updated --- README.md | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 573322f..3f0604d 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,10 @@ **Term** is a simple interpreter that can convert key-value pairs defined in text to C# dictionaries. ***You can find here:*** +- [Setup](#1-setup) +- [Docs](#docs) +- [Term's Syntax](#syntax) +- [Features coming soon](#coming-soon) - [License](#license) ---------- @@ -47,7 +51,7 @@ That's it! You've successfully finished the setup. Continue in the [docs](#docs) ---------- -

Docs

+

Docs

Jump to the [example](#example). @@ -82,7 +86,7 @@ The interpreter itself. ---------- -

Term's syntax

+

Term's syntax

1. ### Comments Comments in `Term` are really simple. @@ -217,11 +221,11 @@ namespace MyProgram ---------- -

Coming soon

+

Coming soon

1. Arithmethic operations in `Term` values. ---------- -

License

+

License

Creative Commons License
Term by YisusGaming is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License. \ No newline at end of file From 86f04ce7d156e73a80a46dd04bced32260598f87 Mon Sep 17 00:00:00 2001 From: Yisus Date: Sun, 30 Jul 2023 12:37:14 -0400 Subject: [PATCH 09/11] added new docs --- README.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/README.md b/README.md index 3f0604d..e693c01 100644 --- a/README.md +++ b/README.md @@ -84,6 +84,29 @@ The interpreter itself. ``` A dictionary containing the keys and values that were found in the file. +

+ +2. ```csharp + public static void WriteToFile(string path, Dictionary termContent, bool replaceContent = true) + ``` + Writes a `dictionary` into a term file. + + It automatically generates `Term configs` + based on the dictionary provided. + + The method will also format correctly any key in + the dictionary. + So if the dictionary contains a key named + "`My Key`" it will be formatted to + "`my_key`" before writing + it to the file. + + 1. ### Parameters: + 1. `path`
**Type**: `string`
Description: The absolute path to the term file to write into. + 2. `termContent`
**Type**: `Dictionary`
Description: The content that will be written in the file. + 3. `replaceContent`
**Type**: `bool`
Description: If `true`, replace all the contents in the term file.

if `false`, append all the contents to the end of the file with a comment "`# Written from C#:`".

This parameter is optional. Defaults to `true`. + + ----------

Term's syntax

From c0816520b2ebdda8d7e5df5124dd14fdadf8a84b Mon Sep 17 00:00:00 2001 From: Yisus Date: Mon, 31 Jul 2023 13:04:23 -0400 Subject: [PATCH 10/11] fixed typos in readme --- README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index e693c01..9cfdb9a 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ > This guide assumes that your project contains a csproj file. ## 1. Setup -**First**, you have to download the `Term.dll` from the **latest** realease. +**First**, you have to download the `Term.dll` from the **latest** release. > You can also `git clone` this repository and **compile** it yourself using: > ```bash @@ -126,14 +126,14 @@ The interpreter itself. A `config` is how we call these key-value pairs in `Term`. - The key is separeted from the value by this symbol: `->` + The key is separated from the value by this symbol: `->` Example: ```term my_key -> My value ``` - It's important that these `configs` are declared on a **single line**, otherwhise it can cause errors. + It's important that these `configs` are declared on a **single line**, otherwise it can cause errors. ### Important aspects: 1. Any empty line found in the `Term` file is going to be ignored by the `Interpreter`. @@ -174,7 +174,7 @@ Project Folder | test.term | project.csproj ``` -> Note: `test.term` is the name I gived to the file. +> Note: `test.term` is the name I gave to the file. Ok, let's go into the `Program.cs`. @@ -236,7 +236,7 @@ namespace MyProgram } ``` ## Important notes -1. You may get errors by trying to accessing a keys that isn't in the returned dictionary. This can happend for reasons like the key being not defined at the term file. +1. You may get errors by trying to accessing a keys that isn't in the returned dictionary. This can happen for reasons like the key being not defined at the term file. You can manage these errors as you want. @@ -246,7 +246,7 @@ namespace MyProgram

Coming soon

-1. Arithmethic operations in `Term` values. +1. Arithmetic operations in `Term` values. ---------- From 255e2c8a20e4d5a2dcd77ee5785d79ac5becf6b1 Mon Sep 17 00:00:00 2001 From: Yisus Date: Mon, 31 Jul 2023 13:14:56 -0400 Subject: [PATCH 11/11] fixed term logo --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 9cfdb9a..8b4b137 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ -
+
TERM
-
+

Save configs in text files and use them in C#!