mirror of
https://github.com/tonytins/PublishTimes.git
synced 2025-03-14 20:01:20 +00:00
Grab topics from config, if it exists
This commit is contained in:
parent
a485dc1a59
commit
8cf1e917f6
3 changed files with 12 additions and 10 deletions
|
@ -1,2 +1,3 @@
|
|||
global using Tomlyn;
|
||||
global using System.Diagnostics;
|
||||
global using Tomlyn.Model;
|
||||
global using System.Globalization;
|
||||
|
|
|
@ -75,20 +75,21 @@ if (Console.ReadKey().Key == ConsoleKey.Y)
|
|||
var model = Toml.ToModel(toml);
|
||||
var usrDir = (string)model["path"];
|
||||
var usrFileName = (string)model["file"];
|
||||
// var usrList = (string[])model["communities"];
|
||||
var tomlList = string.Join(", ", (TomlArray)model["topics"]);
|
||||
var usrList = tomlList.Split(',');
|
||||
|
||||
if (!string.IsNullOrEmpty(usrDir))
|
||||
fileDir = usrDir;
|
||||
|
||||
if (!string.IsNullOrEmpty(usrFileName))
|
||||
scheduleFile = usrFileName;
|
||||
/*
|
||||
|
||||
if (usrList.Length > 0)
|
||||
{
|
||||
var chooseUsrTopic = rng.Next(0, usrList.Length);
|
||||
topic = usrList[chooseUsrTopic];
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
// Set new file Path
|
||||
filePath = Path.Combine(fileDir, scheduleFile);
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
path = "/home/tonytins/Documents/"
|
||||
file = "newscycle.txt"
|
||||
communities = [ "Games", "Politics", "Research", "Technology" ]
|
||||
topics = [ "Games", "Technology", "Cybersecurity" ]
|
||||
|
|
Loading…
Add table
Reference in a new issue