| 104 | } |
| 105 | |
| 106 | bool FromString(const std::string& strID) |
| 107 | { |
| 108 | size_t nStrLength = strID.length(); |
| 109 | size_t nPos = strID.find('-'); |
| 110 | |
| 111 | if (nPos == std::string::npos) |
| 112 | { |
| 113 | return false; |
| 114 | } |
| 115 | |
| 116 | std::string strHigh = strID.substr(0, nPos); |
| 117 | std::string strLow = ""; |
| 118 | |
| 119 | if ((nPos + 1) < nStrLength) |
| 120 | { |
| 121 | strLow = strID.substr(nPos + 1, nStrLength - nPos); |
| 122 | } |
| 123 | |
| 124 | try |
| 125 | { |
| 126 | nHigh = ARK_LEXICAL_CAST<uint64_t>(strHigh); |
| 127 | nLow = ARK_LEXICAL_CAST<uint64_t>(strLow); |
| 128 | |
| 129 | return true; |
| 130 | } |
| 131 | catch (std::system_error& ex) |
| 132 | { |
| 133 | CONSOLE_LOG_NO_FILE << "AFGUID from string failed, code = " << ex.code().message() << " msg = " << ex.what() |
| 134 | << std::endl; |
| 135 | ARK_ASSERT_NO_EFFECT(0); |
| 136 | return false; |
| 137 | } |
| 138 | } |
| 139 | }; |
| 140 | |
| 141 | } // namespace ark |