LoadFileWithString() public static method

public static LoadFileWithString ( string path ) : string
path string
return string
Exemplo n.º 1
0
    void LoadConfigurationConfig()
    {
        string config = "";

        _configRequestDict.Clear();

#if RESOURCE_DEBUG
        TextAsset text = Resources.Load <TextAsset>(CONFIG_FILE);
        config = text.text;
#elif UNITY_ANDROID
        config = FileManager.LoadFileWithString(CONFIG_FILE + ".txt");
#else
        config = FileManager.LoadFileWithString(CONFIG_FILE + ".txt");
#endif

        JsonData jsonData = JsonMapper.ToObject(config);
        if (jsonData["Configs"].IsArray)
        {
            for (int i = 0; i < jsonData["Configs"].Count; i++)
            {
                var jsonObj = jsonData["Configs"][i];
                var req     = new ConfigRequest();
                req.ConfigName         = jsonObj["ConfigName"].ToString();
                req.ConfigPath         = jsonObj["ConfigPath"].ToString();
                req.ConfigResourcePath = jsonObj["ResourcePath"].ToString();
                _configRequestDict.Add(jsonObj["ConfigName"].ToString(), req);
            }
        }
    }
Exemplo n.º 2
0
    public string LoadConfigFileByPath(string configPath)
    {
        TextAsset text = Resources.Load <TextAsset>(configPath);

        if (text != null)
        {
            return(text.text);
        }

        return(FileManager.LoadFileWithString(configPath + ".txt"));
    }
Exemplo n.º 3
0
 static public int LoadFileWithString_s(IntPtr l)
 {
     try {
         System.String a1;
         checkType(l, 1, out a1);
         var ret = FileManager.LoadFileWithString(a1);
         pushValue(l, true);
         pushValue(l, ret);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Exemplo n.º 4
0
    public static void CopyScript()
    {
        FileManager.DeleteDirectory(UpdateManager.UpdateTest + SCRIPT_PATH);
        List <string> fileList = new List <string>();

        GetAllScriptFile(Application.dataPath + "/Resources" + SCRIPT_PATH, fileList);

        for (int i = 0; i < fileList.Count; ++i)
        {
            //TODO:加密每一个script文件,并拷贝到PersistentDataPath
            var file       = fileList[i];
            var targetFile = file.Replace(Application.dataPath + "/Resources", UpdateManager.UpdateTest);
            var content    = FileManager.LoadFileWithString(file);
            FileManager.CreateFileWithString(targetFile, EncryptScript(content));
        }
    }
Exemplo n.º 5
0
    public string LoadConfigFile(string configName)
    {
        ConfigRequest configReq = null;

        if (!HasConfigRequest(configName, out configReq))
        {
            return("");
        }
#if RESOURCE_DEBUG
        TextAsset text = Resources.Load <TextAsset>(configReq.ConfigResourcePath);
        return(text.text);
#elif UNITY_ANDROID
        return(FileManager.LoadFileWithString(configReq.ConfigResourcePath + ".txt"));
#else
        return(FileManager.LoadFileWithString(LuaManager.GetConfigPath() + "/" + configReq.ConfigResourcePath + ".txt"));
#endif
    }
Exemplo n.º 6
0
 /// <summary>
 /// 直接读取文件
 /// </summary>
 /// <param name="configPath">配置的全路径</param>
 /// <returns></returns>
 string LoadConfigFileImmediatly(string configPath)
 {
     return(FileManager.LoadFileWithString(configPath + ".txt"));
 }