mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Moved version from Core to Interop.
This commit is contained in:
2
.idea/.idea.DiscImageChef/.idea/contentModel.xml
generated
2
.idea/.idea.DiscImageChef/.idea/contentModel.xml
generated
@@ -162,7 +162,6 @@
|
||||
<e p="Sidecar.cs" t="Include" />
|
||||
</e>
|
||||
<e p="Statistics.cs" t="Include" />
|
||||
<e p="Version.cs" t="Include" />
|
||||
<e p="bin" t="ExcludeRecursive" />
|
||||
<e p="obj" t="ExcludeRecursive" />
|
||||
<e p="packages.config" t="Include" />
|
||||
@@ -665,6 +664,7 @@
|
||||
<e p="Properties" t="Include">
|
||||
<e p="AssemblyInfo.cs" t="Include" />
|
||||
</e>
|
||||
<e p="Version.cs" t="Include" />
|
||||
<e p="bin" t="ExcludeRecursive" />
|
||||
<e p="obj" t="ExcludeRecursive" />
|
||||
</e>
|
||||
|
||||
@@ -36,6 +36,7 @@ using DiscImageChef.Metadata;
|
||||
using Extents;
|
||||
using Schemas;
|
||||
using PlatformID = DiscImageChef.Interop.PlatformID;
|
||||
using Version = DiscImageChef.Interop.Version;
|
||||
|
||||
namespace DiscImageChef.Core.Devices.Dumping
|
||||
{
|
||||
@@ -62,9 +63,11 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
/// If the provided resume does not correspond with the current in
|
||||
/// progress dump
|
||||
/// </exception>
|
||||
internal static void Process(bool isLba, bool removable, ulong blocks, string manufacturer, string model,
|
||||
internal static void Process(bool isLba, bool removable, ulong blocks,
|
||||
string manufacturer, string model,
|
||||
string serial, PlatformID platform, ref Resume resume,
|
||||
ref DumpHardwareType currentTry, ref ExtentsULong extents)
|
||||
ref DumpHardwareType currentTry,
|
||||
ref ExtentsULong extents)
|
||||
{
|
||||
if(resume != null)
|
||||
{
|
||||
|
||||
@@ -43,6 +43,7 @@ using DiscImageChef.Devices;
|
||||
using DiscImageChef.Metadata;
|
||||
using Schemas;
|
||||
using MediaType = DiscImageChef.CommonTypes.MediaType;
|
||||
using Version = DiscImageChef.Interop.Version;
|
||||
|
||||
namespace DiscImageChef.Core.Devices.Dumping
|
||||
{
|
||||
@@ -58,7 +59,8 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
/// <param name="dumpLog">Dump logger</param>
|
||||
/// <param name="sidecar">Partially filled initialized sidecar</param>
|
||||
internal static void Dump(Device dev, string outputPrefix, string devicePath, ref CICMMetadataType sidecar,
|
||||
ref Resume resume, ref DumpLog dumpLog)
|
||||
ref Resume resume,
|
||||
ref DumpLog dumpLog)
|
||||
{
|
||||
FixedSense? fxSense;
|
||||
bool aborted;
|
||||
@@ -136,8 +138,8 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
fxSense = Sense.DecodeFixed(senseBuf, out strSense);
|
||||
|
||||
if(fxSense.HasValue && (fxSense.Value.ASC == 0x20 && fxSense.Value.ASCQ != 0x00 ||
|
||||
fxSense.Value.ASC != 0x20 && fxSense.Value.SenseKey != SenseKeys.IllegalRequest)
|
||||
)
|
||||
fxSense.Value.ASC != 0x20 &&
|
||||
fxSense.Value.SenseKey != SenseKeys.IllegalRequest))
|
||||
{
|
||||
DicConsole.ErrorWriteLine("Could not get position. Sense follows...");
|
||||
DicConsole.ErrorWriteLine("{0}", strSense);
|
||||
@@ -501,7 +503,8 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
DicConsole.WriteLine("Blocksize changed to {0} bytes at block {1}", blockSize, currentBlock);
|
||||
dumpLog.WriteLine("Blocksize changed to {0} bytes at block {1}", blockSize, currentBlock);
|
||||
|
||||
sense = dev.Space(out senseBuf, SscSpaceCodes.LogicalBlock, -1, dev.Timeout, out duration);
|
||||
sense = dev.Space(out senseBuf, SscSpaceCodes.LogicalBlock, -1, dev.Timeout,
|
||||
out duration);
|
||||
totalDuration += duration;
|
||||
|
||||
if(sense)
|
||||
@@ -617,6 +620,7 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
double newSpeed = blockSize / (double)1048576 / (duration / 1000);
|
||||
if(!double.IsInfinity(newSpeed)) currentSpeed = newSpeed;
|
||||
}
|
||||
|
||||
currentBlock++;
|
||||
currentSize += blockSize;
|
||||
currentFileSize += blockSize;
|
||||
@@ -628,8 +632,10 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
end = DateTime.UtcNow;
|
||||
mhddLog.Close();
|
||||
ibgLog.Close(dev, blocks, blockSize, (end - start).TotalSeconds, currentSpeed * 1024,
|
||||
blockSize * (double)(blocks + 1) / 1024 / (totalDuration / 1000), devicePath);
|
||||
dumpLog.WriteLine("Dump finished in {0} seconds.", (end - start).TotalSeconds);
|
||||
blockSize * (double)(blocks + 1) /
|
||||
1024 / (totalDuration / 1000), devicePath);
|
||||
dumpLog.WriteLine("Dump finished in {0} seconds.",
|
||||
(end - start).TotalSeconds);
|
||||
dumpLog.WriteLine("Average dump speed {0:F3} KiB/sec.",
|
||||
(double)blockSize * (double)(blocks + 1) / 1024 / (totalDuration / 1000));
|
||||
dumpLog.WriteLine("Average checksum speed {0:F3} KiB/sec.",
|
||||
@@ -656,8 +662,10 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
sidecar.BlockMedia[0].LogicalBlocks = (long)blocks;
|
||||
sidecar.BlockMedia[0].Size = (long)currentSize;
|
||||
sidecar.BlockMedia[0].DumpHardwareArray = new DumpHardwareType[1];
|
||||
sidecar.BlockMedia[0].DumpHardwareArray[0] = new DumpHardwareType {Extents = new ExtentType[1]};
|
||||
sidecar.BlockMedia[0].DumpHardwareArray[0].Extents[0] = new ExtentType {Start = 0, End = blocks - 1};
|
||||
sidecar.BlockMedia[0].DumpHardwareArray[0] =
|
||||
new DumpHardwareType {Extents = new ExtentType[1]};
|
||||
sidecar.BlockMedia[0].DumpHardwareArray[0].Extents[0] =
|
||||
new ExtentType {Start = 0, End = blocks - 1};
|
||||
sidecar.BlockMedia[0].DumpHardwareArray[0].Manufacturer = dev.Manufacturer;
|
||||
sidecar.BlockMedia[0].DumpHardwareArray[0].Model = dev.Model;
|
||||
sidecar.BlockMedia[0].DumpHardwareArray[0].Revision = dev.Revision;
|
||||
|
||||
@@ -70,7 +70,6 @@
|
||||
<Compile Include="Devices\Reader.cs" />
|
||||
<Compile Include="Devices\ReaderATA.cs" />
|
||||
<Compile Include="Devices\ReaderSCSI.cs" />
|
||||
<Compile Include="Version.cs" />
|
||||
<Compile Include="Devices\Dumping\SSC.cs" />
|
||||
<Compile Include="Devices\Dumping\MMC.cs" />
|
||||
<Compile Include="Devices\Dumping\CompactDisc.cs" />
|
||||
|
||||
@@ -36,6 +36,7 @@ using System.Reflection;
|
||||
using DiscImageChef.Devices;
|
||||
using DiscImageChef.Interop;
|
||||
using PlatformID = DiscImageChef.Interop.PlatformID;
|
||||
using Version = DiscImageChef.Interop.Version;
|
||||
|
||||
namespace DiscImageChef.Core.Logging
|
||||
{
|
||||
@@ -75,6 +76,7 @@ namespace DiscImageChef.Core.Logging
|
||||
logSw.WriteLine("Mono {0}", monoVer);
|
||||
}
|
||||
else logSw.WriteLine(".NET Framework {0}", Environment.Version);
|
||||
|
||||
logSw.WriteLine();
|
||||
|
||||
logSw.WriteLine("################# Program information ################");
|
||||
@@ -104,6 +106,7 @@ namespace DiscImageChef.Core.Logging
|
||||
logSw.WriteLine("USB vendor ID: {0:X4}h", dev.UsbVendorId);
|
||||
logSw.WriteLine("USB product ID: {0:X4}h", dev.UsbProductId);
|
||||
}
|
||||
|
||||
logSw.WriteLine("FireWire device: {0}", dev.IsFireWire);
|
||||
if(dev.IsFireWire)
|
||||
{
|
||||
@@ -113,6 +116,7 @@ namespace DiscImageChef.Core.Logging
|
||||
logSw.WriteLine("FireWire vendor ID: 0x{0:X8}", dev.FireWireVendor);
|
||||
logSw.WriteLine("FireWire product ID: 0x{0:X8}", dev.FireWireModel);
|
||||
}
|
||||
|
||||
logSw.WriteLine();
|
||||
logSw.WriteLine("######################################################");
|
||||
|
||||
|
||||
@@ -41,6 +41,7 @@ using DiscImageChef.Devices;
|
||||
using DiscImageChef.Interop;
|
||||
using DiscImageChef.Metadata;
|
||||
using MediaType = DiscImageChef.CommonTypes.MediaType;
|
||||
using Version = DiscImageChef.Interop.Version;
|
||||
|
||||
namespace DiscImageChef.Core
|
||||
{
|
||||
@@ -126,8 +127,9 @@ namespace DiscImageChef.Core
|
||||
long count = 0;
|
||||
|
||||
OsStats old = null;
|
||||
foreach(OsStats nvs in
|
||||
AllStats.OperatingSystems.Where(nvs => nvs.name == DetectOS.GetRealPlatformID().ToString() &&
|
||||
foreach(OsStats nvs in AllStats.OperatingSystems.Where(nvs =>
|
||||
nvs.name == DetectOS
|
||||
.GetRealPlatformID().ToString() &&
|
||||
nvs.version == DetectOS.GetVersion()))
|
||||
{
|
||||
count = nvs.Value + 1;
|
||||
@@ -145,7 +147,8 @@ namespace DiscImageChef.Core
|
||||
version = DetectOS.GetVersion()
|
||||
});
|
||||
}
|
||||
else if(CurrentStats != null) AllStats.OperatingSystems = CurrentStats.OperatingSystems;
|
||||
else if(CurrentStats != null)
|
||||
AllStats.OperatingSystems = CurrentStats.OperatingSystems;
|
||||
|
||||
if(AllStats.Versions != null)
|
||||
{
|
||||
@@ -164,7 +167,8 @@ namespace DiscImageChef.Core
|
||||
count++;
|
||||
AllStats.Versions.Add(new NameValueStats {name = Version.GetVersion(), Value = count});
|
||||
}
|
||||
else if(CurrentStats != null) AllStats.Versions = CurrentStats.Versions;
|
||||
else if(CurrentStats != null)
|
||||
AllStats.Versions = CurrentStats.Versions;
|
||||
|
||||
FileStream fs = new FileStream(Path.Combine(Settings.Settings.StatsPath, "Statistics.xml"),
|
||||
FileMode.Create);
|
||||
@@ -219,7 +223,8 @@ namespace DiscImageChef.Core
|
||||
xs.Deserialize(fs); // Just to test validity of stats file
|
||||
fs.Seek(0, SeekOrigin.Begin);
|
||||
|
||||
WebRequest request = WebRequest.Create("http://discimagechef.claunia.com/api/uploadstats");
|
||||
WebRequest request =
|
||||
WebRequest.Create("http://discimagechef.claunia.com/api/uploadstats");
|
||||
((HttpWebRequest)request).UserAgent =
|
||||
$"DiscImageChef {typeof(Version).Assembly.GetName().Version}";
|
||||
request.Method = "POST";
|
||||
@@ -383,6 +388,7 @@ namespace DiscImageChef.Core
|
||||
nw.name = filesystem;
|
||||
nw.Value = 1;
|
||||
}
|
||||
|
||||
AllStats.Filesystems.Add(nw);
|
||||
|
||||
old = CurrentStats.Filesystems.FirstOrDefault(nvs => nvs.name == filesystem);
|
||||
@@ -399,6 +405,7 @@ namespace DiscImageChef.Core
|
||||
nw.name = filesystem;
|
||||
nw.Value = 1;
|
||||
}
|
||||
|
||||
CurrentStats.Filesystems.Add(nw);
|
||||
}
|
||||
|
||||
@@ -427,6 +434,7 @@ namespace DiscImageChef.Core
|
||||
nw.name = partition;
|
||||
nw.Value = 1;
|
||||
}
|
||||
|
||||
AllStats.Partitions.Add(nw);
|
||||
|
||||
old = CurrentStats.Partitions.FirstOrDefault(nvs => nvs.name == partition);
|
||||
@@ -443,6 +451,7 @@ namespace DiscImageChef.Core
|
||||
nw.name = partition;
|
||||
nw.Value = 1;
|
||||
}
|
||||
|
||||
CurrentStats.Partitions.Add(nw);
|
||||
}
|
||||
|
||||
@@ -471,6 +480,7 @@ namespace DiscImageChef.Core
|
||||
nw.name = format;
|
||||
nw.Value = 1;
|
||||
}
|
||||
|
||||
AllStats.Filters.Add(nw);
|
||||
|
||||
old = CurrentStats.Filters.FirstOrDefault(nvs => nvs.name == format);
|
||||
@@ -487,6 +497,7 @@ namespace DiscImageChef.Core
|
||||
nw.name = format;
|
||||
nw.Value = 1;
|
||||
}
|
||||
|
||||
CurrentStats.Filters.Add(nw);
|
||||
}
|
||||
|
||||
@@ -515,6 +526,7 @@ namespace DiscImageChef.Core
|
||||
nw.name = format;
|
||||
nw.Value = 1;
|
||||
}
|
||||
|
||||
AllStats.MediaImages.Add(nw);
|
||||
|
||||
old = CurrentStats.MediaImages.FirstOrDefault(nvs => nvs.name == format);
|
||||
@@ -531,6 +543,7 @@ namespace DiscImageChef.Core
|
||||
nw.name = format;
|
||||
nw.Value = 1;
|
||||
}
|
||||
|
||||
CurrentStats.MediaImages.Add(nw);
|
||||
}
|
||||
|
||||
@@ -547,12 +560,15 @@ namespace DiscImageChef.Core
|
||||
|
||||
string deviceBus;
|
||||
if(dev.IsUsb) deviceBus = "USB";
|
||||
else if(dev.IsFireWire) deviceBus = "FireWire";
|
||||
else deviceBus = dev.Type.ToString();
|
||||
else if(dev.IsFireWire)
|
||||
deviceBus = "FireWire";
|
||||
else
|
||||
deviceBus = dev.Type.ToString();
|
||||
|
||||
DeviceStats old = AllStats.Devices.FirstOrDefault(ds => ds.Manufacturer == dev.Manufacturer &&
|
||||
ds.Model == dev.Model &&
|
||||
ds.Revision == dev.Revision && ds.Bus == deviceBus);
|
||||
ds.Revision == dev.Revision &&
|
||||
ds.Bus == deviceBus);
|
||||
|
||||
if(old != null) AllStats.Devices.Remove(old);
|
||||
|
||||
@@ -567,7 +583,8 @@ namespace DiscImageChef.Core
|
||||
AllStats.Devices.Add(nw);
|
||||
|
||||
old = CurrentStats.Devices.FirstOrDefault(ds => ds.Manufacturer == dev.Manufacturer &&
|
||||
ds.Model == dev.Model && ds.Revision == dev.Revision &&
|
||||
ds.Model == dev.Model &&
|
||||
ds.Revision == dev.Revision &&
|
||||
ds.Bus == deviceBus);
|
||||
|
||||
if(old != null) CurrentStats.Devices.Remove(old);
|
||||
@@ -611,6 +628,7 @@ namespace DiscImageChef.Core
|
||||
nw.real = real;
|
||||
nw.Value = 1;
|
||||
}
|
||||
|
||||
AllStats.Medias.Add(nw);
|
||||
|
||||
old = CurrentStats.Medias.FirstOrDefault(ms => ms.real == real && ms.type == type.ToString());
|
||||
@@ -629,6 +647,7 @@ namespace DiscImageChef.Core
|
||||
nw.real = real;
|
||||
nw.Value = 1;
|
||||
}
|
||||
|
||||
CurrentStats.Medias.Add(nw);
|
||||
}
|
||||
|
||||
@@ -727,7 +746,8 @@ namespace DiscImageChef.Core
|
||||
/// <param name="error">Errored sectors</param>
|
||||
/// <param name="correct">Correct sectors</param>
|
||||
public static void AddMediaScan(long lessThan3ms, long lessThan10ms, long lessThan50ms, long lessThan150ms,
|
||||
long lessThan500ms, long moreThan500ms, long total, long error, long correct)
|
||||
long lessThan500ms, long moreThan500ms, long total, long error,
|
||||
long correct)
|
||||
{
|
||||
if(Settings.Settings.Current.Stats == null || !Settings.Settings.Current.Stats.MediaScanStats) return;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
@@ -37,12 +37,19 @@
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="DetectOS.cs" />
|
||||
<Compile Include="PlatformID.cs" />
|
||||
<Compile Include="Version.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="..\LICENSE.MIT">
|
||||
<Link>LICENSE.MIT</Link>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\DiscImageChef.Metadata\DiscImageChef.Metadata.csproj">
|
||||
<Project>{9F213318-5CB8-4066-A757-074489C9F818}</Project>
|
||||
<Name>DiscImageChef.Metadata</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<ProjectExtensions>
|
||||
<MonoDevelop>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
// Filename : Version.cs
|
||||
// Author(s) : Natalia Portillo <claunia@claunia.com>
|
||||
//
|
||||
// Component : Core algorithms.
|
||||
// Component : Interop services.
|
||||
//
|
||||
// --[ Description ] ----------------------------------------------------------
|
||||
//
|
||||
@@ -13,18 +13,24 @@
|
||||
//
|
||||
// --[ License ] --------------------------------------------------------------
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General internal License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to
|
||||
// permit persons to whom the Software is furnished to do so, subject to
|
||||
// the following conditions:
|
||||
//
|
||||
// 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 internal License for more details.
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
//
|
||||
// You should have received a copy of the GNU General internal License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
// ----------------------------------------------------------------------------
|
||||
// Copyright © 2011-2018 Natalia Portillo
|
||||
@@ -33,16 +39,16 @@
|
||||
using DiscImageChef.Interop;
|
||||
using Schemas;
|
||||
|
||||
namespace DiscImageChef.Core
|
||||
namespace DiscImageChef.Interop
|
||||
{
|
||||
static class Version
|
||||
public static class Version
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets XML software type for the running version
|
||||
/// </summary>
|
||||
/// <param name="platform">Platform we are running in</param>
|
||||
/// <returns>XML software type</returns>
|
||||
internal static SoftwareType GetSoftwareType(PlatformID platform)
|
||||
public static SoftwareType GetSoftwareType(PlatformID platform)
|
||||
{
|
||||
// TODO: Platform should be get automatically
|
||||
return new SoftwareType
|
||||
@@ -57,7 +63,7 @@ namespace DiscImageChef.Core
|
||||
/// Gets version string
|
||||
/// </summary>
|
||||
/// <returns>Version</returns>
|
||||
internal static string GetVersion()
|
||||
public static string GetVersion()
|
||||
{
|
||||
return typeof(Version).Assembly.GetName().Version.ToString();
|
||||
}
|
||||
Reference in New Issue
Block a user