Skip to content

Commit

Permalink
v0.9.25022 release
Browse files Browse the repository at this point in the history
Fixed #240
• Create log file if it doesn't exist on startup
• FileDrop format is no longer accepted to exclude all target detect transfers which we don't support
• Shell ID List is no longer automatically considered virtual
  • Loading branch information
Alex4SSB committed Feb 15, 2025
1 parent fc7d749 commit 7d56792
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 23 deletions.
1 change: 1 addition & 0 deletions ADB Explorer/ADB Explorer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
<PackageReference Include="QRCoder.Xaml" Version="1.6.0" />
<PackageReference Include="System.Management" Version="9.0.0" />
<PackageReference Include="System.Security.Cryptography.Algorithms" Version="4.3.1" />
<PackageReference Include="Vanara.Windows.Shell" Version="4.0.4" />
<PackageReference Include="Vanara.Windows.Shell.Common" Version="4.0.4" />
</ItemGroup>

Expand Down
5 changes: 5 additions & 0 deletions ADB Explorer/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ private void Application_Startup(object sender, StartupEventArgs e)
using StreamReader reader = new(stream);
ReadSettingsFile(reader);
}

if (!File.Exists(ADB_Explorer.Properties.Resources.DragDropLogPath))
{
File.WriteAllText(ADB_Explorer.Properties.Resources.DragDropLogPath, "");
}
}
catch
{
Expand Down
9 changes: 7 additions & 2 deletions ADB Explorer/Models/File/FileClass.cs
Original file line number Diff line number Diff line change
Expand Up @@ -383,8 +383,13 @@ public FileSyncOperation PrepareDescriptors(VirtualFileDataObject vfdo, bool inc
{
using (FileStream fs = new(file, FileMode.Open, FileAccess.Read))
{
// This uses a 85K buffer, which is a pain for large files, but it gets cleared automatically
fs.CopyTo(stream);
// This uses a ~85K buffer, which is a pain for large files, but it gets cleared automatically
byte[] buffer = new byte[81920];
int read = 0;
while ((read = fs.Read(buffer, 0, buffer.Length)) > 0)
{
stream.Write(buffer, 0, read);
}
}
break;
}
Expand Down
4 changes: 2 additions & 2 deletions ADB Explorer/Properties/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions ADB Explorer/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@
<value>ADB Explorer</value>
</data>
<data name="AppVersion" xml:space="preserve">
<value>0.9.25021</value>
<value>0.9.25022</value>
</data>
<data name="ProgressRedirectionHash_ARM" xml:space="preserve">
<value>CB3D9C2E879572CEEA9601531FD532C6</value>
Expand All @@ -134,7 +134,7 @@
<value>A80EA21FAB8CD745642BCAEEB6A91EB2</value>
</data>
<data name="DragDropLogPath" xml:space="preserve">
<value />
<value>E:\Log\log.txt</value>
</data>
<data name="AdbProgressRedirection_ARM" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\AdbProgressRedirection_ARM;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
Expand Down
26 changes: 9 additions & 17 deletions ADB Explorer/Services/AppInfra/CopyPasteService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ public void UpdateUI()

List<FileClass> cutItems = [];
if (PasteSource is not DataSource.None && PasteSource.HasFlag(DataSource.Self))
cutItems = Data.DirList.FileList.Where(f => Files.Contains(f.FullPath)).ToList();
cutItems = [.. Data.DirList.FileList.Where(f => Files.Contains(f.FullPath))];

cutItems.ForEach(file => file.CutState = PasteState);
Data.DirList?.FileList.Except(cutItems).ForEach(file => file.CutState = DragDropEffects.None);
Expand Down Expand Up @@ -350,17 +350,8 @@ public void PreviewDataObject(IDataObject dataObject)
DragParent = "";
string[] oldFiles = [.. DragFiles];

// File Drop - the best format since it gives the actual paths
if (dataObject.GetDataPresent(AdbDataFormats.FileDrop) && dataObject.GetData(AdbDataFormats.FileDrop) is string[] dropFiles)
{
// Drag from 7-Zip File Manager is not supported
if (dropFiles.Length == 1 && dropFiles[0].StartsWith(UserTemp + "7z"))
DragFiles = [];
else
DragFiles = dropFiles;
}
// ADB Drop - for all Android to Android transfers (including self)
else if (dataObject.GetDataPresent(AdbDataFormats.AdbDrop) && dataObject.GetData(AdbDataFormats.AdbDrop) is MemoryStream adbStream)
if (dataObject.GetDataPresent(AdbDataFormats.AdbDrop) && dataObject.GetData(AdbDataFormats.AdbDrop) is MemoryStream adbStream)
{
var dragList = NativeMethods.ADBDRAGLIST.FromStream(adbStream);
var deviceId = dragList.deviceId;
Expand All @@ -376,7 +367,7 @@ public void PreviewDataObject(IDataObject dataObject)

MasterPid = dragList.pid;
DragParent = dragList.parentFolder;
DragFiles = dragList.items.Select(f => FileHelper.ConcatPaths(DragParent, f)).ToArray();
DragFiles = [.. dragList.items.Select(f => FileHelper.ConcatPaths(DragParent, f))];

CurrentSource |= DataSource.Android;
if (deviceId == Data.CurrentADBDevice.ID)
Expand All @@ -399,11 +390,12 @@ public void PreviewDataObject(IDataObject dataObject)
var shItems = ShellItemArray.FromDataObject((System.Runtime.InteropServices.ComTypes.IDataObject)dataObject);
if (shItems is not null)
{
Descriptors = shItems.Select(sh => new FileDescriptor(sh)).ToArray();
DragFiles = shItems.Select(sh => sh.ParsingName).ToArray();
Descriptors = [.. shItems.Select(sh => new FileDescriptor(sh))];
DragFiles = [.. shItems.Select(sh => sh.ParsingName)];

CurrentSource |= DataSource.Virtual;
CurrentSource &= ~DataSource.Android;
if (!shItems[0].IsFileSystem)
CurrentSource |= DataSource.Virtual;
}
}
// VFDO (FileGroupDescriptor + FileContents) - the only viable format for virtual files not mapped to a drive.
Expand All @@ -412,13 +404,13 @@ public void PreviewDataObject(IDataObject dataObject)
{
GetDescriptors(dataObject);

DragFiles = Descriptors.Where(d => !d.Name.Contains('\\'))
.Select(d => d.Name).ToArray();
DragFiles = [.. Descriptors.Where(d => !d.Name.Contains('\\')).Select(d => d.Name)];

CurrentSource |= DataSource.Virtual;
if (dataObject.GetDataPresent(AdbDataFormats.FileContents))
CurrentSource &= ~DataSource.Android;
}
// If the data object only has FileDrop, then it's probably dropping by target detect, which we can't support (7-Zip, WinRAR, etc.)
else
{
DragFiles = [];
Expand Down

0 comments on commit 7d56792

Please sign in to comment.