//------------------------------------------------------------------------------------- /// protected override void AsyncTaskDoneBody(AsyncTask task) { #region Persons if(task.TaskName == "Persons") { _pers = (Persons)task.Result; ListBinder b = new ListBinder(_list = new PList<ISubject>(_pers)); b.CacheSort = false; b.Sort(Sort); fdgvList.DataSource = b; } #endregion Persons #region Save if(task.TaskName == "Save") { ISubject s = (ISubject)task.Tag; if(_pers.Contains(s) == false) _pers.Add((Person)s); else Pulsar.Serialization.PulsarSerializer.Deserialize(Pulsar.Serialization.PulsarSerializer.Backup(s), _pers[s.OID]); Modify = false; } #endregion Save #region Remove if(task.TaskName == "Remove") { _pers.Remove((Person)task.Tag); _list.Remove((ISubject)task.Tag); } #endregion Remove }
/// <summary>look for any new builds on the CI server /// By default, it will start with the newest (ordered by build number) and work its way back. /// If fullScan is set to false (the default), it will stop processing builds and assume that all /// previous ones have been uploaded. If fullScan is true, it will continue to process builds until /// all have been checked. /// </summary> public void LookForBuilds(bool fullScan = false) { // interrogate the file server for new builds foreach (var appDirectory in applicationDirectoires) { // first ensure that the app exists in the db LookForApplication(appDirectory); // grab the application object string appName = appDirectory.Split('\\').Last(); var application = applicationService.GetByName(appName); var builds = Directory.GetDirectories(appDirectory); // Iterate over each directory inside this application folder // order by name (ie build number) foreach (var buildDir in builds.OrderByDescending(b=> b)) // limit this by... date? versionNo? { // grab the plist file from the ci package var filepath = string.Concat(buildDir, "\\info.plist"); FileInfo fileInfo = new FileInfo(filepath); if (fileInfo.Exists) { var plist = new PList(filepath); var buildNumber = buildDir.Split('\\').Last(); var build = BuildService.GetByVersionNumber(application.Id, buildNumber); if (build == null) { build = new Build { Application = application, /* from package xml */ BuildNumber = buildNumber, VersionNumber = plist["CFBundleShortVersionString"], /* from ci output */ DateCreated = fileInfo.CreationTime, Type = BuildType.Production, ReleaseNotes = "pulled from svn", PackageUrl = "http://www.url.com" }; BuildService.Create(build); } else if (fullScan == false) { // stop processing builds for this app once the last uploaded one has been found break; } } } } }
static void ccallback(object sender, EventArgs args) { Console.WriteLine("Connected."); bool available = iph.IsConnected; Console.WriteLine(available); string dn = iph.RequestProperty<string>(null, "DeviceName"); Console.WriteLine("Device: "+dn); Console.Write("Enter new name: "); string nn = Console.ReadLine(); if (nn != "") { bool s = iph.SetProperty(null,"DeviceName",nn); Console.WriteLine(s); } PList pl = new PList(iph.RequestProperties(null), false); foreach (KeyValuePair<string, dynamic> kvp in pl) { Console.WriteLine("{0} : {1}", kvp.Key, kvp.Value); } string[] dirlist = iph.GetContents("/"); Console.WriteLine("\n\nDirectory Listing:"); foreach (string path in dirlist) { Console.WriteLine(path); } string[] afcinfo = iph.GetAFCInfo(); Console.WriteLine("\n\nAFC Info:"); foreach (string key in afcinfo) { Console.WriteLine(key); } Dictionary<string, string> info; info = iph.GetFileInfo("/DCIM"); Console.WriteLine("\n\nDCIM Info:"); foreach (KeyValuePair<string, string> kvp in info) { Console.WriteLine("{0} : {1}", kvp.Key, kvp.Value); } info = iph.GetFileInfo("test"); Console.WriteLine("\n\ntest file Info:"); foreach (KeyValuePair<string, string> kvp in info) { Console.WriteLine("{0} : {1}", kvp.Key, kvp.Value); } Console.WriteLine("Writing File to Device..."); Console.WriteLine(iph.CopyFileToDevice("MK.MobileDevice.dll","test")); Console.WriteLine("Fetching File from Device..."); Console.WriteLine(iph.CopyFileFromDevice("test.dll","test")); Console.WriteLine(iph.IsLink("/")); //System.Threading.Thread.Sleep(10); }
/// <summary> /// The create preset. /// </summary> /// <param name="plist"> /// The plist. /// </param> /// <returns> /// The <see cref="Preset"/>. /// </returns> public static Preset CreatePreset(PList plist) { Preset preset = new Preset { Task = new EncodeTask(), Category = PresetService.UserPresetCatgoryName, AudioTrackBehaviours = new AudioBehaviours(), SubtitleTrackBehaviours = new SubtitleBehaviours() }; // Parse the settings out. foreach (var item in plist) { if (item.Key == "AudioList") { List<AudioTrack> tracks = ParseAudioTracks(item.Value); preset.Task.AudioTracks = new ObservableCollection<AudioTrack>(tracks); } else { ParseSetting(item, preset); } } // Handle the PictureDecombDeinterlace key if (preset.UseDeinterlace) { preset.Task.Decomb = Decomb.Off; preset.Task.CustomDecomb = string.Empty; } // Depending on the selected preset options, we may need to change some settings around. // If the user chose not to use fitlers, remove them. if (!preset.UsePictureFilters) { preset.Task.Detelecine = Detelecine.Off; preset.Task.Denoise = Denoise.Off; preset.Task.Deinterlace = Deinterlace.Off; preset.Task.Decomb = Decomb.Off; preset.Task.Deblock = 0; preset.Task.Grayscale = false; } // IF we are using Source Max, Set the Max Width / Height values. if (preset.PictureSettingsMode == PresetPictureSettingsMode.SourceMaximum) { preset.Task.MaxWidth = preset.Task.Height; preset.Task.MaxHeight = preset.Task.Width; } return preset; }
public static String GenerateContent(string elementType, string siteName, byte[] key, int counter, Func <byte[], byte[], byte[]> hmacFunc) { if (counter == 0) { throw new Exception("counter==0 not support in .net. "); //TODO: what does this line do in Java? //counter = (int) (System.currentTimeMillis() / (300 * 1000)) * 300; } byte[] nameLengthBytes = IntAsByteArray(siteName.Length); byte[] counterBytes = IntAsByteArray(counter); byte[] seed = hmacFunc(key, Combine(Encoding.UTF8.GetBytes("com.lyndir.masterpassword"), // nameLengthBytes, // Encoding.UTF8.GetBytes(siteName), // counterBytes)); //logger.trc( "seed is: %s", CryptUtils.encodeBase64( seed ) ); //Preconditions.checkState( seed.length > 0 ); int templateIndex = seed[0] & 0xFF; // Mask the integer's sign. //MPTemplate template = templates.getTemplateForTypeAtRollingIndex( type, templateIndex ); //MPTemplate template = null; var generatedEntities = PlistData["MPElementGeneratedEntity"]; //TODO catch wrong elementType! var templatesLongPwd = generatedEntities[elementType]; string template = templatesLongPwd[templateIndex % templatesLongPwd.Count]; //logger.trc( "type: %s, template: %s", type, template ); StringBuilder password = new StringBuilder(template.Length); for (int i = 0; i < template.Length; ++i) { int characterIndex = seed[i + 1] & 0xFF; // Mask the integer's sign. char c = template[i]; PList listOfCharacterSets = PlistData["MPCharacterClasses"]; var listOfCharacters = listOfCharacterSets.Single(kvp => { return(kvp.Key == c.ToString()); }).Value; char passwordCharacter = listOfCharacters[characterIndex % listOfCharacters.Length]; /*logger.trc( "class: %s, index: %d, byte: 0x%02X, chosen password character: %s", characterClass, characterIndex, seed[i + 1], * passwordCharacter ); */ password.Append(passwordCharacter); } return(password.ToString()); }
/// <summary> /// The create preset. /// </summary> /// <param name="plist"> /// The plist. /// </param> /// <returns> /// The <see cref="Preset"/>. /// </returns> public static Preset CreatePreset(PList plist) { Preset preset = new Preset { Task = new EncodeTask(), Category = PresetService.UserPresetCatgoryName, AudioTrackBehaviours = new AudioBehaviours(), SubtitleTrackBehaviours = new SubtitleBehaviours() }; // Parse the settings out. foreach (var item in plist) { if (item.Key == "AudioList") { List <AudioTrack> tracks = ParseAudioTracks(item.Value); preset.Task.AudioTracks = new ObservableCollection <AudioTrack>(tracks); } else { ParseSetting(item, preset); } } // Handle the PictureDecombDeinterlace key if (preset.UseDeinterlace) { preset.Task.Decomb = Decomb.Off; preset.Task.CustomDecomb = string.Empty; } // Depending on the selected preset options, we may need to change some settings around. // If the user chose not to use fitlers, remove them. if (!preset.UsePictureFilters) { preset.Task.Detelecine = Detelecine.Off; preset.Task.Denoise = Denoise.Off; preset.Task.Deinterlace = Deinterlace.Off; preset.Task.Decomb = Decomb.Off; preset.Task.Deblock = 0; preset.Task.Grayscale = false; } // IF we are using Source Max, Set the Max Width / Height values. if (preset.PictureSettingsMode == PresetPictureSettingsMode.SourceMaximum) { preset.Task.MaxWidth = preset.Task.Height; preset.Task.MaxHeight = preset.Task.Width; } return(preset); }
public ActionResult Index(int index = 0, SortDirection sortDir = SortDirection.Asc, int sortCol = 0) { int pageSize = _userHelper.PagerSize; Expression <Func <ScopoMFinance.Domain.Models.Branch, object> > orderBy = null; switch (sortCol) { case 0: default: orderBy = x => x.Name; break; case 1: orderBy = x => x.OpenDate; break; case 2: orderBy = x => x.IsHeadOffice; break; case 3: orderBy = x => x.IsActive; break; case 4: orderBy = x => x.Organizations.Count(o => o.IsActive); break; case 5: orderBy = x => x.Employees.Count(e => e.IsActive && e.IsCreditOfficer); break; case 6: orderBy = x => x.Components.Count(p => p.IsActive); break; case 7: orderBy = x => x.UserBranches.Count(u => u.UserProfile.IsActive); break; } PList <BranchListViewModel> branchList = _branchService.GetBranchList(index, pageSize, orderBy, sortDir); if (branchList != null) { string urlFormat = "/HO/Branch?index={0}"; branchList.Pager.URLFormat = urlFormat; } return(View(branchList)); }
public void PartialNameMute(ref ConsoleSystem.Arg Arguments, int id) { var pl = Fougerite.Server.Cache[Arguments.argUser.userID]; if (id == 0) { pl.MessageFrom(Core.Name, yellow + "☢" + green + "Cancelled!"); return; } PList list = (PList)Core.muteWaitList[pl.UID]; MutePlayer(list.PlayerList[id], pl); }
public static PList <T> read(BinaryReader binaryReader) { PList <T> newObj = new PList <T>(); var startPosition = binaryReader.BaseStream.Position; uint numElements = binaryReader.ReadUInt32(); for (int i = 0; i < numElements; ++i) { newObj.list.Add(Util.readers[typeof(T)](binaryReader)); } newObj.Length = (int)(binaryReader.BaseStream.Position - startPosition); return(newObj); }
public static PlayerDescription read(BinaryReader binaryReader) { PlayerDescription newObj = new PlayerDescription(); newObj.CACQualities = CACQualities.read(binaryReader); newObj.PlayerModule = CM_Character.PlayerModule.read(binaryReader); Util.readToAlign(binaryReader); newObj.clist = PList <ContentProfile> .read(binaryReader); newObj.ilist = PList <InventoryPlacement> .read(binaryReader); return(newObj); }
public void PartialNameAddFriend(ref ConsoleSystem.Arg Arguments, int id) { var pl = Fougerite.Server.Cache[Arguments.argUser.userID]; if (id == 0) { pl.MessageFrom(Core.Name, "Cancelled!"); return; } PList list = (PList)Core.friendWaitList[pl.UID]; AddFriend(list.PlayerList[id], pl); }
public void PartialNameWhitelist(ref ConsoleSystem.Arg Arguments, int id) { if (Core.whiteWaitList.Contains(Arguments.argUser.userID)) { if (id == 0) { Util.sayUser(Arguments.argUser.networkPlayer, Core.Name, "Cancelled!"); return; } PList list = (PList)Core.whiteWaitList[Arguments.argUser.userID]; Whitelist(list.PlayerList[id], Arguments.argUser); } }
public void PartialNameDoorShare(ref ConsoleSystem.Arg Arguments, int id) { var pl = Fougerite.Server.Cache[Arguments.argUser.userID]; if (id == 0) { pl.SendClientMessage("¡Share Cancelado!"); return; } PList list = (PList)Core.shareWaitList[pl.UID]; DoorShare(list.PlayerList[id], pl); }
public void PartialNameUnfriend(ref ConsoleSystem.Arg Arguments, int id) { var pl = Fougerite.Server.Cache[Arguments.argUser.userID]; if (id == 0) { pl.SendClientMessage("¡Comando cancelado!"); return; } PList list = (PList)Core.unfriendWaitList[pl.UID]; Unfriend(list.PlayerList[id], pl); }
private void AddChild(IRenderObject child) { if (children == null) { children = new PList <IRenderObject>(); children.Init(); } children.AddTail(child); if (this.gameObject != null && child.gameObject != null) { child.gameObject.transform.parent = this.gameObject.transform; } }
public void Recursion_Deep_SubclassArray_WithEmpty_Test() { var byteArray = Encoding.ASCII.GetBytes(Resources.PList6); var stream = new MemoryStream(byteArray); var node = PList.Load(stream); var d = new Deserializer(); var res = d.Deserialize <ClassWithSameTypes>(node); Assert.IsNotNull(res.ArraySameType); Assert.AreEqual("0", res.ArraySameType[0].Id); Assert.AreEqual("1", res.ArraySameType[1].Id); Assert.AreEqual("10", res.ArraySameType[1].ArraySameType[0].Id); Assert.AreEqual("11", res.ArraySameType[1].ArraySameType[1].Id); }
internal static PListDictionary GetSupportedLanguages() { if (_languageList != null) { return(_languageList); } PList plist = LoadResourcePlist("Resources/Languages.plist"); if (plist != null) { _languageList = plist.Root; } return(_languageList); }
public ActionResult AddFromDetail(int id, int?no, int?by) { using (SmartShoppingEntities db = new SmartShoppingEntities()) { if (User.Identity.IsAuthenticated) { string aspid = User.Identity.GetUserId(); MemberID = db.Members.Where(m => m.Id == aspid).Select(m => m.Member_ID).First(); } //存到我的購物清單 int plistID = db.PList.Where(m => m.Member_ID == MemberID && m.ListName == "我的購物清單").Select(p => p.PList_ID).FirstOrDefault(); if (plistID == 0)//幫他創一個 { PList pl = new PList(); pl.Member_ID = MemberID; pl.ListName = "我的購物清單"; pl.PList_ID = db.PList.Max(m => m.PList_ID) + 1; plistID = pl.PList_ID; db.Entry(pl).State = EntityState.Added; } ShoppingList sl = new Models.ShoppingList(); sl.PList_ID = plistID; sl.Products = db.Products.Where(p => p.Product_ID == id).First(); sl.RepeatNumber = no; sl.RepeatBy = by; sl.ListName = sl.Products.Categories.CategoryName; sl.Active = true; if (no != 0) { if (by == 1)//月 { sl.NextDate = DateTime.Today.AddMonths((int)no); } else if (by == 2)//周 { sl.NextDate = DateTime.Today.AddDays((int)(7 * no)); } else if (by == 3)//日 { sl.NextDate = DateTime.Today.AddDays((int)no); } } db.Entry(sl).State = EntityState.Added; db.SaveChanges(); return(Content(sl.Products.ProductName + "已加入您的智慧清單")); } }
public PList intersect(PList p1, PList p2) { PList result = new PList(new int[0], false); INode pp1 = p1.GetHead(); INode pp2 = p2.GetHead(); while (pp1 != null && pp2 != null) { ComparisonCount++; if (pp1.GetData() == pp2.GetData()) { result.add(new Node(pp1.GetData())); pp1 = pp1.Next(); pp2 = pp2.Next(); } else if (pp1.GetData() < pp2.GetData()) { if (pp1.HasSkip()) { ComparisonCount++; } if (pp1.HasSkip() && pp1.GetSkip().GetData() <= pp2.GetData()) //use skip { SkipCount++; pp1 = pp1.GetSkip(); } else//normal next { pp1 = pp1.Next(); } } else { if (pp2.HasSkip()) { ComparisonCount++; } if (pp2.HasSkip() && pp2.GetSkip().GetData() <= pp1.GetData()) //use skip { SkipCount++; pp2 = pp2.GetSkip(); } else//normal next { pp2 = pp2.Next(); } } } return(result); }
public static FriendData read(BinaryReader binaryReader) { FriendData newObj = new FriendData(); newObj.m_id = binaryReader.ReadUInt32(); newObj.m_online = binaryReader.ReadUInt32(); newObj.m_appearOffline = binaryReader.ReadUInt32(); newObj.m_name = PStringChar.read(binaryReader); newObj.m_friendsList = PList <uint> .read(binaryReader); newObj.m_friendOfList = PList <uint> .read(binaryReader); return(newObj); }
public async Task <TerminalTheme> Parse(StorageFile themeFile) { var stream = await themeFile.OpenStreamForReadAsync().ConfigureAwait(false); var node = PList.Load(stream) as DictionaryNode ?? throw new ParseThemeException("Root node was not a dictionary."); return(new TerminalTheme { Name = Path.GetFileNameWithoutExtension(themeFile.Name), Colors = GetColors(node), Id = Guid.NewGuid(), PreInstalled = false }); }
public void WhenParsingBinaryDocumentWithSingleDictionary_ThenItIsParsedCorrectly() { using (var stream = TestFileHelper.GetTestFileStream("TestFiles/asdf-Info-bin.plist")) { var node = PList.Load(stream); Assert.IsNotNull(node); var dictionary = node as DictionaryNode; Assert.IsNotNull(dictionary); Assert.AreEqual(14, dictionary.Count); } }
public void Constructor_should_rethrow_any_exception_if_an_exception_is_thrown_internally() { using (new IndirectionsContext()) { // Arrange PList <RicePaddy> . ExcludeGeneric(). IncludeAddT(). DefaultBehavior = IndirectionBehaviors.NotImplemented; // Act, Assert ExceptionAssert.Throws <NotImplementedException>(() => new Village()); } }
public void PartialNameWhitelist(ref ConsoleSystem.Arg Arguments, int id) { var pl = Fougerite.Server.Cache[Arguments.argUser.userID]; if (Core.whiteWaitList.Contains(pl.UID)) { if (id == 0) { pl.MessageFrom(Core.Name, "Cancelled!"); return; } PList list = (PList)Core.whiteWaitList[pl.UID]; Whitelist(list.PlayerList[id], pl); } }
public bool Eat(Point food) { Point head = new Point(PList[PList.Count - 1]); if (head.IsHit(food)) { food.Sym = head.Sym; PList.Add(food); return(true); } else { return(false); } }
public void Clear() { for (int i = 0; i < socket_size_; i++) { PList head = list_[i]; for (PListNode pos = head.next; pos != head; pos = pos.next) { TimerEventObject obj = (TimerEventObject)pos; obj.enable = 0; obj.proc = null; obj.obj = null; } head.Init(); } }
public void ReadingFile_With_UID_Field_Fail() { using (var stream = TestFileHelper.GetTestFileStream("TestFiles/uid-test.plist")) { try { var node = PList.Load(stream); Assert.Pass(); } catch (PListFormatException ex) { Assert.Fail(ex.Message); } } }
public void WhenReadingUid_UidNodeIsParsed() { using (var stream = TestFileHelper.GetTestFileStream("TestFiles/github-7-binary.plist")) { try { var node = PList.Load(stream); Assert.Pass(); } catch (PListFormatException ex) { Assert.Fail(ex.Message); } } }
public IBlackboardList <T> List <T>(int index) { if (!IsValid <T>(index, true)) { return(null); } var p = mProperties[index]; if (p == null) { p = new PList <T>(); mProperties[index] = p; } return((IBlackboardList <T>)p); }
public static HouseData read(BinaryReader binaryReader) { HouseData newObj = new HouseData(); newObj.m_buy_time = binaryReader.ReadInt32(); newObj.m_rent_time = binaryReader.ReadInt32(); newObj.m_type = (HouseType)binaryReader.ReadUInt32(); newObj.m_maintenance_free = binaryReader.ReadUInt32(); newObj.m_buy = PList <HousePayment> .read(binaryReader); newObj.m_rent = PList <HousePayment> .read(binaryReader); newObj.m_pos = Position.read(binaryReader); return(newObj); }
public static BookDataResponse read(BinaryReader binaryReader) { BookDataResponse newObj = new BookDataResponse(); newObj.i_bookID = binaryReader.ReadUInt32(); newObj.i_maxNumPages = binaryReader.ReadInt32(); newObj.numPages = binaryReader.ReadUInt32(); newObj.maxNumCharsPerPage = binaryReader.ReadUInt32(); newObj.pageData = PList <PageData> .read(binaryReader); newObj.inscription = PStringChar.read(binaryReader); newObj.authorId = binaryReader.ReadUInt32(); newObj.authorName = PStringChar.read(binaryReader); return(newObj); }
public void ReadingFile_GitHub_Issue9_Fail() { using (var stream = TestFileHelper.GetTestFileStream("TestFiles/github-9.plist")) { try { var node = PList.Load(stream); Assert.Pass(); } catch (PListFormatException ex) { Assert.Fail(ex.Message); } } }
public void ReadingFile_With_16bit_Integers_Fail() { using (var stream = TestFileHelper.GetTestFileStream("TestFiles/unity.binary.plist")) { try { var node = PList.Load(stream); Assert.Pass(); } catch (PListFormatException ex) { Assert.Fail(ex.Message); } } }
public void PartialNameKill(ref ConsoleSystem.Arg Arguments, int id) { if (id == 0) { Util.sayUser(Arguments.argUser.networkPlayer, Core.Name, "Cancelled!"); return; } PList list = (PList)Core.killWaitList[Arguments.argUser.userID]; PlayerClient client; if (PlayerClient.FindByUserID(list.PlayerList[id].UserID, out client)) { KillPlayer(client, Arguments.argUser.playerClient); } }
//------------------------------------------------------------------------------------- /// <summary> /// Инициализирующий конструктор. /// </summary> /// <param name="items">Отображаемые элементы.</param> /// <param name="checkedItems">Выбраные элементы</param> public SimCheckList(IEnumerable items, IEnumerable checkedItems) : this() { if (items == null) throw new ArgumentNullException("items"); list = new PList<ValuesPair<bool, object>>(); foreach (var x in items) { ValuesPair<bool, object> i = new ValuesPair<bool, object>(false, x); i.Value1 = checkedItems != null && checkedItems.Contains(x); list.Add(i); } ListBinder b = new ListBinder(list); fdgv.DataSource = b; }
/// <summary> /// Import a Preset /// </summary> public void PresetImport() { VistaOpenFileDialog dialog = new VistaOpenFileDialog { Filter = "Plist (*.plist)|*.plist", CheckFileExists = true }; dialog.ShowDialog(); string filename = dialog.FileName; if (!string.IsNullOrEmpty(filename)) { PList plist = new PList(filename); Preset preset = PlistPresetFactory.CreatePreset(plist); if (this.presetService.CheckIfPresetExists(preset.Name)) { if (!presetService.CanUpdatePreset(preset.Name)) { MessageBox.Show( "You can not import a preset with the same name as a built-in preset.", "Error", MessageBoxButton.OK, MessageBoxImage.Error); return; } MessageBoxResult result = MessageBox.Show( "This preset appears to already exist. Would you like to overwrite it?", "Overwrite preset?", MessageBoxButton.YesNo, MessageBoxImage.Warning); if (result == MessageBoxResult.Yes) { presetService.Update(preset); } } else { presetService.Add(preset); } this.NotifyOfPropertyChange(() => this.Presets); } }
//------------------------------------------------------------------------------------- private void btnSave_Click(object sender, EventArgs e) { try { OID sd = (OID)fdgvACL.Tag; PList<ACE> list = new PList<ACE>(ACL.Count); foreach(ACEitem i in ACL) list.Add(i.ACE); if(pSec.ACEs.ContainsKey(sd)) foreach(ACE i in pSec.ACEs[sd]) if(at != null && at.Contains(i.SID) == false) list.Add(i); ShowProgressWindow(); PulsarQuery q = new PulsarQuery("Security", "SetACEsForSD", new { SetACEsForSD = new Object[] { sd, list } }, PulsarQueryParams.Modify); TaskManager.Run("SetACEsForSD",this,()=> PulsarConnection.Default.Exec(q), new ValuesPair<OID, PList<ACE>>(sd, list)); } catch(Exception Err) { ModalErrorBox.Show(Err, PanelBack); HideProgressWindow(); } }
public Dictionary<string, dynamic> RequestBatteryInfo() { Dictionary<string, dynamic> battInfo = new Dictionary<string, dynamic>(); PList gasGaugeInfo = RequestDiagnostics()["GasGauge"]; battInfo = gasGaugeInfo; PList battDomainInfo = new PList(RequestProperties("com.apple.mobile.battery"), true); battDomainInfo.ToList().ForEach(x => battInfo.Add(x.Key, x.Value)); return gasGaugeInfo; }
//------------------------------------------------------------------------------------- /// <summary> /// Добавление дочерних групп /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnChildGroupAdd_Click(object sender, EventArgs e) { try { if(fdgvGroups.SelectedRows.Count == 0) return; SecurityGroup cur = (SecurityGroup)((IKeyedValue)fdgvGroups.SelectedRows[0].GetData()).Value; PList<SecurityItem> list = new PList<SecurityItem>(); foreach(SecurityGroup g in psec.SecurityGroups.Values) if(!(g == cur || parentsList.FirstOrDefault(x => x.SID == g.SID) != null || childsList.FirstOrDefault(x => x.SID == g.SID) != null)) list.Add(SecurityItem.FromGroup(g)); SimModalMultiChoiceBox frm = new SimModalMultiChoiceBox(); frm.Parent = PanelBack; frm.DialogClosed += new DialogClosedEventHandler(SimModalMultiChoiceBox_DialogClosed); frm.Tag = 2; frm.CaptionImage = global::Sim.AdminForms.Properties.Resources.Group; frm.CaptionText = "Добавление дочерних групп"; frm.VariantsCaption = "Доступные группы"; frm.ChoicesCaption = "Выбранные группы"; frm.Variants = new ListBinder(list); frm.Show(); } catch(Exception Err) { Sim.Controls.ModalErrorBox.Show(Err, PanelBack); } }
//------------------------------------------------------------------------------------- private void btnAddGroups_Click(object sender, EventArgs e) { try { PList<SecurityItem> list = new PList<SecurityItem>(); foreach(SecurityGroup g in pSec.SecurityGroups.Values) { bool need = true; foreach(ACEitem i in ACL) if(i.ACE.SID == g.SID) { need = false; break; } if(need) list.Add(SecurityItem.FromGroup(g)); } SimModalMultiChoiceBox frm = new SimModalMultiChoiceBox(); frm.Parent = PanelBack; frm.DialogClosed += new DialogClosedEventHandler(SimModalMultiChoiceBox_DialogClosed); frm.CaptionImage = global::Sim.AdminForms.Properties.Resources.Group; frm.CaptionText = "Добавление групп"; frm.VariantsCaption = "Доступные группы"; frm.ChoicesCaption = "Выбранные группы"; frm.Variants = new ListBinder(list); frm.Show(); } catch(Exception Err) { Sim.Controls.ModalErrorBox.Show(Err, PanelBack); } }
public PList RequestDiagnostics() { IntPtr currDevice = this.iPhoneHandle; IntPtr ldService; IntPtr lockdownClient; Lockdown.LockdownError lockdownReturnCode = Lockdown.Start(currDevice, out lockdownClient, out ldService); IntPtr diagClient; IntPtr diagService; iDiagnostics.diagnostics_relay_error_t ide = iDiagnostics.diagnostics_relay_client_start_service(currDevice, out diagClient, out diagService); IntPtr resultPlist; ide = iDiagnostics.diagnostics_relay_request_diagnostics(diagClient, "All", out resultPlist); XDocument xd = LibiMobileDevice.PlistToXml(resultPlist); PList pl = new PList(xd, true); iDiagnostics.diagnostics_relay_client_free(diagClient); Lockdown.FreeClient(lockdownClient); Lockdown.FreeService(ldService); return pl; }
public bool QueryDeveloperDisk() { bool ret = false; this.developer = false; IntPtr currDevice = this.iPhoneHandle; IntPtr ldService; IntPtr lockdownClient; Lockdown.LockdownError lockdownReturnCode = Lockdown.Start(currDevice, out lockdownClient, out ldService); if (!(lockdownReturnCode == Lockdown.LockdownError.LOCKDOWN_E_SUCCESS)) return false; IntPtr ddservice; IntPtr ddclient; Lockdown.LockdownError lde = Lockdown.lockdownd_start_service(lockdownClient, "com.apple.mobile.mobile_image_mounter", out ddservice); if (!(lde == Lockdown.LockdownError.LOCKDOWN_E_SUCCESS)) return false; ImageMounter.mobile_image_mounter_error_t dde = ImageMounter.mobile_image_mounter_new(currDevice, ddservice, out ddclient); if (!(dde == ImageMounter.mobile_image_mounter_error_t.MOBILE_IMAGE_MOUNTER_E_SUCCESS)) return false; string imageType = "Developer"; IntPtr resultPlist; dde = ImageMounter.mobile_image_mounter_lookup_image(ddclient, imageType, out resultPlist); if (!(dde == ImageMounter.mobile_image_mounter_error_t.MOBILE_IMAGE_MOUNTER_E_SUCCESS)) return false; ImageMounter.mobile_image_mounter_free(ddclient); Lockdown.FreeClient(lockdownClient); Lockdown.FreeService(ldService); XDocument xd = LibiMobileDevice.PlistToXml(resultPlist); PList pl = new PList(xd, true); this.developer = ret; ret = pl.ContainsKey("ImagePresent") && pl["ImagePresent"] == true; return ret; }
public string RequestProperty(string domain, string key) { PList pl = new PList(this.RequestProperties(domain), true); return Convert.ToString(pl[key]); }
private void LoadSheetData(SheetData sheetData) { var texture = Game.Content.Load<Texture2D> (sheetData.Texture); var stream = TitleContainer.OpenStream(sheetData.PList); #if __IOS__ PlistDocument pinfo = new PlistDocument(stream); PlistDictionary frames = pinfo.Root.AsDictionary["frames"].AsDictionary; foreach (var frame in frames) { string spriteName = frame.Key.Split('.')[0]; string texRect = frame.Value.AsDictionary["frame"].AsString; var sp = new Sprite2D (spriteName, texture, RectangleFromString (texRect), sheetData.FrameWidth, sheetData.FrameHeight); m_sprites.Add (spriteName, sp); } #else PList pinfo = new PList (stream); PList frames = pinfo ["frames"] as PList; foreach (var frmName in frames.Keys) { PList frame = frames [frmName] as PList; string texRect = frame ["frame"] as string; string spriteName = frmName.Split('.')[0]; var sp = new Sprite2D (spriteName, texture, RectangleFromString (texRect), sheetData.FrameWidth, sheetData.FrameHeight); m_sprites.Add (spriteName, sp); } #endif }
public bool ConnectViaHouseArrest(string appId) { bool ret; IntPtr currDevice = this.iPhoneHandle; IntPtr ldService; IntPtr lockdownClient; Lockdown.LockdownError lockdownReturnCode = Lockdown.Start(currDevice, out lockdownClient, out ldService); IntPtr hHA; IntPtr hSvc; HouseArrest.house_arrest_error_t hea = HouseArrest.house_arrest_client_start_service(currDevice, out hHA, out hSvc); hea = HouseArrest.house_arrest_send_command(hHA, "VendDocuments", appId); IntPtr result; hea = HouseArrest.house_arrest_get_result(hHA, out result); XDocument har = LibiMobileDevice.PlistToXml(result); PList pl = new PList(har, true); if (pl.ContainsKey("Error")) { ret = false; } else { IntPtr HA_afc; HouseArrest.afc_error_t afce = HouseArrest.afc_client_new_from_house_arrest_client(hHA, out HA_afc); ret = afce == HouseArrest.afc_error_t.AFC_E_SUCCESS; if (ret) this.hAFC = HA_afc; } HouseArrest.house_arrest_client_free(hHA); Lockdown.FreeService(ldService); Lockdown.FreeClient(lockdownClient); return ret; }
//------------------------------------------------------------------------------------- /// <summary> /// Добавление пользователей в группу /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnChildUserAdd_Click(object sender, EventArgs e) { try { if(fdgvGroups.SelectedRows.Count == 0) return; SecurityGroup cur = (SecurityGroup)((IKeyedValue)fdgvGroups.SelectedRows[0].GetData()).Value; PList<SecurityItem> list = new PList<SecurityItem>(); foreach(Person u in users) if(childsList.FirstOrDefault(x => x.SID == u.OID) == null) list.Add(SecurityItem.FromUser(u)); SimModalMultiChoiceBox frm = new SimModalMultiChoiceBox(); frm.Parent = PanelBack; frm.DialogClosed += new DialogClosedEventHandler(SimModalMultiChoiceBox_DialogClosed); frm.Tag = 2; frm.CaptionImage = global::Sim.AdminForms.Properties.Resources.User; frm.CaptionText = "Добавление пользователей"; frm.VariantsCaption = "Доступные пользователи"; frm.ChoicesCaption = "Выбранные пользователи"; frm.Variants = new ListBinder(list); frm.Show(); } catch(Exception Err) { Sim.Controls.ModalErrorBox.Show(Err, PanelBack); } }
//------------------------------------------------------------------------------------- private void btnAddUsers_Click(object sender, EventArgs e) { try { PList<SecurityItem> list = new PList<SecurityItem>(); foreach(Person u in users) { bool need = true; foreach(ACEitem i in ACL) if(i.ACE.SID == u.OID) { need = false; break; } if(need) list.Add(SecurityItem.FromUser(u)); } SimModalMultiChoiceBox frm = new SimModalMultiChoiceBox(); frm.Parent = PanelBack; frm.DialogClosed += new DialogClosedEventHandler(SimModalMultiChoiceBox_DialogClosed); frm.Tag = 2; frm.CaptionImage = global::Sim.AdminForms.Properties.Resources.User; frm.CaptionText = "Добавление пользователей"; frm.VariantsCaption = "Доступные пользователи"; frm.ChoicesCaption = "Выбранные пользователи"; frm.Variants = new ListBinder(list); frm.Show(); } catch(Exception Err) { Sim.Controls.ModalErrorBox.Show(Err, PanelBack); } }
public void LoadTheme(string themeName, string variantName) { if (this.ChatHandler == null) { throw new InvalidOperationException("Set ChatHandler first"); } string themeDirectory = System.IO.Path.Combine(ThemesDirectory, themeName) + ".AdiumMessageStyle"; if (!Directory.Exists(themeDirectory)) { throw new DirectoryNotFoundException(themeDirectory); } m_StylePath = Util.JoinPath(themeDirectory, "Contents", "Resources"); string plistPath = Util.JoinPath(themeDirectory, "Contents", "Info.plist"); // XXX: Add additional checks for other required files. if (!File.Exists(plistPath)) { throw new Exception("Missing required theme file: Info.plist"); } m_StyleInfo = new PList(plistPath); // Default Behavior m_AllowsCustomBackground = true; m_AllowsUserIcons = true; m_StyleVersion = m_StyleInfo.GetInt("MessageViewVersion"); // Pre-fetch our templates LoadTemplates(); // Style flags m_AllowsCustomBackground = !m_StyleInfo.Get<bool>("DisableCustomBackground"); m_TransparentDefaultBackground = m_StyleInfo.Get<bool>("DefaultBackgroundIsTransparent"); if (m_TransparentDefaultBackground) { // FIXME: Console.WriteLine("Transparent background not supported"); } m_CombineConsecutive = !m_StyleInfo.Get<bool>("DisableCombineConsecutive"); if (m_StyleInfo.ContainsKey("ShowsUserIcons")) { m_AllowsUserIcons = m_StyleInfo.Get<bool>("ShowsUserIcons"); } // User icon masking var maskName = m_StyleInfo.Get<string>("ImageMask"); if (!String.IsNullOrEmpty(maskName)) { // FIXME: Console.WriteLine("ImageMask not supported"); } m_AllowsColors = m_StyleInfo.Get<bool>("AllowTextColors"); if (!m_AllowsColors) { Console.WriteLine("AllowTextColors not supported"); } // FIXME: Need to selectively show certain actions depending on what's under the cursor. //this.AddAction(this.PageAction(QWebPage.WebAction.OpenLink)); //this.AddAction(this.PageAction(QWebPage.WebAction.CopyLinkToClipboard)); //this.AddAction(this.PageAction(QWebPage.WebAction.CopyImageToClipboard)); //this.AddSeparator(); QAction copyAction = this.PageAction(QWebPage.WebAction.Copy); copyAction.SetShortcuts(QKeySequence.StandardKey.Copy); this.AddAction(copyAction); this.AddAction(this.PageAction(QWebPage.WebAction.InspectElement)); // Create the base template string baseUri = "file://" + m_StylePath + "/"; string mainCssPath = "main.css"; string variantCssPath = PathForVariant(variantName); var formattedBaseTemplate = FormatBaseTemplate(baseUri, mainCssPath, variantCssPath); base.Page().MainFrame().SetHtml(formattedBaseTemplate, themeDirectory); QObject.Connect(this.Page().MainFrame(), Qt.SIGNAL("javaScriptWindowObjectCleared()"), HandleJavaScriptWindowObjectCleared); if (ConversationWidget.ThemesDirectory == null) { throw new Exception("Set ThemesDirectory first"); } this.ContextMenuPolicy = ContextMenuPolicy.ActionsContextMenu; this.Page().linkDelegationPolicy = QWebPage.LinkDelegationPolicy.DelegateAllLinks; QObject.Connect<QUrl>(this, Qt.SIGNAL("linkClicked(QUrl)"), HandleLinkClicked); m_ThemeLoaded = true; HandleJavaScriptWindowObjectCleared(); }
/// <summary> /// Import a Preset /// </summary> public void PresetImport() { OpenFileDialog dialog = new OpenFileDialog() { Filter = "Plist (*.plist)|*.plist", CheckFileExists = true }; dialog.ShowDialog(); string filename = dialog.FileName; if (!string.IsNullOrEmpty(filename)) { PList plist = new PList(filename); object build; plist.TryGetValue("PresetBuildNumber", out build); string buildNumber = build as string; if (buildNumber == null) { MessageBox.Show( Resources.Preset_UnableToImport_Message, Resources.Preset_UnableToImport_Header, MessageBoxButton.YesNo, MessageBoxImage.Question); return; } if (buildNumber != userSettingService.GetUserSetting<int>(UserSettingConstants.HandBrakeBuild).ToString(CultureInfo.InvariantCulture)) { MessageBoxResult result = MessageBox.Show( Resources.Preset_OldVersion_Message, Resources.Preset_OldVersion_Header, MessageBoxButton.YesNo, MessageBoxImage.Question); if (result == MessageBoxResult.No) { return; } } Preset preset = PlistPresetFactory.CreatePreset(plist); if (this.presetService.CheckIfPresetExists(preset.Name)) { if (!presetService.CanUpdatePreset(preset.Name)) { MessageBox.Show(Resources.Main_PresetErrorBuiltInName, Resources.Error, MessageBoxButton.OK, MessageBoxImage.Error); return; } MessageBoxResult result = MessageBox.Show(Resources.Main_PresetOverwriteWarning, Resources.Overwrite, MessageBoxButton.YesNo, MessageBoxImage.Warning); if (result == MessageBoxResult.Yes) { presetService.Update(preset); } } else { presetService.Add(preset); } this.NotifyOfPropertyChange(() => this.Presets); } }