Libraryless. Click here for Pure Java version (5619L/39K/131K).
1 | !7 |
2 | |
3 | sS aiConcepts = #1006463; |
4 | sS exportSnippetID; |
5 | |
6 | p { |
7 | pcall-messagebox { |
8 | try { |
9 | doExport(); |
10 | } catch e { |
11 | if (containsIC(str(e), "Not your snippet")) { |
12 | exportSnippetID = null; |
13 | save("exportSnippetID"); |
14 | doExport(); |
15 | } else rethrow(e); |
16 | } |
17 | } |
18 | } |
19 | |
20 | svoid doExport { |
21 | useDataDirOf(aiConcepts); |
22 | S text = loadConceptsStructure(aiConcepts); |
23 | if (match("exportable=f", text)) fail("Non-exportable concepts found"); |
24 | print(javaTokWordWrap(text)); |
25 | print("Size: " + l(utf8(text))); |
26 | print(); |
27 | load("exportSnippetID"); |
28 | if (empty(exportSnippetID)) { |
29 | infoBox("Creating a snippet for you..."); |
30 | exportSnippetID = createSnippet(text, "AI Concepts from " + computerID(), 53); |
31 | infoBox("Your snippet ID: " + exportSnippetID); |
32 | save("exportSnippetID"); |
33 | } else { |
34 | S oldMD5 = getSnippetMD5(exportSnippetID); |
35 | S newMD5 = md5(text); |
36 | if (eq(oldMD5, newMD5)) |
37 | infoBox("Snippet " + exportSnippetID + " already up to date!"); |
38 | else { |
39 | infoBox("Updating snippet: " + exportSnippetID); |
40 | editSnippet(exportSnippetID, text); |
41 | S actualMD5 = getSnippetMD5(exportSnippetID); |
42 | if (eq(actualMD5, newMD5)) |
43 | infoBox("Export to " + exportSnippetID + " complete (" + n(lUtf8(text), "bytes") + ")."); |
44 | else if (eq(actualMD5, oldMD5)) |
45 | infoBox("Export failed for unknown reason"); |
46 | else |
47 | infoBox("Hm. Export did something, but MD5 mismatch occurred."); |
48 | } |
49 | } |
50 | } |
Began life as a copy of #1007205
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt, wtqryiryparv
No comments. add comment
Snippet ID: | #1007207 |
Snippet name: | Export AI concepts to server (old) |
Eternal ID of this version: | #1007207/14 |
Text MD5: | db138a7f25593533c6954890653492c5 |
Transpilation MD5: | c9c46fc1579652df818001cd37b34c5a |
Author: | stefan |
Category: | javax / a.i. |
Type: | JavaX source code |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2017-03-27 00:05:08 |
Source code size: | 1515 bytes / 50 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 626 / 742 |
Version history: | 13 change(s) |
Referenced in: | [show references] |