Skip to content

Commit

Permalink
docs
Browse files Browse the repository at this point in the history
  • Loading branch information
tnunnink committed Jul 25, 2023
1 parent 9d9e3f8 commit 77fcb83
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 18 deletions.
22 changes: 13 additions & 9 deletions docfx/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Load an L5X file using the primary entry point `LogixContent` class.
```c#
var content = LogixContent.Load("C:\PathToMyFile\FileName.L5X");
```
Query any type across the L5X using the `Find<T>()` method on the content class.
Query any type across the L5X using the `Find<T>()` method.
```csharp
var tags = content.Find<Tag>();
```
Expand All @@ -30,34 +30,38 @@ such as [Tag](xref:L5Sharp.Components.Tag), [DataType](xref:L5Sharp.Components.D
These classes expose methods for querying and modifying the collections
and components within the collections.

#### Get All Components
###### Get All
```c#
var tags = content.Tags.ToList();
```
#### Get Component By Name
>[!NOTE]
>`Tags` on the root `LogixContent` class is controller tags only.
> To get program specific `Tags`, access the Tags collection of a
> specific `Program` component.
###### Get By Name
```c#
var tag = content.Tags.Find("MyTag");
var tag = content.Tags.Get("MyTag");
```
#### Filter Components
###### Filter
```c#
var tags = content.Tags.Where(t => t.DataType == "TIMER" && t.Dimensions.IsEmpty && t["PRE"].Value >= 5000);
```
#### Add Component
###### Add
```c#
var tag = new Tag { Name = "MyTag", Value = 100 };
content.Tags.Add(tag);
```
#### Update Component
###### Update
```c#
var tag = content.Tags.Get("MyTag");
tag.Value = 1234;
tag.Description = "This is a tag's description";
```
#### Remove Component
###### Remove
```c#
content.Tags.Remove("MyTag");
```
#### Save Changes
###### Save
```c#
content.Save("C:\PathToMyOutputFile\FileName.L5X");
```
Expand Down
24 changes: 15 additions & 9 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ <h2 id="quick-start">Quick Start</h2>
<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;);
</code></pre>
<p>Query any type across the L5X 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.</p>
<pre><code class="lang-csharp">var tags = content.Find&lt;Tag&gt;();
</code></pre>
<div class="NOTE">
Expand All @@ -101,28 +101,34 @@ <h2 id="usage">Usage</h2>
<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>
<h6 id="get-all">Get All</h6>
<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;);
<div class="NOTE">
<h5>Note</h5>
<p><code>Tags</code> on the root <code>LogixContent</code> class is controller tags only.
To get program specific <code>Tags</code>, access the Tags collection of a
specific <code>Program</code> component.</p>
</div>
<h6 id="get-by-name">Get By Name</h6>
<pre><code class="lang-c#">var tag = content.Tags.Get(&quot;MyTag&quot;);
</code></pre>
<h4 id="filter-components">Filter Components</h4>
<h6 id="filter">Filter</h6>
<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>
<h6 id="add">Add</h6>
<pre><code class="lang-c#">var tag = new Tag { Name = &quot;MyTag&quot;, Value = 100 };
content.Tags.Add(tag);
</code></pre>
<h4 id="update-component">Update Component</h4>
<h6 id="update">Update</h6>
<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>
<h6 id="remove">Remove</h6>
<pre><code class="lang-c#">content.Tags.Remove(&quot;MyTag&quot;);
</code></pre>
<h4 id="save-changes">Save Changes</h4>
<h6 id="save">Save</h6>
<pre><code class="lang-c#">content.Save(&quot;C:\PathToMyOutputFile\FileName.L5X&quot;);
</code></pre>
<p>See ... for more information.</p>
Expand Down

0 comments on commit 77fcb83

Please sign in to comment.