mirror of
https://github.com/ShareX/ShareX.git
synced 2024-09-28 15:31:30 +12:00
fixed #3015: Removed SevenZipSharp library instead using 7-Zip CLI
This commit is contained in:
parent
4f9b458a7c
commit
328ca6b61d
17 changed files with 130 additions and 288 deletions
BIN
Lib/7z-x64.dll
BIN
Lib/7z-x64.dll
Binary file not shown.
BIN
Lib/7z.dll
BIN
Lib/7z.dll
Binary file not shown.
BIN
Lib/7za.exe
Normal file
BIN
Lib/7za.exe
Normal file
Binary file not shown.
|
@ -1,165 +0,0 @@
|
|||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
|
||||
This version of the GNU Lesser General Public License incorporates
|
||||
the terms and conditions of version 3 of the GNU General Public
|
||||
License, supplemented by the additional permissions listed below.
|
||||
|
||||
0. Additional Definitions.
|
||||
|
||||
As used herein, "this License" refers to version 3 of the GNU Lesser
|
||||
General Public License, and the "GNU GPL" refers to version 3 of the GNU
|
||||
General Public License.
|
||||
|
||||
"The Library" refers to a covered work governed by this License,
|
||||
other than an Application or a Combined Work as defined below.
|
||||
|
||||
An "Application" is any work that makes use of an interface provided
|
||||
by the Library, but which is not otherwise based on the Library.
|
||||
Defining a subclass of a class defined by the Library is deemed a mode
|
||||
of using an interface provided by the Library.
|
||||
|
||||
A "Combined Work" is a work produced by combining or linking an
|
||||
Application with the Library. The particular version of the Library
|
||||
with which the Combined Work was made is also called the "Linked
|
||||
Version".
|
||||
|
||||
The "Minimal Corresponding Source" for a Combined Work means the
|
||||
Corresponding Source for the Combined Work, excluding any source code
|
||||
for portions of the Combined Work that, considered in isolation, are
|
||||
based on the Application, and not on the Linked Version.
|
||||
|
||||
The "Corresponding Application Code" for a Combined Work means the
|
||||
object code and/or source code for the Application, including any data
|
||||
and utility programs needed for reproducing the Combined Work from the
|
||||
Application, but excluding the System Libraries of the Combined Work.
|
||||
|
||||
1. Exception to Section 3 of the GNU GPL.
|
||||
|
||||
You may convey a covered work under sections 3 and 4 of this License
|
||||
without being bound by section 3 of the GNU GPL.
|
||||
|
||||
2. Conveying Modified Versions.
|
||||
|
||||
If you modify a copy of the Library, and, in your modifications, a
|
||||
facility refers to a function or data to be supplied by an Application
|
||||
that uses the facility (other than as an argument passed when the
|
||||
facility is invoked), then you may convey a copy of the modified
|
||||
version:
|
||||
|
||||
a) under this License, provided that you make a good faith effort to
|
||||
ensure that, in the event an Application does not supply the
|
||||
function or data, the facility still operates, and performs
|
||||
whatever part of its purpose remains meaningful, or
|
||||
|
||||
b) under the GNU GPL, with none of the additional permissions of
|
||||
this License applicable to that copy.
|
||||
|
||||
3. Object Code Incorporating Material from Library Header Files.
|
||||
|
||||
The object code form of an Application may incorporate material from
|
||||
a header file that is part of the Library. You may convey such object
|
||||
code under terms of your choice, provided that, if the incorporated
|
||||
material is not limited to numerical parameters, data structure
|
||||
layouts and accessors, or small macros, inline functions and templates
|
||||
(ten or fewer lines in length), you do both of the following:
|
||||
|
||||
a) Give prominent notice with each copy of the object code that the
|
||||
Library is used in it and that the Library and its use are
|
||||
covered by this License.
|
||||
|
||||
b) Accompany the object code with a copy of the GNU GPL and this license
|
||||
document.
|
||||
|
||||
4. Combined Works.
|
||||
|
||||
You may convey a Combined Work under terms of your choice that,
|
||||
taken together, effectively do not restrict modification of the
|
||||
portions of the Library contained in the Combined Work and reverse
|
||||
engineering for debugging such modifications, if you also do each of
|
||||
the following:
|
||||
|
||||
a) Give prominent notice with each copy of the Combined Work that
|
||||
the Library is used in it and that the Library and its use are
|
||||
covered by this License.
|
||||
|
||||
b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
||||
document.
|
||||
|
||||
c) For a Combined Work that displays copyright notices during
|
||||
execution, include the copyright notice for the Library among
|
||||
these notices, as well as a reference directing the user to the
|
||||
copies of the GNU GPL and this license document.
|
||||
|
||||
d) Do one of the following:
|
||||
|
||||
0) Convey the Minimal Corresponding Source under the terms of this
|
||||
License, and the Corresponding Application Code in a form
|
||||
suitable for, and under terms that permit, the user to
|
||||
recombine or relink the Application with a modified version of
|
||||
the Linked Version to produce a modified Combined Work, in the
|
||||
manner specified by section 6 of the GNU GPL for conveying
|
||||
Corresponding Source.
|
||||
|
||||
1) Use a suitable shared library mechanism for linking with the
|
||||
Library. A suitable mechanism is one that (a) uses at run time
|
||||
a copy of the Library already present on the user's computer
|
||||
system, and (b) will operate properly with a modified version
|
||||
of the Library that is interface-compatible with the Linked
|
||||
Version.
|
||||
|
||||
e) Provide Installation Information, but only if you would otherwise
|
||||
be required to provide such information under section 6 of the
|
||||
GNU GPL, and only to the extent that such information is
|
||||
necessary to install and execute a modified version of the
|
||||
Combined Work produced by recombining or relinking the
|
||||
Application with a modified version of the Linked Version. (If
|
||||
you use option 4d0, the Installation Information must accompany
|
||||
the Minimal Corresponding Source and Corresponding Application
|
||||
Code. If you use option 4d1, you must provide the Installation
|
||||
Information in the manner specified by section 6 of the GNU GPL
|
||||
for conveying Corresponding Source.)
|
||||
|
||||
5. Combined Libraries.
|
||||
|
||||
You may place library facilities that are a work based on the
|
||||
Library side by side in a single library together with other library
|
||||
facilities that are not Applications and are not covered by this
|
||||
License, and convey such a combined library under terms of your
|
||||
choice, if you do both of the following:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work based
|
||||
on the Library, uncombined with any other library facilities,
|
||||
conveyed under the terms of this License.
|
||||
|
||||
b) Give prominent notice with the combined library that part of it
|
||||
is a work based on the Library, and explaining where to find the
|
||||
accompanying uncombined form of the same work.
|
||||
|
||||
6. Revised Versions of the GNU Lesser General Public License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions
|
||||
of the GNU Lesser General Public License from time to time. Such new
|
||||
versions will be similar in spirit to the present version, but may
|
||||
differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Library as you received it specifies that a certain numbered version
|
||||
of the GNU Lesser General Public License "or any later version"
|
||||
applies to it, you have the option of following the terms and
|
||||
conditions either of that published version or of any later version
|
||||
published by the Free Software Foundation. If the Library as you
|
||||
received it does not specify a version number of the GNU Lesser
|
||||
General Public License, you may choose any version of the GNU Lesser
|
||||
General Public License ever published by the Free Software Foundation.
|
||||
|
||||
If the Library as you received it specifies that a proxy can decide
|
||||
whether future versions of the GNU Lesser General Public License shall
|
||||
apply, that proxy's public statement of acceptance of any version is
|
||||
permanent authorization for you to choose that version for the
|
||||
Library.
|
89
ShareX.HelpersLib/SevenZipManager.cs
Normal file
89
ShareX.HelpersLib/SevenZipManager.cs
Normal file
|
@ -0,0 +1,89 @@
|
|||
#region License Information (GPL v3)
|
||||
|
||||
/*
|
||||
ShareX - A program that allows you to take screenshots and share any file type
|
||||
Copyright (c) 2007-2017 ShareX Team
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
Optionally you can also view the license at <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#endregion License Information (GPL v3)
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
|
||||
namespace ShareX.HelpersLib
|
||||
{
|
||||
public class SevenZipManager
|
||||
{
|
||||
public string SevenZipPath { get; set; }
|
||||
|
||||
public SevenZipManager()
|
||||
{
|
||||
SevenZipPath = Helpers.GetAbsolutePath("7za.exe");
|
||||
}
|
||||
|
||||
public SevenZipManager(string sevenZipPath)
|
||||
{
|
||||
SevenZipPath = sevenZipPath;
|
||||
}
|
||||
|
||||
public bool Compress(string archivePath, List<string> files, string workingDirectory = "")
|
||||
{
|
||||
string fileArgs = string.Join(" ", files.Select(x => $"\"{x}\""));
|
||||
string arguments = $"a -tzip \"{archivePath}\" {fileArgs} -mx=9";
|
||||
return Run(arguments, workingDirectory) == 0;
|
||||
}
|
||||
|
||||
public bool Extract(string archivePath, string destination)
|
||||
{
|
||||
string arguments = $"x \"{archivePath}\" -o\"{destination}\" -y";
|
||||
return Run(arguments) == 0;
|
||||
}
|
||||
|
||||
public bool Extract(string archivePath, string destination, List<string> files)
|
||||
{
|
||||
string fileArgs = string.Join(" ", files.Select(x => $"\"{x}\""));
|
||||
string arguments = $"e \"{archivePath}\" -o\"{destination}\" {fileArgs} -r -y";
|
||||
return Run(arguments) == 0;
|
||||
}
|
||||
|
||||
private int Run(string arguments, string workingDirectory = "")
|
||||
{
|
||||
ProcessStartInfo startInfo = new ProcessStartInfo()
|
||||
{
|
||||
FileName = SevenZipPath,
|
||||
Arguments = arguments,
|
||||
UseShellExecute = false,
|
||||
CreateNoWindow = true
|
||||
};
|
||||
|
||||
if (!string.IsNullOrEmpty(workingDirectory))
|
||||
{
|
||||
startInfo.WorkingDirectory = workingDirectory;
|
||||
}
|
||||
|
||||
Process process = new Process();
|
||||
process.StartInfo = startInfo;
|
||||
process.Start();
|
||||
process.WaitForExit();
|
||||
|
||||
return process.ExitCode;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -126,6 +126,7 @@
|
|||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Helpers\JsonHelpers.cs" />
|
||||
<Compile Include="SevenZipManager.cs" />
|
||||
<Compile Include="Input\HotkeyForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
|
|
|
@ -23,9 +23,9 @@ You should have received a copy of the GNU General Public License
|
|||
|
||||
#endregion License Information (GPL v3)
|
||||
|
||||
using SevenZip;
|
||||
using ShareX.HelpersLib;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Windows.Forms;
|
||||
|
@ -57,37 +57,13 @@ public static DialogResult DownloadFFmpeg(bool async, DownloaderForm.DownloaderI
|
|||
}
|
||||
}
|
||||
|
||||
public static bool ExtractFFmpeg(string zipPath, string extractPath)
|
||||
public static bool ExtractFFmpeg(string archivePath, string extractPath)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (NativeMethods.Is64Bit())
|
||||
{
|
||||
SevenZipBase.SetLibraryPath(Helpers.GetAbsolutePath("7z-x64.dll"));
|
||||
}
|
||||
else
|
||||
{
|
||||
SevenZipBase.SetLibraryPath(Helpers.GetAbsolutePath("7z.dll"));
|
||||
}
|
||||
|
||||
Helpers.CreateDirectoryFromFilePath(extractPath);
|
||||
|
||||
using (SevenZipExtractor zip = new SevenZipExtractor(zipPath))
|
||||
{
|
||||
Regex regex = new Regex(@"^ffmpeg-.+\\bin\\ffmpeg\.exe$", RegexOptions.Compiled | RegexOptions.CultureInvariant);
|
||||
|
||||
foreach (ArchiveFileInfo item in zip.ArchiveFileData)
|
||||
{
|
||||
if (regex.IsMatch(item.FileName))
|
||||
{
|
||||
using (FileStream fs = new FileStream(extractPath, FileMode.Create, FileAccess.Write, FileShare.None))
|
||||
{
|
||||
zip.ExtractFile(item.Index, fs);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
SevenZipManager sevenZipManager = new SevenZipManager();
|
||||
List<string> files = new List<string>() { "ffmpeg.exe" };
|
||||
return sevenZipManager.Extract(archivePath, extractPath, files);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
|
|
@ -60,10 +60,6 @@
|
|||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="SevenZipSharp, Version=0.64.3890.29348, Culture=neutral, PublicKeyToken=20de82c62b055c88, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\SevenZipSharp.0.64\lib\SevenZipSharp.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Design" />
|
||||
|
@ -216,9 +212,6 @@
|
|||
<EmbeddedResource Include="Properties\Resources.zh-CN.resx" />
|
||||
<EmbeddedResource Include="Properties\Resources.zh-TW.resx" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
|
|
|
@ -1,4 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="SevenZipSharp" version="0.64" targetFramework="net40" />
|
||||
</packages>
|
|
@ -430,14 +430,13 @@ private void btnDownload_Click(object sender, EventArgs e)
|
|||
|
||||
private void DownloaderForm_InstallRequested(string filePath)
|
||||
{
|
||||
string extractPath = DefaultToolsPath ?? "ffmpeg.exe";
|
||||
bool result = FFmpegDownloader.ExtractFFmpeg(filePath, extractPath);
|
||||
bool result = FFmpegDownloader.ExtractFFmpeg(filePath, DefaultToolsPath);
|
||||
|
||||
if (result)
|
||||
{
|
||||
this.InvokeSafe(() =>
|
||||
{
|
||||
txtFFmpegPath.Text = Helpers.GetVariableFolderPath(extractPath);
|
||||
txtFFmpegPath.Text = Helpers.GetVariableFolderPath(DefaultToolsPath);
|
||||
RefreshSourcesAsync();
|
||||
UpdateUI();
|
||||
});
|
||||
|
|
|
@ -105,7 +105,6 @@ public AboutForm()
|
|||
FFmpeg: http://www.ffmpeg.org
|
||||
Zeranoe FFmpeg: http://ffmpeg.zeranoe.com/builds
|
||||
7-Zip: http://www.7-zip.org
|
||||
SevenZipSharp: https://sevenzipsharp.codeplex.com
|
||||
DirectShow video and audio device: https://github.com/rdp/screen-capture-recorder-to-video-windows-free
|
||||
System.Net.FtpClient: https://netftp.codeplex.com
|
||||
Steamworks.NET: https://github.com/rlabrecque/Steamworks.NET
|
||||
|
|
|
@ -1064,7 +1064,7 @@ private void btnScreenRecorderFFmpegOptions_Click(object sender, EventArgs e)
|
|||
|
||||
using (FFmpegOptionsForm form = new FFmpegOptionsForm(options))
|
||||
{
|
||||
form.DefaultToolsPath = Program.DefaultFFmpegFilePath;
|
||||
form.DefaultToolsPath = Program.ToolsFolder;
|
||||
form.ShowDialog();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -145,17 +145,21 @@ public static string PersonalFolder
|
|||
}
|
||||
}
|
||||
|
||||
public const string HistoryFilename = "History.xml";
|
||||
|
||||
public static string HistoryFilePath
|
||||
{
|
||||
get
|
||||
{
|
||||
if (Sandbox) return null;
|
||||
|
||||
return Path.Combine(PersonalFolder, "History.xml");
|
||||
return Path.Combine(PersonalFolder, HistoryFilename);
|
||||
}
|
||||
}
|
||||
|
||||
public static string LogsFolder => Path.Combine(PersonalFolder, "Logs");
|
||||
public const string LogsFoldername = "Logs";
|
||||
|
||||
public static string LogsFolder => Path.Combine(PersonalFolder, LogsFoldername);
|
||||
|
||||
public static string LogsFilePath
|
||||
{
|
||||
|
|
|
@ -23,7 +23,6 @@ You should have received a copy of the GNU General Public License
|
|||
|
||||
#endregion License Information (GPL v3)
|
||||
|
||||
using SevenZip;
|
||||
using ShareX.HelpersLib;
|
||||
using ShareX.ScreenCaptureLib;
|
||||
using ShareX.UploadersLib;
|
||||
|
@ -38,16 +37,20 @@ namespace ShareX
|
|||
{
|
||||
internal static class SettingManager
|
||||
{
|
||||
private const string ApplicationConfigFilename = "ApplicationConfig.json";
|
||||
|
||||
private static string ApplicationConfigFilePath
|
||||
{
|
||||
get
|
||||
{
|
||||
if (Program.Sandbox) return null;
|
||||
|
||||
return Path.Combine(Program.PersonalFolder, "ApplicationConfig.json");
|
||||
return Path.Combine(Program.PersonalFolder, ApplicationConfigFilename);
|
||||
}
|
||||
}
|
||||
|
||||
private const string UploadersConfigFilename = "UploadersConfig.json";
|
||||
|
||||
private static string UploadersConfigFilePath
|
||||
{
|
||||
get
|
||||
|
@ -65,10 +68,12 @@ private static string UploadersConfigFilePath
|
|||
uploadersConfigFolder = Program.PersonalFolder;
|
||||
}
|
||||
|
||||
return Path.Combine(uploadersConfigFolder, "UploadersConfig.json");
|
||||
return Path.Combine(uploadersConfigFolder, UploadersConfigFilename);
|
||||
}
|
||||
}
|
||||
|
||||
private const string HotkeysConfigFilename = "HotkeysConfig.json";
|
||||
|
||||
private static string HotkeysConfigFilePath
|
||||
{
|
||||
get
|
||||
|
@ -86,7 +91,7 @@ private static string HotkeysConfigFilePath
|
|||
hotkeysConfigFolder = Program.PersonalFolder;
|
||||
}
|
||||
|
||||
return Path.Combine(hotkeysConfigFolder, "HotkeysConfig.json");
|
||||
return Path.Combine(hotkeysConfigFolder, HotkeysConfigFilename);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -253,101 +258,55 @@ public static void ResetSettings()
|
|||
HotkeysConfig = new HotkeysConfig();
|
||||
}
|
||||
|
||||
public static bool Export(string exportPath)
|
||||
public static bool Export(string archivePath)
|
||||
{
|
||||
try
|
||||
{
|
||||
Set7ZipLibraryPath();
|
||||
|
||||
SevenZipCompressor zip = new SevenZipCompressor()
|
||||
{
|
||||
ArchiveFormat = OutArchiveFormat.SevenZip,
|
||||
CompressionLevel = CompressionLevel.Normal,
|
||||
CompressionMethod = CompressionMethod.Lzma2
|
||||
};
|
||||
|
||||
Dictionary<string, string> files = new Dictionary<string, string>();
|
||||
List<string> files = new List<string>();
|
||||
|
||||
if (Settings.ExportSettings)
|
||||
{
|
||||
AddFileToDictionary(files, ApplicationConfigFilePath);
|
||||
AddFileToDictionary(files, HotkeysConfigFilePath);
|
||||
AddFileToDictionary(files, UploadersConfigFilePath);
|
||||
files.Add(ApplicationConfigFilename);
|
||||
files.Add(HotkeysConfigFilename);
|
||||
files.Add(UploadersConfigFilename);
|
||||
}
|
||||
|
||||
if (Settings.ExportHistory)
|
||||
{
|
||||
AddFileToDictionary(files, Program.HistoryFilePath);
|
||||
files.Add(Program.HistoryFilename);
|
||||
}
|
||||
|
||||
if (Settings.ExportLogs)
|
||||
{
|
||||
foreach (string file in Directory.GetFiles(Program.LogsFolder, "*.txt", SearchOption.TopDirectoryOnly))
|
||||
{
|
||||
AddFileToDictionary(files, file, Path.GetFileName(Program.LogsFolder));
|
||||
}
|
||||
files.Add($"{Program.LogsFoldername}\\*.txt");
|
||||
}
|
||||
|
||||
zip.CompressFileDictionary(files, exportPath);
|
||||
|
||||
return true;
|
||||
SevenZipManager sevenZipManager = new SevenZipManager();
|
||||
return sevenZipManager.Compress(archivePath, files, Program.PersonalFolder);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
DebugHelper.WriteException(e);
|
||||
MessageBox.Show("Error while exporting backup:\r\n\r\n" + e, "ShareX - Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
MessageBox.Show("Error while exporting backup:\r\n" + e, "ShareX - Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static bool Import(string importPath)
|
||||
public static bool Import(string archivePath)
|
||||
{
|
||||
try
|
||||
{
|
||||
Set7ZipLibraryPath();
|
||||
|
||||
using (SevenZipExtractor zip = new SevenZipExtractor(importPath))
|
||||
{
|
||||
zip.ExtractArchive(Program.PersonalFolder);
|
||||
|
||||
return true;
|
||||
}
|
||||
SevenZipManager sevenZipManager = new SevenZipManager();
|
||||
return sevenZipManager.Extract(archivePath, Program.PersonalFolder);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
DebugHelper.WriteException(e);
|
||||
MessageBox.Show("Error while importing backup:\r\n\r\n" + e, "ShareX - Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
MessageBox.Show("Error while importing backup:\r\n" + e, "ShareX - Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private static void Set7ZipLibraryPath()
|
||||
{
|
||||
if (NativeMethods.Is64Bit())
|
||||
{
|
||||
SevenZipBase.SetLibraryPath(Helpers.GetAbsolutePath("7z-x64.dll"));
|
||||
}
|
||||
else
|
||||
{
|
||||
SevenZipBase.SetLibraryPath(Helpers.GetAbsolutePath("7z.dll"));
|
||||
}
|
||||
}
|
||||
|
||||
private static void AddFileToDictionary(Dictionary<string, string> files, string filePath, string subFolder = null)
|
||||
{
|
||||
if (File.Exists(filePath))
|
||||
{
|
||||
string destinationPath = Path.GetFileName(filePath);
|
||||
|
||||
if (!string.IsNullOrEmpty(subFolder))
|
||||
{
|
||||
destinationPath = Path.Combine(subFolder, destinationPath);
|
||||
}
|
||||
|
||||
files.Add(destinationPath, filePath);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -101,10 +101,6 @@
|
|||
<Reference Include="Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Newtonsoft.Json.10.0.3\lib\net40\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="SevenZipSharp, Version=0.64.3890.29348, Culture=neutral, PublicKeyToken=20de82c62b055c88, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\SevenZipSharp.0.64\lib\SevenZipSharp.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
|
@ -1402,12 +1398,8 @@
|
|||
<None Include="Resources\network-ip.png" />
|
||||
<None Include="Resources\ruler-triangle.png" />
|
||||
<None Include="Resources\application-network.png" />
|
||||
<None Include="..\Lib\7z-x64.dll">
|
||||
<Link>7z-x64.dll</Link>
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="..\Lib\7z.dll">
|
||||
<Link>7z.dll</Link>
|
||||
<None Include="..\Lib\7za.exe">
|
||||
<Link>7za.exe</Link>
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="Resources\barcode-2d.png" />
|
||||
|
|
|
@ -1206,7 +1206,7 @@ public static bool CheckFFmpeg(TaskSettings taskSettings)
|
|||
|
||||
private static void DownloaderForm_InstallRequested(string filePath)
|
||||
{
|
||||
bool result = FFmpegDownloader.ExtractFFmpeg(filePath, Program.DefaultFFmpegFilePath);
|
||||
bool result = FFmpegDownloader.ExtractFFmpeg(filePath, Program.ToolsFolder);
|
||||
|
||||
if (result)
|
||||
{
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Newtonsoft.Json" version="10.0.3" targetFramework="net40" />
|
||||
<package id="SevenZipSharp" version="0.64" targetFramework="net40" />
|
||||
<package id="ZXing.Net" version="0.16.2" targetFramework="net40" />
|
||||
</packages>
|
Loading…
Reference in a new issue