private static CustomVinylTrans convertAaronVinylToXML(AaronPresetCarVinyl aaronPresetCarVinyl) { CustomVinylTrans customVinylTrans = new CustomVinylTrans(); customVinylTrans.Hash = unchecked ((int)aaronPresetCarVinyl.Hash); customVinylTrans.Hue1 = unchecked ((int)aaronPresetCarVinyl.Hues[0].Hue); customVinylTrans.Hue2 = unchecked ((int)aaronPresetCarVinyl.Hues[1].Hue); customVinylTrans.Hue3 = unchecked ((int)aaronPresetCarVinyl.Hues[2].Hue); customVinylTrans.Hue4 = unchecked ((int)aaronPresetCarVinyl.Hues[3].Hue); customVinylTrans.Sat1 = aaronPresetCarVinyl.Hues[0].Saturation; customVinylTrans.Sat2 = aaronPresetCarVinyl.Hues[1].Saturation; customVinylTrans.Sat3 = aaronPresetCarVinyl.Hues[2].Saturation; customVinylTrans.Sat4 = aaronPresetCarVinyl.Hues[3].Saturation; customVinylTrans.Var1 = aaronPresetCarVinyl.Hues[0].Variance; customVinylTrans.Var2 = aaronPresetCarVinyl.Hues[1].Variance; customVinylTrans.Var3 = aaronPresetCarVinyl.Hues[2].Variance; customVinylTrans.Var4 = aaronPresetCarVinyl.Hues[3].Variance; customVinylTrans.Shear = aaronPresetCarVinyl.Shear; customVinylTrans.Rot = aaronPresetCarVinyl.Rotation; customVinylTrans.Mir = aaronPresetCarVinyl.IsMirrored; customVinylTrans.ScaleX = aaronPresetCarVinyl.ScaleX; customVinylTrans.ScaleY = aaronPresetCarVinyl.ScaleY; customVinylTrans.TranX = aaronPresetCarVinyl.TranX; customVinylTrans.TranY = aaronPresetCarVinyl.TranY; return(customVinylTrans); }
private static AaronPresetCarVinyl convertFeVinylToAaronVinyl(FEPresetVinyl fePresetVinyl) { AaronPresetCarVinyl vinyl = new AaronPresetCarVinyl(); vinyl.Shear = (byte)(fePresetVinyl.Shear / 2); vinyl.Hash = unchecked ((uint)fePresetVinyl.Hash); vinyl.IsMirrored = fePresetVinyl.IsMirrored; vinyl.Rotation = fePresetVinyl.Rotation; vinyl.ScaleX = fePresetVinyl.ScaleX; vinyl.ScaleY = fePresetVinyl.ScaleY; vinyl.TranX = fePresetVinyl.TranX; vinyl.TranY = fePresetVinyl.TranY; vinyl.Hues = new AaronPresetCarVinylHue[fePresetVinyl.Hues.Length]; for (var index = 0; index < fePresetVinyl.Hues.Length; index++) { var fePresetVinylHue = fePresetVinyl.Hues[index]; vinyl.Hues[index] = new AaronPresetCarVinylHue(); vinyl.Hues[index].Hue = unchecked ((uint)fePresetVinylHue.Hue); vinyl.Hues[index].Saturation = fePresetVinylHue.Saturation; vinyl.Hues[index].Variance = fePresetVinylHue.Variance; } return(vinyl); }
private static FEPresetVinyl convertAaronVinylToFE(AaronPresetCarVinyl aaronPresetCarVinyl) { FEPresetVinyl fePresetVinyl = new FEPresetVinyl(); fePresetVinyl.Hash = unchecked ((int)aaronPresetCarVinyl.Hash); fePresetVinyl.Hues = new FEPresetVinylHue[4]; fePresetVinyl.IsMirrored = aaronPresetCarVinyl.IsMirrored; fePresetVinyl.Rotation = aaronPresetCarVinyl.Rotation; if (aaronPresetCarVinyl.Shear * 2 > byte.MaxValue) { throw new InvalidDataException("invalid shear"); } fePresetVinyl.Shear = (byte)(aaronPresetCarVinyl.Shear * 2); fePresetVinyl.ScaleX = aaronPresetCarVinyl.ScaleX; fePresetVinyl.ScaleY = aaronPresetCarVinyl.ScaleY; fePresetVinyl.TranX = aaronPresetCarVinyl.TranX; fePresetVinyl.TranY = aaronPresetCarVinyl.TranY; fePresetVinyl.Hues[0] = new FEPresetVinylHue(); fePresetVinyl.Hues[1] = new FEPresetVinylHue(); fePresetVinyl.Hues[2] = new FEPresetVinylHue(); fePresetVinyl.Hues[3] = new FEPresetVinylHue(); for (int i = 0; i < 4; i++) { fePresetVinyl.Hues[i] = new FEPresetVinylHue(); if (aaronPresetCarVinyl.Hues[i] != null) { fePresetVinyl.Hues[i].Hue = unchecked ((int)aaronPresetCarVinyl.Hues[i].Hue); fePresetVinyl.Hues[i].Saturation = aaronPresetCarVinyl.Hues[i].Saturation; fePresetVinyl.Hues[i].Variance = aaronPresetCarVinyl.Hues[i].Variance; } } return(fePresetVinyl); }