Ejemplo n.º 1
0
        public static void Main(string[] args)
        {
            AppCore Core = new AppCore();

            AppCoreSat[] AppCoreSat_ = new AppCoreSat[5];
            AppCoreNo    AppCoreNo_  = Core.AppCoreNo_;

            AppCoreSat_[0] = null;
            AppCoreSat_[1] = Core.CoreKingOfSat;
            AppCoreSat_[2] = Core.CoreLyngSat;
            AppCoreSat_[3] = Core.CoreFlySat;
            AppCoreSat_[4] = Core.CoreSatBeams;
            AppCoreSat_[1].SetListFields(Core.ListTransFields, Core.ListChanFields);
            AppCoreSat_[2].SetListFields(Core.ListTransFields, Core.ListChanFields);
            AppCoreSat_[3].SetListFields(Core.ListTransFields, Core.ListChanFields);
            AppCoreSat_[4].SetListFields(Core.ListTransFields, Core.ListChanFields);

            bool Work    = true;
            bool CmdInfo = true;

            while (Work)
            {
                if (CmdInfo)
                {
                    Info(Core);
                }
                CmdInfo = false;
                string Cmd = (Core.AutoCommand != "") ? Core.AutoCommand : Console.ReadLine();
                if (Core.AutoCommand != "")
                {
                    Core.AutoCommand = "EXIT";
                }

                Cmd = Cmd.Trim();
                while (Cmd != Cmd.Replace("  ", " "))
                {
                    Cmd = Cmd.Replace("  ", " ");
                }
                string[] CmdX    = Cmd.Split(' ');
                bool     GoodCmd = false;
                if (CmdX.Length == 1)
                {
                    switch (CmdX[0].ToUpperInvariant())
                    {
                    case "ENIGMASORT":
                    {
                        Core.Enigma_.DatabaseLoad(Core.EnigmaPath + Core.EnigmaDatabase);
                        for (int i = 0; i < Core.SatName.Count; i++)
                        {
                            if (Core.SatSelected[i])
                            {
                                Console.Write("Sorting " + i.ToString() + "...");
                                Core.Enigma_.DatabaseSetInclude(Core.Enigma_.EnigmaConfig_[i].SatId.Split(':'));
                                if (Core.Enigma_.EnigmaConfig_[i].BouquetT != "")
                                {
                                    Core.Enigma_.BouquetLoad(Core.EnigmaPath + Core.Enigma_.EnigmaConfig_[i].BouquetT, true);
                                    Core.Enigma_.BouquetSort();
                                    Core.Enigma_.BouquetSave();
                                }
                                if (Core.Enigma_.EnigmaConfig_[i].BouquetR != "")
                                {
                                    Core.Enigma_.BouquetLoad(Core.EnigmaPath + Core.Enigma_.EnigmaConfig_[i].BouquetR, true);
                                    Core.Enigma_.BouquetSort();
                                    Core.Enigma_.BouquetSave();
                                }
                                Console.WriteLine("OK");
                            }
                        }
                        GoodCmd = true;
                    }
                    break;

                    case "INFO":
                        GoodCmd = true;
                        CmdInfo = true;
                        break;

                    case "FTA":
                        Core.FTA = !Core.FTA;
                        GoodCmd  = true;
                        CmdInfo  = true;
                        break;

                    case "TRANSCH":
                        Core.TransCh = !Core.TransCh;
                        GoodCmd      = true;
                        break;

                    case "EXIT":
                        Work    = false;
                        GoodCmd = true;
                        break;
                    }
                }
                if (CmdX.Length == 2)
                {
                    int CmdNum = AppCoreSat.ToInt(CmdX[1]);
                    switch (CmdX[0].ToUpperInvariant())
                    {
                    case "SELECT":
                        if ((CmdNum >= 0) && (CmdNum < Core.SatSelected.Count))
                        {
                            Core.SatSelected[CmdNum] = !Core.SatSelected[CmdNum];
                            GoodCmd = true;
                            CmdInfo = true;
                        }
                        break;

                    case "BAND":
                        if (CmdNum == 1)
                        {
                            Core.Band1 = !Core.Band1;
                            GoodCmd    = true;
                            CmdInfo    = true;
                        }
                        if (CmdNum == 2)
                        {
                            Core.Band2 = !Core.Band2;
                            GoodCmd    = true;
                            CmdInfo    = true;
                        }
                        if (CmdNum == 3)
                        {
                            Core.Band3 = !Core.Band3;
                            GoodCmd    = true;
                            CmdInfo    = true;
                        }
                        break;

                    case "TYPE":
                        string ChT = CmdX[1].ToUpperInvariant();
                        switch (ChT)
                        {
                        case "R": Core.ChanFilter1 = !Core.ChanFilter1; GoodCmd = true; CmdInfo = true; break;

                        case "TV": Core.ChanFilter2 = !Core.ChanFilter2; GoodCmd = true; CmdInfo = true; break;

                        case "IMG": Core.ChanFilter3 = !Core.ChanFilter3; GoodCmd = true; CmdInfo = true; break;

                        case "DATA": Core.ChanFilter4 = !Core.ChanFilter4; GoodCmd = true; CmdInfo = true; break;
                        }
                        Info(Core);
                        break;

                    case "ENIGMALIST":
                        if ((CmdNum >= 1) && (CmdNum < AppCoreSat_.Length))
                        {
                            Core.Enigma_.DatabaseLoad(Core.EnigmaPath + Core.EnigmaDatabase);
                            for (int i = 0; i < Core.SatName.Count; i++)
                            {
                                if (Core.SatSelected[i])
                                {
                                    Console.WriteLine("Creating bouquet " + i.ToString() + ":");
                                    Core.Enigma_.DatabaseSetInclude(Core.Enigma_.EnigmaConfig_[i].SatId.Split(':'));
                                    if (Core.Enigma_.EnigmaConfig_[i].BouquetT != "")
                                    {
                                        Console.Write(" TV...");
                                        Core.Enigma_.BouquetLoad(Core.EnigmaPath + Core.Enigma_.EnigmaConfig_[i].BouquetT, false);
                                        if (Core.Enigma_.BouquetCreateFromList(AppCoreSat_[CmdNum].ChanListFileName(i), false, true, true, false))
                                        {
                                            Core.Enigma_.BouquetSort();
                                            Core.Enigma_.BouquetSave();
                                            Console.WriteLine("OK");
                                        }
                                        else
                                        {
                                            Console.WriteLine("File not created");
                                        }
                                    }
                                    if (Core.Enigma_.EnigmaConfig_[i].BouquetR != "")
                                    {
                                        Console.Write(" R...");
                                        Core.Enigma_.BouquetLoad(Core.EnigmaPath + Core.Enigma_.EnigmaConfig_[i].BouquetR, false);
                                        if (Core.Enigma_.BouquetCreateFromList(AppCoreSat_[CmdNum].ChanListFileName(i), true, false, false, false))
                                        {
                                            Core.Enigma_.BouquetSort();
                                            Core.Enigma_.BouquetSave();
                                            Console.WriteLine("OK");
                                        }
                                        else
                                        {
                                            Console.WriteLine("File not created");
                                        }
                                    }
                                }
                            }
                            GoodCmd = true;
                        }
                        break;

                    case "DOWNLOAD":
                        if ((CmdNum >= 1) && (CmdNum < AppCoreSat_.Length))
                        {
                            for (int i = 0; i < Core.SatName.Count; i++)
                            {
                                if (Core.SatSelected[i])
                                {
                                    Console.Write("Downloading " + i.ToString() + "...");
                                    AppCoreSat_[CmdNum].Download(i);
                                    Console.WriteLine("OK");
                                }
                            }
                            GoodCmd = true;
                        }
                        break;

                    case "PARSE":
                        if ((CmdNum >= 1) && (CmdNum < AppCoreSat_.Length))
                        {
                            for (int i = 0; i < Core.SatName.Count; i++)
                            {
                                if (Core.SatSelected[i])
                                {
                                    Console.Write("Parsing " + i.ToString() + "...");
                                    AppCoreSat_[CmdNum].Parse(i, true);
                                    Console.WriteLine("OK");
                                }
                            }
                            GoodCmd = true;
                        }
                        break;

                    case "LIST":
                        if ((CmdNum >= 1) && (CmdNum < AppCoreSat_.Length))
                        {
                            for (int i = 0; i < Core.SatName.Count; i++)
                            {
                                if (Core.SatSelected[i])
                                {
                                    Console.Write("Creating lists " + i.ToString() + "...");
                                    string ChanFilter = "|";
                                    if (Core.ChanFilter1)
                                    {
                                        ChanFilter += "R|";
                                    }
                                    if (Core.ChanFilter2)
                                    {
                                        ChanFilter += "TV|";
                                    }
                                    if (Core.ChanFilter3)
                                    {
                                        ChanFilter += "IMG|";
                                    }
                                    if (Core.ChanFilter4)
                                    {
                                        ChanFilter += "DATA|";
                                    }
                                    AppCoreSat_[CmdNum].CreateList(i, Core.FTA, Core.TransCh, ChanFilter, Core.Band1, Core.Band2, Core.Band3);
                                    Console.WriteLine("OK");
                                }
                            }
                            GoodCmd = true;
                        }
                        break;

                    case "TRANSIMG":
                        if ((CmdNum >= 1) && (CmdNum < AppCoreSat_.Length))
                        {
                            AppCoreSat_[CmdNum].CreateTransBitmap(Core.SatSelected, Core.Band1, Core.Band2, Core.Band3);
                            GoodCmd = true;
                        }
                        break;

                    case "TRANSNO":
                    {
                        AppCoreNo_.TransNo(CmdX[1], Core.SatSelected);
                        GoodCmd = true;
                    }
                    break;

                    case "CHANNO":
                    {
                        AppCoreNo_.ChanNo(CmdX[1], Core.SatSelected);
                        GoodCmd = true;
                    }
                    break;
                    }
                }
                if (!GoodCmd)
                {
                    Help();
                }
                else
                {
                    Console.WriteLine();
                }
            }
        }
