Пример #1
0
            public List <AssetInfo> ParseAudioConfig(string text)
            {
                if (string.IsNullOrEmpty(text))
                {
                    return(null);
                }
                XMLReader reader = new XMLReader(text);
                // List<XMLNode> list = reader.GetNodeList("audio");

                List <AssetInfo> models = new List <AssetInfo>();

                //foreach (XMLNode node in list)
                //{
                //    AssetInfo info = new AssetInfo();
                //    info.type = AssetType.AudioClip;
                //    info. = int.Parse(node.GetAttribute("id"));
                //    info.loop = int.Parse(node.GetAttribute("loop")) == 1 ? true : false;
                //    info.path = node.GetAttribute("path");
                //    info.time = float.Parse(node.GetAttribute("time"));
                //    info.bundle = int.Parse(node.GetAttribute("bundle"));
                //    string[] array = info.path.Split('/');
                //    if (array != null && array.Length > 0)
                //    {
                //        info.name = array[array.Length - 1];
                //    }
                //    models.Add(info);
                //}
                return(models);
            }
Пример #2
0
    public IEnumerable LoadAsset()
    {
        XmlDocument firstDocument = XMLReader.LoadXMLCfg(_firstNameAssetPath);
        XmlDocument lastDocument  = XMLReader.LoadXMLCfg(_lastNameAssetPath);

        _firstNameList.Clear();
        _lastNameList.Clear();


        if (firstDocument == null || lastDocument == null)
        {
            yield break;
        }

        XmlNode rootNodeFirst = firstDocument.DocumentElement;
        XmlNode rootNodeLast  = lastDocument.DocumentElement;

        if (rootNodeFirst == null || rootNodeLast == null)
        {
            yield break;
        }

        LoadResource(ref rootNodeFirst, ref _firstNameList);
        LoadResource(ref rootNodeLast, ref _lastNameList);
    }
Пример #3
0
        public void LoadDataTest()
        {
            plugin = XMLReader.GetInstance();
            var result = plugin.LoadData("C:\\Projects\\MultiLoader\\Sources\\XMLFile.xml");

            Assert.IsNotNull(result);
        }
Пример #4
0
    private void Start()
    {
        started = true;
        if (textObject == null)
        {
            textObject = gameObject;
        }
        _xml = new XMLReader(path);

        Debug.Log(_xml.GetNode(_xml.GetXML(), "root/dialogue/text").InnerText);

        if (float.TryParse(_xml.GetNode(_xml.GetXML(), "root/dialogue/textSpeed").InnerText, NumberStyles.AllowDecimalPoint, CultureInfo.InvariantCulture, out speed))
        {
        }
        else
        {
            if (_xml.GetNode(_xml.GetXML(), "root/dialogue/textSpeed").InnerText == null)
            {
                Debug.Log("Path doesn\'t exist.");
            }
            Debug.Log("Can't be changed to float");
            _speed = 0.5f;
        }

        _text = ReturnPiece(_xml.GetNode(_xml.GetXML(), "root/dialogue/text").InnerText, 0, _xml.GetNode(_xml.GetXML(), "root/dialogue/text").InnerText.IndexOf("(\\)"));

        textObject.AddComponent <DisplayText>();
    }
Пример #5
0
        private void RawLoad(XElement element, PackedData pack, ref float scaler, ref float offset)
        {
            if (element == null)
            {
                return;
            }

            scaler = Utility.ConvertToFloat(XMLReader.XElementAttributeValueByName(element, "scaler"));
            var item = XMLReader.XElementByName(element, "raw");

            if (item == null)
            {
                return;
            }

            offset = Utility.ConvertToFloat(XMLReader.XElementAttributeValueByName(item, "offset"));
            int.TryParse(XMLReader.XElementAttributeValueByName(item, "index"), out pack.index);
            switch (XMLReader.XElementAttributeValueByName(item, "type"))
            {
            case "_byte": pack.type = DataType._byte; break;

            case "_int16": pack.type = DataType._int16; break;

            case "_int32": pack.type = DataType._int32; break;

            case "_float": pack.type = DataType._float; break;
            }
        }
Пример #6
0
        public void TestXMLCData()
        {
            string test    = String.Format(@"<message> <content><![CDATA[test<>me]]></content></message>");
            var    root    = XMLReader.ReadFromString(test);
            var    msg     = root["message"];
            var    content = msg.GetString("content");

            Assert.IsTrue(content.Equals("test<>me"));

            test    = String.Format(@"<message> <content><![CDATA[test<>me]<[]]></content></message>");
            root    = XMLReader.ReadFromString(test);
            msg     = root["message"];
            content = msg.GetString("content");
            Assert.IsTrue(content.Equals("test<>me]<["));

            test    = String.Format(@"<message><content>![CDATA[testme]]</content></message>");
            root    = XMLReader.ReadFromString(test);
            msg     = root["message"];
            content = msg.GetString("content");
            Assert.IsTrue(content.Equals("![CDATA[testme]]"));

            test = String.Format("<message><content><![CDATA[line1.test<>me\nline2.hello\nthirdline]]></content></message>");

            root    = XMLReader.ReadFromString(test);
            msg     = root["message"];
            content = msg.GetString("content");
            Assert.IsTrue(content.Equals("line1.test<>me\nline2.hello\nthirdline"));
        }
Пример #7
0
        // GET: Teams
        public ActionResult Update()
        {
            XMLReader readTeams = new XMLReader();
            var       data      = readTeams.UpdateTeams();

            return(View("Index", data));
        }
Пример #8
0
 void Awake()
 {
     player    = GameObject.FindWithTag("Player");
     selection = player.GetComponentInChildren <WeaponSelection>();
     weapon    = player.GetComponentInChildren <BaseWeapon>();
     reader    = GetComponent <XMLReader>();
 }
