C
C#9mo ago
ᛁᛊᚺᛁ

How do I make specific tasks download to specific folders?

14 Replies
Angius
Angius9mo ago
What, in this list of URLs, defines where it should be downloaded to?
ᛁᛊᚺᛁ
ᛁᛊᚺᛁOP9mo ago
it doesn't, so should I put that there?
Angius
Angius9mo ago
How else are you going to know what goes where? You should have something like
public class DownloadList
{
public required string DownloadLocation { get; init; }
public required string[] URLs { get; init; }
}
public class DownloadList
{
public required string DownloadLocation { get; init; }
public required string[] URLs { get; init; }
}
var downloads = new DownloadList[]{
new() {
DownloadLocation = "/SomeFolder/",
URLs = [
"https://bla.bla",
"https://foo.bar",
"https://bar.baz",
]
},
new() {
DownloadLocation = "/AnotherLocation/Somewhere/",
URLs = [
"https://swish.swosh",
"https://unga.bunga",
]
},
};
var downloads = new DownloadList[]{
new() {
DownloadLocation = "/SomeFolder/",
URLs = [
"https://bla.bla",
"https://foo.bar",
"https://bar.baz",
]
},
new() {
DownloadLocation = "/AnotherLocation/Somewhere/",
URLs = [
"https://swish.swosh",
"https://unga.bunga",
]
},
};
ᛁᛊᚺᛁ
ᛁᛊᚺᛁOP9mo ago
ok ok thanks Srry I'm a total noob when it comes to C#, this is only my third project. Is there a way to name each URL list? They also need to be settable to "un-used" as some of them (such as the "Redux/Ultra" ones might not be used. The Required ones can go in one big thing, but other than that they need to be slectable
Angius
Angius9mo ago
Just add a name property to DownloadList
ᛁᛊᚺᛁ
ᛁᛊᚺᛁOP9mo ago
ok so would it look something like: var downloads = DownloadList[]{ downloads.Add(new CoreSkse()){//implementation} downloads.Add(new BugFixes()){//implementation} or would the curly brackets go inside the parenthesis like: download.Add(new CoreSkse(){implementation});
Angius
Angius9mo ago
What would implementation be?
ᛁᛊᚺᛁ
ᛁᛊᚺᛁOP9mo ago
the list and downloadlocation
DownloadLocation = Core,
URLs = [
"meant for SKSE, need to do the file + edit",]},
DownloadLocation = Core,
URLs = [
"meant for SKSE, need to do the file + edit",]},
this stuff
Angius
Angius9mo ago
In general though: 1. downloads is an array, arrays cannot be added to, they're fixed size. You would need a list 2. Unless CoreSkse and BugFixes inherit from DownloadList, no, you cannot do that You can use a list, yes
ᛁᛊᚺᛁ
ᛁᛊᚺᛁOP9mo ago
ok, so I'd have to change it to a list?
Angius
Angius9mo ago
And you can .AddRange() to add multiple elements to it How you get those from your CoreSkse and BugFixes classes... up to you Could be a property, could be a method
ᛁᛊᚺᛁ
ᛁᛊᚺᛁOP9mo ago
They're just identifiers, for what settings are chosen in a UI
Angius
Angius9mo ago
You can't write code that clearly instantiates a new class, and then just say "oh it's just an identifier" I assume the code you send is what it is
ᛁᛊᚺᛁ
ᛁᛊᚺᛁOP9mo ago
yes
Want results from more Discord servers?
Add your server