Commit 3a99245f authored by fallenstardust's avatar fallenstardust

增加更多支持扩展名下载分拣

更新recyclerview的adapter库
DataManager::ScriptReaderZip
parent c936d24a
...@@ -422,16 +422,16 @@ byte* DataManager::ScriptReader(const char* script_name, int* slen) { ...@@ -422,16 +422,16 @@ byte* DataManager::ScriptReader(const char* script_name, int* slen) {
} }
byte* DataManager::ScriptReaderZip(const char* script_name, int* slen) { byte* DataManager::ScriptReaderZip(const char* script_name, int* slen) {
IReadFile* reader = FileSystem->createAndOpenFile(script_name); IReadFile* reader = FileSystem->createAndOpenFile(script_name);
if(reader == NULL) if (!reader)
return 0; return nullptr;
size_t size = reader->getSize(); size_t size = reader->getSize();
if(size > sizeof(scriptBuffer)) { if (size > sizeof scriptBuffer) {
reader->drop(); reader->drop();
return 0; return nullptr;
} }
reader->read(scriptBuffer, size); reader->read(scriptBuffer, size);
reader->drop(); reader->drop();
*slen = size; *slen = (int)size;
return scriptBuffer; return scriptBuffer;
} }
......
...@@ -107,7 +107,7 @@ dependencies { ...@@ -107,7 +107,7 @@ dependencies {
//dialog库 //dialog库
implementation 'com.github.feihuaduo:DialogUtils:1.8.9.23' implementation 'com.github.feihuaduo:DialogUtils:1.8.9.23'
//recyclerview的adapter库 //recyclerview的adapter库
implementation 'com.github.CymChad:BaseRecyclerViewAdapterHelper:3.0.4' implementation 'io.github.cymchad:BaseRecyclerViewAdapterHelper4:4.1.4'
implementation 'androidx.appcompat:appcompat:1.7.0' implementation 'androidx.appcompat:appcompat:1.7.0'
implementation 'com.google.android.material:material:1.12.0' implementation 'com.google.android.material:material:1.12.0'
//图片选择 //图片选择
......
...@@ -102,6 +102,7 @@ public interface Constants { ...@@ -102,6 +102,7 @@ public interface Constants {
String YDK_FILE_EX = ".ydk"; String YDK_FILE_EX = ".ydk";
String YRP_FILE_EX = ".yrp"; String YRP_FILE_EX = ".yrp";
String YPK_FILE_EX = ".ypk"; String YPK_FILE_EX = ".ypk";
String LUA_FILE_EX = ".lua";
int[] CORE_SKIN_BG_SIZE = new int[]{1920, 1080}; int[] CORE_SKIN_BG_SIZE = new int[]{1920, 1080};
int[] CORE_SKIN_CARD_MINI_SIZE = new int[]{44, 64}; int[] CORE_SKIN_CARD_MINI_SIZE = new int[]{44, 64};
......
...@@ -162,10 +162,14 @@ public class MycardFragment extends BaseFragemnt implements View.OnClickListener ...@@ -162,10 +162,14 @@ public class MycardFragment extends BaseFragemnt implements View.OnClickListener
throw new RuntimeException(e); throw new RuntimeException(e);
} }
String destFileDir = ""; String destFileDir = "";
if (contentDisposition.endsWith(Constants.YDK_FILE_EX)) { if (fileName.endsWith(Constants.YDK_FILE_EX)) {
destFileDir = AppsSettings.get().getDeckDir(); destFileDir = AppsSettings.get().getDeckDir();
} else if (contentDisposition.endsWith(Constants.YRP_FILE_EX)) { } else if (fileName.endsWith(Constants.YRP_FILE_EX)) {
destFileDir = AppsSettings.get().getReplayDir(); destFileDir = AppsSettings.get().getReplayDir();
} else if (fileName.endsWith(Constants.CORE_LIMIT_PATH)) {
destFileDir = AppsSettings.get().getExpansionsPath().getPath();
} else if (fileName.endsWith(Constants.LUA_FILE_EX)) {
destFileDir = AppsSettings.get().getSingleDir();
} else {//萌卡还有些什么文件格式后续可以添加 } else {//萌卡还有些什么文件格式后续可以添加
destFileDir = AppsSettings.get().getResourcePath(); destFileDir = AppsSettings.get().getResourcePath();
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment