diff --git a/.gradle/7.2/executionHistory/executionHistory.bin b/.gradle/7.2/executionHistory/executionHistory.bin index 5554001..9da92e8 100644 Binary files a/.gradle/7.2/executionHistory/executionHistory.bin and b/.gradle/7.2/executionHistory/executionHistory.bin differ diff --git a/.gradle/7.2/executionHistory/executionHistory.lock b/.gradle/7.2/executionHistory/executionHistory.lock index 480fbfb..614e2c9 100644 Binary files a/.gradle/7.2/executionHistory/executionHistory.lock and b/.gradle/7.2/executionHistory/executionHistory.lock differ diff --git a/.gradle/7.2/fileHashes/fileHashes.bin b/.gradle/7.2/fileHashes/fileHashes.bin index 4420b95..ff15838 100644 Binary files a/.gradle/7.2/fileHashes/fileHashes.bin and b/.gradle/7.2/fileHashes/fileHashes.bin differ diff --git a/.gradle/7.2/fileHashes/fileHashes.lock b/.gradle/7.2/fileHashes/fileHashes.lock index bee5ea8..518cd17 100644 Binary files a/.gradle/7.2/fileHashes/fileHashes.lock and b/.gradle/7.2/fileHashes/fileHashes.lock differ diff --git a/.gradle/7.2/fileHashes/resourceHashesCache.bin b/.gradle/7.2/fileHashes/resourceHashesCache.bin index 17e50da..5bbdf05 100644 Binary files a/.gradle/7.2/fileHashes/resourceHashesCache.bin and b/.gradle/7.2/fileHashes/resourceHashesCache.bin differ diff --git a/.gradle/buildOutputCleanup/buildOutputCleanup.lock b/.gradle/buildOutputCleanup/buildOutputCleanup.lock index 5201224..8c719bf 100644 Binary files a/.gradle/buildOutputCleanup/buildOutputCleanup.lock and b/.gradle/buildOutputCleanup/buildOutputCleanup.lock differ diff --git a/.gradle/buildOutputCleanup/outputFiles.bin b/.gradle/buildOutputCleanup/outputFiles.bin index 32b0e55..0c2d6c0 100644 Binary files a/.gradle/buildOutputCleanup/outputFiles.bin and b/.gradle/buildOutputCleanup/outputFiles.bin differ diff --git a/app/src/main/assets/dataBase.rdb b/app/src/main/assets/dataBase.rdb index 1b47e21..6ae5e5d 100644 Binary files a/app/src/main/assets/dataBase.rdb and b/app/src/main/assets/dataBase.rdb differ diff --git a/app/src/main/java/com/coldmint/rust/pro/EditActivity.kt b/app/src/main/java/com/coldmint/rust/pro/EditActivity.kt index 832061e..cd67aa2 100644 --- a/app/src/main/java/com/coldmint/rust/pro/EditActivity.kt +++ b/app/src/main/java/com/coldmint/rust/pro/EditActivity.kt @@ -20,6 +20,7 @@ import androidx.recyclerview.widget.RecyclerView import com.afollestad.materialdialogs.MaterialDialog import com.afollestad.materialdialogs.WhichButton import com.afollestad.materialdialogs.actions.setActionButtonEnabled +import com.afollestad.materialdialogs.bottomsheets.BottomSheet import com.afollestad.materialdialogs.input.getInputField import com.afollestad.materialdialogs.input.input import com.afollestad.materialdialogs.list.ItemListener @@ -1180,6 +1181,13 @@ class EditActivity : BaseActivity() { goIntent.putExtra("filePath", filePath) startActivity(goIntent) } + R.id.display_source_code -> { + val file = File(viewModel.getNowOpenFilePath()) + val code = FileOperator.readFile(file) + MaterialDialog(this, BottomSheet()).show { + title(text = file.name).message(text = code).negativeButton(R.string.dialog_ok) + } + } R.id.clear_code_cache -> { viewModel.codeCompiler2.clearCache() Snackbar.make( diff --git a/app/src/main/java/com/coldmint/rust/pro/WebModInfoActivity.kt b/app/src/main/java/com/coldmint/rust/pro/WebModInfoActivity.kt index c8760f7..ea81f01 100644 --- a/app/src/main/java/com/coldmint/rust/pro/WebModInfoActivity.kt +++ b/app/src/main/java/com/coldmint/rust/pro/WebModInfoActivity.kt @@ -94,6 +94,7 @@ class WebModInfoActivity : BaseActivity() { } modId = temId if (targetFile.exists()) { + viewBinding.button.isEnabled = false viewBinding.button.text = getString(R.string.installated) } viewBinding.modCommentRecyclerView.layoutManager = @@ -375,6 +376,7 @@ class WebModInfoActivity : BaseActivity() { if (materialDialog.isShowing) { materialDialog.dismiss() } + viewBinding.button.isEnabled = false viewBinding.button.setText(R.string.installated) WebMod.instance.addDownloadNum(modId) } diff --git a/app/src/main/java/com/coldmint/rust/pro/edit/RustAutoComplete2.kt b/app/src/main/java/com/coldmint/rust/pro/edit/RustAutoComplete2.kt index e09808d..7629126 100644 --- a/app/src/main/java/com/coldmint/rust/pro/edit/RustAutoComplete2.kt +++ b/app/src/main/java/com/coldmint/rust/pro/edit/RustAutoComplete2.kt @@ -8,6 +8,7 @@ import com.coldmint.rust.core.database.code.CodeDataBase import com.coldmint.rust.core.database.code.SectionInfo import com.coldmint.rust.core.database.file.FileDataBase import com.coldmint.rust.core.interfaces.EnglishMode +import com.coldmint.rust.core.tool.DebugHelper import com.coldmint.rust.core.tool.LineParser import com.coldmint.rust.pro.tool.AppSettings import com.coldmint.rust.pro.tool.CompletionItemConverter @@ -27,6 +28,7 @@ class RustAutoComplete2(val context: Context) : AutoCompleteProvider, EnglishMod private val result: ArrayList by lazy { ArrayList() } + private val debugKey = "自动完成器" private var codeDataBase: CodeDataBase? = null private val executorService = Executors.newCachedThreadPool() private var fileDataBase: FileDataBase? = null @@ -63,6 +65,7 @@ class RustAutoComplete2(val context: Context) : AutoCompleteProvider, EnglishMod * @param sourceFolder String */ fun setSourceFolder(sourceFolder: String) { + DebugHelper.printLog(debugKey, "已设置源文件目录" + sourceFolder, "设置源文件目录") completionItemConverter.setSourceFilePath(sourceFolder) } @@ -214,33 +217,55 @@ class RustAutoComplete2(val context: Context) : AutoCompleteProvider, EnglishMod } else { lineData.subSequence(0, keyIndex) } + val codeInfo = if (isEnglishMode) { codeDataBase!!.getCodeDao().findCodeByCode(keyValue.toString()) } else { codeDataBase!!.getCodeDao().findCodeByTranslate(keyValue.toString()) } + DebugHelper.printLog( + debugKey, + "值[" + keyValue + "]英文模式[" + isEnglishMode + "]代码信息[" + codeInfo + "]关键字[" + prefix + "]", + "值检查" + ) if (codeInfo != null) { val typeInfo = completionItemConverter.getValueType(codeInfo.type) //获取代码的关联列表 if (typeInfo != null && typeInfo.list.isNotBlank()) { + DebugHelper.printLog( + debugKey, + "值类型[" + codeInfo.type + "]自动提示列表[" + typeInfo.list + "]", "关联提示" + ) lineParser.text = typeInfo.list lineParser.analyse { lineNum, lineData, isEnd -> //分析关联提示项目 val temCodeInfo = codeDataBase!!.getCodeDao().findCodeByCode(lineData) + DebugHelper.printLog( + debugKey, + "值类型[" + codeInfo.type + "]项目[" + lineData + "]是代码[" + (temCodeInfo != null) + "]", + "关联提示列表分析" + ) if (temCodeInfo == null) { if (lineData.startsWith("@file(") && lineData.endsWith(")")) { val fileType = lineData.subSequence( lineData.indexOf('(') + 1, lineData.indexOf(')') ) + val fileInfo = fileDataBase!!.getFileInfoDao() .searchFileInfoByNameAndType( prefix, fileType.toString(), identifiersPromptNumber ) + DebugHelper.printLog( + debugKey, + "值类型[" + codeInfo.type + "]项目[" + lineData + "]搜索了[" + fileType + "]类型的文件,返回了[" + (fileInfo?.size + ?: -1) + "]个结果", + "关联提示列表分析" + ) if (fileInfo != null && fileInfo.isNotEmpty()) { for (fileTable in fileInfo) { result.add( @@ -277,16 +302,33 @@ class RustAutoComplete2(val context: Context) : AutoCompleteProvider, EnglishMod lineData.indexOf('(') + 1, lineData.indexOf(')') ).toString() - codeDataBase!!.getCodeDao().findCodeByKeyInType( - prefix, - type, - identifiersPromptNumber - )?.forEach { - result.add( - completionItemConverter.codeInfoToCompletionItem( - it - ) + val list = if (isEnglishMode + ) { + codeDataBase!!.getCodeDao().findCodeByCodeInType( + prefix, + type, + identifiersPromptNumber ) + } else { + codeDataBase!!.getCodeDao().findCodeByTranslateInType( + prefix, + type, + identifiersPromptNumber + ) + } + DebugHelper.printLog( + debugKey, + "关联了值类型[" + type + "]获取[" + (list?.size ?: -1) + "]个结果", + "值类型引用" + ) + if (!list.isNullOrEmpty()) { + list.forEach { + result.add( + completionItemConverter.codeInfoToCompletionItem( + it + ) + ) + } } } else if (lineData.startsWith("@section") && lineData.endsWith( ")" @@ -318,7 +360,18 @@ class RustAutoComplete2(val context: Context) : AutoCompleteProvider, EnglishMod ) } } else { - if (temCodeInfo.translate.contains(prefix)) { + + val show = if (isEnglishMode) { + temCodeInfo.code.contains(prefix) + } else { + temCodeInfo.translate.contains(prefix) + } + DebugHelper.printLog( + debugKey, + "值类型[" + codeInfo.type + "]项目[" + lineData + "]是否包含" + prefix + "关键字[" + show + "]", + "关联提示列表分析" + ) + if (show) { result.add( completionItemConverter.codeInfoToCompletionItem( temCodeInfo diff --git a/app/src/main/res/menu/menu_editer.xml b/app/src/main/res/menu/menu_editer.xml index be653f0..2ab005b 100644 --- a/app/src/main/res/menu/menu_editer.xml +++ b/app/src/main/res/menu/menu_editer.xml @@ -39,9 +39,9 @@ android:title="@string/word_wrap" /> + android:title="@string/turret_design" + android:visible="false" /> + \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 7871508..ba77349 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -827,4 +827,5 @@ 邮箱地址填充完成。 确认密码 两次密码不一致。 + 显示源代码 \ No newline at end of file diff --git a/assistantCoreLibrary/src/main/java/com/coldmint/rust/core/CodeCompiler2.kt b/assistantCoreLibrary/src/main/java/com/coldmint/rust/core/CodeCompiler2.kt index 2d1500e..e53ebec 100644 --- a/assistantCoreLibrary/src/main/java/com/coldmint/rust/core/CodeCompiler2.kt +++ b/assistantCoreLibrary/src/main/java/com/coldmint/rust/core/CodeCompiler2.kt @@ -4,11 +4,14 @@ import android.annotation.SuppressLint import android.content.Context import android.os.Handler import android.os.Looper +import android.os.Message +import android.util.Log import com.coldmint.rust.core.dataBean.CompileConfiguration import com.coldmint.rust.core.database.code.CodeDataBase import com.coldmint.rust.core.database.code.SectionInfo import com.coldmint.rust.core.database.code.ValueTypeInfo import com.coldmint.rust.core.interfaces.* +import com.coldmint.rust.core.tool.DebugHelper import com.coldmint.rust.core.tool.FileOperator import com.coldmint.rust.core.tool.LineParser import java.io.File @@ -70,6 +73,7 @@ class CodeCompiler2 private constructor(val context: Context) : CodeCompilerInte companion object { const val split = "\n ,:()=%{}+*/\r" + val debugKey = "代码编译器" @SuppressLint("StaticFieldLeak") private var instance: CodeCompiler2? = null @@ -175,7 +179,7 @@ class CodeCompiler2 private constructor(val context: Context) : CodeCompilerInte if (translationMap.containsKey(code)) { translationResult.append(translationMap[code]) } else { - codeResult.delete(0, codeResult.length) + codeResult.clear() when (code) { "\n" -> { if (codeBlockType == CompileConfiguration.CodeBlockType.Reference) { @@ -184,9 +188,10 @@ class CodeCompiler2 private constructor(val context: Context) : CodeCompilerInte codeDataBase.getCodeDao().findCodeByCode(referenceValue) if (codeInfo == null) { translationResult.append(referenceResult) - }else{ -// tr + } else { + translationResult.append(codeInfo.translate) } + referenceResult.clear() } codeBlockType = CompileConfiguration.CodeBlockType.Key codeResult.append(code) @@ -295,6 +300,11 @@ class CodeCompiler2 private constructor(val context: Context) : CodeCompilerInte translationMap[code] = codeResult.toString() } translationResult.append(codeResult.toString()) + DebugHelper.printLog( + debugKey, + "代码[" + code + "]译文[" + codeResult.toString() + "]是否翻译[" + (code != codeResult.toString()) + "]", + "翻译" + ) } } handler.post { @@ -323,6 +333,11 @@ class CodeCompiler2 private constructor(val context: Context) : CodeCompilerInte val codeResult = StringBuilder() //保存完整的翻译结果 val compileResult = StringBuilder() + //是否为首次引用冒号值(首次值会直接附加到结果集合内) + var isFirstReference = false + + //保存资源引用值(应该看做整体处理) + val referenceResult = StringBuilder() val context = compileConfiguration.context handler.post { compilerListener?.beforeCompilation() @@ -330,7 +345,7 @@ class CodeCompiler2 private constructor(val context: Context) : CodeCompilerInte val startTime = System.currentTimeMillis() while (tokenizer.hasMoreTokens()) { val translation = tokenizer.nextToken() - codeResult.delete(0, codeResult.length) + codeResult.clear() if (compileMap.containsKey(translation)) { //此处仅读取字段缓存,不涉及错误缓存的读取 val code = compileMap[translation] @@ -351,32 +366,67 @@ class CodeCompiler2 private constructor(val context: Context) : CodeCompilerInte } else { when (translation) { "\n" -> { - analysisLineCode(compileConfiguration, compilerListener) + if (compileConfiguration.codeBlockType == CompileConfiguration.CodeBlockType.Reference) { + //此段代码将临时引用数据referenceValue 附加到编译结果内,并附加到 值 数据内(附加值数据用于检查) + val referenceValue = referenceResult.toString() + compileConfiguration.appendValue(referenceResult.toString()) + val codeInfo = codeDataBase.getCodeDao() + .findCodeByTranslate(referenceResult.toString()) + if (codeInfo == null) { + compileResult.append(referenceValue) + } else { + compileResult.append(codeInfo.code) + } + DebugHelper.printLog( + debugKey, + "引用数据[" + referenceValue + "]代码信息存在状态[" + (codeInfo != null) + "]", + "行引用附加" + ) + referenceResult.clear() + } + isFirstReference = true + checkLineCode(compileConfiguration, compilerListener) compileConfiguration.nextLine() codeResult.append(translation) } "\r" -> { } " ", ",", "(", ")", "=", "%", "{", "}", "+", "*", "/" -> { - codeResult.append( - translation - ) - compileConfiguration.appendResult(translation) + if (compileConfiguration.codeBlockType == CompileConfiguration.CodeBlockType.Reference) { + referenceResult.append(translation) + } else { + codeResult.append( + translation + ) + compileConfiguration.appendResult(translation) + } } ":" -> { when (compileConfiguration.codeBlockType) { CompileConfiguration.CodeBlockType.Value -> { compileConfiguration.appendResult(translation) + codeResult.append(translation) } CompileConfiguration.CodeBlockType.Key -> { compileConfiguration.codeBlockType = CompileConfiguration.CodeBlockType.Value + codeResult.append(translation) + } + CompileConfiguration.CodeBlockType.Reference -> { + if (isFirstReference) { + codeResult.append(translation) + isFirstReference = false + } else { + referenceResult.append(translation) + } } } - codeResult.append(translation) } else -> if (compileConfiguration.codeBlockType == CompileConfiguration.CodeBlockType.Note) { codeResult.append(translation) + } else if (compileConfiguration.codeBlockType == CompileConfiguration.CodeBlockType.Reference) { + //资源引用值应该被整体处理 + referenceResult.append(translation) } else { if (translation.startsWith("#") && compileConfiguration.codeBlockType == CompileConfiguration.CodeBlockType.Key @@ -430,7 +480,7 @@ class CodeCompiler2 private constructor(val context: Context) : CodeCompilerInte if (!tag.isNullOrBlank()) { //如果此类型为特殊标注,那么设置为注释 compileConfiguration.codeBlockType = - CompileConfiguration.CodeBlockType.Note + CompileConfiguration.CodeBlockType.Reference } } codeResult.append(codeInfo.code) @@ -465,15 +515,21 @@ class CodeCompiler2 private constructor(val context: Context) : CodeCompilerInte } } + /** - * 解析行数据 + * 检查行数据,此函数不修改结果集。 * @param compileConfiguration CompileConfiguration 代码配置 * @param compilerListener CodeCompilerListener? 代码监听器 */ - fun analysisLineCode( + fun checkLineCode( compileConfiguration: CompileConfiguration, compilerListener: CodeCompilerListener? = null ) { + DebugHelper.printLog( + debugKey, + "键[" + compileConfiguration.getKey() + "]值[" + compileConfiguration.getValue() + "]", + "行处理" + ) compileConfiguration.setCanAddError(true) val key = compileConfiguration.getKey() //设置了监听器并且key不为空 diff --git a/assistantCoreLibrary/src/main/java/com/coldmint/rust/core/dataBean/CompileConfiguration.kt b/assistantCoreLibrary/src/main/java/com/coldmint/rust/core/dataBean/CompileConfiguration.kt index e9f0303..83bf834 100644 --- a/assistantCoreLibrary/src/main/java/com/coldmint/rust/core/dataBean/CompileConfiguration.kt +++ b/assistantCoreLibrary/src/main/java/com/coldmint/rust/core/dataBean/CompileConfiguration.kt @@ -7,6 +7,7 @@ import android.text.SpannableString import android.text.Spanned import android.text.style.ClickableSpan import android.text.style.ForegroundColorSpan +import android.util.Log import android.view.View import com.coldmint.rust.core.* import java.io.File @@ -40,6 +41,18 @@ data class CompileConfiguration( ) { + /** + * 增加值 + * @param string String + */ + fun appendValue(string: String) { + if (codeBlockType == CodeBlockType.Reference) { + valueBuilder.append(string) + } else { + Log.e(CodeCompiler2.debugKey, "只能在引用语句块设置值。") + } + } + /** * 设置是否可以添加错误(只能在特定的函数内添加错误) * @param canAddError Boolean diff --git a/assistantCoreLibrary/src/main/java/com/coldmint/rust/core/dataBean/dataset/DataBaseManifest.kt b/assistantCoreLibrary/src/main/java/com/coldmint/rust/core/dataBean/dataset/DataBaseManifest.kt index e5d3abb..c397acc 100644 --- a/assistantCoreLibrary/src/main/java/com/coldmint/rust/core/dataBean/dataset/DataBaseManifest.kt +++ b/assistantCoreLibrary/src/main/java/com/coldmint/rust/core/dataBean/dataset/DataBaseManifest.kt @@ -1,19 +1,35 @@ package com.coldmint.rust.core.dataBean.dataset +import com.google.gson.annotations.SerializedName + data class DataBaseManifest( - val id: String, + @SerializedName("author") val author: String, + @SerializedName("describe") val describe: String, + @SerializedName("id") + val id: String, + @SerializedName("name") val name: String, - val versionNumber: Int, + @SerializedName("tables") + val tables: Tables, + @SerializedName("updateLog") + val updateLog: List, + @SerializedName("versionName") val versionName: String, - val tables: Tables + @SerializedName("versionNumber") + val versionNumber: Int ) { data class Tables( - val chain_inspection: String, + @SerializedName("chain_inspection") + val chainInspection: String, + @SerializedName("code") val code: String, - val game_version: String, + @SerializedName("game_version") + val gameVersion: String, + @SerializedName("section") val section: String, - val value_type: String + @SerializedName("value_type") + val valueType: String ) } \ No newline at end of file diff --git a/assistantCoreLibrary/src/main/java/com/coldmint/rust/core/database/code/CodeDao.kt b/assistantCoreLibrary/src/main/java/com/coldmint/rust/core/database/code/CodeDao.kt index 4069fa8..262d6da 100644 --- a/assistantCoreLibrary/src/main/java/com/coldmint/rust/core/database/code/CodeDao.kt +++ b/assistantCoreLibrary/src/main/java/com/coldmint/rust/core/database/code/CodeDao.kt @@ -37,8 +37,24 @@ interface CodeDao { @Query("SELECT * FROM code WHERE translate LIKE '%'||:key||'%' AND (section=:section OR section='all') LIMIT :limitNum") fun findCodeByKeyInSection(key: String, section: String, limitNum: Int): List? + /** + * 在类型内通过翻译查找代码 + * @param key String + * @param type String + * @param limitNum Int + * @return List? + */ @Query("SELECT * FROM code WHERE translate LIKE '%'||:key||'%' AND type=:type LIMIT :limitNum") - fun findCodeByKeyInType(key: String, type: String, limitNum: Int): List? + fun findCodeByTranslateInType(key: String, type: String, limitNum: Int): List? + /** + * 在类型内通过Code查找代码 + * @param key String + * @param type String + * @param limitNum Int + * @return List? + */ + @Query("SELECT * FROM code WHERE code LIKE '%'||:key||'%' AND type=:type LIMIT :limitNum") + fun findCodeByCodeInType(key: String, type: String, limitNum: Int): List? /** * 搜索代码 diff --git a/assistantCoreLibrary/src/main/java/com/coldmint/rust/core/database/code/CodeDataBase.kt b/assistantCoreLibrary/src/main/java/com/coldmint/rust/core/database/code/CodeDataBase.kt index f1dca4f..4c3397c 100644 --- a/assistantCoreLibrary/src/main/java/com/coldmint/rust/core/database/code/CodeDataBase.kt +++ b/assistantCoreLibrary/src/main/java/com/coldmint/rust/core/database/code/CodeDataBase.kt @@ -9,12 +9,8 @@ import androidx.room.RoomDatabase import com.coldmint.rust.core.DataSet import com.coldmint.rust.core.dataBean.dataset.* import com.coldmint.rust.core.database.file.FileDataBase -import com.coldmint.rust.core.database.file.FileTable -import com.coldmint.rust.core.database.file.HistoryRecord -import com.coldmint.rust.core.database.file.ValueTable import com.coldmint.rust.core.tool.FileOperator import com.google.gson.Gson -import java.io.File import java.util.concurrent.Executors /** @@ -226,7 +222,7 @@ abstract class CodeDataBase : RoomDatabase() { try { Log.d("数据集加载", "加载值表...") val valueTypeData = - FileOperator.readFile(dataSet.getAbsolutePath(manifest.tables.value_type)) + FileOperator.readFile(dataSet.getAbsolutePath(manifest.tables.valueType)) if (valueTypeData != null) { val valueTypeDataBean = gson.fromJson( @@ -286,7 +282,7 @@ abstract class CodeDataBase : RoomDatabase() { try { Log.d(datasetTag, "加载链式检查表...") val chainInspectionData = - FileOperator.readFile(dataSet.getAbsolutePath(manifest.tables.chain_inspection)) + FileOperator.readFile(dataSet.getAbsolutePath(manifest.tables.chainInspection)) if (chainInspectionData != null) { val chainInspectionDataBean = gson.fromJson( chainInspectionData, @@ -345,7 +341,7 @@ abstract class CodeDataBase : RoomDatabase() { try { Log.d("数据集加载", "加载版本表...") val versionData = - FileOperator.readFile(dataSet.getAbsolutePath(manifest.tables.game_version)) + FileOperator.readFile(dataSet.getAbsolutePath(manifest.tables.gameVersion)) if (versionData != null) { val versionDataBean = gson.fromJson( diff --git a/assistantCoreLibrary/src/main/java/com/coldmint/rust/core/interfaces/CodeCompilerListener.kt b/assistantCoreLibrary/src/main/java/com/coldmint/rust/core/interfaces/CodeCompilerListener.kt index 590052f..68bf313 100644 --- a/assistantCoreLibrary/src/main/java/com/coldmint/rust/core/interfaces/CodeCompilerListener.kt +++ b/assistantCoreLibrary/src/main/java/com/coldmint/rust/core/interfaces/CodeCompilerListener.kt @@ -27,6 +27,7 @@ interface CodeCompilerListener { * @param code String 代码 * @param section String 节 */ + fun onClickKeyNotFoundItem( lineNum: Int, columnNum: Int, @@ -42,6 +43,7 @@ interface CodeCompilerListener { * @param view View 视图 * @param valueType ValueTypeInfo 值类型 */ + fun onClickValueTypeErrorItem( lineNum: Int, columnNum: Int, @@ -57,6 +59,7 @@ interface CodeCompilerListener { * @param view View * @param sectionName String */ + fun onClickSectionIndexError(lineNum: Int, columnNum: Int, view: View, sectionName: String) /** @@ -92,6 +95,7 @@ interface CodeCompilerListener { * @param sectionName String 节名 * @param needName Boolean 是否需要附加名 */ + fun onClickSectionNameErrorItem( lineNum: Int, columnNum: Int, @@ -107,6 +111,7 @@ interface CodeCompilerListener { * @param view View 视图 * @param sectionName String 节名 */ + fun onClickCodeIndexErrorItem(lineNum: Int, view: View, sectionName: String) /** diff --git a/assistantCoreLibrary/src/main/java/com/coldmint/rust/core/tool/DebugHelper.kt b/assistantCoreLibrary/src/main/java/com/coldmint/rust/core/tool/DebugHelper.kt new file mode 100644 index 0000000..4750eda --- /dev/null +++ b/assistantCoreLibrary/src/main/java/com/coldmint/rust/core/tool/DebugHelper.kt @@ -0,0 +1,31 @@ +package com.coldmint.rust.core.tool + +import android.util.Log +import com.coldmint.rust.core.CodeCompiler2 + +/** + * 调试帮助器 + */ +object DebugHelper { + + + /** + * 日志打印 + * @param message String 消息 + * @param module String? 模块名 + * @param isError Boolean 是否为错误 + */ + fun printLog(keyValue: String, message: String, module: String? = null, isError: Boolean = false) { + val key = if (module == null) { + keyValue + } else { + "$keyValue-$module" + } + if (isError) { + Log.e(key, message) + } else { + Log.d(key, message) + } + } + +} \ No newline at end of file diff --git a/local.properties b/local.properties index d1253cb..4c1f18f 100644 --- a/local.properties +++ b/local.properties @@ -4,5 +4,5 @@ # Location of the SDK. This is only used by Gradle. # For customization when using a Version Control System, please read the # header note. -#Sat Apr 23 18:41:07 CST 2022 -sdk.dir=D\:\\Android_SDK +#Sun Apr 24 15:32:29 CST 2022 +sdk.dir=D\:\\Document\\AndroidSdk