예제 #1
0
        string GetAssetVersion(Hashtable _definition)
        {
            string name = (string)_definition["Name"];

            if (name.Equals("PlayMaker"))
            {
                return(MyUtils.GetPlayMakerVersion());
            }

            if (_definition.ContainsKey("VersionScanMethod"))
            {
                Hashtable _versionScanDetails = (Hashtable)_definition["VersionScanMethod"];
                if (_versionScanDetails.ContainsKey("FindInTextFile"))
                {
                    try
                    {
                        Regex pattern = new Regex((string)_versionScanDetails["VersionRegexPattern"]);

                        using (StreamReader inputReader = new StreamReader(Application.dataPath + _versionScanDetails["FindInTextFile"]))
                        {
                            while (!inputReader.EndOfStream)
                            {
                                try
                                {
                                    Match m = pattern.Match(inputReader.ReadLine());
                                    if (m.Success)
                                    {
                                        return(m.Value);
                                    }
                                }
                                catch (FormatException) {}
                                catch (OverflowException) {}
                            }
                        }
                    }catch (Exception e)
                    {
                        Debug.LogError("Project Scanning error for version scanning of " + name + " :" + e.Message);
                    }
                }
                else if (_versionScanDetails.ContainsKey("FindInVersionInfo"))
                {
                    string _jsonText = File.ReadAllText(Application.dataPath + _versionScanDetails["FindInVersionInfo"]);
                    return(VersionInfo.VersionInfoFromJson(_jsonText).ToString());
                }
            }

            return("n/a");
        }
예제 #2
0
        /// <summary>
        /// Launch the scanning process.
        /// </summary>
        public void LaunchScanningProcess(bool ConsoleOutput, string EditorPlayerPrefKey = "")
        {
            OutputInConsole = ConsoleOutput;

            _editorPlayerPrefKey = EditorPlayerPrefKey;

            if (OutputInConsole)
            {
                Debug.Log("Project Scanner: Downloading Assets Description");
            }

            _hasError   = false;
            _isScanning = true;
            AssetsList  = new SortedDictionary <string, AssetItem>();

            _wwwWrapper = new HttpWrapper();

            WWWForm _form = new WWWForm();

            _form.AddField("UnityVersion", Application.unityVersion);
            _form.AddField("PlayMakerVersion", MyUtils.GetPlayMakerVersion());

            _wwwWrapper.GET
            (
                "http://www.fabrejean.net/projects/playmaker_ecosystem/assetsDescription"
                ,
                _form
                ,
                (WWW www) =>
            {
                if (!string.IsNullOrEmpty(www.error))
                {
                    Debug.LogError("Project Scanner: Error downloading assets definition :" + www.error);

                    _isScanning = false;
                    _hasError   = true;
                }
                else
                {
                    EditorCoroutine.start(DoScanProject(www.text));
                }
            }
            );
        }