| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace IACommService4CSharp
- {
- public class GeneralConfig_t : IDisposable
- {
- private IGeneralConfig4CSharp m_config;
- private bool m_disposed;
- public GeneralConfig_t()
- {
- m_config = GeneralConfigFactory4CSharp.Create();
- if (null == m_config)
- throw new IACommServiceException(ErrorCode.InternalError);
- m_disposed = false;
- }
- ~GeneralConfig_t()
- {
- Dispose(false);
- }
- public uint SetParameter(string name, string value)
- {
- if (null == m_config)
- return ErrorCode.InvalidState;
- if (null == name || null == value)
- return ErrorCode.InvalidArgument;
- return m_config.SetParameter(name, value);
- }
- public string GetParameter(string name)
- {
- if (null == m_config || null == name)
- {
- return null;
- }
- return m_config.GetParameter(name);
- }
- public uint RemoveParameter(string name)
- {
- if (null == m_config)
- return ErrorCode.InvalidState;
- if (null == name)
- return ErrorCode.InvalidArgument;
- return m_config.RemoveParameter(name);
- }
- public void RemoveAll()
- {
- if (null != m_config)
- {
- m_config.RemoveAll();
- }
- }
- public void Dispose()
- {
- Dispose(true);
- GC.SuppressFinalize(this);
- }
- protected virtual void Dispose(bool disposeManaged)
- {
- if (!m_disposed)
- {
- if (disposeManaged)
- {
- //do nothing
- }
- GeneralConfigFactory4CSharp.Destroy(m_config);
- m_config = null;
- m_disposed = true;
- }
- }
- //Internal use
- public IGeneralConfig4CSharp Internal
- {
- get
- {
- return m_config;
- }
- }
- }
- }
|