Пример #1
0
        public void Visit(ActionLayerDef actionLayerDef, object[] args)
        {
            //reader.Read();
            //reader.MoveToContent();
            reader.MoveToAttribute("position");

            actionLayerDef.Position = PositionData.Parse(reader.Value);

            //reader.Read();  //</ActionLayer>
        }
 public void Visit(ActionLayerDef actionLayerDef, object[] args)
 {
     throw new NotImplementedException();
 }
Пример #3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="args">
        /// XMLReader, filename
        /// </param>
        public void Visit(FireMLRoot root, object[] args)
        {
            //reader = args[0] as XmlTextReader;
            //file = args[1] as string;

            while (reader.Read())
            {
                reader.MoveToContent();
                switch (reader.NodeType)
                {
                case XmlNodeType.Element:
                    Location location = new Location(file, reader.LineNumber, reader.LinePosition);
                    switch (dic[reader.Name])
                    {
                    case "MainPlot":
                        if (root.MainPlot != null)
                        {
                            kernel.IssueError(ErrorType.DuplicatedMainPlot, location);
                            continue;
                        }

                        PlotDef plotDef = new PlotDef();
                        plotDef.Location = location;

                        root.MainPlot = plotDef;
                        //reader.MoveToContent();
                        plotDef.Accept(this);
                        break;

                    case "SubPlot":
                        reader.MoveToAttribute("name");
                        string subPlotName = reader.Value;
                        if (root.SubPlotMap.ContainsKey(subPlotName))
                        {
                            kernel.IssueError(ErrorType.DuplicatedSubPlot, subPlotName,
                                              new Location(file, reader.LineNumber, reader.LinePosition));
                            continue;
                        }

                        PlotDef subPlotDef = new PlotDef();
                        subPlotDef.Location = location;
                        subPlotDef.Name     = subPlotName;

                        root.SubPlotMap.Add(subPlotName, subPlotDef);
                        //reader.MoveToContent();
                        subPlotDef.Accept(this);
                        break;

                    case "ActionLayer":
                        reader.MoveToAttribute("name");
                        string layerName = reader.Value;
                        if (root.ActionLayerMap.ContainsKey(layerName))
                        {
                            kernel.IssueError(ErrorType.DuplicatedActorLayer, layerName,
                                              new Location(file, reader.LineNumber, reader.LinePosition));
                            continue;
                        }

                        ActionLayerDef actionLayerDef = new ActionLayerDef();
                        actionLayerDef.Location = location;
                        actionLayerDef.Name     = layerName;

                        root.ActionLayerMap.Add(layerName, actionLayerDef);
                        //reader.Read();
                        reader.MoveToElement();
                        actionLayerDef.Accept(this);
                        break;

                    case "Function":
                        reader.MoveToAttribute("name");
                        string funcName = reader.Value;
                        if (root.FuncDefMap.ContainsKey(funcName))
                        {
                            kernel.IssueError(ErrorType.DuplicatedFunction, funcName,
                                              new Location(file, reader.LineNumber, reader.LinePosition));
                            continue;
                        }

                        FunctionDef funcDef = new FunctionDef();
                        funcDef.Location = location;
                        funcDef.Name     = funcName;

                        root.FuncDefMap.Add(funcName, funcDef);
                        //reader.MoveToContent();
                        funcDef.Accept(this);
                        break;
                    }
                    break;

                case XmlNodeType.EndElement:
                    reader.Read();
                    break;
                }
            }
        }
Пример #4
0
 public void Visit(ActionLayerDef actionLayerDef, object[] args)
 {
 }