Ejemplo n.º 2
0
        public AppCore()
        {
            Enigma_ = new Enigma();

            CoreKingOfSat = new AppCoreSat_1KingOfSat();
            CoreLyngSat   = new AppCoreSat_2LyngSat2();
            CoreFlySat    = new AppCoreSat_3FlySat();
            CoreSatBeams  = new AppCoreSat_4SatBeams();
            AppCoreNo_    = new AppCoreNo();
            ConfigFile CF = new ConfigFile();

            CF.FileLoad(ApplicationDirectory() + "Config.txt");

            CF.ParamGet("SetBand1", ref Band1);
            CF.ParamGet("SetBand2", ref Band2);
            CF.ParamGet("SetBand3", ref Band3);

            CF.ParamGet("SetTypeR", ref ChanFilter1);
            CF.ParamGet("SetTypeTV", ref ChanFilter2);
            CF.ParamGet("SetTypeIMG", ref ChanFilter3);
            CF.ParamGet("SetTypeDATA", ref ChanFilter4);

            CF.ParamGet("SetFTA", ref FTA);
            CF.ParamGet("SetTransWithChan", ref TransCh);

            CF.ParamGet("DataPath", ref DataPath);
            CF.ParamGet("EnigmaPath", ref EnigmaPath);
            CF.ParamGet("EnigmaDatabase", ref EnigmaDatabase);
            CF.ParamGet("EnigmaFrequency", ref Enigma_.TransFrequencyDelta);
            CF.ParamGet("AutoCommand", ref AutoCommand);

            if (DataPath.Length > 0)
            {
                if (!DataPath.EndsWith(Path.DirectorySeparatorChar.ToString()))
                {
                    DataPath = DataPath + Path.DirectorySeparatorChar;
                }
            }
            if (EnigmaPath.Length > 0)
            {
                if (!EnigmaPath.EndsWith(Path.DirectorySeparatorChar.ToString()))
                {
                    EnigmaPath = EnigmaPath + Path.DirectorySeparatorChar;
                }
            }

            CoreKingOfSat.TempDir = DataPath + "Data1" + Path.DirectorySeparatorChar;
            CoreLyngSat.TempDir   = DataPath + "Data2" + Path.DirectorySeparatorChar;
            CoreFlySat.TempDir    = DataPath + "Data3" + Path.DirectorySeparatorChar;
            CoreSatBeams.TempDir  = DataPath + "Data4" + Path.DirectorySeparatorChar;
            AppCoreNo_.TempDir    = DataPath;

            ListTransFields = CF.ParamGetS("SetTransFields").Split('|');
            ListChanFields  = CF.ParamGetS("SetChanFields").Split('|');

            AppCoreNo_.TransNoFields = CF.ParamGetS("SetTransNoListFields").Split('|');
            AppCoreNo_.TransNoMode   = CF.ParamGetS("SetTransNoListMode").Split('|');
            AppCoreNo_.ChanNoFields  = CF.ParamGetS("SetChanNoListFields").Split('|');
            AppCoreNo_.ChanNoMode    = CF.ParamGetS("SetChanNoListMode").Split('|');

            SatCount = 0;
            while (CF.ParamGetS("Sat" + SatCount.ToString() + "Name") != "")
            {
                SatCount++;
            }
            int  SpanCount;
            bool SpanCountWork;

            for (int i = 0; i < SatCount; i++)
            {
                SatName.Add(CF.ParamGetS("Sat" + i.ToString() + "Name"));
                SatSelected.Add(CF.ParamGetB("Sat" + i.ToString() + "Selected"));
                CoreKingOfSat.SatAddr.Add(CF.ParamGetS("Sat" + i.ToString() + "KingOfSat"));
                CoreLyngSat.SatAddr.Add(CF.ParamGetS("Sat" + i.ToString() + "LyngSat"));
                CoreFlySat.SatAddr.Add(CF.ParamGetS("Sat" + i.ToString() + "FlySat"));
                CoreSatBeams.SatAddr.Add(CF.ParamGetS("Sat" + i.ToString() + "SatBeams"));
                CoreLyngSat.SpanChange.Add(new Dictionary <int, int>());
                CoreFlySat.SpanChange.Add(new Dictionary <int, int>());

                string E1 = CF.ParamGetS("Sat" + i.ToString() + "EnigmaId");
                string E2 = CF.ParamGetS("Sat" + i.ToString() + "EnigmaBouquetTv");
                string E3 = CF.ParamGetS("Sat" + i.ToString() + "EnigmaBouquetRadio");
                Enigma_.EnigmaConfig_.Add(new Enigma.EnigmaConfig(E1, E2, E3));

                SpanCountWork = true;
                SpanCount     = 0;
                while (SpanCountWork)
                {
                    int XRow = CF.ParamGetI("Sat" + i.ToString() + "LyngSatRowSpan" + SpanCount.ToString() + "Row", -1);
                    int XVal = CF.ParamGetI("Sat" + i.ToString() + "LyngSatRowSpan" + SpanCount.ToString() + "Val", 0);
                    if (XRow >= 0)
                    {
                        CoreLyngSat.SpanChange[i].Add(XRow, XVal);
                        SpanCount++;
                    }
                    else
                    {
                        SpanCountWork = false;
                    }
                }

                SpanCountWork = true;
                SpanCount     = 0;
                while (SpanCountWork)
                {
                    int XRow = CF.ParamGetI("Sat" + i.ToString() + "FlySatRowSpan" + SpanCount.ToString() + "Row", -1);
                    int XVal = CF.ParamGetI("Sat" + i.ToString() + "FlySatRowSpan" + SpanCount.ToString() + "Val", 0);
                    if (XRow >= 0)
                    {
                        CoreFlySat.SpanChange[i].Add(XRow, XVal);
                        SpanCount++;
                    }
                    else
                    {
                        SpanCountWork = false;
                    }
                }
            }
        }