Пример #9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Employee emp = Session["EmpDetails"] as Employee;

            if (emp == null)
            {
                Response.Redirect("~/Login.aspx");
            }
            else
            {
                //(this.Master as SiteMaster).UserName = emp.EmpName;
                var loanCollection = XMLReader.LoanXMLReader();
                IEnumerable <LoanDetails> filteredLoans;
                if (emp.EmpID.ToUpper() != "ADMIN")
                {
                    filteredLoans = loanCollection.LoanList.Where(item => item.InitiatedBy == emp.EmpID);
                }
                else
                {
                    filteredLoans = loanCollection.LoanList;
                }

                GridView1.DataSource = filteredLoans;
                GridView1.DataBind();
            }
        }
Пример #10
0
 protected internal virtual void loadXML()
 {
     try
     {
         try
         {
             try
             {
                 SAXParserFactory saxparserFactory = SAXParserFactory.newInstance();
                 XMLReader        xmlreader        = saxparserFactory.newSAXParser().getXMLReader();
                 this.rules = new HashMap();
                 GrXMLHandler grXMLHandler = new GrXMLHandler(this.baseURL, this.rules, this.logger);
                 xmlreader.setContentHandler(grXMLHandler);
                 xmlreader.setErrorHandler(grXMLHandler);
                 InputStream inputStream = this.baseURL.openStream();
                 xmlreader.parse(new InputSource(inputStream));
                 inputStream.close();
             }
             catch (SAXParseException ex)
             {
                 throw new IOException(new StringBuilder().append("Error while parsing line ").append(ex.getLineNumber()).append(" of ").append(this.baseURL).append(": ").append(ex.getMessage()).toString());
             }
         }
         catch (SAXException ex3)
         {
             throw new IOException(new StringBuilder().append("Problem with XML: ").append(ex3).toString());
         }
     }
     catch (ParserConfigurationException ex5)
     {
         throw new IOException(Throwable.instancehelper_getMessage(ex5));
     }
 }
Пример #11
0
        // GET: Employment
        public ActionResult Index()
        {
            XMLReader readXML = new XMLReader();
            var       data    = readXML.ReturnListOfEmployments();

            return(View(data.ToList()));
        }
Пример #12
0
        public void reset()
        {
            base.Clear();
            /*********************************
            *         READ XML FILE
            *********************************/
            if (this._xmlFile.Exists) {
                FileStream fStream = null;
                try {
                    fStream = new FileStream(this._xmlFile.FullName, FileMode.Open, FileAccess.Read);
                    XMLReader xmlRdr = new XMLReader(fStream);
                    xmlRdr.Refresh();
                    //
                    this.readXMLItems(xmlRdr, this);
                    //
                    xmlRdr.Clear();
                    xmlRdr = null;
                } catch (Exception ex) {
                    throw ex;

                } finally {
                    if (fStream != null) {
                        fStream.Close();
                        fStream = null;
                    }
                }
            }
            /*********************************
            *   ACCUMULATE WITH DEFAULTS
            *********************************/
            if (this._defaultSettings != null) {
                this.accumulateWithDefaultSettings(this, (Values)this._defaultSettings);
            }
        }
        public override object Deserialize(XMLReader input)
        {
            var backingArr = new List <object>();

            int depth = input.Depth;

            input.GoToNextTag();
            XMLTypeHandler handler = XMLHelpers.GetDerivedTypeHandlerFromXMLTag(input, out string tag) ?? _elementTypeHandler;

            while (input.Depth >= depth && !input.Finished)
            {
                object newObj = tag.Contains("/") ? null : handler.Deserialize(input);
                backingArr.Add(newObj);
                input.GoToNextTag();
                handler = XMLHelpers.GetDerivedTypeHandlerFromXMLTag(input, out tag) ?? _elementTypeHandler;
            }

            Type listGenericType = XMLHelpers.ListType.MakeGenericType(_elementType);
            var  list            = (IList)Activator.CreateInstance(listGenericType, backingArr.Count);

            for (var i = 0; i < backingArr.Count; i++)
            {
                list.Add(backingArr[i]);
            }

            return(list);
        }
Пример #14
0
        static void Main(string[] args)
        {
            log.Debug("Hello logging world!");
            log.Debug(ConfigReader.getConfigs());
            log.Debug(Directory.GetCurrentDirectory());
            string inputFolder;

            ConfigReader.getConfigs().TryGetValue("in", out inputFolder);
            string outputFolder;

            ConfigReader.getConfigs().TryGetValue("out", out outputFolder);
            log.Debug(inputFolder);
            if (!Directory.Exists(inputFolder))
            {
                Directory.CreateDirectory(inputFolder);
            }
            if (!Directory.Exists(outputFolder))
            {
                Directory.CreateDirectory(outputFolder);
            }
            foreach (String f in Directory.GetFiles(inputFolder))
            {
                log.Debug(f);
                String name = Path.GetFileNameWithoutExtension(f);
                log.Debug(name);
                XElement  c = ConfigReader.getAccountConfigs(name);
                XDocument d = XMLReader.getDoc(f);
                log.Debug(d.Nodes());
            }
        }
Пример #15
0
    public void LoadTMX(string fileName)
    {
        // load xml document
        TextAsset dataAsset = (TextAsset) Resources.Load (fileName, typeof(TextAsset));
        if(!dataAsset)
        {
            Debug.Log ("FTiledScene: Couldn't load the xml data from: " + fileName);
        }
        string fileContents = dataAsset.ToString();
        Resources.UnloadAsset(dataAsset);

        // parse xml string
        XMLReader parser = new XMLReader();
        XMLNode xmlNode = parser.read(fileContents);
        XMLNode rootNode = xmlNode.children[0] as XMLNode;

        // loop through all children
        foreach (XMLNode child in rootNode.children) {

            // save references to tilesets
            if (child.tagName == "tileset") {
                _tilesets.Add(child);
            }

            // create FTilemap for layer nodes
            if (child.tagName == "layer" && child.children.Count > 0) {
                AddChild(this.createTilemap(child));
            }

            // create FContainers for layer nodes
            if (child.tagName == "objectgroup") {
                AddChild(this.createObjectLayer(child));
            }
        }
    }
