static void Main(string[] args) { List <string> ptr = new List <string>(); AlphaNumbericCollector alphaCollector = new AlphaNumbericCollector(); StringCollector stringCollector = new StringCollector(); while (true) { ptr.Add(Console.ReadLine()); if (ptr[ptr.Count - 1] != null) { for (int i = 0; i < ptr[ptr.Count - 1].Length; i++) { if (ptr[ptr.Count - 1][i] >= 0x30 && ptr[ptr.Count - 1][i] <= 0x39) { AlphaOperation alpha_operation = alphaCollector.CollectingMethod; alpha_operation(ptr[ptr.Count - 1]); alphaCollector.Show(); break; } else if (i == ptr[ptr.Count - 1].Length - 1) { StringOperation string_operation = stringCollector.CollectingMethod; string_operation(ptr[ptr.Count - 1]); stringCollector.Show(); break; } } } else { ptr.Remove(ptr[ptr.Count - 1]); } } }
/// <summary>Reads a 256 color palette from a stream</summary> /// <param name="reader">The BinaryReader used for reading data in the stream</param> /// <param name="alphaOperation">The operation to apply on each palette entry's alpha component</param> /// <returns>An array of bytes containing the palette entries</returns> private ArgbColor[] ReadPalette(BinaryReader reader, AlphaOperation alphaOperation) { var palette = new ArgbColor[256]; for (int i = 0; i < palette.Length; i++) { byte b = reader.ReadByte(); byte g = reader.ReadByte(); byte r = reader.ReadByte(); byte a = reader.ReadByte(); palette[i] = new ArgbColor(r, g, b, alphaOperation != AlphaOperation.None ? alphaOperation == AlphaOperation.SetAlpha ? (byte)255 : (byte)~a : a); } return(palette); }
/// <summary> /// Returns a hash code. /// </summary> /// <returns> /// A hash code for this instance. /// </returns> public override int GetHashCode() { return(EnableBlending.GetHashCode() ^ SourceBlendColour.GetHashCode() ^ DestinationBlendColour.GetHashCode() ^ ColourOperation.GetHashCode() ^ SourceBlendAlpha.GetHashCode() ^ DestinationBlendAlpha.GetHashCode() ^ AlphaOperation.GetHashCode() ^ BlendConstant.GetHashCode()); }