mirror of
https://github.com/Grasscutters/Cultivation.git
synced 2025-12-16 00:54:40 +01:00
downloading and extracting
This commit is contained in:
@@ -1,13 +1,12 @@
|
||||
import React from 'react'
|
||||
import { app } from '@tauri-apps/api'
|
||||
import { appWindow } from '@tauri-apps/api/window'
|
||||
import closeIcon from '../../resources/icons/close.svg'
|
||||
import minIcon from '../../resources/icons/min.svg'
|
||||
|
||||
import { getConfig, setConfigOption } from '../../utils/configuration'
|
||||
import Tr from '../../utils/language'
|
||||
|
||||
import './TopBar.css'
|
||||
import { getConfig, setConfigOption } from '../../utils/configuration'
|
||||
import closeIcon from '../../resources/icons/close.svg'
|
||||
import minIcon from '../../resources/icons/min.svg'
|
||||
|
||||
interface IProps {
|
||||
children?: React.ReactNode[]
|
||||
|
||||
@@ -5,6 +5,7 @@ import './ProgressBar.css'
|
||||
|
||||
interface IProps {
|
||||
downloadManager: DownloadHandler
|
||||
withStats?: boolean
|
||||
}
|
||||
|
||||
interface IState {
|
||||
@@ -70,11 +71,13 @@ export default class ProgressBar extends React.Component<IProps, IState> {
|
||||
></div>
|
||||
</div>
|
||||
|
||||
<div className="MainProgressText">
|
||||
<Tr text="main.files_downloading" /> {this.state.files} ({this.state.speed})
|
||||
<br />
|
||||
<Tr text="main.files_extracting" /> {this.state.extracting}
|
||||
</div>
|
||||
{this.props.withStats && (
|
||||
<div className="MainProgressText">
|
||||
<Tr text="main.files_downloading" /> {this.state.files} ({this.state.speed})
|
||||
<br />
|
||||
<Tr text="main.files_extracting" /> {this.state.extracting}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -112,7 +112,7 @@ export default class Downloads extends React.Component<IProps, IState> {
|
||||
async downloadGrasscutterStableRepo() {
|
||||
const folder = await this.getGrasscutterFolder()
|
||||
this.props.downloadManager.addDownload(STABLE_REPO_DOWNLOAD, folder + '\\grasscutter_repo.zip', () => {
|
||||
unzip(folder + '\\grasscutter_repo.zip', folder + '\\', this.toggleButtons)
|
||||
unzip(folder + '\\grasscutter_repo.zip', folder + '\\', true, this.toggleButtons)
|
||||
})
|
||||
|
||||
this.toggleButtons()
|
||||
@@ -121,7 +121,7 @@ export default class Downloads extends React.Component<IProps, IState> {
|
||||
async downloadGrasscutterDevRepo() {
|
||||
const folder = await this.getGrasscutterFolder()
|
||||
this.props.downloadManager.addDownload(DEV_REPO_DOWNLOAD, folder + '\\grasscutter_repo.zip', () => {
|
||||
unzip(folder + '\\grasscutter_repo.zip', folder + '\\', this.toggleButtons)
|
||||
unzip(folder + '\\grasscutter_repo.zip', folder + '\\', true, this.toggleButtons)
|
||||
})
|
||||
|
||||
this.toggleButtons()
|
||||
@@ -130,7 +130,7 @@ export default class Downloads extends React.Component<IProps, IState> {
|
||||
async downloadGrasscutterStable() {
|
||||
const folder = await this.getGrasscutterFolder()
|
||||
this.props.downloadManager.addDownload(STABLE_DOWNLOAD, folder + '\\grasscutter.zip', () => {
|
||||
unzip(folder + '\\grasscutter.zip', folder + '\\', this.toggleButtons)
|
||||
unzip(folder + '\\grasscutter.zip', folder + '\\', true, this.toggleButtons)
|
||||
})
|
||||
|
||||
// Also add repo download
|
||||
@@ -142,7 +142,7 @@ export default class Downloads extends React.Component<IProps, IState> {
|
||||
async downloadGrasscutterLatest() {
|
||||
const folder = await this.getGrasscutterFolder()
|
||||
this.props.downloadManager.addDownload(DEV_DOWNLOAD, folder + '\\grasscutter.zip', () => {
|
||||
unzip(folder + '\\grasscutter.zip', folder + '\\', this.toggleButtons)
|
||||
unzip(folder + '\\grasscutter.zip', folder + '\\', true, this.toggleButtons)
|
||||
})
|
||||
|
||||
// Also add repo download
|
||||
@@ -165,7 +165,7 @@ export default class Downloads extends React.Component<IProps, IState> {
|
||||
})
|
||||
}
|
||||
|
||||
await unzip(folder + '\\resources.zip', folder + '\\', () => {
|
||||
await unzip(folder + '\\resources.zip', folder + '\\', true, () => {
|
||||
// Rename folder to resources
|
||||
invoke('rename', {
|
||||
path: folder + '\\Resources',
|
||||
|
||||
@@ -46,7 +46,7 @@ export default class Downloads extends React.Component<IProps, IState> {
|
||||
async downloadGame() {
|
||||
const folder = this.state.gameDownloadFolder
|
||||
this.props.downloadManager.addDownload(GAME_DOWNLOAD, folder + '\\game.zip', () => {
|
||||
unzip(folder + '\\game.zip', folder + '\\', () => {
|
||||
unzip(folder + '\\game.zip', folder + '\\', true, () => {
|
||||
this.setState({
|
||||
gameDownloading: false,
|
||||
})
|
||||
|
||||
@@ -24,8 +24,6 @@ export class ModList extends React.Component<IProps, IState> {
|
||||
constructor(props: IProps) {
|
||||
super(props)
|
||||
|
||||
console.log('Getting')
|
||||
|
||||
this.state = {
|
||||
modList: null,
|
||||
installedList: null,
|
||||
|
||||
Reference in New Issue
Block a user