Example #1
0
        private void TryEraseGroupDataFiles(int idx, GroupData mData)
        {
            // Water Vapour and Other files can be erased without FalseColor
            // Erase Water Vapour LRIT
            if ((GenerateWaterVapour && mData.IsWaterVapourProcessed || !GenerateWaterVapour))
            {
                mData.WaterVapour.Segments.Select(x => x.Value).ToList().ForEach(f => {
                    try {
                        UIConsole.Debug($"Erasing file {f}");
                        File.Delete(f);
                    } catch (IOException e) {
                        UIConsole.Error($"Error erasing file {Path.GetFileName(f)}: {e}");
                    }
                });
                mData.WaterVapour.Segments.Clear();
            }

            // Erase Other Images LRIT
            mData.OtherData.Select(x => x.Value).ToList().ForEach(k => {
                if (!k.OK)
                {
                    return;
                }
                k.Segments.Select(x => x.Value).ToList().ForEach(f => {
                    try {
                        UIConsole.Debug($"Erasing file {f}");
                        File.Delete(f);
                    } catch (IOException e) {
                        UIConsole.Error($"Error erasing file {Path.GetFileName(f)}: {e}");
                    }
                });
                k.Segments.Clear();
            });

            // Do not erase files until false color is processed if required.
            if (GenerateFalseColor && !mData.IsFalseColorProcessed)
            {
                return;
            }

            // Erase Infrared LRIT
            if ((GenerateInfrared && mData.IsInfraredProcessed || !GenerateInfrared))
            {
                mData.Infrared.Segments.Select(x => x.Value).ToList().ForEach(f => {
                    try {
                        UIConsole.Debug($"Erasing file {f}");
                        File.Delete(f);
                    } catch (IOException e) {
                        UIConsole.Error($"Error erasing file {Path.GetFileName(f)}: {e}");
                    }
                });
                mData.Infrared.Segments.Clear();
            }

            // Erase Visible LRIT
            if ((GenerateVisible && mData.IsVisibleProcessed || !GenerateVisible))
            {
                mData.Visible.Segments.Select(x => x.Value).ToList().ForEach(f => {
                    try {
                        UIConsole.Debug($"Erasing file {f}");
                        File.Delete(f);
                    } catch (IOException e) {
                        UIConsole.Error($"Error erasing file {Path.GetFileName(f)}: {e}");
                    }
                });
                mData.Visible.Segments.Clear();
            }

            if (((!GenerateFalseColor || !mData.IsFalseColorProcessed) && GenerateFalseColor) ||
                ((!GenerateVisible || !mData.IsVisibleProcessed) && GenerateVisible) ||
                ((!GenerateInfrared || !mData.IsInfraredProcessed) && GenerateInfrared) ||
                ((!GenerateWaterVapour || !mData.IsWaterVapourProcessed) && GenerateWaterVapour) ||
                ((!GenerateOtherImages || !mData.IsOtherDataProcessed) && GenerateOtherImages) ||
                !mData.GroupTimeout)
            {
                return;
            }
            UIConsole.Debug($"Group Data {idx} is done. Removing it from Organizer.");
            organizer.RemoveGroupData(idx);
        }