Ejemplo n.º 1
0
        public static void SaveDebugCommandLineArgs(string args)
        {
            string filePath = XEditorConst.LaunchSettingsFilePath;

            if (File.Exists(filePath))
            {
                try
                {
                    string json_str = File.ReadAllText(filePath, Encoding.UTF8);
                    EditorLaunchSettingModel model = JsonUtility.FromJson <EditorLaunchSettingModel>(json_str);
                    model.DebugCommandLineArgs = args;
                    json_str = JsonUtility.ToJson(model);
                    File.WriteAllText(filePath, json_str, Encoding.UTF8);
                }
                catch (Exception e)
                {
                    Debug.LogWarning("[TinaX.Core]" + (TinaXEditor.Utils.EditorGUIUtil.IsCmnHans
                        ? "编辑器保存Debug命令行启动参数失败."
                        : "Editor save debug command line args failed.")
                                     + "\n:" + e.Message);
                }
            }
            else
            {
                try
                {
                    EditorLaunchSettingModel model = new EditorLaunchSettingModel();
                    model.DebugCommandLineArgs = args;
                    var json_str = JsonUtility.ToJson(model);
                    File.WriteAllText(filePath, json_str, Encoding.UTF8);
                }
                catch (Exception e)
                {
                    Debug.LogWarning("[TinaX.Core]" + (TinaXEditor.Utils.EditorGUIUtil.IsCmnHans
                        ? "编辑器保存Debug命令行启动参数失败."
                        : "Editor save debug command line args failed.")
                                     + "\n:" + e.Message);
                }
            }
        }