Exemple #1
0
 public EsmFile(StreamSink streamSink, string filePath, TesGame game)
     : base(streamSink, !string.IsNullOrEmpty(filePath) ? new BinaryFileReader(File.Open(filePath, FileMode.Open, FileAccess.Read, FileShare.Read)) : null, filePath, ToFormat(game), 1, 0)
 {
     //void process()
     //{
     //    var watch = new Stopwatch(); watch.Start();
     //    Core.Debug.Log($"Loading: {watch.ElapsedMilliseconds}");
     //    Process();
     //    watch.Stop();
     //}
     if (_streamSink is StreamSinkServer)
     {
         return;
     }
     if (_streamSink is StreamSinkClient)
     {
         SinkDataContains(null);
         Process();
         return;
     }
     if (filePath == null)
     {
         return;
     }
     Read();
     Process();
 }
Exemple #2
0
        internal static GameFormat ToFormat(TesGame game)
        {
            switch (game)
            {
            // tes
            case TesGame.Morrowind: return(GameFormat.TES3);

            case TesGame.Oblivion: return(GameFormat.TES4);

            case TesGame.Skyrim:
            case TesGame.SkyrimSE:
            case TesGame.SkyrimVR: return(GameFormat.TES5);

            // fallout
            case TesGame.Fallout3:
            case TesGame.FalloutNV: return(GameFormat.TES4);

            case TesGame.Fallout4:
            case TesGame.Fallout4VR: return(GameFormat.TES5);

            default: throw new InvalidOperationException();
            }
        }
Exemple #3
0
 public TesDataPack(ProxySink proxySink, string filePath, TesGame game) : base(proxySink, !string.IsNullOrEmpty(filePath) && File.Exists(filePath) ? filePath : null, game)
 {
 }
 public static string[] GetFilePaths(bool many, string pathOrPattern, TesGame game) =>
 _fileDirectories.TryGetValue(game, out var fileDirectory)
         ? many ? Directory.GetFiles(fileDirectory, pathOrPattern) : File.Exists(pathOrPattern = Path.Combine(fileDirectory, pathOrPattern)) ? new[] { pathOrPattern } : null
         : null;