ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/RomCheater/trunk/RomCheater.CheatPlugin/CheatCodePlugin.cs
Revision: 812
Committed: Tue Apr 15 14:52:10 2014 UTC (9 years, 7 months ago) by william
File size: 3220 byte(s)
Log Message:
+ update logging to use Enterpise.Logging -- more work is still needed

File Contents

# Content
1 #region Logging Defines
2 // include this any class or method that required logging, and comment-out what is not needed
3 #define LOGGING_ENABLED // this is only valid within the logger class
4 #region Enabled logging levels
5 #define LOGGING_ENABLE_INFO
6 #define LOGGING_ENABLE_WARN
7 #define LOGGING_ENABLE_DEBUG
8 #define LOGGING_ENABLE_VERBOSEDEBUG
9 #define LOGGING_ENABLE_ERROR
10 #define LOGGING_ENABLE_VERBOSEERROR
11 #define LOGGING_ENABLE_PROFILER
12 #endregion
13 #endregion
14
15 //#define PLUGIN_ENABLED // when defined the plugin is enabled, otherwise it will not be shown
16 using System;
17 using System.Collections.Generic;
18 using System.Linq;
19 using System.Text;
20 using RomCheater.PluginFramework.Core;
21 using WeifenLuo.WinFormsUI.Docking;
22 using Enterprise.Logging;
23
24 namespace RomCheater.CheatPlugin
25 {
26 public class CheatCodePlugin : UserControlPlugin
27 {
28 CheatCodeDockContent t;
29 const string name = "Cheat Code Converter Plugin";
30 const string description = "A simple plugin to allow the conversion of cheat codes to one or more formats";
31
32 public CheatCodePlugin() : base() { t = new CheatCodeDockContent(this); }
33 public override Guid ID
34 {
35 get { return AssemblyGuid.GetGuid(typeof(CheatCodePlugin)); }
36 //get { return new Guid(); }
37 }
38 public override string Name
39 {
40 get
41 {
42 return name;
43 }
44 }
45 public override string Description
46 {
47 get
48 {
49 return description;
50 }
51 }
52 public override void Reload(bool silent)
53 {
54 }
55
56 public override void Config()
57 {
58 gLog.Warn.WriteLine("Plugin: '{0}' guid: '{1}' - has no configurable settings", name, ID);
59 }
60
61 public override void Show() { Show(null); }
62 public override void Show(DockPanel dockPanel) { Show(dockPanel, DockState.Document); }
63 public override void Show(DockPanel dockPanel, DockState dockState) { InternalShow(dockPanel, dockState); }
64 private void InternalShow(DockPanel dockPanel, DockState dockState)
65 {
66 #if PLUGIN_ENABLED
67 if (dockPanel == null)
68 {
69 t.Show();
70 }
71 else
72 {
73 t.Show(dockPanel, dockState);
74 }
75 #else
76 gLog.Warn.WriteLine("Plugin: '{0}' guid: '{1}' - is currently disabled [it has not been implemented yet]", name, ID);
77 #endif
78 }
79
80 public override void Activate()
81 {
82 DockContentHandler handler = this.DockHandler;
83 if (handler != null)
84 handler.Activate();
85 }
86 public override void Close()
87 {
88 DockContentHandler handler = this.DockHandler;
89 if (handler != null)
90 handler.Close();
91 }
92 public override DockContentHandler DockHandler
93 {
94 get
95 {
96 if (t == null || t.DockHandler == null) return null;
97 return t.DockHandler;
98 }
99 }
100 }
101 }