Commit e6585bbf authored by nanahira's avatar nanahira

Merge branch 'master' of github.com:IceYGO/windbot

parents bb7f6a1b bbb765d1
......@@ -60,8 +60,7 @@ namespace WindBot.Game.AI.Decks
public const int WynnP = 30674956;
public const int HiitaP = 48815792;
public const int LynaP = 9839945;
// side
// side
public const int Raigeki = 12580477;
public const int lightningStorm = 14532163;
public const int CosmicCyclone = 8267140;
......@@ -100,7 +99,6 @@ namespace WindBot.Game.AI.Decks
AddExecutor(ExecutorType.Activate, CardId.HarpieFeatherDuster, DefaultHarpiesFeatherDusterFirst);
AddExecutor(ExecutorType.Activate, CardId.CosmicCyclone, DefaultMysticalSpaceTyphoon);
AddExecutor(ExecutorType.Activate, CardId.Raigeki, DefaultRaigeki);
AddExecutor(ExecutorType.Activate, CardId.PotOfDesires, PotOfDesireseff);
//sp
AddExecutor(ExecutorType.Activate, CardId.Linkuriboh, Linkuriboheff);
......
......@@ -59,7 +59,7 @@ namespace WindBot.Game.AI
_game = game;
DataContractJsonSerializer serializer = new DataContractJsonSerializer(typeof(DialogsData));
string dialogfilename = game.Dialog;
using (FileStream fs = File.OpenRead("Dialogs/" + dialogfilename + ".json"))
using (FileStream fs = Program.ReadFile("Dialogs", dialogfilename, "json"))
{
DialogsData data = (DialogsData)serializer.ReadObject(fs);
_welcome = data.welcome;
......
......@@ -43,7 +43,7 @@ namespace WindBot.Game
StreamReader reader = null;
try
{
reader = new StreamReader(new FileStream("Decks/" + name + ".ydk", FileMode.Open, FileAccess.Read));
reader = new StreamReader(Program.ReadFile("Decks", name, "ydk"));
Deck deck = new Deck();
bool side = false;
......
......@@ -201,5 +201,22 @@ namespace WindBot
}
#endif
}
public static FileStream ReadFile(string directory, string filename, string extension)
{
string tryfilename = filename + "." + extension;
string fullpath = Path.Combine(directory, tryfilename);
if (!File.Exists(fullpath))
fullpath = filename;
if (!File.Exists(fullpath))
fullpath = Path.Combine("../", filename);
if (!File.Exists(fullpath))
fullpath = Path.Combine("../deck/", filename);
if (!File.Exists(fullpath))
fullpath = Path.Combine("../", tryfilename);
if (!File.Exists(fullpath))
fullpath = Path.Combine("../deck/", tryfilename);
return new FileStream(fullpath, FileMode.Open, FileAccess.Read);
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment