取消代码中utf8的编码转换
This commit is contained in:
@@ -403,14 +403,14 @@ int WIN_GetWordData(u8 size,u8 type,unsigned char *buff, int word, int buff_size
|
|||||||
{
|
{
|
||||||
gbk[0]=(word>>16)&0xff;
|
gbk[0]=(word>>16)&0xff;
|
||||||
gbk[1]=(word>>8)&0xff;
|
gbk[1]=(word>>8)&0xff;
|
||||||
gbk[2]=word&0xff;
|
// gbk[2]=word&0xff;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
gbk[0]=word;
|
gbk[0]=word;
|
||||||
}
|
}
|
||||||
|
|
||||||
utf82uni_str(gbk,uni);
|
gbk2uni_str(gbk,uni);
|
||||||
|
|
||||||
|
|
||||||
if (g_ft_face)
|
if (g_ft_face)
|
||||||
|
@@ -14,6 +14,7 @@
|
|||||||
#include "nrf.h"
|
#include "nrf.h"
|
||||||
#include "mywin_user_debug.h"
|
#include "mywin_user_debug.h"
|
||||||
#include "string.h"
|
#include "string.h"
|
||||||
|
#include "char_encode.h"
|
||||||
|
|
||||||
// 文件管理器
|
// 文件管理器
|
||||||
|
|
||||||
|
@@ -1,22 +1,17 @@
|
|||||||
#ifndef MYWIN_USER_FILDER_H__
|
#ifndef MYWIN_USER_FILDER_H__
|
||||||
#define MYWIN_USER_FILDER_H__
|
#define MYWIN_USER_FILDER_H__
|
||||||
|
|
||||||
|
// 定义列表中最大显示文件数
|
||||||
|
#define FILDER_FILE_MAXNUM 1000
|
||||||
|
|
||||||
|
// 定义最大路径深度
|
||||||
|
#define FILDER_DIR_DEPTH 10
|
||||||
|
|
||||||
|
// 定义文件类型
|
||||||
|
#define FILDER_FILE_TYPE 1
|
||||||
|
#define FILDER_DIR_TYPE 0
|
||||||
|
|
||||||
|
// 路径栈
|
||||||
//定义列表中最大显示文件数
|
|
||||||
#define FILDER_FILE_MAXNUM 1000
|
|
||||||
|
|
||||||
//定义最大路径深度
|
|
||||||
#define FILDER_DIR_DEPTH 10
|
|
||||||
|
|
||||||
//定义文件类型
|
|
||||||
#define FILDER_FILE_TYPE 1
|
|
||||||
#define FILDER_DIR_TYPE 0
|
|
||||||
|
|
||||||
|
|
||||||
//路径栈
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
int index[FILDER_DIR_DEPTH];
|
int index[FILDER_DIR_DEPTH];
|
||||||
@@ -24,18 +19,12 @@ typedef struct
|
|||||||
int fileNum;
|
int fileNum;
|
||||||
} Filder_Path;
|
} Filder_Path;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
char name[256];
|
char name[256];
|
||||||
int type; //1,文件,0,文件夹
|
int type; // 1,文件,0,文件夹
|
||||||
uint64_t size;
|
uint64_t size;
|
||||||
}Filder_FildInfo;
|
} Filder_FildInfo;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
@@ -44,79 +33,69 @@ typedef struct
|
|||||||
char *imgFile;
|
char *imgFile;
|
||||||
char *imgDir;
|
char *imgDir;
|
||||||
char dirName[256];
|
char dirName[256];
|
||||||
char fileName[256];//文件路径
|
char fileName[256]; // 文件路径
|
||||||
Filder_Path path;
|
Filder_Path path;
|
||||||
int index;
|
int index;
|
||||||
int fileNum; //条目数
|
int fileNum; // 条目数
|
||||||
int dirNum; //文件夹数目
|
int dirNum; // 文件夹数目
|
||||||
int titleHight;
|
int titleHight;
|
||||||
int itemHight;
|
int itemHight;
|
||||||
int itemIndent;
|
int itemIndent;
|
||||||
int scrollbar_xsize;//滚动条宽度
|
int scrollbar_xsize; // 滚动条宽度
|
||||||
int itemNumOnePage; //每页显示条目数
|
int itemNumOnePage; // 每页显示条目数
|
||||||
int firstItemOnPage;//显示在页首的条目编号
|
int firstItemOnPage; // 显示在页首的条目编号
|
||||||
|
|
||||||
int scroll_x; //滚动显示的x坐标
|
int scroll_x; // 滚动显示的x坐标
|
||||||
int scroll_xsize; //混动显示的x长度
|
int scroll_xsize; // 混动显示的x长度
|
||||||
int scroll_timer; //滚动显示使用的定时器
|
int scroll_timer; // 滚动显示使用的定时器
|
||||||
|
|
||||||
int y_off; //支持触屏
|
int y_off; // 支持触屏
|
||||||
}WIN_FilderStruct;
|
} WIN_FilderStruct;
|
||||||
|
|
||||||
|
WIN_FilderStruct *WIN_CreatFilder(WIN_WindowStruct *base,
|
||||||
|
void (*msgLoop)(struct _WIN_WindowStruct *win, WIN_MsgStruct *msg),
|
||||||
|
int x, int y, int x_size, int y_size);
|
||||||
|
|
||||||
|
// 设置文件路径,同时扫描路径下的文件
|
||||||
|
void FILDER_SetFileDir(WIN_FilderStruct *filder, char *dir);
|
||||||
|
|
||||||
WIN_FilderStruct *WIN_CreatFilder (WIN_WindowStruct *base,
|
// 入栈
|
||||||
void (*msgLoop)(struct _WIN_WindowStruct *win,WIN_MsgStruct *msg),
|
int FILDER_PathPush(WIN_FilderStruct *filder);
|
||||||
int x,int y,int x_size,int y_size);
|
|
||||||
|
|
||||||
|
// 出栈
|
||||||
|
int FILDER_PathPull(WIN_FilderStruct *filder);
|
||||||
|
|
||||||
|
// 把文件名追加到目录,同时扫描路径下的文件
|
||||||
|
int FILDER_DirAppend(WIN_FilderStruct *filder, Filder_FildInfo *file);
|
||||||
|
|
||||||
|
// 剪短一层目录,同时扫描目录下的文件
|
||||||
|
int FILDER_DirCut(WIN_FilderStruct *filder);
|
||||||
|
|
||||||
//设置文件路径,同时扫描路径下的文件
|
// 生成文件路径
|
||||||
void FILDER_SetFileDir (WIN_FilderStruct *filder,char *dir);
|
void FILDER_GetFileRoute(WIN_FilderStruct *filder);
|
||||||
|
|
||||||
//入栈
|
// 清空条目
|
||||||
int FILDER_PathPush (WIN_FilderStruct *filder);
|
void FILDER_ClearItem(WIN_FilderStruct *filder);
|
||||||
|
|
||||||
//出栈
|
// 添加一个文件条目
|
||||||
int FILDER_PathPull (WIN_FilderStruct *filder);
|
void FILDER_AddItem(WIN_FilderStruct *filder, Filder_FildInfo *file);
|
||||||
|
|
||||||
//把文件名追加到目录,同时扫描路径下的文件
|
// 在指定位置插入一个条目
|
||||||
int FILDER_DirAppend (WIN_FilderStruct *filder,Filder_FildInfo *file);
|
void FILDER_InsertItem(WIN_FilderStruct *filder, Filder_FildInfo *file, int index);
|
||||||
|
|
||||||
//剪短一层目录,同时扫描目录下的文件
|
// 扫描文件
|
||||||
int FILDER_DirCut (WIN_FilderStruct *filder);
|
void FILDER_ScanFile(WIN_FilderStruct *filder);
|
||||||
|
|
||||||
//生成文件路径
|
// 打开文件
|
||||||
void FILDER_GetFileRoute (WIN_FilderStruct *filder);
|
void FILDER_OpenFile(WIN_FilderStruct *filder);
|
||||||
|
|
||||||
//清空条目
|
// 消息框的绘制函数
|
||||||
void FILDER_ClearItem (WIN_FilderStruct *filder);
|
void FILDER_DefaultPaint(WIN_FilderStruct *filder);
|
||||||
|
|
||||||
|
// 消息框的消息处理函数
|
||||||
|
void FILDER_defaultMsgLoop(WIN_FilderStruct *filder, WIN_MsgStruct *msg);
|
||||||
|
|
||||||
//添加一个文件条目
|
// 选则文件
|
||||||
void FILDER_AddItem (WIN_FilderStruct *filder,Filder_FildInfo *file);
|
int FILDER_ChooseFile(WIN_WindowStruct *win, char *dir);
|
||||||
|
|
||||||
|
|
||||||
//在指定位置插入一个条目
|
|
||||||
void FILDER_InsertItem (WIN_FilderStruct *filder,Filder_FildInfo *file,int index);
|
|
||||||
|
|
||||||
|
|
||||||
//扫描文件
|
|
||||||
void FILDER_ScanFile (WIN_FilderStruct *filder);
|
|
||||||
|
|
||||||
//打开文件
|
|
||||||
void FILDER_OpenFile (WIN_FilderStruct *filder);
|
|
||||||
|
|
||||||
//消息框的绘制函数
|
|
||||||
void FILDER_DefaultPaint (WIN_FilderStruct *filder);
|
|
||||||
|
|
||||||
//消息框的消息处理函数
|
|
||||||
void FILDER_defaultMsgLoop (WIN_FilderStruct *filder,WIN_MsgStruct *msg);
|
|
||||||
|
|
||||||
//选则文件
|
|
||||||
int FILDER_ChooseFile (WIN_WindowStruct *win,char *dir);
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -53,12 +53,9 @@ static void MENU_ToolEnter(WIN_MenuStruct *menu)
|
|||||||
{
|
{
|
||||||
// 选择了一个
|
// 选择了一个
|
||||||
char *path = mymalloc(256);
|
char *path = mymalloc(256);
|
||||||
char *tmp = mymalloc(256);
|
sprintf(path, "%s/%s", TOOL_APP_PATH, MENU_GetSelectItem(menu));
|
||||||
utf82gbk_str(MENU_GetSelectItem(menu), tmp);
|
|
||||||
sprintf(path, "%s/%s", TOOL_APP_PATH, tmp);
|
|
||||||
app_run_path(path);
|
app_run_path(path);
|
||||||
myfree(path);
|
myfree(path);
|
||||||
myfree(tmp);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void MENU_ToolDeleteFun(WIN_MenuStruct *menu)
|
static void MENU_ToolDeleteFun(WIN_MenuStruct *menu)
|
||||||
|
@@ -237,7 +237,6 @@ def run_cmd_queue(cmd_queue:Queue,cpu_num:int=8):
|
|||||||
while not cmd_queue.empty():
|
while not cmd_queue.empty():
|
||||||
cmd_queue.get()
|
cmd_queue.get()
|
||||||
cmd_queue.cancel_join_thread()
|
cmd_queue.cancel_join_thread()
|
||||||
|
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
|
|
||||||
|
@@ -25,10 +25,10 @@ def find_type(path:str,fix:str):
|
|||||||
def conv(file:str):
|
def conv(file:str):
|
||||||
s=""
|
s=""
|
||||||
try:
|
try:
|
||||||
with open(file,encoding="gb2312") as f:
|
with open(file,encoding="utf-8") as f:
|
||||||
s=f.read()
|
s=f.read()
|
||||||
os.remove(file)
|
os.remove(file)
|
||||||
with open(file,mode="w+",encoding="utf-8") as f:
|
with open(file,mode="w+",encoding="gbk") as f:
|
||||||
f.write(s)
|
f.write(s)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print("conv failed",file)
|
print("conv failed",file)
|
||||||
|
Reference in New Issue
Block a user