Skip to content

Commit

Permalink
Implemented mednafen downloading - #81
Browse files Browse the repository at this point in the history
  • Loading branch information
Asnivor committed Jun 27, 2017
1 parent 2151ee6 commit b7f3ce7
Show file tree
Hide file tree
Showing 6 changed files with 413 additions and 29 deletions.
2 changes: 1 addition & 1 deletion MedLaunch/Classes/BackupConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public static void BackupMain()
Directory.CreateDirectory(backupDir);
string destPath = backupDir + "\\mednafen-09x(MLBackup-" + timeStamp + ").cfg";
// create a backup
File.Copy(cfgPath, destPath);
File.Copy(cfgPath, destPath, true);
}
}
}
Expand Down
24 changes: 23 additions & 1 deletion MedLaunch/Classes/IO/Archiving.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,13 @@ public class Archiving
public static List<Archiving> ArchiveMultiple { get; set; }

// constructors
public Archiving(string archivePath)
{
ArchiveMultiple = new List<Archiving>();
ArchivePath = archivePath;
ArchiveExtension = System.IO.Path.GetExtension(ArchivePath).ToLower();
}

public Archiving(string archivePath, int systemId)
{
//if (ArchiveMultiple == null)
Expand All @@ -55,7 +62,6 @@ public Archiving(string _hash, string filename, string archivePath, int systemId
/* methods */




/// <summary>
/// Process the selected archive
Expand Down Expand Up @@ -211,6 +217,22 @@ public void ExtractArchive(string destinationDirectory)
}
}

public void ExtractArchiveZipOverwrite(string destinationDirectory)
{
// determine archive type
if (ArchiveExtension == ".zip")
{
var archive = ArchiveFactory.Open(ArchivePath);
foreach (var entry in archive.Entries)
{
if (entry.IsDirectory)
continue;

entry.WriteToDirectory(destinationDirectory, new SharpCompress.Readers.ExtractionOptions() { Overwrite = true });
}
}
}


public static List<string> GetSbiListFrom7z(string path)
{
Expand Down
36 changes: 35 additions & 1 deletion MedLaunch/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -10986,7 +10986,7 @@ xmlns:il="clr-namespace:Microsoft.Expression.Interactivity.Layout;assembly=Micro
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>

<Button x:Name="btnCheckForUpdates" Click="btnCheckForUpdates_Click" Grid.ColumnSpan="2" Grid.Row="0">Check for Updates</Button>
<Button x:Name="btnCheckForUpdates" Click="btnCheckForUpdates_Click" Grid.ColumnSpan="2" Grid.Row="0">Check for MedLaunch Updates</Button>
<Label HorizontalAlignment="Center" HorizontalContentAlignment="Center" Grid.ColumnSpan="2" Grid.Row="1" Margin="20" x:Name="lblNoUpdate">No MedLaunch Update Available</Label>

<Label x:Name="lbl1" Grid.Column="0" Grid.Row="1" VerticalAlignment="Top" Margin="10" VerticalContentAlignment="Top">
Expand Down Expand Up @@ -11028,6 +11028,40 @@ xmlns:il="clr-namespace:Microsoft.Expression.Interactivity.Layout;assembly=Micro


</Grid>

<Grid Width="500" Margin="50">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="0.7*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>


<Button x:Name="btnCheckForMednafenUpdates" Click="btnCheckForMednafenUpdates_Click" Grid.ColumnSpan="2" Grid.Row="0">Refresh Mednafen Version Status</Button>
<Label HorizontalAlignment="Center" HorizontalContentAlignment="Center" Grid.Column="0" Grid.Row="1" Margin="20" x:Name="lblcompatmedversiontxt">Latest Compatible Mednafen Version: </Label>
<Label HorizontalAlignment="Center" HorizontalContentAlignment="Center" Grid.Column="1" Grid.Row="1" Margin="20" x:Name="lblcompatmedversion"></Label>

<Label HorizontalAlignment="Center" HorizontalContentAlignment="Center" Grid.Column="0" Grid.Row="2" Margin="20" x:Name="lblinstalledmedversiontxt">Installed Mednafen Version:</Label>
<Label HorizontalAlignment="Center" HorizontalContentAlignment="Center" Grid.Column="1" Grid.Row="2" Margin="20" x:Name="lblinstalledmedversion"></Label>


<Button Margin="20" Grid.ColumnSpan="2" Grid.Row="3" x:Name="btnUpdate1" Click="btnUpdateMednafen_Click">
<TextBlock HorizontalAlignment="Center" TextAlignment="Center">
Download and Unpack the Latest Compatible Mednafen
<LineBreak />
Version to Your Current Mednafen Folder
</TextBlock>
</Button>



</Grid>

</WrapPanel>
</TabItem>

Expand Down
Loading

0 comments on commit b7f3ce7

Please sign in to comment.