Преглед изворни кода

Uncommented ReloadConfiguration and updated GetAllUsers to return a dummy user, in order to unblock UI development.

LukePulverenti Luke Pulverenti luke pulverenti пре 13 година
родитељ
комит
23a4c9af21

+ 11 - 19
MediaBrowser.Common/Kernel/BaseKernel.cs

@@ -145,26 +145,18 @@ namespace MediaBrowser.Common.Kernel
         {
         {
             //Configuration information for anything other than server-specific configuration will have to come via the API... -ebr
             //Configuration information for anything other than server-specific configuration will have to come via the API... -ebr
 
 
-            //// Deserialize config
-            //if (!File.Exists(ConfigurationPath))
-            //{
-            //    Configuration = new TConfigurationType();
-            //}
-            //else
-            //{
-            //    Configuration = JsonSerializer.DeserializeFromFile<TConfigurationType>(ConfigurationPath);
-            //}
-
-            //Logger.LoggerInstance.LogSeverity = Configuration.LogSeverity;
-        }
+            // Deserialize config
+            if (!File.Exists(ApplicationPaths.ConfigurationPath))
+            {
+                Configuration = new TConfigurationType();
+            }
+            else
+            {
+                Configuration = JsonSerializer.DeserializeFromFile<TConfigurationType>(ApplicationPaths.ConfigurationPath);
+            }
 
 
-        /// <summary>
-        /// Saves the current application configuration to the config file
-        /// </summary>
-        //public void SaveConfiguration()
-        //{
-        //    JsonSerializer.SerializeToFile(Configuration, ConfigurationPath);
-        //}
+            Logger.LoggerInstance.LogSeverity = Configuration.LogSeverity;
+        }
 
 
         /// <summary>
         /// <summary>
         /// Restarts the Http Server, or starts it if not currently running
         /// Restarts the Http Server, or starts it if not currently running

+ 92 - 0
MediaBrowser.Common/MediaBrowser.Common.csproj.orig

@@ -0,0 +1,92 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProjectGuid>{9142EEFA-7570-41E1-BFCC-468BB571AF2F}</ProjectGuid>
+    <OutputType>Library</OutputType>
+    <AppDesignerFolder>Properties</AppDesignerFolder>
+    <RootNamespace>MediaBrowser.Common</RootNamespace>
+    <AssemblyName>MediaBrowser.Common</AssemblyName>
+    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
+    <FileAlignment>512</FileAlignment>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>bin\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>bin\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="ServiceStack.Text, Version=3.9.3.0, Culture=neutral, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\packages\ServiceStack.Text.3.9.3\lib\net35\ServiceStack.Text.dll</HintPath>
+    </Reference>
+    <Reference Include="System" />
+    <Reference Include="System.ComponentModel.Composition" />
+    <Reference Include="System.Configuration" />
+    <Reference Include="System.Core" />
+    <Reference Include="System.Reactive, Version=1.0.10621.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\packages\Rx-Main.1.0.11226\lib\Net4\System.Reactive.dll</HintPath>
+    </Reference>
+    <Reference Include="System.Xml.Linq" />
+    <Reference Include="System.Data.DataSetExtensions" />
+    <Reference Include="Microsoft.CSharp" />
+    <Reference Include="System.Data" />
+    <Reference Include="System.Xml" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="Configuration\ApplicationPaths.cs" />
+    <Compile Include="Configuration\BaseApplicationConfiguration.cs" />
+    <Compile Include="Events\GenericItemEventArgs.cs" />
+    <Compile Include="Serialization\JsonSerializer.cs" />
+    <Compile Include="Kernel\BaseKernel.cs" />
+    <Compile Include="Kernel\KernelContext.cs" />
+    <Compile Include="Logging\BaseLogger.cs" />
+    <Compile Include="Logging\Logger.cs" />
+    <Compile Include="Logging\LogRow.cs" />
+    <Compile Include="Logging\LogSeverity.cs" />
+    <Compile Include="Logging\StreamLogger.cs" />
+    <Compile Include="Net\CollectionExtensions.cs" />
+    <Compile Include="Net\Handlers\BaseEmbeddedResourceHandler.cs" />
+    <Compile Include="Net\Handlers\BaseHandler.cs" />
+    <Compile Include="Net\Handlers\BaseJsonHandler.cs" />
+    <Compile Include="Net\HttpServer.cs" />
+    <Compile Include="Net\Request.cs" />
+    <Compile Include="Net\RequestContext.cs" />
+    <Compile Include="Net\StreamExtensions.cs" />
+    <Compile Include="Plugins\BasePlugin.cs" />
+    <Compile Include="Properties\AssemblyInfo.cs" />
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="packages.config" />
+  </ItemGroup>
+  <ItemGroup>
+    <ProjectReference Include="..\MediaBrowser.Model\MediaBrowser.Model.csproj">
+      <Project>{7eeeb4bb-f3e8-48fc-b4c5-70f0fff8329b}</Project>
+      <Name>MediaBrowser.Model</Name>
+    </ProjectReference>
+  </ItemGroup>
+  <ItemGroup />
+  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
+       Other similar extension points exist, see Microsoft.Common.targets.
+  <Target Name="BeforeBuild">
+  </Target>
+  <Target Name="AfterBuild">
+  </Target>
+  -->
+</Project>

