瀏覽代碼

Added ApiPort and ServerHostName to ApiClient

LukePulverenti Luke Pulverenti luke pulverenti 13 年之前
父節點
當前提交
80fd8d0156
共有 2 個文件被更改,包括 19 次插入3 次删除
  1. 17 1
      MediaBrowser.ApiInteraction/BaseClient.cs
  2. 2 2
      MediaBrowser.Common/Kernel/BaseKernel.cs

+ 17 - 1
MediaBrowser.ApiInteraction/BaseClient.cs

@@ -8,7 +8,23 @@ namespace MediaBrowser.ApiInteraction
     /// </summary>
     /// </summary>
     public abstract class BaseClient : IDisposable
     public abstract class BaseClient : IDisposable
     {
     {
-        public string ApiUrl { get; set; }
+        /// <summary>
+        /// Gets or sets the server host name (myserver or 192.168.x.x)
+        /// </summary>
+        public string ServerHostName { get; set; }
+
+        /// <summary>
+        /// Gets or sets the port number used by the API
+        /// </summary>
+        public int ApiPort { get; set; }
+
+        protected string ApiUrl
+        {
+            get
+            {
+                return string.Format("http://{0}:{1}/mediabrowser/api", ServerHostName, ApiPort);
+            }
+        }
 
 
         protected HttpClient HttpClient { get; private set; }
         protected HttpClient HttpClient { get; private set; }
 
 

+ 2 - 2
MediaBrowser.Common/Kernel/BaseKernel.cs

@@ -214,7 +214,7 @@ namespace MediaBrowser.Common.Kernel
         /// <summary>
         /// <summary>
         /// Reloads application configuration from the config file
         /// Reloads application configuration from the config file
         /// </summary>
         /// </summary>
-        private void ReloadConfiguration()
+        protected virtual void ReloadConfiguration()
         {
         {
             // Deserialize config
             // Deserialize config
             if (!File.Exists(ConfigurationPath))
             if (!File.Exists(ConfigurationPath))
@@ -270,7 +270,7 @@ namespace MediaBrowser.Common.Kernel
         /// <summary>
         /// <summary>
         /// Disposes all resources currently in use.
         /// Disposes all resources currently in use.
         /// </summary>
         /// </summary>
-        public void Dispose()
+        public virtual void Dispose()
         {
         {
             DisposeHttpServer();
             DisposeHttpServer();
             DisposeLogger();
             DisposeLogger();