OnDeserialize() публичный Метод

public OnDeserialize ( ) : void
Результат void
Пример #1
0
        public static BuildInfo OpenSerializedBuildInfo(string serializedBuildInfoFilePath, bool fromMainThread = true)
        {
            BuildInfo ret = null;

            XmlSerializer x = new XmlSerializer(typeof(BuildInfo));

            string correctedXmlData = FixXmlBuildReportFile(serializedBuildInfoFilePath);

            try
            {
                // when the string has contents, it means there were corrections to the xml data
                // and we should load that updated content instead of reading the file
                if (!string.IsNullOrEmpty(correctedXmlData))
                {
                    TextReader reader = new StringReader(correctedXmlData);
                    ret = (BuildInfo)x.Deserialize(reader);
                }
                else
                {
                    // no corrections in the xml file
                    // proceed to open the file normally
                    using (FileStream fs = new FileStream(serializedBuildInfoFilePath, FileMode.Open))
                    {
                        XmlReader reader = new XmlTextReader(fs);
                        ret = (BuildInfo)x.Deserialize(reader);
                        fs.Close();
                    }
                }
            }
            catch (Exception e)
            {
                Debug.LogError(e);
            }

            if (fromMainThread)
            {
                if (BuildInfoHasContents(ret))
                {
                    ret.OnDeserialize();
                    ret.SetSavedPath(serializedBuildInfoFilePath);
                }
                else
                {
                    Debug.LogError("Build Report Tool: Invalid data in build info file: " + serializedBuildInfoFilePath);
                }
            }

            return(ret);
        }
Пример #2
0
        public static BuildInfo OpenSerializedBuildInfo(string serializedBuildInfoFilePath, bool fromMainThread = true)
        {
            BuildInfo ret = null;

            XmlSerializer x = new XmlSerializer(typeof(BuildInfo));

            string correctedXmlData = FixXmlBuildReportFile(serializedBuildInfoFilePath);

            try
            {
                if (!string.IsNullOrEmpty(correctedXmlData))
                {
                    TextReader reader = new StringReader(correctedXmlData);
                    ret = (BuildInfo)x.Deserialize(reader);
                }
                else
                {
                    using (FileStream fs = new FileStream(serializedBuildInfoFilePath, FileMode.Open))
                    {
                        XmlReader reader = new XmlTextReader(fs);
                        ret = (BuildInfo)x.Deserialize(reader);
                        fs.Close();
                    }
                }
            }
            catch (Exception e)
            {
                Debug.LogError(e);
            }

            if (fromMainThread)
            {
                if (BuildInfoHasContents(ret))
                {
                    ret.OnDeserialize();
                    ret.SetSavedPath(serializedBuildInfoFilePath);
                }
                else
                {
                    Debug.LogError("Build Report Tool: Invalid data in build info file: " + serializedBuildInfoFilePath);
                }
            }

            return(ret);
        }
Пример #3
0
    void OnFinishOpeningBuildReportFile()
    {
        _finishedOpeningFromThread = false;

        if (BuildReportTool.Util.BuildInfoHasContents(_buildInfo))
        {
            _buildSettingsScreen.RefreshData(_buildInfo);
            _usedAssetsScreen.RefreshData(_buildInfo);
            _unusedAssetsScreen.RefreshData(_buildInfo);
            _sizeStatsScreen.RefreshData(_buildInfo);


            _buildInfo.OnDeserialize();
            _buildInfo.SetSavedPath(_lastOpenedBuildInfoFilePath);
        }
        Repaint();
        GoToOverviewScreen();
    }