Skip to content

Commit

Permalink
stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
ttwj committed Oct 13, 2013
1 parent 3495e36 commit a0d8c0f
Show file tree
Hide file tree
Showing 7 changed files with 77 additions and 7 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "PlistCS"]
path = PlistCS
url = https://github.com/animetrics/PlistCS.git
43 changes: 42 additions & 1 deletion Brake/AppHelper.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
using System;
using System.IO;
using Ionic.Zip;
using PlistCS;
using System.Collections.Generic;
using System.Xml.Serialization;

namespace Brake
{
Expand All @@ -17,7 +20,10 @@ public static void Debug(String debugString) {
}
public bool setupDirectory(String location) {
DirectoryInfo di = new DirectoryInfo(location);
Container container = new Container ();
FileInfo[] files;
//byte[] data;

if (!di.Exists) {
Console.WriteLine ("Error: Directory not found?");
return false;
Expand All @@ -37,14 +43,49 @@ public bool setupDirectory(String location) {
using (ZipFile ipa = ZipFile.Read(file.FullName)) {
foreach (ZipEntry e in ipa) {
Debug ("ZipEntry: " + e.FileName);
if (e.FileName.Contains (".sinf")) {
if (e.FileName.Contains (".sinf") || e.FileName.Contains (".supp")) {
//extract it
Debug (GetTemporaryDirectory());
e.Extract (GetTemporaryDirectory(), ExtractExistingFileAction.OverwriteSilently);

} else if (e.FileName.Contains (".app/Info.plist")) {
Debug ("INFO.PLIST FOUND!!!!! " + GetTemporaryDirectory());
e.Extract (GetTemporaryDirectory(), ExtractExistingFileAction.OverwriteSilently);
string plistLocation = Path.Combine (GetTemporaryDirectory(), e.FileName);
//unpackDirectory + "/" + e.FileName;

Dictionary<string, object> plist = (Dictionary<string,object>)Plist.readPlist (unpackDirectory + "/" + e.FileName);
Debug ("plist data: " + plist.ToString ());
Debug ("Bundle Name: " + plist ["CFBundleExecutable"]);
IPAInfo info = new IPAInfo ();
info.AppBundle = (string) plist ["CFBundleExecutable"];
info.AppName = (string) plist ["CFBundleDisplayName"];
info.AppVersion = (string) plist ["CFBundleVersion"];
info.Location = file.FullName;
container.Items.Add (info);
}
}
}

}
using (StreamWriter writer = new StreamWriter("ipas.xml")) {
XmlSerializer serializer = new XmlSerializer (typeof(Container));
serializer.Serialize (writer, container);
Debug ("serializing data");
}
Directory.Delete (GetTemporaryDirectory());
return true;
}

private string tempDir;
public string GetTemporaryDirectory()
{
if (tempDir == null) {
tempDir = Path.Combine (Path.GetTempPath (), Path.GetRandomFileName ());
Directory.CreateDirectory (tempDir);
}
return tempDir;
}
}
}

9 changes: 7 additions & 2 deletions Brake/Brake.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,22 @@
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Xml" />
<Reference Include="Ionic.Zip">
<HintPath>..\packages\DotNetZip.1.9.1.8\lib\net20\Ionic.Zip.dll</HintPath>
<HintPath>..\lib\Ionic.Zip.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="AppHelper.cs" />
<Compile Include="..\PlistCS\PlistCS\Src\Plist.cs">
<Link>Src\Plist.cs</Link>
</Compile>
<Compile Include="IPAInfo.cs" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ItemGroup>
<None Include="packages.config" />
<Folder Include="Src\" />
</ItemGroup>
</Project>
24 changes: 24 additions & 0 deletions Brake/IPAInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;

namespace Brake
{
public class IPAInfo
{
public string AppName;
public string AppVersion;
public string AppBundle;
public string Location;

}
public class Container
{
public List<IPAInfo> Items;
public Container()
{
Items = new List<IPAInfo>();
}
}

}

4 changes: 0 additions & 4 deletions Brake/packages.config

This file was deleted.

1 change: 1 addition & 0 deletions PlistCS
Submodule PlistCS added at 8bfaad
Binary file added lib/Ionic.Zip.dll
Binary file not shown.

0 comments on commit a0d8c0f

Please sign in to comment.