file drop

This commit is contained in:
John Andrews
2025-02-15 21:34:18 +13:00
parent c07e4832e7
commit f226872cc5
23 changed files with 180 additions and 180 deletions
+79
View File
@@ -0,0 +1,79 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<RootNamespace>FileFlows.FileDropPlugin</RootNamespace>
<FileVersion>1.1.1.528</FileVersion>
<ProductVersion>1.1.1.528</ProductVersion>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<Company>FileFlows</Company>
<Authors>John Andrews</Authors>
<Product>File Drop</Product>
<PackageProjectUrl>https://fileflows.com/</PackageProjectUrl>
<Description>Plugin that provides File Drop related flow elements</Description>
<TreatWarningsAsErrors>True</TreatWarningsAsErrors>
<LicenseFlag>File Drop</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>
+46
View File
@@ -0,0 +1,46 @@
using FileFlows.Plugin.Helpers;
namespace FileFlows.FileDropPlugin.FlowElements;
/// <summary>
/// Moves a file to a new location
/// </summary>
public class MoveToUserFolder: Node
{
/// <inheritdoc />
public override int Inputs => 1;
/// <inheritdoc />
public override int Outputs => 1;
/// <inheritdoc />
public override FlowElementType Type => FlowElementType.Process;
/// <inheritdoc />
public override string Icon => "fas fa-file-export";
/// <inheritdoc />
public override string HelpUrl => "https://fileflows.com/docs/plugins/file-drop/move-to-user-folder";
/// <inheritdoc />
public override string Group => "File Drop";
/// <inheritdoc />
public override int Execute(NodeParameters args)
{
if (args.Variables.TryGetValue("FileDropUserOutputDir", 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;
}
}
@@ -0,0 +1,43 @@
namespace FileFlows.FileDropPlugin.FlowElements;
/// <summary>
/// Sets the display name ot a file drop friendly name
/// </summary>
public class SetFileDropDisplayName : Node
{
/// <inheritdoc />
public override int Inputs => 1;
/// <inheritdoc />
public override int Outputs => 1;
/// <inheritdoc />
public override string HelpUrl => "https://fileflows.com/docs/plugins/file-drop/set-file-drop-display-name";
/// <inheritdoc />
public override string Group => "File Drop";
/// <inheritdoc />
public override FlowElementType Type => FlowElementType.Process;
/// <inheritdoc />
public override string Icon => "fas fa-file-signature";
/// <inheritdoc />
public override int Execute(NodeParameters args)
{
var username = Variables["FileDropUser"]?.ToString() ??
Variables["FileDropUserUid"]?.ToString();
if (string.IsNullOrWhiteSpace(username))
{
args.Logger?.WLog("Failed to get file drop username");
return 1;
}
var shortname = Variables["ShortName"]?.ToString();
if (string.IsNullOrWhiteSpace(shortname))
{
args.Logger?.WLog("Failed to get shortname");
return 1;
}
args.SetDisplayName($"{username}: {shortname}");
return base.Execute(args);
}
}
+6
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
View File
@@ -0,0 +1,21 @@
namespace FileFlows.FileDropPlugin;
/// <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 => "File Drop";
/// <inheritdoc />
public string MinimumVersion => "24.12.4.4168";
/// <inheritdoc />
public string Icon => "fas fa-people-carry";
/// <inheritdoc />
public void Init()
{
}
}
+26
View File
@@ -0,0 +1,26 @@
{
"Flow": {
"Parts": {
"MoveToUserFolder": {
"Description": "Verschiebt die Arbeitsdatei in das Ausgabeverzeichnis des Benutzers.",
"Label": "In Benutzerordner verschieben",
"Outputs": {
"1": "Datei wurde erfolgreich verschoben"
}
},
"SetFileDropDisplayName": {
"Description": "Legt den Anzeigenamen für eine Datei basierend auf den Dateiinformationen des File Drops fest, um Klarheit über die Dateiidentität und den Besitz zu gewährleisten.",
"Label": "Datei Drop Anzeigenamen festlegen",
"Outputs": {
"1": "Anzeigename festgelegt"
}
}
}
},
"Plugins": {
"FileDrop": {
"Description": "Plugin, das File Drop bezogene Flow-Elemente bereitstellt",
"Label": "File Drop"
}
}
}
+26
View File
@@ -0,0 +1,26 @@
{
"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"
}
},
"SetFileDropDisplayName": {
"Description": "Sets the display name for a file based on file drop file information, ensuring clarity on file identity and ownership.",
"Label": "Set File Drop Display Name",
"Outputs": {
"1": "Display name set"
}
}
}
},
"Plugins": {
"FileDrop": {
"Description": "Plugin that provides File Drop related flow elements",
"Label": "File Drop"
}
}
}
+26
View File
@@ -0,0 +1,26 @@
{
"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"
}
},
"SetFileDropDisplayName": {
"Description": "Establece el nombre para mostrar de un archivo según la información del archivo de File Drop, asegurando claridad sobre la identidad y propiedad del archivo.",
"Label": "Establecer nombre para mostrar del archivo de File Drop",
"Outputs": {
"1": "Nombre para mostrar establecido"
}
}
}
},
"Plugins": {
"FileDrop": {
"Description": "Complemento que proporciona elementos de flujo relacionados con File Drop",
"Label": "File Drop"
}
}
}
+26
View File
@@ -0,0 +1,26 @@
{
"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"
}
},
"SetFileDropDisplayName": {
"Description": "Définit le nom affiché d'un fichier en fonction des informations du fichier de File Drop, garantissant la clarté de l'identité et de la propriété du fichier.",
"Label": "Définir le nom affiché du fichier de File Drop",
"Outputs": {
"1": "Nom affiché défini"
}
}
}
},
"Plugins": {
"FileDrop": {
"Description": "Plugin qui fournit des éléments de flux liés à File Drop",
"Label": "File Drop"
}
}
}
+26
View File
@@ -0,0 +1,26 @@
{
"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"
}
},
"SetFileDropDisplayName": {
"Description": "Imposta il nome visualizzato di un file in base alle informazioni del file di File Drop, garantendo chiarezza sull'identità e la proprietà del file.",
"Label": "Imposta il nome visualizzato del file di File Drop",
"Outputs": {
"1": "Nome visualizzato impostato"
}
}
}
},
"Plugins": {
"FileDrop": {
"Description": "Plugin che fornisce elementi di flusso relativi a File Drop",
"Label": "File Drop"
}
}
}
+26
View File
@@ -0,0 +1,26 @@
{
"Flow": {
"Parts": {
"MoveToUserFolder": {
"Description": "作業ファイルをユーザーの出力ディレクトリに移動します。",
"Label": "ユーザーフォルダーに移動",
"Outputs": {
"1": "ファイルは正常に移動されました"
}
},
"SetFileDropDisplayName": {
"Description": "ファイルのドロップ情報に基づいてファイルの表示名を設定し、ファイルの識別と所有権が明確であることを保証します。",
"Label": "ファイルドロップ表示名を設定",
"Outputs": {
"1": "表示名が設定されました"
}
}
}
},
"Plugins": {
"FileDrop": {
"Description": "File Drop 関連のフロー要素を提供するプラグイン",
"Label": "File Drop"
}
}
}
+26
View File
@@ -0,0 +1,26 @@
{
"Flow": {
"Parts": {
"MoveToUserFolder": {
"Description": "작업 파일을 사용자의 출력 디렉토리로 이동합니다.",
"Label": "사용자 폴더로 이동",
"Outputs": {
"1": "파일이 성공적으로 이동되었습니다"
}
},
"SetFileDropDisplayName": {
"Description": "파일 드롭 파일 정보를 기반으로 파일의 표시 이름을 설정하여 파일의 정체성과 소유권을 명확하게 보장합니다.",
"Label": "파일 드롭 표시 이름 설정",
"Outputs": {
"1": "표시 이름이 설정됨"
}
}
}
},
"Plugins": {
"FileDrop": {
"Description": "File Drop 관련 흐름 요소를 제공하는 플러그인",
"Label": "File Drop"
}
}
}
+26
View File
@@ -0,0 +1,26 @@
{
"Flow": {
"Parts": {
"MoveToUserFolder": {
"Description": "Verplaatst het werkbestand naar de uitvoermap van de gebruiker.",
"Label": "Verplaats naar Gebruikersmap",
"Outputs": {
"1": "Bestand is succesvol verplaatst"
}
},
"SetFileDropDisplayName": {
"Description": "Stelt de weergavenaam van een bestand in op basis van de bestandsinformatie van File Drop, om duidelijkheid te waarborgen over de identiteit en eigendom van het bestand.",
"Label": "Weergavenaam voor File Drop instellen",
"Outputs": {
"1": "Weergavenaam ingesteld"
}
}
}
},
"Plugins": {
"FileDrop": {
"Description": "Plugin die File Drop gerelateerde flow-elementen biedt",
"Label": "File Drop"
}
}
}
+26
View File
@@ -0,0 +1,26 @@
{
"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"
}
},
"SetFileDropDisplayName": {
"Description": "Define o nome exibido de um arquivo com base nas informações do arquivo de File Drop, garantindo clareza sobre a identidade e a propriedade do arquivo.",
"Label": "Definir nome exibido do arquivo de File Drop",
"Outputs": {
"1": "Nome exibido definido"
}
}
}
},
"Plugins": {
"FileDrop": {
"Description": "Plugin que fornece elementos de fluxo relacionados ao File Drop",
"Label": "File Drop"
}
}
}
+26
View File
@@ -0,0 +1,26 @@
{
"Flow": {
"Parts": {
"MoveToUserFolder": {
"Description": "Перемещает рабочий файл в выходной каталог пользователя.",
"Label": "Переместить в Папку Пользователя",
"Outputs": {
"1": "Файл успешно перемещен"
}
},
"SetFileDropDisplayName": {
"Description": "Устанавливает отображаемое имя файла на основе информации о файле в File Drop, обеспечивая ясность относительно идентичности и собственности файла.",
"Label": "Установить отображаемое имя файла для File Drop",
"Outputs": {
"1": "Отображаемое имя установлено"
}
}
}
},
"Plugins": {
"FileDrop": {
"Description": "Плагин, который предоставляет элементы потока, связанные с File Drop",
"Label": "File Drop"
}
}
}
+26
View File
@@ -0,0 +1,26 @@
{
"Flow": {
"Parts": {
"MoveToUserFolder": {
"Description": "Flyttar arbetsfilen till användarens utmatningskatalog.",
"Label": "Flytta till Användarmapp",
"Outputs": {
"1": "Filen flyttades framgångsrikt"
}
},
"SetFileDropDisplayName": {
"Description": "Sätter visningsnamnet för en fil baserat på filinformation från File Drop, vilket säkerställer tydlighet om filens identitet och ägande.",
"Label": "Ställ in visningsnamn för File Drop",
"Outputs": {
"1": "Visningsnamn inställt"
}
}
}
},
"Plugins": {
"FileDrop": {
"Description": "Plugin som tillhandahåller flow-element relaterade till File Drop",
"Label": "File Drop"
}
}
}
+26
View File
@@ -0,0 +1,26 @@
{
"Flow": {
"Parts": {
"MoveToUserFolder": {
"Description": "将工作文件移动到用户的输出目录。",
"Label": "移动到用户文件夹",
"Outputs": {
"1": "文件已成功移动"
}
},
"SetFileDropDisplayName": {
"Description": "根据文件上传信息设置文件的显示名称,确保文件的身份和所有权清晰可见。",
"Label": "设置文件上传显示名称",
"Outputs": {
"1": "显示名称已设置"
}
}
}
},
"Plugins": {
"FileDrop": {
"Description": "提供与文件上传相关的流程元素的插件",
"Label": "文件上传"
}
}
}
+26
View File
@@ -0,0 +1,26 @@
{
"Flow": {
"Parts": {
"MoveToUserFolder": {
"Description": "將工作檔案移動到使用者的輸出目錄。",
"Label": "移動到使用者資料夾",
"Outputs": {
"1": "檔案已成功移動"
}
},
"SetFileDropDisplayName": {
"Description": "根據文件上傳資訊設定文件的顯示名稱,確保文件的身份和所有權清晰可見。",
"Label": "設定文件上傳顯示名稱",
"Outputs": {
"1": "顯示名稱已設定"
}
}
}
},
"Plugins": {
"FileDrop": {
"Description": "提供與文件上傳相關的流程元素的插件",
"Label": "文件上傳"
}
}
}