expansivemango
Member
- Joined
- Jun 3, 2015
- Messages
- 6
- Programming Experience
- Beginner
I have a very basic background with programming and I'm trying to learn more with C# (for Unity and projects related to Game development)... but I have a question that I'm hoping is fairly simple to answer. I have a file in a .sqf format (ArmAIII script). Inside this file are include statements pointing to other .sqf files.
I'm looking for a way to find the full path of each of these .sqf files contained within an open file, but the only thing I know about the path is that it will contain the file extension ".sqf". Can anyone provide some guidance on how to search for a full path (of unknown folder names)? So far I was able to find the index of where the string is... I'm also not sure if this algorithm makes sense, but I think I would have to read to the left of this index and find the first open quote, then read to the right and find the first close quote, then looping between these indices should build the correct path name. So far I can only get the indexOf string.
I'm looking for a way to find the full path of each of these .sqf files contained within an open file, but the only thing I know about the path is that it will contain the file extension ".sqf". Can anyone provide some guidance on how to search for a full path (of unknown folder names)? So far I was able to find the index of where the string is... I'm also not sure if this algorithm makes sense, but I think I would have to read to the left of this index and find the first open quote, then read to the right and find the first close quote, then looping between these indices should build the correct path name. So far I can only get the indexOf string.
C#:
public static void CrawlFile(string file){
string readText = File.ReadAllText(file);
if (readText.Contains(".sqf")){
Console.WriteLine(readText.IndexOf(".sqf"));
}
}