Server.Core.FindDataFile C# (CSharp) Méthode

FindDataFile() public static méthode

public static FindDataFile ( string path ) : string
path string
Résultat string
        public static string FindDataFile( string path )
        {
            if( m_DataDirectories.Count == 0 )
                throw new InvalidOperationException( "Attempted to FindDataFile before DataDirectories list has been filled." );

            string fullPath = null;

            for( int i = 0; i < m_DataDirectories.Count; ++i )
            {
                fullPath = Path.Combine( m_DataDirectories[i], path );

                if( File.Exists( fullPath ) )
                    break;

                fullPath = null;
            }

            return fullPath;
        }

Usage Example

Exemple #1
0
        public TileMatrixPatch(TileMatrix matrix, int index)
        {
            if (PatchLandEnabled)
            {
                var mapDataPath  = Core.FindDataFile($"mapdif{index}.mul", false);
                var mapIndexPath = Core.FindDataFile($"mapdifl{index}.mul", false);

                if (mapDataPath != null && mapIndexPath != null)
                {
                    LandBlocks = PatchLand(matrix, mapDataPath, mapIndexPath);
                }
            }

            if (PatchStaticsEnabled)
            {
                var staDataPath   = Core.FindDataFile($"stadif{index}.mul", false);
                var staIndexPath  = Core.FindDataFile($"stadifl{index}.mul", false);
                var staLookupPath = Core.FindDataFile($"stadifi{index}.mul", false);

                if (staDataPath != null && staIndexPath != null && staLookupPath != null)
                {
                    StaticBlocks = PatchStatics(matrix, staDataPath, staIndexPath, staLookupPath);
                }
            }
        }
All Usage Examples Of Server.Core::FindDataFile