public PatchSet(PatchLevel patchLevel, string name, Patch[] _changes, params Patch[][] _incompatible) { PatchStatus = patchLevel; Name = name; changes = _changes; incompatible = _incompatible; }
public Color GetLevelColor(PatchLevel level) { switch (level) { case PatchLevel.random: return Color.grey; case PatchLevel.low: return Color.blue; case PatchLevel.medium: return Color.green; case PatchLevel.high: return Color.red; } return Color.grey; }
static public Firmware FirmwareMatch(byte[] data, PatchLevel allowLevel) { var hash = MD5Core.GetHash(data); //#if DEBUG string s = ""; foreach (byte b in hash) { s += string.Format("0x{0:X2}, ", b); } System.Diagnostics.Debug.WriteLine(s); //#endif Firmware firm = null; foreach (var h in hashMap) { if (HashSame(h.Key, hash)) { firm = h.Value; break; } } if (firm != null) { int i = 0; do { for (i = 0; i < firm.Patches.Count; i++) { if (firm.Patches[i].PatchStatus < allowLevel) { firm.Patches.RemoveAt(i); break; } } } while (i < firm.Patches.Count); firm.LoadData(data); } return(firm); }
public PatchSet(PatchLevel patchLevel, string name, Patch[] _changes, params Patch[][] _incompatible) { PatchStatus = patchLevel; Name = name; Enabled = false; changes = _changes; incompatible = _incompatible; }
static public Firmware FirmwareMatch(byte[] data, PatchLevel allowLevel) { var hash = MD5Core.GetHash(data); //#if DEBUG string s = ""; foreach (byte b in hash) { s += string.Format("0x{0:X2}, ", b); } System.Diagnostics.Debug.WriteLine(s); //#endif Firmware firm = null; foreach (var h in hashMap) { if (HashSame(h.Key, hash)) { firm = h.Value; break; } } if (firm != null) { int i = 0; do { for (i = 0; i < firm.Patches.Count; i++) { if (firm.Patches[i].PatchStatus < allowLevel) { firm.Patches.RemoveAt(i); break; } } } while (i < firm.Patches.Count); firm.LoadData(data); } return firm; }
public string GetLevelString(PatchLevel level) { switch (level) { case PatchLevel.random: return "?"; case PatchLevel.low: return "L"; case PatchLevel.medium: return "M"; case PatchLevel.high: return "H"; } return "X"; }
/// <summary> /// sets valus to patch defined by center [x,z] and patchSize /// randomValue = random value can be asigned to patch /// </summary> public void SetPatchValue(int x, int z, PatchLevel level, bool randomValue) { switch (level) { case PatchLevel.random: if (randomValue) { pm.SetValues(new Vertex(x * patchSize, z * patchSize), patchSize, 666, 666, 666); } else { SetPatchRandomLevel(x, z); } break; case PatchLevel.low: pm.SetValues(new Vertex(x * patchSize, z * patchSize), patchSize, low_rMin, low_rMax, low_noise, PatchLevel.low); break; case PatchLevel.medium: pm.SetValues(new Vertex(x * patchSize, z * patchSize), patchSize, medium_rMin, medium_rMax, medium_noise, PatchLevel.medium); break; case PatchLevel.high: pm.SetValues(new Vertex(x * patchSize, z * patchSize), patchSize, high_rMin, high_rMax, high_noise, PatchLevel.high); break; } }
public void SetPatchValue(int x, int z, PatchLevel level) { SetPatchValue(x, z, level, false); }
/// <summary> /// sets PatchLevel in |radius| distance from center /// </summary> public void SetPatchLevelInRadius(int radius, PatchLevel level) { for (int x = -radius; x <= radius; x++) SetPatchValue(x, radius, level); for (int x = -radius; x <= radius; x++) SetPatchValue(x, -radius, level); for (int z = -radius+1; z < radius; z++) SetPatchValue(radius, z, level); for (int z = -radius + 1; z < radius; z++) SetPatchValue(-radius, z, level); }
public PatchLevel GetNextLevel(PatchLevel level) { switch (level) { case PatchLevel.random: return PatchLevel.low; case PatchLevel.low: return PatchLevel.medium; case PatchLevel.medium: return PatchLevel.high; //case PatchLevel.high: // return PatchLevel.low; //for better user control case PatchLevel.high: return PatchLevel.random; } return PatchLevel.random; }
public void SetValues(Vertex center, int patchSize, float rMinV, float rMaxV, float noiseV, PatchLevel level) { switch (level) { case PatchLevel.random: patchLevel.SetValue(center.x, center.z, -1, true); break; case PatchLevel.low: //Debug.Log(center + ": LOW"); patchLevel.SetValue(center.x, center.z, 0, true); break; case PatchLevel.medium: //Debug.Log(center + ": MEDIUM"); patchLevel.SetValue(center.x, center.z, 1, true); break; case PatchLevel.high: //Debug.Log(center + ": HIGH"); patchLevel.SetValue(center.x, center.z, 2, true); break; } rMin.SetValue(center.x, center.z, rMinV); rMax.SetValue(center.x, center.z, rMaxV); noise.SetValue(center.x, center.z, noiseV); }