reseller plugin

This commit is contained in:
John Andrews
2024-12-26 17:04:25 +13:00
parent 178ea17e74
commit ec13e16a7b
21 changed files with 414 additions and 1 deletions

View File

@@ -43,6 +43,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PluginTestLibrary", "Plugin
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Docker", "Docker\Docker.csproj", "{2E26B8A7-269B-4E0C-A4D6-936B6FEC01F5}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Reseller", "Reseller\Reseller.csproj", "{AB24139B-9B44-47EA-829A-954CFFC23A65}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -129,6 +131,10 @@ Global
{2E26B8A7-269B-4E0C-A4D6-936B6FEC01F5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2E26B8A7-269B-4E0C-A4D6-936B6FEC01F5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2E26B8A7-269B-4E0C-A4D6-936B6FEC01F5}.Release|Any CPU.Build.0 = Release|Any CPU
{AB24139B-9B44-47EA-829A-954CFFC23A65}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{AB24139B-9B44-47EA-829A-954CFFC23A65}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AB24139B-9B44-47EA-829A-954CFFC23A65}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AB24139B-9B44-47EA-829A-954CFFC23A65}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View File

@@ -1,6 +1,8 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ANodeParameters_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2024_002E2_003Fresharper_002Dhost_003FSourcesCache_003Fdee079649268c95f3c443b7776c8ad605d45d1e95e2149305c1b1e8c5f6ad8_003FNodeParameters_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ANodeParameters_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003Fcfc0f1386e5572143ccffd1bc8bd48379d3d91186af93c9b49550ed882f885_003FNodeParameters_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ANodeParameters_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003Ff7d0aedce0548bec84f43fedd356938ebd764763a1151e1a2eb96ec0e8c612_003FNodeParameters_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003APlugin_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003F89a73480168b2779213e1e33ed41c89fcf9e077bebd56282de80fbc324f28_003FPlugin_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/Environment/UnitTesting/UnitTestSessionStore/Sessions/=b20312da_002Dc17d_002D4b13_002Db8cd_002D4b8138bf9db8/@EntryIndexedValue">&lt;SessionState ContinuousTestingMode="0" IsActive="True" Name="BurnIn" xmlns="urn:schemas-jetbrains-com:jetbrains-ut-session"&gt;
&lt;Or&gt;
&lt;TestAncestor&gt;

View File

@@ -50,7 +50,7 @@ public abstract class PlexNode:Node
args.Logger?.ILog("Working File (Unmapped): " + path);
if (args.IsDirectory == false)
{
// juse use /
// just use /
path = path.Replace("\\", "/");
path = path[..path.LastIndexOf("/", StringComparison.Ordinal)];
}

View File

@@ -0,0 +1,49 @@
using FileFlows.Plugin.Helpers;
namespace FileFlows.ResellerPlugin.FlowElements;
/// <summary>
/// Moves a file to a new location
/// </summary>
public class MoveToUserFolder: Node
{
/// <summary>
/// Gets the number of inputs
/// </summary>
public override int Inputs => 1;
/// <summary>
/// Gets the type of flow element
/// </summary>
public override FlowElementType Type => FlowElementType.Process;
/// <summary>
/// Gets the icon for the flow element
/// </summary>
public override string Icon => "fas fa-file-export";
/// <summary>
/// Gets the help URL
/// </summary>
public override string HelpUrl => "https://fileflows.com/docs/plugins/reseller/move-to-user-folder";
/// <inheritdoc />
public override int Execute(NodeParameters args)
{
if (args.Variables.TryGetValue("ResellerUserOutputDir", out var oOutputDir) == false || string.IsNullOrWhiteSpace(oOutputDir as string))
return args.Fail("No user output directory in variables");
var outputDir = (string)oOutputDir;
string filename = FileHelper.GetShortFileName(args.WorkingFile);
var noExtension = FileHelper.GetShortFileNameWithoutExtension(args.WorkingFile);
if(Guid.TryParse(noExtension, out _))
filename = FileHelper.GetShortFileNameWithoutExtension(args.LibraryFileName) + FileHelper.GetExtension(args.WorkingFile);
string fullPath = Path.Combine(outputDir, filename);
args.Logger?.ILog("Full Output Path: " + fullPath);
var result = args.MoveFile(fullPath);
if (result.Failed(out var error))
return args.Fail(error);
return 1;
}
}

6
Reseller/GlobalUsings.cs Normal file
View File

@@ -0,0 +1,6 @@
global using System;
global using System.Text;
global using System.ComponentModel.DataAnnotations;
global using FileFlows.Plugin;
global using FileFlows.Plugin.Attributes;
global using FileFlows.Common;

21
Reseller/Plugin.cs Normal file
View File

