@@ -646,11 +646,29 @@ private void metanetPalettesList_SelectedIndexChanged(object sender, EventArgs e
646646 private void installMetanetPalette_Click ( object sender , EventArgs e )
647647 {
648648 string palName = metanetPalettesList . SelectedItem . ToString ( ) . Substring ( 0 , metanetPalettesList . SelectedItem . ToString ( ) . Length - 13 ) ;
649- DirectoryCopy ( savePath + @"\Palettes\Palettes\" + palName , steamGamePath + @"\NPP\Palettes\" + palName , false ) ;
650- palettesInstalledList . Items . Clear ( ) ;
651- PopulateListBoxWithSubDirectories ( palettesInstalledList , steamGamePath + @"\NPP\Palettes" ) ;
652- installMetanetPalette . Enabled = false ;
653- statusLabel . Text = "Done installing palette " + palName ;
649+
650+ // check if it already exists
651+ if ( Directory . Exists ( steamGamePath + @"\NPP\Palettes\" + palName ) )
652+ {
653+ DialogResult dialogResult = MessageBox . Show ( "A palette already exists with this name, would you like to replace it?" , "Replace Existing?" , MessageBoxButtons . YesNo ) ;
654+ if ( dialogResult == DialogResult . Yes )
655+ {
656+ Directory . Delete ( steamGamePath + @"\NPP\Palettes\" + palName , true ) ;
657+ DirectoryCopy ( savePath + @"\Palettes\Palettes\" + palName , steamGamePath + @"\NPP\Palettes\" + palName , false ) ;
658+ palettesInstalledList . Items . Clear ( ) ;
659+ PopulateListBoxWithSubDirectories ( palettesInstalledList , steamGamePath + @"\NPP\Palettes" ) ;
660+ installMetanetPalette . Enabled = false ;
661+ statusLabel . Text = "Done installing palette " + palName ;
662+ }
663+ }
664+ else
665+ {
666+ DirectoryCopy ( savePath + @"\Palettes\Palettes\" + palName , steamGamePath + @"\NPP\Palettes\" + palName , false ) ;
667+ palettesInstalledList . Items . Clear ( ) ;
668+ PopulateListBoxWithSubDirectories ( palettesInstalledList , steamGamePath + @"\NPP\Palettes" ) ;
669+ installMetanetPalette . Enabled = false ;
670+ statusLabel . Text = "Done installing palette " + palName ;
671+ }
654672 }
655673
656674 private void communityPalettesList_SelectedIndexChanged ( object sender , EventArgs e )
0 commit comments