Skip to content

Commit

Permalink
added more try-catch
Browse files Browse the repository at this point in the history
  • Loading branch information
ttwj committed Feb 4, 2014
1 parent 1a1d939 commit c6e0852
Show file tree
Hide file tree
Showing 3 changed files with 173 additions and 177 deletions.
98 changes: 54 additions & 44 deletions AppHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,39 +44,47 @@ public static void getIPAs(String location)
}
foreach (FileInfo file in files)
{
Debug("IPA found: " + file.Name);
using (ZipFile ipa = ZipFile.Read(file.FullName))
{
foreach (ZipEntry e in ipa)
{
//Debug ("ZipEntry: " + e.FileName);
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;
Debug("yo yo yo");
Dictionary<string, object> plist = (Dictionary<string, object>)Plist.readPlist(plistLocation);
Debug("plist data: " + plist.ToString());
Debug("Bundle Name: " + plist["CFBundleExecutable"]);
IPAInfo info = new IPAInfo();
info.AppBundle = (string)plist["CFBundleExecutable"];
if (plist.ContainsKey("CFBundleDisplayName"))
{
info.AppName = (string)plist["CFBundleDisplayName"];
}
else
{
info.AppName = (string)plist["CFBundleName"];
}
info.AppVersion = (string)plist["CFBundleVersion"];
info.Location = file.FullName;
info.BinaryLocation = e.FileName.Replace("Info.plist", "") + info.AppBundle;
container.IPAItems.Add(info);
}
}
}
try {
Debug("IPA found: " + file.Name);
using (ZipFile ipa = ZipFile.Read(file.FullName))
{
foreach (ZipEntry e in ipa)
{

Debug("ZipEntry: " + e.FileName);
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;
Debug("yo yo yo");
Dictionary<string, object> plist = (Dictionary<string, object>)Plist.readPlist(plistLocation);
Debug("plist data: " + plist.ToString());
Debug("Bundle Name: " + plist["CFBundleExecutable"]);
IPAInfo info = new IPAInfo();
info.AppBundle = (string)plist["CFBundleExecutable"];
if (plist.ContainsKey("CFBundleDisplayName"))
{
info.AppName = (string)plist["CFBundleDisplayName"];
}
else
{
info.AppName = (string)plist["CFBundleName"];
}
info.AppVersion = (string)plist["CFBundleVersion"];
info.Location = file.FullName;
info.BinaryLocation = e.FileName.Replace("Info.plist", "") + info.AppBundle;
container.IPAItems.Add(info);
}
}
}
}
catch (Exception ex) {
Debug ("Error: could not analyze " + file.Name);
Debug ("Error: " + ex.ToString());
}


}
/*using (StreamWriter writer = new StreamWriter("Brake.xml")) {
Expand All @@ -97,17 +105,19 @@ public static String extractIPA(IPAInfo info)
foreach (ZipEntry e in ipa)
{
//Debug ("file:" + e.FileName);
if (e.FileName.Contains(".sinf") || e.FileName.Contains(".supp"))
{
//extract it
Debug(GetTemporaryDirectory());
e.Extract(GetTemporaryDirectory(), ExtractExistingFileAction.OverwriteSilently);
}
else if (e.FileName == info.BinaryLocation)
{
Debug("found binary!!");
e.Extract(GetTemporaryDirectory(), ExtractExistingFileAction.OverwriteSilently);
}
if (e.FileName.Contains (".sinf") || e.FileName.Contains (".supp")) {
//extract it
Debug (GetTemporaryDirectory ());
e.Extract (GetTemporaryDirectory (), ExtractExistingFileAction.OverwriteSilently);
} else if (e.FileName == info.BinaryLocation) {
Debug ("found binary!!");
e.Extract (GetTemporaryDirectory (), ExtractExistingFileAction.OverwriteSilently);
} else if (e.FileName == "iTunesMetadata") {
e.Extract (GetWorkingDirectory (), ExtractExistingFileAction.OverwriteSilently);
string plistLocation = Path.Combine(GetTemporaryDirectory(), e.FileName);
info.iTunesMetadata = (Dictionary<string, object>)Plist.readPlist (plistLocation);

}
}
}
//zip!
Expand Down
251 changes: 118 additions & 133 deletions Brake.csproj
Original file line number Diff line number Diff line change
@@ -1,133 +1,118 @@
<<<<<<< HEAD
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
=======
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
>>>>>>> 721a50c90965fa438028b97a6f018a6ad0fb796a
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{110D2FAE-0BC0-495C-86FC-B7EF426F6C60}</ProjectGuid>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Brake</RootNamespace>
<AssemblyName>Brake</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
<ProductVersion>12.0.0</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<<<<<<< HEAD
=======
<Reference Include="Ionic.Zip">
<HintPath>lib\Ionic.Zip.dll</HintPath>
</Reference>
<Reference Include="Renci.SshNet">
<HintPath>lib\Renci.SshNet.dll</HintPath>
</Reference>
>>>>>>> 721a50c90965fa438028b97a6f018a6ad0fb796a
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="Ionic.Zip">
<HintPath>lib\Ionic.Zip.dll</HintPath>
</Reference>
<Reference Include="Renci.SshNet">
<HintPath>lib\Renci.SshNet.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="AppHelper.cs" />
<Compile Include="AppList.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="AppList.Designer.cs">
<DependentUpon>AppList.cs</DependentUpon>
</Compile>
<Compile Include="Config.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Config.Designer.cs">
<DependentUpon>Config.cs</DependentUpon>
</Compile>
<Compile Include="CrackProcess.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="CrackProcess.Designer.cs">
<DependentUpon>CrackProcess.cs</DependentUpon>
</Compile>
<Compile Include="ListViewMultiSelect.cs" />
<Compile Include="Plist.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="XML.cs" />
<EmbeddedResource Include="AppList.resx">
<DependentUpon>AppList.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Config.resx">
<DependentUpon>Config.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="CrackProcess.resx">
<DependentUpon>CrackProcess.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
<DesignTime>True</DesignTime>
</Compile>
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.setdepentings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<ItemGroup>
<None Include="App.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.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{110D2FAE-0BC0-495C-86FC-B7EF426F6C60}</ProjectGuid>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Brake</RootNamespace>
<AssemblyName>Brake</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Ionic.Zip">
<HintPath>Z:\Projects\Brake GUI\WindowsFormsApplication1\WindowsFormsApplication1\lib\Ionic.Zip.dll</HintPath>
</Reference>
<Reference Include="Renci.SshNet">
<HintPath>Z:\Projects\Brake GUI\WindowsFormsApplication1\WindowsFormsApplication1\lib\Renci.SshNet.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="AppHelper.cs" />
<Compile Include="AppList.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="AppList.Designer.cs">
<DependentUpon>AppList.cs</DependentUpon>
</Compile>
<Compile Include="Config.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Config.Designer.cs">
<DependentUpon>Config.cs</DependentUpon>
</Compile>
<Compile Include="CrackProcess.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="CrackProcess.Designer.cs">
<DependentUpon>CrackProcess.cs</DependentUpon>
</Compile>
<Compile Include="ListViewMultiSelect.cs" />
<Compile Include="Plist.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="XML.cs" />
<EmbeddedResource Include="AppList.resx">
<DependentUpon>AppList.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Config.resx">
<DependentUpon>Config.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="CrackProcess.resx">
<DependentUpon>CrackProcess.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
<DesignTime>True</DesignTime>
</Compile>
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<ItemGroup>
<None Include="App.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.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
1 change: 1 addition & 0 deletions XML.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ public class IPAInfo
public string BinaryLocation;
public string IPALocation;
public string IPALocationOnDevice;
public Dictionary<string, object> iTunesMetadata;

}
public class Configuration
Expand Down

0 comments on commit c6e0852

Please sign in to comment.