@@ -0,0 +1,21 @@
namespace FileFlows.ResellerPlugin;
/// <summary>
/// Plugin Information
/// </summary>
public class Plugin : FileFlows.Plugin.IPlugin
{
/// <inheritdoc />
public Guid Uid => new Guid("ba8cfaa3-4ac0-4a39-9e1b-a48def94eb3d");
/// <inheritdoc />
public string Name => "Reseller";
/// <inheritdoc />
public string MinimumVersion => "24.12.4.4168";
/// <inheritdoc />
public string Icon => "fas fa-people-carry";
/// <inheritdoc />
public void Init()
{
}
}

79
Reseller/Reseller.csproj Normal file
View File

@@ -0,0 +1,79 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<RootNamespace>FileFlows.ResellerPlugin</RootNamespace>
<FileVersion>1.1.1.528</FileVersion>
<ProductVersion>1.1.1.528</ProductVersion>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<Company>FileFlows</Company>
<Authors>John Andrews</Authors>
<Product>Reseller</Product>
<PackageProjectUrl>https://fileflows.com/</PackageProjectUrl>
<Description>Plugin that provides Reseller related flow elements</Description>
<TreatWarningsAsErrors>True</TreatWarningsAsErrors>
<LicenseFlag>Reseller</LicenseFlag>
</PropertyGroup>
<ItemGroup>
<None Update="i18n\*.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="i18n\de.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="i18n\en.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="i18n\es.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="i18n\fr.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="i18n\it.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="i18n\ja.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="i18n\ko.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="i18n\nl.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="i18n\pt.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="i18n\ru.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="i18n\sv.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="i18n\zh.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="i18n\zht.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup Condition=" '$(Configuration)' == 'Debug'">
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
<PackageReference Include="MSTest.TestAdapter" Version="3.4.3" />
<PackageReference Include="MSTest.TestFramework" Version="3.4.3" />
<ProjectReference Include="..\PluginTestLibrary\PluginTestLibrary.csproj" />
</ItemGroup>
<ItemGroup>
<Reference Include="FileFlows.Plugin">
<HintPath>..\FileFlows.Plugin.dll</HintPath>
</Reference>
<Reference Include="Common">
<HintPath>..\FileFlows.Common.dll</HintPath>
<SpecificVersion>False</SpecificVersion>
</Reference>
</ItemGroup>
</Project>

19
Reseller/i18n/de.json Normal file
View File

@@ -0,0 +1,19 @@
{
"Flow": {
"Parts": {
"MoveToUserFolder": {
"Description": "Verschiebt die Arbeitsdatei in das Ausgabeverzeichnis des Benutzers.",
"Label": "In Benutzerordner verschieben",
"Outputs": {
"1": "Datei wurde erfolgreich verschoben"
}
}
}
},
"Plugins": {
"Web": {
"Description": "Plugin, das flow-bezogene Elemente für Reseller bereitstellt",
"Label": "Reseller"
}
}
}

19
Reseller/i18n/en.json Normal file
View File

@@ -0,0 +1,19 @@
{
"Flow": {
"Parts": {
"MoveToUserFolder": {
"Description": "Moves the working file into the users output directory.",
"Label": "Move To User Folder",
"Outputs": {
"1": "File was was successfully moved"
}
}
}
},
"Plugins": {
"Web": {
"Description": "Plugin that provides Reseller related flow elements",
"Label": "Reseller"
}
}
}

19
Reseller/i18n/es.json Normal file
View File

@@ -0,0 +1,19 @@
{
"Flow": {
"Parts": {
"MoveToUserFolder": {
"Description": "Mueve el archivo de trabajo al directorio de salida del usuario.",
"Label": "Mover a la Carpeta del Usuario",
"Outputs": {
"1": "El archivo se movió con éxito"
}
}
}
},
"Plugins": {
"Web": {
"Description": "Complemento que proporciona elementos de flujo relacionados con el revendedor",
"Label": "Revendedor"
}
}
}

19
Reseller/i18n/fr.json Normal file
View File

@@ -0,0 +1,19 @@
{
"Flow": {
"Parts": {
"MoveToUserFolder": {
"Description": "Déplace le fichier de travail dans le répertoire de sortie de l'utilisateur.",
"Label": "Déplacer vers le Dossier Utilisateur",
"Outputs": {
"1": "Le fichier a été déplacé avec succès"
}
}
}
},
"Plugins": {
"Web": {
"Description": "Plugin qui fournit des éléments de flux liés aux revendeurs",
"Label": "Revendeur"
}
}
}

19
Reseller/i18n/it.json Normal file
View File

@@ -0,0 +1,19 @@
{
"Flow": {
"Parts": {
"MoveToUserFolder": {
"Description": "Sposta il file di lavoro nella directory di output dell'utente.",
"Label": "Sposta nella Cartella dell'Utente",
"Outputs": {
"1": "Il file è stato spostato con successo"
}
}
}
},
"Plugins": {
"Web": {
"Description": "Plugin che fornisce elementi di flusso relativi ai rivenditori",
"Label": "Rivenditore"
}
}
}