Пример #16
0
        // GET: ProductsList
        public ActionResult AllMatches()
        {
            XMLReader xmlReader = new XMLReader();
            var       data      = xmlReader.GetMatchesList();

            return(View(data.ToList()));
        }
Пример #17
0
        public List <Exercises> getExerciseList()
        {
            XMLReader readXML = new XMLReader();
            var       data    = readXML.ReturnListOfExercises();

            return(data);
        }
Пример #18
0
    void Start()
    {
        var reader     = new XMLReader();
        var npcSetting = reader.LoadSetting <NPCSetting>("NPCSetting");

        Debug.Log(npcSetting.assetPath);
    }
Пример #19
0
        /// <summary>Initialize repository and prepare it to work</summary>
        public RepositoryGUI()
        {
            InitializeComponent();
            // prepare the console
            AllocConsole();
            Console.Title = "Repository Server";
            Console.Write("Repository Console View".Title());
            txtPort1.Text = "8000";
            txtPort2.Text = "8001";
            // initialize files lists
            FileList    = new List <string>();
            ResultsList = new List <string>();
            // initialize the sending queue
            sendingQueue = new BlockingQ <Message>();
            // initialize and set up the receiver
            receiver = new Receiver();
            receiver.SetFilesPath(".\\Repository\\Libraries");
            receiver.SetResultsPath(".\\Repository\\Results");
            btnCreateChannels.PerformClick();
            LibSearchRepository();
            ResSearchRepository();
            mReceiver = new Thread(ReceiveMessages);
            mReceiver.Start();

            sender  = new Sender();
            mSender = new Thread(SendMessages);
            mSender.Start();
            ConnectedEnds    = new Dictionary <string, string>();
            ConnectedStreams = new Dictionary <string, string>();
            BlockedMessages  = new Dictionary <string, List <Message> >();
            BlockedFiles     = new Dictionary <string, List <FileTransferMessage> >();
            xReader          = new XMLReader();
            ReceivedMessages = new List <Message>();
        }
Пример #20
0
        /**
         * Processes the given sheet
         */
        public void ProcessSheet(
            SheetContentsHandler sheetContentsExtractor,
            StylesTable styles,
            ReadOnlySharedStringsTable strings,
            InputStream sheetInputStream)
        {
            DataFormatter formatter;

            if (locale == null)
            {
                formatter = new DataFormatter();
            }
            else
            {
                formatter = new DataFormatter(locale);
            }

            InputSource      sheetSource = new InputSource(sheetInputStream);
            SAXParserFactory saxFactory  = SAXParserFactory.newInstance();

            try
            {
                SAXParser      saxParser   = saxFactory.newSAXParser();
                XMLReader      sheetParser = saxParser.GetXMLReader();
                ContentHandler handler     = new XSSFSheetXMLHandler(
                    styles, strings, sheetContentsExtractor, formatter, formulasNotResults);
                sheetParser.SetContentHandler(handler);
                sheetParser.Parse(sheetSource);
            }
            catch (ParserConfigurationException e)
            {
                throw new RuntimeException("SAX Parser appears to be broken - " + e.GetMessage());
            }
        }
Пример #21
0
        public MainWindow()
        {
            InitializeComponent();

            #region 查看API文件是否存在
            if (!File.Exists(CfDdnsProperty.CONFIG_FILE_PATH + CfDdnsProperty.CONFIG_API_FILE_NAME))
            {
                Helper.ResetAPIConfiguration();
            }
            #endregion

            #region 读取XML中的Config信息
            XMLReader <UserConfigurationData> .read(CfDdnsProperty.CONFIG_FILE_PATH, CfDdnsProperty.CONFIG_FILE_NAME).save();

            #endregion

            #region 退出询问
            this.Closing += Window_Closing;
            #endregion

            #region UI初始化
            this.Title = CfDdnsProperty.SHOW_NAME;
            #endregion

            #region 系统托盘

            #endregion

            #region 页面导航初始化
            ddnsViews.Add("Configuration", new Uri("Pages/ConfigurationPage.xaml", UriKind.Relative));
            ddnsViews.Add("Console", new Uri("Pages/ConsolePage.xaml", UriKind.Relative));
            navigationFrame.Navigate(ddnsViews["Configuration"]);
            #endregion
        }
Пример #22
0
 /// <summary>Downloads required test files to thread's folder and appends log</summary>
 /// <param name="xReader">Reference to the XMLReader involved</param>
 /// <param name="Name">The calling thread name</param>
 /// <param name="Log">Reference to log to append on it</param>
 void DownloadTestFiles(ref XMLReader xReader, string Name, ref StringBuilder Log)
 {
     // get all needed libraries before processing any tests
     foreach (var Test in xReader.TestDrivers)
     {
         Log.Append("\n\t\"" + Test.Key + "\"\n\t\tTest Drivers:");
         foreach (string TestDriver in Test.Value)
         {
             sender.DownloadLibrary(TestDriver, "Repository", ".\\" + Name);
             Log.Append("\n\t\t\t" + TestDriver);
         }
         Log.Append("\n\t\tLibraries:");
         foreach (string Library in xReader.Libraries[Test.Key])
         {
             sender.DownloadLibrary(Library, "Repository", ".\\" + Name);
             Log.Append("\n\t\t\t" + Library);
         }
     }
     Dispatcher.BeginInvoke(new Action(() => {
         string[] names = Directory.GetFiles(Name, "*.dll");
         foreach (string s in names)
         {
             lstBoxTempFiles.Items.Add(s);
         }
     }));
 }
