/
HR - GetFileType - 389.cs
58 lines (52 loc) · 2.36 KB
/
HR - GetFileType - 389.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
// Skeleton generated by Hyland Unity Editor on 3/22/2017 3:23:32 PM
namespace SYSGetFileType443
{
using Hyland.Unity;
/// <summary>
/// Script 443 - check file format
/// </summary>
public class SYSGetFileType443 : IClientWorkflowScript
{
private const long PDF_FILE_TYPE = 16;
#region IClientWorkflowScript
/// <summary>
/// Implementation of <see cref="IClientWorkflowScript.OnClientWorkflowScriptExecute" />.
/// <seealso cref="IClientWorkflowScript" />
/// </summary>
/// <param name="app"></param>
/// <param name="args"></param>
public void OnClientWorkflowScriptExecute(Hyland.Unity.Application app, Hyland.Unity.ClientWorkflowEventArgs args)
{
app.Diagnostics.Level = Diagnostics.DiagnosticsLevel.Verbose;
try
{
app.Diagnostics.WriteIf(Diagnostics.DiagnosticsLevel.Info, "Begin Script - Get File Type");
Document objCurrentDocument = args.Document;
app.Diagnostics.WriteIf(Diagnostics.DiagnosticsLevel.Info, string.Format("Processing document: {0}", objCurrentDocument.ID.ToString()));
//Get Current Rendition
Rendition objDocRendition = objCurrentDocument.DefaultRenditionOfLatestRevision;
if (objDocRendition.FileType.ID == PDF_FILE_TYPE)
{
args.ScriptResult = true;
app.Diagnostics.WriteIf(Diagnostics.DiagnosticsLevel.Info, "PDF File Format");
}
else
{
args.ScriptResult = false;
app.Diagnostics.WriteIf(Diagnostics.DiagnosticsLevel.Info, "Not PDF File Format");
}
}
catch (UnityAPIException ex)
{
app.Diagnostics.WriteIf(Diagnostics.DiagnosticsLevel.Error, string.Format("Unity API Exception: {0}", ex.Message));
app.Diagnostics.WriteIf(Diagnostics.DiagnosticsLevel.Error, string.Format("Stack Trace: {0}", ex.StackTrace));
args.ScriptResult = false;
}
finally
{
app.Diagnostics.WriteIf(Diagnostics.DiagnosticsLevel.Info, "End Script - Get File Type");
}
}
#endregion
}
}