Exemplo n.º 1
0
        private static PlayerArgs ParseArgs(string[] args)
        {
            PlayerArgs sArgs = new PlayerArgs();

            Dictionary<string, bool> dict = new Dictionary<string, bool>();
            foreach (string s in args)
            {
                dict.Add(s.ToUpper(), true);
            }

            if( dict.ContainsKey("-LRC") )
            {
                sArgs.needLRC = true;
            }

            if( dict.ContainsKey("-AL") )
            {
                sArgs.commandTypeAddToList = true;
            }
            if( dict.ContainsKey("-D") )
            {
                sArgs.addDir = true;
            }

            if( dict.ContainsKey("-DL") )
            {
                sArgs.commandTypeDeleteList = true;
            }

            if( dict.ContainsKey("-ML"))
            {
                if (args.Length == 3)
                {
                    sArgs.commandTypeModifyList = true;
                    sArgs.modifyIndex = UInt32.Parse(args[1]);
                }
            }

            if( dict.ContainsKey("-L"))
            {
                sArgs.commandTypeList = true;
            }

            if(dict.ContainsKey("-RL"))
            {
                if( args.Length == 2 )
                {
                    sArgs.commandTypeRmFrmList = true;
                    sArgs.modifyIndex = UInt32.Parse(args[1]);
                }

            }

            if( dict.ContainsKey("-P"))
            {
                sArgs.commandTypePlay = true;
            }

            if( dict.ContainsKey("-PL"))
            {
                sArgs.commandTypePlayList = true;
            }

            if( dict.ContainsKey("-I") )
            {
                if( dict.ContainsKey("-S") )
                    sArgs.commandTypeAddSupport = true;
                else
                    sArgs.commandTypeAddExtension = true;
            }

            if( dict.ContainsKey("-U") )
            {
                if( dict.ContainsKey("-S") )
                    sArgs.commandTypeDelSupport = true;
                else
                    sArgs.commandTypeDelExtension = true;
            }

            if( args.Length == 0 ||(args.Length == 1 && dict.ContainsKey("-LRC")))
            {
                sArgs.commandTypePlayList = true;
            }
            else
            {
                if( sArgs.commandTypePlay || sArgs.commandTypeAddToList ||
                    sArgs.commandTypeRmFrmList || sArgs.commandTypeModifyList ||
                    sArgs.commandTypeAddExtension || sArgs.commandTypeDelExtension ||
                    sArgs.commandTypeAddSupport || sArgs.commandTypeDelSupport )
                {
                    sArgs.destFile = args[args.Length - 1];
                }

                if( args.Length == 1 && !sArgs.commandTypeList &&
                    !sArgs.commandTypeDeleteList && !sArgs.commandTypePlayList)
                {
                    sArgs.commandTypePlay = true;
                    sArgs.destFile = args[args.Length - 1];
                }

                if( sArgs.needLRC && !sArgs.commandTypePlayList )
                {
                    sArgs.commandTypePlay = true;
                    sArgs.destFile = args[args.Length - 1];
                }
            }

            return sArgs;
        }
Exemplo n.º 2
0
 public CommandPlayList(PlayerArgs args)
 {
     _args = args;
 }
Exemplo n.º 3
0
        public void Action()
        {
            bool result = false;
            KeyValuePair<int, string> tmp = new KeyValuePair<int, string>();
            int count = ListManager.Instance.GetCount();
            for (current = 0; current < count; current++)
            {

                result = ListManager.Instance.GetAt(current, out tmp);
                if (!result)
                    break;
                string fileName = tmp.Value;
                PlayerArgs singleArgs = new PlayerArgs();
                singleArgs.commandTypePlay = true;
                singleArgs.destFile = fileName;
                CommandPlay player = new CommandPlay(singleArgs);
                player.Action();
                if (previous)
                {
                    current -= 2;
                    if (current < -1)
                        current = -1;
                    previous = false;
                }
            }
        }
Exemplo n.º 4
0
 public CommandDelSupport(PlayerArgs args)
 {
     _args = args;
 }
Exemplo n.º 5
0
 public CommandPlay(PlayerArgs sArgs)
 {
     _args = sArgs;
     this.fileName = sArgs.destFile;
     player = new PlayerCore(fileName);
     Extensions.Instance.NotifyConnection(player);
 }
Exemplo n.º 6
0
 public CommandDelExtension(PlayerArgs args)
 {
     _args = args;
 }
Exemplo n.º 7
0
 public CommandAddToList(PlayerArgs args)
 {
     _args = args;
 }
Exemplo n.º 8
0
 public CommandRmFrmList(PlayerArgs args)
 {
     _args = args;
 }
Exemplo n.º 9
0
 public CommandModifyList(PlayerArgs args)
 {
     _args = args;
 }
Exemplo n.º 10
0
 public CommandDeleteList(PlayerArgs args)
 {
     _args = args;
 }