Beispiel #1
0
        bool Import(string[] aLine)
        {
            Console.WriteLine("Importing...");

            bool Result = true;

            for (int oLine = 0; oLine < aLine.Length && Result; ++oLine)
            {
                switch ((int)GetMode(aLine[oLine]))
                {
                case (int)eMode.None: {
                    break;
                }

                case (int)eMode.Error: {
                    Console.WriteLine($"!! Error !! : Syntax error");
                    Console.WriteLine($"Line {oLine+1}");
                    Result = false;
                    break;
                }

                case (int)eMode.Setting: {
                    if (TimbrePhase == Timbre.ePhase.None)
                    {
                        var Kind = Setting.eKind.Error;
                        if (mSetting.Import(out Kind, aLine[oLine], oLine))
                        {
                            switch ((int)Kind)
                            {
                            case (int)Setting.eKind.Error: {
                                Result = false;
                                break;
                            }

                            case (int)Setting.eKind.OCTAVE_UPDOWN:
                            case (int)Setting.eKind.VOLUME_UPDOWN: {
                                break;
                            }
                            }
                        }
                        else
                        {
                            Result = false;
                        }
                    }
                    else
                    {
                        Console.WriteLine($"!! Error !! : Syntax error");
                        Console.WriteLine($"Line {oLine+1}");
                        Result = false;
                    }
                    break;
                }

                case (int)eMode.Timbre: {
                    if (mTimbre.Import(out TimbrePhase, aLine[oLine], oLine))
                    {
                        switch ((int)TimbrePhase)
                        {
                        case (int)Timbre.ePhase.None: {
                            Result = false;
                            break;
                        }

                        case (int)Timbre.ePhase.Number:
                        case (int)Timbre.ePhase.FB:
                        case (int)Timbre.ePhase.OP1: {
                            break;
                        }

                        case (int)Timbre.ePhase.OP2: {
                            mDelivery.TimbreLibrary.Add(mTimbre.Params.Number, mTimbre);

                            TimbrePhase = Timbre.ePhase.None;
                            mTimbre     = new Timbre();
                            break;
                        }
                        }
                    }
                    else
                    {
                        Result = false;
                    }
                    break;
                }

                case (int)eMode.Macro: {
                    if (TimbrePhase == Timbre.ePhase.None)
                    {
                        var v = new Macro();
                        if (v.Import(aLine[oLine], oLine))
                        {
                            maMacro.Add(v);
                        }
                        else
                        {
                            Result = false;
                        }
                    }
                    else
                    {
                        Console.WriteLine($"!! Error !! : Syntax error");
                        Console.WriteLine($"Line {oLine+1}");
                        Result = false;
                    }
                    break;
                }

                case (int)eMode.Track: {
                    if (TimbrePhase == Timbre.ePhase.None)
                    {
                        var v = new Track();
                        if (v.Import(aLine[oLine], oLine))
                        {
                            Console.Write($"{v.Channel}");
                            maTrack.Add(v.Channel, v);
                        }
                        else
                        {
                            Result = false;
                        }
                    }
                    else
                    {
                        Console.WriteLine($"!! Error !! : Syntax error");
                        Console.WriteLine($"Line {oLine+1}");
                        Result = false;
                    }
                    break;
                }
                }
            }
            Console.WriteLine("");
            return(Result);
        }
        bool Import(string[] aLine)
        {
            Console.WriteLine("Importing...");

            bool Result = true;

            for (int oLine = 0; oLine < aLine.Length && Result; ++oLine)
            {
                switch ((int)GetMode(aLine[oLine]))
                {
                case (int)eMode.None: {
                    break;
                }

                case (int)eMode.Error: {
                    Console.WriteLine($"!! Error !! : Syntax error");
                    Console.WriteLine($"Line {oLine+1}");
                    Result = false;
                    break;
                }

                case (int)eMode.Setting: {
                    var Kind = Setting.eKind.Error;
                    if (mSetting.Import(out Kind, aLine[oLine], oLine))
                    {
                        switch ((int)Kind)
                        {
                        case (int)Setting.eKind.Error: {
                            Result = false;
                            break;
                        }

                        case (int)Setting.eKind.VOLUME_UPDOWN: {
                            break;
                        }
                        }
                    }
                    else
                    {
                        Result = false;
                    }
                    break;
                }

                case (int)eMode.Macro: {
                    var v = new Macro();
                    if (v.Import(aLine[oLine], oLine))
                    {
                        maMacro.Add(v);
                    }
                    else
                    {
                        Result = false;
                    }
                    break;
                }

                case (int)eMode.Track: {
                    var v = new Track();
                    if (v.Import(aLine[oLine], oLine))
                    {
                        Console.Write($"{v.Channel}");
                        maTrack.Add(v.Channel, v);
                    }
                    else
                    {
                        Result = false;
                    }
                    break;
                }
                }
            }
            Console.WriteLine("");
            return(Result);
        }