Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            if (args.Length < 1)
            {
                Console.WriteLine("No args found, try -help argument for help");
                return;
            }
            foreach (string arg in args)
            {
                ArgsManager      argmng   = new ArgsManager();
                GetCmdReturnType foundArg = argmng.GetArg(arg);
                switch (foundArg.cmd)
                {
                case Cmd.createdefltprj:
                    Console.WriteLine("create and save default projec at: " + foundArg.value);
                    break;

                case Cmd.help:
                    Console.WriteLine("     -help:                 | get help");
                    Console.WriteLine("     -openprj[path]:        | to open a JSON project at path");
                    Console.WriteLine("     -createdefltprj[path]: | to create a default JSON project save to path");
                    break;

                case Cmd.openprj:
                    Console.WriteLine("loiefy_loader started");
                    Console.WriteLine("Opening project: " + foundArg.value);
                    Console.WriteLine(run_project(foundArg.value));
                    break;

                case Cmd.none:
                    Console.WriteLine("argument: " + arg + " not supported, try -help argument for help");
                    return;
                }
            }
        }
Ejemplo n.º 2
0
        public GetCmdReturnType GetArg(string arg)
        {
            GetCmdReturnType RetVal = new GetCmdReturnType();

            RetVal.cmd   = Cmd.none;
            RetVal.value = string.Empty;

            for (int Index = 0; Index < ArgsList.Count; Index++)
            {
                if (arg.Contains(ArgsList[Index]))
                {
                    RetVal.cmd = (Cmd)Index;
                    int StartIndex = arg.IndexOf(ArgsList[Index]);
                    StartIndex   = StartIndex + ArgsList[Index].Length;
                    RetVal.value = arg.Substring(StartIndex, arg.Length - StartIndex);
                    return(RetVal);
                }
            }
            return(RetVal);
        }