Load() public static method

Loads a .nuspec file inside the given stream.
public static Load ( Stream stream ) : NuspecFile
stream System.IO.Stream The stream containing the .nuspec file to load.
return NuspecFile
コード例 #1
0
        /// <summary>
        /// Reload the currently selected asset as a .nuspec file.
        /// </summary>
        protected void Reload()
        {
            var defaultAsset = Selection.activeObject as DefaultAsset;

            if (defaultAsset != null)
            {
                var assetFilepath = AssetDatabase.GetAssetPath(defaultAsset);
                var dataPath      = Application.dataPath.Substring(0, Application.dataPath.Length - "Assets".Length);
                assetFilepath = Path.Combine(dataPath, assetFilepath);

                var isNuspec = Path.GetExtension(assetFilepath) == ".nuspec";

                if (!isNuspec || nuspec != null && filepath == assetFilepath)
                {
                    return;
                }

                filepath     = assetFilepath;
                nuspec       = NuspecFile.Load(filepath);
                titleContent = new GUIContent(Path.GetFileNameWithoutExtension(filepath));

                // force a repaint
                Repaint();
            }
        }
コード例 #2
0
        /// <summary>
        /// Automatically called by Unity when the Inspector is first opened (when a .nuspec file is clicked on in the Project view).
        /// </summary>
        public void OnEnable()
        {
            filepath = AssetDatabase.GetAssetPath(target);
            string dataPath = Application.dataPath.Substring(0, Application.dataPath.Length - "Assets".Length);

            filepath = Path.Combine(dataPath, filepath);

            isNuspec = Path.GetExtension(filepath) == ".nuspec";
            if (isNuspec)
            {
                nuspec = NuspecFile.Load(filepath);
            }
        }