Skip to content

Commit

Permalink
Add usage samples for client API; Improve other doc pages to prep for…
Browse files Browse the repository at this point in the history
… 9.0.0 release (#89)
  • Loading branch information
spaceisfun authored Feb 18, 2021
1 parent 1625684 commit d2723c4
Show file tree
Hide file tree
Showing 15 changed files with 765 additions and 209 deletions.
36 changes: 22 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,36 @@

Factory Orchestrator provides a simple and reliable way to run and manage factory line validation and fault analysis workflows. Beyond the factory floor Factory Orchestrator can be during os and hardware development to support various developer inner-loop and diagnostics activities.

Learn more about this tool and how to use it by reading the [documentation here](https://microsoft.github.io/FactoryOrchestrator/).
Factory Orchestrator consists of two components:

The [getting started](https://microsoft.github.io/FactoryOrchestrator/get-started-with-factory-orchestrator/) page is a great place to go once you've built the binaries for the project.
* A .NET Core system service (Microsoft.FactoryOrchestrator.Service.exe): The service tracks task information, including unique per-run results and logging; even persisting task state to allow the service to be resilient to data loss due to client failure. It also provides a [robust API surface](https://microsoft.github.io/FactoryOrchestrator/use-the-factory-orchestrator-api/) for clients on the same device and/or over a network to monitor & interact with the service via C# .NET, C# UWP, or PowerShell code.

## **Factory Orchestrator consists of the following projects:**
* [A UWP app](https://microsoft.github.io/FactoryOrchestrator/use-the-factory-orchestrator-app/): Communicates with the service to monitor & run executable tasks and commands on a device under test (DUT). This app can communicate with the service running on the same device and/or over a network. The app is optional; the service does not depend on the app.

* **Microsoft.FactoryOrchestrator.Core**
A .NET Standard library containing the core FactoryOrchestrator classes. Required in all projects.
Learn more about this tool and how to use it by reading the [documentation here](https://microsoft.github.io/FactoryOrchestrator/).

* **Microsoft.FactoryOrchestrator.Server**
A .NET Standard library containing the server-side FactoryOrchestrator classes. Required on all FactoryOrchestrator server projects.
## **Factory Orchestrator consists of the following projects and binary releases:**

* **Microsoft.FactoryOrchestrator.Service**
.NET Core Executable project for Microsoft.FactoryOrchestrator.Service.exe, the FactoryOrchestrator server implementation. Requires administrator access to run.
* **Microsoft.FactoryOrchestrator.Core**
A .NET Standard library containing the core FactoryOrchestrator classes. Required in all projects. This is available as ["Microsoft.FactoryOrchestrator.Core" on NuGet](https://www.nuget.org/packages/Microsoft.FactoryOrchestrator.Core/).

* **Microsoft.FactoryOrchestrator.Client**
.NET Standard library containing the client-side FactoryOrchestrator classes, required to interact with Microsoft.FactoryOrchestrator.Service. Also contains optional helper classes.
.NET Standard library containing the client-side FactoryOrchestrator classes, required to interact with Microsoft.FactoryOrchestrator.Service. Also contains optional helper classes. This is available as ["Microsoft.FactoryOrchestrator.Client" on NuGet](https://www.nuget.org/packages/Microsoft.FactoryOrchestrator.Client/).

* **FactoryOrchestratorPowerShellLibrary**
.NET Standard library containing a synchronous client-side FactoryOrchestrator class and Cmdlet wrapper classes, designed to be used via PowerShell.
* **Microsoft.FactoryOrchestrator.UWPClient**
UWP library containing the client-side FactoryOrchestrator classes, required to interact with Microsoft.FactoryOrchestrator.Service from a Universal Windows Platform app. This is available as ["Microsoft.FactoryOrchestrator.UWPClient" on NuGet](https://www.nuget.org/packages/Microsoft.FactoryOrchestrator.UWPClient/).

* **Microsoft.FactoryOrchestrator.PowerShell**
PowerShell module containing a synchronous client-side FactoryOrchestrator class and Cmdlet wrapper classes, designed to be used WITH PowerShell 6+. This is available as ["Microsoft.FactoryOrchestrator.Client" on PowerShell Gallery](https://www.powershellgallery.com/packages/Microsoft.FactoryOrchestrator.Client/).

* **Microsoft.FactoryOrchestrator.Server**
A .NET Standard library containing the server-side FactoryOrchestrator classes. Required on all FactoryOrchestrator server projects. ["Microsoft.FactoryOrchestrator.Server" on NuGet](https://www.nuget.org/packages/Microsoft.FactoryOrchestrator.Server/).

* **Microsoft.FactoryOrchestrator.Service**
.NET Core Executable project for Microsoft.FactoryOrchestrator.Service.exe, the FactoryOrchestrator server implementation. Requires administrator access to run. This is available on [the GitHub Releases page as a .zip](https://github.com/microsoft/FactoryOrchestrator/releases).

* **Microsoft.FactoryOrchestrator.App**
C# UWP app project for Microsoft.FactoryOrchestrator.App.exe, the UWP provides a GUI (Graphical User Interface) to manually interact with Microsoft.FactoryOrchestrator.Service.
C# UWP app project for Microsoft.FactoryOrchestrator.App.exe, the UWP provides a GUI (Graphical User Interface) to manually interact with Microsoft.FactoryOrchestrator.Service. This is available on [the GitHub Releases page as a .msixbundle](https://github.com/microsoft/FactoryOrchestrator/releases).

Factory Orchestrator :green_heart: OSS.

Expand All @@ -50,13 +57,14 @@ FactoryOrchestrator
| ClientLibrary
| ClientSample
| CoreLibrary
| PowerShellLibrary
| ServerLibrary
| Service
| Tests
└ UWPClientLibrary
```

## Prerequisites
## Prerequisites to build source code

### Install dependencies

Expand Down
158 changes: 158 additions & 0 deletions docs/AddAPILinks.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.

# This script is used to add links to API documentation for manually authored Markdown files.
# It attempts to be as cautious as possible to avoid mis-linking an unrelated work to a C# class/API/etc.
# It should be run whenever you edit a manually authored Markdown file.
$regex = '\(.*\)'

# Files to search
$scriptDir = Split-Path $script:MyInvocation.MyCommand.Path
$docPath = [System.IO.Path]::Join($scriptDir, "docs")
$userDocs = Get-ChildItem -Path $docPath -filter "*.md"
$apiDocs = Get-ChildItem -Path $docPath -filter "Microsoft-FactoryOrchestrator-Core-TaskList*.md" -Recurse
$apiDocs += Get-ChildItem -Path $docPath -filter "Microsoft-FactoryOrchestrator-Core-TaskBase*.md" -Recurse
$apiDocs += Get-ChildItem -Path $docPath -filter "Microsoft-FactoryOrchestrator-Core-UWPTask.md" -Recurse
$apiDocs += Get-ChildItem -Path $docPath -filter "Microsoft-FactoryOrchestrator-Core-ExecutableTask.md" -Recurse
$apiDocs += Get-ChildItem -Path $docPath -filter "Microsoft-FactoryOrchestrator-Core-PowerShellTask.md" -Recurse
$apiDocs += Get-ChildItem -Path $docPath -filter "Microsoft-FactoryOrchestrator-Core-ExternalTask.md" -Recurse
$apiDocs += Get-ChildItem -Path $docPath -filter "Microsoft-FactoryOrchestrator-Core-TaskRun*.md" -Recurse
$apiDocs += Get-ChildItem -Path $docPath -filter "Microsoft-FactoryOrchestrator-Client-FactoryOrchestratorClient-*.md" -Recurse
$apiDocs += Get-ChildItem -Path $docPath -filter "Microsoft-FactoryOrchestrator-Client-ServerPoller-*.md" -Recurse
$apiDocs = $apiDocs | Sort-Object -Descending
$apiNames = @{}

# Ignore these words in .md even though they map to APIs, as they are used in multiple classes or are vague words.
$dupNames = @("Equals", "Name", "Guid", "ToString", "IsRunningOrPending", "Path", "Tasks", "Connect", "Status", "IpAddress", "EnumerateFiles", "EnumerateDirectories")
foreach ($doc in $apiDocs)
{
$name = $($doc.BaseName)

$regex = '\(.*\)'
$name = $name -replace $regex, ''

$name = $name.Split('-') | Select-Object -Last 1
Write-Verbose "$name from $($doc.BaseName)"

if (-not $apiNames.ContainsKey($name))
{
if (-not $dupNames.Contains($name))
{
# Change file path to html path
$path = $($doc.FullName).Replace($docPath, "..").Replace('\','/').Replace('(', '%28').Replace(')', '%29').Replace('.md', '/')
$apiNames.add($name, $path)
Write-Verbose "Added $name to $path"
}
}
else
{
# if a name is in two different classes, dont link it as we might link the wrong one
Write-Verbose "Duplicate $name"

if (-not $dupNames.Contains($name))
{
$dupNames += $name
}

if (-not ($apiNames[$name] -like "*()"))
{
$apiNames.remove($name)
Write-Warning "Possible confusion with $name"
}
}
}

# Add links until no more changes are found
$changeMade = $true
while ($changeMade -eq $true)
{
$changeMade = $false

foreach ($doc in $userDocs)
{
Write-Verbose "Checking $doc"
$content = Get-Content $doc
$edited = @()
$incode = $false
foreach ($line in $content)
{
$newline = $null
if ($line.Contains('```'))
{
# sadly I didn't find a way to add links to code snippets :(
$incode = -not $incode
}

if (-not $incode)
{
# Split line into words and words into sections
$words = $line.Split(' ')
$sections = $words.Split('.')
$sections = $sections.Split('(')
$sections = $sections.Split(',')
foreach ($section in $sections)
{
$section = $section.Replace(')', '')
$section = $section.Replace(';', '')
if ([System.Char]::IsUpper($section[0]))
{
if ($apiNames.ContainsKey($section))
{
$index = $line.IndexOf($section)

# Don't add a link if it's already a link :)
while ($line[$index-1] -eq '[')
{
$index = $line.IndexOf($section, $index+1)
if ($index -eq -1)
{
break
}
}

if ($index -eq -1)
{
continue
}

# Ensure we are at the start of a new word, not in the middle of one.
while (($line[$index-1] -ne ' ') -and ($line[$index-1] -ne '(') -and ($line[$index-1] -ne '.'))
{
$index = $line.IndexOf($section, $index+1)
if ($index -eq -1)
{
break
}

}

if ($index -eq -1)
{
continue
}

# All checks are passed! Add the link!
Write-Host "found $section at $index ($($line.Substring($index, $section.Length)))"
Write-Host " $line"
Write-Host ""
Write-Host " $section maps to $($apiNames[$section])"
$newline = $line.Substring(0, $index) + "[$section]($($apiNames[$section]))" + $line.Substring($index + $section.Length)
$changeMade = $true
}
}
}
}

if ($null -ne $newline)
{
$edited += $newline
}
else
{
$edited += $line
}
}

Out-File -FilePath $doc -InputObject $edited
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#### [Microsoft.FactoryOrchestrator.Client](./Microsoft-FactoryOrchestrator-Client.md 'Microsoft.FactoryOrchestrator.Client')
### [Microsoft.FactoryOrchestrator.Client](./Microsoft-FactoryOrchestrator-Client.md 'Microsoft.FactoryOrchestrator.Client').[FactoryOrchestratorClient](./Microsoft-FactoryOrchestrator-Client-FactoryOrchestratorClient.md 'Microsoft.FactoryOrchestrator.Client.FactoryOrchestratorClient')
## FactoryOrchestratorClient.EnableLocalLoopbackForApp(string) Method
Asynchronously Enables local loopback on the given UWP app.
Asynchronously Enables local loopback on the given UWP app. Local loopback is enabled permanently for this app, persisting through reboots.
```csharp
public System.Threading.Tasks.Task EnableLocalLoopbackForApp(string aumid);
```
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#### [Microsoft.FactoryOrchestrator.Core](./Microsoft-FactoryOrchestrator-Core.md 'Microsoft.FactoryOrchestrator.Core')
### [Microsoft.FactoryOrchestrator.Core](./Microsoft-FactoryOrchestrator-Core.md 'Microsoft.FactoryOrchestrator.Core').[IFactoryOrchestratorService](./Microsoft-FactoryOrchestrator-Core-IFactoryOrchestratorService.md 'Microsoft.FactoryOrchestrator.Core.IFactoryOrchestratorService')
## IFactoryOrchestratorService.EnableLocalLoopbackForApp(string) Method
Enables local loopback on the given UWP app.
Enables local loopback on the given UWP app. Local loopback is enabled permanently for this app, persisting through reboots.
```csharp
void EnableLocalLoopbackForApp(string aumid);
```
Expand Down
Loading

0 comments on commit d2723c4

Please sign in to comment.