-
-
Notifications
You must be signed in to change notification settings - Fork 219
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
prepare source-generator diagnostics
- Loading branch information
Showing
8 changed files
with
284 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
sandbox/SandboxWebApp/wwwroot/js/memorypack/FooBarBazDayonDattayon.js
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
1 change: 1 addition & 0 deletions
1
sandbox/SandboxWebApp/wwwroot/js/memorypack/FooBarBazDayonDattayon.js.map
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
72 changes: 72 additions & 0 deletions
72
sandbox/SandboxWebApp/wwwroot/js/memorypack/FooBarBazDayonDattayon.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
import { MemoryPackWriter } from "./MemoryPackWriter.js"; | ||
import { MemoryPackReader } from "./MemoryPackReader.js"; | ||
|
||
export class FooBarBazDayonDattayon { | ||
myProperty: number; | ||
|
||
constructor() { | ||
this.myProperty = 0; | ||
|
||
} | ||
|
||
static serialize(value: FooBarBazDayonDattayon | null): Uint8Array { | ||
const writer = MemoryPackWriter.getSharedInstance(); | ||
this.serializeCore(writer, value); | ||
return writer.toArray(); | ||
} | ||
|
||
static serializeCore(writer: MemoryPackWriter, value: FooBarBazDayonDattayon | null): void { | ||
if (value == null) { | ||
writer.writeNullObjectHeader(); | ||
return; | ||
} | ||
|
||
writer.writeObjectHeader(1); | ||
writer.writeInt32(value.myProperty); | ||
|
||
} | ||
|
||
static serializeArray(value: (FooBarBazDayonDattayon | null)[] | null): Uint8Array { | ||
const writer = MemoryPackWriter.getSharedInstance(); | ||
this.serializeArrayCore(writer, value); | ||
return writer.toArray(); | ||
} | ||
|
||
static serializeArrayCore(writer: MemoryPackWriter, value: (FooBarBazDayonDattayon | null)[] | null): void { | ||
writer.writeArray(value, (writer, x) => FooBarBazDayonDattayon.serializeCore(writer, x)); | ||
} | ||
|
||
static deserialize(buffer: ArrayBuffer): FooBarBazDayonDattayon | null { | ||
return this.deserializeCore(new MemoryPackReader(buffer)); | ||
} | ||
|
||
static deserializeCore(reader: MemoryPackReader): FooBarBazDayonDattayon | null { | ||
const [ok, count] = reader.tryReadObjectHeader(); | ||
if (!ok) { | ||
return null; | ||
} | ||
|
||
const value = new FooBarBazDayonDattayon(); | ||
if (count == 1) { | ||
value.myProperty = reader.readInt32(); | ||
|
||
} | ||
else if (count > 1) { | ||
throw new Error("Current object's property count is larger than type schema, can't deserialize about versioning."); | ||
} | ||
else { | ||
if (count == 0) return value; | ||
value.myProperty = reader.readInt32(); if (count == 1) return value; | ||
|
||
} | ||
return value; | ||
} | ||
|
||
static deserializeArray(buffer: ArrayBuffer): (FooBarBazDayonDattayon | null)[] | null { | ||
return this.deserializeArrayCore(new MemoryPackReader(buffer)); | ||
} | ||
|
||
static deserializeArrayCore(reader: MemoryPackReader): (FooBarBazDayonDattayon | null)[] | null { | ||
return reader.readArray(reader => FooBarBazDayonDattayon.deserializeCore(reader)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters