Exemple #1
0
        public static bool Run(string[] args)
        {
            try
            {
                EcuMapTool prog = new EcuMapTool();

                if (args.Length < 1 || args[0].EqualsCI("-h") || args[0].EqualsCI("-help"))
                {
                    WriteHelp();
                }
                else if (args[0].ContainsCI(".h"))
                {
                    prog.ReadHeader(args[0]);
                    if (args.Length < 2) //no idc filename specified, use header name
                    {
                        prog.WriteIDC(Regex.Split(args[0], ".h")[0] + ".idc");
                    }
                    else if (args[1].ContainsCI(".idc"))
                    {
                        prog.WriteIDC(args[1]);
                    }
                    else
                    {
                        WriteHelp();
                    }
                }
                else if (args[0].ContainsCI(".map"))
                {
                    prog.MapToDefines(args[0]);
                    if (args.Length < 2) //no filename specified
                    {
                        prog.WriteIDC(Regex.Split(args[0], ".map")[0] + ".idc");
                    }
                    else if (args[1].ContainsCI(".idc"))
                    {
                        prog.WriteIDC(args[1]);
                    }
                    else
                    {
                        WriteHelp();
                    }
                }
                else if (args[0].ContainsCI(".xml") && args[1].ContainsCI(".map") && args[2].ContainsCI(".h") && args[3].ContainsCI(".txt") && args.Length == 6)
                {
                    prog.UpdateTargetHeader(args[0], args[1], args[2], args[3], args[4], args[5]);
                }
                else
                {
                    WriteHelp();
                }
                return(true); //TODO FIX!!
            }
            catch (Exception e)
            {
                Trace.WriteLine(e.Message);
                return(false);
            }
        }
Exemple #2
0
        public static bool Run(AvailableDevices ad, string[] args)
        {
            try
            {

                EcuMapTool prog = new EcuMapTool(ad);//TODO: get rid of static?

                if (args.Length < 1 || args[0].EqualsCI("-h") || args[0].EqualsCI("-help"))
                {
                    WriteHelp();
                }
                else if (args[0].ContainsCI(".h"))
                {
                    prog.ReadHeader(args[0]);
                    if (args.Length < 2) //no idc filename specified, use header name
                        prog.WriteIDC(Regex.Split(args[0], ".h")[0] + ".idc");
                    else if (args[1].ContainsCI(".idc"))
                        prog.WriteIDC(args[1]);
                    else
                        WriteHelp();
                }
                else if (args[0].ContainsCI(".map"))
                {
                    prog.MapToDefines(args[0]);
                    if (args.Length < 2) //no filename specified
                        prog.WriteIDC(Regex.Split(args[0], ".map")[0] + ".idc");
                    else if (args[1].ContainsCI(".idc"))
                        prog.WriteIDC(args[1]);
                    else
                        WriteHelp();
                }
                else if (args[0].ContainsCI(".xml") && args[1].ContainsCI(".map") && args[2].ContainsCI(".h") && args[3].ContainsCI(".txt") && args.Length == 6)
                {
                    prog.UpdateTargetHeader(args[0], args[1], args[2], args[3], args[4], args[5], null);
                }
                else if (args[0].ContainsCI(".xml") && args[1].ContainsCI(".map") && args[2].ContainsCI(".h") && args[3].ContainsCI(".txt") && args.Length == 7)
                {
                    prog.UpdateTargetHeader(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
                }
                else
                    WriteHelp();
                return true; //TODO FIX!!
            }
            catch (Exception e)
            {
                Trace.WriteLine(e.Message);
                return false;
            }
        }