clean up config/data file parsing a bit, fix redundant code

This commit is contained in:
Jesse Plamondon-Willard 2017-07-31 01:15:45 -04:00
parent cf86505338
commit 962360579e
13 changed files with 155 additions and 417 deletions

View File

@ -49,11 +49,8 @@ namespace Omegasis.AutoSpeed
private void LoadConfig()
{
string path = Path.Combine(this.Helper.DirectoryPath, "AutoSpeed_data.txt");
if (!File.Exists(path)) //if not data.json exists, initialize the data variables to the ModConfig data. I.E. starting out.
{
this.Monitor.Log("The config file for AutoSpeed was not found, guess I'll create it...", LogLevel.Warn);
if (!File.Exists(path))
this.WriteConfig();
}
else
{
string[] text = File.ReadAllLines(path);
@ -66,26 +63,11 @@ namespace Omegasis.AutoSpeed
{
string path = Path.Combine(this.Helper.DirectoryPath, "AutoSpeed_data.txt");
string[] text = new string[20];
if (!File.Exists(path))
{
this.Monitor.Log("The data file for AutoSpeed was not found, guess I'll create it when you sleep.", LogLevel.Info);
text[0] = "Player: AutoSpeed Config:";
text[1] = "====================================================================================";
text[2] = "Player Added Speed:";
text[3] = Speed.ToString();
File.WriteAllLines(path, text);
}
else
{
text[0] = "Player: AutoSpeed Config:";
text[1] = "====================================================================================";
text[2] = "Player Added Speed:";
text[3] = Speed.ToString();
File.WriteAllLines(path, text);
}
}
}
}

View File

@ -61,7 +61,7 @@ namespace Omegasis.BillboardAnywhere
void LoadConfig()
{
string path = Path.Combine(this.Helper.DirectoryPath, "Billboard_Anywhere_Config.txt");
if (!File.Exists(path)) //if not data.json exists, initialize the data variables to the ModConfig data. I.E. starting out.
if (!File.Exists(path))
{
this.KeyBinding = "B";
this.WriteConfig();
@ -78,24 +78,11 @@ namespace Omegasis.BillboardAnywhere
{
string path = Path.Combine(Helper.DirectoryPath, "Billboard_Anywhere_Config.txt");
string[] text = new string[20];
if (!File.Exists(path))
{
this.Monitor.Log("Billboard_Anywhere: The Billboard Anywhere Config doesn't exist. Creating it now.");
text[0] = "Config: Billboard_Anywhere. Feel free to mess with these settings.";
text[1] = "====================================================================================";
text[2] = "Key binding for opening the billboard anywhere. Press this key to do so";
text[3] = this.KeyBinding;
File.WriteAllLines(path, text);
}
else
{
text[0] = "Config: Billboard_Anywhere Info. Feel free to mess with these settings.";
text[1] = "====================================================================================";
text[2] = "Key binding for opening the billboard anywhere. Press this key to do so";
text[3] = this.KeyBinding;
File.WriteAllLines(path, text);
}
}
}
}

View File