Пример #23
0
            /// <exception cref="System.IO.IOException"/>
            private FileChecksum GetFileChecksum(string f)
            {
                HttpURLConnection connection = this._enclosing.OpenConnection("/fileChecksum" + ServletUtil
                                                                              .EncodePath(f), "ugi=" + this._enclosing.GetEncodedUgiParameter());

                try
                {
                    XMLReader xr = XMLReaderFactory.CreateXMLReader();
                    xr.SetContentHandler(this);
                    xr.Parse(new InputSource(connection.GetInputStream()));
                }
                catch (SAXException e)
                {
                    Exception embedded = e.GetException();
                    if (embedded != null && embedded is IOException)
                    {
                        throw (IOException)embedded;
                    }
                    throw new IOException("invalid xml directory content", e);
                }
                finally
                {
                    connection.Disconnect();
                }
                return(this.filechecksum);
            }
Пример #24
0
        public override object Deserialize(XMLReader input)
        {
            int    depth  = input.Depth;
            object newObj = Activator.CreateInstance(Type, true);

            input.GoToNextTag();
            while (input.Depth >= depth && !input.Finished)
            {
                string currentTag = input.ReadTagWithoutAttribute();
                if (!_fieldHandlers.Value.TryGetValue(currentTag, out XMLFieldHandler field))
                {
                    Engine.Log.Warning($"Couldn't find handler for field - {currentTag}", MessageSource.XML);
                    return(newObj);
                }

                object val = field.TypeHandler.Deserialize(input);
                if (!field.Skip)
                {
                    field.ReflectionInfo.SetValue(newObj, val);
                }
                input.GoToNextTag();
            }

            return(newObj);
        }
Пример #25
0
        // GET: ProductList
        public ActionResult Index()
        {
            XMLReader readXML = new XMLReader();
            var       data    = readXML.RetrunListOfProducts();

            return(View(data.ToList()));
        }
Пример #26
0
            public List <AssetInfo> ParseFixAssetsConfig(string xml)
            {
                if (string.IsNullOrEmpty(xml))
                {
                    return(null);
                }
                XMLReader        reader   = new XMLReader(xml);
                List <AssetInfo> infoList = new List <AssetInfo>();
                List <XMLNode>   list     = reader.GetNodeList("item");

                foreach (XMLNode node in list)
                {
                    AssetInfo model = new AssetInfo
                    {
                        name       = node.GetAttribute("name"),
                        type       = (AssetType)int.Parse(node.GetAttribute("type")),
                        bundle     = uint.Parse(node.GetAttribute("bundle")),
                        preInstant = int.Parse(node.GetAttribute("instant")),
                        asset      = node.GetAttribute("path"),
                        audio      = uint.Parse(node.GetAttribute("music")),
                        grade      = int.Parse(node.GetAttribute("grade"))
                    };
                    infoList.Add(model);
                }
                return(infoList);
            }
Пример #27
0
    // TODO: HACK
    private Hashtable GetQuestionDataFromXML(string xml)
    {
        Hashtable returnData = new Hashtable();
        XMLNode   node;
        XMLReader parser = new XMLReader();

        node = parser.read(xml);

        if (node.tagName == "!DOCTYPE")
        {
            returnData["error"] = serverErrorMsg;
        }
        else if (node.tagName == "error")
        {
            foreach (XMLNode detail in node.children)
            {
                switch (detail.tagName)
                {
                case "description":
                    returnData["error"] = detail.value;
                    break;
                }
            }
        }
        else
        {
            returnData["data"] = node;
        }

        return(returnData);
    }
Пример #28
0
        public TiledMap(XMLReader reader) : base(reader)
        {
            CollisionPlatforms            = new List <LineSegment>();
            SlopedCollisionPlatforms      = new List <LineSegment>();
            AxisAlignedCollisionPlatforms = new List <LineSegment>();
            MagicFlows            = new List <MagicFlow>();
            BackgroundDecorations = new List <Decoration>();
            TilesetMap            = new Dictionary <int, string>();

            Size = new Vector2(Width, Height);

            float spawnX;

            float.TryParse(Properties["SpawnX"], out spawnX);
            float spawnY;

            float.TryParse(Properties["SpawnY"], out spawnY);
            float spawnZ;

            float.TryParse(Properties["SpawnZ"], out spawnZ);

            Spawn = new Vector3(spawnX, spawnY, spawnZ);

            CreateObjects();
        }
Пример #29
0
        internal static void LoadEnvironment_NameValue()
        {
            _environmentSetting.Setting_NameValue = new NameValueSetting();

            XMLReader _reader = new XMLReader();

            _reader.LoadFile(PathUtility.GetApplicationPath(CommonCode.ConfigName.EnvironmentNameValue));

            _environmentSetting.Setting_NameValue.NameValues = new Dictionary <string, string>();

            var _nameValueItems = _reader.FindNodes("Item/add");

            if (_nameValueItems != null)
            {
                foreach (XmlNode item in _nameValueItems)
                {
                    var _key = item.Attributes["key"].Value;

                    if (_environmentSetting.Setting_NameValue.NameValues.ContainsKey(_key))
                    {
                        throw new ArgumentException("Environment_NameValue.config exist repetitive key:the key is [" + _key + "]");
                    }
                    _environmentSetting.Setting_NameValue.NameValues.Add(_key, item.Attributes["value"].Value);
                }
            }
        }
Пример #30
0
        public JsonResult AllRoadBlocks()
        {
            XMLReader myXmlReader    = new XMLReader();
            var       lstAllClosures = myXmlReader.getListOfRoadClosures().ToList();

            return(Json(lstAllClosures, JsonRequestBehavior.AllowGet));
        }
