Add project files.
This commit is contained in:
parent
4fae997a05
commit
4a06940a08
4 changed files with 140 additions and 0 deletions
25
IPASorter.sln
Normal file
25
IPASorter.sln
Normal file
|
@ -0,0 +1,25 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.31624.102
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IPASorter", "IPASorter\IPASorter.csproj", "{A79DAC1B-2AFF-45B6-B63F-92B90D3EFC74}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{A79DAC1B-2AFF-45B6-B63F-92B90D3EFC74}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{A79DAC1B-2AFF-45B6-B63F-92B90D3EFC74}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{A79DAC1B-2AFF-45B6-B63F-92B90D3EFC74}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{A79DAC1B-2AFF-45B6-B63F-92B90D3EFC74}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {EB55AD64-EE03-4C37-B92A-90698C71A4A2}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
13
IPASorter/FileClass.cs
Normal file
13
IPASorter/FileClass.cs
Normal file
|
@ -0,0 +1,13 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace IPASorter
|
||||
{
|
||||
public class IPAFile
|
||||
{
|
||||
public string path { get; set; }
|
||||
public string md5sum { get; set; }
|
||||
public string fileName { get; set; }
|
||||
}
|
||||
}
|
8
IPASorter/IPASorter.csproj
Normal file
8
IPASorter/IPASorter.csproj
Normal file
|
@ -0,0 +1,8 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
94
IPASorter/Program.cs
Normal file
94
IPASorter/Program.cs
Normal file
|
@ -0,0 +1,94 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace IPASorter
|
||||
{
|
||||
class Program
|
||||
{
|
||||
// renaming format: "com.bundle.id-1.0-(iOS4.3).ipa"
|
||||
|
||||
public static List<IPAFile> files = new List<IPAFile>();
|
||||
static void Main(string[] args)
|
||||
{
|
||||
Console.WriteLine("IPASorter by KawaiiZenbo");
|
||||
// parse filepath if given
|
||||
string argsFilePath = args.Length != 0 ? args[0] : "./";
|
||||
if (!argsFilePath.EndsWith("/") || !argsFilePath.EndsWith("\\")) argsFilePath += "/";
|
||||
|
||||
// create temp dir
|
||||
if (Directory.Exists("%appdata%/IPASorterTemp/")) Directory.CreateDirectory("%appdata%/IPASorterTemp/");
|
||||
|
||||
// run steps
|
||||
FileScanner(argsFilePath);
|
||||
MD5Eliminator();
|
||||
|
||||
//done
|
||||
if (Directory.Exists("%appdata%/IPASorterTemp/")) Directory.Delete("%appdata%/IPASorterTemp/");
|
||||
Console.WriteLine("complete :)");
|
||||
}
|
||||
|
||||
// step 1
|
||||
static void FileScanner(string path)
|
||||
{
|
||||
List<string> tmp = Directory.GetFiles(path, "*.ipa", SearchOption.AllDirectories).ToList();
|
||||
foreach (string s in tmp)
|
||||
{
|
||||
files.Add(new IPAFile
|
||||
{
|
||||
fileName = s.Split('/')[s.Split('/').Length -1].Split('\\')[s.Split('/')[s.Split('/').Length - 1].Split('\\').Length - 1],
|
||||
path = s,
|
||||
md5sum = CalculateMD5(s)
|
||||
}) ;
|
||||
}
|
||||
}
|
||||
|
||||
// step 2
|
||||
static void MD5Eliminator()
|
||||
{
|
||||
foreach (IPAFile i in files)
|
||||
{
|
||||
Console.WriteLine($"checking against {i.path} ({i.md5sum})");
|
||||
}
|
||||
}
|
||||
|
||||
// step 3
|
||||
static void InfoPlistEliminator()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// step 4
|
||||
static void InfoPlistRenamer()
|
||||
{
|
||||
foreach (IPAFile i in files)
|
||||
{
|
||||
File.Move(i.path, i.path.Replace(i.fileName, ""));
|
||||
}
|
||||
}
|
||||
|
||||
// step 5???
|
||||
static void Sort()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// misc functions
|
||||
static string CalculateMD5(string fileName)
|
||||
{
|
||||
using (var md5 = MD5.Create())
|
||||
{
|
||||
using (var stream = File.OpenRead(fileName))
|
||||
{
|
||||
var hash = md5.ComputeHash(stream);
|
||||
return BitConverter.ToString(hash).Replace("-", "").ToLowerInvariant();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Add table
Reference in a new issue