public void Replace() { Assert.AreEqual(_People.Count, 0); _People.Replace(_Bob, _Jane); Assert.AreEqual(_People.Count, 1); Assert.AreEqual(_People[0].ID, 2); _People.Replace(_Jane, _Bob); Assert.AreEqual(_People.Count, 1); Assert.AreEqual(_People[0].ID, 1); }
private void btnRaporla_Click(object sender, EventArgs e) { try { HesapHareketTuru?turu = null; turu = HareketTipiniBelirle(turu); hareketList = mngHesap.GetHesapNoWithDate(UserInfo.Sube.Id, txtHesapNo.Text, dateTimeStart.Value.JustDate(), dateTimeFinish.Value.JustDate(), turu); dataGridView1.Columns[clTutar.Name].DefaultCellStyle.Format = "F2"; dataGridView1.AutoGenerateColumns = false; hareketList.Replace("HareketTuru", "1", "ParaYatirma(+)"); hareketList.Replace("HareketTuru", "2", "ParaCekme(-)"); hareketList.Replace("HareketTuru", "3", "GelenHavale(+)"); hareketList.Replace("HareketTuru", "4", "GidenHavale(-)"); hareketList.Replace("HareketTuru", "5", "KrediKarti"); hareketList.Replace("HareketTuru", "6", "ÇekÖdeme"); hareketList.Replace("HareketTuru", "7", "ÇekTahsil"); hareketList.Replace("HareketTuru", "8", "SenetTahsil"); if (hareketList.Count > 0) { btnPrint.Visible = true; tslabToplamTutar.Text = hareketList.Sum(x => x.Tutar).ToString("F2"); } else { btnPrint.Visible = false; } dataGridView1.DataSource = hareketList; } catch (Exception exc) { MessageBox.Show(exc.Message); LogWrite.Write(exc); } }
//<param @arbol> Raiz del arbol de irony public string getErrores(ParseTree arbol) { String errores = ""; String cabecera = ""; if (arbol.HasErrors()) { int elementos = arbol.ParserMessages.Count; for (int x = 0; x < elementos; x++) { cabecera += "Error en " + arbol.ParserMessages[x].Location + "\t" + arbol.ParserMessages[x].Message + "\r\n---------->"; errores += "Error en: Linea" + arbol.ParserMessages[x].Location.Line + "\tColumna:" + arbol.ParserMessages[x].Location.Column + "\r\n---------->" + arbol.ParserMessages[x].Message + "@"; } } errores = errores.Replace("expected", "Se esperaba"); errores = errores.Replace("Syntax error", "Error Sintactico"); errores = errores.Replace("Invalid character", "Caracter invalido"); cabecera = cabecera.Replace("expected", "Se esperaba"); cabecera = cabecera.Replace("Syntax error", "Error Sintactico"); cabecera = cabecera.Replace("Invalid character", "Caracter invalido"); /* * ---------->Error en (9:1) Invalid character: 'x'. * ---------->Error en (12:2) Error Sintactico, Se esperaba: db * ---------->Error en (22:1) Error Sintactico, Se esperaba: > * ----------> * 8;0;Invalid character: 'x'.@11;1;Error Sintactico, Se esperaba: db@21;0;Error Sintactico, Se esperaba: >@ * */ return(cabecera + errores); }
public override void ReplacePawnReferences(Pawn replace, Pawn with) { if (pawns != null) { pawns.Replace(replace, with); } }
public async Task <PostResponseModel> Create(PostRequestModel model) { var currentPopilarity = await _unitOfWork.Repository <ApplicationUser>() .Get(u => u.Id == _userId) .Select(u => u.Popularity) .FirstOrDefaultAsync(); var lessPopularUser = await _unitOfWork.Repository <ApplicationUser>() .Get(u => Stories.Select(s => s.AuthorId).Contains(u.Id) && u.Popularity < currentPopilarity || u.Popularity <= currentPopilarity) .FirstOrDefaultAsync(); PostResponseModel response = null; response = await _story.Create(model); if (Stories.Count < 10) { Stories.Add(response); } else if (lessPopularUser != null) { Stories.Replace(Stories.OrderBy(s => s.CreationDate).FirstOrDefault(s => s.AuthorId == lessPopularUser.Id), response); } return(response); }
private void OnMenuChanged(object sender, MenuChangedEventArgs e) { // menu closed if (e.NewMenu == null) { ignoreMenuChanged = false; if (e.OldMenu is LetterViewerMenu && switchBackToCollectionsMenu) { ignoreMenuChanged = true; Game1.activeClickableMenu = savedGameMenu; } switchBackToCollectionsMenu = false; return; } // menu changed or opened if (e.NewMenu is GameMenu gameMenu && !ignoreMenuChanged) { List <IClickableMenu> pages = ModEntry.CommonServices.ReflectionHelper.GetField <List <IClickableMenu> >(gameMenu, "pages").GetValue(); if (collectionsPageTabIndex == -1) { collectionsPageTabIndex = pages.Replace(tab => tab is CollectionsPage, new CollectionsPageEx(gameMenu.xPositionOnScreen, gameMenu.yPositionOnScreen, gameMenu.width - 64 - 16, gameMenu.height)); } else { pages[collectionsPageTabIndex] = new CollectionsPageEx(gameMenu.xPositionOnScreen, gameMenu.yPositionOnScreen, gameMenu.width - 64 - 16, gameMenu.height); } }
GameObject <R> MorphGameObject <T, R>(GameObject <T> obj, Func <T, R> morpher) { var newObject = new GameObject <R>(morpher(obj.Instance), obj.Id, obj.Owner); GameObjects.Replace(obj, newObject); return(newObject); }
public void ReplaceSkyLight(LevelSkyLight oldLight, LevelSkyLight newLight) { lock (instanceMutationLock) { skyLights.Replace(oldLight, newLight); ResetSkyLight(oldLight); ResetSkyLight(newLight); } }
public void ReplaceWithNullFuncThrows() { var seq = new List<object> { new object(), new object() }; var dummyValue = new object(); Assert.Throws<ArgumentNullException>( () => seq.Replace( dummyValue, (Func<object, bool>)null).ToList()); }
/// <summary>Modifies an existing contact in the database.</summary> /// <param name="originalContact">Contact to be modified</param> /// <param name="newContact">Contact with modifications</param> public static async Task <bool> ModifyContact(Contact originalContact, Contact newContact) { if (await DatabaseInteraction.ModifyContact(originalContact, newContact)) { AllContacts.Replace(originalContact, newContact); return(true); } return(false); }
/// <summary>Modifies a passed <see cref="Student"/> on disk.</summary> /// <param name="oldStudent">Old <see cref="Student"/></param> /// <param name="newStudent">New <see cref="Student"/></param> public static void ModifyStudent(Student oldStudent, Student newStudent) { if (oldStudent.Id != newStudent.Id) { JSONInteraction.DeleteStudent(oldStudent); } JSONInteraction.WriteStudent(newStudent); AllStudents.Replace <Student>(oldStudent, newStudent); }
public void ReplaceEntity(LevelGeometryEntity existing, LevelGeometryEntity replacement) { Assure.NotNull(existing); Assure.NotNull(replacement); lock (instanceMutationLock) { Assure.True(this.levelGeometryEntities.Contains(existing)); levelGeometryEntities.Replace(existing, replacement); } }
public static void Replace <T>(this List <T> list, T replaced, T replacer) { var nextList = new List <T>(); foreach (var item in list) { nextList.Add(item.Equals(replaced) ? replacer : item); } list.Replace(nextList); }
public void AddConfiguration2(Span <int> configuration) { UncoveredIntervals = UncoveredIntervals.Replace( x => x.IsOverlapOf(configuration), x => x.RemoveInterval(configuration)) .ToList(); Configurations.Add(configuration); }
/// <summary>Modifies a <see cref="Series"/> in the database.</summary> /// <param name="oldSeries">Original <see cref="Series"/></param> /// <param name="newSeries"><see cref="Series"/> to replace original</param> /// <returns>True if successful</returns> public static async Task <bool> ModifySeries(Series oldSeries, Series newSeries) { if (await DatabaseInteraction.ModifySeries(oldSeries, newSeries)) { AllSeries.Replace(oldSeries, newSeries); return(true); } DisplayNotification("Unable to modify television series.", "Personal Tracker"); return(false); }
internal static async Task UpdateUserAsync(User user) { if (UseBackend.Backend) { var userJson = JsonConvert.SerializeObject(user); HttpClient client = new HttpClient(); var res = await client.PutAsync(String.Format("{0}/{1}", POSTString, user.Id), new StringContent(userJson, System.Text.Encoding.UTF8, "application/json")); } _users.Replace(u => u.Id.Equals(user.Id), user); }
public void ReplaceTests_02() { // Arrange var list = new List <int>() { 1, 2, 3 }; // Act Assert.Throws <ArgumentOutOfRangeException>(() => list.Replace(10, 5)); }
public void PassPawnToDeadMercenaries(Mercenary merc) { //If ever add past dead pawns, use this code /*MilitaryCustomizationUtil util = Find.World.GetComponent<FactionFC>().militaryCustomizationUtil; * Mercenary pwn = new Mercenary(true); * if (merc.animal != null) * { * Mercenary animal = new Mercenary(true); * animal = merc.animal; * util.deadPawns.Add(animal); * } * pwn = merc;*/ //util.deadPawns.Add(pwn); Mercenary pawn2 = new Mercenary(true); createNewPawn(ref pawn2, merc.pawn.kindDef); mercenaries.Replace(merc, pawn2); }
public void RefreshStats() { if (addPanel.activeSelf == true) { ToggleAddStat(); } foreach (GameObject stat in GameObject.FindGameObjectsWithTag("StatType")) { StatType statType = stat.GetComponent <StatType>(); Stat statStage = new Stat(); if (statType.statName != null) { statStage = new Stat(statType.statName.text, statType.statValue.text); } else { statStage = new Stat("header", statType.statValue.text); } newStats.Replace(statType.statIndex, statStage); Destroy(stat); } int index = 0; foreach (Stat stat in newStats) { if (stat.name.ToLower() == "header") { StatType field = Instantiate(headerTemplate, scrollView).GetComponent <StatType>(); field.name = stat.name; field.statValue.text = stat.value; field.statIndex = index; } else { StatType field = Instantiate(fieldTemplate, scrollView).GetComponent <StatType>(); field.name = stat.name; field.statName.text = stat.name; field.statValue.text = stat.value; field.statIndex = index; } index++; } }
internal void AddRegistry(BlueprintRegistry registry) { _customBlueprints.AddRange(registry._customBlueprints); foreach (var map in registry._typeMap) { _typeMap[map.Key] = map.Value; } _ctorStrategy = registry._ctorStrategy ?? _ctorStrategy ?? Extensions.GreedyCtor; _defaultBlueprints.Replace(typeof(NonEmptyCtorBlueprint), new NonEmptyCtorBlueprint(_typeMap, _ctorStrategy)); }
public int Search(string [] input, string search) { string output; for (int i = 0; i < input.Length; i++) { if (input[i].Contains(search)) { output = input[i].Replace(search, ""); output = output.Replace("=", ""); return(Int32.Parse(output)); } } return(-69); }
private void MenuEvents_MenuChanged(object sender, EventArgsClickableMenuChanged e) { if (e.NewMenu is GameMenu gameMenu && !ignoreMenuChanged) { List <IClickableMenu> pages = ModEntry.CommonServices.ReflectionHelper.GetField <List <IClickableMenu> >(gameMenu, "pages").GetValue(); if (collectionsPageTabIndex == -1) { collectionsPageTabIndex = pages.Replace(tab => tab is CollectionsPage, new CollectionsPageEx(gameMenu.xPositionOnScreen, gameMenu.yPositionOnScreen, gameMenu.width - 64 - 16, gameMenu.height)); } else { pages[collectionsPageTabIndex] = new CollectionsPageEx(gameMenu.xPositionOnScreen, gameMenu.yPositionOnScreen, gameMenu.width - 64 - 16, gameMenu.height); } }
public static void Deduplicate <T>(this List <T> list, Func <T, T, bool> compare) { var deduped = new List <T>(); foreach (var item in list) { if (!deduped.Exists(other => { var compared = compare(item, other); return(compared); })) { deduped.Add(item); } } list.Replace(deduped); }
public void ReplaceTests_01() { // Arrange var list = new List <int>() { 1, 2, 3 }; // Act list.Replace(2, 5); // Assert Assert.Equal(new List <int> { 1, 5, 3 }, list); }
string ProcessExpression(string expression) { Dictionary <char, char> replaceDictionary = new Dictionary <char, char> { { '∨', '|' }, { '∧', '&' }, { '⇒', '>' }, { '⊕', '^' }, { '⇔', '=' }, { '¬', '!' } }; foreach (var(key, value) in replaceDictionary.Select(x => (x.Key, x.Value))) //КТО СЛОМАЛ ДЕКОНСТРУКЦИЮ КОРТЕЖЕЙЙ { expression = expression.Replace(key, value); } return(expression.Replace("true", "1").Replace("false", "0").Replace("True", "1").Replace("False", "0")); }
public TreeNode[] GetLeaves() { List <TreeNode> Leaves = new List <TreeNode>(); Leaves.Add(Root); Repeat: for (int i = 0; i < Leaves.Count; i++) { if (Leaves[i].HasChildren) { Leaves.Replace(Leaves[i], Leaves[i].Children); goto Repeat; } } return(Leaves.ToArray()); }
private void TestList(List <String> Values, String Old, String New) { List <String> Temp = Values.Copy(); Temp.Replace(Old, New); if (Values.Count != Temp.Count) { Assert.Fail("Count amount seems to change"); } for (Int32 I = 0; I < Values.Count; I++) { if (Values[I].Replace(Old, New) != Temp[I]) { Assert.Fail("Replacement failed"); } } }
public ReadOnlyCollection <PatientWithStatus> Process(ReadOnlyCollection <PatientWithStatus> currentState) { var ret = new List <PatientWithStatus>(); ret.AddRange(currentState); if (currentState.None(p => p.PatientId.Equals(PatientId))) { ret.Add(new PatientWithStatus(PatientId, CheckInStatus, Timestamp)); return(ret.AsReadOnly()); } var target = ret.First(p => p.PatientId.Equals(PatientId)); var updated = new PatientWithStatus(PatientId, CheckInStatus, Timestamp); ret.Replace(target, updated); return(ret.AsReadOnly()); }
public void test_replacing_element_with_list_of_elements() { // Arrange var list = new List <int>() { 1, 2, 3, 4, 5, 6, 7, 8, 9 }; var newValues = new List <int> { 100, 200 }; // Act list.Replace(4, newValues); // Assert Assert.AreEqual(new List <int>() { 1, 2, 3, 100, 200, 5, 6, 7, 8, 9 }, list); }
internal async Task UpdateCompanyAsync(Company company) { if (UseBackend.Backend) { var companyJson = JsonConvert.SerializeObject(company); HttpClient client = new HttpClient(); var res = await client.PutAsync(String.Format("{0}/{1}", POSTString, company.Id), new StringContent(companyJson, System.Text.Encoding.UTF8, "application/json")); } else { if (new CompanyManager().GetCompanies().FindIndex(c => c.Id == company.Id) >= 0) { _companies.Replace(c => c.Id == company.Id, company); } else { _companies.Add(company); } } }
public void SaveProfile(Profile profile) { _profiles = _profiles.Distinct().ToList(); var exisitingProfile = _profiles.Where(x => x.ProfileName == profile.ProfileName).FirstOrDefault(); if (exisitingProfile != null) { _profiles.Replace(exisitingProfile, profile); } else { _profiles.Add(profile); } var jsonString = Json.SerializeToString(_profiles); using (StreamWriter newTask = new StreamWriter(fileName, false)) { newTask.WriteLine(jsonString); } }
public void setTowerChallengeInfo(TowerChallengeInfo tci, GetTowerInfoMessage msg) { TowerLevel[] tls = msg.getSortedLevels(); foreach (TowerLevel tl in tls) { if (this.triallist.ContainsKey(tl.id.ToString())) { trialding td = this.triallist[tl.id.ToString()]; Console.WriteLine("### found trial " + tl.name + " " + tl.description); string odesc = tl.description.Replace(" ", ""); odesc = odesc.Replace("\r\n", ""); odesc = odesc.Replace("\n", ""); odesc = odesc.Replace("\r", ""); string tdesc = td.odescription.Replace(" ",""); tdesc = tdesc.Replace("\r\n", ""); tdesc = tdesc.Replace("\r", ""); tdesc = tdesc.Replace("\n", ""); if (odesc != tdesc) //dont check the title! { Console.WriteLine("### dont match because of " + odesc + " " + tdesc); } string oflav = tl.flavour.Replace(" ", ""); oflav = oflav.Replace("\r\n", ""); oflav = oflav.Replace("\n", ""); oflav = oflav.Replace("\r", ""); string tflav = td.oflavour.Replace(" ", ""); tflav = tflav.Replace("\r\n", ""); tflav = tflav.Replace("\r", ""); tflav = tflav.Replace("\n", ""); if (oflav != tflav) //dont check the title! { Console.WriteLine("### dont match because of " + oflav + " " + tflav); } string oname = tl.name.Replace(" ", ""); oname = oname.Replace("\r\n", ""); oname = oname.Replace("\n", ""); oname = oname.Replace("\r", ""); string tname = td.oname.Replace(" ", ""); tname = tname.Replace("\r\n", ""); tname = tname.Replace("\r", ""); tname = tname.Replace("\n", ""); if (oname != tname) //dont check the title! { Console.WriteLine("### dont match because of " + oname + " " + tname); } if (odesc == tdesc && oflav == tflav && oname == tname) //dont check the title! { tl.description = td.description; tl.name = td.name; tl.flavour = td.flavour; tl.title = td.title; } } } tci.setLevels(tls); }
public void ScrapeFriendsGroup(ref GlobusHttpHelper HttpHelper, List<string> FriendsProfileIDs, string username) { try { string MainUrl = string.Empty; FriendsProfileIDs = FriendsProfileIDs.Distinct().ToList(); foreach (var friendID in FriendsProfileIDs) { try { MainUrl = "http://www.linkedin.com/profile/view?id=" + friendID; string pageSourceforGroup = HttpHelper.getHtmlfromUrl1(new Uri(MainUrl)); if (pageSourceforGroup.Contains("Your address book is currently unavailable. Please check again later")) { Logger("[ " + DateTime.Now + " ] => [ Your address book is currently unavailable. Please check again later ! ]"); Logger("[ " + DateTime.Now + " ] => [ Please Wait for sometimes ! ]"); System.Threading.Thread.Sleep(1 * 60 * 1000); pageSourceforGroup = HttpHelper.getHtmlfromUrl1(new Uri(MainUrl)); } if (pageSourceforGroup.Contains("You and this LinkedIn user don’t know anyone in common") || pageSourceforGroup.Contains("You and this LinkedIn user don’t know anyone in common")) { Logger("[ " + DateTime.Now + " ] => [ You and this LinkedIn user don’t know anyone in common With Profile URL >>> " + "http://www.linkedin.com/profile/view?id=" + friendID + " ]"); continue; } string[] RgxGroupDataforGroup = System.Text.RegularExpressions.Regex.Split(pageSourceforGroup, "link_groupRegistration"); string[] RgxGroupDataName = System.Text.RegularExpressions.Regex.Split(pageSourceforGroup, "fmt__profileUserFullName"); #region CodeChabgeBysanjeev string MemberName = string.Empty; try { int startIndex = pageSourceforGroup.IndexOf("<span class=\"full-name\">"); string start = pageSourceforGroup.Substring(startIndex).Replace("<span class=\"full-name\">", string.Empty); int endIndex = start.IndexOf("</span>"); string end = start.Substring(0, endIndex).Replace("</span>", string.Empty); MemberName = end.Trim(); //MemberName = pageSourceforGroup.Substring(pageSourceforGroup.IndexOf("<span class=\"full-name\">"), (pageSourceforGroup.IndexOf("</span>", pageSourceforGroup.IndexOf("fmt__profileUserFullName")) - pageSourceforGroup.IndexOf("<span class=\"full-name\">"))).Replace("<span class=\"full-name\">", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Replace(":", string.Empty).Trim(); //MemberName = MemberName.Replace(" ", "-"); } catch { } if (RgxGroupDataforGroup.Count() < 2) { try { pageSourceforGroup = HttpHelper.getHtmlfromUrl1(new Uri("http://www.linkedin.com/profile/mappers?x-a=profile_v2_groups%2Cprofile_v2_follow%2Cprofile_v2_connections&x-p=profile_v2_discovery%2Erecords%3A4%2Ctop_card%2EprofileContactsIntegrationStatus%3A0%2Cprofile_v2_comparison_insight%2Edistance%3A1%2Cprofile_v2_right_fixed_discovery%2Eoffset%3A0%2Cprofile_v2_connections%2Edistance%3A1%2Cprofile_v2_right_fixed_discovery%2Erecords%3A4%2Cprofile_v2_network_overview_insight%2Edistance%3A1%2Cprofile_v2_right_top_discovery_teamlinkv2%2Eoffset%3A0%2Cprofile_v2_right_top_discovery_teamlinkv2%2Erecords%3A4%2Cprofile_v2_discovery%2Eoffset%3A0%2Cprofile_v2_summary_upsell%2EsummaryUpsell%3Atrue%2Cprofile_v2_network_overview_insight%2EnumConn%3A1668%2Ctop_card%2Etc%3Atrue&x-oa=bottomAliases&id=" + friendID + "&locale=&snapshotID=&authToken=&authType=name&invAcpt=¬Contactable=&primaryAction=&isPublic=false&sfd=true&_=1366115853014")); } catch (Exception ex) { Console.WriteLine("Error >>> " + ex.StackTrace); } } if (pageSourceforGroup.Contains("link_groupRegistration")) { RgxGroupDataforGroup = System.Text.RegularExpressions.Regex.Split(pageSourceforGroup, "link_groupRegistration"); RgxGroupDataName = System.Text.RegularExpressions.Regex.Split(pageSourceforGroup, "class=\"full-name\">"); foreach (string item in RgxGroupDataforGroup) { string GroupUrl = string.Empty; string GroupNames = string.Empty; string GroupIds = string.Empty; try { if (!item.Contains("<!DOCTYPE html>") && item.Contains("\"name\":\"")) { try { GroupNames = item.Substring(item.IndexOf("\"name\":\""), (item.IndexOf("\",\"", item.IndexOf("\"name\":\"")) - item.IndexOf("\"name\":\""))).Replace("\"name\":\"", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Trim(); } catch { } try { //int startindex = item.IndexOf("groups?gid="); //if (startindex > 0) //{ // string start = item.Substring(startindex).Replace("groups?gid=","&"); // int endindex = start.IndexOf("&"); // string end = start.Substring(0, endindex); // GroupIds = end; //} GroupIds = getBetween(item, "groups?gid=", "&"); } catch { } if (string.IsNullOrEmpty(GroupIds)) { try { GroupIds = item.Substring(item.IndexOf("groupRegistration?gid="), (item.IndexOf("&", item.IndexOf("groupRegistration?gid=")) - item.IndexOf("groupRegistration?gid="))).Replace("groupRegistration?gid=", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Replace("&", "").Trim(); } catch { } } if (string.IsNullOrEmpty(GroupIds)) { try { //GroupIds = item.Substring(item.IndexOf("groupRegistration?gid="), (item.IndexOf("&", item.IndexOf("groupRegistration?gid=")) - item.IndexOf("groupRegistration?gid="))).Replace("groupRegistration?gid=", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Replace("&", "").Trim(); int startIndex = item.IndexOf("groupRegistration?gid="); string start = item.Substring(startIndex); int endIndex = start.IndexOf("&"); string end = start.Substring(0, endIndex).Replace("&", string.Empty); GroupIds = end.Trim(); } catch { } } GroupUrl = "http://www.linkedin.com/groups?gid=" + GroupIds; try { #region Data Saved In CSV File if (!string.IsNullOrEmpty(GroupNames)) { try { string CSVHeader = "GroupUrl" + "," + "GroupName" + "," + "FriendName" + "," + "SearchByID"; string CSV_Content = GroupUrl.Replace(",", ";") + "," + GroupNames.Replace(",", ";") + "," + MemberName.Replace(",", ";") + "," + username; CSVUtilities.ExportDataCSVFile(CSVHeader, CSV_Content, Globals.path_LinkedinFriendsGroupScraper); Logger("[ " + DateTime.Now + " ] => [ GroupUrl: " + GroupUrl + " ]"); Logger("[ " + DateTime.Now + " ] => [ GroupName: " + GroupNames + " ]"); Logger("[ " + DateTime.Now + " ] => [ FriendName: " + MemberName +" ]"); Logger("[ " + DateTime.Now + " ] => [ SearchByID: " + username + " ]"); Logger("[ " + DateTime.Now + " ] => [ Data Saved In CSV File ! ]"); } catch { } } #endregion } catch { } } } catch { } } } else { RgxGroupDataforGroup = System.Text.RegularExpressions.Regex.Split(pageSourceforGroup, "link_media"); RgxGroupDataName = System.Text.RegularExpressions.Regex.Split(pageSourceforGroup, "class=\"full-name\">"); foreach (string item in RgxGroupDataforGroup) { string GroupUrl = string.Empty; string GroupNames = string.Empty; string GroupIds = string.Empty; try { if (!item.Contains("<!DOCTYPE html>") && item.Contains("\"name\":\"")) { try { //GroupNames = item.Substring(item.IndexOf("\"name\":\""), (item.IndexOf("\",\"", item.IndexOf("\"name\":\"")) - item.IndexOf("\"name\":\""))).Replace("\"name\":\"", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Trim(); int startindex = item.IndexOf("\"name\""); string start = item.Substring(startindex).Replace("\"name\"",string.Empty).Replace(":", string.Empty); int endindex = start.IndexOf(","); string end = start.Substring(0, endindex).Replace("\"",string.Empty); GroupNames = end.Trim(); } catch { } try { int startindex1 = item.IndexOf("\"groupID\""); string start = item.Substring(startindex1).Replace("\"groupID\"",string.Empty).Replace(":", string.Empty); int endindex = start.IndexOf(","); string end = start.Substring(0, endindex); GroupIds = end.Trim(); } catch { } if (string.IsNullOrEmpty(GroupIds)) { try { GroupIds = item.Substring(item.IndexOf("groupRegistration?gid="), (item.IndexOf("&", item.IndexOf("groupRegistration?gid=")) - item.IndexOf("groupRegistration?gid="))).Replace("groupRegistration?gid=", string.Empty).Replace("\\", string.Empty).Replace("\"", string.Empty).Replace("&", "").Trim(); } catch { } } GroupUrl = "http://www.linkedin.com/groups?gid=" + GroupIds; try { #region Data Saved In CSV File if (!string.IsNullOrEmpty(GroupNames)) { try { string CSVHeader = "GroupUrl" + "," + "GroupName" + "," + "FriendName" + "," + "SearchByID"; string CSV_Content = GroupUrl.Replace(",", ";") + "," + GroupNames.Replace(",", ";") + "," + MemberName.Replace(",", ";") + "," + username; CSVUtilities.ExportDataCSVFile(CSVHeader, CSV_Content, Globals.path_LinkedinFriendsGroupScraper); Logger("[ " + DateTime.Now + " ] => [ GroupUrl: " + GroupUrl.Replace(",", ";") + " ]"); Logger("[ " + DateTime.Now + " ] => [ GroupName: " + GroupNames.Replace(",", ";") + " ]"); Logger("[ " + DateTime.Now + " ] => [ FriendName: " + MemberName.Replace(",", ";") + " ]"); Logger("[ " + DateTime.Now + " ] => [ SearchByID: " + username + " ]"); Logger("[ " + DateTime.Now + " ] => [ Data Saved In CSV File ! ]"); } catch { } } #endregion } catch { } } } catch { } } } #endregion } catch { } } } catch (Exception ex) { } }