Пример #31
0
        public ActionResult Participants()
        {
            XMLReader readXML = new XMLReader();
            var       data    = readXML.ReturnListOfUsers();

            if (data == null)
            {
                return(View());
            }
            else
            {
                Participants p  = new Participants();
                int          c  = data.Count;
                int          se = 0;
                for (int i = 0; i < c; i++)
                {
                    if (data[i].SocialEvents == "Yes")
                    {
                        se = se + 1;
                    }
                }
                p.Nr           = c;
                p.SocialEvents = se;
                List <Participants> part = new List <Participants>();
                part.Add(p);
                return(View(part));
            }
        }
Пример #32
0
        public Form1()
        {
            //this.FormBorderStyle = FormBorderStyle.None; //uncomment to make completely full screen, so close button
            //this.WindowState = FormWindowState.Maximized; //uncomment to make full screen
            InitializeComponent();
            intakeStatus.newPatient = true;
            patientForm = new FormData();
            clinicData = new ClinicData();

            xmlHandler = new XMLHandler(this, patientForm);
            xmlReader = new XMLReader(this, patientForm, clinicData);
            xmlReader.LoadClinicSettings();

            intakeStatus = new IntakeTabStatus();
            triageStatus = new TriageTabStatus();
            clinicTabStatus = new ClinicTabStatus();
            pharmacyTabStatus = new PharmacyTabStatus();

            //set scribe list
            string[] providers = clinicData.GetProviders();
            for (int i = 0; i < providers.Length; i++)
            {
                comboBoxScribeList.Items.Add(providers[i]);
            }
            comboBoxScribeList.Text = "NI";

            InitializeIntakeData();
            InitializeTriageData();
            InitializeClinicTabData();
            InitializeAdminTab();
        }
Пример #33
0
 /// <summary>Tests the Test Drivers specified by the calling thread</summary>
 /// <param name="xReader">Reference to the XMLReader involved</param>
 /// <param name="Log">Reference to the log to append</param>
 /// <param name="innerLog">Reference to the inner log. This helps orginizing the results file</param>
 void TestFiles(ref XMLReader xReader, ref StringBuilder Log, ref StringBuilder innerLog, string Name)
 {
     Log.Append("\n\nResults:");
     foreach (var Test in xReader.TestDrivers)
     {
         Log.Append("\n\t" + Test.Key + ":");
         innerLog.Append("\n" + Test.Key + ":\n\n");
         foreach (string TestDriver in Test.Value)
         {
             // load the file in a child AppDomain. This is useful as we need to unload the
             // assembly and that cannot be done if it was loaded directly
             AppDomain ChildDomain = AppDomain.CreateDomain(Name + "ChildDomain");
             ChildDomain.Load("TestAppDomain");
             ObjectHandle  objH   = ChildDomain.CreateInstance("TestAppDomain", "RemoteTestHarness.TestAppDomain");
             TestAppDomain Tester = (TestAppDomain)objH.Unwrap();
             Tester.path = Path.Combine(".\\" + Name, TestDriver);
             // perform testing
             Tester.execute();
             Log.Append("\n\t\t" + Tester.getLog());
             innerLog.Append(Tester.getLog(true) + "\n");
             // unload the assembly to set the assembly file free
             AppDomain.Unload(ChildDomain);
         }
     }
 }
Пример #34
0
 public Map(XMLReader.Map map, ContentManager content)
 {
     mapWidth = map.mapWidth;
     mapHeight = map.mapHeight;
     cellWidth = map.cellWidth;
     cellHeight = map.cellHeight;
     System.Console.WriteLine(mapWidth);
     animations = new Dictionary<string, SpiritForce.TheWorld.Animation>();
     foreach (XMLReader.Animation a in map.Animations)
     {
         animations.Add(a.identifier, new SpiritForce.TheWorld.Animation(a.identifier, a.sheet, a.frameTime, a.startX, a.startY, a.width, a.height, a.frameWidth, a.frameHeight));
     }
     Sprites = new Dictionary<String, Sprite>();
     foreach (XMLReader.Sprite sprite in map.Sprites)
     {
         Sprites.Add(sprite.identifier, new Sprite(sprite.identifier, animations[sprite.animation].copy(), sprite.posX, sprite.posY, sprite.width, sprite.height, sprite.collidable));
     }
     SpriteSheets = new Dictionary<String, Spritesheet>();
     foreach (XMLReader.Spritesheet sheet in map.Spritesheets)
     {
         SpriteSheets.Add(sheet.id, new Spritesheet(sheet.id,content.Load<Texture2D>(sheet.sheet),sheet.cellWidth,sheet.cellHeight,sheet.paddingWidth,sheet.paddingHeight,sheet.numRows,sheet.numColumns));
     }
     events = new List<Event>();
     foreach (XMLReader.Event e in map.Events)
     {
         events.Add(new Event(e.id, e.command, e.prereqs, e.postreqs, e.posX, e.posY, e.width, e.height, e.objectTrigger, e.triggers, e.activateOnLoad));
     }
     narrative = new Dictionary<String, SpiritForce.TheWorld.Narrative>();
     foreach (XMLReader.Narrative n in map.Narratives)
     {
         List<SpiritForce.TheWorld.NarrativeItem> items = new List<SpiritForce.TheWorld.NarrativeItem>();
         foreach (XMLReader.NarrativeItem n2 in n.narrativeItems)
         {
             items.Add(new SpiritForce.TheWorld.NarrativeItem(n2.sprite,n2.spriteX,n2.spriteY,n2.text,n2.textX,n2.textY));
         }
         narrative.Add(n.identifier, new SpiritForce.TheWorld.Narrative(n.identifier, n.backgroundSprite, n.x, n.y, n.delay, n.continueButton, items));
     }
     sounds = new Dictionary<string, SpiritForce.TheWorld.Sound>();
     foreach (XMLReader.Sound s in map.Sounds)
     {
         sounds.Add(s.identifier, new SpiritForce.TheWorld.Sound(s.identifier, content.Load<SoundEffect>(s.sound), s.volume));
     }
     music = new Dictionary<string, SpiritForce.TheWorld.Music>();
     foreach (XMLReader.Music m in map.Music)
     {
         music.Add(m.identifier, new SpiritForce.TheWorld.Music(m.identifier, content.Load<Song>(m.song)));
     }
     particleEmitters = new Dictionary<string, SpiritForce.TheWorld.ParticleEmitter>();
     foreach (XMLReader.ParticleEmitter p in map.ParticleEmitters)
     {
         List<Sprite> sprites = new List<Sprite>();
         foreach (String s in p.particleTypes)
         {
             sprites.Add(this.Sprites[s]);
         }
         particleEmitters.Add(p.identifier, new SpiritForce.TheWorld.ParticleEmitter(p.identifier, sprites, p.maxAngle, p.minAngle, p.x, p.y, p.width, p.height, p.maxParticles, p.minParticles, p.liveTime, p.particleLiveTime, p.maxSpeed, p.minSpeed, p.randomChanceOfDeath));
     }
     this.liveEmitters = new List<SpiritForce.TheWorld.ParticleEmitter>();
 }
