mirror of
https://github.com/Wack0/IFPSTools.NET.git
synced 2025-06-18 10:45:36 -04:00

libifpscc: initial commit readme: document ifpscc/libifpscc license: add credits for ifpscc/libifpscc (derived from code also MIT licensed) libifps: make additional fields/types public for libifpscc libifps: fix field documentation for some opcodes libifps: fix loading functions that are not exported libifps: allow saving a nonexistant primitive type if the same primitive type was added already libifps: fix parsing Extended constants libifps: fix ushort/short being mapped to the wrong types in one table csproj: set Prefer32Bit=false for release builds
30 lines
632 B
C#
30 lines
632 B
C#
using System;
|
|
|
|
public class SetOnce<T> {
|
|
public SetOnce() {
|
|
this.IsSet = false;
|
|
this._value = default(T);
|
|
}
|
|
|
|
public Boolean IsSet { get; private set; }
|
|
private T _value;
|
|
|
|
public T Value {
|
|
get {
|
|
if (!this.IsSet) {
|
|
throw new InvalidOperationException("Value hasn't been set.");
|
|
}
|
|
return this._value;
|
|
}
|
|
set {
|
|
if (this.IsSet) {
|
|
throw new InvalidOperationException("Value cannot be set twice.");
|
|
}
|
|
this._value = value;
|
|
this.IsSet = true;
|
|
}
|
|
}
|
|
|
|
}
|
|
|