@ -238,7 +238,7 @@ namespace Omegasis.BuildEndurance
Directory.CreateDirectory(Path.Combine(Helper.DirectoryPath, "PlayerData"));
string path = Path.Combine(Helper.DirectoryPath, "PlayerData", $"BuildEndurance_data_{Game1.player.name}.txt");
if (!File.Exists(path)) //if not data.json exists, initialize the data variables to the ModConfig data. I.E. starting out.
if (!File.Exists(path))
{
Console.WriteLine("Clear Data Loaded could not find the correct file.");
@ -248,7 +248,6 @@ namespace Omegasis.BuildEndurance
}
else
{
//loads the BuildEndurance_data upon loading the mod
string[] text = File.ReadAllLines(path);
this.BaseStaminaBonus = Convert.ToInt32(text[9]);
this.ClearModEffects = Convert.ToBoolean(text[14]);
@ -263,7 +262,7 @@ namespace Omegasis.BuildEndurance
Directory.CreateDirectory(Path.Combine(Helper.DirectoryPath, "PlayerData"));
string path = Path.Combine(Helper.DirectoryPath, "PlayerData", $"BuildEndurance_data_{Game1.player.name}.txt");
if (!File.Exists(path)) //if not data.json exists, initialize the data variables to the ModConfig data. I.E. starting out.
if (!File.Exists(path))
{
Console.WriteLine("Clear Data Loaded could not find the correct file.");
@ -285,7 +284,7 @@ namespace Omegasis.BuildEndurance
Directory.CreateDirectory(Path.Combine(Helper.DirectoryPath, "PlayerData"));
string path = Path.Combine(Helper.DirectoryPath, "PlayerData", $"BuildEndurance_data_{Game1.player.name}.txt");
if (!File.Exists(path)) //if not data.json exists, initialize the data variables to the ModConfig data. I.E. starting out.
if (!File.Exists(path))
{
this.ExpToNextLevel = this.Config.ExpToNextLevel;
this.CurrentExp = this.Config.CurrentExp;
@ -297,63 +296,26 @@ namespace Omegasis.BuildEndurance
}
else
{
// loads the BuildEndurance_data upon loading the mod
string[] text = File.ReadAllLines(path);
this.CurrentLevel = Convert.ToInt32(text[3]);
this.ExpToNextLevel = Convert.ToDouble(text[7]); //these array locations refer to the lines in BuildEndurance_data.json
this.ExpToNextLevel = Convert.ToDouble(text[7]);
this.CurrentExp = Convert.ToDouble(text[5]);
this.BaseStaminaBonus = Convert.ToInt32(text[9]);
this.CurrentLevelStaminaBonus = Convert.ToInt32(text[11]);
this.ClearModEffects = Convert.ToBoolean(text[14]);
this.OriginalStamina = Convert.ToInt32(text[16]);
this.NightlyStamina = Convert.ToInt32(text[18]); //this should grab the nightly stamina values
this.NightlyStamina = Convert.ToInt32(text[18]);
}
}
/// <summary>Save the configuration settings.</summary>
void WriteConfig()
{
// saves the BuildEndurance_data at the end of a new day
if (!Directory.Exists(Path.Combine(Helper.DirectoryPath, "PlayerData")))
Directory.CreateDirectory(Path.Combine(Helper.DirectoryPath, "PlayerData"));
string path = Path.Combine(Helper.DirectoryPath, "PlayerData", $"BuildEndurance_data_{Game1.player.name}.txt");
string[] text = new string[20];
if (!File.Exists(path))
{
Console.WriteLine("The data file for BuildEndurance was not found, guess I'll create it when you sleep.");
text[0] = "Player: Build Endurance Data. Modification can cause errors. Edit at your own risk.";
text[1] = "====================================================================================";
text[2] = "Player Current Level:";
text[3] = this.CurrentLevel.ToString();
text[4] = "Player Current XP:";
text[5] = this.CurrentExp.ToString();
text[6] = "Xp to next Level:";
text[7] = this.ExpToNextLevel.ToString();
text[8] = "Initial Stam Bonus:";
text[9] = this.BaseStaminaBonus.ToString();
text[10] = "Additional Stam Bonus:";
text[11] = this.CurrentLevelStaminaBonus.ToString();
text[12] = "=======================================================================================";
text[13] = "RESET ALL MOD EFFECTS? This will effective start you back at square 1. Also good if you want to remove this mod.";
text[14] = this.ClearModEffects.ToString();
text[15] = "OLD STAMINA AMOUNT: This is the initial value of the Player's Stamina before this mod took over.";
text[16] = this.OriginalStamina.ToString();
text[17] = "Nightly Stamina Value: This is the value of the player's stamina that was saved when the player slept.";
text[18] = this.NightlyStamina.ToString(); //this should save the player's stamina upon sleeping.
File.WriteAllLines(path, text);
}
else
{
text[0] = "Player: Build Endurance Data. Modification can cause errors. Edit at your own risk.";
text[1] = "====================================================================================";
@ -385,4 +347,3 @@ namespace Omegasis.BuildEndurance
}
}
}
}

View File