19
Reseller/i18n/ja.json Normal file
View File

@@ -0,0 +1,19 @@
{
"Flow": {
"Parts": {
"MoveToUserFolder": {
"Description": "作業ファイルをユーザーの出力ディレクトリに移動します。",
"Label": "ユーザーフォルダーに移動",
"Outputs": {
"1": "ファイルは正常に移動されました"
}
}
}
},
"Plugins": {
"Web": {
"Description": "リセラー関連のフロー要素を提供するプラグイン",
"Label": "リセラー"
}
}
}

19
Reseller/i18n/ko.json Normal file
View File

@@ -0,0 +1,19 @@
{
"Flow": {
"Parts": {
"MoveToUserFolder": {
"Description": "작업 파일을 사용자의 출력 디렉토리로 이동합니다.",
"Label": "사용자 폴더로 이동",
"Outputs": {
"1": "파일이 성공적으로 이동되었습니다"
}
}
}
},
"Plugins": {
"Web": {
"Description": "리셀러 관련 흐름 요소를 제공하는 플러그인",
"Label": "리셀러"
}
}
}

19
Reseller/i18n/nl.json Normal file
View File

@@ -0,0 +1,19 @@
{
"Flow": {
"Parts": {
"MoveToUserFolder": {
"Description": "Verplaatst het werkbestand naar de uitvoermap van de gebruiker.",
"Label": "Verplaats naar Gebruikersmap",
"Outputs": {
"1": "Bestand is succesvol verplaatst"
}
}
}
},
"Plugins": {
"Web": {
"Description": "Plugin die reseller-gerelateerde flow-elementen biedt",
"Label": "Reseller"
}
}
}

19
Reseller/i18n/pt.json Normal file
View File

@@ -0,0 +1,19 @@
{
"Flow": {
"Parts": {
"MoveToUserFolder": {
"Description": "Move o arquivo de trabalho para o diretório de saída do usuário.",
"Label": "Mover para a Pasta do Usuário",
"Outputs": {
"1": "O arquivo foi movido com sucesso"
}
}
}
},
"Plugins": {
"Web": {
"Description": "Plugin que fornece elementos de fluxo relacionados ao revendedor",
"Label": "Revendedor"
}
}
}

19
Reseller/i18n/ru.json Normal file
View File

@@ -0,0 +1,19 @@
{
"Flow": {
"Parts": {
"MoveToUserFolder": {
"Description": "Перемещает рабочий файл в выходной каталог пользователя.",
"Label": "Переместить в Папку Пользователя",
"Outputs": {
"1": "Файл успешно перемещен"
}
}
}
},
"Plugins": {
"Web": {
"Description": "Плагин, предоставляющий элементы потока, связанные с реселлерами",
"Label": "Реселлер"
}
}
}

19
Reseller/i18n/sv.json Normal file
View File

@@ -0,0 +1,19 @@
{
"Flow": {
"Parts": {
"MoveToUserFolder": {
"Description": "Flyttar arbetsfilen till användarens utmatningskatalog.",
"Label": "Flytta till Användarmapp",
"Outputs": {
"1": "Filen flyttades framgångsrikt"
}
}
}
},
"Plugins": {
"Web": {
"Description": "Plugin som tillhandahåller flödesrelaterade element för återförsäljare",
"Label": "Återförsäljare"
}
}
}

19
Reseller/i18n/zh.json Normal file
View File

@@ -0,0 +1,19 @@
{
"Flow": {
"Parts": {
"MoveToUserFolder": {
"Description": "将工作文件移动到用户的输出目录。",
"Label": "移动到用户文件夹",
"Outputs": {
"1": "文件已成功移动"
}
}
}
},
"Plugins": {
"Web": {
"Description": "提供与经销商相关的流程元素的插件",
"Label": "经销商"
}
}
}

19
Reseller/i18n/zht.json Normal file
View File

@@ -0,0 +1,19 @@
{
"Flow": {
"Parts": {
"MoveToUserFolder": {
"Description": "將工作檔案移動到使用者的輸出目錄。",
"Label": "移動到使用者資料夾",
"Outputs": {
"1": "檔案已成功移動"
}
}
}
},
"Plugins": {
"Web": {
"Description": "提供與經銷商相關的流程元素的外掛程式",
"Label": "經銷商"
}
}
}

View File

@@ -1,5 +1,8 @@
namespace FileFlows.Web;
/// <summary>
/// Plugin Information
/// </summary>
public class Plugin : FileFlows.Plugin.IPlugin
{
/// <inheritdoc />