Skip to content

Commit

Permalink
Merge pull request #18 from tnunnink/wip-version-2.0
Browse files Browse the repository at this point in the history
Version 2.0 Merge
  • Loading branch information
tnunnink authored Apr 4, 2024
2 parents d9c2282 + ad1c82f commit b736cfd
Show file tree
Hide file tree
Showing 207 changed files with 6,381 additions and 6,835 deletions.
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ Description, and Preset value in a flat list ordered by TagName.
> Since `Query<T>()` queries the entire L5X for the specified type, the above query
> will return all **Tag** components found, including controller and program tags.

## Releases Notes
- [Version 2.0](https://tnunnink.github.io/L5Sharp/articles/Release%20Notes%202.0.html)

## Usage
The following is some basic examples of how you can use this library
to query and modify the L5X content.
Expand Down Expand Up @@ -132,8 +136,7 @@ added or removed.

### Modifying
Modifying components is simple as well.
The same component collection interface offers methods for adding,
removing, and updating components.
The same component collection interface offers methods for adding, removing, and updating components.

```csharp
//Add a new component.
Expand Down
20 changes: 20 additions & 0 deletions docfx/articles/Release Notes v2.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
## Release Notes 2.0
This release follows from version 0.19.X. The reason for the version change is to represent this as a mostly complete
and no longer a work in progress library. The reason for v2 and not v1 is because I accidentally released v1 a long time
ago before backing into v0.1.

This update mostly focused on adding .NET 2.0 standard support and merging how LogixTypes were deserialized with
how all other LogixElements were deserialized, which makes the entire project more uniform and gives one point for
deserialization of any element/type. Most of the API surface is the same with a couple minor tweaks. You should not notice too may changes.

### Changes
1. Adds support for .NET Standard 2.0 to make library compatible with .NET Framework applications.
2. `LogixType` now implements `LogixElement`, making them wrap an underlying element where possible,
and allowing a single base class for all types.
3. Combined the old `LogixData` with the `LogixSerializer` to have a single point of deserialization for all elements.
4. Created new `LogixObject` which implements `LogixElement` and moved the common L5X, Scope, Container, and methods
for adding, replacing, and removing the object from the L5X.
5. Removed `AtomicType` bit members to avoid exceedingly large number of member tags it would generate when attemping to
all tags in a file.
6. Removed `Class` and `Family` properties from `LogixType` since they are not really useful.
7. Renamed `LogixType` to `LogixData`, as well as all derivatives to better match the L5X naming convention.
2 changes: 2 additions & 0 deletions docfx/articles/toc.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
- name: Introduction
href: intro.md
- name: Release Notes 2.0
href: Release Notes v2.0.md
48 changes: 27 additions & 21 deletions docfx/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,35 +14,41 @@ The following are some high level goals this project aimed to accomplish.
3. Make it easy and seamless to extend the API to support custom queries or functions.
4. Support strongly typed mutable tag data, so we can reference complex structures statically at compile time.

## Feedback
If you like or use this project, leave a star. If you have questions or issues,
please post in the [issues](https://github.com/tnunnink/L5Sharp/issues) tab
of the project repository. Any feedback is always appreciated. Enjoy!

## Quick Start
Install package from Nuget.
## Packages
You can consume the library via NuGet.
```powershell
Install-Package L5Sharp
```
Load an L5X file using the primary entry point `LogixContent` class.
```c#
var content = LogixContent.Load("C:\PathToMyFile\FileName.L5X");
```
Get started by querying any type across the L5X using the `Find<T>()` and LINQ extensions.
```csharp
var results = content.Find<Tag>()
>Previously I had two separate libraries but have since consolidated to a single package to avoid confusion and since
> I think most people would want all functionality anyway. `L5Sharp.Extensions` is no longer maintained.
## Quick Start
1. Install package from Nuget.
```powershell
Install-Package L5Sharp
```
2. Load an L5X file using the `L5X` class static factory methods.
```c#
var content = L5X.Load("C:\PathToMyFile\FileName.L5X");
```
3. Get started by querying elements across the L5X using the `Query()` methods and LINQ extensions.
The following query gets all tags and their nested tag members of type TIMER and returns the TagName,
Description, and Preset value in a flat list ordered by TagName.
```csharp
var results = content.Query<Tag>()
.SelectMany(t => t.Members())
.Where(t => t.DataType == "TIMER")
.Select(t => new { t.TagName, t.Comment, t.Value.As<TIMER>().PRE })
.Select(t => new {t.TagName, t.Description, Preset = t["PRE"].Value})
.OrderBy(v => v.TagName)
.ToList();
```
```

>`Query<T>()` returns an `IEnumerable<T>`, allowing for complex queries
> using LINQ and the strongly typed objects in the library.
> Since `Query<T>()` queries the entire L5X for the specified type, the above query
> will return all **Tag** components found, including controller and program tags.
The above query gets all tags and their nested tag members of type TIMER and returns the TagName,
Comment, and Preset value in a flat list.
>[!NOTE]
>`Find<T>()` returns an `IEnumerable<T>`, allowing for complex queries
using LINQ and the strongly typed objects in the library.
> Since `Find<T>()` queries the entire L5X for the specified type, the above query
> will return all **Tag** components found, including controller and program tags.

## Usage
The `LogixContent` class contains `LogixContainer` collections for all L5X components,
Expand Down
4 changes: 2 additions & 2 deletions docs/api/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@



<meta name="docfx:docurl" content="https://github.com/tnunnink/L5Sharp/blob/main/docfx/api/index.md/#L1">
<meta name="docfx:docurl" content="https://github.com/tnunnink/L5Sharp/blob/wip-version-2.0/docfx/api/index.md/#L1">
</head>

<script type="module">
Expand Down Expand Up @@ -78,7 +78,7 @@ <h1 id="placeholder">PLACEHOLDER</h1>
</article>

<div class="contribution d-print-none">
<a href="https://github.com/tnunnink/L5Sharp/blob/main/docfx/api/index.md/#L1" class="edit-link">Edit this page</a>
<a href="https://github.com/tnunnink/L5Sharp/blob/wip-version-2.0/docfx/api/index.md/#L1" class="edit-link">Edit this page</a>
</div>

<div class="next-article d-print-none border-top" id="nextArticle"></div>
Expand Down
120 changes: 120 additions & 0 deletions docs/articles/Release Notes v2.0.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Release Notes 2.0 </title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="title" content="Release Notes 2.0 ">

<link rel="icon" href="../favicon.ico">
<link rel="stylesheet" href="../public/docfx.min.css">
<link rel="stylesheet" href="../public/main.css">
<meta name="docfx:navrel" content="../toc.html">
<meta name="docfx:tocrel" content="toc.html">




<meta name="docfx:docurl" content="https://github.com/tnunnink/L5Sharp/blob/wip-version-2.0/docfx/articles/Release Notes v2.0.md/#L1">
</head>

<script type="module">
import options from './../public/main.js'
import { init } from './../public/docfx.min.js'
init(options)
</script>

<script>
const theme = localStorage.getItem('theme') || 'auto'
document.documentElement.setAttribute('data-bs-theme', theme === 'auto' ? (window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light') : theme)
</script>


<body class="tex2jax_ignore" data-layout="" data-yaml-mime="">
<header class="bg-body border-bottom">
<nav id="autocollapse" class="navbar navbar-expand-md" role="navigation">
<div class="container-xxl flex-nowrap">
<a class="navbar-brand" href="../index.html">
<img id="logo" class="svg" src="../logo.svg" alt="">

</a>
<button class="btn btn-lg d-md-none border-0" type="button" data-bs-toggle="collapse" data-bs-target="#navpanel" aria-controls="navpanel" aria-expanded="false" aria-label="Toggle navigation">
<i class="bi bi-three-dots"></i>
</button>
<div class="collapse navbar-collapse" id="navpanel">
<div id="navbar">
</div>
</div>
</div>
</nav>
</header>

<main class="container-xxl">
<div class="toc-offcanvas">
<div class="offcanvas-md offcanvas-start" tabindex="-1" id="tocOffcanvas" aria-labelledby="tocOffcanvasLabel">
<div class="offcanvas-header">
<h5 class="offcanvas-title" id="tocOffcanvasLabel">Table of Contents</h5>
<button type="button" class="btn-close" data-bs-dismiss="offcanvas" data-bs-target="#tocOffcanvas" aria-label="Close"></button>
</div>
<div class="offcanvas-body">
<nav class="toc" id="toc"></nav>
</div>
</div>
</div>

<div class="content">
<div class="actionbar">
<button class="btn btn-lg border-0 d-md-none" style="margin-top: -.65em; margin-left: -.8em" type="button" data-bs-toggle="offcanvas" data-bs-target="#tocOffcanvas" aria-controls="tocOffcanvas" aria-expanded="false" aria-label="Show table of contents">
<i class="bi bi-list"></i>
</button>

<nav id="breadcrumb"></nav>
</div>

<article data-uid="">
<h2 id="release-notes-20">Release Notes 2.0</h2>

<p>This release follows from version 0.19.X. The reason for the version change is to represent this as a mostly complete
and no longer a work in progress library. The reason for v2 and not v1 is because I accidentally released v1 a long time
ago before backing into v0.1.</p>
<p>This update mostly focused on adding .NET 2.0 standard support and merging how LogixTypes were deserialized with
how all other LogixElements were deserialized, which makes the entire project more uniform and gives one point for
deserialization of any element/type. Most of the API surface is the same with a couple minor tweaks. You should not notice too may changes.</p>
<h3 id="changes">Changes</h3>
<ol>
<li>Adds support for .NET Standard 2.0 to make library compatible with .NET Framework applications.</li>
<li><code>LogixType</code> now implements <code>LogixElement</code>, making them wrap an underlying element where possible,
and allowing a single base class for all types.</li>
<li>Combined the old <code>LogixData</code> with the <code>LogixSerializer</code> to have a single point of deserialization for all elements.</li>
<li>Created new <code>LogixObject</code> which implements <code>LogixElement</code> and moved the common L5X, Scope, Container, and methods
for adding, replacing, and removing the object from the L5X.</li>
<li>Removed <code>AtomicType</code> bit members to avoid exceedingly large number of member tags it would generate when attemping to
all tags in a file.</li>
<li>Removed <code>Class</code> and <code>Family</code> properties from <code>LogixType</code> since they are not really useful.</li>
<li>Renamed <code>LogixType</code> to <code>LogixData</code>, as well as all derivatives to better match the L5X naming convention.</li>
</ol>
</article>

<div class="contribution d-print-none">
<a href="https://github.com/tnunnink/L5Sharp/blob/wip-version-2.0/docfx/articles/Release Notes v2.0.md/#L1" class="edit-link">Edit this page</a>
</div>

<div class="next-article d-print-none border-top" id="nextArticle"></div>

</div>

<div class="affix">
<nav id="affix"></nav>
</div>
</main>


<footer class="border-top">
<div class="container-xxl">
<div class="flex-fill">
<span>Made with <a href="https://dotnet.github.io/docfx">docfx</a></span>
</div>
</div>
</footer>
</body>
</html>
4 changes: 2 additions & 2 deletions docs/articles/intro.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@



<meta name="docfx:docurl" content="https://github.com/tnunnink/L5Sharp/blob/main/docfx/articles/intro.md/#L1">
<meta name="docfx:docurl" content="https://github.com/tnunnink/L5Sharp/blob/wip-version-2.0/docfx/articles/intro.md/#L1">
</head>

<script type="module">
Expand Down Expand Up @@ -77,7 +77,7 @@ <h1 id="add-your-introductions-here">Add your introductions here!</h1>
</article>

<div class="contribution d-print-none">
<a href="https://github.com/tnunnink/L5Sharp/blob/main/docfx/articles/intro.md/#L1" class="edit-link">Edit this page</a>
<a href="https://github.com/tnunnink/L5Sharp/blob/wip-version-2.0/docfx/articles/intro.md/#L1" class="edit-link">Edit this page</a>
</div>

<div class="next-article d-print-none border-top" id="nextArticle"></div>
Expand Down
3 changes: 3 additions & 0 deletions docs/articles/toc.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
<li>
<a href="intro.html" name="" title="Introduction">Introduction</a>
</li>
<li>
<a href="Release%20Notes%20v2.0.html" name="" title="Release Notes 2.0">Release Notes 2.0</a>
</li>
</ul>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion docs/articles/toc.json
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@

{"items":[{"name":"Introduction","href":"intro.html","topicHref":"intro.html"}]}
{"items":[{"name":"Introduction","href":"intro.html","topicHref":"intro.html"},{"name":"Release Notes 2.0","href":"Release%20Notes%20v2.0.html","topicHref":"Release%20Notes%20v2.0.html"}]}
57 changes: 34 additions & 23 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@



<meta name="docfx:docurl" content="https://github.com/tnunnink/L5Sharp/blob/main/docfx/index.md/#L1">
<meta name="docfx:docurl" content="https://github.com/tnunnink/L5Sharp/blob/wip-version-2.0/docfx/index.md/#L1">
</head>

<script type="module">
Expand Down Expand Up @@ -88,33 +88,44 @@ <h2 id="goals">Goals</h2>
<li>Make it easy and seamless to extend the API to support custom queries or functions.</li>
<li>Support strongly typed mutable tag data, so we can reference complex structures statically at compile time.</li>
</ol>
<h2 id="feedback">Feedback</h2>
<p>If you like or use this project, leave a star. If you have questions or issues,
please post in the <a href="https://github.com/tnunnink/L5Sharp/issues">issues</a> tab
of the project repository. Any feedback is always appreciated. Enjoy!</p>
<h2 id="packages">Packages</h2>
<p>You can consume the library via NuGet.</p>
<pre><code class="lang-powershell">Install-Package L5Sharp
</code></pre>
<blockquote>
<p>Previously I had two separate libraries but have since consolidated to a single package to avoid confusion and since
I think most people would want all functionality anyway. <code>L5Sharp.Extensions</code> is no longer maintained.</p>
</blockquote>
<h2 id="quick-start">Quick Start</h2>
<p>Install package from Nuget.</p>
<ol>
<li><p>Install package from Nuget.</p>
<pre><code class="lang-powershell">Install-Package L5Sharp
</code></pre>
<p>Load an L5X file using the primary entry point <code>LogixContent</code> class.</p>
<pre><code class="lang-c#">var content = LogixContent.Load(&quot;C:\PathToMyFile\FileName.L5X&quot;);
</li>
<li><p>Load an L5X file using the <code>L5X</code> class static factory methods.</p>
<pre><code class="lang-c#">var content = L5X.Load(&quot;C:\PathToMyFile\FileName.L5X&quot;);
</code></pre>
<p>Get started by querying any type across the L5X using the <code>Find&lt;T&gt;()</code> and LINQ extensions.</p>
<pre><code class="lang-csharp">var results = content.Find&lt;Tag&gt;()
.SelectMany(t =&gt; t.Members())
.Where(t =&gt; t.DataType == &quot;TIMER&quot;)
.Select(t =&gt; new { t.TagName, t.Comment, t.Value.As&lt;TIMER&gt;().PRE })
.ToList();
</li>
<li><p>Get started by querying elements across the L5X using the <code>Query()</code> methods and LINQ extensions.
The following query gets all tags and their nested tag members of type TIMER and returns the TagName,
Description, and Preset value in a flat list ordered by TagName.</p>
<pre><code class="lang-csharp">var results = content.Query&lt;Tag&gt;()
.SelectMany(t =&gt; t.Members())
.Where(t =&gt; t.DataType == &quot;TIMER&quot;)
.Select(t =&gt; new {t.TagName, t.Description, Preset = t[&quot;PRE&quot;].Value})
.OrderBy(v =&gt; v.TagName)
.ToList();
</code></pre>
<p>The above query gets all tags and their nested tag members of type TIMER and returns the TagName,
Comment, and Preset value in a flat list.</p>
<div class="NOTE">
<h5>Note</h5>
<p><code>Find&lt;T&gt;()</code> returns an <code>IEnumerable&lt;T&gt;</code>, allowing for complex queries
<blockquote>
<p><code>Query&lt;T&gt;()</code> returns an <code>IEnumerable&lt;T&gt;</code>, allowing for complex queries
using LINQ and the strongly typed objects in the library.
Since <code>Find&lt;T&gt;()</code> queries the entire L5X for the specified type, the above query
will return all <strong>Tag</strong> components found, including controller and program tags.</p>
</div>
Since <code>Query&lt;T&gt;()</code> queries the entire L5X for the specified type, the above query
will return all <strong>Tag</strong> components found, including controller and program tags.
The above query gets all tags and their nested tag members of type TIMER and returns the TagName,
Comment, and Preset value in a flat list.</p>
</blockquote>
</li>
</ol>
<h2 id="usage">Usage</h2>
<p>The <code>LogixContent</code> class contains <code>LogixContainer</code> collections for all L5X components,
such as <a class="xref" href="api/L5Sharp.Components.Tag.html">Tag</a>, <a class="xref" href="api/L5Sharp.Components.DataType.html">DataType</a>,
Expand Down Expand Up @@ -278,7 +289,7 @@ <h2 id="references">References</h2>
</article>

<div class="contribution d-print-none">
<a href="https://github.com/tnunnink/L5Sharp/blob/main/docfx/index.md/#L1" class="edit-link">Edit this page</a>
<a href="https://github.com/tnunnink/L5Sharp/blob/wip-version-2.0/docfx/index.md/#L1" class="edit-link">Edit this page</a>
</div>

<div class="next-article d-print-none border-top" id="nextArticle"></div>
Expand Down
10 changes: 10 additions & 0 deletions docs/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2696,6 +2696,16 @@
},
"version": ""
},
{
"type": "Conceptual",
"source_relative_path": "articles/Release Notes v2.0.md",
"output": {
".html": {
"relative_path": "articles/Release Notes v2.0.html"
}
},
"version": ""
},
{
"type": "Conceptual",
"source_relative_path": "articles/intro.md",
Expand Down
4 changes: 3 additions & 1 deletion src/.idea/.idea.L5Sharp/.idea/indexLayout.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Large diffs are not rendered by default.

Loading

0 comments on commit b736cfd

Please sign in to comment.