mirror of
				https://github.com/jellyfin/jellyfin.git
				synced 2025-11-03 19:17:24 -05:00 
			
		
		
		
	make common project portable
This commit is contained in:
		
							parent
							
								
									abc5a2eabd
								
							
						
					
					
						commit
						2af3ec43d5
					
				@ -462,6 +462,10 @@ namespace MediaBrowser.Common.Implementations
 | 
			
		||||
 | 
			
		||||
                    assemblyPlugin.SetAttributes(assemblyFilePath, assemblyFileName, assemblyName.Version, assemblyId);
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                var isFirstRun = !File.Exists(plugin.ConfigurationFilePath);
 | 
			
		||||
 | 
			
		||||
                plugin.SetStartupInfo(isFirstRun, File.GetLastWriteTimeUtc, s => Directory.CreateDirectory(s));
 | 
			
		||||
            }
 | 
			
		||||
            catch (Exception ex)
 | 
			
		||||
            {
 | 
			
		||||
 | 
			
		||||
@ -13,8 +13,11 @@
 | 
			
		||||
    <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
 | 
			
		||||
    <ProductVersion>10.0.0</ProductVersion>
 | 
			
		||||
    <SchemaVersion>2.0</SchemaVersion>
 | 
			
		||||
    <TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
 | 
			
		||||
    <TargetFrameworkProfile />
 | 
			
		||||
    <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
 | 
			
		||||
    <TargetFrameworkProfile>
 | 
			
		||||
    </TargetFrameworkProfile>
 | 
			
		||||
    <TargetFrameworkVersion>v5.0</TargetFrameworkVersion>
 | 
			
		||||
    <MinimumVisualStudioVersion>14.0</MinimumVisualStudioVersion>
 | 
			
		||||
  </PropertyGroup>
 | 
			
		||||
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
 | 
			
		||||
    <DebugSymbols>true</DebugSymbols>
 | 
			
		||||
@ -42,11 +45,6 @@
 | 
			
		||||
    <ErrorReport>prompt</ErrorReport>
 | 
			
		||||
    <WarningLevel>4</WarningLevel>
 | 
			
		||||
  </PropertyGroup>
 | 
			
		||||
  <ItemGroup>
 | 
			
		||||
    <Reference Include="System" />
 | 
			
		||||
    <Reference Include="System.Core" />
 | 
			
		||||
    <Reference Include="Microsoft.CSharp" />
 | 
			
		||||
  </ItemGroup>
 | 
			
		||||
  <ItemGroup>
 | 
			
		||||
    <Compile Include="..\SharedVersion.cs">
 | 
			
		||||
      <Link>Properties\SharedVersion.cs</Link>
 | 
			
		||||
@ -83,8 +81,10 @@
 | 
			
		||||
      <Name>MediaBrowser.Model</Name>
 | 
			
		||||
    </ProjectReference>
 | 
			
		||||
  </ItemGroup>
 | 
			
		||||
  <ItemGroup />
 | 
			
		||||
  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
 | 
			
		||||
  <ItemGroup>
 | 
			
		||||
    <None Include="project.json" />
 | 
			
		||||
  </ItemGroup>
 | 
			
		||||
  <Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />
 | 
			
		||||
  <PropertyGroup>
 | 
			
		||||
    <PostBuildEvent />
 | 
			
		||||
  </PropertyGroup>
 | 
			
		||||
 | 
			
		||||
@ -61,8 +61,17 @@ namespace MediaBrowser.Common.Plugins
 | 
			
		||||
            AssemblyFileName = assemblyFileName;
 | 
			
		||||
            Version = assemblyVersion;
 | 
			
		||||
            Id = assemblyId;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
            IsFirstRun = !File.Exists(ConfigurationFilePath);
 | 
			
		||||
        private Func<string, DateTime> _dateModifiedFn;
 | 
			
		||||
        private Action<string> _directoryCreateFn;
 | 
			
		||||
        public void SetStartupInfo(bool isFirstRun, Func<string, DateTime> dateModifiedFn, Action<string> directoryCreateFn)
 | 
			
		||||
        {
 | 
			
		||||
            IsFirstRun = isFirstRun;
 | 
			
		||||
 | 
			
		||||
            // hack alert, until the .net core transition is complete
 | 
			
		||||
            _dateModifiedFn = dateModifiedFn;
 | 
			
		||||
            _directoryCreateFn = directoryCreateFn;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
@ -94,7 +103,7 @@ namespace MediaBrowser.Common.Plugins
 | 
			
		||||
                // Ensure it's been lazy loaded
 | 
			
		||||
                var config = Configuration;
 | 
			
		||||
 | 
			
		||||
                return File.GetLastWriteTimeUtc(ConfigurationFilePath);
 | 
			
		||||
                return _dateModifiedFn(ConfigurationFilePath);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
@ -147,14 +156,6 @@ namespace MediaBrowser.Common.Plugins
 | 
			
		||||
            {
 | 
			
		||||
                return (TConfigurationType)XmlSerializer.DeserializeFromFile(typeof(TConfigurationType), path);
 | 
			
		||||
            }
 | 
			
		||||
            catch (DirectoryNotFoundException)
 | 
			
		||||
            {
 | 
			
		||||
                return (TConfigurationType)Activator.CreateInstance(typeof(TConfigurationType));
 | 
			
		||||
            }
 | 
			
		||||
            catch (FileNotFoundException)
 | 
			
		||||
            {
 | 
			
		||||
                return (TConfigurationType)Activator.CreateInstance(typeof(TConfigurationType));
 | 
			
		||||
            }
 | 
			
		||||
            catch
 | 
			
		||||
            {
 | 
			
		||||
                return (TConfigurationType)Activator.CreateInstance(typeof(TConfigurationType));
 | 
			
		||||
@ -182,10 +183,6 @@ namespace MediaBrowser.Common.Plugins
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// The _data folder path
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        private string _dataFolderPath;
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// Gets the full path to the data folder, where the plugin can store any miscellaneous files needed
 | 
			
		||||
        /// </summary>
 | 
			
		||||
@ -193,17 +190,10 @@ namespace MediaBrowser.Common.Plugins
 | 
			
		||||
        public string DataFolderPath
 | 
			
		||||
        {
 | 
			
		||||
            get
 | 
			
		||||
            {
 | 
			
		||||
                if (_dataFolderPath == null)
 | 
			
		||||
            {
 | 
			
		||||
                // Give the folder name the same name as the config file name
 | 
			
		||||
                // We can always make this configurable if/when needed
 | 
			
		||||
                    _dataFolderPath = Path.Combine(ApplicationPaths.PluginsPath, Path.GetFileNameWithoutExtension(ConfigurationFileName));
 | 
			
		||||
 | 
			
		||||
                    Directory.CreateDirectory(_dataFolderPath);
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                return _dataFolderPath;
 | 
			
		||||
                return Path.Combine(ApplicationPaths.PluginsPath, Path.GetFileNameWithoutExtension(ConfigurationFileName));
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
@ -230,7 +220,7 @@ namespace MediaBrowser.Common.Plugins
 | 
			
		||||
        {
 | 
			
		||||
            lock (_configurationSaveLock)
 | 
			
		||||
            {
 | 
			
		||||
                Directory.CreateDirectory(Path.GetDirectoryName(ConfigurationFilePath));
 | 
			
		||||
                _directoryCreateFn(Path.GetDirectoryName(ConfigurationFilePath));
 | 
			
		||||
                
 | 
			
		||||
                XmlSerializer.SerializeToFile(Configuration, ConfigurationFilePath);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
@ -104,5 +104,7 @@ namespace MediaBrowser.Common.Plugins
 | 
			
		||||
        /// Called when just before the plugin is uninstalled from the server.
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        void OnUninstalling();
 | 
			
		||||
 | 
			
		||||
        void SetStartupInfo(bool isFirstRun, Func<string, DateTime> dateModifiedFn, Action<string> directoryCreateFn);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										16
									
								
								MediaBrowser.Common/project.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								MediaBrowser.Common/project.json
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,16 @@
 | 
			
		||||
{
 | 
			
		||||
  "supports": {
 | 
			
		||||
    "net46.app": {},
 | 
			
		||||
    "uwp.10.0.app": {},
 | 
			
		||||
    "dnxcore50.app": {}
 | 
			
		||||
  },
 | 
			
		||||
  "dependencies": {
 | 
			
		||||
    "Microsoft.NETCore": "5.0.0",
 | 
			
		||||
    "Microsoft.NETCore.Portable.Compatibility": "1.0.0"
 | 
			
		||||
  },
 | 
			
		||||
  "frameworks": {
 | 
			
		||||
    "dotnet": {
 | 
			
		||||
      "imports": "portable-net452+win81"
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										18472
									
								
								MediaBrowser.Common/project.lock.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										18472
									
								
								MediaBrowser.Common/project.lock.json
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user