Ejemplo n.º 1
0
        public override void Run()
        {
            var savePath = EditorUtility.SaveFilePanel(
                "Export Settings",
                Utility.PathCombine(Application.dataPath, ".."),
                "setting",
                Constants.SETTING_FILE_EXT);

            if (string.IsNullOrEmpty(savePath))
            {
                return;
            }

            // editor config
            var           editorConfig     = "{}";
            var           editorConfigPath = PathManager.GetEditorConfigPath();
            StringBuilder sb = new StringBuilder();

            sb.Append("{");
            if (File.Exists(editorConfigPath))
            {
                editorConfig = File.ReadAllText(editorConfigPath);
                sb.Append(string.Format("\"editor\":{0},", editorConfig));
            }

            // key mapping
            var keymapping     = "{}";
            var keymappingPath = PathManager.GetKeyMappingConfigPath();

            if (File.Exists(keymappingPath))
            {
                keymapping = File.ReadAllText(keymappingPath);
                sb.Append(string.Format("\"keymap\":{0}", keymapping));
            }

            sb.Append("}");

            File.WriteAllText(savePath, sb.ToString());
        }
 private void SaveKeyBindingConfig(string message, object callback)
 {
     SaveConfigFileInternal(message, callback, PathManager.GetKeyMappingConfigPath());
 }
 private void GetKeyMappingConfig(string message, object callback)
 {
     GetOrCreateConfigPathInternal(message, callback, PathManager.GetKeyMappingConfigPath(), "[]");
 }