From 98601a178a815c8c6b010cf141962c5658209679 Mon Sep 17 00:00:00 2001 From: Arnoud Buzing Date: Fri, 18 May 2018 13:02:10 -0500 Subject: [PATCH] updates --- Prototypes/Files.wl | 15 --------------- Prototypes/Formats.wl | 12 ++++++++++++ Prototypes/Prototypes.wl | 2 +- 3 files changed, 13 insertions(+), 16 deletions(-) create mode 100644 Prototypes/Formats.wl diff --git a/Prototypes/Files.wl b/Prototypes/Files.wl index 8dba5d3..855ac6f 100644 --- a/Prototypes/Files.wl +++ b/Prototypes/Files.wl @@ -41,18 +41,3 @@ If[ $SystemID === "Windows-x86-64", $LocalAppDataDirectory = FileNameJoin[{$AppDataDirectory, "Local"}]; $RoamingAppDataDirectory = FileNameJoin[{$AppDataDirectory, "Roaming"}]; ] - - - -FormatDetect[ format_String, data:(_String|_List|_ByteArray)] := Module[ {ba}, - ba = Switch[ data, - _String, StringToByteArray[data], - _List, ByteArray[data], - _ByteArray, data - ]; - Which[ - format === "PNG", SameQ[ ba, ByteArray[{137, 80, 78, 71, 13, 10, 26, 10}] ], - format === "JPEG" || format === "JPG", SameQ[ ba, ByteArray[{255,216,255}] ], - format === "GIF", SameQ[ ba, ByteArray[{71,73,70,56}] ] - ] -] diff --git a/Prototypes/Formats.wl b/Prototypes/Formats.wl new file mode 100644 index 0000000..920b7e6 --- /dev/null +++ b/Prototypes/Formats.wl @@ -0,0 +1,12 @@ +FormatDetect[ format_String, data:(_String|_List|_ByteArray)] := Module[ {ba}, + ba = Switch[ data, + _String, StringToByteArray[data], + _List, ByteArray[data], + _ByteArray, data + ]; + Which[ + format === "PNG", SameQ[ ba, ByteArray[{137, 80, 78, 71, 13, 10, 26, 10}] ], + format === "JPEG" || format === "JPG", SameQ[ ba, ByteArray[{255,216,255}] ], + format === "GIF", SameQ[ ba, ByteArray[{71,73,70,56}] ] + ] +] diff --git a/Prototypes/Prototypes.wl b/Prototypes/Prototypes.wl index 8fe822e..85d5663 100644 --- a/Prototypes/Prototypes.wl +++ b/Prototypes/Prototypes.wl @@ -10,7 +10,7 @@ Module[ {files}, (* load in any session *) files = {"Build.wl", "Dataset.wl", "Files.wl", - "Image.wl", "Language.wl", "Paclet.wl", + "Image.wl", "Language.wl", "Paclet.wl", "Formats.wl", "Resources.wl", "Search.wl", "String.wl", "Color.wl", "Entities.wl", "WolframAlpha.wl", "Translation.wl","GeoGraphics.wl"}; Map[ Get[ FileNameJoin[{DirectoryName[$InputFileName], #}] ] &, files ];