Skip to content

Commit 7b6235b

Browse files
committed
ui
1 parent abd7a5b commit 7b6235b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+1472
-45
lines changed

.DS_Store

0 Bytes
Binary file not shown.

Common/.DS_Store

0 Bytes
Binary file not shown.

Common/File/CSVParser.py

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
#!/usr/bin/python
2+
# coding=utf-8
3+
import sys
4+
import zipfile
5+
import shutil
6+
import os
7+
import os.path
8+
import json
9+
10+
from . import FileUtil
11+
12+
class CSVParser():
13+
KEY_WORD_YINHAO = "\""
14+
KEY_WORD_YINHAO2 = "”"
15+
KEY_WORD_SPLIT = ","
16+
KEY_WORD_CANCEL = "#"
17+
18+
rootJson = None
19+
fileJson = ""
20+
# 当前行数组
21+
listLine = []
22+
# 整个内容表
23+
listTable = []
24+
25+
26+
def ReadData(self,text):
27+
self.SplitAllLine(text)
28+
def SplitAllLine(self,text):
29+
list = text.split("\n")
30+
index = 0
31+
for i in range(0, len(list)):
32+
strline = list[i]
33+
if len(strline) > 0:
34+
# 注释
35+
if strline[0:1]==self.KEY_WORD_CANCEL:
36+
continue
37+
38+
v_new = strline.replace("\r", "")
39+
self.SplitLine(v_new)
40+
index = index+1
41+
}
42+
43+
def SplitLine(self,text):
44+
list = []
45+
pos = 0
46+
# 是否有分割符
47+
ishas_split = False
48+
yinhao_pos_start = -1
49+
yinhao_pos_end = -1
50+
strYinhao = ""
51+
for i in range(0, len(text)):
52+
word = text[i:i+1]
53+
54+
if yinhao_pos_start >= 0:
55+
# //skip 引号
56+
if i <= yinhao_pos_end and i != str.length - 1 :
57+
continue
58+
59+
60+
61+
if word == self.KEY_WORD_SPLIT:
62+
ishas_split = True
63+
# //substring:pos to (i-1)
64+
len = (i - 1) - pos + 1
65+
strtmp = str.substr(pos, len)
66+
# //Debug.Log("SplitLine:" + strtmp)
67+
list.append(strtmp)
68+
pos = i + 1
69+
70+
71+
if (word == self.KEY_WORD_YINHAO) or (word == self.KEY_WORD_YINHAO2):
72+
strYinhao = word
73+
skip_step = 0
74+
# //查找下一个引号
75+
# //"亲,好玩,现在就去赞一个?","Pro, fun, and now to praise a?"
76+
# postmp = text.indexOf(strYinhao, i + 1)
77+
strtmp = text[i+1:]
78+
postmp = strtmp.find(strYinhao)
79+
if postmp >= 0:
80+
yinhao_pos_start = i
81+
yinhao_pos_end = postmp
82+
skip_step = postmp - i + 1
83+
# // i += skip_step
84+
85+
if i == len(text) - 1 :
86+
if ishas_split == True:
87+
# //添加最后一个分割符后的子串
88+
len = i - pos + 1
89+
strtmp = text[pos:pos+len]
90+
# //Debug.Log("SplitLine:" + strtmp)
91+
list.append(strtmp)
92+
93+
else:
94+
# //整个
95+
list.append(str)
96+
97+
98+
99+
# index = 0
100+
# for (let value of list) {
101+
# // Debug.Log("SplitLine list=" + value)
102+
# index++
103+
# }
104+
self.listTable.append(list)
105+
106+
def GetText(self,row,col):
107+
# ret = ""
108+
# list = self.listTable[row]
109+
# ret = list[col]
110+
return self.listTable[row][col]
111+
112+
def GetRowCount(self):
113+
return len(self.listTable)
114+
115+
116+
117+
mainCSVParser = CSVParser()
118+

Common/File/FileUtil.py

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,32 @@ def GetSubDirList(sourceDir,listdir):
101101
print(sourceFile)
102102
listdir.append(sourceFile)
103103

104+
105+
# 获取子目录文件列表
106+
@staticmethod
107+
def GetSubFileList(sourceDir,ext,listfile):
108+
for file in os.listdir(sourceDir):
109+
sourceFile = os.path.join(sourceDir, file)
110+
#cover the files
111+
if os.path.isfile(sourceFile):
112+
# print sourceFile
113+
# 分割文件名与后缀
114+
temp_list = os.path.splitext(file)
115+
# name without extension
116+
name = temp_list[0]
117+
# 后缀名,包含. 例如: ".apk "
118+
ext_file = temp_list[1]
119+
ext_file = ext_file[1:]
120+
if ext==ext_file:
121+
print(sourceFile)
122+
listfile.append(sourceFile)
123+
124+
#目录嵌套
125+
if os.path.isdir(sourceFile):
126+
# print sourceFile
127+
FileUtil.GetSubFileList(sourceFile,ext,listfile)
128+
129+
104130
#删除一级目录下的所有文件:
105131
@staticmethod
106132
def RemoveFileInFirstDir(targetDir):
@@ -212,6 +238,13 @@ def CreateDir(dir):
212238
if os.path.exists(dir)==False:
213239
os.mkdir(dir)
214240

241+
242+
# 复制单个文件
243+
@staticmethod
244+
def CreateFile(sourceFile):
245+
open(sourceFile, "w").write("")
246+
247+
215248
@staticmethod
216249
# 循环创建
217250
def CreateDir2(dir):
@@ -226,7 +259,7 @@ def CreateDir2(dir):
226259
break
227260

228261
ext = FileUtil.GetFileExt(dir)
229-
print("CreateDir2 ext=",ext)
262+
# print("CreateDir2 ext=",ext)
230263
if len(ext)==0:
231264
listdir.append(dir)
232265

538 Bytes
Binary file not shown.

Docs/.DS_Store

0 Bytes
Binary file not shown.

Docs/软著/.DS_Store

6 KB
Binary file not shown.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)