Alexandria.Engines.UltimaUnderworld.Graphic.LoadRLE C# (CSharp) Метод

LoadRLE() приватный Метод

private LoadRLE ( int indices, BinaryReader reader, int width, int height, int codeSize, int aux = null, int auxOffset ) : void
indices int
reader System.IO.BinaryReader
width int
height int
codeSize int
aux int
auxOffset int
Результат void
        void LoadRLE(int[] indices, BinaryReader reader, int width, int height, int codeSize, int[] aux = null, int auxOffset = 0)
        {
            RLELoader loader = new RLELoader(reader, codeSize, aux, auxOffset);
            bool state = true;

            for (int offset = 0, end = width * height; offset < end; state = !state) {
                int count = loader.ReadCount();

                if (state) {
                    if (count == 2) {
                        int repeatCount = loader.ReadCount();
                        for (int repeatIndex = 0; repeatIndex < repeatCount; repeatIndex++) {
                            int runCount = loader.ReadCount();
                            int runValue = loader.ReadAux();

                            for (int runIndex = 0; runIndex < runCount; runIndex++)
                                indices[offset++] = runValue;
                        }
                    } else if (count > 1) {
                        int value = loader.ReadAux();
                        for (int index = 0; index < count; index++)
                            indices[offset++] = value;
                    }
                } else {
                    for (int index = 0; index < count; index++)
                        indices[offset++] = loader.ReadAux();
                }
            }
        }