diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Framework/GcNotify.cs (renamed from OpenSim/Region/Framework/Scenes/Animation/AvatarAnimations.cs) | 57 |
1 files changed, 28 insertions, 29 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Animation/AvatarAnimations.cs b/OpenSim/Framework/GcNotify.cs index 659c3a5..14a22a6 100644 --- a/OpenSim/Region/Framework/Scenes/Animation/AvatarAnimations.cs +++ b/OpenSim/Framework/GcNotify.cs | |||
@@ -25,39 +25,38 @@ | |||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System.Collections.Generic; | 28 | using System; |
29 | using System.Xml; | 29 | using System.Reflection; |
30 | using OpenMetaverse; | 30 | using log4net; |
31 | 31 | ||
32 | namespace OpenSim.Region.Framework.Scenes.Animation | 32 | public class GcNotify |
33 | { | 33 | { |
34 | public class AvatarAnimations | 34 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
35 | |||
36 | public static bool Enabled | ||
35 | { | 37 | { |
36 | public Dictionary<string, UUID> AnimsUUID = new Dictionary<string, UUID>(); | 38 | get { return s_initialized; } |
37 | public Dictionary<UUID, string> AnimsNames = new Dictionary<UUID, string>(); | 39 | set |
38 | public Dictionary<UUID, string> AnimStateNames = new Dictionary<UUID, string>(); | 40 | { |
41 | if (!s_initialized && value) | ||
42 | new GcNotify(); | ||
43 | |||
44 | s_initialized = value; | ||
45 | } | ||
46 | } | ||
39 | 47 | ||
40 | public AvatarAnimations() | 48 | private static bool s_initialized = false; |
49 | |||
50 | private GcNotify() {} | ||
51 | |||
52 | ~GcNotify() | ||
53 | { | ||
54 | if (!Environment.HasShutdownStarted && !AppDomain.CurrentDomain.IsFinalizingForUnload()) | ||
41 | { | 55 | { |
42 | using (XmlTextReader reader = new XmlTextReader("data/avataranimations.xml")) | 56 | m_log.DebugFormat("[GC NOTIFY]: Garbage collection triggered."); |
43 | { | 57 | |
44 | XmlDocument doc = new XmlDocument(); | 58 | if (Enabled) |
45 | doc.Load(reader); | 59 | new GcNotify(); |
46 | foreach (XmlNode nod in doc.DocumentElement.ChildNodes) | ||
47 | { | ||
48 | if (nod.Attributes["name"] != null) | ||
49 | { | ||
50 | string name = (string)nod.Attributes["name"].Value; | ||
51 | UUID id = (UUID)nod.InnerText; | ||
52 | string animState = (string)nod.Attributes["state"].Value; | ||
53 | |||
54 | AnimsUUID.Add(name, id); | ||
55 | AnimsNames.Add(id, name); | ||
56 | if (animState != "") | ||
57 | AnimStateNames.Add(id, animState); | ||
58 | } | ||
59 | } | ||
60 | } | ||
61 | } | 60 | } |
62 | } | 61 | } |
63 | } | 62 | } \ No newline at end of file |