Table of Contents

Class CodeHashGeneratorPostprocessor

Namespace
CodeStage.AntiCheat.EditorCode.PostProcessors
Assembly
Build.dll

Does calculates code hash after build if you use option "Generate code hash". Listen to HashesGenerated or look for hash for each build in the Editor Console.

public class CodeHashGeneratorPostprocessor : IPostprocessBuildWithReport, IOrderedCallback
Inheritance
object
CodeHashGeneratorPostprocessor
Implements
IPostprocessBuildWithReport
IOrderedCallback

Remarks

Resulting hash in most cases should match value you get from the CodeHashGenerator

Fields

CallbackOrder

Equals int.MaxValue to make sure this postprocessor will run as late as possible so you could run own postprocessors before and subscribe to HashesGenerated event.

public const int CallbackOrder = 2147483647

Field Value

int

Remarks

Used at CodeHashGeneratorListener example.

Methods

CalculateBuildReportHashesAsync(BuildReport, bool)

Calculates hashes for the given build report. Can be useful if you wish to hash build you just made with BuildPipeline.

public static Task<IReadOnlyList<BuildHashes>> CalculateBuildReportHashesAsync(BuildReport report, bool printToConsole)

Parameters

report BuildReport

BuildReport you wish to calculates hashes for

printToConsole bool

Specifies if calculated hashes should be printed to Unity Console

Returns

Task<IReadOnlyList<BuildHashes>>

Readonly List of the BuildHashes, one per each resulting build from the BuildReport.

CalculateExternalBuildHashes(string, bool)

Calls selection dialog and calculates hashes for the selected build.

public static BuildHashes CalculateExternalBuildHashes(string buildPath, bool printToConsole)

Parameters

buildPath string

Path to the .apk / .aab or .exe file. Pass null to show file selection dialog.

printToConsole bool

Path to the .apk / .aab or .exe file. Pass null to show file selection dialog.

Returns

BuildHashes

Valid BuildHashes instance or null in case of error / user cancellation.

CalculateExternalBuildHashesAsync(string, bool)

Calls selection dialog and calculates hashes for the selected build.

public static Task<BuildHashes> CalculateExternalBuildHashesAsync(string buildPath, bool printToConsole)

Parameters

buildPath string

Path to the .apk / .aab or .exe file. Pass null to show file selection dialog.

printToConsole bool

Path to the .apk / .aab or .exe file. Pass null to show file selection dialog.

Returns

Task<BuildHashes>

Task with Valid BuildHashes instance or null in case of error / user cancellation.

Events

HashesGenerated

You may listen to this event if you wish to post-process resulting code hash, e.g. upload it to the server for the later runtime check with CodeHashGenerator.

public static event CodeHashGeneratorPostprocessor.OnHashesGenerated HashesGenerated

Event Type

CodeHashGeneratorPostprocessor.OnHashesGenerated