Exemplo n.º 1
0
        public EncodeQueryResult getResult()
        {
            EncodeQueryResult result = new EncodeQueryResult();

            result.layers = new List <LayerInformation>();

            foreach (Panel panel in layerContainerPanels)
            {
                addLayerToListIfNotNull(ref result.layers, panel);
            }

            return(result);
        }
        private bool encodeLSBBMP()
        {
            bool result = false;

            BmpFileHeaders bmpFileHeaders = FileFormatHelpers.readBmpFileHeaders(this.fileBytes);

            LSBEncodeDialog lSBEncodeDialog = new LSBEncodeDialog();

            if (lSBEncodeDialog.ShowDialog() == true)
            {
                EncodeQueryResult encodeQueryResult = lSBEncodeDialog.getResult();

                byte[] sourceByteArray = FileFormatHelpers.convertLayerToByteArray(encodeQueryResult.layers[encodeQueryResult.layers.Count - 1]);

                for (int index = (encodeQueryResult.layers.Count - 1); index >= 0; index--)
                {
                    if (index == 0)
                    {
                        FileFormatHelpers.encodeDataIntoFileBytesBmp(
                            ref bmpFileHeaders,
                            ref sourceByteArray,
                            ref this.fileBytes
                            );
                    }
                    else
                    {
                        LayerInformation layerTargetInformation = encodeQueryResult.layers[index - 1];
                        sourceByteArray = FileFormatHelpers.encodeDataIntoLayersFileBytes(
                            ref sourceByteArray,
                            layerTargetInformation
                            );
                    }

                    encodeQueryResult.layers.RemoveAt(index);
                }

                result = true;
            }

            return(result);
        }