mirror of
https://github.com/rememberber/MooTool.git
synced 2026-12-03 12:42:50 +08:00
Extend zh/en/ja ToolError coverage for Electron import, workspace validation, favorites, translation words, RSA/SM2 crypto, and remaining Core engines; wire UI language through migration panel and tighten smoke find waits. Co-authored-by: Cursor <cursoragent@cursor.com>
22 lines
969 B
Swift
22 lines
969 B
Swift
import Foundation
|
|
|
|
public struct MediaWorkspaceState: Codable, Equatable {
|
|
public var filePaths: [String] = []
|
|
public var exportWidth: String = ""
|
|
public var jpegQuality: Double = 0.85
|
|
public var watermark: String = ""
|
|
public var pdfShowText = false
|
|
|
|
public init() {}
|
|
|
|
public func validate(language: AppLanguage = AppLocalization.preferredLanguage()) throws {
|
|
func err(_ key: String) -> ToolError { ToolError(AppLocalization.string(key, language: language)) }
|
|
guard filePaths.count <= 32 else { throw err("media.error.tooManyFiles") }
|
|
for path in filePaths {
|
|
guard !path.isEmpty, path.utf8.count <= 4096 else { throw err("media.error.invalidPath") }
|
|
}
|
|
guard jpegQuality.isFinite, (0.05...1).contains(jpegQuality) else { throw err("media.error.jpegQuality") }
|
|
guard exportWidth.utf8.count <= 16, watermark.utf8.count <= 1024 else { throw err("media.error.exportSettings") }
|
|
}
|
|
}
|