Exemple #1
0
        static public void applySecMethod(Model model, ExcelFile excelFile, string methodChoice)
        {
            switch (methodChoice)
            {
            case "--GRAS":
                GRAS methodGRAS = new GRAS(1f, model, excelFile);
                methodGRAS.apply();
                break;

            case "--SPT":
                SPT methodSPT = new SPT(model, excelFile);
                methodSPT.apply();
                break;

            case "--LPT":
                LPT methodLPT = new LPT(model, excelFile);
                methodLPT.apply();
                break;

            case "--EDD":
                EDD methodEDD = new EDD(model, excelFile);
                methodEDD.apply();
                break;

            case "--CR":
                CR methodCR = new CR(model, excelFile);
                methodCR.apply();
                break;

            case "--SES":
                SES methodSES = new SES(model, excelFile);
                methodSES.apply();
                break;

            case "--SLACK":
                SES methodSLACK = new SES(model, excelFile);
                methodSLACK.apply();
                break;

            case "A":
                MyConsole.displayError("Aborting operation...\n");
                break;

            default:
            {
                MyConsole.displayError("Input invalid, applying GRAS anyway... \n");
                GRAS methodDefault = new GRAS(1f, model, excelFile);
                methodDefault.apply();
            }
            break;
            }
        }
Exemple #2
0
        public void ReadEDD(string path, List <string> sharedStrings = null)
        {
            // Read the given EDD. If shared strings is provided, we should dump our strings into it.
            edd   = EDD.Read(path);
            order = sharedStrings ?? new List <string>();
            // 1179 at the start. 1101 with builtin dedupe
            // return;
            List <string> s = new List <string>();

            foreach (MachineDesc machine in edd.Machines)
            {
                string m = Common.FormatMachine(machine.ID);
                addStr(m, machine.Name);
                for (int i = 0; i < machine.ParamNames.Length; i++)
                {
                    string text = machine.ParamNames[i];
                    if (text == null)
                    {
                        continue;
                    }
                    addStr($"{m}_p{i}", text);
                }
                foreach (StateDesc state in machine.States)
                {
                    addStr($"{m}_s{state.ID}", state.Name);
                    void WriteCommands(List <CommandDesc> cmds, string prefix)
                    {
                        for (int i = 0; i < cmds.Count; i++)
                        {
                            addStr($"{m}_s{state.ID}_{prefix}{i}", cmds[i].Name);
                        }
                    }

                    WriteCommands(state.EntryCommands, "e");
                    WriteCommands(state.ExitCommands, "x");
                    WriteCommands(state.WhileCommands, "w");
                    for (int i = 0; i < state.PassCommands.Count; i++)
                    {
                        WriteCommands(state.PassCommands[i].PassCommands, $"p{i}_");
                    }
                }
            }
        }
Exemple #3
0
 public static extern bool EnumDisplayDevices([Optional] string lpDevice, uint iDevNum, ref DISPLAY_DEVICE lpDisplayDevice, EDD dwFlags);
Exemple #4
0
        public void ReadTxt(string path, List <string> sharedStrings = null)
        {
            // Two cases: either a single .edd.txt file, or chunks to join together and rely on shared strings.
            bool strRef = sharedStrings != null;

            order = sharedStrings ?? new List <string>();
            if (strRef)
            {
                path = path.Replace(".edd.txt", "_part.edd.txt");
            }
            Dictionary <int, MachineDesc> machines = new Dictionary <int, MachineDesc>();

            foreach (string line in File.ReadLines(path))
            {
                if (line.Length == 0)
                {
                    continue;
                }
                string[] parts = line.Split(new[] { ' ' }, 2);
                if (parts.Length != 2 || !parts[0].EndsWith(":") || parts[1].StartsWith("#") != strRef)
                {
                    throw new Exception($"{path}: bad line: {line}");
                }
                string desc = parts[0].Substring(0, parts[0].Length - 1);
                if (strRef)
                {
                    locs[desc] = int.Parse(parts[1].Substring(1));
                }
                else
                {
                    addStr(desc, parts[1]);
                }
                string name = order[locs[desc]];
                parts = desc.Split('_');
                if (!Common.ParseMachine(parts[0], out int machineId))
                {
                    throw new Exception($"Bad machine id in {desc}");
                }
                if (!machines.TryGetValue(machineId, out MachineDesc machine))
                {
                    machine = machines[machineId] = new MachineDesc(machineId);
                }
                if (parts.Length == 1)
                {
                    machine.Name = name;
                }
                else
                {
                    int i = int.Parse(parts[1].Substring(1));
                    if (parts[1].StartsWith("p"))
                    {
                        machine.ParamNames[i] = name;
                    }
                    else if (parts[1].StartsWith("s"))
                    {
                        StateDesc state = machine.States.Find(s => s.ID == i);
                        if (state == null)
                        {
                            state = new StateDesc(i);
                            machine.States.Add(state);
                        }
                        if (parts.Length == 2)
                        {
                            state.Name = name;
                        }
                        else
                        {
                            // Ignore indices, add in order
                            if (parts[2].StartsWith("e"))
                            {
                                state.EntryCommands.Add(new CommandDesc(name));
                            }
                            else if (parts[2].StartsWith("x"))
                            {
                                state.ExitCommands.Add(new CommandDesc(name));
                            }
                            else if (parts[2].StartsWith("w"))
                            {
                                state.WhileCommands.Add(new CommandDesc(name));
                            }
                        }
                    }
                    else
                    {
                        throw new Exception(desc);
                    }
                }
            }
            edd          = new EDD();
            edd.Machines = machines.Values.ToList();
        }