예제 #1
0
        public static List<GroupSetting> load(string pathname)
        {
            List<GroupSetting> groups = new List<GroupSetting>();
            try
            {
                XmlReader reader = XmlReader.Create(pathname);
                GroupSetting tempGroup = new GroupSetting();
                MonitorSetting tempMonitor = new MonitorSetting("temp");
                while (reader.Read())
                {
                    if (reader.IsStartElement())
                    {
                        switch (reader.Name)
                        {
                            case "Group":
                                tempGroup = new GroupSetting();
                                break;
                            case "Name":
                                reader.Read();
                                tempGroup.groupName = reader.Value.Trim();
                            break;
                        case "Type":
                            reader.Read();
                            tempGroup.ssType = reader.Value.Trim();
                                break;
                            case "isActive":
                                reader.Read();
                                tempGroup.isActive = bool.Parse(reader.Value.Trim());
                                break;
                            case "MazeSize":
                                reader.Read();
                                tempGroup.mazeSize = int.Parse(reader.Value);
                                break;
                            case "Pallet":
                                reader.Read();
                                tempGroup.mazePalletName = reader.Value.Trim();
                                break;
                            case "Monitor":
                                reader.Read();
                                if (reader.Name == "ID")
                                {
                                    reader.Read();
                                    tempMonitor = new MonitorSetting(reader.Value.Trim());
                                }
                                else
                                {
                                    throw new Exception("No Monitor ID");
                                }
                                break;
                            case "Album":
                                reader.Read();
                                tempMonitor.albumLocation = reader.Value.Trim();
                                break;
                            case "PictureOrder":
                                reader.Read();
                                tempMonitor.order = reader.Value.Trim();
                                break;
                            case "transitionType":
                                reader.Read();
                                tempMonitor.transitionType = reader.Value.Trim();
                                break;
                            case "FadeTime":
                                reader.Read();
                                tempMonitor.fadeTime = int.Parse(reader.Value.Trim());
                                break;
                            case "DisplayTime":
                                reader.Read();
                                tempMonitor.displayTime = int.Parse(reader.Value.Trim());
                                break;
                            case "PanTime":
                                reader.Read();
                                tempMonitor.panTime = int.Parse(reader.Value.Trim());
                                break;
                            case "PanDirIn":
                                reader.Read();
                                tempMonitor.dirIn = int.Parse(reader.Value.Trim());
                                break;
                            case "PanDirOut":
                                reader.Read();
                                tempMonitor.dirOut = int.Parse(reader.Value.Trim());
                                break;
                            case "IsClockwise":
                                reader.Read();
                                tempMonitor.clockwise = bool.Parse(reader.Value.Trim());
                                break;
                            case "NumRotations":
                                reader.Read();
                                tempMonitor.numRotations = int.Parse(reader.Value.Trim());
                                break;
                            case "AIView":
                                reader.Read();
                                tempMonitor.aiView = reader.Value.Trim();
                                break;
                            case "AIMethod":
                                reader.Read();
                                tempMonitor.aiMethod = reader.Value.Trim();
                                break;

                        }

                    }
                    else if (reader.MoveToContent().Equals(XmlNodeType.EndElement) && reader.Name == "Monitor")
                    {
                        tempGroup.addMonitor(tempMonitor);
                    }
                    else if (reader.MoveToContent() == XmlNodeType.EndElement && reader.Name == "Group")
                    {
                        groups.Add(tempGroup);
                    }

                }
            }

            catch (FileNotFoundException) { }
            return groups;
        }
예제 #2
0
 public void addMonitor(MonitorSetting ms)
 {
     monitors.Add(ms);
 }
예제 #3
0
        public static List <GroupSetting> load(string pathname)
        {
            XmlReader           reader      = XmlReader.Create(pathname);
            List <GroupSetting> groups      = new List <GroupSetting>();
            GroupSetting        tempGroup   = new GroupSetting();
            MonitorSetting      tempMonitor = new MonitorSetting("temp");

            while (reader.Read())
            {
                if (reader.IsStartElement())
                {
                    switch (reader.Name)
                    {
                    case "Group":
                        tempGroup = new GroupSetting();
                        break;

                    case "Name":
                        reader.Read();
                        tempGroup.groupName = reader.Value.Trim();
                        break;

                    case "isActive":
                        reader.Read();
                        tempGroup.isActive = bool.Parse(reader.Value.Trim());
                        break;

                    case "Album":
                        reader.Read();
                        tempGroup.albumLocation = reader.Value.Trim();
                        break;

                    case "PictureOrder":
                        reader.Read();
                        tempGroup.order = reader.Value.Trim();
                        break;

                    case "MazeSize":
                        reader.Read();
                        tempGroup.mazeSize = int.Parse(reader.Value);
                        break;

                    case "Pallet":
                        reader.Read();
                        tempGroup.mazePalletName = reader.Value.Trim();
                        break;

                    case "Monitor":
                        reader.Read();
                        if (reader.Name == "ID")
                        {
                            reader.Read();
                            tempMonitor = new MonitorSetting(reader.Value.Trim());
                        }
                        else
                        {
                            throw new Exception("No Monitor ID");
                        }
                        break;

                    case "transitionType":
                        reader.Read();
                        tempMonitor.transitionType = reader.Value.Trim();
                        break;

                    case "FadeTime":
                        reader.Read();
                        tempMonitor.fadeTime = int.Parse(reader.Value.Trim());
                        break;

                    case "DisplayTime":
                        reader.Read();
                        tempMonitor.displayTime = int.Parse(reader.Value.Trim());
                        break;

                    case "PanTime":
                        reader.Read();
                        tempMonitor.panTime = int.Parse(reader.Value.Trim());
                        break;

                    case "PanDirIn":
                        reader.Read();
                        tempMonitor.dirIn = int.Parse(reader.Value.Trim());
                        break;

                    case "PanDirOut":
                        reader.Read();
                        tempMonitor.dirOut = int.Parse(reader.Value.Trim());
                        break;

                    case "IsClockwise":
                        reader.Read();
                        tempMonitor.clockwise = bool.Parse(reader.Value.Trim());
                        break;

                    case "NumRotations":
                        reader.Read();
                        tempMonitor.numRotations = int.Parse(reader.Value.Trim());
                        break;

                    case "AIView":
                        reader.Read();
                        tempMonitor.aiView = reader.Value.Trim();
                        break;

                    case "AIMethod":
                        reader.Read();
                        tempMonitor.aiMethod = reader.Value.Trim();
                        break;
                    }
                }
                else if (reader.MoveToContent().Equals(XmlNodeType.EndElement) && reader.Name == "Monitor")
                {
                    tempGroup.addMonitor(tempMonitor);
                }
                else if (reader.MoveToContent() == XmlNodeType.EndElement && reader.Name == "Group")
                {
                    groups.Add(tempGroup);
                }
            }
            return(groups);
        }
예제 #4
0
 public void addMonitor(MonitorSetting ms)
 {
     monitors.Add(ms);
 }