@ -71,7 +71,6 @@ namespace Omegasis.BuildHealth
var configPath = Path.Combine(helper.DirectoryPath, "BuildHealthConfig.json");
if (!File.Exists(configPath))
{
this.Monitor.Log("The config file for BuildHealth was not found, guess I'll create it...");
this.Config = new ModConfig
{
CurrentLevel = 0,
@ -235,17 +234,14 @@ namespace Omegasis.BuildHealth
Directory.CreateDirectory(Path.Combine(Helper.DirectoryPath, "PlayerData"));
string path = Path.Combine(Helper.DirectoryPath, "PlayerData", $"BuildHealth_data_{Game1.player.name}.txt");
if (!File.Exists(path)) //if not data.json exists, initialize the data variables to the ModConfig data. I.E. starting out.
if (!File.Exists(path))
{
this.Monitor.Log("The config file for BuildHealth was not found, guess I'll create it...");
this.ClearModEffects = false;
this.OriginalMaxHealth = 0;
this.BaseHealthBonus = 0;
}
else
{
//loads the BuildHealth_data upon loading the mod
string[] text = File.ReadAllLines(path);
this.BaseHealthBonus = Convert.ToInt32(text[9]);
this.ClearModEffects = Convert.ToBoolean(text[14]);
@ -260,10 +256,8 @@ namespace Omegasis.BuildHealth
Directory.CreateDirectory(Path.Combine(Helper.DirectoryPath, "PlayerData"));
string path = Path.Combine(Helper.DirectoryPath, "PlayerData", $"BuildHealth_data_{Game1.player.name}.txt");
if (!File.Exists(path)) //if not data.json exists, initialize the data variables to the ModConfig data. I.E. starting out.
if (!File.Exists(path))
{
this.Monitor.Log("The config file for BuildHealth was not found, guess I'll create it...");
this.ClearModEffects = false;
this.OriginalMaxHealth = 0;
this.BaseHealthBonus = 0;
@ -282,9 +276,8 @@ namespace Omegasis.BuildHealth
Directory.CreateDirectory(Path.Combine(Helper.DirectoryPath, "PlayerData"));
string path = Path.Combine(Helper.DirectoryPath, "PlayerData", $"BuildHealth_data_{Game1.player.name}.txr");
if (!File.Exists(path)) //if not data.json exists, initialize the data variables to the ModConfig data. I.E. starting out.
if (!File.Exists(path))
{
this.Monitor.Log("The config file for BuildHealth was not found, guess I'll create it...");
this.ExpToNextLevel = this.Config.ExpToNextLevel;
this.CurrentExp = this.Config.CurrentExp;
this.CurrentLevel = this.Config.CurrentLevel;
@ -295,10 +288,9 @@ namespace Omegasis.BuildHealth
}
else
{
//loads the BuildHealth_data upon loading the mod
string[] text = File.ReadAllLines(path);
this.CurrentLevel = Convert.ToInt32(text[3]);
this.ExpToNextLevel = Convert.ToDouble(text[7]); //these array locations refer to the lines in BuildHealth_data.json
this.ExpToNextLevel = Convert.ToDouble(text[7]);
this.CurrentExp = Convert.ToDouble(text[5]);
this.BaseHealthBonus = Convert.ToInt32(text[9]);
this.CurrentLevelHealthBonus = Convert.ToInt32(text[11]);
@ -315,41 +307,6 @@ namespace Omegasis.BuildHealth
string path = Path.Combine(Helper.DirectoryPath, "PlayerData", $"BuildHealth_data_{Game1.player.name}.txt");
string[] text = new string[20];
if (!File.Exists(path))
{
this.Monitor.Log("The data file for BuildHealth was not found, guess I'll create it when you sleep.");
//write out the info to a text file at the end of a day. This will run if it doesnt exist.
text[0] = "Player: Build Health Data. Modification can cause errors. Edit at your own risk.";
text[1] = "====================================================================================";
text[2] = "Player Current Level:";
text[3] = this.CurrentLevel.ToString();
text[4] = "Player Current XP:";
text[5] = this.CurrentExp.ToString();
text[6] = "Xp to next Level:";
text[7] = this.ExpToNextLevel.ToString();
text[8] = "Initial Health Bonus:";
text[9] = this.BaseHealthBonus.ToString();
text[10] = "Additional Health Bonus:";
text[11] = this.CurrentLevelHealthBonus.ToString();
text[12] = "=======================================================================================";
text[13] = "RESET ALL MOD EFFECTS? This will effective start you back at square 1. Also good if you want to remove this mod.";
text[14] = this.ClearModEffects.ToString();
text[15] = "OLD Health AMOUNT: This is the initial value of the Player's Health before this mod took over.";
text[16] = this.OriginalMaxHealth.ToString();
File.WriteAllLines(path, text);
}
else
{
//write out the info to a text file at the end of a day.
text[0] = "Player: Build Health Data. Modification can cause errors. Edit at your own risk.";
text[1] = "====================================================================================";
@ -378,4 +335,3 @@ namespace Omegasis.BuildHealth
}
}
}
}

View File

@ -65,7 +65,7 @@ namespace Omegasis.BuyBackCollectables
{
//loads the data to the variables upon loading the game.
string path = Path.Combine(Helper.DirectoryPath, "BuyBack_Config.txt");
if (!File.Exists(path)) //if not data.json exists, initialize the data variables to the ModConfig data. I.E. starting out.
if (!File.Exists(path))
{
this.KeyBinding = "B";
this.CostMultiplier = 3.0;
@ -84,21 +84,6 @@ namespace Omegasis.BuyBackCollectables
//write all of my info to a text file.
string path = Path.Combine(Helper.DirectoryPath, "BuyBack_Config.txt");
string[] text = new string[20];
if (!File.Exists(path))
{
this.Monitor.Log("BuyBack Collections: Config not found. Creating it now.");
text[0] = "Config: Buy Back Collections. Feel free to mess with these settings.";
text[1] = "====================================================================================";
text[2] = "Key binding";
text[3] = this.KeyBinding;
text[4] = "Collectables Multiplier Cost: Sell Value * value listed below";
text[5] = this.CostMultiplier.ToString();
File.WriteAllLines(path, text);
}
else
{
//write out the info to a text file at the end of a day. This will run if it doesnt exist.
text[0] = "Config: Buy Back Collections. Feel free to mess with these settings.";
text[1] = "====================================================================================";
text[2] = "Key binding";
@ -109,4 +94,3 @@ namespace Omegasis.BuyBackCollectables
}
}
}
}

View File

@ -93,10 +93,8 @@ namespace Omegasis.CustomShopsRedux
Directory.CreateDirectory(this.DataPath);
string path = Path.Combine(this.PathOnDisk, "Custom_Shop_Redux_Config.txt");
if (!File.Exists(path)) //if not data.json exists, initialize the data variables to the ModConfig data. I.E. starting out.
{
if (!File.Exists(path))
this.KeyBinding = "U";
}
else
{
string[] text = File.ReadAllLines(path);
@ -107,12 +105,8 @@ namespace Omegasis.CustomShopsRedux
/// <summary>Save the configuration settings.</summary>
private void WriteConfig()
{
string path = Path.Combine(PathOnDisk, "Custom_Shop_Redux_Config.txt");
string path = Path.Combine(this.PathOnDisk, "Custom_Shop_Redux_Config.txt");
string[] text = new string[20];
if (!File.Exists(path))
{
Console.WriteLine("The custom character save info doesn't exist. It will be created when the custom saving method is run. Which is now.");
text[0] = "Config: Custom_Shop_Redux. Feel free to mess with these settings.";
text[1] = "====================================================================================";
@ -121,19 +115,6 @@ namespace Omegasis.CustomShopsRedux
File.WriteAllLines(path, text);
}
else
{
Console.WriteLine("The custom character save info doesn't exist. It will be created when the custom saving method is run. Which is now.");
text[0] = "Config: Custom_Shop_Redux. Feel free to mess with these settings.";
text[1] = "====================================================================================";
text[2] = "Key binding for saving anywhere. Press this key to save anywhere!";
text[3] = this.KeyBinding;
File.WriteAllLines(path, text);
}
}
/// <summary>Open the menu which lets the player choose a file.</summary>
private void OpenSelectFileMenu()

View File

@ -61,7 +61,7 @@ namespace Omegasis.DailyQuestAnywhere
void LoadConfig()
{
string path = Path.Combine(Helper.DirectoryPath, "DailyQuest_Anywhere_Config.txt");
if (!File.Exists(path)) //if not data.json exists, initialize the data variables to the ModConfig data. I.E. starting out.
if (!File.Exists(path))
this.KeyBinding = "H";
else
{
@ -75,22 +75,6 @@ namespace Omegasis.DailyQuestAnywhere
{
string path = Path.Combine(Helper.DirectoryPath, "DailyQuest_Anywhere_Config.txt");
string[] text = new string[20];
if (!File.Exists(path))
{
this.Monitor.Log("DailyQuest_Anywhere: The DailyQuest Anywhere Config doesn't exist. Creating it now.");
text[0] = "Config: DailyQuest_Anywhere Info. Feel free to mess with these settings.";
text[1] = "====================================================================================";
text[2] = "Key binding for opening the billboard for quests anywhere. Press this key to do so";
text[3] = this.KeyBinding;
File.WriteAllLines(path, text);
}
else
{
//write out the info to a text file at the end of a day. This will run if it doesnt exist.
text[0] = "Config: DailyQuest_Anywhere Info. Feel free to mess with these settings.";
text[1] = "====================================================================================";
@ -101,4 +85,3 @@ namespace Omegasis.DailyQuestAnywhere
}
}
}
}

View File

@ -513,7 +513,7 @@ namespace Omegasis.HappyBirthday
private void LoadConfig()
{
string path = Path.Combine(Helper.DirectoryPath, "HappyBirthday_Config.txt");
if (!File.Exists(path)) //if not data.json exists, initialize the data variables to the ModConfig data. I.E. starting out.
if (!File.Exists(path))
this.KeyBinding = "O";
else
{
@ -527,10 +527,6 @@ namespace Omegasis.HappyBirthday
{
string path = Path.Combine(Helper.DirectoryPath, "HappyBirthday_Config.txt");
string[] text = new string[20];
if (!File.Exists(path))
{
this.Monitor.Log("HappyBirthday: The HappyBirthday Config doesn't exist. Creating it now.");
text[0] = "Config: HappyBirthday Info. Feel free to mess with these settings.";
text[1] = "====================================================================================";
@ -539,23 +535,12 @@ namespace Omegasis.HappyBirthday
File.WriteAllLines(path, text);
}
else
{
text[0] = "Config: HappyBirthday Info. Feel free to mess with these settings.";
text[1] = "====================================================================================";
text[2] = "Key binding for opening the birthday menu. Press this key to do so.";
text[3] = this.KeyBinding;
File.WriteAllLines(path, text);
}
}
/// <summary>Load the player's birthday from the config file.</summary>
private void LoadBirthday()
{
string path = Path.Combine(this.BirthdayFolderPath, $"HappyBirthday_{Game1.player.name}.txt");
if (File.Exists(path)) //if not data.json exists, initialize the data variables to the ModConfig data. I.E. starting out.
if (File.Exists(path))
{
string[] text = File.ReadAllLines(path);
this.BirthdaySeason = Convert.ToString(text[3]);
@ -568,22 +553,6 @@ namespace Omegasis.HappyBirthday
{
string path = Path.Combine(this.BirthdayFolderPath, $"HappyBirthday_{Game1.player.name}.txt");
string[] text = new string[20];
if (!File.Exists(path))
{
this.Monitor.Log("HappyBirthday: The HappyBirthday Player Info doesn't exist. Creating it now.");
text[0] = "Player Info: Modifying these values could be considered cheating or an exploit. Edit at your own risk.";
text[1] = "====================================================================================";
text[2] = "Player's Birthday Season";
text[3] = this.BirthdaySeason;
text[4] = "Player's Birthday Date";
text[5] = this.BirthdayDay.ToString();
File.WriteAllLines(path, text);
}
else
{
text[0] = "Player Info: Modifying these values could be considered cheating or an exploit. Edit at your own risk.";
text[1] = "====================================================================================";
@ -596,4 +565,3 @@ namespace Omegasis.HappyBirthday
}
}
}
}

View File

@ -207,10 +207,6 @@ namespace Omegasis.MoreRain
{
string path = Path.Combine(Helper.DirectoryPath, "More_Rain_Config.txt");
string[] text = new string[20];
if (!File.Exists(path))
{
this.Monitor.Log("The data file for More Rain wasn't found. Time to create it!");
//write out the info to a text file at the end of a day. This will run if it doesnt exist.
text[0] = "Player: More Rain Config. Feel free to edit.";
text[1] = "====================================================================================";
text[2] = "Spring Rain chance: The chance out of 100 that it will rain tomorrow.";
@ -236,42 +232,12 @@ namespace Omegasis.MoreRain
File.WriteAllLines(path, text);
}
else
{
this.Monitor.Log("The data file for More Rain wasn't found. Time to create it!");
//write out the info to a text file at the end of a day. This will run if it doesnt exist.
text[0] = "Player: More Rain Config. Feel free to edit.";
text[1] = "====================================================================================";
text[2] = "Spring Rain chance: The chance out of 100 that it will rain tomorrow.";
text[3] = this.SpringRainChance.ToString();
text[4] = "Spring Storm chance: The chance out of 100 that it will be stormy tomorrow.";
text[5] = this.SpringThunderChance.ToString();
text[6] = "Summer Rain chance: The chance out of 100 that it will rain tomorrow.";
text[7] = this.SummerRainChance.ToString();
text[8] = "Summer Storm chance: The chance out of 100 that it will be stormy tomorrow.";
text[9] = this.SummerThunderChance.ToString();
text[10] = "Fall Rain chance: The chance out of 100 that it will rain tomorrow.";
text[11] = this.FallRainChance.ToString();
text[12] = "Fall Storm chance: The chance out of 100 that it will be stormy tomorrow.";
text[13] = this.FallThunderChance.ToString();
text[14] = "Winter Snow chance: The chance out of 100 that it will rain tomorrow.";
text[15] = this.WinterSnowChance.ToString();
text[16] = "Supress Log: If true, the mod won't output any messages to the console.";
text[17] = this.SuppressLog.ToString();
File.WriteAllLines(path, text);
}
}
/// <summary>Load the configuration settings.</summary>
private void LoadConfig()
{
string path = Path.Combine(Helper.DirectoryPath, $"More_Rain_Config.txt");
if (!File.Exists(path)) //if not data.json exists, initialize the data variables to the ModConfig data. I.E. starting out.
if (!File.Exists(path))
{
this.SpringRainChance = 15;
this.SummerRainChance = 5;

View File

@ -80,7 +80,7 @@ namespace Omegasis.MuseumRearranger
private void LoadConfig()
{
string path = Path.Combine(Helper.DirectoryPath, "Museum_Rearrange_Config.txt");
if (!File.Exists(path)) //if not data.json exists, initialize the data variables to the ModConfig data. I.E. starting out.
if (!File.Exists(path))
{
this.ShowMenuKey = "R";
this.ToggleInventoryKey = "T";
@ -98,10 +98,6 @@ namespace Omegasis.MuseumRearranger
{
string path = Path.Combine(Helper.DirectoryPath, "Museum_Rearrange_Config.txt");
string[] text = new string[20];
if (!File.Exists(path))
{
this.Monitor.Log("Museum Rearranger: Config not found. Creating it now.");
text[0] = "Config: Museum_Rearranger. Feel free to mess with these settings.";
text[1] = "====================================================================================";
text[2] = "Key binding for rearranging the museum.";
@ -110,17 +106,5 @@ namespace Omegasis.MuseumRearranger
text[5] = this.ToggleInventoryKey;
File.WriteAllLines(path, text);
}
else
{
//write out the info to a text file at the end of a day. This will run if it doesnt exist.
text[0] = "Config: Save_Anywhere Info. Feel free to mess with these settings.";
text[1] = "====================================================================================";
text[2] = "Key binding for rearranging the museum.";
text[3] = this.ShowMenuKey;
text[4] = "Key binding for showing the menu when rearranging the museum.";
text[5] = this.ToggleInventoryKey;
File.WriteAllLines(path, text);
}
}
}
}

View File

@ -273,9 +273,8 @@ namespace Omegasis.NightOwl
private void LoadConfig()
{
string path = Path.Combine(Helper.DirectoryPath, "Night_Owl_Config_.txt");
if (!File.Exists(path)) //if not data.json exists, initialize the data variables to the ModConfig data. I.E. starting out.
if (!File.Exists(path))
{
this.Monitor.Log("Loading Night_Owl_Config");
this.MorningLightTransition = true;
this.KeepPositionAfterCollapse = true;
this.StayUp = true;

View File

@ -182,28 +182,24 @@ namespace Omegasis.StardewSymphony.Framework
public void Music_Loader_Locations(string conditionalName, IDictionary<string, MusicManager> cues)
{
List<Cue> locationSongs = new List<Cue>();
//loads the data to the variables upon loading the game.
var musicPath = this.Directory;
string mylocation = Path.Combine(musicPath, "Music_Files", "Locations", conditionalName);
string mylocation2 = mylocation;
string mylocation3 = mylocation2 + ".txt";
if (!File.Exists(mylocation3)) //check to make sure the file actually exists
string path = Path.Combine(this.Directory, "Music_Files", "Locations", conditionalName + ".txt");
if (!File.Exists(path))
{
Console.WriteLine("StardewSymohony:A music list for the location " + conditionalName + " does not exist for the music pack located at " + mylocation3 + " which isn't a problem, I just thought I'd let you know since this may have been intentional. Also I'm creating it for you just incase. Cheers.");
Console.WriteLine("StardewSymohony:A music list for the location " + conditionalName + " does not exist for the music pack located at " + path + " which isn't a problem, I just thought I'd let you know since this may have been intentional. Also I'm creating it for you just incase. Cheers.");
//Console.WriteLine("Creating the Config file");
string[] mystring3 = new string[3];//seems legit.
mystring3[0] = conditionalName + " music file. This file holds all of the music that will play when at this game location. Simply type the name of the song below the wall of equal signs.";
mystring3[1] = "========================================================================================";
string[] text = new string[3];//seems legit.
text[0] = conditionalName + " music file. This file holds all of the music that will play when at this game location. Simply type the name of the song below the wall of equal signs.";
text[1] = "========================================================================================";
File.WriteAllLines(mylocation3, mystring3);
File.WriteAllLines(path, text);
}
else
{
Console.WriteLine("Stardew Symphony:The music pack located at: " + this.Directory + " is processing the song info for the game location: " + conditionalName);
string[] readtext = File.ReadAllLines(mylocation3);
string[] readtext = File.ReadAllLines(path);
int i = 2;
var lineCount = File.ReadLines(mylocation3).Count();
var lineCount = File.ReadLines(path).Count();
while (i < lineCount) //the ordering seems bad, but it works.
{
if (Convert.ToString(readtext[i]) == "")
@ -239,24 +235,21 @@ namespace Omegasis.StardewSymphony.Framework
public void Music_Loader_Locations_Rain(string conditionalName, IDictionary<string, MusicManager> cues)
{
List<Cue> locationSongs = new List<Cue>();
var musicPath = this.Directory;
string mylocation = Path.Combine(musicPath, "Music_Files", "Locations", conditionalName);
string mylocation2 = mylocation;
string mylocation3 = mylocation2 + ".txt";
if (!File.Exists(mylocation3)) //check to make sure the file actually exists
string path = Path.Combine(this.Directory, "Music_Files", "Locations", conditionalName + ".txt");
if (!File.Exists(path))
{
Console.WriteLine("StardewSymphony:A music list for the location " + conditionalName + " does not exist for the music pack located at " + mylocation3 + " which isn't a problem, I just thought I'd let you know since this may have been intentional. Also I'm creating it for you just incase. Cheers.");
string[] mystring3 = new string[3];//seems legit.
mystring3[0] = conditionalName + " music file. This file holds all of the music that will play when at this game location. Simply type the name of the song below the wall of equal signs.";
mystring3[1] = "========================================================================================";
File.WriteAllLines(mylocation3, mystring3);
Console.WriteLine("StardewSymphony:A music list for the location " + conditionalName + " does not exist for the music pack located at " + path + " which isn't a problem, I just thought I'd let you know since this may have been intentional. Also I'm creating it for you just incase. Cheers.");
string[] text = new string[3];//seems legit.
text[0] = conditionalName + " music file. This file holds all of the music that will play when at this game location. Simply type the name of the song below the wall of equal signs.";
text[1] = "========================================================================================";
File.WriteAllLines(path, text);
}
else
{
// add in data here
string[] readtext = File.ReadAllLines(mylocation3);
string[] readtext = File.ReadAllLines(path);
int i = 2;
var lineCount = File.ReadLines(mylocation3).Count();
var lineCount = File.ReadLines(path).Count();
while (i < lineCount) //the ordering seems bad, but it works.
{
if (Convert.ToString(readtext[i]) == "")
@ -292,25 +285,21 @@ namespace Omegasis.StardewSymphony.Framework
public void Music_Loader_Locations_Night(string conditionalName, IDictionary<string, MusicManager> cues)
{
List<Cue> locationSongs = new List<Cue>();
//loads the data to the variables upon loading the game.
var musicPath = this.Directory;
string mylocation = Path.Combine(musicPath, "Music_Files", "Locations", conditionalName);
string mylocation2 = mylocation;
string mylocation3 = mylocation2 + ".txt";
if (!File.Exists(mylocation3)) //check to make sure the file actually exists
string path = Path.Combine(this.Directory, "Music_Files", "Locations", conditionalName + ".txt");
if (!File.Exists(path))
{
Console.WriteLine("StardewSymphony:A music list for the location " + conditionalName + " does not exist for the music pack located at " + mylocation3 + " which isn't a problem, I just thought I'd let you know since this may have been intentional. Also I'm creating it for you just incase. Cheers.");
string[] mystring3 = new string[3];//seems legit.
mystring3[0] = conditionalName + " music file. This file holds all of the music that will play when at this game location. Simply type the name of the song below the wall of equal signs.";
mystring3[1] = "========================================================================================";
File.WriteAllLines(mylocation3, mystring3);
Console.WriteLine("StardewSymphony:A music list for the location " + conditionalName + " does not exist for the music pack located at " + path + " which isn't a problem, I just thought I'd let you know since this may have been intentional. Also I'm creating it for you just incase. Cheers.");
string[] text = new string[3];//seems legit.
text[0] = conditionalName + " music file. This file holds all of the music that will play when at this game location. Simply type the name of the song below the wall of equal signs.";
text[1] = "========================================================================================";
File.WriteAllLines(path, text);
}
else
{
// add in data here
string[] readtext = File.ReadAllLines(mylocation3);
string[] readtext = File.ReadAllLines(path);
int i = 2;
var lineCount = File.ReadLines(mylocation3).Count();
var lineCount = File.ReadLines(path).Count();
while (i < lineCount) //the ordering seems bad, but it works.
{
@ -350,7 +339,7 @@ namespace Omegasis.StardewSymphony.Framework
var musicPath = this.Directory;
string path = Path.Combine(musicPath, "Music_Files", "Locations", conditionalName + ".txt");
if (!File.Exists(path)) //check to make sure the file actually exists
if (!File.Exists(path))
{
Console.WriteLine("StardewSymphony:A music list for the location " + conditionalName + " does not exist for the music pack located at " + path + " which isn't a problem, I just thought I'd let you know since this may have been intentional. Also I'm creating it for you just incase. Cheers.");
string[] text = new string[3];//seems legit.

View File

@ -280,11 +280,9 @@ namespace Omegasis.StardewSymphony
}
// read config file
if (File.Exists(Path.Combine(dirPath, "Config.txt")))
{
string temp = Path.Combine(dirPath, "Config.txt");
musicPacks.Add(dirPath, temp);
}
string configPath = Path.Combine(dirPath, "Config.txt");
if (File.Exists(configPath))
musicPacks.Add(dirPath, configPath);
// check subdirectories
foreach (string childDir in Directory.GetDirectories(dirPath))