Protogame.RawOgmoEditorLevelLoadStrategy.AttemptLoad C# (CSharp) Méthode

AttemptLoad() public méthode

The attempt load.
public AttemptLoad ( string path, string name, System.DateTime &lastModified, bool noTranslate = false ) : IRawAsset
path string /// The path. ///
name string /// The name. ///
lastModified System.DateTime
noTranslate bool
Résultat IRawAsset
        public IRawAsset AttemptLoad(string path, string name, ref DateTime? lastModified, bool noTranslate = false)
        {
            var file = new FileInfo(Path.Combine(path, (noTranslate ? name : name.Replace('.', Path.DirectorySeparatorChar)) + ".oel"));
            if (file.Exists)
            {
                lastModified = file.LastWriteTime;
                using (var fileStream = new FileStream(file.FullName, FileMode.Open, FileAccess.Read))
                {
                    using (var reader = new StreamReader(fileStream))
                    {
                        return
                            new AnonymousObjectBasedRawAsset(
                                new
                                {
                                    Loader = typeof(LevelAssetLoader).FullName,
                                    PlatformData = (PlatformData)null,
                                    LevelData = reader.ReadToEnd(),
                                    LevelDataFormat = LevelDataFormat.OgmoEditor,
                                    SourcePath = (string)null,
                                    SourcedFromRaw = true
                                });
                    }
                }
            }

            return null;
        }
RawOgmoEditorLevelLoadStrategy