brain:// Links
Local links to a thought take the following format:
brain://server-domain/brain-id/thought-id/HumanReadableName
server-domainis optional if excluded, the default server will be assumedbrain-idis may be excluded if the link is coming from inside of the same brainthought-idmust always be includedHumanReadbleNameis ignored and is only added for convenience - it need not match the actual thought name
IDs are in “Short GUID” format. To convert these IDs to standard GUIDs such as those found in the JSON export, the following code can be used:
public static string ToShortGuid(this Guid newGuid) {
string modifiedBase64 = Convert.ToBase64String(newGuid.ToByteArray())
.Replace('+', '-').Replace('/', '_') // avoid invalid URL characters
.Substring(0, 22);
return modifiedBase64;
}
public static Guid ParseShortGuid(this string shortGuid) {
string base64 = shortGuid.Replace('-', '+').Replace('_', '/') + "==";
Byte[] bytes = Convert.FromBase64String(base64);
return new Guid(bytes);
}