Пример #35
0
 // Use this for initialization
 void Start()
 {
     gps = GameObject.Find ("GamePanelHolder").GetComponent<GamePanelScript> ();
     gf = gameObject.GetComponent<GameFactory> ();
     xreader = new XMLReader ();
     taad = gameObject.GetComponent<TestAddAndDestroy> ();
     gamesActive = new List<string> {"Auditiv","Kinæstetisk","Visuel","Taktil"};
     tagFilter = new TagFilter ();
     LoadAllXML ();
 }
Пример #36
0
                public void TestDictionary()
                {
                    Variant input = new Variant(Variant.EnumType.Dictionary);
                    input.Add("key1", new Variant("value1"));
                    input.Add("key2", new Variant("value2"));

                    StringBuilder ibuffer = new StringBuilder();
                    System.IO.StringWriter istream = new System.IO.StringWriter(ibuffer);
                    XMLWriter writer = new XMLWriter(istream);
                    writer.Write(input);

                    System.IO.StringReader ostream = new System.IO.StringReader(ibuffer.ToString());
                    XMLReader reader = new XMLReader(ostream);
                    Variant output = reader.Read();

                    Assert.True(input.Equals(output));
                }
Пример #37
0
        public ActionResult Buscar(string Nombre)
        {
            string Path = Server.MapPath("~/App_Data/ListaArtistas.xml");

            if(Nombre != null){
                // Retrieve XML document
                string Url = "http://ws.spotify.com/search/1/artist?q=" + Nombre;

                XmlDocument myXMLDocument = new XmlDocument();

                myXMLDocument.Load(Url);

                myXMLDocument.Save(Path);
            }

            XMLReader readXML = new XMLReader();
            var data = readXML.RetrunListaArtistas(Path);

            return View(data.ToList());
        }
Пример #38
0
    public void LoadTMX(string fileName)
    {
        // load xml document
        TextAsset dataAsset = (TextAsset)Resources.Load(fileName, typeof(TextAsset));
        if (!dataAsset)
        {
            Debug.Log("FTiledScene: Couldn't load the xml data from: " + fileName);
        }
        string fileContents = dataAsset.ToString();
        Resources.UnloadAsset(dataAsset);

        // parse xml string
        XMLReader parser = new XMLReader();
        XMLNode xmlNode = parser.read(fileContents);
        XMLNode rootNode = xmlNode.children[0] as XMLNode;
        int firstgid = 0;

        this.actualMapName = fileName;

        int tilesWide = int.Parse(rootNode.attributes["width"]);
        int tilesHigh = int.Parse(rootNode.attributes["height"]);
        tileWidth = int.Parse(rootNode.attributes["tilewidth"]);
        tileHeight = int.Parse(rootNode.attributes["tileheight"]);

        this.width = tilesWide * tileWidth;
        this.height = tilesHigh * tileHeight;
        // loop through all children
        foreach (XMLNode child in rootNode.children)
        {

            if (child.tagName == "properties")
            {
                foreach (XMLNode property in child.children)
                {
                    switch (property.attributes["name"].ToLower())
                    {
                        case "name":
                            this.mapName = property.attributes["value"];
                            break;
                        case "music":
                            this.mapMusic = property.attributes["value"];
                            break;
                        case "mapdescription":
                            this.mapDescription = property.attributes["value"];
                            break;
                    }

                }
            }
            // save references to tilesets
            if (child.tagName == "tileset")
            {
                _tilesets.Add(child);
                if (child.attributes["name"].CompareTo("objects") == 0)
                {
                    objectLayerStartGID = int.Parse(child.attributes["firstgid"]);
                }
                firstgid = int.Parse(child.attributes["firstgid"]);
            }

            // create FTilemap for layer nodes
            if (child.tagName == "layer" && child.children.Count > 0)
            {
                FTilemap tilemap = (FTilemap)this.createTilemap(child);
                tilemaps.Add(tilemap);
                AddChild(tilemap);
            }

            // create FContainers for layer nodes
            if (child.tagName == "objectgroup")
            {
                AddChild(this.createObjectLayer(child));
            }
        }
    }
Пример #39
0
    // Use this for initialization
    void Start()
    {
        department = initialText;
        oldslectedItem = slectedItem;
        GameObject aboveCam = GameObject.Find("AboveCam");

        aboveCam.SetActive (false);
        GameObject master = GameObject.Find("master");
        master.SetActive(false);

        windowRectangle = new Rect(Screen.width/2-200,Screen.height/2-100,400,200);
        messageRectangle = new Rect(Screen.width/2-200,Screen.height/2-80,400,160);

        XMLReader xml = new XMLReader (GameAsset);
        items = xml.getList();
    }
