Skip to content

Commit

Permalink
Updating index.md
Browse files Browse the repository at this point in the history
  • Loading branch information
tnunnink committed Jul 25, 2023
1 parent ad95c6e commit ce3514e
Show file tree
Hide file tree
Showing 10 changed files with 106 additions and 70 deletions.
13 changes: 13 additions & 0 deletions docfx/.idea/.idea.docfx.dir/.idea/.gitignore

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

4 changes: 4 additions & 0 deletions docfx/.idea/.idea.docfx.dir/.idea/encodings.xml

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

8 changes: 8 additions & 0 deletions docfx/.idea/.idea.docfx.dir/.idea/indexLayout.xml

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

6 changes: 6 additions & 0 deletions docfx/.idea/.idea.docfx.dir/.idea/vcs.xml

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

67 changes: 36 additions & 31 deletions docfx/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,58 +4,63 @@ The goal of this project was to provide a simple and reusable library for
querying and manipulating L5X files to aid in the creation of tools that
automate tasks related RSLogix5000 PLC development.

If you would like to contribute, have feedback or questions, please reach out!
If you are using or like the progress being made, please leave a star. Thanks!

## Quick Start
Install package from Nuget.
```powershell
Install-Package L5Sharp
```

The main entry point to the L5X is the `LogixContent` class.
Use the factory methods `Load` to load a L5S file or `Parse` to parse a L5X string.
Use the factory methods `Load` to load a L5X file or `Parse` to parse a L5X string.
```c#
var content = LogixContent.Load("C:\PathToMyFile\FileName.L5X");
```

Quickly query any type using the `Find<T>()` method on the content class.
Query any type across the L5X using the `Find<T>()` method on the content class.
`Find<T>()` just returns an `IEnumerable<T>`, allowing for more complex queries
using LINQ and the strongly typed objects in the library.
```csharp
var tags = content.Find<Tag>();
```
NOTE: `Find<T>()` just returns an `IEnumerable<T>`, so it is essentially read only,
but allows you to form more complex queries using LINQ and the strongly typed
components in the library. To mutate components, see the following section.
[!NOTE]
Ths above query will return all Tag elements found, including controller and all program tags.

### Components
Query or mutate components in the file using the top level `LogixContainer` collections,
such as `Tag`, `DataType`, `Module`, `Program`, and more.
## Usage
The `LogixContent` class contains `LogixContainer` collections for all L5X components,
such as [Tag](xref:L5Sharp.Components.Tag), [DataType](xref:L5Sharp.Components.DataType),
[Moulde](xref:L5Sharp.Components.Module), and more.
These classes expose methods for querying and modifying the collections
and components within the collections.

The following shows some simple querying via the controller tags container:
#### Get All Components
```c#
var tags = content.Tags.ToList();
```
#### Get Component By Name
```c#
//Get all controller tags.
var controllerTags = content.Tags;

//Get a tag by name.
var myTag = content.Tags.Find("MyTag");

//Use LINQ to query further.
var timerTypeTags = content.Tags.Where(t => t.DataType == "TIMER");
var tag = content.Tags.Find("MyTag");
```

The following shows some simple modifications via the controller tags container:
```csharp
//Add a new component.
#### Filter Components
```c#
var tags = content.Tags.Where(t => t.DataType == "TIMER" && t.Dimensions.IsEmpty && t["PRE"].Value >= 5000);
```
#### Add Component
```c#
var tag = new Tag { Name = "MyTag", Value = 100 };
content.Tags.Add(tag);

//Remove an existing component.
```
#### Update Component
```c#
var tag = content.Tags.Get("MyTag");
tag.Value = 1234;
tag.Description = "This is a tag's description";
```
#### Remove Component
```c#
content.Tags.Remove("MyTag");

//Repalce an existing component.
content.Tags.Find("MyTag").Replace(tag);

