Elin Decompiled Documentation EA 23.312 Nightly Patch 4
Loading...
Searching...
No Matches
CustomFileContent.cs
Go to the documentation of this file.
1using System;
2using System.IO;
3using Newtonsoft.Json;
4using UnityEngine;
5
6public abstract class CustomFileContent : CustomContent
7{
8 protected DateTime LastModified { get; set; } = DateTime.MinValue;
9
10
11 [JsonIgnore]
12 public FileInfo File { get; set; }
13
14 public bool HasFileChanged()
15 {
16 File.Refresh();
17 return File.LastWriteTimeUtc != LastModified;
18 }
19
20 public virtual void OnSetLang(string lang)
21 {
22 }
23
24 public void Load()
25 {
26 if (!HasFileChanged())
27 {
28 return;
29 }
30 try
31 {
33 }
34 catch (Exception message)
35 {
36 ModUtil.LogModError("exception while loading file '" + base.ContentId + "'", base.Owner);
37 Debug.LogError(message);
38 }
39 finally
40 {
41 LastModified = File.LastWriteTimeUtc;
42 }
43 }
44
45 protected abstract void LoadContent();
46}
virtual void OnSetLang(string lang)
abstract void LoadContent()