Пример #40
0
 protected void importXML(string text)
 {
     XMLReader xmlReader = new XMLReader();
     XMLNode root = xmlReader.read(text).children[0] as XMLNode;
     foreach (XMLNode record in root.children)
     {
         Dictionary<string, string> items = new Dictionary<string, string>();
         foreach (XMLNode item in record.children)
             items.Add(item.tagName, item.cdata);
         strings.Add(record.attributes["id"], items);
     }
 }
Пример #41
0
        public ActionResult Guardar(string ID, string name, string popularity)
        {
            var art = new Artista();

            art.ID = ID;
            art.NombreArtista = name;
            art.PopularidadArtista = popularity;

            using (var dbCtx = new SpotifyContext())
            {
                dbCtx.Artistas.Add(art);

                dbCtx.SaveChanges();
            }

            //buscando albumes
            string Path = Server.MapPath("~/App_Data/ListaAlbumes.xml");
            string PathPistas = Server.MapPath("~/App_Data/ListaPistas.xml");

            if (ID != null)
            {
                // Retrieve XML document
                string Url = "https://ws.spotify.com/lookup/1/?uri=spotify:artist:" + ID + "&extras=albumdetail";

                XmlDocument myXMLDocument = new XmlDocument();

                myXMLDocument.Load(Url);

                myXMLDocument.Save(Path);

                XMLReader readXML = new XMLReader();
                var data = readXML.RetrunListaAlbumes(Path);

                foreach (var album in data.ToList())
                {
                    var alb = new Album();

                    alb.ID = album.ID + art.ID;
                    alb.ArtistaID = album.ArtistaID;
                    alb.NombreAlbum = album.name;
                    //alb.PopularidadAlbum = album.popularity;
                    alb.Disponibilidad = album.availability;
                    alb.Año = album.released;

                    using (var dbCtx = new SpotifyContext())
                    {
                        dbCtx.Albumes.Add(alb);

                        dbCtx.SaveChanges();
                    }

                    // Retrieve XML document
                    string UrlPista = "https://ws.spotify.com/lookup/1/?uri=spotify:album:" + album.ID + "&extras=trackdetail";

                    XmlDocument myXMLDocumentPista = new XmlDocument();

                    myXMLDocumentPista.Load(UrlPista);

                    myXMLDocumentPista.Save(PathPistas);

                    XMLReader readXMLPista = new XMLReader();
                    var dataPista = readXMLPista.RetrunListaPistas(PathPistas);

                    foreach (var track in dataPista.ToList())
                    {
                        var tra = new Pista();

                        tra.ID = track.ID + alb.ID;
                        tra.AlbumID = alb.ID;
                        tra.NombrePista = track.name;
                        tra.Popularidad = Convert.ToDecimal(track.popularity.Replace('.',','));
                        tra.Duracion = Convert.ToDecimal(track.length.Replace('.', ','));
                        tra.NumeroPista = Convert.ToInt32(track.tracknumber);

                        using (var dbCtxPista = new SpotifyContext())
                        {
                            dbCtxPista.Pistas.Add(tra);

                            dbCtxPista.SaveChanges();
                        }
                    }
                }
            }

            return RedirectToAction("Index");
        }
Пример #42
0
 /**
  * Create a new adapter.
  *
  * <p>Create a new adapter, wrapped around a SAX2 XMLReader.
  * The adapter will make the XMLReader act like a SAX1
  * Parser.</p>
  *
  * @param xmlReader The SAX2 XMLReader to wrap.
  * @exception java.lang.NullPointerException If the argument is null.
  */
 public XMLReaderAdapter(XMLReader xmlReader)
 {
     setup(xmlReader);
 }
Пример #43
0
 /**
  * Internal setup.
  *
  * @param xmlReader The embedded XMLReader.
  */
 private void setup(XMLReader xmlReader)
 {
     if (xmlReader == null)
     {
         throw new java.lang.NullPointerException("XMLReader must not be null");
     }
     this.xmlReader = xmlReader;
     qAtts = new AttributesAdapter();
 }
Пример #44
0
    // Use this for initialization
    void Start()
    {
        //CACHEEE FTW
        waveText = GameObject.Find("HUD").GetComponentsInChildren<Text>()[2];
        xml = this.GetComponentInChildren<XMLReader> ();

        print (minionsVivos);
        print (minionsSpawneables);
        StartCoroutine ("SpawnWaves");
    }
