11using System ;
22using System . Collections . Generic ;
3+ using System . Collections . ObjectModel ;
34using System . IO ;
45using System . Linq ;
56using System . Text ;
@@ -11,14 +12,20 @@ namespace SharpFM.Core;
1112
1213public class FileMakerClip
1314{
14- public static Dictionary < string , string > ClipTypes { get ; set ; } = new Dictionary < string , string >
15- {
16- { "Mac-XMSS" , "ScriptSteps" } ,
17- { "Mac-XML2" , "Layout" } ,
18- { "Mac-XMTB" , "Table" } ,
19- { "Mac-XMFD" , "Field" } ,
20- { "Mac-XMSC" , "Script" }
21- } ;
15+ public class ClipFormat
16+ {
17+ public string KeyId { get ; set ; } = string . Empty ;
18+ public string DisplayName { get ; set ; } = string . Empty ;
19+ }
20+
21+ public static List < ClipFormat > ClipTypes { get ; set ; } = new List < ClipFormat >
22+ {
23+ new ClipFormat ( ) { KeyId = "Mac-XMSS" , DisplayName = "ScriptSteps" } ,
24+ new ClipFormat ( ) { KeyId = "Mac-XML2" , DisplayName = "Layout" } ,
25+ new ClipFormat ( ) { KeyId = "Mac-XMTB" , DisplayName = "Table" } ,
26+ new ClipFormat ( ) { KeyId = "Mac-XMFD" , DisplayName = "Field" } ,
27+ new ClipFormat ( ) { KeyId = "Mac-XMSC" , DisplayName = "Script" }
28+ } ;
2229
2330 /// <summary>
2431 /// Constructor taking in the raw data byte array.
@@ -83,7 +90,9 @@ public IEnumerable<FileMakerField> Fields
8390 {
8491 var xdoc = XDocument . Parse ( XmlData ) ;
8592
86- switch ( ClipTypes [ ClipboardFormat ] )
93+ var clipType = ClipTypes . SingleOrDefault ( ct => ct . KeyId == ClipboardFormat ) ;
94+
95+ switch ( clipType . DisplayName )
8796 {
8897 case "Table" : // When we have a table, we can get rich metadata from the clipboard data.
8998 return xdoc
0 commit comments