public string exportTeam(Controller controller) { StringBuilder sb = new StringBuilder(); sb.Append("Id;teamName;shortSquadra;hasLicensedPlayers;licensedTeam;national;fakeTeam;licensedCoach;hasAnthem;anthemStandingAngle;anthemPlayersSinging;anthemStandingStyle;UNK6;notPlayableLeague;country"); sb.Append("\n"); for (int i = 0; i < Form1._Form1.teamsBox.Items.Count; i++) { Team temp = controller.leggiSquadra(i); sb.Append(temp.getId() + ";"); string decode = Unidecoder.Unidecode(temp.getEnglish()); sb.Append(decode + ";"); sb.Append(temp.getShortSquadra() + ";"); sb.Append(temp.getHasLicensedPlayers() + ";"); sb.Append(temp.getLicensedTeam() + ";"); sb.Append(temp.getNational() + ";"); sb.Append(temp.getFakeTeam() + ";"); sb.Append(temp.getLicensedCoach() + ";"); sb.Append(temp.getHasAnthem() + ";"); sb.Append(temp.getAnthemStandingAngle() + ";"); sb.Append(temp.getAnthemPlayersSinging() + ";"); sb.Append(temp.getAnthemStandingStyle() + ";"); sb.Append(temp.getUnknown6() + ";"); sb.Append(temp.getNotPlayableLeague() + ";"); sb.Append(temp.getCountry() + ";"); sb.Append("\n"); } return(sb.ToString()); }
public static bool IsLike(this string source, string query, StringComparison comp) { var result = query.Split(' ').All(x => { var index = source.IndexOf(x, comp); if (index > -1) { return(index == 0 || char.IsSeparator(source[index - 1]) || !char.IsLetterOrDigit(source[index - 1])); } return(false); }); source = Unidecoder.Unidecode(source); return(result || query.Split(' ').All(x => { var index = source.IndexOf(x, comp); if (index > -1) { return index == 0 || char.IsSeparator(source[index - 1]) || !char.IsLetterOrDigit(source[index - 1]); } return false; })); }
private string GetRegionFileName(string fileName) { var spacePos = fileName.IndexOf(" "); if (spacePos != -1) { fileName = fileName.Substring(0, spacePos); fileName = fileName.TrimEnd(','); } return(Unidecoder.Unidecode(fileName) + ".gpx"); }
private void title_TextChanged(object sender, TextChangedEventArgs e) { buildName.Content = Unidecoder.Unidecode(title.Text.ToLower().Replace(' ', '-').Replace(':', '-').Replace(';', '-')); }
//-------------------------------------------------------------------------- // Comparison Processes //-------------------------------------------------------------------------- #region private List <int> CompareLists(Excel.Worksheet sheet1, Excel.Worksheet sheet2, string[] sheet1Columns, string[] sheet2Columns, bool sheet1HeaderRow, bool sheet2HeaderRow, bool ignoreCaps, bool ignoreSpecialChars) { List <int> sheetIndices = new List <int>(); //Gets the range and columns in the worksheet that are used. Range will be used to loop, and col to keep data intact var sheet1NumOfCols = sheet1.UsedRange.Columns.Count; var sheet1NumOfRows = sheet1.UsedRange.Rows.Count; var sheet2NumOfCols = sheet2.UsedRange.Columns.Count; var sheet2NumOfRows = sheet2.UsedRange.Rows.Count; // Compare each row in sheet1 to every row in sheet2. If a match is found, save the current row's index for (int i = (!sheet1HeaderRow) ? 1 : 2; i <= sheet1NumOfRows; i++) { StringBuilder sheet1RowString = new StringBuilder(); bool matchFound = false; // Create the comparison string for the current row in sheet 1 foreach (string column in sheet1Columns) { // Add each cells' contents to the string Range cell = sheet1.get_Range(column + i.ToString()); //sheet1.Cells[i, j] as Range; if (cell.Value != null) { string value = Convert.ToString(cell.Value); if (ignoreSpecialChars) // @"\s+" { value = Regex.Replace(value, "[^0-9a-zA-Z]", ""); } sheet1RowString.Append(value + ","); } } sheet1RowString.Replace(" ", ""); // Compare the row in the base sheet with every row in the compare sheet for (int k = (!sheet2HeaderRow) ? 1 : 2; k <= sheet2NumOfRows; k++) { StringBuilder sheet2RowString = new StringBuilder(); // Create the comparison string for the row in sheet 2 foreach (string column in sheet2Columns) { // Add each cells' contents to the string Range cell = sheet2.get_Range(column + k.ToString()); if (cell.Value != null) { string value = Convert.ToString(cell.Value); if (ignoreSpecialChars) { value = Regex.Replace(value, "[^0-9a-zA-Z]", ""); } sheet2RowString.Append(value + ","); } } sheet2RowString.Replace(" ", ""); string sheet1Row = sheet1RowString.ToString(); string sheet2Row = sheet2RowString.ToString(); bool romanize = true; if (ignoreCaps) { sheet1Row = sheet1Row.ToLower(); sheet2Row = sheet2Row.ToLower(); } if (romanize) { sheet1Row = Unidecoder.Unidecode(sheet1Row); sheet2Row = Unidecoder.Unidecode(sheet2Row); } // Compare the two rows and see if they are the same if (sheet1Row == sheet2Row) { matchFound = true; break; } } // If a similar entry was not found in the other list, add it to the list if (!matchFound) { sheetIndices.Add(i); } } return(sheetIndices); }
public string exportPlayer(Controller controller) { StringBuilder sb = new StringBuilder(); sb.Append("Id;Name;Shirt_Name;Weight;Height;Nationality;second_Nationality;Early_cross;def_prowess;Clearing;Low_pass;place_kicking;Goal_celeb;LB;coverage;catching;Jump;Header;Ball_control;GK;GoalKeeping;Reflexes;Finishing;Ball_winning;Speed;Penalty_kick;Kicking_power;Dribling;Explosive_power;Stamina;Swerve;playingAttitude;Age;Lofted_pass;Physical_Contact;Body_Controll;Attacking_Prowess;Weak_foot_use;DMF;"); sb.Append("starPlayerIndicator;Running_arm_mov;Dribling_arm_mov;Corner_kick;FORM;Position;Free_kick;Playing_Style;Pinpoint_Crossing;Sombrero;Runing_Hutching;SS;unk2;RWF;LMF;RB;LWF;CF;CB;Dribling_hutching;AMF;Weak_foot_acc;RMF;Injury_res;CMF;COM_Speeding Bullet;Scotch_Move;GK_long;Long_Throw;Scissors_Feint;Track Back;Super-sub;Rabona;Acrobatic_Finishing;Stronger_Foot;Knuckle_Shot;First-time_Shot;COM_Incisive_Run;Stronger_Hand;Hidden_Player;"); sb.Append("COM_Long_Ranger;One-touch_Pass;Heel_Trick;UNK4;Man_Marking;legendGoldenBall;Marseille_Turn;Heading;Outside_Curler;Captaincy;Malicia;Low_Punt_Trajectory;COM_Trickster;Low_Lofted_Pass;Fighting_Spirit;Flip_Flap;Weightness_Pass;unk6;UNK7;UNK8;comMazingRun;acrobatingClear;comBallExpert;cutBehind;longRange"); sb.Append("\n"); for (int i = 0; i < Form1._Form1.playersBox.Items.Count; i++) { Player temp = controller.leggiGiocatore(i); sb.Append(temp.getId() + ";"); string decode = Unidecoder.Unidecode(temp.getName()); sb.Append(decode + ";"); sb.Append(temp.getShirtName() + ";"); sb.Append(temp.getWeight() + ";"); sb.Append(temp.getHeight() + ";"); sb.Append(temp.getNational() + ";"); sb.Append(temp.getNational2() + ";"); sb.Append(temp.getEarlyCross() + ";"); sb.Append(temp.getDefense() + ";"); sb.Append(temp.getClearing() + ";"); sb.Append(temp.getLowPass() + ";"); sb.Append(temp.getPlaceKick() + ";"); sb.Append(temp.getGoalCelebrate() + ";"); sb.Append(temp.getLb() + ";"); sb.Append(temp.getCoverage() + ";"); sb.Append(temp.getCathing() + ";"); sb.Append(temp.getJump() + ";"); sb.Append(temp.getHeader() + ";"); sb.Append(temp.getBallControll() + ";"); sb.Append(temp.getGk() + ";"); sb.Append(temp.getGoalkeeping() + ";"); sb.Append(temp.getReflexes() + ";"); sb.Append(temp.getFinishing() + ";"); sb.Append(temp.getBallWinning() + ";"); sb.Append(temp.getSpeed() + ";"); sb.Append(temp.getPenaltyKick() + ";"); sb.Append(temp.getKickingPower() + ";"); sb.Append(temp.getDribbling() + ";"); sb.Append(temp.getExplosiveP() + ";"); sb.Append(temp.getStamina() + ";"); sb.Append(temp.getSwerve() + ";"); sb.Append(temp.getPlayingAttitude() + ";"); sb.Append(temp.getAge() + ";"); sb.Append(temp.getLoftedPass() + ";"); sb.Append(temp.getPhysical() + ";"); sb.Append(temp.getBodyControl() + ";"); sb.Append(temp.getAttack() + ";"); sb.Append(temp.getWcUsage() + ";"); sb.Append(temp.getDmf() + ";"); sb.Append(temp.getStarPlayerIndicator() + ";"); sb.Append(temp.getRunningArm() + ";"); sb.Append(temp.getDriblingArm() + ";"); sb.Append(temp.getCornerKick() + ";"); sb.Append(temp.getForm() + ";"); sb.Append(temp.getPosition() + ";"); sb.Append(temp.getFreeKick() + ";"); sb.Append(temp.getPlayingStyle() + ";"); sb.Append(temp.getPinCrossing() + ";"); sb.Append(temp.getSombrero() + ";"); sb.Append(temp.getRunningH() + ";"); sb.Append(temp.getSs() + ";"); sb.Append(temp.getUnk2() + ";"); sb.Append(temp.getRwf() + ";"); sb.Append(temp.getLmf() + ";"); sb.Append(temp.getRb() + ";"); sb.Append(temp.getLwf() + ";"); sb.Append(temp.getCf() + ";"); sb.Append(temp.getCb() + ";"); sb.Append(temp.getDriblingH() + ";"); sb.Append(temp.getAmf() + ";"); sb.Append(temp.getWeakFootAcc() + ";"); sb.Append(temp.getRmf() + ";"); sb.Append(temp.getInjuryRes() + ";"); sb.Append(temp.getCmf() + ";"); sb.Append(temp.getSpeedingBullet() + ";"); sb.Append(temp.getSchotMove() + ";"); sb.Append(temp.getGkLong() + ";"); sb.Append(temp.getLongThrow() + ";"); sb.Append(temp.getScissorFeint() + ";"); sb.Append(temp.getTrackBack() + ";"); sb.Append(temp.getSuperSub() + ";"); sb.Append(temp.getRabona() + ";"); sb.Append(temp.getAcrobatingFinishing() + ";"); sb.Append(temp.getStrongerFoot() + ";"); sb.Append(temp.getKnucleShot() + ";"); sb.Append(temp.getFirstTimeShot() + ";"); sb.Append(temp.getComIncisiveRun() + ";"); sb.Append(temp.getStrongerHand() + ";"); sb.Append(temp.getHiddenPlayer() + ";"); sb.Append(temp.getLongRange() + ";"); sb.Append(temp.getOneTouchPass() + ";"); sb.Append(temp.getHellTick() + ";"); sb.Append(temp.getUnk4() + ";"); sb.Append(temp.getManMarking() + ";"); sb.Append(temp.getLegendGoldenBall() + ";"); sb.Append(temp.getMarseilleTurn() + ";"); sb.Append(temp.getHeading() + ";"); sb.Append(temp.getOutsideCurler() + ";"); sb.Append(temp.getCaptaincy() + ";"); sb.Append(temp.getMalicia() + ";"); sb.Append(temp.getLowPuntTrajectory() + ";"); sb.Append(temp.getComTrickster() + ";"); sb.Append(temp.getLowLoftedPass() + ";"); sb.Append(temp.getFightingSpirit() + ";"); sb.Append(temp.getFlipFlap() + ";"); sb.Append(temp.getWeightnessPass() + ";"); sb.Append(temp.getUnk6() + ";"); sb.Append(temp.getUnk7() + ";"); sb.Append(temp.getUnk8() + ";"); sb.Append(temp.getComMazingRun() + ";"); sb.Append(temp.getAcrobatingClear() + ";"); sb.Append(temp.getComBallExpert() + ";"); sb.Append(temp.getCutBehind() + ";"); sb.Append(temp.getLongRange()); sb.Append("\n"); } return(sb.ToString()); }
private void Update() { string newString = userString; if (formatDateTime) { newString = DateTime.Now.ToString(newString); } if (formatCustom) { newString = newString.Replace("\\n", "\n"); if (!isEditor) { newString = newString.Replace("%playerLocal%", $"{playerLocal.displayName}"); newString = newString.Replace("%instanceDuration%", $"{Networking.GetServerTimeInSeconds()}"); } } if (forceAscii) { if (unidecoder != null) { newString = unidecoder.Unidecode(newString); } } if (skipBrokenNames) { // TODO: Add more in-depth checking somehow. // TODO: Make it actually revert to default text. foreach (var letter in newString) { if ("eéêëèiïaâäàåcç".IndexOf(letter) != -1) { return; } } } textObject.text = newString; // Get length of first line to adjust size. // TODO: Get length of longest line instead of first one. var firstLineLength = 0; foreach (var letter in newString) { if (letter == '\n') { break; } firstLineLength++; } var newFontSize = maxLineLength / ((float)firstLineLength + 1) * (float)maxFontSize; if (newFontSize > maxFontSize) { newFontSize = maxFontSize; } textObject.fontSize = (int)newFontSize; }