Elin Decompiled Documentation EA 23.102 Nightly
Loading...
Searching...
No Matches
ModItem< T > Class Template Reference

Public Member Functions

 ModItem (FileInfo _fileInfo, string path=null, ModItemList< T > _list=null, string desiredID=null)
 
void Set (FileInfo _fileInfo, string path, string desiredID=null)
 
GetObject (object option=null)
 
void ClearCache ()
 

Public Attributes

ModItemList< T > list
 
string category
 
string id
 
string resourcePath
 
string parent
 
string parentParent
 
FileInfo fileInfo
 
cache
 

Detailed Description

Type Constraints
T :Object 

Definition at line 4 of file ModItem.cs.

Constructor & Destructor Documentation

◆ ModItem()

ModItem< T >.ModItem ( FileInfo  _fileInfo,
string  path = null,
ModItemList< T >  _list = null,
string  desiredID = null 
)
inline

Definition at line 22 of file ModItem.cs.

23 {
24 list = _list;
25 resourcePath = path;
26 Set(_fileInfo, path, desiredID);
27 }
void Set(FileInfo _fileInfo, string path, string desiredID=null)
Definition: ModItem.cs:29
ModItemList< T > list
Definition: ModItem.cs:6
string resourcePath
Definition: ModItem.cs:12

References ModItem< T >.list, ModItem< T >.resourcePath, and ModItem< T >.Set().

Member Function Documentation

◆ ClearCache()

void ModItem< T >.ClearCache ( )
inline

Definition at line 65 of file ModItem.cs.

66 {
67 if (list == null)
68 {
69 if ((bool)cache)
70 {
71 Object.DestroyImmediate(cache);
72 }
73 }
74 else
75 {
76 list.cache.Clear();
77 }
78 }
T cache
Definition: ModItem.cs:20

References ModItem< T >.cache, and ModItem< T >.list.

◆ GetObject()

T ModItem< T >.GetObject ( object  option = null)
inline

Definition at line 44 of file ModItem.cs.

45 {
46 if (fileInfo == null)
47 {
48 return null;
49 }
50 if (list == null)
51 {
52 if (cache == null)
53 {
54 cache = IO.LoadObject<T>(fileInfo, option);
55 }
56 return cache;
57 }
58 if (resourcePath != null)
59 {
60 return list.cache.Get(resourcePath, ResourceLoadType.Resource, option);
61 }
62 return list.cache.Get(fileInfo.FullName, ResourceLoadType.Streaming, option);
63 }
ResourceLoadType
Definition: IO.cs:11
FileInfo fileInfo
Definition: ModItem.cs:18

References ModItem< T >.cache, ModItem< T >.fileInfo, ModItem< T >.list, and ModItem< T >.resourcePath.

◆ Set()

void ModItem< T >.Set ( FileInfo  _fileInfo,
string  path,
string  desiredID = null 
)
inline

Definition at line 29 of file ModItem.cs.

30 {
31 if (_fileInfo != null)
32 {
33 fileInfo = _fileInfo;
34 parent = ((fileInfo != null) ? fileInfo.Directory.Name : Path.GetDirectoryName(path));
35 parentParent = ((fileInfo != null) ? fileInfo.Directory.Parent.Name : Path.GetDirectoryName(path.Split('/')[0]));
36 id = desiredID ?? Path.GetFileNameWithoutExtension((fileInfo != null) ? fileInfo.Name : path);
37 if (list != null && list.catLength > 0)
38 {
39 category = id.Substring(0, list.catLength);
40 }
41 }
42 }
string parentParent
Definition: ModItem.cs:16
string parent
Definition: ModItem.cs:14
string category
Definition: ModItem.cs:8

References ModItem< T >.category, ModItem< T >.fileInfo, ModItem< T >.list, ModItem< T >.parent, and ModItem< T >.parentParent.

Referenced by ModItem< T >.ModItem().

Member Data Documentation

◆ cache

T ModItem< T >.cache

Definition at line 20 of file ModItem.cs.

Referenced by ModItem< T >.ClearCache(), and ModItem< T >.GetObject().

◆ category

string ModItem< T >.category

Definition at line 8 of file ModItem.cs.

Referenced by ModItemList< T >.GetRandomID(), and ModItem< T >.Set().

◆ fileInfo

FileInfo ModItem< T >.fileInfo

Definition at line 18 of file ModItem.cs.

Referenced by ModItem< T >.GetObject(), and ModItem< T >.Set().

◆ id

◆ list

◆ parent

string ModItem< T >.parent

Definition at line 14 of file ModItem.cs.

Referenced by ModItem< T >.Set().

◆ parentParent

string ModItem< T >.parentParent

Definition at line 16 of file ModItem.cs.

Referenced by ModItem< T >.Set().

◆ resourcePath

string ModItem< T >.resourcePath

Definition at line 12 of file ModItem.cs.

Referenced by ModItem< T >.GetObject(), and ModItem< T >.ModItem().


The documentation for this class was generated from the following file: