/[RomCheater]/trunk/RomCheater.CheatPlugin/CheatCodePlugin.cs
ViewVC logotype

Annotation of /trunk/RomCheater.CheatPlugin/CheatCodePlugin.cs

Parent Directory Parent Directory | Revision Log Revision Log


Revision 855 - (hide annotations) (download)
Tue Sep 16 21:09:17 2014 UTC (6 years, 1 month ago) by william
File size: 3316 byte(s)
+ add support in UserControlDock to save and restore the user plugin layout

1 william 443 #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 william 442 using System;
17 william 437 using System.Collections.Generic;
18     using System.Linq;
19     using System.Text;
20     using RomCheater.PluginFramework.Core;
21 william 440 using WeifenLuo.WinFormsUI.Docking;
22 william 812 using Enterprise.Logging;
23 william 437
24     namespace RomCheater.CheatPlugin
25     {
26     public class CheatCodePlugin : UserControlPlugin
27     {
28 william 717 CheatCodeDockContent t;
29 william 437 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 william 717 public CheatCodePlugin() : base() { t = new CheatCodeDockContent(this); }
33 william 437 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 william 440
56     public override void Config()
57     {
58 william 812 gLog.Warn.WriteLine("Plugin: '{0}' guid: '{1}' - has no configurable settings", name, ID);
59 william 440 }
60    
61 william 442 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 william 440 {
66 william 717 #if PLUGIN_ENABLED
67 william 442 if (dockPanel == null)
68     {
69     t.Show();
70     }
71     else
72     {
73     t.Show(dockPanel, dockState);
74     }
75     #else
76 william 812 gLog.Warn.WriteLine("Plugin: '{0}' guid: '{1}' - is currently disabled [it has not been implemented yet]", name, ID);
77 william 442 #endif
78 william 440 }
79 william 717
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 william 855 set
100     {
101     t.DockHandler = value;
102     }
103 william 717 }
104 william 437 }
105     }

  ViewVC Help
Powered by ViewVC 1.1.22