Skip to content
Merged

Wip #10

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
112 changes: 56 additions & 56 deletions ActionEditor.cs

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions ActionsLib.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ static class ActionsLib
public static string ActionEquateDisplay(string ActionName, string ActionArguments)
{
string Returnable = string.Empty;
foreach (string Y in File.ReadAllLines(Constants.AppDirectory + @"Actions\" + ActionName + ".action"))
foreach (string Y in File.ReadAllLines(Constants.AppDirectory + "Actions/" + ActionName + ".action"))
{
if (Y.StartsWith("DISPLAY "))
{
Expand All @@ -19,7 +19,7 @@ public static string ActionEquateDisplay(string ActionName, string ActionArgumen
}
if (Returnable.Length == 0)
return ActionName;
foreach (string Y in File.ReadAllLines(Constants.AppDirectory + @"Actions\" + ActionName + ".action"))
foreach (string Y in File.ReadAllLines(Constants.AppDirectory + "Actions/" + ActionName + ".action"))
{
for (int Z = 0, loopTo = (int)DSGMlib.HowManyChar(ActionArguments, ";"); Z <= loopTo; Z++)
{
Expand Down Expand Up @@ -64,15 +64,15 @@ public static bool ActionIsConditional(object ActionName)
public static string ActionGetIconPath(string ActionName, bool UseFullPath)
{
string Returnable = "Empty.png";
foreach (string X in File.ReadAllLines(Constants.AppDirectory + @"Actions\" + ActionName + ".action"))
foreach (string X in File.ReadAllLines(Constants.AppDirectory + "Actions/" + ActionName + ".action"))
{
if (X.StartsWith("ICON "))
Returnable = X.Substring(5);
}
if (!File.Exists(Constants.AppDirectory + @"ActionIcons\" + Returnable))
if (!File.Exists(Constants.AppDirectory + "ActionIcons/" + Returnable))
Returnable = "Empty.png";
if (UseFullPath)
Returnable = Constants.AppDirectory + @"ActionIcons\" + Returnable;
Returnable = Constants.AppDirectory + "ActionIcons/" + Returnable;
return Returnable;
}

Expand Down
62 changes: 31 additions & 31 deletions Background.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ private void Background_Load(object sender, EventArgs e)
MainToolStrip.Renderer = new clsToolstripRenderer();
NameTextBox.Text = BackgroundName;
Text = BackgroundName;
RealPath = SessionsLib.SessionPath + @"Backgrounds\" + BackgroundName + ".png";
TempPath = SessionsLib.SessionPath + @"Backgrounds\" + BackgroundName + "_Copy.png";
RealPath = SessionsLib.SessionPath + "Backgrounds/" + BackgroundName + ".png";
TempPath = SessionsLib.SessionPath + "Backgrounds/" + BackgroundName + "_Copy.png";
File.Delete(TempPath);
File.Copy(RealPath, TempPath);
ImageChanged = false;
Expand All @@ -53,8 +53,8 @@ private void DAcceptButton_Click(object sender, EventArgs e)
if (!((NewName ?? "") == (BackgroundName ?? "")))
{
DSGMlib.XDSChangeLine("BACKGROUND " + BackgroundName, "BACKGROUND " + NewName);
DSGMlib.SilentMoveFile(RealPath, SessionsLib.SessionPath + @"Backgrounds\" + NewName + ".png");
// File.Move(RealPath, SessionPath + "Backgrounds\" + NewName + ".png")
DSGMlib.SilentMoveFile(RealPath, SessionsLib.SessionPath + "Backgrounds/" + NewName + ".png");
// File.Move(RealPath, SessionPath + "Backgrounds/" + NewName + ".png")
foreach (Form X in Program.Forms.main_Form.MdiChildren)
{
if (X.Name == "Room")
Expand Down Expand Up @@ -146,25 +146,25 @@ private void DAcceptButton_Click(object sender, EventArgs e)
}
}
// Remove the old files (no use!!!!!)
File.Delete(SessionsLib.CompilePath + @"gfx\" + BackgroundName + ".png");
if (Directory.Exists(SessionsLib.CompilePath + @"gfx\bin"))
File.Delete(SessionsLib.CompilePath + "gfx/" + BackgroundName + ".png");
if (Directory.Exists(SessionsLib.CompilePath + "gfx/bin"))
{
File.Delete(SessionsLib.CompilePath + @"gfx\bin\" + BackgroundName + ".c");
File.Delete(SessionsLib.CompilePath + @"gfx\bin\" + BackgroundName + "_Tiles.bin");
File.Delete(SessionsLib.CompilePath + @"gfx\bin\" + BackgroundName + "_Map.bin");
File.Delete(SessionsLib.CompilePath + @"gfx\bin\" + BackgroundName + "_Pal.bin");
File.Delete(SessionsLib.CompilePath + "gfx/bin/" + BackgroundName + ".c");
File.Delete(SessionsLib.CompilePath + "gfx/bin/" + BackgroundName + "_Tiles.bin");
File.Delete(SessionsLib.CompilePath + "gfx/bin/" + BackgroundName + "_Map.bin");
File.Delete(SessionsLib.CompilePath + "gfx/bin/" + BackgroundName + "_Pal.bin");
}
}
if (!((BackgroundName ?? "") == (NewName ?? "")))
if (BackgroundName != NewName)
{
if (File.Exists(SessionsLib.CompilePath + @"gfx\bin\" + BackgroundName + ".c"))
if (File.Exists(SessionsLib.CompilePath + "gfx/bin/" + BackgroundName + ".c"))
{
var BackupDate = File.GetLastWriteTime(SessionsLib.CompilePath + @"gfx\bin\" + BackgroundName + ".c");
// SilentMoveFile(CompilePath + "gfx\bin\" + BackgroundName + ".c", CompilePath + "gfx\bin\" + NewName + ".c")
File.Move(SessionsLib.CompilePath + @"gfx\bin\" + BackgroundName + ".c", SessionsLib.CompilePath + @"gfx\bin\" + NewName + ".c");
var BackupDate = File.GetLastWriteTime(SessionsLib.CompilePath + "gfx/bin/" + BackgroundName + ".c");
// SilentMoveFile(CompilePath + "gfx/bin/" + BackgroundName + ".c", CompilePath + "gfx/bin/" + NewName + ".c")
File.Move(SessionsLib.CompilePath + "gfx/bin/" + BackgroundName + ".c", SessionsLib.CompilePath + "gfx/bin/" + NewName + ".c");
string ToWrite = string.Empty;
string ToPaste = string.Empty;
foreach (string X in DSGMlib.StringToLines(DSGMlib.PathToString(SessionsLib.CompilePath + @"gfx\bin\" + NewName + ".c")))
foreach (string X in DSGMlib.StringToLines(DSGMlib.PathToString(SessionsLib.CompilePath + "gfx/bin/" + NewName + ".c")))
{
ToPaste = X;
switch (X ?? "")
Expand Down Expand Up @@ -207,40 +207,40 @@ private void DAcceptButton_Click(object sender, EventArgs e)
}
ToWrite += ToPaste + Constants.vbCrLf;
}
File.WriteAllText(SessionsLib.CompilePath + @"gfx\bin\" + NewName + ".c", ToWrite);
File.SetLastWriteTime(SessionsLib.CompilePath + @"gfx\bin\" + NewName + ".c", BackupDate);
File.WriteAllText(SessionsLib.CompilePath + "gfx/bin/" + NewName + ".c", ToWrite);
File.SetLastWriteTime(SessionsLib.CompilePath + "gfx/bin/" + NewName + ".c", BackupDate);
}
if (File.Exists(SessionsLib.CompilePath + @"gfx\bin\" + BackgroundName + "_Map.bin"))
if (File.Exists(SessionsLib.CompilePath + "gfx/bin/" + BackgroundName + "_Map.bin"))
{
DSGMlib.SilentMoveFile(SessionsLib.CompilePath + @"gfx\bin\" + BackgroundName + "_Map.bin", SessionsLib.CompilePath + @"gfx\bin\" + NewName + "_Map.bin");
DSGMlib.SilentMoveFile(SessionsLib.CompilePath + "gfx/bin/" + BackgroundName + "_Map.bin", SessionsLib.CompilePath + "gfx/bin/" + NewName + "_Map.bin");
}
if (File.Exists(SessionsLib.CompilePath + @"gfx\bin\" + BackgroundName + "_Tiles.bin"))
if (File.Exists(SessionsLib.CompilePath + "gfx/bin/" + BackgroundName + "_Tiles.bin"))
{
DSGMlib.SilentMoveFile(SessionsLib.CompilePath + @"gfx\bin\" + BackgroundName + "_Tiles.bin", SessionsLib.CompilePath + @"gfx\bin\" + NewName + "_Tiles.bin");
DSGMlib.SilentMoveFile(SessionsLib.CompilePath + "gfx/bin/" + BackgroundName + "_Tiles.bin", SessionsLib.CompilePath + "gfx/bin/" + NewName + "_Tiles.bin");
}
if (File.Exists(SessionsLib.CompilePath + @"gfx\bin\" + BackgroundName + "_Pal.bin"))
if (File.Exists(SessionsLib.CompilePath + "gfx/bin/" + BackgroundName + "_Pal.bin"))
{
DSGMlib.SilentMoveFile(SessionsLib.CompilePath + @"gfx\bin\" + BackgroundName + "_Pal.bin", SessionsLib.CompilePath + @"gfx\bin\" + NewName + "_Pal.bin");
DSGMlib.SilentMoveFile(SessionsLib.CompilePath + "gfx/bin/" + BackgroundName + "_Pal.bin", SessionsLib.CompilePath + "gfx/bin/" + NewName + "_Pal.bin");
}
if (File.Exists(SessionsLib.CompilePath + @"gfx\" + BackgroundName + ".png"))
if (File.Exists(SessionsLib.CompilePath + "gfx/" + BackgroundName + ".png"))
{
DSGMlib.SilentMoveFile(SessionsLib.CompilePath + @"gfx\" + BackgroundName + ".png", SessionsLib.CompilePath + @"gfx\" + NewName + ".png");
DSGMlib.SilentMoveFile(SessionsLib.CompilePath + "gfx/" + BackgroundName + ".png", SessionsLib.CompilePath + "gfx/" + NewName + ".png");
}
string NewString = string.Empty;
foreach (string X_ in DSGMlib.StringToLines(DSGMlib.PathToString(SessionsLib.CompilePath + @"gfx\dsgm_gfx.h")))
foreach (string X_ in DSGMlib.StringToLines(DSGMlib.PathToString(SessionsLib.CompilePath + "gfx/dsgm_gfx.h")))
{
string X = X_;
if ((X ?? "") == ("extern const PA_BgStruct " + BackgroundName + ";" ?? ""))
X = "extern const PA_BgStruct " + NewName + ";";
NewString += X + Constants.vbCrLf;
}
File.WriteAllText(SessionsLib.CompilePath + @"gfx\temp_gfx.h", NewString);
File.Delete(SessionsLib.CompilePath + @"gfx\dsgm_gfx.h");
DSGMlib.SilentMoveFile(SessionsLib.CompilePath + @"gfx\temp_gfx.h", SessionsLib.CompilePath + @"gfx\dsgm_gfx.h");
File.WriteAllText(SessionsLib.CompilePath + "gfx/temp_gfx.h", NewString);
File.Delete(SessionsLib.CompilePath + "gfx/dsgm_gfx.h");
DSGMlib.SilentMoveFile(SessionsLib.CompilePath + "gfx/temp_gfx.h", SessionsLib.CompilePath + "gfx/dsgm_gfx.h");
}
foreach (TreeNode X in Program.Forms.main_Form.ResourcesTreeView.Nodes[(int)DSGMlib.ResourceIDs.Background].Nodes)
{
if ((X.Text ?? "") == (BackgroundName ?? ""))
if (X.Text == BackgroundName)
X.Text = NewName;
}
Close();
Expand Down
18 changes: 9 additions & 9 deletions DObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public void ActionMouseEnter(object sender, EventArgs e)
ActionNameLabel.Text = ActionName;
ArgumentsListLabel.Text = string.Empty;
byte ArgumentCount = 0;
foreach (string X_ in File.ReadAllLines(Constants.AppDirectory + @"Actions\" + ActionName + ".action"))
foreach (string X_ in File.ReadAllLines(Constants.AppDirectory + "Actions/" + ActionName + ".action"))
{
string X = X_;
if (X.StartsWith("ARG "))
Expand Down Expand Up @@ -120,7 +120,7 @@ public void ActionMouseUp(object sender, MouseEventArgs e)
return;
byte ArgCount = 0;
bool NoAppliesTo = false;
foreach (string X in File.ReadAllLines(Constants.AppDirectory + @"Actions\" + ActionName + ".action"))
foreach (string X in File.ReadAllLines(Constants.AppDirectory + "Actions/" + ActionName + ".action"))
{
if (X.StartsWith("ARG "))
ArgCount = (byte)(ArgCount + 1);
Expand Down Expand Up @@ -261,7 +261,7 @@ public void GenerateIndentIndices()
{
string ActionName = Actions[X];
byte IndentChange = 0;
foreach (string Y in File.ReadAllLines(Constants.AppDirectory + @"Actions\" + ActionName + ".action"))
foreach (string Y in File.ReadAllLines(Constants.AppDirectory + "Actions/" + ActionName + ".action"))
{
if (Y == "INDENT")
{
Expand Down Expand Up @@ -289,7 +289,7 @@ public void GenerateIndentIndices()
// For X As Int16 = 0 To Actions.Count - 1
// IndentChange = 0
// Dim ActionName As String = Actions(X)
// For Each Y As String In IO.File.ReadAllLines(AppPath + "Actions\" + ActionName + ".action")
// For Each Y As String In IO.File.ReadAllLines(AppPath + "Actions/" + ActionName + ".action")
// If Y = "INDENT" Then IndentChange = 2 : Exit For
// If Y = "DEDENT" Then IndentChange = 1 : Exit For
// Next
Expand Down Expand Up @@ -320,11 +320,11 @@ public void RenderSprite()
string ImagePath;
if (SpriteDropper.Text == "None")
{
ImagePath = Constants.AppDirectory + @"Resources\NoSprite.png";
ImagePath = Constants.AppDirectory + "Resources/NoSprite.png";
}
else
{
ImagePath = SessionsLib.SessionPath + @"Sprites\" + Frame.ToString() + "_" + SpriteDropper.Text + ".png";
ImagePath = SessionsLib.SessionPath + "Sprites/" + Frame.ToString() + "_" + SpriteDropper.Text + ".png";
}
var Drawable = DSGMlib.PathToImage(ImagePath);
Drawable = DSGMlib.MakeBMPTransparent(Drawable, Color.Magenta);
Expand Down Expand Up @@ -384,7 +384,7 @@ public void PopulateActionsTabControl(ref TabControl RAppliesTo)
var Actions = new List<string>();
foreach (string Z in Directory.GetFiles(Constants.AppDirectory + "Actions"))
{
string ActionName = Z.Substring(Z.LastIndexOf(@"\") + 1);
string ActionName = Z.Substring(Z.LastIndexOf("/") + 1);
ActionName = ActionName.Substring(0, ActionName.LastIndexOf("."));
if (Hide)
{
Expand Down Expand Up @@ -680,7 +680,7 @@ private void SpriteDropper_SelectedIndexChanged(object sender, EventArgs e)
foreach (string X_ in Directory.GetFiles(SessionsLib.SessionPath + "Sprites"))
{
string X = X_;
X = X.Substring(X.LastIndexOf(@"\") + 1);
X = X.Substring(X.LastIndexOf("/") + 1);
X = X.Substring(0, X.LastIndexOf("."));
X = X.Substring(X.IndexOf("_") + 1);
if ((X ?? "") == (SpriteDropper.Text ?? ""))
Expand Down Expand Up @@ -1226,7 +1226,7 @@ public bool ShouldAllowDialog(string ActionName)
{
bool NoAppliesTo = false;
byte ArgCount = 0;
foreach (string X in File.ReadAllLines(Constants.AppDirectory + @"Actions\" + Actions[ActionsList.SelectedIndices[0]] + ".action"))
foreach (string X in File.ReadAllLines(Constants.AppDirectory + "Actions/" + Actions[ActionsList.SelectedIndices[0]] + ".action"))
{
if (X == "NOAPPLIES")
NoAppliesTo = true;
Expand Down
Loading
Loading