少年修仙传客户端基础资源
hch
2024-04-01 d01413b00ef631ac20347716b23818b0b811f65f
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
61
62
63
#include "il2cpp-config.h"
 
#if IL2CPP_TARGET_WINDOWS
 
#include "os/Locale.h"
#include "WindowsHelpers.h"
#include <locale.h>
#include <vector>
 
namespace il2cpp
{
namespace os
{
#if IL2CPP_TARGET_WINDOWS_DESKTOP
 
    std::string Locale::GetLocale()
    {
        LCID lcid = GetThreadLocale();
 
        int number_of_characters = GetLocaleInfo(lcid, LOCALE_SNAME, NULL, 0);
        std::vector<WCHAR> locale_name(number_of_characters);
        if (GetLocaleInfo(lcid, LOCALE_SNAME, &locale_name[0], number_of_characters) == 0)
            return std::string();
 
        std::vector<char> locale_name_char(number_of_characters);
        if (WideCharToMultiByte(CP_ACP, 0, &locale_name[0], number_of_characters, &locale_name_char[0], number_of_characters, NULL, NULL) == 0)
            return std::string();
 
        return std::string(locale_name_char.begin(), locale_name_char.end());
    }
 
#endif
 
#if IL2CPP_SUPPORT_LOCALE_INDEPENDENT_PARSING
    static _locale_t s_cLocale = NULL;
#endif
 
    void Locale::Initialize()
    {
#if IL2CPP_SUPPORT_LOCALE_INDEPENDENT_PARSING
        s_cLocale = _create_locale(LC_ALL, "C");
#endif
    }
 
    void Locale::UnInitialize()
    {
#if IL2CPP_SUPPORT_LOCALE_INDEPENDENT_PARSING
        _free_locale(s_cLocale);
        s_cLocale = NULL;
#endif
    }
 
#if IL2CPP_SUPPORT_LOCALE_INDEPENDENT_PARSING
    double Locale::DoubleParseLocaleIndependentImpl(char *ptr, char** endptr)
    {
        return _strtod_l(ptr, endptr, s_cLocale);
    }
 
#endif
} /* namespace os */
} /* namespace il2cpp */
 
#endif