void Modify() { string src = dirName + "\\" + fileName + @"\Payload\WeChat.app\Info.plist"; try { PListRoot root = PListRoot.Load(src); PListDict dic = (PListDict)root.Root; dic["CFBundleDisplayName"] = new PListString(WeChatName); dic["CFBundleIdentifier"] = new PListString(Guid.NewGuid().ToString()); root.Root = dic; root.Save(src, PListFormat.Xml); } catch (Exception ex) { MessageBox.Show("修改失败"); } if (iconNum != 3) { string route = dirName + "\\" + fileName + @"\Payload\WeChat.app"; string desPath = route + @"\[email protected]"; del(desPath, true); System.IO.File.Copy(System.AppDomain.CurrentDomain.BaseDirectory + @"img\" + iconNum.ToString() + ".png", desPath); string infoPlist = route + @"\zh_CN.lproj\InfoPlist.strings"; del(infoPlist, true); ChangeFileName(route + @"\zh_CN.lproj\" + iconNum.ToString() + ".plist", route + @"\zh_CN.lproj\InfoPlist.strings"); } }
private static void Replace(PListDict dict, String key, String value) { if (value == null) { if (dict.ContainsKey(key)) { dict.Remove(key); } return; } if (!dict.ContainsKey(key)) { dict[key] = new PListString(value); return; } PListString pListString = dict[key] as PListString; if (pListString == null) { dict[key] = new PListString(value); return; } String currentValue = pListString.Value; if (currentValue.StartsWith("${") && currentValue.EndsWith("}")) { dict[key] = new PListString(value); return; } }
public void GetString() { PListString element = _basicPlist.Root["StringValue"] as PListString; Assert.IsNotNull(element); Assert.AreEqual(element.Value, "Foo"); }
/// <summary> /// Generate the specified infoPlist and outputFolder. /// </summary> /// <param name='infoPlist'> /// Info plist. /// </param> /// <param name='outputFolder'> /// Output folder. /// </param> public String Generate(String infoPlist, String outputFolder) { // Load the Info.plist file PListDocument document = PListDocument.LoadFromFile(infoPlist); if (document == null) { this.Logger.LogError("Cannot parse document: " + infoPlist); return(String.Empty); } if (document.Root == null) { this.Logger.LogError("Document has no root: " + infoPlist); return(String.Empty); } if (document.Root.Dict == null) { this.Logger.LogError("Document has no dict: " + infoPlist); return(String.Empty); } // Extract bundle identifier PListString identifier = document.Root.Dict ["CFBundleIdentifier"] as PListString; if (identifier == null || String.IsNullOrWhiteSpace(identifier.Value)) { this.Logger.LogError("Document has no 'CFBundleIdentifier': " + infoPlist); return(String.Empty); } // Extract bundle version PListString version = document.Root.Dict ["CFBundleShortVersionString"] as PListString; if (version == null || String.IsNullOrWhiteSpace(version.Value)) { this.Logger.LogError("Document has no 'CFBundleShortVersionString': " + infoPlist); return(String.Empty); } // Launch the generation String file = Path.Combine(outputFolder, "receigen.h"); StringBuilder arguments = new StringBuilder(); arguments.AppendFormat(" --identifier {0} ", identifier.Value); arguments.AppendFormat(" --version {0} ", version.Value); this.Logger.LogDebug("Calling '" + this.Executable + "' with '" + arguments + "'"); ProcessHelper helper = new ProcessHelper(this.Executable, arguments.ToString()); String output = helper.ExecuteAndReturnOutput(); Directory.CreateDirectory(Path.GetDirectoryName(file)); File.WriteAllText(file, output); return("Done"); }
protected override void DrawString(PListString element) { EditorGUI.BeginChangeCheck(); var value = EditorGUILayout.TextField(element.Value); if (EditorGUI.EndChangeCheck()) { element.Value = value; IsDirty = true; } }
protected abstract void DrawString(PListString element);
public void SpecifiedConstructor() { PListString b = new PListString("Hello"); Assert.AreEqual(b.Value, "Hello"); }
public void SetUp() { _element = new PListString(); }
/// <summary> /// Compiles the specified XIB file. /// </summary> /// <param name = "xibFile">The XIB file.</param> /// <param name = "directory">The directory.</param> /// <returns><code>true</code> if the compilation is successful, <code>false</code> otherwise.</returns> public bool Compile(String xibFile, String directory) { // TODO: I18N this.Logger.LogDebug(String.Format(CultureInfo.CurrentCulture, "Compiling {0} into {1}", xibFile, directory)); PListDocument result = XibTool.Compile(xibFile, directory); if (result == null) { this.Logger.LogInfo(String.Format(CultureInfo.CurrentCulture, Resources.IBFileUpToDate, xibFile)); return(true); } PList root = result.Root; PListDict dict = root.Dict; if (dict == null) { this.Logger.LogError(Resources.NoDictionaryFound); return(false); } // Global errors if (dict.ContainsKey(XibTool.ERRORS)) { PListArray errors = (PListArray)dict[XibTool.ERRORS]; foreach (PListItemBase item in errors) { PListDict error = item as PListDict; if (error == null) { continue; } PListString description = error[XibTool.KEY_DESCRIPTION] as PListString; if (description != null) { this.Logger.LogError(description.Value); } } // If there was global errors, return if (errors.Count > 0) { return(false); } } // Document errors PListDict documentErrors = (PListDict)dict[XibTool.DOCUMENT_ERRORS]; foreach (String key in documentErrors.Keys) { PListArray elementErrors = documentErrors[key] as PListArray; if (elementErrors == null) { continue; } foreach (PListItemBase item in elementErrors) { PListDict error = item as PListDict; PListString type = error[XibTool.KEY_TYPE] as PListString; PListString message = error[XibTool.KEY_MESSAGE] as PListString; if (type != null && message != null) { this.Logger.LogError(String.Format(CultureInfo.CurrentCulture, Resources.ValueDescriptionFormat, type.Value, message.Value)); } } } // If there was document errors, return if (documentErrors.Count > 0) { return(false); } // Document warnings PListDict documentWarnings = (PListDict)dict[XibTool.DOCUMENT_WARNINGS]; foreach (String key in documentWarnings.Keys) { PListArray elementWarnings = documentWarnings[key] as PListArray; if (elementWarnings == null) { continue; } foreach (PListItemBase item in elementWarnings) { PListDict error = item as PListDict; PListString type = error[XibTool.KEY_TYPE] as PListString; PListString message = error[XibTool.KEY_MESSAGE] as PListString; if (type != null && message != null) { this.Logger.LogWarning(String.Format(CultureInfo.CurrentCulture, Resources.ValueDescriptionFormat, type.Value, message.Value)); } } } // Document notices PListDict documentNotices = (PListDict)dict[XibTool.DOCUMENT_NOTICES]; foreach (String key in documentNotices.Keys) { PListArray elementNotices = documentNotices[key] as PListArray; if (elementNotices == null) { continue; } foreach (PListItemBase item in elementNotices) { PListDict error = item as PListDict; PListString type = error[XibTool.KEY_TYPE] as PListString; PListString message = error[XibTool.KEY_MESSAGE] as PListString; if (type != null && message != null) { this.Logger.LogInfo(String.Format(CultureInfo.CurrentCulture, Resources.ValueDescriptionFormat, type.Value, message.Value)); } } } return(true); }
public static void mobilesync_get_all_contacts(MobileSync client) { PListArray array = new PListArray(); array.Add(new PListString("SDMessageSyncDataClassWithDevice")); array.Add(new PListString("com.apple.Contacts")); array.Add(new PListString("---")); array.Add(new PListString("2009-01-09 18:03:58 +0100")); array.Add(new PListInteger(106)); array.Add(new PListString("___EmptyParameterString___")); client.mobilesync_send(array); array = client.mobilesync_receive() as PListArray; array = new PListArray(); array.Add(new PListString("SDMessageGetAllRecordsFromDevice")); array.Add(new PListString("com.apple.Contacts")); client.mobilesync_send(array); array = client.mobilesync_receive() as PListArray; PListString contact_node = array[1] as PListString; PListString switch_node = array[0] as PListString; while (contact_node.Value == "com.apple.Contacts" && switch_node.Value != "SDMessageDeviceReadyToReceiveChanges") { array = new PListArray(); array.Add(new PListString("SDMessageAcknowledgeChangesFromDevice")); array.Add(new PListString("com.apple.Contacts")); client.mobilesync_send(array); array = client.mobilesync_receive() as PListArray; contact_node = array[1] as PListString; switch_node = array[0] as PListString; } array = new PListArray(); array.Add(new PListString("DLMessagePing")); array.Add(new PListString("Preparing to get changes for device")); client.mobilesync_send(array); array = new PListArray(); array.Add(new PListString("SDMessageProcessChanges")); array.Add(new PListString("com.apple.Contacts")); array.Add(create_new_contact()); array.Add(new PListBool(false)); PListDict dict = new PListDict(); array.Add(dict); PListArray array2 = new PListArray(); dict.Add("SyncDeviceLinkEntityNamesKey", array2); array2.Add(new PListString("com.apple.contacts.Contact")); array2.Add(new PListString("com.apple.contacts.Group")); dict.Add("SyncDeviceLinkAllRecordsOfPulledEntityTypeSentKey", new PListBool(true)); ShowIPListElement(array); client.mobilesync_send(array); array = client.mobilesync_receive() as PListArray; PListArray finish = new PListArray(); finish.Add(new PListString("SDMessageFinishSessionOnDevice")); finish.Add(new PListString("com.apple.Contacts")); client.mobilesync_send(finish); finish = client.mobilesync_receive() as PListArray; }
protected override void DrawString(PListString element) { Style.MinWidthLabel(element.ToString(), PADDING); }
private static IPListElement ExportShapedGraphic(Omnigraffle.ShapedGraphic graphic) { var dict = new PListDict (); dict.Add ("Bounds", ExportBounds (graphic.Bounds)); dict.Add ("Class", new PListString (graphic.Class)); dict.Add ("ID", new PListInteger (graphic.ID)); var shape = new PListString (); if (graphic.Shape == Omnigraffle.Shape.Bezier) shape.Value = "Bezier"; else if (graphic.Shape == Omnigraffle.Shape.Rectangle) shape.Value = "Rectangle"; else if (graphic.Shape == Omnigraffle.Shape.Circle) shape.Value = "Circle"; else if (graphic.Shape == Omnigraffle.Shape.Cloud) shape.Value = "Cloud"; else throw new NotImplementedException (); dict.Add ("Shape", shape); var fit_text = new PListString (); if (graphic.FitText == Omnigraffle.FitText.Vertical) fit_text.Value = "Vertical"; if (graphic.FitText == Omnigraffle.FitText.Clip) fit_text.Value = "Clip"; if (graphic.FitText == Omnigraffle.FitText.Yes) fit_text.Value = "Clip"; dict.Add ("FitText", fit_text); var flow = new PListString (); if (graphic.Flow == Omnigraffle.Flow.Resize) flow.Value = "Resize"; if (graphic.Flow == Omnigraffle.Flow.Clip) flow.Value = "Clip"; dict.Add ("Flow", flow); var wrap = new PListString (); if (!graphic.Wrap) { wrap.Value = "NO"; dict.Add ("Wrap", wrap); } if (graphic.FontInfo != default (Omnigraffle.FontInfo)) { dict.Add ("Font", ExportFont (graphic.FontInfo)); } if (graphic.ShapeData != default (Omnigraffle.ShapeData)) dict.Add ("ShapeData", ExportShapeData (graphic.ShapeData)); if (graphic.Style != default (Omnigraffle.StyleInfo)) dict.Add ("Style", ExportStyle (graphic.Style)); if (graphic.VFlip) dict.Add ("VFlip", new PListBool (graphic.VFlip)); if (graphic.HFlip) dict.Add ("HFlip", new PListBool (graphic.HFlip)); if (!graphic.AllowConnections) dict.Add ("AllowConnections", new PListString (graphic.AllowConnections ? "YES" : "NO")); if (graphic.Text != default(Omnigraffle.TextInfo)) dict.Add ("Text", ExportText (graphic)); if (graphic.Line != null) { var d2 = new PListDict(); d2.Add ("ID", new PListInteger(graphic.Line.ID)); d2.Add ("Position", new PListReal(graphic.Line.Position)); d2.Add ("RotationType", new PListInteger(graphic.Line.RotationType == Omnigraffle.RotationType.Default ? 0 : 0)); dict.Add ("Line", d2); } if (graphic.Magnets.Count > 0) { var d2 = new PListArray(); foreach (var m in graphic.Magnets) { d2.Add(new PListString(string.Format(CultureInfo.InvariantCulture, "{{{0:0.######},{1:0.######}}}", m.X, m.Y))); } dict.Add ("Magnets", d2); } return dict; }
private static IPListElement ExportShapedGraphic(Omnigraffle.ShapedGraphic graphic) { var dict = new PListDict(); dict.Add("Bounds", ExportBounds(graphic.Bounds)); dict.Add("Class", new PListString(graphic.Class)); dict.Add("ID", new PListInteger(graphic.ID)); var shape = new PListString(); if (graphic.Shape == Omnigraffle.Shape.Bezier) { shape.Value = "Bezier"; } else if (graphic.Shape == Omnigraffle.Shape.Rectangle) { shape.Value = "Rectangle"; } else if (graphic.Shape == Omnigraffle.Shape.Circle) { shape.Value = "Circle"; } else if (graphic.Shape == Omnigraffle.Shape.Cloud) { shape.Value = "Cloud"; } else { throw new NotImplementedException(); } dict.Add("Shape", shape); var fit_text = new PListString(); if (graphic.FitText == Omnigraffle.FitText.Vertical) { fit_text.Value = "Vertical"; } if (graphic.FitText == Omnigraffle.FitText.Clip) { fit_text.Value = "Clip"; } if (graphic.FitText == Omnigraffle.FitText.Yes) { fit_text.Value = "Clip"; } dict.Add("FitText", fit_text); var flow = new PListString(); if (graphic.Flow == Omnigraffle.Flow.Resize) { flow.Value = "Resize"; } if (graphic.Flow == Omnigraffle.Flow.Clip) { flow.Value = "Clip"; } dict.Add("Flow", flow); var wrap = new PListString(); if (!graphic.Wrap) { wrap.Value = "NO"; dict.Add("Wrap", wrap); } if (graphic.FontInfo != default(Omnigraffle.FontInfo)) { dict.Add("Font", ExportFont(graphic.FontInfo)); } if (graphic.ShapeData != default(Omnigraffle.ShapeData)) { dict.Add("ShapeData", ExportShapeData(graphic.ShapeData)); } if (graphic.Style != default(Omnigraffle.StyleInfo)) { dict.Add("Style", ExportStyle(graphic.Style)); } if (graphic.VFlip) { dict.Add("VFlip", new PListBool(graphic.VFlip)); } if (graphic.HFlip) { dict.Add("HFlip", new PListBool(graphic.HFlip)); } if (!graphic.AllowConnections) { dict.Add("AllowConnections", new PListString(graphic.AllowConnections ? "YES" : "NO")); } if (graphic.Text != default(Omnigraffle.TextInfo)) { dict.Add("Text", ExportText(graphic)); } if (graphic.Line != null) { var d2 = new PListDict(); d2.Add("ID", new PListInteger(graphic.Line.ID)); d2.Add("Position", new PListReal(graphic.Line.Position)); d2.Add("RotationType", new PListInteger(graphic.Line.RotationType == Omnigraffle.RotationType.Default ? 0 : 0)); dict.Add("Line", d2); } if (graphic.Magnets.Count > 0) { var d2 = new PListArray(); foreach (var m in graphic.Magnets) { d2.Add(new PListString(string.Format("{{{0},{1}}}", m.X, m.Y))); } dict.Add("Magnets", d2); } return(dict); }