From a71ef8e889d328e83f8c61cc3adc01647118ce24 Mon Sep 17 00:00:00 2001 From: eaxvac Date: Sun, 12 Jul 2020 18:56:55 +0800 Subject: [PATCH 1/5] [HaCreator] QOL - when opening a new map, filter the map names relative to the maps near the current map opened in the board --- HaCreator/GUI/Load.cs | 14 +++++++------- HaCreator/GUI/Load.designer.cs | 12 ++++++------ HaCreator/MapEditor/HaCreatorStateManager.cs | 20 +++++++++++++++----- MapleLib/WzLib/WzDirectory.cs | 4 ++-- MapleLib/WzLib/WzImage.cs | 6 +++++- 5 files changed, 35 insertions(+), 21 deletions(-) diff --git a/HaCreator/GUI/Load.cs b/HaCreator/GUI/Load.cs index f08e6353..b21cd6f2 100644 --- a/HaCreator/GUI/Load.cs +++ b/HaCreator/GUI/Load.cs @@ -27,7 +27,7 @@ public partial class Load : System.Windows.Forms.Form private System.Windows.Controls.TabControl Tabs; private System.Windows.RoutedEventHandler[] rightClickHandler; - private string defaultMapNameFilter; + private readonly string defaultMapNameFilter; /// /// @@ -78,7 +78,7 @@ private void Load_Load(object sender, EventArgs e) } } - private void selectionChanged(object sender, EventArgs e) + private void SelectionChanged(object sender, EventArgs e) { if (HAMSelect.Checked) { @@ -109,7 +109,7 @@ private void selectionChanged(object sender, EventArgs e) } } - private void browseXML_Click(object sender, EventArgs e) + private void BrowseXML_Click(object sender, EventArgs e) { OpenFileDialog dialog = new OpenFileDialog(); dialog.Title = "Select XML to load..."; @@ -122,7 +122,7 @@ private void browseXML_Click(object sender, EventArgs e) loadButton.Enabled = true; } - private void browseHAM_Click(object sender, EventArgs e) + private void BrowseHAM_Click(object sender, EventArgs e) { OpenFileDialog dialog = new OpenFileDialog(); dialog.Title = "Select Map to load..."; @@ -135,7 +135,7 @@ private void browseHAM_Click(object sender, EventArgs e) loadButton.Enabled = true; } - private void loadButton_Click(object sender, EventArgs e) + private void LoadButton_Click(object sender, EventArgs e) { //Hide(); WaitWindow ww = new WaitWindow("Loading..."); @@ -207,7 +207,7 @@ private void loadButton_Click(object sender, EventArgs e) Close(); } - private void mapBrowser_SelectionChanged() + private void MapBrowser_SelectionChanged() { loadButton.Enabled = mapBrowser.LoadAvailable; } @@ -220,7 +220,7 @@ private void Load_KeyDown(object sender, KeyEventArgs e) } else if (e.KeyCode == Keys.Enter) { - loadButton_Click(null, null); + LoadButton_Click(null, null); } } diff --git a/HaCreator/GUI/Load.designer.cs b/HaCreator/GUI/Load.designer.cs index 992bb79e..b366422f 100644 --- a/HaCreator/GUI/Load.designer.cs +++ b/HaCreator/GUI/Load.designer.cs @@ -50,7 +50,7 @@ private void InitializeComponent() this.loadButton.Size = new System.Drawing.Size(747, 30); this.loadButton.TabIndex = 9; this.loadButton.Text = "Load"; - this.loadButton.Click += new System.EventHandler(this.loadButton_Click); + this.loadButton.Click += new System.EventHandler(this.LoadButton_Click); // // WZSelect // @@ -63,7 +63,7 @@ private void InitializeComponent() this.WZSelect.TabStop = true; this.WZSelect.Text = "WZ"; this.WZSelect.UseVisualStyleBackColor = true; - this.WZSelect.CheckedChanged += new System.EventHandler(this.selectionChanged); + this.WZSelect.CheckedChanged += new System.EventHandler(this.SelectionChanged); // // XMLSelect // @@ -74,7 +74,7 @@ private void InitializeComponent() this.XMLSelect.TabIndex = 3; this.XMLSelect.Text = "XML"; this.XMLSelect.UseVisualStyleBackColor = true; - this.XMLSelect.CheckedChanged += new System.EventHandler(this.selectionChanged); + this.XMLSelect.CheckedChanged += new System.EventHandler(this.SelectionChanged); // // XMLBox // @@ -83,7 +83,7 @@ private void InitializeComponent() this.XMLBox.Name = "XMLBox"; this.XMLBox.Size = new System.Drawing.Size(692, 22); this.XMLBox.TabIndex = 4; - this.XMLBox.Click += new System.EventHandler(this.browseXML_Click); + this.XMLBox.Click += new System.EventHandler(this.BrowseXML_Click); this.XMLBox.TextChanged += new System.EventHandler(this.XMLBox_TextChanged); // // HAMBox @@ -93,7 +93,7 @@ private void InitializeComponent() this.HAMBox.Name = "HAMBox"; this.HAMBox.Size = new System.Drawing.Size(692, 22); this.HAMBox.TabIndex = 1; - this.HAMBox.Click += new System.EventHandler(this.browseHAM_Click); + this.HAMBox.Click += new System.EventHandler(this.BrowseHAM_Click); this.HAMBox.TextChanged += new System.EventHandler(this.HAMBox_TextChanged); // // HAMSelect @@ -114,7 +114,7 @@ private void InitializeComponent() this.mapBrowser.Name = "mapBrowser"; this.mapBrowser.Size = new System.Drawing.Size(746, 465); this.mapBrowser.TabIndex = 8; - this.mapBrowser.SelectionChanged += new HaCreator.CustomControls.MapBrowser.MapSelectChangedDelegate(this.mapBrowser_SelectionChanged); + this.mapBrowser.SelectionChanged += new HaCreator.CustomControls.MapBrowser.MapSelectChangedDelegate(this.MapBrowser_SelectionChanged); // // searchBox // diff --git a/HaCreator/MapEditor/HaCreatorStateManager.cs b/HaCreator/MapEditor/HaCreatorStateManager.cs index caa7c4e4..98678f1d 100644 --- a/HaCreator/MapEditor/HaCreatorStateManager.cs +++ b/HaCreator/MapEditor/HaCreatorStateManager.cs @@ -41,7 +41,11 @@ public class HaCreatorStateManager private readonly System.Windows.Controls.TabControl tabs; // StatusBar (bottom) - private System.Windows.Controls.TextBlock textblock_CursorX, textblock_CursorY, textblock_RCursorX, textblock_RCursorY, textblock_selectedItem; + private readonly SystemWinCtl.TextBlock textblock_CursorX; + private readonly SystemWinCtl.TextBlock textblock_CursorY; + private readonly SystemWinCtl.TextBlock textblock_RCursorX; + private readonly SystemWinCtl.TextBlock textblock_RCursorY; + private readonly SystemWinCtl.TextBlock textblock_selectedItem; private readonly InputHandler input; private TilePanel tilePanel; @@ -68,7 +72,7 @@ public HaCreatorStateManager(MultiBoard multiBoard, HaRibbon ribbon, System.Wind this.backupMan = new BackupManager(multiBoard, input, this, tabs); this.ribbon.NewClicked += ribbon_NewClicked; - this.ribbon.OpenClicked += ribbon_OpenClicked; + this.ribbon.OpenClicked += Ribbon_OpenClicked; this.ribbon.SaveClicked += ribbon_SaveClicked; this.ribbon.RepackClicked += ribbon_RepackClicked; this.ribbon.AboutClicked += ribbon_AboutClicked; @@ -103,7 +107,7 @@ public HaCreatorStateManager(MultiBoard multiBoard, HaRibbon ribbon, System.Wind this.multiBoard.MouseMoved += multiBoard_MouseMoved; this.multiBoard.ImageDropped += multiBoard_ImageDropped; this.multiBoard.ExportRequested += ribbon_ExportClicked; - this.multiBoard.LoadRequested += ribbon_OpenClicked; + this.multiBoard.LoadRequested += Ribbon_OpenClicked; this.multiBoard.CloseTabRequested += multiBoard_CloseTabRequested; this.multiBoard.SwitchTabRequested += multiBoard_SwitchTabRequested; this.multiBoard.BackupCheck += multiBoard_BackupCheck; @@ -740,9 +744,15 @@ void ribbon_NewClicked() LoadMap(new New(multiBoard, tabs, MakeRightClickHandler())); } - void ribbon_OpenClicked() + void Ribbon_OpenClicked() { - LoadMap(new Load(multiBoard, tabs, MakeRightClickHandler())); + string mapNameFilter = null; + Board currentSelectedBoard = multiBoard.SelectedBoard; + if (currentSelectedBoard != null) + { + mapNameFilter = ( currentSelectedBoard.MapInfo.id / 10000).ToString(); // shows near-by maps relative to the current map opened in the Board + } + LoadMap(new Load(multiBoard, tabs, MakeRightClickHandler(), mapNameFilter)); } /// diff --git a/MapleLib/WzLib/WzDirectory.cs b/MapleLib/WzLib/WzDirectory.cs index 5c163a13..6dad06db 100644 --- a/MapleLib/WzLib/WzDirectory.cs +++ b/MapleLib/WzLib/WzDirectory.cs @@ -381,11 +381,11 @@ internal int GenerateDataFile(string fileName, byte[] useIv) size += nameLen; size += dir.GenerateDataFile(fileName, useIv); size += WzTool.GetCompressedIntLength(dir.size); - size += WzTool.GetCompressedIntLength(dir.checksum); + size += WzTool.GetCompressedIntLength(dir.Checksum); size += 4; offsetSize += nameLen; offsetSize += WzTool.GetCompressedIntLength(dir.size); - offsetSize += WzTool.GetCompressedIntLength(dir.checksum); + offsetSize += WzTool.GetCompressedIntLength(dir.Checksum); offsetSize += 4; } return size; diff --git a/MapleLib/WzLib/WzImage.cs b/MapleLib/WzLib/WzImage.cs index 375a0a01..fe413266 100644 --- a/MapleLib/WzLib/WzImage.cs +++ b/MapleLib/WzLib/WzImage.cs @@ -253,7 +253,7 @@ public WzImageProperty GetFromPath(string path) } /// - /// Adds a property to the image + /// Adds a property to the WzImage /// /// Property to add public void AddProperty(WzImageProperty prop) @@ -262,6 +262,10 @@ public void AddProperty(WzImageProperty prop) if (reader != null && !parsed) ParseImage(); properties.Add(prop); } + /// + /// Add a list of properties to the WzImage + /// + /// public void AddProperties(List props) { foreach (WzImageProperty prop in props) From b7f1c8ade5b8a8363bf9a8c85b95b4efbd3286cf Mon Sep 17 00:00:00 2001 From: eaxvac Date: Sun, 12 Jul 2020 23:11:42 +0800 Subject: [PATCH 2/5] [HaCreator] Fixed issues with simulator loading 'Elina: Soaring land' map Id = 867119250 --- HaCreator/MapEditor/HaCreatorStateManager.cs | 202 +++++++++---------- HaCreator/MapSimulator/MapSimulatorLoader.cs | 107 +++++----- 2 files changed, 160 insertions(+), 149 deletions(-) diff --git a/HaCreator/MapEditor/HaCreatorStateManager.cs b/HaCreator/MapEditor/HaCreatorStateManager.cs index 98678f1d..9eb32858 100644 --- a/HaCreator/MapEditor/HaCreatorStateManager.cs +++ b/HaCreator/MapEditor/HaCreatorStateManager.cs @@ -71,48 +71,48 @@ public HaCreatorStateManager(MultiBoard multiBoard, HaRibbon ribbon, System.Wind this.backupMan = new BackupManager(multiBoard, input, this, tabs); - this.ribbon.NewClicked += ribbon_NewClicked; + this.ribbon.NewClicked += Ribbon_NewClicked; this.ribbon.OpenClicked += Ribbon_OpenClicked; - this.ribbon.SaveClicked += ribbon_SaveClicked; - this.ribbon.RepackClicked += ribbon_RepackClicked; - this.ribbon.AboutClicked += ribbon_AboutClicked; - this.ribbon.HelpClicked += ribbon_HelpClicked; - this.ribbon.SettingsClicked += ribbon_SettingsClicked; - this.ribbon.ExitClicked += ribbon_ExitClicked; - this.ribbon.ViewToggled += ribbon_ViewToggled; - this.ribbon.ShowMinimapToggled += ribbon_ShowMinimapToggled; - this.ribbon.ParallaxToggled += ribbon_ParallaxToggled; + this.ribbon.SaveClicked += Ribbon_SaveClicked; + this.ribbon.RepackClicked += Ribbon_RepackClicked; + this.ribbon.AboutClicked += Ribbon_AboutClicked; + this.ribbon.HelpClicked += Ribbon_HelpClicked; + this.ribbon.SettingsClicked += Ribbon_SettingsClicked; + this.ribbon.ExitClicked += Ribbon_ExitClicked; + this.ribbon.ViewToggled += Ribbon_ViewToggled; + this.ribbon.ShowMinimapToggled += Ribbon_ShowMinimapToggled; + this.ribbon.ParallaxToggled += Ribbon_ParallaxToggled; this.ribbon.LayerViewChanged += ribbon_LayerViewChanged; - this.ribbon.MapSimulationClicked += ribbon_MapSimulationClicked; - this.ribbon.RegenerateMinimapClicked += ribbon_RegenerateMinimapClicked; - this.ribbon.SnappingToggled += ribbon_SnappingToggled; - this.ribbon.RandomTilesToggled += ribbon_RandomTilesToggled; - this.ribbon.InfoModeToggled += ribbon_InfoModeToggled; - this.ribbon.HaRepackerClicked += ribbon_HaRepackerClicked; - this.ribbon.FinalizeClicked += ribbon_FinalizeClicked; + this.ribbon.MapSimulationClicked += Ribbon_MapSimulationClicked; + this.ribbon.RegenerateMinimapClicked += Ribbon_RegenerateMinimapClicked; + this.ribbon.SnappingToggled += Ribbon_SnappingToggled; + this.ribbon.RandomTilesToggled += Ribbon_RandomTilesToggled; + this.ribbon.InfoModeToggled += Ribbon_InfoModeToggled; + this.ribbon.HaRepackerClicked += Ribbon_HaRepackerClicked; + this.ribbon.FinalizeClicked += Ribbon_FinalizeClicked; this.ribbon.NewPlatformClicked += ribbon_NewPlatformClicked; - this.ribbon.UserObjsClicked += ribbon_UserObjsClicked; - this.ribbon.ExportClicked += ribbon_ExportClicked; + this.ribbon.UserObjsClicked += Ribbon_UserObjsClicked; + this.ribbon.ExportClicked += Ribbon_ExportClicked; this.ribbon.RibbonKeyDown += multiBoard.DxContainer_KeyDown; this.tabs.SelectionChanged += Tabs_SelectionChanged; - this.multiBoard.OnBringToFrontClicked += multiBoard_OnBringToFrontClicked; - this.multiBoard.OnEditBaseClicked += multiBoard_OnEditBaseClicked; - this.multiBoard.OnEditInstanceClicked += multiBoard_OnEditInstanceClicked; - this.multiBoard.OnLayerTSChanged += multiBoard_OnLayerTSChanged; - this.multiBoard.OnSendToBackClicked += multiBoard_OnSendToBackClicked; - this.multiBoard.ReturnToSelectionState += multiBoard_ReturnToSelectionState; - this.multiBoard.SelectedItemChanged += multiBoard_SelectedItemChanged; - this.multiBoard.MouseMoved += multiBoard_MouseMoved; - this.multiBoard.ImageDropped += multiBoard_ImageDropped; - this.multiBoard.ExportRequested += ribbon_ExportClicked; + this.multiBoard.OnBringToFrontClicked += MultiBoard_OnBringToFrontClicked; + this.multiBoard.OnEditBaseClicked += MultiBoard_OnEditBaseClicked; + this.multiBoard.OnEditInstanceClicked += MultiBoard_OnEditInstanceClicked; + this.multiBoard.OnLayerTSChanged += MultiBoard_OnLayerTSChanged; + this.multiBoard.OnSendToBackClicked += MultiBoard_OnSendToBackClicked; + this.multiBoard.ReturnToSelectionState += MultiBoard_ReturnToSelectionState; + this.multiBoard.SelectedItemChanged += MultiBoard_SelectedItemChanged; + this.multiBoard.MouseMoved += MultiBoard_MouseMoved; + this.multiBoard.ImageDropped += MultiBoard_ImageDropped; + this.multiBoard.ExportRequested += Ribbon_ExportClicked; this.multiBoard.LoadRequested += Ribbon_OpenClicked; - this.multiBoard.CloseTabRequested += multiBoard_CloseTabRequested; - this.multiBoard.SwitchTabRequested += multiBoard_SwitchTabRequested; - this.multiBoard.BackupCheck += multiBoard_BackupCheck; - this.multiBoard.BoardRemoved += multiBoard_BoardRemoved; - this.multiBoard.MinimapStateChanged += multiBoard_MinimapStateChanged; + this.multiBoard.CloseTabRequested += MultiBoard_CloseTabRequested; + this.multiBoard.SwitchTabRequested += MultiBoard_SwitchTabRequested; + this.multiBoard.BackupCheck += MultiBoard_BackupCheck; + this.multiBoard.BoardRemoved += MultiBoard_BoardRemoved; + this.multiBoard.MinimapStateChanged += MultiBoard_MinimapStateChanged; multiBoard.Visibility = System.Windows.Visibility.Collapsed; ribbon.SetEnabled(false); @@ -124,29 +124,29 @@ public static int PositiveMod(int x, int m) return r < 0 ? r + m : r; } - void multiBoard_SwitchTabRequested(object sender, bool reverse) + void MultiBoard_SwitchTabRequested(object sender, bool reverse) { tabs.SelectedItem = tabs.Items[PositiveMod(tabs.Items.IndexOf(tabs.SelectedItem) + (reverse ? -1 : 1), tabs.Items.Count)]; } - void multiBoard_CloseTabRequested() + void MultiBoard_CloseTabRequested() { tabs.Items.Remove(tabs.SelectedItem); } #region MultiBoard Events - void multiBoard_MinimapStateChanged(object sender, bool hasMm) + void MultiBoard_MinimapStateChanged(object sender, bool hasMm) { ribbon.SetHasMinimap(hasMm); } - void multiBoard_BoardRemoved(object sender, EventArgs e) + void MultiBoard_BoardRemoved(object sender, EventArgs e) { Board board = (Board)sender; backupMan.DeleteBackup(board.UniqueID); } - void multiBoard_BackupCheck() + void MultiBoard_BackupCheck() { try { @@ -158,7 +158,7 @@ void multiBoard_BackupCheck() } } - void multiBoard_ImageDropped(Board selectedBoard, System.Drawing.Bitmap bmp, string name, Microsoft.Xna.Framework.Point pos) + void MultiBoard_ImageDropped(Board selectedBoard, System.Drawing.Bitmap bmp, string name, Microsoft.Xna.Framework.Point pos) { WaitWindow ww = new WaitWindow("Processing \"" + name + "\"..."); ww.Show(); @@ -188,7 +188,7 @@ void multiBoard_ImageDropped(Board selectedBoard, System.Drawing.Bitmap bmp, str /// /// /// - void multiBoard_MouseMoved(Board selectedBoard, Microsoft.Xna.Framework.Point oldPos, Microsoft.Xna.Framework.Point newPos, Microsoft.Xna.Framework.Point currPhysicalPos) + void MultiBoard_MouseMoved(Board selectedBoard, Microsoft.Xna.Framework.Point oldPos, Microsoft.Xna.Framework.Point newPos, Microsoft.Xna.Framework.Point currPhysicalPos) { textblock_CursorX.Text = currPhysicalPos.X.ToString(); textblock_CursorY.Text = currPhysicalPos.Y.ToString(); @@ -201,7 +201,7 @@ void multiBoard_MouseMoved(Board selectedBoard, Microsoft.Xna.Framework.Point ol /// Selected item event /// /// - void multiBoard_SelectedItemChanged(BoardItem selectedItem) + void MultiBoard_SelectedItemChanged(BoardItem selectedItem) { if (selectedItem != null) { @@ -213,7 +213,7 @@ void multiBoard_SelectedItemChanged(BoardItem selectedItem) } } - void multiBoard_ReturnToSelectionState() + void MultiBoard_ReturnToSelectionState() { // No need to lock because SelectionMode() and ExitEditMode() are both thread-safe if (multiBoard.SelectedBoard == null) @@ -224,7 +224,7 @@ void multiBoard_ReturnToSelectionState() multiBoard.Focus(); } - void multiBoard_OnSendToBackClicked(BoardItem boardRefItem) + void MultiBoard_OnSendToBackClicked(BoardItem boardRefItem) { lock (multiBoard) { @@ -241,12 +241,12 @@ void multiBoard_OnSendToBackClicked(BoardItem boardRefItem) multiBoard.Focus(); } - void multiBoard_OnLayerTSChanged(Layer layer) + void MultiBoard_OnLayerTSChanged(Layer layer) { ribbon.SetLayer(layer); } - void multiBoard_OnEditInstanceClicked(BoardItem item) + void MultiBoard_OnEditInstanceClicked(BoardItem item) { InputHandler.ClearBoundItems(multiBoard.SelectedBoard); try @@ -275,29 +275,29 @@ void multiBoard_OnEditInstanceClicked(BoardItem item) new GeneralInstanceEditor(item).ShowDialog(); } } - else if (item is RopeAnchor) + else if (item is RopeAnchor ropeItem) { - new RopeInstanceEditor((RopeAnchor)item).ShowDialog(); + new RopeInstanceEditor(ropeItem).ShowDialog(); } - else if (item is LifeInstance) + else if (item is LifeInstance lifeItem) { - new LifeInstanceEditor((LifeInstance)item).ShowDialog(); + new LifeInstanceEditor(lifeItem).ShowDialog(); } - else if (item is ReactorInstance) + else if (item is ReactorInstance reactorItem) { - new ReactorInstanceEditor((ReactorInstance)item).ShowDialog(); + new ReactorInstanceEditor(reactorItem).ShowDialog(); } - else if (item is BackgroundInstance) + else if (item is BackgroundInstance backgroundItem) { - new BackgroundInstanceEditor((BackgroundInstance)item).ShowDialog(); + new BackgroundInstanceEditor(backgroundItem).ShowDialog(); } - else if (item is PortalInstance) + else if (item is PortalInstance portal) { - new PortalInstanceEditor((PortalInstance)item).ShowDialog(); + new PortalInstanceEditor(portal).ShowDialog(); } - else if (item is ToolTipInstance) + else if (item is ToolTipInstance tooltipItem) { - new TooltipInstanceEditor((ToolTipInstance)item).ShowDialog(); + new TooltipInstanceEditor(tooltipItem).ShowDialog(); } } catch (Exception e) @@ -306,12 +306,12 @@ void multiBoard_OnEditInstanceClicked(BoardItem item) } } - void multiBoard_OnEditBaseClicked(BoardItem item) + void MultiBoard_OnEditBaseClicked(BoardItem item) { //TODO } - void multiBoard_OnBringToFrontClicked(BoardItem boardRefItem) + void MultiBoard_OnBringToFrontClicked(BoardItem boardRefItem) { lock (multiBoard) { @@ -348,7 +348,7 @@ void multiBoard_OnBringToFrontClicked(BoardItem boardRefItem) /// /// /// - private void mapEditInfo(object sender, EventArgs e) + private void MapEditInfo(object sender, EventArgs e) { System.Windows.Controls.MenuItem item = (System.Windows.Controls.MenuItem)sender; if (item == null) @@ -370,7 +370,7 @@ private void mapEditInfo(object sender, EventArgs e) /// /// /// - private void mapAddVR(object sender, EventArgs e) + private void MapAddVR(object sender, EventArgs e) { System.Windows.Controls.MenuItem item = (System.Windows.Controls.MenuItem)sender; if (item == null) @@ -401,7 +401,7 @@ private void mapAddVR(object sender, EventArgs e) /// /// /// - private void mapAddMinimap(object sender, EventArgs e) + private void MapAddMinimap(object sender, EventArgs e) { System.Windows.Controls.MenuItem item = (System.Windows.Controls.MenuItem)sender; if (item == null) @@ -433,7 +433,7 @@ private void mapAddMinimap(object sender, EventArgs e) /// /// /// - private void closeMapTab(object sender, EventArgs e) + private void CloseMapTab(object sender, EventArgs e) { if (tabs.Items.Count <= 1) // at least 1 tabs for now { @@ -462,7 +462,7 @@ private void Tabs_SelectionChanged(object sender, System.Windows.Controls.Select { lock (multiBoard) { - multiBoard_ReturnToSelectionState(); + MultiBoard_ReturnToSelectionState(); if (tabs.SelectedItem != null) { @@ -488,7 +488,7 @@ private void Tabs_SelectionChanged(object sender, System.Windows.Controls.Select #region Ribbon Handlers private string lastSaveLoc = null; - public void ribbon_ExportClicked() + public void Ribbon_ExportClicked() { SaveFileDialog ofd = new SaveFileDialog() { Title = "Select export location", Filter = "HaCreator Map File (*.ham)|*.ham" }; if (lastSaveLoc != null) @@ -507,7 +507,7 @@ public void ribbon_ExportClicked() } } - void ribbon_UserObjsClicked() + void Ribbon_UserObjsClicked() { lock (multiBoard) { @@ -516,7 +516,7 @@ void ribbon_UserObjsClicked() } } - void ribbon_FinalizeClicked() + void Ribbon_FinalizeClicked() { if (MessageBox.Show("This will finalize all footholds, removing their Tile bindings and clearing the Undo/Redo list in the process.\r\nContinue?", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes) { @@ -527,7 +527,7 @@ void ribbon_FinalizeClicked() } } - void ribbon_HaRepackerClicked() + void Ribbon_HaRepackerClicked() { WaitWindow ww = new WaitWindow("Opening HaRepacker..."); ww.Show(); @@ -581,24 +581,24 @@ private void ParseVisibleEditedTypes() getTypes(visibleTypes, editedTypes, ItemTypes.Misc)); } - void ribbon_RandomTilesToggled(bool pressed) + void Ribbon_RandomTilesToggled(bool pressed) { ApplicationSettings.randomTiles = pressed; if (tilePanel != null) tilePanel.LoadTileSetList(); } - void ribbon_SnappingToggled(bool pressed) + void Ribbon_SnappingToggled(bool pressed) { UserSettings.useSnapping = pressed; } - void ribbon_InfoModeToggled(bool pressed) + void Ribbon_InfoModeToggled(bool pressed) { ApplicationSettings.InfoMode = pressed; } - void ribbon_RegenerateMinimapClicked() + void Ribbon_RegenerateMinimapClicked() { if (multiBoard.SelectedBoard.RegenerateMinimap()) MessageBox.Show("Minimap regenerated successfully", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information); @@ -609,7 +609,7 @@ void ribbon_RegenerateMinimapClicked() } } - void ribbon_MapSimulationClicked() + void Ribbon_MapSimulationClicked() { multiBoard.DeviceReady = false; @@ -623,17 +623,17 @@ void ribbon_MapSimulationClicked() multiBoard.DeviceReady = true; } - void ribbon_ParallaxToggled(bool pressed) + void Ribbon_ParallaxToggled(bool pressed) { UserSettings.emulateParallax = pressed; } - void ribbon_ShowMinimapToggled(bool pressed) + void Ribbon_ShowMinimapToggled(bool pressed) { UserSettings.useMiniMap = pressed; } - void setTypes(ref ItemTypes newVisibleTypes, ref ItemTypes newEditedTypes, bool? x, ItemTypes type) + void SetTypes(ref ItemTypes newVisibleTypes, ref ItemTypes newEditedTypes, bool? x, ItemTypes type) { if (x.HasValue) { @@ -649,24 +649,24 @@ void setTypes(ref ItemTypes newVisibleTypes, ref ItemTypes newEditedTypes, bool? } } - void ribbon_ViewToggled(bool? tiles, bool? objs, bool? npcs, bool? mobs, bool? reactors, bool? portals, bool? footholds, bool? ropes, bool? chairs, bool? tooltips, bool? backgrounds, bool? misc) + void Ribbon_ViewToggled(bool? tiles, bool? objs, bool? npcs, bool? mobs, bool? reactors, bool? portals, bool? footholds, bool? ropes, bool? chairs, bool? tooltips, bool? backgrounds, bool? misc) { lock (multiBoard) { ItemTypes newVisibleTypes = 0; ItemTypes newEditedTypes = 0; - setTypes(ref newVisibleTypes, ref newEditedTypes, tiles, ItemTypes.Tiles); - setTypes(ref newVisibleTypes, ref newEditedTypes, objs, ItemTypes.Objects); - setTypes(ref newVisibleTypes, ref newEditedTypes, npcs, ItemTypes.NPCs); - setTypes(ref newVisibleTypes, ref newEditedTypes, mobs, ItemTypes.Mobs); - setTypes(ref newVisibleTypes, ref newEditedTypes, reactors, ItemTypes.Reactors); - setTypes(ref newVisibleTypes, ref newEditedTypes, portals, ItemTypes.Portals); - setTypes(ref newVisibleTypes, ref newEditedTypes, footholds, ItemTypes.Footholds); - setTypes(ref newVisibleTypes, ref newEditedTypes, ropes, ItemTypes.Ropes); - setTypes(ref newVisibleTypes, ref newEditedTypes, chairs, ItemTypes.Chairs); - setTypes(ref newVisibleTypes, ref newEditedTypes, tooltips, ItemTypes.ToolTips); - setTypes(ref newVisibleTypes, ref newEditedTypes, backgrounds, ItemTypes.Backgrounds); - setTypes(ref newVisibleTypes, ref newEditedTypes, misc, ItemTypes.Misc); + SetTypes(ref newVisibleTypes, ref newEditedTypes, tiles, ItemTypes.Tiles); + SetTypes(ref newVisibleTypes, ref newEditedTypes, objs, ItemTypes.Objects); + SetTypes(ref newVisibleTypes, ref newEditedTypes, npcs, ItemTypes.NPCs); + SetTypes(ref newVisibleTypes, ref newEditedTypes, mobs, ItemTypes.Mobs); + SetTypes(ref newVisibleTypes, ref newEditedTypes, reactors, ItemTypes.Reactors); + SetTypes(ref newVisibleTypes, ref newEditedTypes, portals, ItemTypes.Portals); + SetTypes(ref newVisibleTypes, ref newEditedTypes, footholds, ItemTypes.Footholds); + SetTypes(ref newVisibleTypes, ref newEditedTypes, ropes, ItemTypes.Ropes); + SetTypes(ref newVisibleTypes, ref newEditedTypes, chairs, ItemTypes.Chairs); + SetTypes(ref newVisibleTypes, ref newEditedTypes, tooltips, ItemTypes.ToolTips); + SetTypes(ref newVisibleTypes, ref newEditedTypes, backgrounds, ItemTypes.Backgrounds); + SetTypes(ref newVisibleTypes, ref newEditedTypes, misc, ItemTypes.Misc); ApplicationSettings.theoreticalVisibleTypes = newVisibleTypes; ApplicationSettings.theoreticalEditedTypes = newEditedTypes; if (multiBoard.SelectedBoard != null) @@ -678,7 +678,7 @@ void ribbon_ViewToggled(bool? tiles, bool? objs, bool? npcs, bool? mobs, bool? r } } - void ribbon_ExitClicked() + void Ribbon_ExitClicked() { if (CloseRequested != null) { @@ -686,7 +686,7 @@ void ribbon_ExitClicked() } } - void ribbon_SettingsClicked() + void Ribbon_SettingsClicked() { lock (multiBoard) { @@ -694,7 +694,7 @@ void ribbon_SettingsClicked() } } - void ribbon_HelpClicked() + void Ribbon_HelpClicked() { string helpPath = Path.Combine(Application.StartupPath, "Help.htm"); if (File.Exists(helpPath)) @@ -703,12 +703,12 @@ void ribbon_HelpClicked() MessageBox.Show("Help could not be shown because the help file (HRHelp.htm) was not found"); } - void ribbon_AboutClicked() + void Ribbon_AboutClicked() { new About().ShowDialog(); } - void ribbon_RepackClicked() + void Ribbon_RepackClicked() { lock (multiBoard) { @@ -721,7 +721,7 @@ void ribbon_RepackClicked() } } - void ribbon_SaveClicked() + void Ribbon_SaveClicked() { lock (multiBoard) { @@ -732,14 +732,14 @@ void ribbon_SaveClicked() public System.Windows.RoutedEventHandler[] MakeRightClickHandler() { return new System.Windows.RoutedEventHandler[] { - new System.Windows.RoutedEventHandler(mapEditInfo), - new System.Windows.RoutedEventHandler(mapAddVR), - new System.Windows.RoutedEventHandler(mapAddMinimap), - new System.Windows.RoutedEventHandler(closeMapTab) + new System.Windows.RoutedEventHandler(MapEditInfo), + new System.Windows.RoutedEventHandler(MapAddVR), + new System.Windows.RoutedEventHandler(MapAddMinimap), + new System.Windows.RoutedEventHandler(CloseMapTab) }; } - void ribbon_NewClicked() + void Ribbon_NewClicked() { LoadMap(new New(multiBoard, tabs, MakeRightClickHandler())); } diff --git a/HaCreator/MapSimulator/MapSimulatorLoader.cs b/HaCreator/MapSimulator/MapSimulatorLoader.cs index 06b5d2da..cb851465 100644 --- a/HaCreator/MapSimulator/MapSimulatorLoader.cs +++ b/HaCreator/MapSimulator/MapSimulatorLoader.cs @@ -119,55 +119,64 @@ private static List LoadFrames(TexturePool texturePool, WzImageProper } else if (source is WzSubProperty) // animated { - WzCanvasProperty frameProp; + WzImageProperty _frameProp; int i = 0; - while ((frameProp = (WzCanvasProperty)WzInfoTools.GetRealProperty(source[(i++).ToString()])) != null) + while ((_frameProp = WzInfoTools.GetRealProperty(source[(i++).ToString()])) != null) { - int delay = (int)InfoTool.GetOptionalInt(frameProp["delay"], 100); - - bool bLoadedSpine = LoadSpineMapObjectItem((WzImageProperty)frameProp.Parent, frameProp, device, spineAni); - if (!bLoadedSpine) + if (_frameProp is WzSubProperty) // issue with 867119250 { - if (frameProp.MSTag == null) + frames.AddRange( LoadFrames(texturePool, _frameProp, x, y, device, ref usedProps, null)); + } + else + { + WzCanvasProperty frameProp = (WzCanvasProperty)_frameProp; + + int delay = (int)InfoTool.GetOptionalInt(frameProp["delay"], 100); + + bool bLoadedSpine = LoadSpineMapObjectItem((WzImageProperty)frameProp.Parent, frameProp, device, spineAni); + if (!bLoadedSpine) { - string canvasBitmapPath = frameProp.FullPath; - Texture2D textureFromCache = texturePool.GetTexture(canvasBitmapPath); - if (textureFromCache != null) + if (frameProp.MSTag == null) { - frameProp.MSTag = textureFromCache; - } - else - { - frameProp.MSTag = BoardItem.TextureFromBitmap(device, frameProp.GetLinkedWzCanvasBitmap()); - - // add to cache - texturePool.AddTextureToPool(canvasBitmapPath, (Texture2D)frameProp.MSTag); + string canvasBitmapPath = frameProp.FullPath; + Texture2D textureFromCache = texturePool.GetTexture(canvasBitmapPath); + if (textureFromCache != null) + { + frameProp.MSTag = textureFromCache; + } + else + { + frameProp.MSTag = BoardItem.TextureFromBitmap(device, frameProp.GetLinkedWzCanvasBitmap()); + + // add to cache + texturePool.AddTextureToPool(canvasBitmapPath, (Texture2D)frameProp.MSTag); + } } } - } - usedProps.Add(frameProp); + usedProps.Add(frameProp); - if (frameProp.MSTagSpine != null) - { - WzSpineObject spineObject = (WzSpineObject)frameProp.MSTagSpine; - System.Drawing.PointF origin = frameProp.GetCanvasOriginPosition(); + if (frameProp.MSTagSpine != null) + { + WzSpineObject spineObject = (WzSpineObject)frameProp.MSTagSpine; + System.Drawing.PointF origin = frameProp.GetCanvasOriginPosition(); - frames.Add(new DXSpineObject(spineObject, x, y, origin, delay)); - } - else if (frameProp.MSTag != null) - { - Texture2D texture = (Texture2D)frameProp.MSTag; - System.Drawing.PointF origin = frameProp.GetCanvasOriginPosition(); + frames.Add(new DXSpineObject(spineObject, x, y, origin, delay)); + } + else if (frameProp.MSTag != null) + { + Texture2D texture = (Texture2D)frameProp.MSTag; + System.Drawing.PointF origin = frameProp.GetCanvasOriginPosition(); - frames.Add(new DXObject(x - (int)origin.X, y - (int)origin.Y, texture, delay)); - } - else - { - Texture2D texture = BoardItem.TextureFromBitmap(device, Properties.Resources.placeholder); - System.Drawing.PointF origin = frameProp.GetCanvasOriginPosition(); + frames.Add(new DXObject(x - (int)origin.X, y - (int)origin.Y, texture, delay)); + } + else + { + Texture2D texture = BoardItem.TextureFromBitmap(device, Properties.Resources.placeholder); + System.Drawing.PointF origin = frameProp.GetCanvasOriginPosition(); - frames.Add(new DXObject(x - (int)origin.X, y - (int)origin.Y, texture, delay)); + frames.Add(new DXObject(x - (int)origin.X, y - (int)origin.Y, texture, delay)); + } } } } @@ -424,18 +433,20 @@ public static MobItem CreateMobFromProperty(TexturePool texturePool, MobInstance foreach (WzImageProperty childProperty in source.WzProperties) { - WzSubProperty mobStateProperty = (WzSubProperty)childProperty; - switch (mobStateProperty.Name) + if (childProperty is WzSubProperty mobStateProperty) // issue with 867119250, Eluna map mobs { - case "info": // info/speak/0 WzStringProperty - { - break; - } - default: - { - frames.AddRange(LoadFrames(texturePool, mobStateProperty, mobInstance.X, mobInstance.Y, device, ref usedProps)); - break; - } + switch (mobStateProperty.Name) + { + case "info": // info/speak/0 WzStringProperty + { + break; + } + default: + { + frames.AddRange(LoadFrames(texturePool, mobStateProperty, mobInstance.X, mobInstance.Y, device, ref usedProps)); + break; + } + } } } return new MobItem(mobInstance, frames); From 0fef178dadc9f10a99317bb8ddb20daba9c97459 Mon Sep 17 00:00:00 2001 From: eaxvac Date: Mon, 13 Jul 2020 00:21:24 +0800 Subject: [PATCH 3/5] fix compile warnings --- HaCreator/GUI/EditorPanels/BackgroundPanel.cs | 16 ++-- HaCreator/GUI/EditorPanels/ObjPanel.cs | 6 +- HaCreator/GUI/EditorPanels/PortalPanel.cs | 4 +- .../InstanceEditor/PortalInstanceEditor.cs | 6 +- HaCreator/MapEditor/Board.cs | 2 +- HaCreator/MapEditor/Info/MobInfo.cs | 1 - HaCreator/MapEditor/Info/ObjectInfo.cs | 4 +- HaCreator/MapSimulator/MapSimulatorLoader.cs | 73 +++++++++---------- HaCreator/Wz/WzFileManager.cs | 2 +- HaRepacker/GUI/ZLZPacketEncryptionKeyForm.cs | 2 +- HaRepacker/WzNode.cs | 46 +++++++----- HaSharedLirary/WzMp3Streamer.cs | 2 +- .../Configuration/ConfigurationManager.cs | 2 +- MapleLib/WzLib/WzProperties/WzPngProperty.cs | 2 +- 14 files changed, 87 insertions(+), 81 deletions(-) diff --git a/HaCreator/GUI/EditorPanels/BackgroundPanel.cs b/HaCreator/GUI/EditorPanels/BackgroundPanel.cs index 218f6f84..a30642cb 100644 --- a/HaCreator/GUI/EditorPanels/BackgroundPanel.cs +++ b/HaCreator/GUI/EditorPanels/BackgroundPanel.cs @@ -142,17 +142,11 @@ private void bgItem_Click(object sender, MouseEventArgs e) WzStringProperty stringObj = (WzStringProperty)spineAtlasProp; Thread thread = new Thread(() => { - try - { - WzSpineAnimationItem item = new WzSpineAnimationItem(stringObj); - - // Create xna window - SpineAnimationWindow Window = new SpineAnimationWindow(item); - Window.Run(); - } - catch (Exception ex) - { - } + WzSpineAnimationItem item = new WzSpineAnimationItem(stringObj); + + // Create xna window + SpineAnimationWindow Window = new SpineAnimationWindow(item); + Window.Run(); }); thread.Start(); thread.Join(); diff --git a/HaCreator/GUI/EditorPanels/ObjPanel.cs b/HaCreator/GUI/EditorPanels/ObjPanel.cs index f8c13595..fc329bb1 100644 --- a/HaCreator/GUI/EditorPanels/ObjPanel.cs +++ b/HaCreator/GUI/EditorPanels/ObjPanel.cs @@ -108,7 +108,11 @@ private void objL1ListBox_SelectedIndexChanged(object sender, EventArgs e) item.MaxHeight = UserSettings.ImageViewerHeight; item.MaxWidth = UserSettings.ImageViewerWidth; } - }catch(InvalidCastException ex) { return; } + } + catch(InvalidCastException) + { + return; + } } } diff --git a/HaCreator/GUI/EditorPanels/PortalPanel.cs b/HaCreator/GUI/EditorPanels/PortalPanel.cs index a06d40f6..bfbf3320 100644 --- a/HaCreator/GUI/EditorPanels/PortalPanel.cs +++ b/HaCreator/GUI/EditorPanels/PortalPanel.cs @@ -44,7 +44,9 @@ public void Initialize(HaCreatorStateManager hcsm) item.MouseDown += new MouseEventHandler(portal_MouseDown); item.MouseUp += new MouseEventHandler(ImageViewer.item_MouseUp); } - catch (KeyNotFoundException e) { } + catch (KeyNotFoundException) + { + } } } diff --git a/HaCreator/GUI/InstanceEditor/PortalInstanceEditor.cs b/HaCreator/GUI/InstanceEditor/PortalInstanceEditor.cs index 4d1a1869..1b075b52 100644 --- a/HaCreator/GUI/InstanceEditor/PortalInstanceEditor.cs +++ b/HaCreator/GUI/InstanceEditor/PortalInstanceEditor.cs @@ -36,7 +36,11 @@ public PortalInstanceEditor(PortalInstance item) try { portals.Add(Tables.PortalTypeNames[Program.InfoManager.PortalTypeById[i]]); - }catch(KeyNotFoundException e) { continue; } + } + catch(KeyNotFoundException) + { + continue; + } } ptComboBox.Items.AddRange(portals.ToArray()); diff --git a/HaCreator/MapEditor/Board.cs b/HaCreator/MapEditor/Board.cs index 90ea0203..a3d24eb7 100644 --- a/HaCreator/MapEditor/Board.cs +++ b/HaCreator/MapEditor/Board.cs @@ -218,7 +218,7 @@ public void RenderBoard(SpriteBatch sprite) public void CreateLayers() { - for (int i = 0; i < MapConstants.MaxMapLayers; i++) + for (int i = 0; i <= MapConstants.MaxMapLayers; i++) { new Layer(this); } diff --git a/HaCreator/MapEditor/Info/MobInfo.cs b/HaCreator/MapEditor/Info/MobInfo.cs index cde26854..0eb2d2f5 100644 --- a/HaCreator/MapEditor/Info/MobInfo.cs +++ b/HaCreator/MapEditor/Info/MobInfo.cs @@ -89,7 +89,6 @@ public override BoardItem CreateInstance(Layer layer, Board board, int x, int y, if (Image == null) ParseImage(); - bool bIsBoss = false; // set default to false as boss return new MobInstance(this, board, x, y, UserSettings.Mobrx0Offset, UserSettings.Mobrx1Offset, 20, null, UserSettings.defaultMobTime, flip, false, null, null); } diff --git a/HaCreator/MapEditor/Info/ObjectInfo.cs b/HaCreator/MapEditor/Info/ObjectInfo.cs index 5b871bc4..3f87812d 100644 --- a/HaCreator/MapEditor/Info/ObjectInfo.cs +++ b/HaCreator/MapEditor/Info/ObjectInfo.cs @@ -53,7 +53,7 @@ public static ObjectInfo Get(string oS, string l0, string l1, string l2) { objInfoProp.HCTag = ObjectInfo.Load((WzSubProperty)objInfoProp, oS, l0, l1, l2); } - catch (KeyNotFoundException e) + catch (KeyNotFoundException) { return null; } @@ -89,7 +89,7 @@ public static ObjectInfo Get(string oS, string l0, string l1, string l2) result.Add(ParsePropToOffsetList(offsetSet)); } } - catch (InvalidCastException exc) { } + catch (InvalidCastException) { } } else { diff --git a/HaCreator/MapSimulator/MapSimulatorLoader.cs b/HaCreator/MapSimulator/MapSimulatorLoader.cs index cb851465..6c007653 100644 --- a/HaCreator/MapSimulator/MapSimulatorLoader.cs +++ b/HaCreator/MapSimulator/MapSimulatorLoader.cs @@ -42,8 +42,10 @@ public static MapSimulator CreateAndShowMapSimulator(Board mapBoard, string titl { mapSimulator = new MapSimulator(mapBoard, titleName); mapSimulator.Run(); - }); - thread.Priority = ThreadPriority.Highest; + }) + { + Priority = ThreadPriority.Highest + }; thread.Start(); thread.Join(); @@ -265,54 +267,47 @@ private static bool LoadSpineMapObjectItem(WzImageProperty source, WzImageProper if (spineAtlas != null) { - if (spineAtlas is WzStringProperty) + if (spineAtlas is WzStringProperty stringObj) { - WzStringProperty stringObj = (WzStringProperty)spineAtlas; if (!stringObj.IsSpineAtlasResources) return false; - try - { - WzSpineObject spineObject = new WzSpineObject(new WzSpineAnimationItem(stringObj)); + WzSpineObject spineObject = new WzSpineObject(new WzSpineAnimationItem(stringObj)); - spineObject.spineAnimationItem.LoadResources(device); // load spine resources (this must happen after window is loaded) - spineObject.skeleton = new Skeleton(spineObject.spineAnimationItem.SkeletonData); - //spineObject.skeleton.R =153; - //spineObject.skeleton.G = 255; - //spineObject.skeleton.B = 0; - //spineObject.skeleton.A = 1f; + spineObject.spineAnimationItem.LoadResources(device); // load spine resources (this must happen after window is loaded) + spineObject.skeleton = new Skeleton(spineObject.spineAnimationItem.SkeletonData); + //spineObject.skeleton.R =153; + //spineObject.skeleton.G = 255; + //spineObject.skeleton.B = 0; + //spineObject.skeleton.A = 1f; - // Skin - foreach (Skin skin in spineObject.spineAnimationItem.SkeletonData.Skins) - { - spineObject.skeleton.SetSkin(skin); // just set the first skin - break; - } + // Skin + foreach (Skin skin in spineObject.spineAnimationItem.SkeletonData.Skins) + { + spineObject.skeleton.SetSkin(skin); // just set the first skin + break; + } - // Define mixing between animations. - spineObject.stateData = new AnimationStateData(spineObject.skeleton.Data); - spineObject.state = new AnimationState(spineObject.stateData); - if (!bIsObjectLayer) - spineObject.state.TimeScale = 0.1f; + // Define mixing between animations. + spineObject.stateData = new AnimationStateData(spineObject.skeleton.Data); + spineObject.state = new AnimationState(spineObject.stateData); + if (!bIsObjectLayer) + spineObject.state.TimeScale = 0.1f; - if (spineAniPath != null) - { - spineObject.state.SetAnimation(0, spineAniPath, true); - } - else - { - int i = 0; - foreach (Animation animation in spineObject.spineAnimationItem.SkeletonData.Animations) - { - spineObject.state.SetAnimation(i++, animation.Name, true); - } - } - prop.MSTagSpine = spineObject; - return true; + if (spineAniPath != null) + { + spineObject.state.SetAnimation(0, spineAniPath, true); } - catch (Exception e) + else { + int i = 0; + foreach (Animation animation in spineObject.spineAnimationItem.SkeletonData.Animations) + { + spineObject.state.SetAnimation(i++, animation.Name, true); + } } + prop.MSTagSpine = spineObject; + return true; } } return false; diff --git a/HaCreator/Wz/WzFileManager.cs b/HaCreator/Wz/WzFileManager.cs index 7bd1dfa0..1c012a5b 100644 --- a/HaCreator/Wz/WzFileManager.cs +++ b/HaCreator/Wz/WzFileManager.cs @@ -100,7 +100,7 @@ public bool LoadWzFile(string name) wzDirs[name] = new WzMainDirectory(wzf); return true; } - catch (Exception e) + catch (Exception) { //HaRepackerLib.Warning.Error("Error initializing " + name + ".wz (" + e.Message + ").\r\nCheck that the directory is valid and the file is not in use."); return false; diff --git a/HaRepacker/GUI/ZLZPacketEncryptionKeyForm.cs b/HaRepacker/GUI/ZLZPacketEncryptionKeyForm.cs index 981d4d2f..c7685370 100644 --- a/HaRepacker/GUI/ZLZPacketEncryptionKeyForm.cs +++ b/HaRepacker/GUI/ZLZPacketEncryptionKeyForm.cs @@ -95,7 +95,7 @@ public bool OpenZLZDllFile() private void ShowKey(IntPtr module) { const int KeyPos = 0x14020; - const int KeyGen = 0x1340; + //const int KeyGen = 0x1340; // OdinMS format StringBuilder sb = new StringBuilder(); diff --git a/HaRepacker/WzNode.cs b/HaRepacker/WzNode.cs index 4b37bdb6..f695df47 100644 --- a/HaRepacker/WzNode.cs +++ b/HaRepacker/WzNode.cs @@ -65,9 +65,14 @@ public void Delete() try { Remove(); - }catch(Exception e) { throw new Exception("Cannot remove/replace an inlinked node"); } - if (Tag is WzImageProperty) - ((WzImageProperty)Tag).ParentImage.Changed = true; + } + catch(Exception) + { + throw new Exception("Cannot remove/replace an inlinked node"); + } + + if (Tag is WzImageProperty property) + property.ParentImage.Changed = true; ((WzObject)Tag).Remove(); } @@ -111,32 +116,35 @@ public static bool CanNodeBeInserted(WzNode parentNode, string name) private bool addObjInternal(WzObject obj) { WzObject TaggedObject = (WzObject)Tag; - if (TaggedObject is WzFile) TaggedObject = ((WzFile)TaggedObject).WzDirectory; - if (TaggedObject is WzDirectory) + if (TaggedObject is WzFile file) + TaggedObject = file.WzDirectory; + + if (TaggedObject is WzDirectory directory) { - if (obj is WzDirectory) - ((WzDirectory)TaggedObject).AddDirectory((WzDirectory)obj); - else if (obj is WzImage) - ((WzDirectory)TaggedObject).AddImage((WzImage)obj); + if (obj is WzDirectory wzDirectory) + directory.AddDirectory(wzDirectory); + else if (obj is WzImage wzImgProperty) + directory.AddImage(wzImgProperty); else return false; } - else if (TaggedObject is WzImage) + else if (TaggedObject is WzImage wzImageProperty) { - if (!((WzImage)TaggedObject).Parsed) ((WzImage)TaggedObject).ParseImage(); - if (obj is WzImageProperty) + if (!wzImageProperty.Parsed) + wzImageProperty.ParseImage(); + if (obj is WzImageProperty imgProperty) { - ((WzImage)TaggedObject).AddProperty((WzImageProperty)obj); - ((WzImage)TaggedObject).Changed = true; + wzImageProperty.AddProperty(imgProperty); + wzImageProperty.Changed = true; } else return false; } - else if (TaggedObject is IPropertyContainer) + else if (TaggedObject is IPropertyContainer container) { - if (obj is WzImageProperty) + if (obj is WzImageProperty property) { - ((IPropertyContainer)TaggedObject).AddProperty((WzImageProperty)obj); - if (TaggedObject is WzImageProperty) - ((WzImageProperty)TaggedObject).ParentImage.Changed = true; + container.AddProperty(property); + if (TaggedObject is WzImageProperty imgProperty) + imgProperty.ParentImage.Changed = true; } else return false; } diff --git a/HaSharedLirary/WzMp3Streamer.cs b/HaSharedLirary/WzMp3Streamer.cs index 8a7420df..a8c88480 100644 --- a/HaSharedLirary/WzMp3Streamer.cs +++ b/HaSharedLirary/WzMp3Streamer.cs @@ -52,7 +52,7 @@ public WzMp3Streamer(WzBinaryProperty sound, bool repeat) wavePlayer.Init(waveFileStream); } } - catch (System.Exception e) + catch (Exception) { playbackSuccessfully = false; //InvalidDataException diff --git a/MapleLib/Configuration/ConfigurationManager.cs b/MapleLib/Configuration/ConfigurationManager.cs index 6979c316..59547dfe 100644 --- a/MapleLib/Configuration/ConfigurationManager.cs +++ b/MapleLib/Configuration/ConfigurationManager.cs @@ -86,7 +86,7 @@ public bool Load() _appSettings = JsonConvert.DeserializeObject(applicationFileContent); return true; - } catch (Exception exp) + } catch (Exception) { // delete all try diff --git a/MapleLib/WzLib/WzProperties/WzPngProperty.cs b/MapleLib/WzLib/WzProperties/WzPngProperty.cs index 52f239db..74184601 100644 --- a/MapleLib/WzLib/WzProperties/WzPngProperty.cs +++ b/MapleLib/WzLib/WzProperties/WzPngProperty.cs @@ -407,7 +407,7 @@ internal void ParsePng() } } } - catch (InvalidDataException exp) + catch (InvalidDataException) { png = null; } From a9f2ea616499f9118e38b7130b81b17d6727272f Mon Sep 17 00:00:00 2001 From: eaxvac Date: Mon, 13 Jul 2020 00:37:44 +0800 Subject: [PATCH 4/5] .net framework 4.8 https://dotnet.microsoft.com/download/visual-studio-sdks?utm_source=getdotnetsdk&utm_medium=referral https://devblogs.microsoft.com/dotnet/announcing-the-net-framework-4-8/ --- ...ptyKeys.UserInterface.Core.Standard.csproj | 8 ++- ...eys.UserInterface.MonoGame.Standard.csproj | 8 +++ HaCreator/HaCreator.csproj | 2 +- HaCreator/app.config | 14 +++--- HaRepacker/Harepacker-resurrected.csproj | 2 +- HaRepacker/app.config | 50 +++++++++---------- HaSharedLirary/HaSharedLibrary.csproj | 3 +- HaSharedLirary/app.config | 32 ++++++------ MapleLib/MapleLib.csproj | 2 +- MapleLib/app.config | 40 +++++++-------- spine-runtimes-2.1.25/spine-csharp/app.config | 32 ++++++------ .../spine-csharp/spine-csharp 2.1.25.csproj | 2 +- 12 files changed, 104 insertions(+), 91 deletions(-) diff --git a/EmptyKeys.UIEngine/EmptyKeys.UserInterface.Core/EmptyKeys.UserInterface.Core.Standard.csproj b/EmptyKeys.UIEngine/EmptyKeys.UserInterface.Core/EmptyKeys.UserInterface.Core.Standard.csproj index 4d9b3ed4..27c58e91 100644 --- a/EmptyKeys.UIEngine/EmptyKeys.UserInterface.Core/EmptyKeys.UserInterface.Core.Standard.csproj +++ b/EmptyKeys.UIEngine/EmptyKeys.UserInterface.Core/EmptyKeys.UserInterface.Core.Standard.csproj @@ -22,8 +22,12 @@ - ..\..\!Release\EmptyKeysUI\Common\AnyCPU - ..\..\!Release\EmptyKeysUI\Common\AnyCPU\netstandard2.0\EmptyKeys.UserInterface.Core.xml + ..\Compiled\Release\ + ..\Compiled\Release\EmptyKeysUI\Common\AnyCPU\netstandard2.0\EmptyKeys.UserInterface.Core.xml + + + + ..\Compiled\Debug\ diff --git a/EmptyKeys.UIEngine/EmptyKeys.UserInterface.MonoGame/EmptyKeys.UserInterface.MonoGame.Standard.csproj b/EmptyKeys.UIEngine/EmptyKeys.UserInterface.MonoGame/EmptyKeys.UserInterface.MonoGame.Standard.csproj index e2fa8a65..dfae7307 100644 --- a/EmptyKeys.UIEngine/EmptyKeys.UserInterface.MonoGame/EmptyKeys.UserInterface.MonoGame.Standard.csproj +++ b/EmptyKeys.UIEngine/EmptyKeys.UserInterface.MonoGame/EmptyKeys.UserInterface.MonoGame.Standard.csproj @@ -21,6 +21,14 @@ EmptyKeys.UserInterface.MonoGame + + ..\Compiled\Debug\ + + + + ..\Compiled\Release\ + + diff --git a/HaCreator/HaCreator.csproj b/HaCreator/HaCreator.csproj index 90b9964e..159d0784 100644 --- a/HaCreator/HaCreator.csproj +++ b/HaCreator/HaCreator.csproj @@ -10,7 +10,7 @@ Properties HaCreator HaCreator - v4.7.2 + v4.8 512 diff --git a/HaCreator/app.config b/HaCreator/app.config index 533eddd1..f94e79c6 100644 --- a/HaCreator/app.config +++ b/HaCreator/app.config @@ -1,22 +1,22 @@ - + - + - + - - + + - - + + diff --git a/HaRepacker/Harepacker-resurrected.csproj b/HaRepacker/Harepacker-resurrected.csproj index 862a6062..f8a463b1 100644 --- a/HaRepacker/Harepacker-resurrected.csproj +++ b/HaRepacker/Harepacker-resurrected.csproj @@ -10,7 +10,7 @@ Properties HaRepacker HaRepackerResurrected - v4.7.2 + v4.8 512 diff --git a/HaRepacker/app.config b/HaRepacker/app.config index 270092a4..037ba5a2 100644 --- a/HaRepacker/app.config +++ b/HaRepacker/app.config @@ -1,58 +1,58 @@ - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + diff --git a/HaSharedLirary/HaSharedLibrary.csproj b/HaSharedLirary/HaSharedLibrary.csproj index 714bbe4e..85ba83d8 100644 --- a/HaSharedLirary/HaSharedLibrary.csproj +++ b/HaSharedLirary/HaSharedLibrary.csproj @@ -8,11 +8,12 @@ Library HaSharedLibrary HaSharedLibrary - v4.7.2 + v4.8 512 true + true diff --git a/HaSharedLirary/app.config b/HaSharedLirary/app.config index 56ab2596..81118d71 100644 --- a/HaSharedLirary/app.config +++ b/HaSharedLirary/app.config @@ -1,35 +1,35 @@ - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - \ No newline at end of file + diff --git a/MapleLib/MapleLib.csproj b/MapleLib/MapleLib.csproj index a4516e18..301210cd 100644 --- a/MapleLib/MapleLib.csproj +++ b/MapleLib/MapleLib.csproj @@ -10,7 +10,7 @@ Properties MapleLib MapleLib - v4.7.2 + v4.8 512 diff --git a/MapleLib/app.config b/MapleLib/app.config index f9d7ceb9..0a1afb90 100644 --- a/MapleLib/app.config +++ b/MapleLib/app.config @@ -1,43 +1,43 @@ - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - \ No newline at end of file + diff --git a/spine-runtimes-2.1.25/spine-csharp/app.config b/spine-runtimes-2.1.25/spine-csharp/app.config index 56ab2596..81118d71 100644 --- a/spine-runtimes-2.1.25/spine-csharp/app.config +++ b/spine-runtimes-2.1.25/spine-csharp/app.config @@ -1,35 +1,35 @@ - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - \ No newline at end of file + diff --git a/spine-runtimes-2.1.25/spine-csharp/spine-csharp 2.1.25.csproj b/spine-runtimes-2.1.25/spine-csharp/spine-csharp 2.1.25.csproj index cd3a68d9..be75211b 100644 --- a/spine-runtimes-2.1.25/spine-csharp/spine-csharp 2.1.25.csproj +++ b/spine-runtimes-2.1.25/spine-csharp/spine-csharp 2.1.25.csproj @@ -10,7 +10,7 @@ Properties Spine spine-csharp - v4.7.2 + v4.8 v4.0 From 6093ec6b8487c6ecb86eead7254c7b0e3bcf224a Mon Sep 17 00:00:00 2001 From: eaxvac Date: Mon, 13 Jul 2020 03:19:01 +0800 Subject: [PATCH 5/5] [WzLib] Improve the write speed of wz when saving - the .wz file is re-opened each time it is trying to dump a new directory or image. --- HaCreator/GUI/Repack.cs | 13 +--- MapleLib/WzLib/Spine/WzSpineAnimationItem.cs | 4 +- MapleLib/WzLib/Spine/WzSpineAtlasLoader.cs | 7 +- MapleLib/WzLib/Spine/WzSpineTextureLoader.cs | 12 +-- MapleLib/WzLib/Util/WzBinaryWriter.cs | 2 +- MapleLib/WzLib/WzDirectory.cs | 76 ++++++++++--------- MapleLib/WzLib/WzFile.cs | 5 +- .../WzLib/WzProperties/WzBinaryProperty.cs | 14 +--- 8 files changed, 62 insertions(+), 71 deletions(-) diff --git a/HaCreator/GUI/Repack.cs b/HaCreator/GUI/Repack.cs index 5109191e..d66a8902 100644 --- a/HaCreator/GUI/Repack.cs +++ b/HaCreator/GUI/Repack.cs @@ -22,7 +22,7 @@ namespace HaCreator.GUI { public partial class Repack : Form { - List toRepack = new List(); + private readonly List toRepack = new List(); public Repack() { @@ -103,7 +103,7 @@ private void ChangeRepackState(string state) /// private void FinishSuccess(bool bSaveFileInHaCreatorDirectory) { - MessageBox.Show("Repacked successfully. " + (!bSaveFileInHaCreatorDirectory ? "press OK to restart." : "Please replace the files in HaCreator\\Output.")); + MessageBox.Show("Repacked successfully. " + (!bSaveFileInHaCreatorDirectory ? "Please replace the files under the MapleStory directory." : "Please replace the files in HaCreator\\Output.")); if (!bSaveFileInHaCreatorDirectory) { @@ -247,14 +247,7 @@ private void RepackerThread() if (!bSaveFileInHaCreatorDirectory) // only replace the original file if its saving in the maplestory folder { - string buPath = Path.Combine(orgBackupDir, Path.GetFileName(orgFile)); - // Try to backup to /Originals/ First, if there is already a file there, we are not original, so just backup to /Backup/ - if (File.Exists(buPath)) - { - buPath = Path.Combine(backupDir, Path.GetFileName(orgFile)); - } - File.Move(orgFile, buPath); - File.Move(tmpFile, orgFile); + File.Move(tmpFile, orgFile + "_NewCreated.wz"); } } catch (Exception e) diff --git a/MapleLib/WzLib/Spine/WzSpineAnimationItem.cs b/MapleLib/WzLib/Spine/WzSpineAnimationItem.cs index 771bbb4b..62690124 100644 --- a/MapleLib/WzLib/Spine/WzSpineAnimationItem.cs +++ b/MapleLib/WzLib/Spine/WzSpineAnimationItem.cs @@ -69,8 +69,8 @@ public void LoadResources(GraphicsDevice graphicsDevice) } bool pma; - if (wzSpineAtlasPropertyNode.parent is WzImageProperty) - pma = ((WzImageProperty)wzSpineAtlasPropertyNode.parent)["PMA"].ReadValue(0) > 0; + if (wzSpineAtlasPropertyNode.parent is WzImageProperty imgProperty) + pma = imgProperty["PMA"].ReadValue(0) > 0; else pma = ((WzImage)wzSpineAtlasPropertyNode.parent)["PMA"].ReadValue(0) > 0; diff --git a/MapleLib/WzLib/Spine/WzSpineAtlasLoader.cs b/MapleLib/WzLib/Spine/WzSpineAtlasLoader.cs index 8aab39b3..d32d07cc 100644 --- a/MapleLib/WzLib/Spine/WzSpineAtlasLoader.cs +++ b/MapleLib/WzLib/Spine/WzSpineAtlasLoader.cs @@ -102,11 +102,10 @@ private static bool TryLoadSkeletonJsonOrBinary(WzImageProperty atlasNode, Atlas // try read binary based foreach (WzImageProperty property in childProperties) { - if (property is WzBinaryProperty) + // should be called binaryproperty actually + if (property is WzBinaryProperty soundProp) { - WzBinaryProperty soundProp = (WzBinaryProperty)property; // should be called binaryproperty actually - - using (MemoryStream ms = new MemoryStream(soundProp.GetBytes(false))) + using (MemoryStream ms = new MemoryStream(soundProp.GetBytes(false))) { SkeletonBinary skeletonBinary = new SkeletonBinary(atlas); data = skeletonBinary.ReadSkeletonData(ms); diff --git a/MapleLib/WzLib/Spine/WzSpineTextureLoader.cs b/MapleLib/WzLib/Spine/WzSpineTextureLoader.cs index 8973afbe..763b82be 100644 --- a/MapleLib/WzLib/Spine/WzSpineTextureLoader.cs +++ b/MapleLib/WzLib/Spine/WzSpineTextureLoader.cs @@ -60,22 +60,22 @@ public void Load(AtlasPage page, string path) WzCanvasProperty canvasProperty = null; WzImageProperty imageChild = (WzImageProperty)ParentNode[path]; - if (imageChild is WzUOLProperty) + if (imageChild is WzUOLProperty uolProperty) { - WzObject uolLink = ((WzUOLProperty)imageChild).LinkValue; + WzObject uolLink = uolProperty.LinkValue; - if (uolLink is WzCanvasProperty) + if (uolLink is WzCanvasProperty uolPropertyLink) { - canvasProperty = (WzCanvasProperty)uolLink; + canvasProperty = uolPropertyLink; } else { // other unimplemented prop? } } - else if (imageChild is WzCanvasProperty) + else if (imageChild is WzCanvasProperty property) { - canvasProperty = (WzCanvasProperty)imageChild; + canvasProperty = property; } if (canvasProperty != null) diff --git a/MapleLib/WzLib/Util/WzBinaryWriter.cs b/MapleLib/WzLib/Util/WzBinaryWriter.cs index 71de4cdc..8910872d 100644 --- a/MapleLib/WzLib/Util/WzBinaryWriter.cs +++ b/MapleLib/WzLib/Util/WzBinaryWriter.cs @@ -70,7 +70,7 @@ public void WriteStringValue(string s, int withoutOffset, int withOffset) public void WriteWzObjectValue(string s, byte type) { - string storeName = type + "_" + s; + string storeName = string.Format("{0}_{1}", type, s); if (s.Length > 4 && StringCache.ContainsKey(storeName)) { Write((byte)2); diff --git a/MapleLib/WzLib/WzDirectory.cs b/MapleLib/WzLib/WzDirectory.cs index 6dad06db..7a7a2f68 100644 --- a/MapleLib/WzLib/WzDirectory.cs +++ b/MapleLib/WzLib/WzDirectory.cs @@ -313,10 +313,10 @@ internal void SaveImages(BinaryWriter wzWriter, FileStream fs) /// /// /// - /// /// The IV to use while generating the data file. If null, it'll use the WzDirectory default + /// The previously opened file stream /// - internal int GenerateDataFile(string fileName, byte[] useIv) + internal int GenerateDataFile(byte[] useIv, FileStream prevOpenedStream) { bool useCustomIv = useIv != null; // whole shit gonna be re-written if its a custom IV specified @@ -330,56 +330,58 @@ internal int GenerateDataFile(string fileName, byte[] useIv) size = WzTool.GetCompressedIntLength(entryCount); offsetSize = WzTool.GetCompressedIntLength(entryCount); - using (FileStream fileWrite = new FileStream(fileName, FileMode.Append, FileAccess.Write)) + foreach (WzImage img in images) { - foreach (WzImage img in images) + if (useCustomIv || img.bIsImageChanged) { - if (useCustomIv || img.bIsImageChanged) + using (MemoryStream memStream = new MemoryStream()) { - using (MemoryStream memStream = new MemoryStream()) + using (WzBinaryWriter imgWriter = new WzBinaryWriter(memStream, useCustomIv ? useIv : this.WzIv)) { - using (WzBinaryWriter imgWriter = new WzBinaryWriter(memStream, useCustomIv ? useIv : this.WzIv)) - { - img.SaveImage(imgWriter, useCustomIv); + img.SaveImage(imgWriter, useCustomIv); - img.CalculateAndSetImageChecksum(memStream.ToArray()); // checksum + img.CalculateAndSetImageChecksum(memStream.ToArray()); // checksum - img.tempFileStart = fileWrite.Position; - fileWrite.Write(memStream.ToArray(), 0, (int)memStream.Length); - img.tempFileEnd = fileWrite.Position; - } + img.tempFileStart = prevOpenedStream.Position; + prevOpenedStream.Write(memStream.ToArray(), 0, (int)memStream.Length); + img.tempFileEnd = prevOpenedStream.Position; } } - else - { - img.tempFileStart = img.offset; - img.tempFileEnd = img.offset + img.size; - } - img.UnparseImage(); - - int nameLen = WzTool.GetWzObjectValueLength(img.name, 4); - size += nameLen; - int imgLen = img.size; - size += WzTool.GetCompressedIntLength(imgLen); - size += imgLen; - size += WzTool.GetCompressedIntLength(img.Checksum); - size += 4; - offsetSize += nameLen; - offsetSize += WzTool.GetCompressedIntLength(imgLen); - offsetSize += WzTool.GetCompressedIntLength(img.Checksum); - offsetSize += 4; - - // otherwise Item.wz (300MB) probably uses > 4GB - GC.Collect(); + } + else + { + img.tempFileStart = img.offset; + img.tempFileEnd = img.offset + img.size; + } + img.UnparseImage(); + + int nameLen = WzTool.GetWzObjectValueLength(img.name, 4); + size += nameLen; + int imgLen = img.size; + size += WzTool.GetCompressedIntLength(imgLen); + size += imgLen; + size += WzTool.GetCompressedIntLength(img.Checksum); + size += 4; + offsetSize += nameLen; + offsetSize += WzTool.GetCompressedIntLength(imgLen); + offsetSize += WzTool.GetCompressedIntLength(img.Checksum); + offsetSize += 4; + + // otherwise Item.wz (300MB) probably uses > 4GB + if (useCustomIv) // when using custom IV, or changing IVs, all images have to be re-read and re-written.. + { + GC.Collect(); // GC slows down writing of maps in HaCreator GC.WaitForPendingFinalizers(); } + + //Debug.WriteLine("Writing image :" + img.FullPath); } foreach (WzDirectory dir in subDirs) { int nameLen = WzTool.GetWzObjectValueLength(dir.name, 3); size += nameLen; - size += dir.GenerateDataFile(fileName, useIv); + size += dir.GenerateDataFile(useIv, prevOpenedStream); size += WzTool.GetCompressedIntLength(dir.size); size += WzTool.GetCompressedIntLength(dir.Checksum); size += 4; @@ -387,6 +389,8 @@ internal int GenerateDataFile(string fileName, byte[] useIv) offsetSize += WzTool.GetCompressedIntLength(dir.size); offsetSize += WzTool.GetCompressedIntLength(dir.Checksum); offsetSize += 4; + + //Debug.WriteLine("Writing dir :" + dir.FullPath); } return size; } diff --git a/MapleLib/WzLib/WzFile.cs b/MapleLib/WzLib/WzFile.cs index 38592da2..cb10ae8d 100644 --- a/MapleLib/WzLib/WzFile.cs +++ b/MapleLib/WzLib/WzFile.cs @@ -375,7 +375,10 @@ public void SaveToDisk(string path, WzMapleVersion savingToPreferredWzVer = WzMa string tempFile = Path.GetFileNameWithoutExtension(path) + ".TEMP"; File.Create(tempFile).Close(); - wzDir.GenerateDataFile(tempFile, bIsWzIvSimilar ? null : WzIv); + using (FileStream fs = new FileStream(tempFile, FileMode.Append, FileAccess.Write)) + { + wzDir.GenerateDataFile(bIsWzIvSimilar ? null : WzIv, fs); + } WzTool.StringCache.Clear(); uint totalLen = wzDir.GetImgOffsets(wzDir.GetOffsets(Header.FStart + 2)); diff --git a/MapleLib/WzLib/WzProperties/WzBinaryProperty.cs b/MapleLib/WzLib/WzProperties/WzBinaryProperty.cs index 46805e6a..8a23d4d8 100644 --- a/MapleLib/WzLib/WzProperties/WzBinaryProperty.cs +++ b/MapleLib/WzLib/WzProperties/WzBinaryProperty.cs @@ -26,9 +26,9 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the namespace MapleLib.WzLib.WzProperties { - public enum WzSoundPropertyType + public enum WzBinaryPropertyType { - Binary, + Raw, // could be anything.. MP3, WAV, } @@ -166,14 +166,6 @@ public WzBinaryProperty(string name, WzBinaryReader reader, bool parseNow) reader.BaseStream.Position += soundDataLen; } - /*public WzSoundProperty(string name) - { - this.name = name; - this.len_ms = 0; - this.header = null; - this.mp3bytes = null; - }*/ - /// /// Creates a WzSoundProperty with the specified name and data from another WzSoundProperty Object /// @@ -246,7 +238,7 @@ public WzBinaryProperty(string name, string file) this.mp3bytes = File.ReadAllBytes(file); } - public static bool memcmp(byte[] a, byte[] b, int n) + public static bool Memcmp(byte[] a, byte[] b, int n) { for (int i = 0; i < n; i++) {