本文整理汇总了C#中MonoDevelop.IPhone.IPhoneProjectConfiguration类的典型用法代码示例。如果您正苦于以下问题:C# IPhoneProjectConfiguration类的具体用法?C# IPhoneProjectConfiguration怎么用?C# IPhoneProjectConfiguration使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IPhoneProjectConfiguration类属于MonoDevelop.IPhone命名空间,在下文中一共展示了IPhoneProjectConfiguration类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: TouchUploadMarker
static void TouchUploadMarker (IPhoneProjectConfiguration conf, string deviceId)
{
var markerFile = conf.OutputDirectory.Combine (".monotouch_uploaded");
if (File.Exists (markerFile))
File.AppendAllText (markerFile, "\n" + deviceId);
else
File.WriteAllText (markerFile,
"# This file is used to determine when the app was last uploaded to a device\n" + deviceId);
}
开发者ID:nickname100,项目名称:monodevelop,代码行数:9,代码来源:IPhoneProject.cs
示例2: CreateMergedPlist
static BuildResult CreateMergedPlist (IProgressMonitor monitor, IPhoneProjectConfiguration conf,
ProjectFile template, string outPath,
Func<IPhoneProjectConfiguration, PlistDocument,BuildResult> merge)
{
var result = new BuildResult ();
var doc = new PlistDocument ();
if (template != null) {
try {
doc.LoadFromXmlFile (template.FilePath);
} catch (Exception ex) {
if (ex is XmlException)
result.AddError (template.FilePath, ((XmlException)ex).LineNumber,
((XmlException)ex).LinePosition, null, ex.Message);
else
result.AddError (template.FilePath, 0, 0, null, ex.Message);
monitor.ReportError (GettextCatalog.GetString ("Could not load file '{0}': {1}",
template.FilePath, ex.Message), null);
return result;
}
}
if (result.Append (merge (conf, doc)).ErrorCount > 0)
return result;
try {
EnsureDirectoryForFile (outPath);
using (XmlTextWriter writer = new XmlTextWriter (outPath, Encoding.UTF8)) {
writer.Formatting = Formatting.Indented;
doc.Write (writer);
}
} catch (Exception ex) {
result.AddError (outPath, 0, 0, null, ex.Message);
monitor.ReportError (GettextCatalog.GetString ("Could not write file '{0}'", outPath), ex);
}
return result;
}
开发者ID:transformersprimeabcxyz,项目名称:monodevelop-1,代码行数:37,代码来源:IPhoneBuildExtension.cs
示例3: GetSimulatorTarget
/// <summary>
/// User setting of device for running app in simulator. Null means use default.
/// </summary>
public IPhoneSimulatorTarget GetSimulatorTarget (IPhoneProjectConfiguration conf)
{
return UserProperties.GetValue<IPhoneSimulatorTarget> (GetSimulatorTargetKey (conf));
}
开发者ID:nickname100,项目名称:monodevelop,代码行数:7,代码来源:IPhoneProject.cs
示例4: GetSimulatorTargetKey
string GetSimulatorTargetKey (IPhoneProjectConfiguration conf)
{
return "IPhoneSimulatorTarget-" + conf.Id;
}
开发者ID:nickname100,项目名称:monodevelop,代码行数:4,代码来源:IPhoneProject.cs
示例5: CreateConfiguration
public override SolutionItemConfiguration CreateConfiguration (string name)
{
var conf = new IPhoneProjectConfiguration (name);
var dir = new FilePath ("bin");
if (!String.IsNullOrEmpty (conf.Platform))
dir.Combine (conf.Platform);
dir.Combine (conf.Name);
conf.OutputDirectory = BaseDirectory.IsNullOrEmpty? dir : BaseDirectory.Combine (dir);
conf.OutputAssembly = Name;
if (conf.Platform == PLAT_IPHONE) {
conf.CodesignKey = Keychain.DEV_CERT_PREFIX;
} else if (conf.Platform == PLAT_SIM) {
conf.MtouchLink = MtouchLinkMode.None;
}
if (LanguageBinding != null)
conf.CompilationParameters = LanguageBinding.CreateCompilationParameters (null);
return conf;
}
开发者ID:transformersprimeabcxyz,项目名称:monodevelop-1,代码行数:21,代码来源:IPhoneProject.cs
示例6: TouchUploadMarker
static void TouchUploadMarker (IPhoneProjectConfiguration conf)
{
var markerFile = conf.OutputDirectory.Combine (".monotouch_last_uploaded");
if (File.Exists (markerFile))
File.SetLastWriteTime (markerFile, DateTime.Now);
else
File.WriteAllText (markerFile, "This file is used to determine when the app was last uploaded to a device");
}
开发者ID:transformersprimeabcxyz,项目名称:monodevelop-1,代码行数:8,代码来源:IPhoneProject.cs
示例7: PrepareResourceRules
static BuildResult PrepareResourceRules (IProgressMonitor monitor, IPhoneSdkVersion sdkVersion, IPhoneProjectConfiguration conf, out string resRulesFile)
{
resRulesFile = conf.AppDirectory.Combine ("ResourceRules.plist");
monitor.BeginTask (GettextCatalog.GetString ("Preparing resources rules"), 0);
if (File.Exists (resRulesFile))
File.Delete (resRulesFile);
string resRulesSrc = String.IsNullOrEmpty (conf.CodesignResourceRules)
? "/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS"
+ sdkVersion.ToString () + ".sdk/ResourceRules.plist"
: (string) conf.CodesignResourceRules;
if (File.Exists (resRulesSrc)) {
File.Copy (resRulesSrc, resRulesFile, true);
} else {
return BuildError ("Resources rules file \"" + conf.CodesignResourceRules + "\" not found.");
}
monitor.EndTask ();
return null;
}
开发者ID:slluis,项目名称:monodevelop,代码行数:22,代码来源:IPhoneBuildExtension.cs
示例8: GetIdentity
static BuildResult GetIdentity (IProgressMonitor monitor, IPhoneProject proj, IPhoneProjectConfiguration conf,
out IPhoneAppIdentity identity)
{
var result = new BuildResult ();
identity = new IPhoneAppIdentity ();
bool defaultID = string.IsNullOrEmpty (proj.BundleIdentifier);
if (!defaultID)
identity.BundleID = proj.BundleIdentifier;
//treat empty as "developer automatic"
if (string.IsNullOrEmpty (conf.CodesignKey)) {
conf.CodesignKey = IPhoneProject.DEV_CERT_PREFIX;
}
IList<X509Certificate2> certs = null;
if (conf.CodesignKey == IPhoneProject.DEV_CERT_PREFIX || conf.CodesignKey == IPhoneProject.DIST_CERT_PREFIX) {
certs = Keychain.FindNamedSigningCertificates (x => x.StartsWith (conf.CodesignKey)).ToList ();
if (certs.Count == 0) {
result.AddError ("No valid iPhone code signing keys found in keychain.");
return result;
}
} else {
identity.SigningKey = Keychain.FindNamedSigningCertificates (x => x == conf.CodesignKey).FirstOrDefault ();
if (identity.SigningKey == null) {
result.AddError (string.Format ("iPhone code signing key '{0}' not found in keychain.", conf.CodesignKey));
return result;
}
certs = new X509Certificate2[] { identity.SigningKey };
}
if (!string.IsNullOrEmpty (conf.CodesignProvision)) {
//if the profile was installed by Xcode, we can determine the filename directly from the UUID
//but if it was installed by iTunes, we need to search all profiles for the UUID.
var file = MobileProvision.ProfileDirectory.Combine (conf.CodesignProvision).ChangeExtension (".mobileprovision");
if (File.Exists (file)) {
try {
identity.Profile = MobileProvision.LoadFromFile (file);
} catch (Exception ex) {
string msg = "Could not read provisioning profile '" + file + "'.";
monitor.ReportError (msg, ex);
result.AddError (msg);
return result;
}
} else {
identity.Profile = MobileProvision.GetAllInstalledProvisions ()
.Where (p => p.Uuid == conf.CodesignProvision).FirstOrDefault ();
}
if (identity.Profile == null) {
result.AddError (string.Format ("The specified provisioning profile '{0}' could not be found", conf.CodesignProvision));
return result;
}
var prof = identity.Profile; //capture ref for lambda
identity.SigningKey = certs.Where (c => prof.DeveloperCertificates
.Any (p => p.Thumbprint == c.Thumbprint)).FirstOrDefault ();
if (identity.SigningKey == null) {
result.AddError (string.Format ("No iPhone code signing key matches specified provisioning profile '{0}'.", conf.CodesignProvision));
return result;
}
if (defaultID) {
identity.BundleID = GetDefaultBundleID (proj, GetProfileBundleID (identity.Profile));
result.AddWarning (string.Format ("Project does not have bundle identifier specified. Generated '{0}' to match provisioning profile.", identity.BundleID));
}
bool exact;
identity.AppID = ConstructValidAppId (identity.Profile, identity.BundleID, out exact);
if (identity.AppID == null) {
result.AddError (string.Format (
"Project bundle ID '{0}' does not match specified provisioning profile '{1}'", identity.BundleID, conf.CodesignProvision));
return result;
}
return result;
}
var pairs = (from p in MobileProvision.GetAllInstalledProvisions ()
from c in certs
where p.DeveloperCertificates.Any (d => d.Thumbprint == c.Thumbprint)
select new { Cert = c, Profile = p }).ToList ();
if (pairs.Count == 0) {
result.AddError ("No installed provisioning profiles match the installed iPhone code signing keys.");
return result;
}
if (!defaultID) {
//find a provisioning profile with compatible appid, preferring exact match
foreach (var p in pairs) {
bool exact;
var id = ConstructValidAppId (p.Profile, identity.BundleID, out exact);
if (id != null) {
if (exact || identity.AppID == null) {
identity.Profile = p.Profile;
identity.SigningKey = p.Cert;
identity.AppID = id;
}
if (exact)
break;
//.........这里部分代码省略.........
开发者ID:slluis,项目名称:monodevelop,代码行数:101,代码来源:IPhoneBuildExtension.cs
示例9: EmbedProvisioningProfile
static BuildResult EmbedProvisioningProfile (IProgressMonitor monitor, IPhoneProjectConfiguration conf, MobileProvision profile)
{
monitor.BeginTask (GettextCatalog.GetString ("Embedding provisioning profile"), 0);
try {
File.Copy (profile.FileName, conf.AppDirectory.Combine ("embedded.mobileprovision"), true);
} catch (IOException ex) {
var result = new BuildResult ();
result.AddError ("Embedding the provisioning profile failed: " + ex.Message);
return result;
}
monitor.EndTask ();
return null;
}
开发者ID:slluis,项目名称:monodevelop,代码行数:15,代码来源:IPhoneBuildExtension.cs
示例10: GenXcent
static BuildResult GenXcent (IProgressMonitor monitor, IPhoneSdkVersion sdkVersion, IPhoneProject proj,
IPhoneProjectConfiguration conf, IPhoneAppIdentity identity, out string xcentName)
{
xcentName = conf.CompiledOutputName.ChangeExtension (".xcent");
monitor.BeginTask (GettextCatalog.GetString ("Processing entitlements file"), 0);
string srcFile;
if (!string.IsNullOrEmpty (conf.CodesignEntitlements)) {
if (!File.Exists (conf.CodesignEntitlements))
return BuildError ("Entitlements file \"" + conf.CodesignEntitlements + "\" not found.");
srcFile = conf.CodesignEntitlements;
} else {
srcFile = "/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS" + sdkVersion.ToString ()
+ ".sdk/Entitlements.plist";
}
var doc = new PlistDocument ();
try {
doc.LoadFromXmlFile (srcFile);
} catch (Exception ex) {
monitor.Log.WriteLine (ex.ToString ());
return BuildError ("Error loading entitlements source file '" + srcFile +"'.");
}
//insert the app ID into the plist at the beginning
var oldDict = doc.Root as PlistDictionary;
var newDict = new PlistDictionary ();
doc.Root = newDict;
newDict["application-identifier"] = identity.AppID;
var keychainGroups = new PlistArray (new [] { identity.AppID } );
newDict["keychain-access-groups"] = keychainGroups;
//merge in the user's values
foreach (var item in oldDict) {
//FIXME: we currently ignore these items, and write our own, but maybe we should do substitutes
//i.e. $(AppIdentifierPrefix)$(CFBundleIdentifier)
if (item.Key == "application-identifier") {
var str = item.Value as PlistString;
if (str == null || string.IsNullOrEmpty (str.Value) || str.Value.Contains ('$'))
continue;
} else if (item.Key == "keychain-access-groups") {
//special handling, merge into the array
var keyArr = item.Value as PlistArray;
foreach (var key in keyArr) {
var str = key as PlistString;
if (str != null && !string.IsNullOrEmpty (str.Value) && !str.Value.Contains ('$')) {
keychainGroups.Add (str.Value);
}
}
continue;
}
newDict[item.Key] = item.Value;
}
//merge in the settings from the provisioning profile, skipping some
foreach (var item in identity.Profile.Entitlements)
if (item.Key != "application-identifier" && item.Key != "keychain-access-groups")
newDict[item.Key] = item.Value;
try {
WriteXcent (doc, xcentName);
} catch (Exception ex) {
monitor.Log.WriteLine (ex.ToString ());
return BuildError ("Error writing entitlements file '" + xcentName +"'.");
}
monitor.EndTask ();
return null;
}
开发者ID:slluis,项目名称:monodevelop,代码行数:71,代码来源:IPhoneBuildExtension.cs
示例11: AppendExtrasMtouchArgs
static internal void AppendExtrasMtouchArgs (ProcessArgumentBuilder args, IPhoneSdkVersion sdkVersion,
IPhoneProject proj, IPhoneProjectConfiguration conf)
{
if (conf.MtouchDebug)
args.Add ("-debug");
switch (conf.MtouchLink) {
case MtouchLinkMode.SdkOnly:
args.Add ("-linksdkonly");
break;
case MtouchLinkMode.None:
args.Add ("-nolink");
break;
case MtouchLinkMode.Full:
default:
break;
}
if (!string.IsNullOrEmpty (conf.MtouchI18n)) {
args.AddQuotedFormat ("-i18n={0}", conf.MtouchI18n);
}
if (!sdkVersion.Equals (IPhoneSdkVersion.V3_0))
args.AddQuotedFormat ("-sdk={0}", sdkVersion);
if (conf.MtouchMinimumOSVersion != "3.0")
args.AddQuotedFormat ("-targetver={0}", conf.MtouchMinimumOSVersion);
AddExtraArgs (args, conf.MtouchExtraArgs, proj, conf);
}
开发者ID:carlosaml,项目名称:monodevelop,代码行数:31,代码来源:IPhoneBuildExtension.cs
示例12: UpdateInfoPlist
BuildResult UpdateInfoPlist (IProgressMonitor monitor, IPhoneProject proj, IPhoneProjectConfiguration conf,
IPhoneAppIdentity identity, ProjectFile template, string plistOut)
{
return CreateMergedPlist (monitor, conf, template, plistOut,
(IPhoneProjectConfiguration config, PlistDocument doc) =>
{
var result = new BuildResult ();
var dict = doc.Root as PlistDictionary;
if (dict == null)
doc.Root = dict = new PropertyList.PlistDictionary ();
bool sim = conf.Platform != IPhoneProject.PLAT_IPHONE;
SetIfNotPresent (dict, "CFBundleDevelopmentRegion",
String.IsNullOrEmpty (proj.BundleDevelopmentRegion)? "English" : proj.BundleDevelopmentRegion);
SetIfNotPresent (dict, "CFBundleDisplayName", proj.BundleDisplayName ?? proj.Name);
SetIfNotPresent (dict, "CFBundleExecutable", conf.NativeExe.FileName);
//iphone icons
if ((proj.SupportedDevices & TargetDevice.IPhone) != 0) {
if (!dict.ContainsKey ("CFBundleIconFile")) {
var icon = proj.BundleIcon.ToRelative (proj.BaseDirectory);
if (icon.IsNullOrEmpty || icon.ToString () == ".")
result.AddWarning ("Application bundle icon has not been set");
else
dict ["CFBundleIconFile"] = icon.FileName;
}
}
//ipad and universal icons
if ((proj.SupportedDevices & TargetDevice.IPad) != 0 && !dict.ContainsKey ("CFBundleIconFiles")) {
var arr = new PlistArray ();
dict["CFBundleIconFiles"] = arr;
//universal only
if ((proj.SupportedDevices & TargetDevice.IPhone) != 0)
AddRelativeIfNotEmpty (proj, arr, proj.BundleIcon);
//ipad and universal
AddRelativeIfNotEmpty (proj, arr, proj.BundleIconSpotlight);
AddRelativeIfNotEmpty (proj, arr, proj.BundleIconIPadSpotlight);
if (!AddRelativeIfNotEmpty (proj, arr, proj.BundleIconIPad))
result.AddWarning ("iPad bundle icon has not been set");
}
SetIfNotPresent (dict, "CFBundleIdentifier", identity.BundleID);
SetIfNotPresent (dict, "CFBundleInfoDictionaryVersion", "6.0");
SetIfNotPresent (dict, "CFBundleName", proj.Name);
SetIfNotPresent (dict, "CFBundlePackageType", "APPL");
if (!sim)
dict["CFBundleResourceSpecification"] = "ResourceRules.plist";
SetIfNotPresent (dict, "CFBundleSignature", "????");
SetIfNotPresent (dict, "CFBundleSupportedPlatforms",
new PropertyList.PlistArray () { sim? "iPhoneSimulator" : "iPhoneOS" });
SetIfNotPresent (dict, "CFBundleVersion", proj.BundleVersion ?? "1.0");
SetIfNotPresent (dict, "DTPlatformName", sim? "iphonesimulator" : "iphoneos");
SetIfNotPresent (dict, "DTSDKName", (sim? "iphonesimulator" : "iphoneos") + conf.MtouchSdkVersion);
SetIfNotPresent (dict, "LSRequiresIPhoneOS", true);
if (proj.SupportedDevices != TargetDevice.IPhone)
SetIfNotPresent (dict, "UIDeviceFamily", GetSupportedDevices (proj.SupportedDevices));
SetIfNotPresent (dict, "DTPlatformVersion", conf.MtouchSdkVersion);
SetIfNotPresent (dict, "MinimumOSVersion", conf.MtouchMinimumOSVersion);
SetNibProperty (dict, proj, proj.MainNibFile, "NSMainNibFile");
if (proj.SupportedDevices == TargetDevice.IPhoneAndIPad)
SetNibProperty (dict, proj, proj.MainNibFileIPad, "NSMainNibFile~ipad");
return result;
});
}
开发者ID:transformersprimeabcxyz,项目名称:monodevelop-1,代码行数:70,代码来源:IPhoneBuildExtension.cs
示例13: AppendExtrasMtouchArgs
static internal void AppendExtrasMtouchArgs (StringBuilder args, IPhoneProject proj, IPhoneProjectConfiguration conf)
{
if (conf.MtouchDebug)
args.Append (" -debug");
switch (conf.MtouchLink) {
case MtouchLinkMode.SdkOnly:
args.Append (" -linksdkonly");
break;
case MtouchLinkMode.None:
args.Append (" -nolink");
break;
case MtouchLinkMode.Full:
default:
break;
}
if (!string.IsNullOrEmpty (conf.MtouchI18n)) {
args.Append (" -i18n=");
args.Append (conf.MtouchI18n);
}
if (conf.MtouchSdkVersion != "3.0")
args.AppendFormat (" -sdk=\"{0}\"", conf.MtouchSdkVersion);
if (conf.MtouchMinimumOSVersion != "3.0")
args.AppendFormat (" -targetver=\"{0}\"", conf.MtouchMinimumOSVersion);
AppendExtraArgs (args, conf.MtouchExtraArgs, proj, conf);
}
开发者ID:transformersprimeabcxyz,项目名称:monodevelop-1,代码行数:31,代码来源:IPhoneBuildExtension.cs
示例14: ProcessPackaging
static BuildResult ProcessPackaging (IProgressMonitor monitor, IPhoneSdkVersion sdkVersion, IPhoneProject proj,
IPhoneProjectConfiguration conf, IPhoneAppIdentity identity)
{
//don't bother signing in the sim
bool isDevice = conf.Platform == IPhoneProject.PLAT_IPHONE;
if (!isDevice)
return null;
BuildResult result = new BuildResult ();
var pkgInfo = conf.AppDirectory.Combine ("PkgInfo");
if (!File.Exists (pkgInfo))
using (var f = File.OpenWrite (pkgInfo))
f.Write (new byte [] { 0X41, 0X50, 0X50, 0X4C, 0x3f, 0x3f, 0x3f, 0x3f}, 0, 8);
if (result.Append (CompressResources (monitor, conf)).ErrorCount > 0)
return result;
if (result.Append (EmbedProvisioningProfile (monitor, conf, identity.Profile)).ErrorCount > 0)
return result;
string xcent;
if (result.Append (GenXcent (monitor, sdkVersion, proj, conf, identity, out xcent)).ErrorCount > 0)
return result;
string resRules;
if (result.Append (PrepareResourceRules (monitor, sdkVersion, conf, out resRules)).ErrorCount > 0)
return result;
if (result.Append (SignAppBundle (monitor, proj, conf, identity.SigningKey, resRules, xcent)).ErrorCount > 0)
return result;
return result;
}
开发者ID:slluis,项目名称:monodevelop,代码行数:34,代码来源:IPhoneBuildExtension.cs
示例15: SignAppBundle
static BuildResult SignAppBundle (IProgressMonitor monitor, IPhoneProject proj, IPhoneProjectConfiguration conf,
X509Certificate2 key, string resRules, string xcent)
{
monitor.BeginTask (GettextCatalog.GetString ("Signing application"), 0);
var args = new ProcessArgumentBuilder ();
args.Add ("-v", "-f", "-s");
args.AddQuoted (Keychain.GetCertificateCommonName (key));
args.AddQuotedFormat ("--resource-rules={0}", resRules);
args.Add ("--entitlements");
args.AddQuoted (xcent);
args.AddQuoted (conf.AppDirectory);
AddExtraArgs (args, conf.CodesignExtraArgs, proj, conf);
int signResultCode;
var psi = new ProcessStartInfo ("codesign") {
UseShellExecute = false,
RedirectStandardError = true,
RedirectStandardOutput = true,
Arguments = args.ToString (),
};
monitor.Log.WriteLine ("codesign " + psi.Arguments);
psi.EnvironmentVariables.Add ("CODESIGN_ALLOCATE",
"/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/codesign_allocate");
string output;
if ((signResultCode = MacBuildUtilities.ExecuteCommand (monitor, psi, out output)) != 0) {
monitor.Log.WriteLine (output);
return BuildError (string.Format ("Code signing failed with error code {0}. See output for details.", signResultCode));
}
monitor.EndTask ();
return null;
}
开发者ID:slluis,项目名称:monodevelop,代码行数:35,代码来源:IPhoneBuildExtension.cs
示例16: CompressResources
static BuildResult CompressResources (IProgressMonitor monitor, IPhoneProjectConfiguration conf)
{
monitor.BeginTask (GettextCatalog.GetString ("Compressing resources"), 0);
var optTool = new ProcessStartInfo (
"/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/iphoneos-optimize",
ProcessArgumentBuilder.Quote (conf.AppDirectory));
monitor.Log.WriteLine (optTool.FileName + " " + optTool.Arguments);
string errorOutput;
int code = MacBuildUtilities.ExecuteCommand (monitor, optTool, out errorOutput);
if (code != 0) {
var result = new BuildResult ();
result.AddError ("Compressing the resources failed: " + errorOutput);
return result;
}
monitor.EndTask ();
return null;
}
开发者ID:slluis,项目名称:monodevelop,代码行数:21,代码来源:IPhoneBuildExtension.cs
示例17: UpdateDebugSettingsPlist
static BuildResult UpdateDebugSettingsPlist (IProgressMonitor monitor, IPhoneProjectConfiguration conf,
ProjectFile template, string target)
{
if (template != null && template.BuildAction != BuildAction.Content)
template = null;
//if not in debug mode, make sure that the settings file is either
//copied cleanly or deleted
if (!conf.DebugMode) {
if (template != null) {
MacBuildUtilities.EnsureDirectoryForFile (target);
File.Copy (template.FilePath, target, true);
} else if (File.Exists (target)) {
File.Delete (target);
}
return null;
}
return MacBuildUtilities.CreateMergedPlist (monitor, template, target, (PlistDocument doc) => {
var br = new BuildResult ();
var debuggerIP = System.Net.IPAddress.Any;
bool sim = conf.Platform == IPhoneProject.PLAT_SIM;
try {
debuggerIP = IPhoneSettings.GetDebuggerHostIP (sim);
} catch {
br.AddWarning (GettextCatalog.GetString ("Could not resolve host IP for debugger settings"));
}
var dict = doc.Root as PlistDictionary;
if (dict == null)
doc.Root = dict = new PlistDictionary ();
SetIfNotPresent (dict, "Title", "AppSettings");
SetIfNotPresent (dict, "StringsTable", "Root");
var arr = dict.TryGetValue ("PreferenceSpecifiers") as PlistArray;
if (arr == null)
dict["PreferenceSpecifiers"] = arr = new PlistArray ();
arr.Add (new PlistDictionary (true) {
{ "Type", "PSGroupSpecifier" },
{ "Title", "Debug Settings" }
});
arr.Add (new PlistDictionary (true) {
{ "Type", "PSToggleSwitchSpecifier" },
{ "Title", "Enabled" },
{ "Key", "__monotouch_debug_enabled" },
{ "DefaultValue", "1" },
{ "TrueValue", "1" },
{ "FalseValue", "0" }
});
arr.Add (new PlistDictionary (true) {
{ "Type", "PSTextFieldSpecifier" },
{ "Title", "Debugger Host" },
{ "Key", "__monotouch_debug_host" },
{ "AutocapitalizationType", "None" },
{ "AutocorrectionType", "No" },
{ "DefaultValue", debuggerIP.ToString () }
});
arr.Add (new PlistDictionary (true) {
{ "Type", "PSTextFieldSpecifier" },
{ "Title", "Debugger Port" },
{ "Key", "__monotouch_debug_port" },
{ "AutocapitalizationType", "None" },
{ "AutocorrectionType", "No" },
{ "DefaultValue", IPhoneSettings.DebuggerPort.ToString () }
});
arr.Add (new PlistDictionary (true) {
{ "Type", "PSTextFieldSpecifier" },
{ "Title", "Output Port" },
{ "Key", "__monotouch_output_port" },
{ "AutocapitalizationType", "None" },
{ "AutocorrectionType", "No" },
{ "DefaultValue", IPhoneSettings.DebuggerOutputPort.ToString () }
});
return br;
});
}
开发者ID:slluis,项目名称:monodevelop,代码行数:84,代码来源:IPhoneBuildExtension.cs
示例18: GenerateXCodeProject
void GenerateXCodeProject (IPhoneProject proj, IPhoneProjectConfiguration conf, ConfigurationSelector slnConf)
{
string mtouchPath = IPhoneUtility.GetMtouchPath (proj.TargetRuntime, proj.TargetFramework);
var xcodeDir = conf.OutputDirectory.Combine ("XcodeProject");
if (!Directory.Exists (xcodeDir)) {
try {
Directory.CreateDirectory (xcodeDir);
} catch (IOException ex) {
MessageService.ShowException (ex, "Failed to create directory '" + xcodeDir +"' for Xcode project");
return;
}
}
var args = new ProcessArgumentBuilder ();
args.AddQuotedFormat ("-xcode={0}", xcodeDir);
args.Add ("-v");
foreach (ProjectFile pf in proj.Files) {
if (pf.BuildAction == BuildAction.Content) {
var rel = pf.ProjectVirtualPath;
args.AddQuotedFormat ("-res={0},{1}", pf.FilePath, rel);
//hack around mtouch 1.0 bug. create resource directories
string subdir = rel.ParentDirectory;
if (string.IsNullOrEmpty (subdir))
continue;
subdir = xcodeDir.Combine (subdir);
try {
if (!Directory.Exists (subdir))
Directory.CreateDirectory (subdir);
} catch (IOException ex) {
MessageService.ShowException (ex, "Failed to create directory '" + subdir +"' for Xcode project");
return;
}
} else if (pf.BuildAction == BuildAction.Page) {
args.AddQuotedFormat ("-res={0}", pf.FilePath);
}
}
args.AddQuotedFormat ("-res={0},Info.plist", conf.AppDirectory.Combine ("Info.plist"));
foreach (string asm in proj.GetReferencedAssemblies (slnConf).Distinct ())
args.AddQuotedFormat ("-r={0}", asm);
var sdkVersion = conf.MtouchSdkVersion.ResolveIfDefault ();
if (!IPhoneFramework.SdkIsInstalled (sdkVersion))
sdkVersion = IPhoneFramework.GetClosestInstalledSdk (sdkVersion);
IPhoneBuildExtension.AppendExtrasMtouchArgs (args, sdkVersion, proj, conf);
args.AddQuoted (conf.CompiledOutputName);
string argStr = args.ToString ();
var console = (IConsole) IdeApp.Workbench.ProgressMonitors.GetOutputProgressMonitor (
GettextCatalog.GetString ("Generate Xcode project"), MonoDevelop.Ide.Gui.Stock.RunProgramIcon, true, true);
console.Log.WriteLine (mtouchPath + " " + argStr);
Runtime.ProcessService.StartConsoleProcess (mtouchPath, argStr, conf.OutputDirectory, console, null);
}
开发者ID:nickname100,项目名称:monodevelop,代码行数:59,代码来源:IPhoneCommands.cs
示例19: UnpackContent
static BuildResult UnpackContent (IProgressMonitor monitor, IPhoneProjectConfiguration cfg, List<string> assemblies)
{
bool isDevice = cfg.Platform == IPhoneProject.PLAT_IPHONE;
//remove framework references, they don't contain embedded content
List<string> toProcess = new List<string> ();
for (int i = 0; i < assemblies.Count; i++) {
var asm = assemblies[i];
if (!asm.StartsWith ("/Developer/MonoTouch/usr/lib/mono/2.1") && asm != "mscorlib")
toProcess.Add (asm);
}
//optimize the case where there are no non-framework references
if (toProcess.Count == 0)
return null;
var result = new BuildResult ();
var appDir = cfg.AppDirectory;
//check that the dlls are also in the app bundle
for (int i = 0; i < toProcess.Count; i++) {
var asmInBundle = appDir.Combine (Path.GetFileName (toProcess[i]));
if (!File.Exists (asmInBundle)) {
var m = GettextCatalog.GetString ("Library '{0}' missing in app bundle, cannot extract content", asmInBundle.FileName);
result.AddWarning (m);
toProcess.RemoveAt (i--);
}
}
//determine which dlls have been extracted, so we can skip re-extracting their content
var previouslyProcessedDlls = new HashSet<string> ();
var infoFile = cfg.ObjDir.Combine ("monotouch_dll_content_processed");
bool hasInfoFile = File.Exists (infoFile);
DateTime infoFileWritten = DateTime.MinValue;
List<bool> skipExtractList = null;
if (hasInfoFile) {
infoFileWritten = File.GetLastWriteTimeUtc (infoFile);
foreach (var line in File.ReadAllLines (infoFile))
previouslyProcessedDlls.Add (line);
//remove logged dlls that are no longer in the build
previouslyProcessedDlls.IntersectWith (toProcess);
//don't re-process dlls that were written before the info file and are in the info file
skipExtractList = toProcess.Select (asm =>
!previouslyProcessedDlls.Add (asm)
&& infoFileWritten > File.GetLastWriteTimeUtc (asm)
).ToList ();
} else {
previouslyProcessedDlls.UnionWith (toProcess);
}
//early exit if nothing needs to be extracted or stripped
if (toProcess.Count == 0 || (!isDevice && skipExtractList != null && skipExtractList.All (b => b)))
return result;
monitor.BeginTask ("Extracting embedded content", 0);
for (int i = 0; i < toProcess.Count; i++) {
FilePath asmFile = toProcess[i];
bool skipExtract = skipExtractList != null && skipExtractList[i];
if (skipExtract)
continue;
try {
ExtractFromContentAssembly (monitor, appDir, asmFile);
} catch (Exception ex) {
string message = string.Format ("Error extracting content from assembly '{0}'", asmFile);
monitor.ReportError (message, ex);
result.AddError (message);
monitor.EndTask ();
return result;
}
}
monitor.EndTask ();
var dir = infoFile.ParentDirectory;
if (!Directory.Exists (dir))
Directory.CreateDirectory (dir);
File.WriteAllLines (infoFile, previouslyProcessedDlls.ToArray ());
return result;
}
开发者ID:slluis,项目名称:monodevelop,代码行数:80,代码来源:IPhoneBuildExtension.cs
示例20: NeedsUploading
static bool NeedsUploading (IPhoneProjectConfiguration conf)
{
var markerFile = conf.OutputDirectory.Combine (".monotouch_last_uploaded");
return Directory.Exists (conf.AppDirectory) && (!File.Exists (markerFile)
|| File.GetLastWriteTime (markerFile) < Directory.GetLastWriteTime (conf.AppDirectory));
}
开发者ID:transformersprimeabcxyz,项目名称:monodevelop-1,代码行数:6,代码来源:IPhoneProject.cs
注:本文中的MonoDevelop.IPhone.IPhoneProjectConfiguration类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论