Jypeli 10
The simple game programming library
NameHelpers.cs
Siirry tämän tiedoston dokumentaatioon.
1using System;
2using System.Text;
3using System.IO;
4
5namespace Jypeli
6{
7 public partial class FileManager
8 {
9 internal static string SanitizeFileName( string fileName )
10 {
11 StringBuilder newName = new StringBuilder( fileName );
12 newName.Replace( "[]", "Array" ).Replace( "()", "Func" );
13
14 for ( int i = 0; i < newName.Length; i++ )
15 {
16 char c = newName[i];
17 if ( !Char.IsLetterOrDigit( c ) && c != '-' && c != '_' && c != '.' )
18 newName[i] = '_';
19 }
20
21 return newName.ToString();
22 }
23
24 internal void MakeAbsolute( ref string path )
25 {
26 if ( !Path.IsPathRooted( path ) )
27#if WINDOWS_STOREAPP
28 path = Path.Combine( _currentDir, path );
29#else
30 path = Path.GetFullPath( Path.Combine( _currentDir, path ) );
31#endif
32 }
33 }
34}
static string SanitizeFileName(string fileName)
Definition: NameHelpers.cs:9
void MakeAbsolute(ref string path)
Definition: NameHelpers.cs:24