Elin Decompiled Documentation EA 23.342.1 Nightly
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 [JsonIgnore]
11 public FileInfo File { get; set; }
12
13 public bool HasFileChanged()
14 {
15 File.Refresh();
16 return File.LastWriteTimeUtc != LastModified;
17 }
18
19 public virtual void OnSetLang(string lang)
20 {
21 }
22
23 public void Load()
24 {
25 if (!HasFileChanged())
26 {
27 return;
28 }
29 try
30 {
32 }
33 catch (Exception exception)
34 {
35 ModUtil.LogModError("exception while loading file '" + base.ContentId + "'", base.Owner);
36 Debug.LogException(exception);
37 }
38 finally
39 {
40 LastModified = File.LastWriteTimeUtc;
41 }
42 }
43
44 protected abstract void LoadContent();
45}
virtual void OnSetLang(string lang)
abstract void LoadContent()