public void Check(string name) { if (string.IsNullOrEmpty(AlbedoTexture) || string.IsNullOrEmpty(NormalTexture) || string.IsNullOrEmpty(DamagedTexture)) { throw new InvalidRegistryDataException(name, GetType().Name, "Empty albedo, normal, or damaged texture"); } var directory = new Directory(); string[] membranes = { AlbedoTexture, NormalTexture, DamagedTexture }; foreach (var resource in membranes) { // When exported only the .import files exist, so this check is done accordingly if (!directory.FileExists(resource + ".import")) { throw new InvalidRegistryDataException(name, GetType().Name, "Membrane uses non-existent image: " + resource); } } TranslationHelper.CopyTranslateTemplatesToTranslateSource(this); }
public void Check(string name) { if (Inputs == null || Outputs == null) { throw new InvalidRegistryDataException(name, GetType().Name, "Empty inputs or outputs"); } if (Inputs.Count == 0 && Outputs.Count == 0) { throw new InvalidRegistryDataException(name, GetType().Name, "Process has no inputs AND no outputs"); } foreach (var input in Inputs) { if (input.Value <= 0) { throw new InvalidRegistryDataException(name, GetType().Name, "Non-positive amount of input compound " + input.Key + " found"); } } foreach (var output in Outputs) { if (output.Value <= 0) { throw new InvalidRegistryDataException(name, GetType().Name, "Non-positive amount of output compound " + output.Key + " found"); } } TranslationHelper.CopyTranslateTemplatesToTranslateSource(this); }
public void Check(string name) { if (string.IsNullOrEmpty(GroupName)) { throw new InvalidRegistryDataException(name, GetType().Name, "NamedInputGroup has no group name"); } if (EnvironmentId == null || EnvironmentId.Count < 1) { throw new InvalidRegistryDataException(name, GetType().Name, "NamedInputGroup has no environment ids"); } if (Actions == null || Actions.Count < 1) { throw new InvalidRegistryDataException(name, GetType().Name, "NamedInputGroup has no actions"); } InternalName = GroupName; TranslationHelper.CopyTranslateTemplatesToTranslateSource(this); foreach (var action in Actions) { action.Check(string.Empty); } }
public void Check(string name) { if (string.IsNullOrEmpty(Name) || string.IsNullOrEmpty(Background)) { throw new InvalidRegistryDataException(name, GetType().Name, "Empty normal or damaged texture"); } if (Conditions == null) { throw new InvalidRegistryDataException(name, GetType().Name, "Conditions missing"); } Conditions.Check(name); if (Icon == null) { throw new InvalidRegistryDataException(name, GetType().Name, "icon missing"); } if (Sunlight == null) { throw new InvalidRegistryDataException(name, GetType().Name, "sunlight missing"); } TranslationHelper.CopyTranslateTemplatesToTranslateSource(this); }
public void Check(string name) { InternalName = GroupName; TranslationHelper.CopyTranslateTemplatesToTranslateSource(this); foreach (var action in Actions) { action.Check(string.Empty); } }
public void Check(string name) { if (string.IsNullOrEmpty(Name)) { throw new InvalidRegistryDataException(name, GetType().Name, "Compound has no name"); } if (string.IsNullOrEmpty(IconPath)) { throw new InvalidRegistryDataException(name, GetType().Name, "Compound must be provided an icon"); } // Guards against uninitialized alpha #pragma warning disable RECS0018 if (Colour.a == 0.0f) #pragma warning restore RECS0018 { Colour.a = 1; } if (Math.Abs(Colour.a - 1.0f) > MathUtils.EPSILON) { throw new InvalidRegistryDataException(name, GetType().Name, "Compound colour cannot have alpha other than 1"); } if (Math.Abs(Colour.r) < MathUtils.EPSILON && Math.Abs(Colour.g) < MathUtils.EPSILON && Math.Abs(Colour.b) < MathUtils.EPSILON) { throw new InvalidRegistryDataException(name, GetType().Name, "Compound colour can't be black"); } if (Volume <= 0) { throw new InvalidRegistryDataException(name, GetType().Name, "Volume should be > 0"); } TranslationHelper.CopyTranslateTemplatesToTranslateSource(this); }
public void Check(string name) { if (Components == null) { throw new InvalidRegistryDataException(name, GetType().Name, "No components specified"); } Components.Check(name); if (Components.Count < 1) { throw new InvalidRegistryDataException(name, GetType().Name, "No components specified"); } if (Mass <= 0.0f) { throw new InvalidRegistryDataException(name, GetType().Name, "Mass is unset"); } if (Mass <= 0.0f) { throw new InvalidRegistryDataException(name, GetType().Name, "Mass is unset"); } if (string.IsNullOrEmpty(Name)) { throw new InvalidRegistryDataException(name, GetType().Name, "Name is not set"); } if (InitialComposition == null || InitialComposition.Count < 1) { throw new InvalidRegistryDataException(name, GetType().Name, "InitialComposition is not set"); } if (Hexes == null || Hexes.Count < 1) { throw new InvalidRegistryDataException(name, GetType().Name, "Hexes is empty"); } // Check for duplicate position hexes for (int i = 0; i < Hexes.Count; ++i) { bool duplicate = false; for (int j = i + 1; j < Hexes.Count; ++j) { if (Hexes[i].Equals(Hexes[j])) { duplicate = true; break; } } if (duplicate) { throw new InvalidRegistryDataException(name, GetType().Name, "Duplicate hex position"); } } TranslationHelper.CopyTranslateTemplatesToTranslateSource(this); }