docs are built in PR/CI and published as artifact if needed (#65)

This commit is contained in:
Jake Friedman 2020-11-19 12:52:34 -08:00 коммит произвёл GitHub
Родитель 2ef40e79bb
Коммит c0d1858e46
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
11 изменённых файлов: 100 добавлений и 1693 удалений

3
.gitignore поставляемый
Просмотреть файл

@ -339,3 +339,6 @@ venv/
# Mkdocs site out
site/
# Ignore autogenerated C# files
**/*Autogenerated.cs

Просмотреть файл

@ -83,7 +83,10 @@ FactoryOrchestrator contains a series of unsigned powershell scripts. Windows se
Documentation on Execution Policy:
https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.security/set-executionpolicy?view=powershell-7
When building the source code, keep in mind that certain actions only occur when the build is run as part of an Azure DevOps Pipeline or when run in the "Release" configuration locally. For example, [DocFX documentation](https://dotnet.github.io/docfx/) for the Core and Client Libraries is only generated when the build is run in in one of those two modes. These actions are skipped in Debug builds to increase inner-dev-loop speed.
## Other notes
* When building the source code, keep in mind that certain actions only occur when the build is run as part of an Azure DevOps Pipeline or when run in the "Release" configuration locally. For example, [DocFX documentation](https://dotnet.github.io/docfx/) for the Core and Client Libraries is only generated when the build is run in in one of those two modes. These actions are skipped in Debug builds to increase inner-dev-loop speed.
* You may see IntelliSense errors before building FactoryOrchestratorCoreLibrary, as that project creates Autogenerated C# files used in other projects.
## Debugging

Просмотреть файл

@ -197,6 +197,12 @@ foreach ($line in $interfaceContent)
$outputContent += "`n$indent}`n}"
# Save to file
$OutFolder = [System.IO.Path]::GetDirectoryName($OutputFile)
if ((Test-Path $OutFolder) -eq $false)
{
$Folder = New-Item -Path $OutFolder -ItemType Directory
}
Copy-Item -Path "$TemplateFile" -Destination "$OutputFile"
Add-Content -Path "$OutputFile" -Value "$outputContent"

Просмотреть файл

@ -59,3 +59,27 @@ jobs:
runInParallel: true
vsTestVersion: latest
runSettingsFile: '$(System.DefaultWorkingDirectory)\src\Tests\defaults.runsettings'
- script: |
cd $(Build.SourcesDirectory)
pip install --upgrade pip --upgrade -r $(System.DefaultWorkingDirectory)\docs\requirements.txt
mkdocs build --clean --config-file $(System.DefaultWorkingDirectory)\docs\mkdocs.yml
git fetch
git checkout gh-pages
robocopy $(System.DefaultWorkingDirectory)\docs\site\ $(System.DefaultWorkingDirectory)\ /S
git restore sitemap.xml*
git add -A
git diff --cached --exit-code
echo ##vso[task.setvariable variable=hasChanges]%errorlevel%
mkdir $(Build.ArtifactStagingDirectory)\Patch
git diff --cached > $(Build.ArtifactStagingDirectory)\Patch\UpdatedDocs.patch
displayName: 'Build and check for changes to website'
- task: PublishPipelineArtifact@1
displayName: 'Publish patch file as artifact if website has changes'
condition: eq(variables['hasChanges'], '1')
inputs:
artifactName: UpdatedDocsPatch
targetPath: $(Build.ArtifactStagingDirectory)\Patch
- script: |
echo ##vso[task.logissue type=warning]gh-pages documentation needs updating! Use the published UpdatedDocsPatch artifact to update the gh-pages branch after this PR is completed.
displayName: 'Warn if website has changes'
condition: eq(variables['hasChanges'], '1')

Просмотреть файл

@ -59,4 +59,27 @@ jobs:
runInParallel: true
vsTestVersion: latest
runSettingsFile: '$(System.DefaultWorkingDirectory)\src\Tests\defaults.runsettings'
- script: |
cd $(Build.SourcesDirectory)
pip install --upgrade pip --upgrade -r $(System.DefaultWorkingDirectory)\docs\requirements.txt
mkdocs build --clean --config-file $(System.DefaultWorkingDirectory)\docs\mkdocs.yml
git fetch
git checkout gh-pages
robocopy $(System.DefaultWorkingDirectory)\docs\site\ $(System.DefaultWorkingDirectory)\ /S
git restore sitemap.xml*
git add -A
git diff --cached --exit-code
echo ##vso[task.setvariable variable=hasChanges]%errorlevel%
mkdir $(Build.ArtifactStagingDirectory)\Patch
git diff --cached > $(Build.ArtifactStagingDirectory)\Patch\UpdatedDocs.patch
displayName: 'Build and check for changes to website'
- task: PublishPipelineArtifact@1
displayName: 'Publish patch file as artifact if website has changes'
condition: eq(variables['hasChanges'], '1')
inputs:
artifactName: UpdatedDocsPatch
targetPath: $(Build.ArtifactStagingDirectory)\Patch
- script: |
echo ##vso[task.logissue type=warning]gh-pages documentation needs updating! Use the published UpdatedDocsPatch artifact to update the gh-pages branch.
displayName: 'Warn if website has changes'
condition: eq(variables['hasChanges'], '1')

Просмотреть файл

@ -4,24 +4,32 @@
We welcome contributions on our documentation as well under the same code of conduct as the rest of the project.
To build & locally view the docs you can follow [these steps](https://www.mkdocs.org/#building-the-site):
To edit and locally view the docs you can follow [these steps](https://www.mkdocs.org/#building-the-site):
From the root:
## One-time setup:
1. pip install --upgrade -r requirements.txt
2. mkdocs build --clean
3. mkdocs serve
1. Install python
2. From this directory (\docs) run: pip install --upgrade -r requirements.txt
Once you are happy with the changes, you can prepare a pull request to update the checked in docs as you would with any other code change.
## Viewing changes locally
1. From this directory (\docs) run: mkdocs serve
When completed, then you will have to manually update the live docs by do the following from the root (todo: make better):
## Commiting changes to the live site
Once you are happy with your changes, you will have to manually update the live docs by doing the following from the root folder (TODO: make part of the CI build):
1. (optional- in case you rev'd it) mkdocs build --clean --config-file .\docs\mkdocs.yml
2. git checkout gh-pages
3. git checkout -b <topic branch with>
4. Commit your changes, open a pull request. Once approved and the remote 'gh-branch' has the last changes then it will update the website.
1. Checkout a working branch based on the latest code in 'main'.
2. Make your desired documentation changes.
3. mkdocs build --clean --config-file .\docs\mkdocs.yml
4. git checkout gh-pages
5. robocopy /S .\docs\site\ .\
6. git checkout -b <your working branch>
7. Commit & push your changes, open a pull request into 'gh-pages'. Once approved and the remote 'gh-pages' has the changes it will update the website automatically.
## ## Open Source Software Acknowledgments
To help prevent documentation<->code mismatches, the GitHub PR build will detect if your code changes will result in any documentation updates. If documentation updates are needed, the build will generate a build warning and publish a Git .patch file. The .patch file can be used to make a PR into 'gh-pages' in lieu of the steps above.
Please note that any changes to the public API surface of the ClientLibrary and/or CoreLibrary classes will result in documentation changes. If you see your changes result in modified files in docs\docs, you must run the above steps to rebuild the website source manually!
## Open Source Software Acknowledgments
### Mkdocs

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -32,7 +32,10 @@
</ItemGroup>
<ItemGroup>
<!-- Created by SetSourceVersion -->
<Compile Include="obj\AssemblyInfo.cs" />
<!-- Created by AutoGenerateInterfaceHelper in CoreLibrary -->
<Compile Include="obj\FactoryOrchestratorClientAutogenerated.cs" />
<Compile Remove="Properties\AssemblyInfo.cs" />
</ItemGroup>

Просмотреть файл

@ -75,8 +75,8 @@
</Target>
<Target Name="AfterBuildPS" AfterTargets="Build">
<Exec Command="Powershell.exe $(ProjectDir)..\..\build\AutoGenerateInterfaceHelper.ps1 -InterfaceName IFactoryOrchestratorService -InterfaceFile $(ProjectDir)IPCInterface.cs -TemplateFile $(ProjectDir)ClientTemplate\IPCInterfaceHelperTemplate.cs -OutputFile $(ProjectDir)..\ClientLibrary\FactoryOrchestratorClientAutogenerated.cs -Async" />
<Exec Command="Powershell.exe $(ProjectDir)..\..\build\AutoGenerateInterfaceHelper.ps1 -InterfaceName IFactoryOrchestratorService -InterfaceFile $(ProjectDir)IPCInterface.cs -TemplateFile $(ProjectDir)ClientTemplate\IPCInterfaceHelperTemplateSync.cs -OutputFile $(ProjectDir)..\PowerShellLibrary\FactoryOrchestratorClientSyncAutogenerated.cs" />
<Exec Command="Powershell.exe $(ProjectDir)..\..\build\AutoGenerateInterfaceHelper.ps1 -InterfaceName IFactoryOrchestratorService -InterfaceFile $(ProjectDir)IPCInterface.cs -TemplateFile $(ProjectDir)ClientTemplate\IPCInterfaceHelperTemplate.cs -OutputFile $(ProjectDir)..\ClientLibrary\obj\FactoryOrchestratorClientAutogenerated.cs -Async" />
<Exec Command="Powershell.exe $(ProjectDir)..\..\build\AutoGenerateInterfaceHelper.ps1 -InterfaceName IFactoryOrchestratorService -InterfaceFile $(ProjectDir)IPCInterface.cs -TemplateFile $(ProjectDir)ClientTemplate\IPCInterfaceHelperTemplateSync.cs -OutputFile $(ProjectDir)..\PowerShellLibrary\obj\FactoryOrchestratorClientSyncAutogenerated.cs" />
</Target>
<Target Name="FixAndCopyMd" AfterTargets="Build">
<ItemGroup>

Просмотреть файл

@ -1,527 +0,0 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
//
// Autogenerated by building FactoryOrchestratorCoreLibrary. DO NOT MODIFY, CHANGES WILL BE LOST.
//
using Microsoft.FactoryOrchestrator.Core;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using TaskStatus = Microsoft.FactoryOrchestrator.Core.TaskStatus;
namespace Microsoft.FactoryOrchestrator.Client
{
public partial class FactoryOrchestratorClientSync
{
/// <summary>
/// Stops all running Tasks and deletes all TaskLists.
/// </summary>
/// <param name="preserveLogs">If true, are logs not deleted.</param>
/// <param name="factoryReset">If true, the service is restarted as if it is first boot.</param>
public void ResetService(bool preserveLogs = false, bool factoryReset = false)
{
AsyncClient.ResetService(preserveLogs , factoryReset ).Wait();
}
/// <summary>
/// Gets all Service events.
/// </summary>
/// <returns>List of all Service events.</returns>
public List<ServiceEvent> GetServiceEvents()
{
return AsyncClient.GetServiceEvents().Result;
}
/// <summary>
/// Get all Service events since given time.
/// </summary>
/// <param name="timeLastChecked"></param>
/// <returns>List of Service events.</returns>
public List<ServiceEvent> GetServiceEvents(DateTime timeLastChecked)
{
return AsyncClient.GetServiceEvents(timeLastChecked).Result;
}
/// <summary>
/// Get all Service events since given index.
/// </summary>
/// <param name="lastEventIndex"></param>
/// <returns>List of Service events.</returns>
public List<ServiceEvent> GetServiceEvents(ulong lastEventIndex)
{
return AsyncClient.GetServiceEvents(lastEventIndex).Result;
}
/// <summary>
/// Get last Service error.
/// </summary>
/// <returns></returns>
public ServiceEvent GetLastServiceError()
{
return AsyncClient.GetLastServiceError().Result;
}
/// <summary>
/// Returns the version of Factory Orchestrator Service.
/// </summary>
/// <returns>string representing the Service version.</returns>
public string GetServiceVersionString()
{
return AsyncClient.GetServiceVersionString().Result;
}
/// <summary>
/// Returns the version of the Windows OS.
/// </summary>
/// <returns>string representing the Windows OS version.</returns>
public string GetOSVersionString()
{
return AsyncClient.GetOSVersionString().Result;
}
/// <summary>
/// Returns the version set by the OEM duing WSK Image Customization.
/// </summary>
/// <returns>string representing the OEM version.</returns>
public string GetOEMVersionString()
{
return AsyncClient.GetOEMVersionString().Result;
}
/// <summary>
/// Sets the path to TE.exe, used to run TAEF tests.
/// </summary>
/// <param name="teExePath">Path to TE.exe</param>
/// <returns></returns>
public void SetTeExePath(string teExePath)
{
AsyncClient.SetTeExePath(teExePath).Wait();
}
/// <summary>
/// Sets the log folder path used by Factory Orchestrator.
/// </summary>
/// <param name="path">Path to the desired folder.</param>
/// <param name="moveExistingLogs">If true, existing logs are moved to the new location.</param>
/// <returns></returns>
public void SetLogFolder(string path, bool moveExistingLogs)
{
AsyncClient.SetLogFolder(path, moveExistingLogs).Wait();
}
/// <summary>
/// Gets the log folder path used by Factory Orchestrator.
/// </summary>
/// <returns>Path to the log folder.</returns>
public string GetLogFolder()
{
return AsyncClient.GetLogFolder().Result;
}
/// <summary>
/// Gets a list of IP addresses and the Network Adapter each IP address belongs to.
/// </summary>
/// <returns>A list of IP addresses and the Network Adapter each IP address belongs to.</returns>
public List<Tuple<string, string>> GetIpAddressesAndNicNames()
{
return AsyncClient.GetIpAddressesAndNicNames().Result;
}
/// <summary>
/// Gets a list of IP addresses for the container. These IPs are internal, they cannot be accessed outside of the host.
/// </summary>
/// <returns>A list of IP addresses for the container.</returns>
public List<string> GetContainerIpAddresses()
{
return AsyncClient.GetContainerIpAddresses().Result;
}
/// <summary>
/// Checks if the service is executing boot tasks. While executing boot tasks, many commands cannot be run.
/// </summary>
/// <returns><c>true</c> is the service is executing boot tasks.</returns>
public bool IsExecutingBootTasks()
{
return AsyncClient.IsExecutingBootTasks().Result;
}
/// <summary>
/// Determines whether the connected device has a container present and running.
/// </summary>
/// <returns>
/// <c>true</c> if container is present and running; otherwise, <c>false</c>.
/// </returns>
public bool IsContainerRunning()
{
return AsyncClient.IsContainerRunning().Result;
}
/// <summary>
/// Gets a list of Factory Orchestrator App pages that were disabled by OEM Customization.
/// </summary>
/// <returns>A list of page tags that should be disabled.</returns>
public List<string> GetDisabledPages()
{
return AsyncClient.GetDisabledPages().Result;
}
/// <summary>
/// Checks if the service supports network access.
/// </summary>
/// <returns><c>true</c> if the service allows connections over the local network.</returns>
public bool IsNetworkAccessEnabled()
{
return AsyncClient.IsNetworkAccessEnabled().Result;
}
/// <summary>
/// Creates a new TaskList by finding all .exe, .cmd, .bat, .ps1, and TAEF files in a given folder.
/// </summary>
/// <param name="path">Path of the directory to search.</param>
/// <param name="recursive">If true, search recursively.</param>
/// <returns>The created TaskList</returns>
public TaskList CreateTaskListFromDirectory(string path, bool recursive = false)
{
return AsyncClient.CreateTaskListFromDirectory(path, recursive ).Result;
}
/// <summary>
/// Creates new TaskLists by loading them from a FactoryOrchestratorXML file.
/// </summary>
/// <param name="filename">The path to the FactoryOrchestratorXML file.</param>
/// <returns>The GUID(s) of the created TaskList(s)</returns>
public List<Guid> LoadTaskListsFromXmlFile(string filename)
{
return AsyncClient.LoadTaskListsFromXmlFile(filename).Result;
}
/// <summary>
/// Saves a TaskList to a FactoryOrchestratorXML file.
/// </summary>
/// <param name="guid">The GUID of the TaskList you wish to save.</param>
/// <param name="filename">The path to the FactoryOrchestratorXML file that will be created.</param>
/// <returns>true on success</returns>
public void SaveTaskListToXmlFile(Guid guid, string filename)
{
AsyncClient.SaveTaskListToXmlFile(guid, filename).Wait();
}
/// <summary>
/// Saves all TaskLists in the Service to a FactoryOrchestratorXML file.
/// </summary>
/// <param name="filename">The path to the FactoryOrchestratorXML file that will be created.</param>
/// <returns>true on success</returns>
public void SaveAllTaskListsToXmlFile(string filename)
{
AsyncClient.SaveAllTaskListsToXmlFile(filename).Wait();
}
/// <summary>
/// Creates a TaskList on the Service by copying a TaskList object provided by the Client.
/// </summary>
/// <param name="list">The TaskList to add to the Service.</param>
/// <returns>The created Service TaskList.</returns>
public TaskList CreateTaskListFromTaskList(TaskList list)
{
return AsyncClient.CreateTaskListFromTaskList(list).Result;
}
/// <summary>
/// Gets the GUID of every "active" TaskList on the Service. If "IsExecutingBootTasks()" returns true, this returns the "boot" TaskLists. Otherwise, it returns the "normal" TaskLists.
/// </summary>
/// <returns>The list of TaskList GUIDs.</returns>
public List<Guid> GetTaskListGuids()
{
return AsyncClient.GetTaskListGuids().Result;
}
/// <summary>
/// Gets TaskList summaries for every "active" TaskList on the Service. If "IsExecutingBootTasks()" returns true, this returns the "boot" TaskLists. Otherwise, it returns the "normal" TaskLists. The summary contains basic info about the TaskList.
/// </summary>
/// <returns>A list of TaskListSummary objects.</returns>
public List<TaskListSummary> GetTaskListSummaries()
{
return AsyncClient.GetTaskListSummaries().Result;
}
/// <summary>
/// Gets the GUID of every "boot" TaskList on the Service.
/// </summary>
/// <returns>The list of TaskList GUIDs.</returns>
public List<Guid> GetBootTaskListGuids()
{
return AsyncClient.GetBootTaskListGuids().Result;
}
/// <summary>
/// Gets "boot" TaskList summaries for every "boot" TaskList on the Service. The summary contains basic info about the TaskList.
/// </summary>
/// <returns>A list of TaskListSummary objects.</returns>
public List<TaskListSummary> GetBootTaskListSummaries()
{
return AsyncClient.GetBootTaskListSummaries().Result;
}
/// <summary>
/// Gets the TaskList object for a given TaskList GUID.
/// </summary>
/// <param name="taskListGuid">The TaskList GUID.</param>
/// <returns>The TaskList object with that GUID.</returns>
public TaskList QueryTaskList(Guid taskListGuid)
{
return AsyncClient.QueryTaskList(taskListGuid).Result;
}
/// <summary>
/// Deletes a TaskList on the Service.
/// </summary>
/// <param name="listToDelete">The GUID of the TaskList to delete.</param>
/// <returns>true if it was deleted successfully.</returns>
public void DeleteTaskList(Guid listToDelete)
{
AsyncClient.DeleteTaskList(listToDelete).Wait();
}
/// <summary>
/// Updates an existing TaskList on the Service.
/// </summary>
/// <param name="taskList">The updated TaskList.</param>
/// <returns>true if it was updated successfully.</returns>
public void UpdateTaskList(TaskList taskList)
{
AsyncClient.UpdateTaskList(taskList).Wait();
}
/// <summary>
/// Reorders the TaskLists known to the Service.
/// </summary>
/// <param name="newOrder">An ordered list of GUIDs corresponding to the TaskList GUIDs known to the Service.</param>
public void ReorderTaskLists(List<Guid> newOrder)
{
AsyncClient.ReorderTaskLists(newOrder).Wait();
}
/// <summary>
/// Returns the Task object for a given Task GUID.
/// </summary>
/// <param name="guid">The Task GUID.</param>
/// <returns></returns>
public TaskBase QueryTask(Guid guid)
{
return AsyncClient.QueryTask(guid).Result;
}
/// <summary>
/// Gets the AUMIDs of all installed apps on the OS. Requires Windows Device Portal.
/// </summary>
/// <returns>The list of app AUMIDs.</returns>
public List<string> GetInstalledApps()
{
return AsyncClient.GetInstalledApps().Result;
}
/// <summary>
/// Installs an app package on the Service's computer. The app package must already be on the Service's computer. Requires Windows Device Portal.
/// If the app package is not on the Service's computer already, use SendAndInstallApp() to copy and install it instead.
/// </summary>
/// <param name="appPackagePath">Path on the Service's computer to the app package (.appx, .appxbundle, .msix, .msixbundle).</param>
/// <param name="dependentPackages">List of paths on the Service's computer to the app's dependent packages.</param>
/// <param name="certificateFile">Path on the Service's computer to the app's certificate file, if needed. Microsoft Store signed apps do not need a certificate.</param>
public void InstallApp(string appPackagePath, List<string> dependentPackages = null, string certificateFile = null)
{
AsyncClient.InstallApp(appPackagePath, dependentPackages , certificateFile ).Wait();
}
/// <summary>
/// Enables local loopback on the given UWP app.
/// </summary>
/// <param name="aumid">The Application User Model ID (AUMID) of the app to enable local loopback on.</param>
public void EnableLocalLoopbackForApp(string aumid)
{
AsyncClient.EnableLocalLoopbackForApp(aumid).Wait();
}
/// <summary>
/// Executes all TaskLists in order.
/// </summary>
/// <returns><c>true</c> if the TaskLists are successfully queued to run.</returns>
public bool RunAllTaskLists()
{
return AsyncClient.RunAllTaskLists().Result;
}
/// <summary>
/// Executes a TaskList.
/// </summary>
/// <param name="taskListGuid">GUID of the TaskList to run.</param>
/// <param name="initialTask">Index of the Task to start the run from.</param>
/// <returns></returns>
public void RunTaskList(Guid taskListGuid, int initialTask = 0)
{
AsyncClient.RunTaskList(taskListGuid, initialTask ).Wait();
}
/// <summary>
/// Stops all executing Tasks and/or TaskLists.
/// </summary>
public void AbortAll()
{
AsyncClient.AbortAll().Wait();
}
/// <summary>
/// Stops executing a TaskList.
/// </summary>
/// <param name="taskListGuid">The GUID of the TaskList to stop.</param>
public void AbortTaskList(Guid taskListGuid)
{
AsyncClient.AbortTaskList(taskListGuid).Wait();
}
/// <summary>
/// Stops executing a TaskRun.
/// </summary>
/// <param name="taskRunGuid">The GUID of the TaskRun to stop.</param>
public void AbortTaskRun(Guid taskRunGuid)
{
AsyncClient.AbortTaskRun(taskRunGuid).Wait();
}
/// <summary>
/// Runs an executable (.exe) outside of a Task/TaskList.
/// </summary>
/// <param name="exeFilePath">Full path to the .exe file</param>
/// <param name="arguments">Arguments to pass to the .exe</param>
/// <param name="logFilePath">Optional log file to save the console output to.</param>
/// <param name="runInContainer">If true, run the executable in the container of the connected device.</param>
/// <returns>The TaskRun associated with the .exe</returns>
public TaskRun RunExecutable(string exeFilePath, string arguments, string logFilePath = null, bool runInContainer = false)
{
return AsyncClient.RunExecutable(exeFilePath, arguments, logFilePath , runInContainer ).Result;
}
/// <summary>
/// Runs a UWP app outside of a Task/TaskList. Requires Windows Device Portal.
/// </summary>
/// <param name="aumid">The Application User Model ID (AUMID) of the app to run.</param>
/// <returns></returns>
public TaskRun RunApp(string aumid)
{
return AsyncClient.RunApp(aumid).Result;
}
/// <summary>
/// Runs a Task outside of a TaskList.
/// </summary>
/// <param name="taskGuid">The GUID of the Task to run.</param>
/// <returns>The TaskRun associated with the run.</returns>
public TaskRun RunTask(Guid taskGuid)
{
return AsyncClient.RunTask(taskGuid).Result;
}
/// <summary>
/// Runs a Task outside of a TaskList.
/// </summary>
/// <param name="task">The Task to run.</param>
/// <returns>The TaskRun associated with the run.</returns>
public TaskRun RunTask(TaskBase task)
{
return AsyncClient.RunTask(task).Result;
}
/// <summary>
/// Updates the status of a TaskRun.
/// </summary>
/// <param name="taskRun">The TaskRun to update.</param>
/// <returns>true if it was updated.</returns>
public void UpdateTaskRun(TaskRun taskRun)
{
AsyncClient.UpdateTaskRun(taskRun).Wait();
}
/// <summary>
/// Gets a TaskRun object.
/// </summary>
/// <param name="taskRunGuid">The GUID of the desired TaskRun</param>
/// <returns>The TaskRun object.</returns>
public TaskRun QueryTaskRun(Guid taskRunGuid)
{
return AsyncClient.QueryTaskRun(taskRunGuid).Result;
}
/// <summary>
/// Gets all the data in a file on the Service's computer. It is recommended you use FactoryOrchestratorClient::GetFileFromDevice instead.
/// </summary>
/// <param name="sourceFilename">The path to the file to retrieve.</param>
/// <param name="offset">If -1, read the whole file. Otherwise the starting byte to read the file from.</param>
/// <param name="count">If offset is -1 this is ignored. Otherwise, the number of bytes to read from the file.</param>
/// <param name="getFromContainer">If true, get the file from the container running on the connected device.</param>
/// <returns>The bytes in the file.</returns>
public byte[] GetFile(string sourceFilename, long offset = -1, int count = 0, bool getFromContainer = false)
{
return AsyncClient.GetFile(sourceFilename, offset , count , getFromContainer ).Result;
}
/// <summary>
/// Saves data to a file to the Service's computer. It is recommended you use FactoryOrchestratorClient::SendFileToDevice instead.
/// </summary>
/// <param name="targetFilename">The name of the file you want created on the Service's computer.</param>
/// <param name="fileData">The bytes you want saved to that file.</param>
/// <param name="appendFile">If true, the file is appended to instead of overwritten.</param>
/// <param name="sendToContainer">If true, send the file to the container running on the connected device.</param>
/// <returns>true if the file was sucessfully created.</returns>
public void SendFile(string targetFilename, byte[] fileData, bool appendFile = false, bool sendToContainer = false)
{
AsyncClient.SendFile(targetFilename, fileData, appendFile , sendToContainer ).Wait();
}
/// <summary>
/// Permanently deletes a file or folder. If a folder, all contents are deleted.
/// </summary>
/// <param name="path">File or folder to delete</param>
/// <param name="deleteInContainer">If true, delete the file from the container running on the connected device.</param>
public void DeleteFileOrFolder(string path, bool deleteInContainer = false)
{
AsyncClient.DeleteFileOrFolder(path, deleteInContainer ).Wait();
}
/// <summary>
/// Moves a file or folder to a new location.
/// </summary>
/// <param name="sourcePath">File or folder to move</param>
/// <param name="destinationPath">Destination path</param>
/// <param name="moveInContainer">If true, move the file from the container running on the connected device.</param>
public void MoveFileOrFolder(string sourcePath, string destinationPath, bool moveInContainer = false)
{
AsyncClient.MoveFileOrFolder(sourcePath, destinationPath, moveInContainer ).Wait();
}
/// <summary>
/// Returns a list of all directories in a given folder.
/// </summary>
/// <param name="path">The folder to search.</param>
/// <param name="recursive">If true, search recursively.</param>
/// <param name="inContainer">If true, look for directories in the container running on the connected device.</param>
/// <returns></returns>
public List<string> EnumerateDirectories(string path, bool recursive = false, bool inContainer = false)
{
return AsyncClient.EnumerateDirectories(path, recursive , inContainer ).Result;
}
/// <summary>
/// Returns a list of all files in a given folder.
/// </summary>
/// <param name="path">The folder to search.</param>
/// <param name="recursive">If true, search recursively.</param>
/// <param name="inContainer">If true, look for files in the container running on the connected device.</param>
/// <returns></returns>
public List<string> EnumerateFiles(string path, bool recursive = false, bool inContainer = false)
{
return AsyncClient.EnumerateFiles(path, recursive , inContainer ).Result;
}
}
}

Просмотреть файл

@ -22,7 +22,10 @@
</ItemGroup>
<ItemGroup>
<!-- Created by SetSourceVersion -->
<Compile Include="obj\AssemblyInfo.cs" />
<!-- Created by AutoGenerateInterfaceHelper in CoreLibrary -->
<Compile Include="obj\FactoryOrchestratorClientSyncAutogenerated.cs" />
<Compile Remove="Properties\AssemblyInfo.cs" />
<None Include="FactoryOrchestratorClient.psd1" CopyToOutputDirectory="Always" CopyToPublishDirectory="Always" />
</ItemGroup>