mirror of
https://github.com/sbrl/PolyFeed.git
synced 2024-11-05 04:03:00 +00:00
Fill out CLI, but it's all untested.
This commit is contained in:
parent
b497ffb0d7
commit
521ce61bc1
2 changed files with 21 additions and 2 deletions
|
@ -87,7 +87,16 @@ namespace PolyFeed
|
||||||
: lastUpdatedNode.Attributes[source.EntryLastUpdatedAttribute].DeEntitizeValue
|
: lastUpdatedNode.Attributes[source.EntryLastUpdatedAttribute].DeEntitizeValue
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
await feed.Write(nextItem);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Render()
|
||||||
|
{
|
||||||
|
xml.Flush();
|
||||||
|
xml.WriteEndDocument();
|
||||||
|
return result.ToString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
using System.Threading.Tasks;
|
||||||
using Nett;
|
using Nett;
|
||||||
|
|
||||||
namespace PolyFeed
|
namespace PolyFeed
|
||||||
|
@ -79,19 +81,27 @@ namespace PolyFeed
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void run()
|
private static async Task<string> run()
|
||||||
{
|
{
|
||||||
FeedSource feedSource = new FeedSource();
|
FeedSource feedSource = new FeedSource();
|
||||||
TomlTable config = Toml.ReadFile(settings.ConfigFilepath, TomlSettings.Create());
|
TomlTable config = Toml.ReadFile(settings.ConfigFilepath, TomlSettings.Create());
|
||||||
|
|
||||||
foreach (KeyValuePair<string, TomlObject> item in config) {
|
foreach (KeyValuePair<string, TomlObject> item in config) {
|
||||||
string key = item.Key;
|
string key = Regex.Replace(
|
||||||
|
item.Key,
|
||||||
|
@"(^|_)[A-Za-z0-9]",
|
||||||
|
(match) => match.Value.Replace("_", "").ToUpper()
|
||||||
|
);
|
||||||
string value = item.Value.Get<TomlString>().Value;
|
string value = item.Value.Get<TomlString>().Value;
|
||||||
feedSource.GetType().GetProperty(value).SetValue(
|
feedSource.GetType().GetProperty(value).SetValue(
|
||||||
feedSource,
|
feedSource,
|
||||||
value
|
value
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FeedBuilder feedBuilder = new FeedBuilder();
|
||||||
|
await feedBuilder.AddSource(feedSource);
|
||||||
|
return await feedBuilder.Render();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue