From ce3514ea83edd8ee570a32d40f660060f2eda8ae Mon Sep 17 00:00:00 2001 From: Timothy Nunnink <46979634+tnunnink@users.noreply.github.com> Date: Tue, 25 Jul 2023 11:32:26 -0500 Subject: [PATCH] Updating index.md --- docfx/.idea/.idea.docfx.dir/.idea/.gitignore | 13 ++++ .../.idea/.idea.docfx.dir/.idea/encodings.xml | 4 ++ .../.idea.docfx.dir/.idea/indexLayout.xml | 8 +++ docfx/.idea/.idea.docfx.dir/.idea/vcs.xml | 6 ++ docfx/index.md | 67 ++++++++++--------- docfx/toc.yml | 2 +- docs/index.html | 64 +++++++++--------- docs/toc.html | 2 +- docs/toc.json | 2 +- src/.idea/.idea.L5Sharp/.idea/workspace.xml | 8 +-- 10 files changed, 106 insertions(+), 70 deletions(-) create mode 100644 docfx/.idea/.idea.docfx.dir/.idea/.gitignore create mode 100644 docfx/.idea/.idea.docfx.dir/.idea/encodings.xml create mode 100644 docfx/.idea/.idea.docfx.dir/.idea/indexLayout.xml create mode 100644 docfx/.idea/.idea.docfx.dir/.idea/vcs.xml diff --git a/docfx/.idea/.idea.docfx.dir/.idea/.gitignore b/docfx/.idea/.idea.docfx.dir/.idea/.gitignore new file mode 100644 index 00000000..d51a862c --- /dev/null +++ b/docfx/.idea/.idea.docfx.dir/.idea/.gitignore @@ -0,0 +1,13 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Rider ignored files +/modules.xml +/contentModel.xml +/.idea.docfx.iml +/projectSettingsUpdater.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/docfx/.idea/.idea.docfx.dir/.idea/encodings.xml b/docfx/.idea/.idea.docfx.dir/.idea/encodings.xml new file mode 100644 index 00000000..df87cf95 --- /dev/null +++ b/docfx/.idea/.idea.docfx.dir/.idea/encodings.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/docfx/.idea/.idea.docfx.dir/.idea/indexLayout.xml b/docfx/.idea/.idea.docfx.dir/.idea/indexLayout.xml new file mode 100644 index 00000000..7b08163c --- /dev/null +++ b/docfx/.idea/.idea.docfx.dir/.idea/indexLayout.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/docfx/.idea/.idea.docfx.dir/.idea/vcs.xml b/docfx/.idea/.idea.docfx.dir/.idea/vcs.xml new file mode 100644 index 00000000..6c0b8635 --- /dev/null +++ b/docfx/.idea/.idea.docfx.dir/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/docfx/index.md b/docfx/index.md index 023b68a2..2f22f6d2 100644 --- a/docfx/index.md +++ b/docfx/index.md @@ -4,9 +4,6 @@ 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 @@ -14,48 +11,56 @@ 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()` method on the content class. +Query any type across the L5X using the `Find()` method on the content class. +`Find()` just returns an `IEnumerable`, allowing for more complex queries +using LINQ and the strongly typed objects in the library. ```csharp var tags = content.Find(); ``` -NOTE: `Find()` just returns an `IEnumerable`, 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"); ``` diff --git a/docfx/toc.yml b/docfx/toc.yml index 59f80104..907a4c3b 100644 --- a/docfx/toc.yml +++ b/docfx/toc.yml @@ -1,5 +1,5 @@ - name: Articles href: articles/ -- name: Api Documentation +- name: Api href: api/ homepage: api/index.md diff --git a/docs/index.html b/docs/index.html index 5013fabb..9969b4ef 100644 --- a/docs/index.html +++ b/docs/index.html @@ -78,48 +78,50 @@

L5Sharp

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.

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.

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.

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.

-

Components

-

Query or mutate components in the file using the top level LogixContainer collections, -such as Tag, DataType, Module, Program, and more.

-

The following shows some simple querying via the controller tags container:

-
//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");
+

[!NOTE] +Ths above query will return all Tag elements found, including controller and all program tags.

+

Usage

+

The LogixContent class contains LogixContainer collections for all L5X components, +such as Tag, DataType, +Moulde, and more. +These classes expose methods for querying and modifying the collections +and components within the collections.

+

Get All Components

+
var tags = content.Tags.ToList();
+
+

Get Component By Name

+
var tag = content.Tags.Find("MyTag");
 
-

The following shows some simple modifications via the controller tags container:

-
//Add a new component.
-var tag = new Tag { Name = "MyTag", Value = 100 };
+

Filter Components

+
var tags = content.Tags.Where(t => t.DataType == "TIMER" && t.Dimensions.IsEmpty && t["PRE"].Value >= 5000);
+
+

Add Component

+
var tag = new Tag { Name = "MyTag", Value = 100 };
 content.Tags.Add(tag);
-
-//Remove an existing component.
-content.Tags.Remove("MyTag");
-
-//Repalce an existing component.
-content.Tags.Find("MyTag").Replace(tag);
-
-//Save changes when done.
-content.Save("C:\PathToMyOutputFile\FileName.L5X");
+
+

Update Component

+
var tag = content.Tags.Get("MyTag");
+tag.Value = 1234;
+tag.Description = "This is a tag's description";
+
+

Remove Component

+
content.Tags.Remove("MyTag");
+
+

Save Changes

+
content.Save("C:\PathToMyOutputFile\FileName.L5X");
 

See ... for more information.

diff --git a/docs/toc.html b/docs/toc.html index e77dcce2..a704f27f 100644 --- a/docs/toc.html +++ b/docs/toc.html @@ -16,7 +16,7 @@ Articles
  • - Api Documentation + Api
  • diff --git a/docs/toc.json b/docs/toc.json index 1217a7ab..6007a1eb 100644 --- a/docs/toc.json +++ b/docs/toc.json @@ -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"}]} \ No newline at end of file +{"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"}]} \ No newline at end of file diff --git a/src/.idea/.idea.L5Sharp/.idea/workspace.xml b/src/.idea/.idea.L5Sharp/.idea/workspace.xml index ff0b83de..664e1fb3 100644 --- a/src/.idea/.idea.L5Sharp/.idea/workspace.xml +++ b/src/.idea/.idea.L5Sharp/.idea/workspace.xml @@ -7,11 +7,9 @@