Implement server-owned read-only sample checks, category publication, explicit order-version identity and durable PDF/archive/notification steps. Freeze category-bound templates and recipients for isolated scheduled delivery, and require human verification for unknown SMTP outcomes. Add order/batch views and local HTTP/browser/PDF/archive regression coverage. Fix Unicode Windows startup links found by full regression using IShellLinkW. Automatic processing and sending stay disabled; no service deployment. Validation: npm ci; npm test -- --test-concurrency=1 (242 pass, 1 optional ZCode skip, 0 fail); 31 syntax checks; scoped independent code review. Live BPM V13/SMB/163 acceptance remains pending.
58 lines
2.9 KiB
C#
58 lines
2.9 KiB
C#
using System;
|
|
using System.Text;
|
|
using System.Runtime.InteropServices;
|
|
using System.Runtime.InteropServices.ComTypes;
|
|
|
|
// WScript.Shell's shortcut wrapper truncates non-ANSI paths on some Windows
|
|
// installations. IShellLinkW and IPersistFile retain UTF-16 paths end to end.
|
|
[ComImport, Guid("00021401-0000-0000-C000-000000000046")]
|
|
internal class OrderShellLink { }
|
|
|
|
[ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("000214F9-0000-0000-C000-000000000046")]
|
|
internal interface IOrderShellLinkW {
|
|
void GetPath([Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder path, int length, IntPtr findData, uint flags);
|
|
void GetIDList(out IntPtr list);
|
|
void SetIDList(IntPtr list);
|
|
void GetDescription([Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder description, int length);
|
|
void SetDescription([MarshalAs(UnmanagedType.LPWStr)] string description);
|
|
void GetWorkingDirectory([Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder directory, int length);
|
|
void SetWorkingDirectory([MarshalAs(UnmanagedType.LPWStr)] string directory);
|
|
void GetArguments([Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder arguments, int length);
|
|
void SetArguments([MarshalAs(UnmanagedType.LPWStr)] string arguments);
|
|
void GetHotkey(out short hotkey);
|
|
void SetHotkey(short hotkey);
|
|
void GetShowCmd(out int command);
|
|
void SetShowCmd(int command);
|
|
void GetIconLocation([Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder path, int length, out int index);
|
|
void SetIconLocation([MarshalAs(UnmanagedType.LPWStr)] string path, int index);
|
|
void SetRelativePath([MarshalAs(UnmanagedType.LPWStr)] string path, uint reserved);
|
|
void Resolve(IntPtr window, uint flags);
|
|
void SetPath([MarshalAs(UnmanagedType.LPWStr)] string path);
|
|
}
|
|
|
|
public static class OrderShortcut {
|
|
public static void Save(string file, string target, string arguments, string directory) {
|
|
object instance = new OrderShellLink();
|
|
try {
|
|
var link = (IOrderShellLinkW)instance;
|
|
link.SetPath(target);
|
|
link.SetArguments(arguments);
|
|
link.SetWorkingDirectory(directory);
|
|
link.SetDescription("Order workspace service supervisor");
|
|
((IPersistFile)instance).Save(file, true);
|
|
} finally { Marshal.FinalReleaseComObject(instance); }
|
|
}
|
|
public static string[] Read(string file) {
|
|
object instance = new OrderShellLink();
|
|
try {
|
|
((IPersistFile)instance).Load(file, 0);
|
|
var link = (IOrderShellLinkW)instance;
|
|
var target = new StringBuilder(32768);
|
|
var arguments = new StringBuilder(32768);
|
|
link.GetPath(target, target.Capacity, IntPtr.Zero, 4);
|
|
link.GetArguments(arguments, arguments.Capacity);
|
|
return new string[] { target.ToString(), arguments.ToString() };
|
|
} finally { Marshal.FinalReleaseComObject(instance); }
|
|
}
|
|
}
|