Documentation
¶
Overview ¶
Package nei 实现 KISS 游戏共用的 .nei 加密 CSV 表格格式 COM3D2 与 KCES 使用完全相同的容器结构,仅单元格文本的字符编码不同,因此实现放在共用包中,由各游戏包提供自身语义的封装 Package nei implements the encrypted .nei CSV table format shared by KISS games COM3D2 and KCES use an identical container structure and differ only in the character encoding of cell text, so the implementation lives in a shared package and each game package wraps it with its own semantics
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // Signature 是 .nei 解密后数据的固定签名 // Signature is the fixed signature of decrypted .nei data Signature = []byte{0x77, 0x73, 0x76, 0xFF} // Key 是默认加密密钥 // Key is the default encryption key Key = []byte{ 0xAA, 0xC9, 0xD2, 0x35, 0x22, 0x87, 0x20, 0xF2, 0x40, 0xC5, 0x61, 0x7C, 0x01, 0xDF, 0x66, 0x54, } )
Functions ¶
This section is empty.
Types ¶
type Table ¶
type Table struct {
Rows uint32 `json:"Rows"` // CSV 的行数 / Number of CSV rows
Cols uint32 `json:"Cols"` // CSV 的列数 / Number of CSV columns
Data [][]string `json:"Data"` // CSV 的数据 [行][列] / CSV cell data indexed as [row][column]
// 单元格文本的字符编码,读取时按内容探测,写出时为空等同于 Shift-JIS
// Character encoding of cell text, detected from content while reading, and an empty value writes as Shift-JIS
TextEncoding TextEncoding `json:"TextEncoding,omitempty"`
}
Table 表示解密后的 .nei CSV 表格数据 Table represents decrypted .nei CSV table data
type TextEncoding ¶
type TextEncoding string
TextEncoding 表示 .nei 单元格文本使用的字符编码 / TextEncoding represents the character encoding used by .nei cell text
const ( // TextEncodingShiftJIS 是 COM3D2 读取 .nei 时使用的 Shift-JIS(CP932)编码 // TextEncodingShiftJIS is the Shift-JIS (CP932) encoding COM3D2 uses when reading .nei TextEncodingShiftJIS TextEncoding = "Shift-JIS" // TextEncodingUTF8 是 KCES 读取 .nei 时使用的 UTF-8 编码 // TextEncodingUTF8 is the UTF-8 encoding KCES uses when reading .nei TextEncodingUTF8 TextEncoding = "UTF-8" )
func DetectTextEncoding ¶
func DetectTextEncoding(cells [][]byte) TextEncoding
DetectTextEncoding 按单元格字节内容探测 .nei 表格使用的文本编码 COM3D2 与 KCES 的 .nei 共用签名与结构,只能靠内容区分:KCES 写出的日文是合法 UTF-8,而 Shift-JIS 的假名与大多数汉字首字节落在 UTF-8 的非法首字节区 全部单元格都是 ASCII 时两种编码等价,返回 Shift-JIS 以保持既有默认 DetectTextEncoding detects the text encoding of a .nei table from the cell bytes COM3D2 and KCES .nei files share a signature and structure and can only be told apart by content: the Japanese text KCES writes is valid UTF-8, while Shift-JIS kana and most kanji lead bytes fall in UTF-8's invalid lead-byte range The two encodings are equivalent when every cell is ASCII, so Shift-JIS is returned to keep the existing default