+ 6 - 59
MediaBrowser.Controller/Kernel.cs

@@ -38,15 +38,6 @@ namespace MediaBrowser.Controller
                 return ApplicationPaths.RootFolderPath;
                 return ApplicationPaths.RootFolderPath;
             }
             }
         }
         }
-
-        //gonna want to load this from the standard repository... -ebr
-        //private string UsersPath
-        //{
-        //    get
-        //    {
-        //        return Path.Combine(ProgramDataPath, "Users");
-        //    }
-        //}
         
         
         /// <summary>
         /// <summary>
         /// Gets the list of currently registered entity resolvers
         /// Gets the list of currently registered entity resolvers
@@ -436,61 +427,17 @@ namespace MediaBrowser.Controller
         /// </summary>
         /// </summary>
         private IEnumerable<User> GetAllUsers()
         private IEnumerable<User> GetAllUsers()
         {
         {
-            //we'll get this from the standard repo... -ebr
-
-            //if (!Directory.Exists(UsersPath))
-            //{
-            //    Directory.CreateDirectory(UsersPath);
-            //}
-
             List<User> list = new List<User>();
             List<User> list = new List<User>();
 
 
-            //foreach (string folder in Directory.GetDirectories(UsersPath, "*", SearchOption.TopDirectoryOnly))
-            //{
-            //    User item = GetFromDirectory(folder);
+            // Return a dummy user for now since all calls to get items requre a userId
+            User user = new User();
 
 
-            //    if (item != null)
-            //    {
-            //        list.Add(item);
-            //    }
-            //}
+            user.Name = "Default User";
+            user.Id = Guid.NewGuid();
+
+            list.Add(user);
 
 
             return list;
             return list;
         }
         }
-
-        /// <summary>
-        /// Gets a User from it's directory
-        /// </summary>
-        //private User GetFromDirectory(string path)
-        //{
-        //    string file = Path.Combine(path, "user.js");
-
-        //    return JsonSerializer.DeserializeFromFile<User>(file);
-        //}
-
-        /// <summary>
-        /// Creates a User with a given name
-        /// </summary>
-        //public User CreateUser(string name)
-        //{
-        //    var now = DateTime.Now;
-
-        //    User user = new User()
-        //    {
-        //        Name = name,
-        //        Id = Guid.NewGuid(),
-        //        DateCreated = now,
-        //        DateModified = now
-        //    };
-
-        //    user.Path = Path.Combine(UsersPath, user.Id.ToString());
-
-        //    Directory.CreateDirectory(user.Path);
-
-        //    JsonSerializer.SerializeToFile(user, Path.Combine(user.Path, "user.js"));
-
-        //    return user;
-        //}
-
     }
     }
 }
 }