Tweak Gitignore
This commit is contained in:
@@ -1,10 +1,21 @@
|
|||||||
|
|
||||||
|
# Created by https://www.gitignore.io/api/visualstudio,visualstudiocode
|
||||||
|
|
||||||
|
### VisualStudioCode ###
|
||||||
|
.vscode/*
|
||||||
|
!.vscode/settings.json
|
||||||
|
!.vscode/tasks.json
|
||||||
|
!.vscode/launch.json
|
||||||
|
!.vscode/extensions.json
|
||||||
|
.history
|
||||||
|
|
||||||
|
### VisualStudio ###
|
||||||
## Ignore Visual Studio temporary files, build results, and
|
## Ignore Visual Studio temporary files, build results, and
|
||||||
## files generated by popular Visual Studio add-ons.
|
## files generated by popular Visual Studio add-ons.
|
||||||
##
|
##
|
||||||
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
|
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
|
||||||
|
|
||||||
# User-specific files
|
# User-specific files
|
||||||
*.rsuser
|
|
||||||
*.suo
|
*.suo
|
||||||
*.user
|
*.user
|
||||||
*.userosscache
|
*.userosscache
|
||||||
@@ -13,9 +24,6 @@
|
|||||||
# User-specific files (MonoDevelop/Xamarin Studio)
|
# User-specific files (MonoDevelop/Xamarin Studio)
|
||||||
*.userprefs
|
*.userprefs
|
||||||
|
|
||||||
# Mono auto generated files
|
|
||||||
mono_crash.*
|
|
||||||
|
|
||||||
# Build results
|
# Build results
|
||||||
[Dd]ebug/
|
[Dd]ebug/
|
||||||
[Dd]ebugPublic/
|
[Dd]ebugPublic/
|
||||||
@@ -23,62 +31,43 @@ mono_crash.*
|
|||||||
[Rr]eleases/
|
[Rr]eleases/
|
||||||
x64/
|
x64/
|
||||||
x86/
|
x86/
|
||||||
[Ww][Ii][Nn]32/
|
|
||||||
[Aa][Rr][Mm]/
|
|
||||||
[Aa][Rr][Mm]64/
|
|
||||||
bld/
|
bld/
|
||||||
[Bb]in/
|
[Bb]in/
|
||||||
[Oo]bj/
|
[Oo]bj/
|
||||||
[Ll]og/
|
[Ll]og/
|
||||||
[Ll]ogs/
|
|
||||||
|
|
||||||
# Visual Studio 2015/2017 cache/options directory
|
# Visual Studio 2015 cache/options directory
|
||||||
.vs/
|
.vs/
|
||||||
# Uncomment if you have tasks that create the project's static files in wwwroot
|
# Uncomment if you have tasks that create the project's static files in wwwroot
|
||||||
#wwwroot/
|
#wwwroot/
|
||||||
|
|
||||||
# Visual Studio 2017 auto generated files
|
|
||||||
Generated\ Files/
|
|
||||||
|
|
||||||
# MSTest test Results
|
# MSTest test Results
|
||||||
[Tt]est[Rr]esult*/
|
[Tt]est[Rr]esult*/
|
||||||
[Bb]uild[Ll]og.*
|
[Bb]uild[Ll]og.*
|
||||||
|
|
||||||
# NUnit
|
# NUNIT
|
||||||
*.VisualState.xml
|
*.VisualState.xml
|
||||||
TestResult.xml
|
TestResult.xml
|
||||||
nunit-*.xml
|
|
||||||
|
|
||||||
# Build Results of an ATL Project
|
# Build Results of an ATL Project
|
||||||
[Dd]ebugPS/
|
[Dd]ebugPS/
|
||||||
[Rr]eleasePS/
|
[Rr]eleasePS/
|
||||||
dlldata.c
|
dlldata.c
|
||||||
|
|
||||||
# Benchmark Results
|
|
||||||
BenchmarkDotNet.Artifacts/
|
|
||||||
|
|
||||||
# .NET Core
|
# .NET Core
|
||||||
project.lock.json
|
project.lock.json
|
||||||
project.fragment.lock.json
|
project.fragment.lock.json
|
||||||
artifacts/
|
artifacts/
|
||||||
|
**/Properties/launchSettings.json
|
||||||
|
|
||||||
# ASP.NET Scaffolding
|
|
||||||
ScaffoldingReadMe.txt
|
|
||||||
|
|
||||||
# StyleCop
|
|
||||||
StyleCopReport.xml
|
|
||||||
|
|
||||||
# Files built by Visual Studio
|
|
||||||
*_i.c
|
*_i.c
|
||||||
*_p.c
|
*_p.c
|
||||||
*_h.h
|
*_i.h
|
||||||
*.ilk
|
*.ilk
|
||||||
*.meta
|
*.meta
|
||||||
*.obj
|
*.obj
|
||||||
*.iobj
|
|
||||||
*.pch
|
*.pch
|
||||||
*.pdb
|
*.pdb
|
||||||
*.ipdb
|
|
||||||
*.pgc
|
*.pgc
|
||||||
*.pgd
|
*.pgd
|
||||||
*.rsp
|
*.rsp
|
||||||
@@ -88,7 +77,6 @@ StyleCopReport.xml
|
|||||||
*.tlh
|
*.tlh
|
||||||
*.tmp
|
*.tmp
|
||||||
*.tmp_proj
|
*.tmp_proj
|
||||||
*_wpftmp.csproj
|
|
||||||
*.log
|
*.log
|
||||||
*.vspscc
|
*.vspscc
|
||||||
*.vssscc
|
*.vssscc
|
||||||
@@ -117,9 +105,6 @@ ipch/
|
|||||||
*.vspx
|
*.vspx
|
||||||
*.sap
|
*.sap
|
||||||
|
|
||||||
# Visual Studio Trace Files
|
|
||||||
*.e2e
|
|
||||||
|
|
||||||
# TFS 2012 Local Workspace
|
# TFS 2012 Local Workspace
|
||||||
$tf/
|
$tf/
|
||||||
|
|
||||||
@@ -131,21 +116,15 @@ _ReSharper*/
|
|||||||
*.[Rr]e[Ss]harper
|
*.[Rr]e[Ss]harper
|
||||||
*.DotSettings.user
|
*.DotSettings.user
|
||||||
|
|
||||||
|
# JustCode is a .NET coding add-in
|
||||||
|
.JustCode
|
||||||
|
|
||||||
# TeamCity is a build add-in
|
# TeamCity is a build add-in
|
||||||
_TeamCity*
|
_TeamCity*
|
||||||
|
|
||||||
# DotCover is a Code Coverage Tool
|
# DotCover is a Code Coverage Tool
|
||||||
*.dotCover
|
*.dotCover
|
||||||
|
|
||||||
# AxoCover is a Code Coverage Tool
|
|
||||||
.axoCover/*
|
|
||||||
!.axoCover/settings.json
|
|
||||||
|
|
||||||
# Coverlet is a free, cross platform Code Coverage Tool
|
|
||||||
coverage*.json
|
|
||||||
coverage*.xml
|
|
||||||
coverage*.info
|
|
||||||
|
|
||||||
# Visual Studio code coverage results
|
# Visual Studio code coverage results
|
||||||
*.coverage
|
*.coverage
|
||||||
*.coveragexml
|
*.coveragexml
|
||||||
@@ -181,9 +160,11 @@ publish/
|
|||||||
# Publish Web Output
|
# Publish Web Output
|
||||||
*.[Pp]ublish.xml
|
*.[Pp]ublish.xml
|
||||||
*.azurePubxml
|
*.azurePubxml
|
||||||
# Note: Comment the next line if you want to checkin your web deploy settings,
|
# TODO: Uncomment the next line to ignore your web deploy settings.
|
||||||
# but database connection strings (with potential passwords) will be unencrypted
|
# By default, sensitive information, such as encrypted password
|
||||||
*.pubxml
|
# should be stored in the .pubxml.user file.
|
||||||
|
#*.pubxml
|
||||||
|
*.pubxml.user
|
||||||
*.publishproj
|
*.publishproj
|
||||||
|
|
||||||
# Microsoft Azure Web App publish settings. Comment the next line if you want to
|
# Microsoft Azure Web App publish settings. Comment the next line if you want to
|
||||||
@@ -193,14 +174,12 @@ PublishScripts/
|
|||||||
|
|
||||||
# NuGet Packages
|
# NuGet Packages
|
||||||
*.nupkg
|
*.nupkg
|
||||||
# NuGet Symbol Packages
|
|
||||||
*.snupkg
|
|
||||||
# The packages folder can be ignored because of Package Restore
|
# The packages folder can be ignored because of Package Restore
|
||||||
**/[Pp]ackages/*
|
**/packages/*
|
||||||
# except build/, which is used as an MSBuild target.
|
# except build/, which is used as an MSBuild target.
|
||||||
!**/[Pp]ackages/build/
|
!**/packages/build/
|
||||||
# Uncomment if necessary however generally it will be regenerated when needed
|
# Uncomment if necessary however generally it will be regenerated when needed
|
||||||
#!**/[Pp]ackages/repositories.config
|
#!**/packages/repositories.config
|
||||||
# NuGet v3's project.json files produces more ignorable files
|
# NuGet v3's project.json files produces more ignorable files
|
||||||
*.nuget.props
|
*.nuget.props
|
||||||
*.nuget.targets
|
*.nuget.targets
|
||||||
@@ -218,15 +197,12 @@ AppPackages/
|
|||||||
BundleArtifacts/
|
BundleArtifacts/
|
||||||
Package.StoreAssociation.xml
|
Package.StoreAssociation.xml
|
||||||
_pkginfo.txt
|
_pkginfo.txt
|
||||||
*.appx
|
|
||||||
*.appxbundle
|
|
||||||
*.appxupload
|
|
||||||
|
|
||||||
# Visual Studio cache files
|
# Visual Studio cache files
|
||||||
# files ending in .cache can be ignored
|
# files ending in .cache can be ignored
|
||||||
*.[Cc]ache
|
*.[Cc]ache
|
||||||
# but keep track of directories ending in .cache
|
# but keep track of directories ending in .cache
|
||||||
!?*.[Cc]ache/
|
!*.[Cc]ache/
|
||||||
|
|
||||||
# Others
|
# Others
|
||||||
ClientBin/
|
ClientBin/
|
||||||
@@ -239,10 +215,6 @@ ClientBin/
|
|||||||
*.publishsettings
|
*.publishsettings
|
||||||
orleans.codegen.cs
|
orleans.codegen.cs
|
||||||
|
|
||||||
# Including strong name files can present a security risk
|
|
||||||
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
|
|
||||||
#*.snk
|
|
||||||
|
|
||||||
# Since there are multiple workflows, uncomment next line to ignore bower_components
|
# Since there are multiple workflows, uncomment next line to ignore bower_components
|
||||||
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
|
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
|
||||||
#bower_components/
|
#bower_components/
|
||||||
@@ -257,8 +229,6 @@ _UpgradeReport_Files/
|
|||||||
Backup*/
|
Backup*/
|
||||||
UpgradeLog*.XML
|
UpgradeLog*.XML
|
||||||
UpgradeLog*.htm
|
UpgradeLog*.htm
|
||||||
ServiceFabricBackup/
|
|
||||||
*.rptproj.bak
|
|
||||||
|
|
||||||
# SQL Server files
|
# SQL Server files
|
||||||
*.mdf
|
*.mdf
|
||||||
@@ -269,10 +239,6 @@ ServiceFabricBackup/
|
|||||||
*.rdl.data
|
*.rdl.data
|
||||||
*.bim.layout
|
*.bim.layout
|
||||||
*.bim_*.settings
|
*.bim_*.settings
|
||||||
*.rptproj.rsuser
|
|
||||||
*- [Bb]ackup.rdl
|
|
||||||
*- [Bb]ackup ([0-9]).rdl
|
|
||||||
*- [Bb]ackup ([0-9][0-9]).rdl
|
|
||||||
|
|
||||||
# Microsoft Fakes
|
# Microsoft Fakes
|
||||||
FakesAssemblies/
|
FakesAssemblies/
|
||||||
@@ -284,6 +250,9 @@ FakesAssemblies/
|
|||||||
.ntvs_analysis.dat
|
.ntvs_analysis.dat
|
||||||
node_modules/
|
node_modules/
|
||||||
|
|
||||||
|
# Typescript v1 declaration files
|
||||||
|
typings/
|
||||||
|
|
||||||
# Visual Studio 6 build log
|
# Visual Studio 6 build log
|
||||||
*.plg
|
*.plg
|
||||||
|
|
||||||
@@ -308,8 +277,12 @@ paket-files/
|
|||||||
# FAKE - F# Make
|
# FAKE - F# Make
|
||||||
.fake/
|
.fake/
|
||||||
|
|
||||||
# CodeRush personal settings
|
# JetBrains Rider
|
||||||
.cr/personal
|
.idea/
|
||||||
|
*.sln.iml
|
||||||
|
|
||||||
|
# CodeRush
|
||||||
|
.cr/
|
||||||
|
|
||||||
# Python Tools for Visual Studio (PTVS)
|
# Python Tools for Visual Studio (PTVS)
|
||||||
__pycache__/
|
__pycache__/
|
||||||
@@ -319,9 +292,6 @@ __pycache__/
|
|||||||
# tools/**
|
# tools/**
|
||||||
# !tools/packages.config
|
# !tools/packages.config
|
||||||
|
|
||||||
# Tabs Studio
|
|
||||||
*.tss
|
|
||||||
|
|
||||||
# Telerik's JustMock configuration file
|
# Telerik's JustMock configuration file
|
||||||
*.jmconfig
|
*.jmconfig
|
||||||
|
|
||||||
@@ -331,34 +301,12 @@ __pycache__/
|
|||||||
*.odx.cs
|
*.odx.cs
|
||||||
*.xsd.cs
|
*.xsd.cs
|
||||||
|
|
||||||
# OpenCover UI analysis results
|
### VisualStudio Patch ###
|
||||||
OpenCover/
|
# By default, sensitive information, such as encrypted password
|
||||||
|
# should be stored in the .pubxml.user file.
|
||||||
|
|
||||||
# Azure Stream Analytics local run output
|
|
||||||
ASALocalRun/
|
|
||||||
|
|
||||||
# MSBuild Binary and Structured Log
|
# End of https://www.gitignore.io/api/visualstudio,visualstudiocode
|
||||||
*.binlog
|
|
||||||
|
|
||||||
# NVidia Nsight GPU debugger configuration file
|
# Mac
|
||||||
*.nvuser
|
.DS_Store
|
||||||
|
|
||||||
# MFractors (Xamarin productivity tool) working folder
|
|
||||||
.mfractor/
|
|
||||||
|
|
||||||
# Local History for Visual Studio
|
|
||||||
.localhistory/
|
|
||||||
|
|
||||||
# BeatPulse healthcheck temp database
|
|
||||||
healthchecksdb
|
|
||||||
|
|
||||||
# Backup folder for Package Reference Convert tool in Visual Studio 2017
|
|
||||||
MigrationBackup/
|
|
||||||
|
|
||||||
# Ionide (cross platform F# VS Code tools) working folder
|
|
||||||
.ionide/
|
|
||||||
|
|
||||||
# Fody - auto-generated XML schema
|
|
||||||
FodyWeavers.xsd
|
|
||||||
|
|
||||||
[Ss]ubmodules/*
|
|
||||||
29
src/submodules/OPMLCore.NET/.vscode/launch.json
vendored
Normal file
29
src/submodules/OPMLCore.NET/.vscode/launch.json
vendored
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
{
|
||||||
|
// Use IntelliSense to find out which attributes exist for C# debugging
|
||||||
|
// Use hover for the description of the existing attributes
|
||||||
|
// For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md
|
||||||
|
"version": "0.2.0",
|
||||||
|
"configurations": [
|
||||||
|
|
||||||
|
{
|
||||||
|
"name": ".NET Core Launch (console)",
|
||||||
|
"type": "coreclr",
|
||||||
|
"request": "launch",
|
||||||
|
"preLaunchTask": "build",
|
||||||
|
// If you have changed target frameworks, make sure to update the program path.
|
||||||
|
"program": "${workspaceFolder}/test.xunit/bin/Debug/netcoreapp2.0/test.xunit.dll",
|
||||||
|
"args": [],
|
||||||
|
"cwd": "${workspaceFolder}/test.xunit",
|
||||||
|
// For more information about the 'console' field, see https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md#console-terminal-window
|
||||||
|
"console": "internalConsole",
|
||||||
|
"stopAtEntry": false,
|
||||||
|
"internalConsoleOptions": "openOnSessionStart"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": ".NET Core Attach",
|
||||||
|
"type": "coreclr",
|
||||||
|
"request": "attach",
|
||||||
|
"processId": "${command:pickProcess}"
|
||||||
|
}
|
||||||
|
,]
|
||||||
|
}
|
||||||
15
src/submodules/OPMLCore.NET/.vscode/tasks.json
vendored
Normal file
15
src/submodules/OPMLCore.NET/.vscode/tasks.json
vendored
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"version": "2.0.0",
|
||||||
|
"tasks": [
|
||||||
|
{
|
||||||
|
"label": "build",
|
||||||
|
"command": "dotnet",
|
||||||
|
"type": "process",
|
||||||
|
"args": [
|
||||||
|
"build",
|
||||||
|
"${workspaceFolder}/test.xunit/test.xunit.csproj"
|
||||||
|
],
|
||||||
|
"problemMatcher": "$msCompile"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
21
src/submodules/OPMLCore.NET/LICENSE
Normal file
21
src/submodules/OPMLCore.NET/LICENSE
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2018 fnya
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
53
src/submodules/OPMLCore.NET/OPMLCoredotNET.sln
Normal file
53
src/submodules/OPMLCore.NET/OPMLCoredotNET.sln
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
|
# Visual Studio 15
|
||||||
|
VisualStudioVersion = 15.0.26124.0
|
||||||
|
MinimumVisualStudioVersion = 15.0.26124.0
|
||||||
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{0DA6DFA3-972E-4B42-AF2C-67D226DCDD89}"
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OPMLCore.NET", "src\OPMLCore.NET\OPMLCore.NET.csproj", "{74D51452-48A8-4F0F-82B5-F47826B4F1C9}"
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "test", "test\test.csproj", "{15E07BD7-75A1-46F8-8697-F146915FC23F}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
Debug|x64 = Debug|x64
|
||||||
|
Debug|x86 = Debug|x86
|
||||||
|
Release|Any CPU = Release|Any CPU
|
||||||
|
Release|x64 = Release|x64
|
||||||
|
Release|x86 = Release|x86
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
|
HideSolutionNode = FALSE
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{74D51452-48A8-4F0F-82B5-F47826B4F1C9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{74D51452-48A8-4F0F-82B5-F47826B4F1C9}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{74D51452-48A8-4F0F-82B5-F47826B4F1C9}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
|
{74D51452-48A8-4F0F-82B5-F47826B4F1C9}.Debug|x64.Build.0 = Debug|x64
|
||||||
|
{74D51452-48A8-4F0F-82B5-F47826B4F1C9}.Debug|x86.ActiveCfg = Debug|x86
|
||||||
|
{74D51452-48A8-4F0F-82B5-F47826B4F1C9}.Debug|x86.Build.0 = Debug|x86
|
||||||
|
{74D51452-48A8-4F0F-82B5-F47826B4F1C9}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{74D51452-48A8-4F0F-82B5-F47826B4F1C9}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{74D51452-48A8-4F0F-82B5-F47826B4F1C9}.Release|x64.ActiveCfg = Release|x64
|
||||||
|
{74D51452-48A8-4F0F-82B5-F47826B4F1C9}.Release|x64.Build.0 = Release|x64
|
||||||
|
{74D51452-48A8-4F0F-82B5-F47826B4F1C9}.Release|x86.ActiveCfg = Release|x86
|
||||||
|
{74D51452-48A8-4F0F-82B5-F47826B4F1C9}.Release|x86.Build.0 = Release|x86
|
||||||
|
{15E07BD7-75A1-46F8-8697-F146915FC23F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{15E07BD7-75A1-46F8-8697-F146915FC23F}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{15E07BD7-75A1-46F8-8697-F146915FC23F}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
|
{15E07BD7-75A1-46F8-8697-F146915FC23F}.Debug|x64.Build.0 = Debug|x64
|
||||||
|
{15E07BD7-75A1-46F8-8697-F146915FC23F}.Debug|x86.ActiveCfg = Debug|x86
|
||||||
|
{15E07BD7-75A1-46F8-8697-F146915FC23F}.Debug|x86.Build.0 = Debug|x86
|
||||||
|
{15E07BD7-75A1-46F8-8697-F146915FC23F}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{15E07BD7-75A1-46F8-8697-F146915FC23F}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{15E07BD7-75A1-46F8-8697-F146915FC23F}.Release|x64.ActiveCfg = Release|x64
|
||||||
|
{15E07BD7-75A1-46F8-8697-F146915FC23F}.Release|x64.Build.0 = Release|x64
|
||||||
|
{15E07BD7-75A1-46F8-8697-F146915FC23F}.Release|x86.ActiveCfg = Release|x86
|
||||||
|
{15E07BD7-75A1-46F8-8697-F146915FC23F}.Release|x86.Build.0 = Release|x86
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(NestedProjects) = preSolution
|
||||||
|
{74D51452-48A8-4F0F-82B5-F47826B4F1C9} = {0DA6DFA3-972E-4B42-AF2C-67D226DCDD89}
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
||||||
48
src/submodules/OPMLCore.NET/README.md
Normal file
48
src/submodules/OPMLCore.NET/README.md
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
# OPMLCore.NET
|
||||||
|
OPMLCore.NET is OPML Parser which easy to use for .NET Core Applications.
|
||||||
|
|
||||||
|
It is written in C# and with Visual Studio Code.
|
||||||
|
|
||||||
|
It supports .NET Core 2.0.
|
||||||
|
|
||||||
|
# Setting
|
||||||
|
|
||||||
|
You shoud add project refference to your project.
|
||||||
|
|
||||||
|
The below is sample `.csproj` which is added project refference.
|
||||||
|
|
||||||
|
```
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\src\OPMLCore.NET\OPMLCore.NET.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
```
|
||||||
|
And then `dotnet restore`.
|
||||||
|
|
||||||
|
# Usage
|
||||||
|
How to use is below.
|
||||||
|
|
||||||
|
```
|
||||||
|
using OPMLCore.NET; //Add
|
||||||
|
|
||||||
|
Opml opml = new Opml("opmlFilePath");
|
||||||
|
|
||||||
|
foreach (Outline outline in opml.Body.Outlines)
|
||||||
|
{
|
||||||
|
//Output outline node
|
||||||
|
Console.WriteLine(outline.Text);
|
||||||
|
Console.WriteLine(outline.XMLUrl);
|
||||||
|
|
||||||
|
//output child's output node
|
||||||
|
foreach (Outline childOutline in outline.Outlines)
|
||||||
|
{
|
||||||
|
Console.WriteLine(childOutline.Text);
|
||||||
|
Console.WriteLine(childOutline.XMLUrl);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
For more detail, show test code or source code.
|
||||||
|
|
||||||
|
# License
|
||||||
|
Lisense is MIT License.
|
||||||
52
src/submodules/OPMLCore.NET/src/OPMLCore.NET/Body.cs
Normal file
52
src/submodules/OPMLCore.NET/src/OPMLCore.NET/Body.cs
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
using System;
|
||||||
|
using System.Text;
|
||||||
|
using System.Xml;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace OPMLCore.NET {
|
||||||
|
public class Body
|
||||||
|
{
|
||||||
|
///<summary>
|
||||||
|
/// Outline list
|
||||||
|
///</summary>
|
||||||
|
public List<Outline> Outlines { get; set; } = new List<Outline>();
|
||||||
|
|
||||||
|
///<summary>
|
||||||
|
/// Constructor
|
||||||
|
///</summary>
|
||||||
|
public Body()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
///<summary>
|
||||||
|
/// Constructor
|
||||||
|
///</summary>
|
||||||
|
/// <param name="element">element of Body</param>
|
||||||
|
public Body(XmlElement element)
|
||||||
|
{
|
||||||
|
if (element.Name.Equals("body", StringComparison.CurrentCultureIgnoreCase))
|
||||||
|
{
|
||||||
|
foreach (XmlNode node in element.ChildNodes)
|
||||||
|
{
|
||||||
|
if (node.Name.Equals("outline", StringComparison.CurrentCultureIgnoreCase))
|
||||||
|
{
|
||||||
|
Outlines.Add(new Outline((XmlElement)node));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string ToString() {
|
||||||
|
StringBuilder buf = new StringBuilder();
|
||||||
|
buf.Append("<body>\r\n");
|
||||||
|
foreach (Outline outline in Outlines)
|
||||||
|
{
|
||||||
|
buf.Append(outline.ToString());
|
||||||
|
}
|
||||||
|
buf.Append("</body>\r\n");
|
||||||
|
|
||||||
|
return buf.ToString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
213
src/submodules/OPMLCore.NET/src/OPMLCore.NET/Head.cs
Normal file
213
src/submodules/OPMLCore.NET/src/OPMLCore.NET/Head.cs
Normal file
@@ -0,0 +1,213 @@
|
|||||||
|
using System;
|
||||||
|
using System.Text;
|
||||||
|
using System.Xml;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace OPMLCore.NET {
|
||||||
|
public class Head
|
||||||
|
{
|
||||||
|
///<summary>
|
||||||
|
/// title
|
||||||
|
///</summary>
|
||||||
|
public string Title { get; set; }
|
||||||
|
|
||||||
|
///<summary>
|
||||||
|
/// Created date
|
||||||
|
///</summary>
|
||||||
|
public DateTime? DateCreated { get; set; } = null;
|
||||||
|
|
||||||
|
///<summary>
|
||||||
|
/// Modified date
|
||||||
|
///</summary>
|
||||||
|
public DateTime? DateModified { get; set; } = null;
|
||||||
|
|
||||||
|
///<summary>
|
||||||
|
/// ownerName
|
||||||
|
///</summary>
|
||||||
|
public string OwnerName { get; set; }
|
||||||
|
|
||||||
|
///<summary>
|
||||||
|
/// ownerEmail
|
||||||
|
///</summary>
|
||||||
|
public string OwnerEmail { get; set; }
|
||||||
|
|
||||||
|
///<summary>
|
||||||
|
/// ownerId
|
||||||
|
///</summary>
|
||||||
|
public string OwnerId { get; set;}
|
||||||
|
|
||||||
|
///<summary>
|
||||||
|
/// docs
|
||||||
|
///</summary>
|
||||||
|
public string Docs { get; set;}
|
||||||
|
|
||||||
|
///<summary>
|
||||||
|
/// expansionState
|
||||||
|
///</summary>
|
||||||
|
public List<string> ExpansionState { get; set; } = new List<string>();
|
||||||
|
|
||||||
|
///<summary>
|
||||||
|
/// vertScrollState
|
||||||
|
///</summary>
|
||||||
|
public string VertScrollState { get; set; }
|
||||||
|
|
||||||
|
///<summary>
|
||||||
|
/// windowTop
|
||||||
|
///</summary>
|
||||||
|
public string WindowTop { get; set; }
|
||||||
|
|
||||||
|
///<summary>
|
||||||
|
/// windowLeft
|
||||||
|
///</summary>
|
||||||
|
public string WindowLeft { get; set; }
|
||||||
|
|
||||||
|
///<summary>
|
||||||
|
/// windowBottom
|
||||||
|
///</summary>
|
||||||
|
public string WindowBottom { get; set; }
|
||||||
|
|
||||||
|
///<summary>
|
||||||
|
/// windowRight
|
||||||
|
///</summary>
|
||||||
|
public string WindowRight { get; set; }
|
||||||
|
|
||||||
|
///<summary>
|
||||||
|
/// Constructor
|
||||||
|
///</summary>
|
||||||
|
public Head()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
///<summary>
|
||||||
|
/// Constructor
|
||||||
|
///</summary>
|
||||||
|
/// <param name="element">element of Head</param>
|
||||||
|
public Head(XmlElement element)
|
||||||
|
{
|
||||||
|
if (element.Name.Equals("head", StringComparison.CurrentCultureIgnoreCase))
|
||||||
|
{
|
||||||
|
foreach (XmlNode node in element.ChildNodes)
|
||||||
|
{
|
||||||
|
Title = GetStringValue(node, "title", Title);
|
||||||
|
DateCreated = GetDateTimeValue(node, "dateCreated", DateCreated);
|
||||||
|
DateModified = GetDateTimeValue(node, "dateModified", DateModified);
|
||||||
|
OwnerName = GetStringValue(node, "ownerName", OwnerName);
|
||||||
|
OwnerEmail = GetStringValue(node, "ownerEmail", OwnerEmail);
|
||||||
|
OwnerId = GetStringValue(node, "ownerId", OwnerId);
|
||||||
|
Docs = GetStringValue(node, "docs", Docs);
|
||||||
|
ExpansionState = GetExpansionState(node, "expansionState", ExpansionState);
|
||||||
|
VertScrollState = GetStringValue(node, "vertScrollState", VertScrollState);
|
||||||
|
WindowTop = GetStringValue(node, "windowTop", WindowTop);
|
||||||
|
WindowLeft = GetStringValue(node, "windowLeft", WindowLeft);
|
||||||
|
WindowBottom = GetStringValue(node, "windowBottom", WindowBottom);
|
||||||
|
WindowRight = GetStringValue(node, "windowRight", WindowRight);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private string GetStringValue(XmlNode node, string name, string value)
|
||||||
|
{
|
||||||
|
if (node.Name.Equals(name, StringComparison.CurrentCultureIgnoreCase))
|
||||||
|
{
|
||||||
|
return node.InnerText;
|
||||||
|
} else if (!node.Name.Equals(name, StringComparison.CurrentCultureIgnoreCase)) {
|
||||||
|
return value;
|
||||||
|
} else {
|
||||||
|
return string.Empty;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private DateTime? GetDateTimeValue(XmlNode node, string name, DateTime? value)
|
||||||
|
{
|
||||||
|
if (node.Name.Equals(name, StringComparison.CurrentCultureIgnoreCase))
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
return DateTime.Parse(node.InnerText);
|
||||||
|
} catch {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
} else if (!node.Name.Equals(name, StringComparison.CurrentCultureIgnoreCase)){
|
||||||
|
return value;
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<string> GetExpansionState(XmlNode node, string name, List<string> value)
|
||||||
|
{
|
||||||
|
if (node.Name.Equals(name, StringComparison.CurrentCultureIgnoreCase))
|
||||||
|
{
|
||||||
|
List<string> list = new List<string>();
|
||||||
|
var items = node.InnerText.Split(',');
|
||||||
|
foreach(var item in items)
|
||||||
|
{
|
||||||
|
list.Add(item.Trim());
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
|
||||||
|
} else if (!node.Name.Equals(name, StringComparison.CurrentCultureIgnoreCase))
|
||||||
|
{
|
||||||
|
return value;
|
||||||
|
} else {
|
||||||
|
return new List<string>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
StringBuilder buf = new StringBuilder();
|
||||||
|
buf.Append("<head>\r\n");
|
||||||
|
buf.Append(GetNodeString("title", Title));
|
||||||
|
buf.Append(GetNodeString("dateCreated", DateCreated));
|
||||||
|
buf.Append(GetNodeString("dateModified", DateModified));
|
||||||
|
buf.Append(GetNodeString("ownerName", OwnerName));
|
||||||
|
buf.Append(GetNodeString("ownerEmail", OwnerEmail));
|
||||||
|
buf.Append(GetNodeString("ownerId", OwnerId));
|
||||||
|
buf.Append(GetNodeString("docs", Docs));
|
||||||
|
buf.Append(GetNodeString("expansionState", ExpansionState));
|
||||||
|
buf.Append(GetNodeString("vertScrollState", VertScrollState));
|
||||||
|
buf.Append(GetNodeString("windowTop", WindowTop));
|
||||||
|
buf.Append(GetNodeString("windowLeft", WindowLeft));
|
||||||
|
buf.Append(GetNodeString("windowBottom", WindowBottom));
|
||||||
|
buf.Append(GetNodeString("windowRight", WindowRight));
|
||||||
|
buf.Append("</head>\r\n");
|
||||||
|
return buf.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
private string GetNodeString(string name, string value)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(value))
|
||||||
|
{
|
||||||
|
return string.Empty;
|
||||||
|
} else {
|
||||||
|
return $"<{name}>{value}</{name}>\r\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private string GetNodeString(string name, DateTime? value)
|
||||||
|
{
|
||||||
|
if (value == null)
|
||||||
|
{
|
||||||
|
return string.Empty;
|
||||||
|
} else {
|
||||||
|
return $"<{name}>{value?.ToString("R")}</{name}>\r\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private string GetNodeString(string name, List<string> value)
|
||||||
|
{
|
||||||
|
if (value.Count == 0) {
|
||||||
|
return string.Empty;
|
||||||
|
}
|
||||||
|
|
||||||
|
StringBuilder buf = new StringBuilder();
|
||||||
|
foreach (var item in value)
|
||||||
|
{
|
||||||
|
buf.Append(item);
|
||||||
|
buf.Append(",");
|
||||||
|
}
|
||||||
|
|
||||||
|
return $"<{name}>{buf.Remove(buf.Length - 1, 1).ToString()}</{name}>\r\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>netstandard2.0</TargetFramework>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
93
src/submodules/OPMLCore.NET/src/OPMLCore.NET/Opml.cs
Normal file
93
src/submodules/OPMLCore.NET/src/OPMLCore.NET/Opml.cs
Normal file
@@ -0,0 +1,93 @@
|
|||||||
|
using System;
|
||||||
|
using System.Text;
|
||||||
|
using System.Xml;
|
||||||
|
|
||||||
|
namespace OPMLCore.NET {
|
||||||
|
public class Opml {
|
||||||
|
///<summary>
|
||||||
|
/// Version of OPML
|
||||||
|
///</summary>
|
||||||
|
public string Version { get; set;}
|
||||||
|
|
||||||
|
///<summary>
|
||||||
|
/// Encoding of OPML
|
||||||
|
///</summary>
|
||||||
|
public string Encoding { get; set;}
|
||||||
|
|
||||||
|
///<summary>
|
||||||
|
/// Head of OPML
|
||||||
|
///</summary>
|
||||||
|
public Head Head { get; set;} = new Head();
|
||||||
|
|
||||||
|
///<summary>
|
||||||
|
/// Body of OPML
|
||||||
|
///</summary>
|
||||||
|
public Body Body { get; set;} = new Body();
|
||||||
|
|
||||||
|
///<summary>
|
||||||
|
/// Constructor
|
||||||
|
///</summary>
|
||||||
|
public Opml()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
///<summary>
|
||||||
|
/// Constructor
|
||||||
|
///</summary>
|
||||||
|
/// <param name="location">Location of the OPML file</param>
|
||||||
|
public Opml(string location)
|
||||||
|
{
|
||||||
|
XmlDocument doc = new XmlDocument();
|
||||||
|
doc.Load(location);
|
||||||
|
readOpmlNodes(doc);
|
||||||
|
}
|
||||||
|
|
||||||
|
///<summary>
|
||||||
|
/// Constructor
|
||||||
|
///</summary>
|
||||||
|
/// <param name="doc">XMLDocument of the OPML</param>
|
||||||
|
public Opml(XmlDocument doc)
|
||||||
|
{
|
||||||
|
readOpmlNodes(doc);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void readOpmlNodes(XmlDocument doc) {
|
||||||
|
foreach (XmlNode nodes in doc)
|
||||||
|
{
|
||||||
|
if (nodes.Name.Equals("opml", StringComparison.CurrentCultureIgnoreCase))
|
||||||
|
{
|
||||||
|
foreach (XmlNode childNode in nodes)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (childNode.Name.Equals("head", StringComparison.CurrentCultureIgnoreCase))
|
||||||
|
{
|
||||||
|
Head = new Head((XmlElement) childNode);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (childNode.Name.Equals("body", StringComparison.CurrentCultureIgnoreCase))
|
||||||
|
{
|
||||||
|
Body = new Body((XmlElement) childNode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
StringBuilder buf = new StringBuilder();
|
||||||
|
String ecoding = string.IsNullOrEmpty(Encoding)?"UTF-8":Encoding;
|
||||||
|
buf.Append($"<?xml version=\"1.0\" encoding=\"{ecoding}\" ?>\r\n");
|
||||||
|
String version = string.IsNullOrEmpty(Version)?"2.0":Version;
|
||||||
|
buf.Append($"<opml version=\"{version}\">\r\n");
|
||||||
|
buf.Append(Head.ToString());
|
||||||
|
buf.Append(Body.ToString());
|
||||||
|
buf.Append("</opml>");
|
||||||
|
|
||||||
|
return buf.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
203
src/submodules/OPMLCore.NET/src/OPMLCore.NET/Outline.cs
Normal file
203
src/submodules/OPMLCore.NET/src/OPMLCore.NET/Outline.cs
Normal file
@@ -0,0 +1,203 @@
|
|||||||
|
using System;
|
||||||
|
using System.Text;
|
||||||
|
using System.Xml;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace OPMLCore.NET {
|
||||||
|
public class Outline
|
||||||
|
{
|
||||||
|
///<summary>
|
||||||
|
/// Text of the XML file (required)
|
||||||
|
///</summary>
|
||||||
|
public string Text { get; set; }
|
||||||
|
|
||||||
|
///<summary>
|
||||||
|
/// true / false
|
||||||
|
///</summary>
|
||||||
|
public string IsComment { get; set; }
|
||||||
|
|
||||||
|
///<summary>
|
||||||
|
/// true / false
|
||||||
|
///</summary>
|
||||||
|
public string IsBreakpoint { get; set; }
|
||||||
|
|
||||||
|
///<summary>
|
||||||
|
/// outline node was created
|
||||||
|
///</summary>
|
||||||
|
public DateTime? Created { get; set; } = null;
|
||||||
|
|
||||||
|
///<summary>
|
||||||
|
/// Categories
|
||||||
|
///</summary>
|
||||||
|
public List<string> Category { get; set; } = new List<string>();
|
||||||
|
|
||||||
|
///<summary>
|
||||||
|
/// Description
|
||||||
|
///</summary>
|
||||||
|
public string Description { get; set; }
|
||||||
|
|
||||||
|
///<summary>
|
||||||
|
/// HTML URL
|
||||||
|
///</summary>
|
||||||
|
public string HTMLUrl { get; set; }
|
||||||
|
|
||||||
|
///<summary>
|
||||||
|
/// Language
|
||||||
|
///</summary>
|
||||||
|
public string Language { get; set; }
|
||||||
|
|
||||||
|
///<summary>
|
||||||
|
/// Title
|
||||||
|
///</summary>
|
||||||
|
public string Title { get; set; }
|
||||||
|
|
||||||
|
///<summary>
|
||||||
|
/// Type (rss/atom)
|
||||||
|
///</summary>
|
||||||
|
public string Type { get; set; }
|
||||||
|
|
||||||
|
///<summary>
|
||||||
|
/// Version of RSS.
|
||||||
|
/// RSS1 for RSS1.0. RSS for 0.91, 0.92 or 2.0.
|
||||||
|
///</summary>
|
||||||
|
public string Version { get; set; }
|
||||||
|
|
||||||
|
///<summary>
|
||||||
|
/// URL of the XML file
|
||||||
|
///</summary>
|
||||||
|
public string XMLUrl { get; set; }
|
||||||
|
|
||||||
|
///<summary>
|
||||||
|
/// Outline list
|
||||||
|
///</summary>
|
||||||
|
public List<Outline> Outlines { get; set; } = new List<Outline>();
|
||||||
|
|
||||||
|
///<summary>
|
||||||
|
/// Constructor
|
||||||
|
///</summary>
|
||||||
|
public Outline()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
///<summary>
|
||||||
|
/// Constructor
|
||||||
|
///</summary>
|
||||||
|
/// <param name="element">element of Head</param>
|
||||||
|
public Outline(XmlElement element)
|
||||||
|
{
|
||||||
|
Text = element.GetAttribute("text");
|
||||||
|
IsComment = element.GetAttribute("isComment");
|
||||||
|
IsBreakpoint = element.GetAttribute("isBreakpoint");
|
||||||
|
Created = GetDateTimeAttribute(element, "created");
|
||||||
|
Category = GetCategoriesAtrribute(element, "category");
|
||||||
|
Description = element.GetAttribute("description");
|
||||||
|
HTMLUrl = element.GetAttribute("htmlUrl");
|
||||||
|
Language = element.GetAttribute("language");
|
||||||
|
Title = element.GetAttribute("title");
|
||||||
|
Type = element.GetAttribute("type");
|
||||||
|
Version = element.GetAttribute("version");
|
||||||
|
XMLUrl = element.GetAttribute("xmlUrl");
|
||||||
|
|
||||||
|
if (element.HasChildNodes) {
|
||||||
|
foreach (XmlNode child in element.ChildNodes)
|
||||||
|
{
|
||||||
|
if (child.Name.Equals("outline", StringComparison.CurrentCultureIgnoreCase))
|
||||||
|
{
|
||||||
|
Outlines.Add(new Outline((XmlElement) child));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private DateTime? GetDateTimeAttribute(XmlElement element, string name)
|
||||||
|
{
|
||||||
|
string dt = element.GetAttribute(name);
|
||||||
|
|
||||||
|
try {
|
||||||
|
return DateTime.Parse(dt);
|
||||||
|
} catch {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<string> GetCategoriesAtrribute(XmlElement element, string name)
|
||||||
|
{
|
||||||
|
List<string> list = new List<string>();
|
||||||
|
var items = element.GetAttribute(name).Split(',');
|
||||||
|
foreach(var item in items)
|
||||||
|
{
|
||||||
|
list.Add(item.Trim());
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
StringBuilder buf = new StringBuilder();
|
||||||
|
buf.Append("<outline");
|
||||||
|
buf.Append(GetAtrributeString("text", Text));
|
||||||
|
buf.Append(GetAtrributeString("isComment", IsComment));
|
||||||
|
buf.Append(GetAtrributeString("isBreakpoint", IsBreakpoint));
|
||||||
|
buf.Append(GetAtrributeString("created", Created));
|
||||||
|
buf.Append(GetAtrributeString("category", Category));
|
||||||
|
buf.Append(GetAtrributeString("description", Description));
|
||||||
|
buf.Append(GetAtrributeString("htmlUrl", HTMLUrl));
|
||||||
|
buf.Append(GetAtrributeString("language", Language));
|
||||||
|
buf.Append(GetAtrributeString("title", Title));
|
||||||
|
buf.Append(GetAtrributeString("type", Type));
|
||||||
|
buf.Append(GetAtrributeString("version", Version));
|
||||||
|
buf.Append(GetAtrributeString("xmlUrl", XMLUrl));
|
||||||
|
|
||||||
|
if (Outlines.Count > 0)
|
||||||
|
{
|
||||||
|
buf.Append(">\r\n");
|
||||||
|
foreach (Outline outline in Outlines)
|
||||||
|
{
|
||||||
|
buf.Append(outline.ToString());
|
||||||
|
}
|
||||||
|
buf.Append("</outline>\r\n");
|
||||||
|
} else {
|
||||||
|
buf.Append(" />\r\n");
|
||||||
|
}
|
||||||
|
return buf.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
private string GetAtrributeString(string name, string value)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(value))
|
||||||
|
{
|
||||||
|
return string.Empty;
|
||||||
|
} else {
|
||||||
|
return $" {name}=\"{value}\"";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private string GetAtrributeString(string name, DateTime? value)
|
||||||
|
{
|
||||||
|
if (value == null)
|
||||||
|
{
|
||||||
|
return string.Empty;
|
||||||
|
} else {
|
||||||
|
return $" {name}=\"{value?.ToString("R")}\"";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private string GetAtrributeString(string name, List<string> value)
|
||||||
|
{
|
||||||
|
if (value.Count == 0) {
|
||||||
|
return string.Empty;
|
||||||
|
}
|
||||||
|
|
||||||
|
StringBuilder buf = new StringBuilder();
|
||||||
|
foreach (var item in value)
|
||||||
|
{
|
||||||
|
buf.Append(item);
|
||||||
|
buf.Append(",");
|
||||||
|
}
|
||||||
|
|
||||||
|
return $" {name}=\"{buf.Remove(buf.Length - 1, 1).ToString()}\"";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
251
src/submodules/OPMLCore.NET/test/UnitTest1.cs
Normal file
251
src/submodules/OPMLCore.NET/test/UnitTest1.cs
Normal file
@@ -0,0 +1,251 @@
|
|||||||
|
using System;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Xml;
|
||||||
|
using Xunit;
|
||||||
|
using OPMLCore.NET;
|
||||||
|
|
||||||
|
namespace test
|
||||||
|
{
|
||||||
|
public class UnitTest1
|
||||||
|
{
|
||||||
|
[Fact]
|
||||||
|
public void NormalTest()
|
||||||
|
{
|
||||||
|
StringBuilder xml = new StringBuilder();
|
||||||
|
xml.Append("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>");
|
||||||
|
xml.Append("<opml version=\"2.0\">");
|
||||||
|
xml.Append("<head>");
|
||||||
|
xml.Append("<title>mySubscriptions.opml</title>");
|
||||||
|
xml.Append("<dateCreated>Sat, 18 Jun 2005 12:11:52 GMT</dateCreated>");
|
||||||
|
xml.Append("<dateModified>Tue, 02 Aug 2005 21:42:48 GMT</dateModified>");
|
||||||
|
xml.Append("<ownerName>fnya</ownerName>");
|
||||||
|
xml.Append("<ownerEmail>fnya@example.com</ownerEmail>");
|
||||||
|
xml.Append("<ownerId>http://news.com.com/</ownerId>");
|
||||||
|
xml.Append("<docs>http://news.com.com/</docs>");
|
||||||
|
xml.Append("<expansionState>1, 6, 13, 16, 18, 20</expansionState>");
|
||||||
|
xml.Append("<vertScrollState>1</vertScrollState>");
|
||||||
|
xml.Append("<windowTop>106</windowTop>");
|
||||||
|
xml.Append("<windowLeft>106</windowLeft>");
|
||||||
|
xml.Append("<windowBottom>558</windowBottom>");
|
||||||
|
xml.Append("<windowRight>479</windowRight>");
|
||||||
|
xml.Append("</head>");
|
||||||
|
xml.Append("<body>");
|
||||||
|
xml.Append("<outline ");
|
||||||
|
xml.Append("text=\"CNET News.com\" ");
|
||||||
|
xml.Append("isComment=\"true\" ");
|
||||||
|
xml.Append("isBreakpoint=\"true\" ");
|
||||||
|
xml.Append("created=\"Tue, 02 Aug 2005 21:42:48 GMT\" ");
|
||||||
|
xml.Append("category=\"/Harvard/Berkman,/Politics\" ");
|
||||||
|
xml.Append("description=\"Tech news and business reports by CNET News.com.\" ");
|
||||||
|
xml.Append("htmlUrl=\"http://news.com.com/\" ");
|
||||||
|
xml.Append("language=\"unknown\" ");
|
||||||
|
xml.Append("title=\"CNET News.com\" ");
|
||||||
|
xml.Append("type=\"rss\" ");
|
||||||
|
xml.Append("version=\"RSS2\" ");
|
||||||
|
xml.Append("xmlUrl=\"http://news.com.com/2547-1_3-0-5.xml\" ");
|
||||||
|
xml.Append("/>");
|
||||||
|
xml.Append("</body>");
|
||||||
|
xml.Append("</opml>");
|
||||||
|
|
||||||
|
XmlDocument doc = new XmlDocument();
|
||||||
|
doc.LoadXml(xml.ToString());
|
||||||
|
Opml opml = new Opml(doc);
|
||||||
|
|
||||||
|
Assert.True(opml.Head.Title == "mySubscriptions.opml");
|
||||||
|
Assert.True(opml.Head.DateCreated == DateTime.Parse("Sat, 18 Jun 2005 12:11:52 GMT"));
|
||||||
|
Assert.True(opml.Head.DateModified == DateTime.Parse("Tue, 02 Aug 2005 21:42:48 GMT"));
|
||||||
|
Assert.True(opml.Head.OwnerName == "fnya");
|
||||||
|
Assert.True(opml.Head.OwnerEmail == "fnya@example.com");
|
||||||
|
Assert.True(opml.Head.OwnerId == "http://news.com.com/");
|
||||||
|
Assert.True(opml.Head.Docs == "http://news.com.com/");
|
||||||
|
Assert.True(opml.Head.ExpansionState.ToArray().SequenceEqual("1,6,13,16,18,20".Split(',')));
|
||||||
|
Assert.True(opml.Head.VertScrollState == "1");
|
||||||
|
Assert.True(opml.Head.WindowTop == "106");
|
||||||
|
Assert.True(opml.Head.WindowLeft == "106");
|
||||||
|
Assert.True(opml.Head.WindowBottom == "558");
|
||||||
|
Assert.True(opml.Head.WindowRight == "479");
|
||||||
|
|
||||||
|
foreach (var outline in opml.Body.Outlines)
|
||||||
|
{
|
||||||
|
Assert.True(outline.Text == "CNET News.com");
|
||||||
|
Assert.True(outline.IsComment == "true");
|
||||||
|
Assert.True(outline.IsBreakpoint == "true");
|
||||||
|
Assert.True(outline.Created == DateTime.Parse("Tue, 02 Aug 2005 21:42:48 GMT"));
|
||||||
|
Assert.True(outline.Category.ToArray().SequenceEqual("/Harvard/Berkman,/Politics".Split(',')));
|
||||||
|
Assert.True(outline.Description == "Tech news and business reports by CNET News.com.");
|
||||||
|
Assert.True(outline.HTMLUrl == "http://news.com.com/");
|
||||||
|
Assert.True(outline.Language == "unknown");
|
||||||
|
Assert.True(outline.Title == "CNET News.com");
|
||||||
|
Assert.True(outline.Type == "rss");
|
||||||
|
Assert.True(outline.Version == "RSS2");
|
||||||
|
Assert.True(outline.XMLUrl == "http://news.com.com/2547-1_3-0-5.xml");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void ChildNodeTest()
|
||||||
|
{
|
||||||
|
StringBuilder xml = new StringBuilder();
|
||||||
|
xml.Append("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>");
|
||||||
|
xml.Append("<opml version=\"2.0\">");
|
||||||
|
xml.Append("<head>");
|
||||||
|
xml.Append("<title>mySubscriptions.opml</title>");
|
||||||
|
xml.Append("</head>");
|
||||||
|
xml.Append("<body>");
|
||||||
|
xml.Append("<outline ");
|
||||||
|
xml.Append("text=\"IT\" >");
|
||||||
|
xml.Append("<outline ");
|
||||||
|
xml.Append("text=\"washingtonpost.com\" ");
|
||||||
|
xml.Append("htmlUrl=\"http://www.washingtonpost.com\" ");
|
||||||
|
xml.Append("xmlUrl=\"http://www.washingtonpost.com/rss.xml\" ");
|
||||||
|
xml.Append("/>");
|
||||||
|
xml.Append("</outline>");
|
||||||
|
xml.Append("</body>");
|
||||||
|
xml.Append("</opml>");
|
||||||
|
|
||||||
|
XmlDocument doc = new XmlDocument();
|
||||||
|
doc.LoadXml(xml.ToString());
|
||||||
|
Opml opml = new Opml(doc);
|
||||||
|
|
||||||
|
foreach (var outline in opml.Body.Outlines)
|
||||||
|
{
|
||||||
|
foreach(var childOutline in outline.Outlines) {
|
||||||
|
Assert.True(childOutline.Text == "washingtonpost.com");
|
||||||
|
Assert.True(childOutline.HTMLUrl == "http://www.washingtonpost.com");
|
||||||
|
Assert.True(childOutline.XMLUrl == "http://www.washingtonpost.com/rss.xml");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void CreateNormalOpmlTest()
|
||||||
|
{
|
||||||
|
Opml opml = new Opml();
|
||||||
|
opml.Encoding = "UTF-8";
|
||||||
|
opml.Version = "2.0";
|
||||||
|
|
||||||
|
Head head = new Head();
|
||||||
|
head.Title = "mySubscriptions.opml";
|
||||||
|
head.DateCreated = DateTime.Parse("Sat, 18 Jun 2005 12:11:52 GMT").ToUniversalTime();
|
||||||
|
head.DateModified = DateTime.Parse("Tue, 02 Aug 2005 21:42:48 GMT").ToUniversalTime();
|
||||||
|
head.OwnerName = "fnya";
|
||||||
|
head.OwnerEmail = "fnya@example.com";
|
||||||
|
head.OwnerId = "http://news.com.com/";
|
||||||
|
head.Docs = "http://news.com.com/";
|
||||||
|
head.ExpansionState.Add("1");
|
||||||
|
head.ExpansionState.Add("6");
|
||||||
|
head.ExpansionState.Add("13");
|
||||||
|
head.ExpansionState.Add("16");
|
||||||
|
head.ExpansionState.Add("18");
|
||||||
|
head.ExpansionState.Add("20");
|
||||||
|
head.VertScrollState = "1";
|
||||||
|
head.WindowTop = "106";
|
||||||
|
head.WindowLeft = "106";
|
||||||
|
head.WindowBottom = "558";
|
||||||
|
head.WindowRight = "479";
|
||||||
|
opml.Head = head;
|
||||||
|
|
||||||
|
Outline outline = new Outline();
|
||||||
|
outline.Text = "CNET News.com";
|
||||||
|
outline.IsComment = "true";
|
||||||
|
outline.IsBreakpoint = "true";
|
||||||
|
outline.Created = DateTime.Parse("Tue, 02 Aug 2005 21:42:48 GMT").ToUniversalTime();
|
||||||
|
outline.Category.Add("/Harvard/Berkman");
|
||||||
|
outline.Category.Add("/Politics");
|
||||||
|
outline.Description = "Tech news and business reports by CNET News.com.";
|
||||||
|
outline.HTMLUrl = "http://news.com.com/";
|
||||||
|
outline.Language = "unknown";
|
||||||
|
outline.Title = "CNET News.com";
|
||||||
|
outline.Type = "rss";
|
||||||
|
outline.Version = "RSS2";
|
||||||
|
outline.XMLUrl = "http://news.com.com/2547-1_3-0-5.xml";
|
||||||
|
|
||||||
|
Body body = new Body();
|
||||||
|
body.Outlines.Add(outline);
|
||||||
|
opml.Body = body;
|
||||||
|
|
||||||
|
StringBuilder xml = new StringBuilder();
|
||||||
|
xml.Append("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\r\n");
|
||||||
|
xml.Append("<opml version=\"2.0\">\r\n");
|
||||||
|
xml.Append("<head>\r\n");
|
||||||
|
xml.Append("<title>mySubscriptions.opml</title>\r\n");
|
||||||
|
xml.Append("<dateCreated>Sat, 18 Jun 2005 12:11:52 GMT</dateCreated>\r\n");
|
||||||
|
xml.Append("<dateModified>Tue, 02 Aug 2005 21:42:48 GMT</dateModified>\r\n");
|
||||||
|
xml.Append("<ownerName>fnya</ownerName>\r\n");
|
||||||
|
xml.Append("<ownerEmail>fnya@example.com</ownerEmail>\r\n");
|
||||||
|
xml.Append("<ownerId>http://news.com.com/</ownerId>\r\n");
|
||||||
|
xml.Append("<docs>http://news.com.com/</docs>\r\n");
|
||||||
|
xml.Append("<expansionState>1,6,13,16,18,20</expansionState>\r\n");
|
||||||
|
xml.Append("<vertScrollState>1</vertScrollState>\r\n");
|
||||||
|
xml.Append("<windowTop>106</windowTop>\r\n");
|
||||||
|
xml.Append("<windowLeft>106</windowLeft>\r\n");
|
||||||
|
xml.Append("<windowBottom>558</windowBottom>\r\n");
|
||||||
|
xml.Append("<windowRight>479</windowRight>\r\n");
|
||||||
|
xml.Append("</head>\r\n");
|
||||||
|
xml.Append("<body>\r\n");
|
||||||
|
xml.Append("<outline ");
|
||||||
|
xml.Append("text=\"CNET News.com\" ");
|
||||||
|
xml.Append("isComment=\"true\" ");
|
||||||
|
xml.Append("isBreakpoint=\"true\" ");
|
||||||
|
xml.Append("created=\"Tue, 02 Aug 2005 21:42:48 GMT\" ");
|
||||||
|
xml.Append("category=\"/Harvard/Berkman,/Politics\" ");
|
||||||
|
xml.Append("description=\"Tech news and business reports by CNET News.com.\" ");
|
||||||
|
xml.Append("htmlUrl=\"http://news.com.com/\" ");
|
||||||
|
xml.Append("language=\"unknown\" ");
|
||||||
|
xml.Append("title=\"CNET News.com\" ");
|
||||||
|
xml.Append("type=\"rss\" ");
|
||||||
|
xml.Append("version=\"RSS2\" ");
|
||||||
|
xml.Append("xmlUrl=\"http://news.com.com/2547-1_3-0-5.xml\" ");
|
||||||
|
xml.Append("/>\r\n");
|
||||||
|
xml.Append("</body>\r\n");
|
||||||
|
xml.Append("</opml>");
|
||||||
|
|
||||||
|
Assert.True(opml.ToString() == xml.ToString());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void CreateChildOpmlTest()
|
||||||
|
{
|
||||||
|
Opml opml = new Opml();
|
||||||
|
opml.Encoding = "UTF-8";
|
||||||
|
opml.Version = "2.0";
|
||||||
|
|
||||||
|
Head head = new Head();
|
||||||
|
head.Title = "mySubscriptions.opml";
|
||||||
|
opml.Head = head;
|
||||||
|
|
||||||
|
Outline outline = new Outline();
|
||||||
|
outline.Text = "IT";
|
||||||
|
|
||||||
|
Outline childOutline = new Outline();
|
||||||
|
childOutline.Text = "CNET News.com";
|
||||||
|
childOutline.HTMLUrl = "http://news.com.com/";
|
||||||
|
childOutline.XMLUrl = "http://news.com.com/2547-1_3-0-5.xml";
|
||||||
|
|
||||||
|
outline.Outlines.Add(childOutline);
|
||||||
|
|
||||||
|
Body body = new Body();
|
||||||
|
body.Outlines.Add(outline);
|
||||||
|
opml.Body = body;
|
||||||
|
|
||||||
|
StringBuilder xml = new StringBuilder();
|
||||||
|
xml.Append("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\r\n");
|
||||||
|
xml.Append("<opml version=\"2.0\">\r\n");
|
||||||
|
xml.Append("<head>\r\n");
|
||||||
|
xml.Append("<title>mySubscriptions.opml</title>\r\n");
|
||||||
|
xml.Append("</head>\r\n");
|
||||||
|
xml.Append("<body>\r\n");
|
||||||
|
xml.Append("<outline text=\"IT\">\r\n");
|
||||||
|
xml.Append("<outline text=\"CNET News.com\" ");
|
||||||
|
xml.Append("htmlUrl=\"http://news.com.com/\" ");
|
||||||
|
xml.Append("xmlUrl=\"http://news.com.com/2547-1_3-0-5.xml\" />\r\n");
|
||||||
|
xml.Append("</outline>\r\n");
|
||||||
|
xml.Append("</body>\r\n");
|
||||||
|
xml.Append("</opml>");
|
||||||
|
|
||||||
|
Assert.True(opml.ToString() == xml.ToString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
20
src/submodules/OPMLCore.NET/test/test.csproj
Normal file
20
src/submodules/OPMLCore.NET/test/test.csproj
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>netcoreapp2.0</TargetFramework>
|
||||||
|
|
||||||
|
<IsPackable>false</IsPackable>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.5.0" />
|
||||||
|
<PackageReference Include="xunit" Version="2.3.1" />
|
||||||
|
<PackageReference Include="xunit.runner.visualstudio" Version="2.3.1" />
|
||||||
|
<DotNetCliToolReference Include="dotnet-xunit" Version="2.3.1" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\src\OPMLCore.NET\OPMLCore.NET.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
Reference in New Issue
Block a user