Пример #45
0
                public void TestSchemaValidation()
                {
                    System.IO.StringReader xml = new System.IO.StringReader(
                        @"<?xml version=""1.0"" encoding=""utf-8""?>
                          <Variant aBoolean=""true"" aDate=""2007-01-03"" aDateTime=""2007-01-03T10:30:00"" aFloat=""0.5"" aDouble=""3.9"" aInteger=""1"" aUnsigned=""2"" aInt32=""3"" aUInt32=""4"" aInt64=""5"" aUInt64=""6"" aString=""Element"" aTime=""10:30:00"">
                            <Boolean>true</Boolean>
                            <Date>2007-01-03</Date>
                            <DateTime>2007-01-03T10:30:00</DateTime>
                            <Float>0.5</Float>
                            <Double>1</Double>
                            <Integer>1</Integer>
                            <Unsigned>2</Unsigned>
                            <Int32>3</Int32>
                            <UInt32>4</UInt32>
                            <Int64>5</Int64>
                            <UInt64>6</UInt64>
                            <String>Element</String>
                            <Time>10:30:00</Time>
                          </Variant>");

                    System.IO.StringReader xsd = new System.IO.StringReader(
                        @"<?xml version=""1.0"" encoding=""utf-8""?>
                          <xsd:schema xmlns:xsd=""http://www.w3.org/2001/XMLSchema"">
                            <xsd:element name=""Variant"">
                              <xsd:complexType mixed=""true"">
                                <xsd:all>
                                  <xsd:element name=""String""   type=""xsd:string""/>
                                  <xsd:element name=""Boolean""  type=""xsd:boolean""/>
                                  <xsd:element name=""Integer""  type=""xsd:integer""/>
                                  <xsd:element name=""Unsigned"" type=""xsd:positiveInteger""/>
                                  <xsd:element name=""Int32""    type=""xsd:int""/>
                                  <xsd:element name=""UInt32""   type=""xsd:unsignedInt""/>
                                  <xsd:element name=""Int64""    type=""xsd:long""/>
                                  <xsd:element name=""UInt64""   type=""xsd:unsignedLong""/>
                                  <xsd:element name=""Float""    type=""xsd:float""/>
                                  <xsd:element name=""Double""   type=""xsd:double""/>
                                  <xsd:element name=""Date""     type=""xsd:date""/>
                                  <xsd:element name=""Time""     type=""xsd:time""/>
                                  <xsd:element name=""DateTime"" type=""xsd:dateTime""/>
                                </xsd:all>
                                <xsd:attribute name=""variant""   type=""xsd:string"" use=""optional"" default=""Dictionary""/>
                                <xsd:attribute name=""aString""   type=""xsd:string""/>
                                <xsd:attribute name=""aBoolean""  type=""xsd:boolean""/>
                                <xsd:attribute name=""aInteger""  type=""xsd:integer""/>
                                <xsd:attribute name=""aUnsigned"" type=""xsd:positiveInteger""/>
                                <xsd:attribute name=""aInt32""    type=""xsd:int""/>
                                <xsd:attribute name=""aUInt32""   type=""xsd:unsignedInt""/>
                                <xsd:attribute name=""aInt64""    type=""xsd:long""/>
                                <xsd:attribute name=""aUInt64""   type=""xsd:unsignedLong""/>
                                <xsd:attribute name=""aFloat""    type=""xsd:float""/>
                                <xsd:attribute name=""aDouble""   type=""xsd:double""/>
                                <xsd:attribute name=""aDate""     type=""xsd:date""/>
                                <xsd:attribute name=""aTime""     type=""xsd:time""/>
                                <xsd:attribute name=""aDateTime"" type=""xsd:dateTime""/>
                              </xsd:complexType>
                            </xsd:element>
                          </xsd:schema>");

                    Variant v1;
                    using (XMLReader reader = new XMLReader(xml))
                    {
                        reader.SetExternalSchema("MySchema");
                        reader.AddEntityReader("MySchema", xsd);

                        v1 = reader.Read();
                    }

                    Assert.AreEqual(v1["String"].Type, Variant.EnumType.String);
                    Assert.AreEqual(v1["Boolean"].Type, Variant.EnumType.Boolean);
                    Assert.AreEqual(v1["Integer"].Type, Variant.EnumType.Int32);
                    Assert.AreEqual(v1["Unsigned"].Type, Variant.EnumType.UInt32);
                    Assert.AreEqual(v1["Int32"].Type, Variant.EnumType.Int32);
                    Assert.AreEqual(v1["UInt32"].Type, Variant.EnumType.UInt32);
                    Assert.AreEqual(v1["Int64"].Type, Variant.EnumType.Int64);
                    Assert.AreEqual(v1["UInt64"].Type, Variant.EnumType.UInt64);
                    Assert.AreEqual(v1["Float"].Type, Variant.EnumType.Float);
                    Assert.AreEqual(v1["Double"].Type, Variant.EnumType.Double);
                    Assert.AreEqual(v1["Date"].Type, Variant.EnumType.Date);
                    Assert.AreEqual(v1["Time"].Type, Variant.EnumType.Time);
                    Assert.AreEqual(v1["DateTime"].Type, Variant.EnumType.DateTime);

                    // check attribute types
                    Assert.AreEqual(v1["aString"].Type, Variant.EnumType.String);
                    Assert.AreEqual(v1["aBoolean"].Type, Variant.EnumType.Boolean);
                    Assert.AreEqual(v1["aInteger"].Type, Variant.EnumType.Int32);
                    Assert.AreEqual(v1["aUnsigned"].Type, Variant.EnumType.UInt32);
                    Assert.AreEqual(v1["aInt32"].Type, Variant.EnumType.Int32);
                    Assert.AreEqual(v1["aUInt32"].Type, Variant.EnumType.UInt32);
                    Assert.AreEqual(v1["aInt64"].Type, Variant.EnumType.Int64);
                    Assert.AreEqual(v1["aUInt64"].Type, Variant.EnumType.UInt64);
                    Assert.AreEqual(v1["aFloat"].Type, Variant.EnumType.Float);
                    Assert.AreEqual(v1["aDouble"].Type, Variant.EnumType.Double);
                    Assert.AreEqual(v1["aDate"].Type, Variant.EnumType.Date);
                    Assert.AreEqual(v1["aTime"].Type, Variant.EnumType.Time);
                    Assert.AreEqual(v1["aDateTime"].Type, Variant.EnumType.DateTime);
                }
Пример #46
0
 /**
  * Construct an XML filter with the specified parent.
  *
  * @see #setParent
  * @see #getParent
  */
 public XMLFilterImpl(XMLReader parent)
     : base()
 {
     setParent(parent);
 }
Пример #47
0
 ////////////////////////////////////////////////////////////////////
 // Implementation of org.xml.sax.XMLFilter.
 ////////////////////////////////////////////////////////////////////
 /**
  * Set the parent reader.
  *
  * <p>This is the {@link org.xml.sax.XMLReader XMLReader} from which
  * this filter will obtain its events and to which it will pass its
  * configuration requests.  The parent may itself be another filter.</p>
  *
  * <p>If there is no parent reader set, any attempt to parse
  * or to set or get a feature or property will fail.</p>
  *
  * @param parent The parent XML reader.
  * @see #getParent
  */
 public void setParent(XMLReader parent)
 {
     this.parent = parent;
 }