当前位置: 首页>>代码示例>>C#>>正文


C# ISource.ToString方法代码示例

本文整理汇总了C#中ISource.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# ISource.ToString方法的具体用法?C# ISource.ToString怎么用?C# ISource.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ISource的用法示例。


在下文中一共展示了ISource.ToString方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Load

 /// <summary>
 /// Loads an asset supported by this loader
 /// </summary>
 /// <param name="source">Asset source</param>
 /// <param name="parameters">Asset load parameters</param>
 /// <returns>
 /// If the parameters specify "returnTextureDataOnly" as true  (<see cref="TextureLoadParameters.ReturnTextureDataOnly"/>),
 /// the method returns an array of <see cref="Texture2dData"/> or <see cref="Texture3dData"/>. If the "returnTextureDataOnly" 
 /// is false, or does not exist, this method returns an <see cref="ITexture"/> object.
 /// </returns>
 public unsafe override object Load( ISource source, LoadParameters parameters )
 {
     bool generateMipMaps = DynamicProperties.GetProperty( parameters.Properties, TextureLoadParameters.GenerateMipMapsPropertyName, false );
     bool returnTextureData = DynamicProperties.GetProperty( parameters.Properties, TextureLoadParameters.ReturnTextureDataOnlyName, false );
     using ( Stream stream = ( ( IStreamSource )source ).Open( ) )
     {
         return TextureReader.ReadTextureFromStream( source.ToString( ), stream, returnTextureData, generateMipMaps );
     }
 }
开发者ID:johann-gambolputty,项目名称:robotbastards,代码行数:19,代码来源:Loader.cs

示例2: CanLoad

 /// <summary>
 /// Returns true if this loader can load the asset at the specified location
 /// </summary>
 /// <param name="source">Source of the asset</param>
 /// <returns>Returns true if this loader can process the specified source</returns>
 public virtual bool CanLoad( ISource source )
 {
     string sourceStr = source.ToString( );
     foreach ( string ext in Extensions )
     {
         if ( sourceStr.EndsWith( ext, StringComparison.CurrentCultureIgnoreCase ) )
         {
             return true;
         }
     }
     return false;
 }
开发者ID:johann-gambolputty,项目名称:robotbastards,代码行数:17,代码来源:AssetLoader.cs

示例3: GetSourceName

        private static string GetSourceName( ISource source )
        {
            string path = source.ToString( );

            char lastChar = path[ path.Length - 1 ];
            if ( ( lastChar == '/' ) || ( lastChar == '\\' ) )
            {
                path = path.Remove( path.Length - 1 );
            }

            return path.Substring( path.LastIndexOfAny( new char[] { '\\', '/' } ) + 1 );
        }
开发者ID:johann-gambolputty,项目名称:robotbastards,代码行数:12,代码来源:LocationTreeNode.cs

示例4: LoadMd3

        /// <summary>
        /// Loads an MD3 mesh resource from a stream
        /// </summary>
        private static ModelMesh LoadMd3( ISource source, Model model, ModelPart part, Matrix44 transform, ISource md3Source, IDictionary<string, ITexture2d> surfaceTextureTable )
        {
            using ( Stream inputStream = OpenStream( md3Source ) )
            {
                BinaryReader reader = new BinaryReader( inputStream );

                //	http://icculus.org/homepages/phaethon/q3a/formats/md3format.html

                //	Make sure of the MD3 identity
                byte[] ident		= reader.ReadBytes( 4 );
                if ( ( ident[ 0 ] != 'I' ) || ( ident[ 1 ] != 'D' ) || ( ident[ 2 ] != 'P' ) || ( ident[ 3 ] != '3' ) )
                {
                    throw new ApplicationException( "Failed to load MD3 resource - stream did not start with 'IDP3' MD3 identifier" );
                }

                //	Read in header
                //int version			=
                reader.ReadInt32( );
                //string name			=
                ReadString( reader, MaxPathLength );
                //int flags			=
                reader.ReadInt32( );
                int numFrames		= reader.ReadInt32( );
                int numTags			= reader.ReadInt32( );
                int numSurfaces		= reader.ReadInt32( );
                //int numSkins		=
                reader.ReadInt32( );
                int framesOffset	= reader.ReadInt32( );
                int tagsOffset		= reader.ReadInt32( );
                int surfacesOffset	= reader.ReadInt32( );
                //int eofOffset		=
                reader.ReadInt32( );

                //	TODO: Can load directly into mesh frame, tag and surface structures - don't do this intermediate step
                ModelMesh mesh = new ModelMesh( model, part );

                ReadFrames( reader, framesOffset, numFrames, mesh, transform );
                ReadTags( reader, tagsOffset, numTags, numFrames, mesh, transform );
                ReadSurfaces( source, reader, surfacesOffset, numSurfaces, numFrames, mesh, surfaceTextureTable, transform );

                //	TODO: REMOVE. test frames
                string md3Name = md3Source.ToString( );
                if ( md3Name.IndexOf( "Upper" ) != -1 )
                {
                    mesh.DefaultFrame = 151;
                }
                else if ( md3Name.IndexOf( "Head" ) != -1 )
                {
                    mesh.DefaultFrame = 0;
                }
                else
                {
                    mesh.DefaultFrame = 0;
                }

                return mesh;
            }
        }
开发者ID:johann-gambolputty,项目名称:robotbastards,代码行数:61,代码来源:Loader.cs


注:本文中的ISource.ToString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。