✨ Add configuration information file storage
This commit is contained in:
4
frontend/bindings/time/index.ts
Normal file
4
frontend/bindings/time/index.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||
// This file is automatically generated. DO NOT EDIT
|
||||
|
||||
export * from "./models.js";
|
||||
51
frontend/bindings/time/models.ts
Normal file
51
frontend/bindings/time/models.ts
Normal file
@@ -0,0 +1,51 @@
|
||||
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||
// This file is automatically generated. DO NOT EDIT
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore: Unused imports
|
||||
import {Create as $Create} from "@wailsio/runtime";
|
||||
|
||||
/**
|
||||
* A Time represents an instant in time with nanosecond precision.
|
||||
*
|
||||
* Programs using times should typically store and pass them as values,
|
||||
* not pointers. That is, time variables and struct fields should be of
|
||||
* type [time.Time], not *time.Time.
|
||||
*
|
||||
* A Time value can be used by multiple goroutines simultaneously except
|
||||
* that the methods [Time.GobDecode], [Time.UnmarshalBinary], [Time.UnmarshalJSON] and
|
||||
* [Time.UnmarshalText] are not concurrency-safe.
|
||||
*
|
||||
* Time instants can be compared using the [Time.Before], [Time.After], and [Time.Equal] methods.
|
||||
* The [Time.Sub] method subtracts two instants, producing a [Duration].
|
||||
* The [Time.Add] method adds a Time and a Duration, producing a Time.
|
||||
*
|
||||
* The zero value of type Time is January 1, year 1, 00:00:00.000000000 UTC.
|
||||
* As this time is unlikely to come up in practice, the [Time.IsZero] method gives
|
||||
* a simple way of detecting a time that has not been initialized explicitly.
|
||||
*
|
||||
* Each time has an associated [Location]. The methods [Time.Local], [Time.UTC], and Time.In return a
|
||||
* Time with a specific Location. Changing the Location of a Time value with
|
||||
* these methods does not change the actual instant it represents, only the time
|
||||
* zone in which to interpret it.
|
||||
*
|
||||
* Representations of a Time value saved by the [Time.GobEncode], [Time.MarshalBinary], [Time.AppendBinary],
|
||||
* [Time.MarshalJSON], [Time.MarshalText] and [Time.AppendText] methods store the [Time.Location]'s offset,
|
||||
* but not the location name. They therefore lose information about Daylight Saving Time.
|
||||
*
|
||||
* In addition to the required “wall clock” reading, a Time may contain an optional
|
||||
* reading of the current process's monotonic clock, to provide additional precision
|
||||
* for comparison or subtraction.
|
||||
* See the “Monotonic Clocks” section in the package documentation for details.
|
||||
*
|
||||
* Note that the Go == operator compares not just the time instant but also the
|
||||
* Location and the monotonic clock reading. Therefore, Time values should not
|
||||
* be used as map or database keys without first guaranteeing that the
|
||||
* identical Location has been set for all values, which can be achieved
|
||||
* through use of the UTC or Local method, and that the monotonic clock reading
|
||||
* has been stripped by setting t = t.Round(0). In general, prefer t.Equal(u)
|
||||
* to t == u, since t.Equal uses the most accurate comparison available and
|
||||
* correctly handles the case when only one of its arguments has a monotonic
|
||||
* clock reading.
|
||||
*/
|
||||
export type Time = any;
|
||||
4
frontend/bindings/voidraft/internal/models/index.ts
Normal file
4
frontend/bindings/voidraft/internal/models/index.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||
// This file is automatically generated. DO NOT EDIT
|
||||
|
||||
export * from "./models.js";
|
||||
219
frontend/bindings/voidraft/internal/models/models.ts
Normal file
219
frontend/bindings/voidraft/internal/models/models.ts
Normal file
@@ -0,0 +1,219 @@
|
||||
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||
// This file is automatically generated. DO NOT EDIT
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore: Unused imports
|
||||
import {Create as $Create} from "@wailsio/runtime";
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore: Unused imports
|
||||
import * as time$0 from "../../../time/models.js";
|
||||
|
||||
/**
|
||||
* AppConfig 应用配置
|
||||
*/
|
||||
export class AppConfig {
|
||||
/**
|
||||
* 编辑器配置
|
||||
*/
|
||||
"editor": EditorConfig;
|
||||
|
||||
/**
|
||||
* 路径配置
|
||||
*/
|
||||
"paths": PathConfig;
|
||||
|
||||
/**
|
||||
* 配置元数据
|
||||
*/
|
||||
"metadata": ConfigMetadata;
|
||||
|
||||
/** Creates a new AppConfig instance. */
|
||||
constructor($$source: Partial<AppConfig> = {}) {
|
||||
if (!("editor" in $$source)) {
|
||||
this["editor"] = (new EditorConfig());
|
||||
}
|
||||
if (!("paths" in $$source)) {
|
||||
this["paths"] = (new PathConfig());
|
||||
}
|
||||
if (!("metadata" in $$source)) {
|
||||
this["metadata"] = (new ConfigMetadata());
|
||||
}
|
||||
|
||||
Object.assign(this, $$source);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new AppConfig instance from a string or object.
|
||||
*/
|
||||
static createFrom($$source: any = {}): AppConfig {
|
||||
const $$createField0_0 = $$createType0;
|
||||
const $$createField1_0 = $$createType1;
|
||||
const $$createField2_0 = $$createType2;
|
||||
let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source;
|
||||
if ("editor" in $$parsedSource) {
|
||||
$$parsedSource["editor"] = $$createField0_0($$parsedSource["editor"]);
|
||||
}
|
||||
if ("paths" in $$parsedSource) {
|
||||
$$parsedSource["paths"] = $$createField1_0($$parsedSource["paths"]);
|
||||
}
|
||||
if ("metadata" in $$parsedSource) {
|
||||
$$parsedSource["metadata"] = $$createField2_0($$parsedSource["metadata"]);
|
||||
}
|
||||
return new AppConfig($$parsedSource as Partial<AppConfig>);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* ConfigMetadata 配置元数据
|
||||
*/
|
||||
export class ConfigMetadata {
|
||||
/**
|
||||
* 配置版本
|
||||
*/
|
||||
"version": string;
|
||||
|
||||
/**
|
||||
* 最后更新时间
|
||||
*/
|
||||
"lastUpdated": time$0.Time;
|
||||
|
||||
/** Creates a new ConfigMetadata instance. */
|
||||
constructor($$source: Partial<ConfigMetadata> = {}) {
|
||||
if (!("version" in $$source)) {
|
||||
this["version"] = "";
|
||||
}
|
||||
if (!("lastUpdated" in $$source)) {
|
||||
this["lastUpdated"] = null;
|
||||
}
|
||||
|
||||
Object.assign(this, $$source);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new ConfigMetadata instance from a string or object.
|
||||
*/
|
||||
static createFrom($$source: any = {}): ConfigMetadata {
|
||||
let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source;
|
||||
return new ConfigMetadata($$parsedSource as Partial<ConfigMetadata>);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* EditorConfig 定义编辑器配置
|
||||
*/
|
||||
export class EditorConfig {
|
||||
/**
|
||||
* 字体大小
|
||||
*/
|
||||
"fontSize": number;
|
||||
|
||||
/**
|
||||
* 文件保存的编码
|
||||
*/
|
||||
"encoding": string;
|
||||
|
||||
/**
|
||||
* 是否启用Tab缩进
|
||||
*/
|
||||
"enableTabIndent": boolean;
|
||||
|
||||
/**
|
||||
* Tab大小
|
||||
*/
|
||||
"tabSize": number;
|
||||
|
||||
/**
|
||||
* Tab类型(空格或Tab)
|
||||
*/
|
||||
"tabType": TabType;
|
||||
|
||||
/** Creates a new EditorConfig instance. */
|
||||
constructor($$source: Partial<EditorConfig> = {}) {
|
||||
if (!("fontSize" in $$source)) {
|
||||
this["fontSize"] = 0;
|
||||
}
|
||||
if (!("encoding" in $$source)) {
|
||||
this["encoding"] = "";
|
||||
}
|
||||
if (!("enableTabIndent" in $$source)) {
|
||||
this["enableTabIndent"] = false;
|
||||
}
|
||||
if (!("tabSize" in $$source)) {
|
||||
this["tabSize"] = 0;
|
||||
}
|
||||
if (!("tabType" in $$source)) {
|
||||
this["tabType"] = ("" as TabType);
|
||||
}
|
||||
|
||||
Object.assign(this, $$source);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new EditorConfig instance from a string or object.
|
||||
*/
|
||||
static createFrom($$source: any = {}): EditorConfig {
|
||||
let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source;
|
||||
return new EditorConfig($$parsedSource as Partial<EditorConfig>);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* PathConfig 定义配置文件路径相关配置
|
||||
*/
|
||||
export class PathConfig {
|
||||
/**
|
||||
* 根目录
|
||||
*/
|
||||
"rootDir": string;
|
||||
|
||||
/**
|
||||
* 配置文件路径
|
||||
*/
|
||||
"configPath": string;
|
||||
|
||||
/** Creates a new PathConfig instance. */
|
||||
constructor($$source: Partial<PathConfig> = {}) {
|
||||
if (!("rootDir" in $$source)) {
|
||||
this["rootDir"] = "";
|
||||
}
|
||||
if (!("configPath" in $$source)) {
|
||||
this["configPath"] = "";
|
||||
}
|
||||
|
||||
Object.assign(this, $$source);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new PathConfig instance from a string or object.
|
||||
*/
|
||||
static createFrom($$source: any = {}): PathConfig {
|
||||
let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source;
|
||||
return new PathConfig($$parsedSource as Partial<PathConfig>);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* TabType 定义了制表符类型
|
||||
*/
|
||||
export enum TabType {
|
||||
/**
|
||||
* The Go zero value for the underlying type of the enum.
|
||||
*/
|
||||
$zero = "",
|
||||
|
||||
/**
|
||||
* TabTypeSpaces 使用空格作为制表符
|
||||
*/
|
||||
TabTypeSpaces = "spaces",
|
||||
|
||||
/**
|
||||
* TabTypeTab 使用Tab作为制表符
|
||||
*/
|
||||
TabTypeTab = "tab",
|
||||
};
|
||||
|
||||
// Private type creation functions
|
||||
const $$createType0 = EditorConfig.createFrom;
|
||||
const $$createType1 = PathConfig.createFrom;
|
||||
const $$createType2 = ConfigMetadata.createFrom;
|
||||
@@ -0,0 +1,76 @@
|
||||
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||
// This file is automatically generated. DO NOT EDIT
|
||||
|
||||
/**
|
||||
* ConfigService 提供配置管理功能
|
||||
* @module
|
||||
*/
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore: Unused imports
|
||||
import {Call as $Call, Create as $Create} from "@wailsio/runtime";
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore: Unused imports
|
||||
import * as models$0 from "../models/models.js";
|
||||
|
||||
/**
|
||||
* GetAppConfig 获取应用配置
|
||||
*/
|
||||
export function GetAppConfig(): Promise<models$0.AppConfig | null> & { cancel(): void } {
|
||||
let $resultPromise = $Call.ByID(3361428829) as any;
|
||||
let $typingPromise = $resultPromise.then(($result: any) => {
|
||||
return $$createType1($result);
|
||||
}) as any;
|
||||
$typingPromise.cancel = $resultPromise.cancel.bind($resultPromise);
|
||||
return $typingPromise;
|
||||
}
|
||||
|
||||
/**
|
||||
* GetEditorConfig 获取编辑器配置
|
||||
*/
|
||||
export function GetEditorConfig(): Promise<models$0.EditorConfig> & { cancel(): void } {
|
||||
let $resultPromise = $Call.ByID(3648153351) as any;
|
||||
let $typingPromise = $resultPromise.then(($result: any) => {
|
||||
return $$createType2($result);
|
||||
}) as any;
|
||||
$typingPromise.cancel = $resultPromise.cancel.bind($resultPromise);
|
||||
return $typingPromise;
|
||||
}
|
||||
|
||||
/**
|
||||
* GetFullConfigPath 获取完整的配置文件路径
|
||||
*/
|
||||
export function GetFullConfigPath(): Promise<string> & { cancel(): void } {
|
||||
let $resultPromise = $Call.ByID(38527092) as any;
|
||||
return $resultPromise;
|
||||
}
|
||||
|
||||
/**
|
||||
* ResetToDefault 重置为默认配置
|
||||
*/
|
||||
export function ResetToDefault(): Promise<void> & { cancel(): void } {
|
||||
let $resultPromise = $Call.ByID(4057687351) as any;
|
||||
return $resultPromise;
|
||||
}
|
||||
|
||||
/**
|
||||
* SaveAppConfig 保存应用配置
|
||||
*/
|
||||
export function SaveAppConfig(config: models$0.AppConfig | null): Promise<void> & { cancel(): void } {
|
||||
let $resultPromise = $Call.ByID(2077587650, config) as any;
|
||||
return $resultPromise;
|
||||
}
|
||||
|
||||
/**
|
||||
* UpdateEditorConfig 更新编辑器配置
|
||||
*/
|
||||
export function UpdateEditorConfig(editorConfig: models$0.EditorConfig): Promise<void> & { cancel(): void } {
|
||||
let $resultPromise = $Call.ByID(1237949666, editorConfig) as any;
|
||||
return $resultPromise;
|
||||
}
|
||||
|
||||
// Private type creation functions
|
||||
const $$createType0 = models$0.AppConfig.createFrom;
|
||||
const $$createType1 = $Create.Nullable($$createType0);
|
||||
const $$createType2 = models$0.EditorConfig.createFrom;
|
||||
51
frontend/bindings/voidraft/internal/services/fileservice.ts
Normal file
51
frontend/bindings/voidraft/internal/services/fileservice.ts
Normal file
@@ -0,0 +1,51 @@
|
||||
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||
// This file is automatically generated. DO NOT EDIT
|
||||
|
||||
/**
|
||||
* FileService 提供原子化文件操作
|
||||
* @module
|
||||
*/
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore: Unused imports
|
||||
import {Call as $Call, Create as $Create} from "@wailsio/runtime";
|
||||
|
||||
/**
|
||||
* DeleteFile 删除文件
|
||||
*/
|
||||
export function DeleteFile(filePath: string): Promise<void> & { cancel(): void } {
|
||||
let $resultPromise = $Call.ByID(1771867857, filePath) as any;
|
||||
return $resultPromise;
|
||||
}
|
||||
|
||||
/**
|
||||
* EnsureDir 确保目录存在,如不存在则创建
|
||||
*/
|
||||
export function EnsureDir(dirPath: string): Promise<void> & { cancel(): void } {
|
||||
let $resultPromise = $Call.ByID(2291976369, dirPath) as any;
|
||||
return $resultPromise;
|
||||
}
|
||||
|
||||
/**
|
||||
* FileExists 检查文件是否存在
|
||||
*/
|
||||
export function FileExists(filePath: string): Promise<boolean> & { cancel(): void } {
|
||||
let $resultPromise = $Call.ByID(4264173930, filePath) as any;
|
||||
return $resultPromise;
|
||||
}
|
||||
|
||||
/**
|
||||
* LoadJSON 从文件加载JSON数据
|
||||
*/
|
||||
export function LoadJSON(filePath: string, target: any): Promise<void> & { cancel(): void } {
|
||||
let $resultPromise = $Call.ByID(1385779418, filePath, target) as any;
|
||||
return $resultPromise;
|
||||
}
|
||||
|
||||
/**
|
||||
* SaveJSON 原子化保存JSON数据到文件
|
||||
*/
|
||||
export function SaveJSON(filePath: string, data: any): Promise<void> & { cancel(): void } {
|
||||
let $resultPromise = $Call.ByID(3646933935, filePath, data) as any;
|
||||
return $resultPromise;
|
||||
}
|
||||
9
frontend/bindings/voidraft/internal/services/index.ts
Normal file
9
frontend/bindings/voidraft/internal/services/index.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||
// This file is automatically generated. DO NOT EDIT
|
||||
|
||||
import * as ConfigService from "./configservice.js";
|
||||
import * as FileService from "./fileservice.js";
|
||||
export {
|
||||
ConfigService,
|
||||
FileService
|
||||
};
|
||||
Reference in New Issue
Block a user