//Save changes when done.
```
#### Save Changes
```c#
content.Save("C:\PathToMyOutputFile\FileName.L5X");
```

Expand Down
2 changes: 1 addition & 1 deletion docfx/toc.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
- name: Articles
href: articles/
- name: Api Documentation
- name: Api
href: api/
homepage: api/index.md
64 changes: 33 additions & 31 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -78,48 +78,50 @@ <h1 id="l5sharp">L5Sharp</h1>
The goal of this project was to provide a simple and reusable library for
querying and manipulating L5X files to aid in the creation of tools that
automate tasks related RSLogix5000 PLC development.</p>
<p>If you would like to contribute, have feedback or questions, please reach out!
If you are using or like the progress being made, please leave a star. Thanks!</p>
<h2 id="quick-start">Quick Start</h2>
<p>Install package from Nuget.</p>
<pre><code class="lang-powershell">Install-Package L5Sharp
</code></pre>
<p>The main entry point to the L5X is the <code>LogixContent</code> class.
Use the factory methods <code>Load</code> to load a L5S file or <code>Parse</code> to parse a L5X string.</p>
Use the factory methods <code>Load</code> to load a L5X file or <code>Parse</code> to parse a L5X string.</p>
<pre><code class="lang-c#">var content = LogixContent.Load(&quot;C:\PathToMyFile\FileName.L5X&quot;);
</code></pre>
<p>Quickly query any type using the <code>Find&lt;T&gt;()</code> method on the content class.</p>
<p>Query any type across the L5X using the <code>Find&lt;T&gt;()</code> method on the content class.
<code>Find&lt;T&gt;()</code> just returns an <code>IEnumerable&lt;T&gt;</code>, allowing for more complex queries
using LINQ and the strongly typed objects in the library.</p>
<pre><code class="lang-csharp">var tags = content.Find&lt;Tag&gt;();
</code></pre>
<p>NOTE: <code>Find&lt;T&gt;()</code> just returns an <code>IEnumerable&lt;T&gt;</code>, so it is essentially read only,
but allows you to form more complex queries using LINQ and the strongly typed
components in the library. To mutate components, see the following section.</p>
<h3 id="components">Components</h3>
<p>Query or mutate components in the file using the top level <code>LogixContainer</code> collections,
such as <code>Tag</code>, <code>DataType</code>, <code>Module</code>, <code>Program</code>, and more.</p>
<p>The following shows some simple querying via the controller tags container:</p>
<pre><code class="lang-c#">//Get all controller tags.
var controllerTags = content.Tags;

//Get a tag by name.
var myTag = content.Tags.Find(&quot;MyTag&quot;);

//Use LINQ to query further.
var timerTypeTags = content.Tags.Where(t =&gt; t.DataType == &quot;TIMER&quot;);
<p>[!NOTE]
Ths above query will return all Tag elements found, including controller and all program tags.</p>
<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>,
<a class="xref" href="api/L5Sharp.Components.Module.html">Moulde</a>, and more.
These classes expose methods for querying and modifying the collections
and components within the collections.</p>
<h4 id="get-all-components">Get All Components</h4>
<pre><code class="lang-c#">var tags = content.Tags.ToList();
</code></pre>
<h4 id="get-component-by-name">Get Component By Name</h4>
<pre><code class="lang-c#">var tag = content.Tags.Find(&quot;MyTag&quot;);
</code></pre>
<p>The following shows some simple modifications via the controller tags container:</p>
<pre><code class="lang-csharp">//Add a new component.
var tag = new Tag { Name = &quot;MyTag&quot;, Value = 100 };
<h4 id="filter-components">Filter Components</h4>
<pre><code class="lang-c#">var tags = content.Tags.Where(t =&gt; t.DataType == &quot;TIMER&quot; &amp;&amp; t.Dimensions.IsEmpty &amp;&amp; t[&quot;PRE&quot;].Value &gt;= 5000);
</code></pre>
<h4 id="add-component">Add Component</h4>
<pre><code class="lang-c#">var tag = new Tag { Name = &quot;MyTag&quot;, Value = 100 };
content.Tags.Add(tag);

//Remove an existing component.
content.Tags.Remove(&quot;MyTag&quot;);

//Repalce an existing component.
content.Tags.Find(&quot;MyTag&quot;).Replace(tag);

//Save changes when done.
content.Save(&quot;C:\PathToMyOutputFile\FileName.L5X&quot;);
</code></pre>
<h4 id="update-component">Update Component</h4>
<pre><code class="lang-c#">var tag = content.Tags.Get(&quot;MyTag&quot;);
tag.Value = 1234;
tag.Description = &quot;This is a tag's description&quot;;
</code></pre>
<h4 id="remove-component">Remove Component</h4>
<pre><code class="lang-c#">content.Tags.Remove(&quot;MyTag&quot;);
</code></pre>
<h4 id="save-changes">Save Changes</h4>
<pre><code class="lang-c#">content.Save(&quot;C:\PathToMyOutputFile\FileName.L5X&quot;);
</code></pre>
<p>See ... for more information.</p>
</article>
Expand Down
2 changes: 1 addition & 1 deletion docs/toc.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<a href="articles/intro.html" name="articles/toc.html" title="Articles">Articles</a>
</li>
<li>
<a href="api/index.html" name="api/toc.html" title="Api Documentation">Api Documentation</a>
<a href="api/index.html" name="api/toc.html" title="Api">Api</a>
</li>
</ul>
</div>
Expand Down
2 changes: 1 addition & 1 deletion docs/toc.json
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@

{"items":[{"name":"Articles","href":"articles/intro.html","tocHref":"articles/toc.html","topicHref":"articles/intro.html"},{"name":"Api Documentation","href":"api/index.html","tocHref":"api/toc.html","topicHref":"api/index.html","homepage":"api/index.html"}]}
{"items":[{"name":"Articles","href":"articles/intro.html","tocHref":"articles/toc.html","topicHref":"articles/intro.html"},{"name":"Api","href":"api/index.html","tocHref":"api/toc.html","topicHref":"api/index.html","homepage":"api/index.html"}]}
8 changes: 3 additions & 5 deletions src/.idea/.idea.L5Sharp/.idea/workspace.xml

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

0 comments on commit ce3514e

Please sign in to comment.