private void OnSubmitAction()
    {
        WKSigleton.Instance.GetPlayerName = _PlayerName.text;

        JSONGetter jsonGetter = JSONGetter.GetJSON();

        jsonGetter._CreateName.name = _PlayerName.text;
        jsonGetter.StartParsing(EJSONType.JSON_PLAYERNAME, JSONAction);
    }
Example #2
0
        public static void writeProperties(string _path)
        {
            //this method assumes that in you have scraped a number of Scratch files
            //it will then put all the corresponding properties in /properties


            DirectoryInfo d = new DirectoryInfo(_path);

            FileInfo[] Files = d.GetFiles(); //Getting files
            int        i     = 0;

            foreach (FileInfo file in Files)
            {
                //get the id:
                string id = Path.GetFileNameWithoutExtension(file.Name);

                string projectURL = @"https://scratch.mit.edu/projects/" + id + "/?x=" + DateTime.Now.ToString();
                //we are adding a fake quety string to prevent the browser form loading from the cache and getting old data

                var HTML = JSONGetter.GetJSON(projectURL);

                if (HTML != null)
                {
                    if (isShared(HTML))
                    {
                        string pathForProperties = _path + "properties\\properties.sb";

                        JSONGetter.writeStringToFile(id + ",", pathForProperties, true, false);

                        FindCountandWritetoFile(HTML, "fav-count", pathForProperties);
                        FindCountandWritetoFile(HTML, "love-count", pathForProperties);

                        FindCountandWritetoFile(HTML, "icon views", pathForProperties);
                        FindCountandWritetoFile(HTML, "icon remix-tree", pathForProperties);

                        FindCountandWritetoFile(HTML, "Shared:", pathForProperties);
                        FindCountandWritetoFile(HTML, "Modified:", pathForProperties);

                        FindUserWritetoFile(HTML, pathForProperties);
                    }
                    else
                    {
                        string pathForProperties = _path + "properties\\notShared.sb";
                        JSONGetter.writeStringToFile(id, pathForProperties, true, true);
                    }
                }

                Console.WriteLine(i.ToString());
                i++;
            }
        }