-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMachineIDUtilities.h
More file actions
60 lines (48 loc) · 2.2 KB
/
MachineIDUtilities.h
File metadata and controls
60 lines (48 loc) · 2.2 KB
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
59
60
/*
==============================================================================
MachineIDUtilities.h
Created: 23 Sep 2019 7:39:39pm
Author: Edwin Park
==============================================================================
*/
#pragma once
#include <juce_core/juce_core.h>
using juce::File;
using juce::String;
using juce::StringArray;
/** This class contains some utility functions that might help with machine ID
* generation. */
struct MachineIDUtilities {
/** Returns a character that represents the current OS.
E.g. 'M' for Mac, 'W' for windows, etc
*/
static char getPlatformPrefix();
/** Returns an encoded hash string from the given input string, prefixing it
with a letter to represent the current OS type.
*/
static String getEncodedIDString(const String &inputString);
/** Utility function that you may want to use in your machine-ID generation
code. This adds an ID string to the given array which is a hash of the
filesystem ID of the given file.
*/
static bool addFileIDToList(StringArray &result, const File &file);
/** Utility function that you may want to use in your machine-ID generation
code. This adds some ID strings to the given array which represent each MAC
address of the machine.
*/
static void addMACAddressesToList(StringArray &result);
/** This method calculates some machine IDs based on things like network
MAC addresses, hard-disk IDs, etc, but if you want, you can overload
it to generate your own list of IDs.
The IDs that are returned should be short alphanumeric strings
without any punctuation characters. Since users may need to type
them, case is ignored when comparing them.
Note that the first item in the list is considered to be the
"main" ID, and this will be the one that is displayed to the user
and registered with the marketplace webserver. Subsequent IDs are
just used as fallback to avoid false negatives when checking for
registration on machines which have had hardware added/removed
since the product was first registered.
*/
static StringArray getLocalMachineIDs();
};