/// <summary> /// Update the filter applied to the character list data grid view. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void FilterUpdate() { string filterBase = "(ItemType = '" + FLGameData.GAMEDATA_BASES + "')"; if (textBox1.Text.Length > 0) { string filterText = textBox1.Text; if (filterBase != null) { filterBase += " AND "; } filterBase += "((ItemNickName LIKE '%" + FLUtility.EscapeLikeExpressionString(filterText) + "%')"; filterBase += "OR (IDSName LIKE '%" + FLUtility.EscapeLikeExpressionString(filterText) + "%'))"; } hashListBindingSource.Filter = filterBase; string filterSystem = "(ItemType = '" + FLGameData.GAMEDATA_SYSTEMS + "')"; if (textBox1.Text.Length > 0) { string filterText = textBox1.Text; if (filterSystem != null) { filterSystem += " AND "; } filterSystem += "((ItemNickName LIKE '%" + FLUtility.EscapeLikeExpressionString(filterText) + "%')"; filterSystem += "OR (IDSName LIKE '%" + FLUtility.EscapeLikeExpressionString(filterText) + "%'))"; } hashListBindingSource1.Filter = filterSystem; }
private static void LoadBase(string fldatapath, string path, BaseData basedata, ILogController log) { try { var ini = new FLDataFile(path, true); foreach (FLDataFile.Section sec in ini.Sections) { string sectionName = sec.SectionName.ToLowerInvariant(); if (sectionName == "baseinfo") { basedata.StartRoom = String.Format("{0:x}_{1}", basedata.BaseID, sec.GetSetting("start_room").Str(0)); basedata.StartRoomID = FLUtility.CreateID(basedata.StartRoom); } else if (sectionName == "room") { var room = new Room { Nickname = sec.GetSetting("nickname").Str(0).ToLowerInvariant() }; room.RoomID = FLUtility.CreateID(room.Nickname); path = fldatapath + Path.DirectorySeparatorChar + sec.GetSetting("file").Str(0); //I don't need room data at the moment. Yay. //TODO: make LoadRoom? //LoadRoom(fldatapath, path, basedata, room, log); basedata.Rooms[room.Nickname] = room; } } } catch (Exception e) { log.AddLog(LogType.ERROR, "error: '" + e.Message + "' when parsing '" + path); } }
public DebugAI(Old.Object.Ship.Ship ship) : base(ship) { waypoints.Add(new Waypoint(new Vector(-29292, -892, -27492), 0, FLUtility.CreateID("li01"))); waypoints.Add(new Waypoint(new Vector(-30689, -600, -28092), 0, FLUtility.CreateID("li01"))); waypoints.Add(new Waypoint(new Vector(-33021, -124, -27880), 0, FLUtility.CreateID("li01"))); waypoints.Add(new Waypoint(new Vector(-35185, -138, -26487), 0, FLUtility.CreateID("li01"))); }
public void Handle(PlayerStatsRequest message) { byte[] omsg = { 0x18, 0x01 }; FLMsgType.AddInt32(ref omsg, (13 * 4) + (_account.Reputations.Count * 8) + (_account.Kills.Count * 8)); // FLMsgType.AddUInt32(ref omsg, 4); // rm_completed FLMsgType.AddUInt32(ref omsg, 0); // u_dword FLMsgType.AddUInt32(ref omsg, 2); // rm_failed FLMsgType.AddUInt32(ref omsg, 0); // u_dword FLMsgType.AddFloat(ref omsg, 10000.0f); // total_time_played FLMsgType.AddUInt32(ref omsg, 6); // systems_visited FLMsgType.AddUInt32(ref omsg, 5); // bases_visited FLMsgType.AddUInt32(ref omsg, 4); // holes_visited FLMsgType.AddInt32(ref omsg, _account.Kills.Count); // kills_cnt FLMsgType.AddUInt32(ref omsg, _account.Rank); // rank FLMsgType.AddUInt32(ref omsg, (UInt32)_account.Money); // current_worth FLMsgType.AddUInt32(ref omsg, 0); // dunno FLMsgType.AddInt32(ref omsg, _account.Reputations.Count); foreach (var pi in _account.Kills) { FLMsgType.AddUInt32(ref omsg, pi.Key); FLMsgType.AddUInt32(ref omsg, pi.Value); } foreach (var pi in _account.Reputations) { //TODO: check hash FLMsgType.AddUInt32(ref omsg, FLUtility.CreateFactionID(pi.Key)); FLMsgType.AddFloat(ref omsg, pi.Value); } _socket.Tell(omsg); }
public Solar(StarSystem system, string nickname) : base(null) { System = system; Nickname = nickname; Objid = FLUtility.CreateID(Nickname); }
public LauncherArchetype(Section sec) : base(sec) { Setting tmpSet; if (sec.TryGetFirstOf("damage_per_fire", out tmpSet)) { DamagePerFire = float.Parse(tmpSet[0]); } if (sec.TryGetFirstOf("power_usage", out tmpSet)) { PowerUsage = float.Parse(tmpSet[0]); } if (sec.TryGetFirstOf("refire_delay", out tmpSet)) { RefireDelay = float.Parse(tmpSet[0]); } if (sec.TryGetFirstOf("muzzle_velocity", out tmpSet)) { MuzzleVelocity = new JVector(0, 0, -float.Parse(tmpSet[0])); } if (sec.TryGetFirstOf("projectile_archetype", out tmpSet)) { _projectileArchHash = FLUtility.CreateID(tmpSet[0]); } }
/// <summary> /// Update the filter applied to the character list data grid view. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void TimerFilterUpdate(object sender, EventArgs e) { timerFilter.Stop(); string filter = ""; if (textBoxFilter.Text.Length > 2) { string filterText = textBoxFilter.Text; if (filter != "") { filter += " AND "; } filter += "((AccID = '" + FLUtility.EscapeEqualsExpressionString(filterText) + "') " + " OR (AccDir = '" + FLUtility.EscapeLikeExpressionString(filterText) + "') " + " OR (BanReason LIKE '%" + FLUtility.EscapeLikeExpressionString(filterText) + "%'))"; } if (checkBoxShowExpiredBans.Checked) { if (filter != "") { filter += " AND "; } filter += "(BanEnd < #" + String.Format("{0:s}", DateTime.Now.ToUniversalTime()) + "#)"; } banListBindingSource.Filter = filter; }
/// <summary> /// Update the account information area. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void dataGridView1_SelectionChanged(object sender, EventArgs e) { if (dataGridView1.SelectedRows.Count != 1) { textBoxCharacters.Text = ""; richTextBoxBanReason.Text = ""; return; } string accDir = (string)dataGridView1.SelectedRows[0].Cells[accDirDataGridViewTextBoxColumn.Index].Value; string query = "(AccDir = '" + FLUtility.EscapeEqualsExpressionString(accDir) + "') AND (IsDeleted = 'false')"; DamDataSet.CharacterListRow[] charRecords = (DamDataSet.CharacterListRow[])dataSet.CharacterList.Select(query); string charStr = ""; foreach (DamDataSet.CharacterListRow charRecord in charRecords) { charStr += charRecord.CharName + ", "; } textBoxCharacters.Text = charStr; richTextBoxBanReason.Text = (string)dataGridView1.SelectedRows[0].Cells[banReasonDataGridViewTextBoxColumn.Index].Value; }
/// <summary> /// Load goods list for every base: buy\sell list, price mods, etc. /// </summary> /// <param name="file"></param> public static void LoadBaseMarketData(DataFile file) { foreach (var basesect in file.GetSections("BaseGood")) { var sbase = GetBase(basesect.GetFirstOf("base")[0]); if (sbase == null) { Logger.Warn("Market info for unknown base skipped: {0}", basesect.GetFirstOf("base")[0]); continue; } foreach (var set in basesect.GetSettings("MarketGood")) { var hash = FLUtility.CreateID(set[0]); var good = new Base.Base.MarketGood(hash) { MinLevelToBuy = float.Parse(set[1]), MinRepToBuy = float.Parse(set[2]), }; var baseSells = (set[5] == "1"); if (set.Count >= 7) { good.PriceMod = float.Parse(set[6]); } sbase.GoodsToBuy[hash] = good; if (baseSells) { sbase.GoodsForSale[hash] = good; } } } }
static void SendNPCGFUpdateChar(Character ch, uint charid) { byte[] omsg = { 0x26, 0x02 }; FLMsgType.AddUInt32(ref omsg, 68 + (uint)ch.FidgetScript.Length + (uint)ch.RoomLocation.Length); FLMsgType.AddUInt32(ref omsg, charid); FLMsgType.AddUInt32(ref omsg, 0); // 1 = player, 0 = npc FLMsgType.AddUInt32(ref omsg, ch.RoomID); FLMsgType.AddUInt32(ref omsg, ch.IndividualName); // npc name FLMsgType.AddUInt32(ref omsg, FLUtility.CreateFactionID(ch.Faction)); // faction FLMsgType.AddInt32(ref omsg, -1); FLMsgType.AddUInt32(ref omsg, ch.Head); FLMsgType.AddUInt32(ref omsg, ch.Body); FLMsgType.AddUInt32(ref omsg, ch.Lefthand); FLMsgType.AddUInt32(ref omsg, ch.Righthand); FLMsgType.AddUInt32(ref omsg, 0); // accessories count + list FLMsgType.AddAsciiStringLen32(ref omsg, ch.FidgetScript); FLMsgType.AddUInt32(ref omsg, charid); // behaviourid if (ch.RoomLocation.Length == 0) { FLMsgType.AddInt32(ref omsg, -1); } else { FLMsgType.AddAsciiStringLen32(ref omsg, ch.RoomLocation); } FLMsgType.AddUInt32(ref omsg, 0x00); // 1 = player, 0 = npc FLMsgType.AddUInt32(ref omsg, 0x00); // 1 = sitlow, 0 = stand FLMsgType.AddUInt32(ref omsg, ch.Voice); // voice Context.Sender.Tell(omsg); }
// <summary> /// Show details when row is selected /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void dataGridView1_SelectionChanged(object sender, EventArgs e) { foreach (DataGridViewRow row in itemGrid.SelectedRows) { richTextBoxInfo.Clear(); richTextBoxInfo.AppendText("@@@INSERTED_RTF_CODE_HACK@@@"); string rtf = ""; if ((string)row.Cells[itemTypeDataGridViewTextBoxColumn.Index].Value == "ships") { rtf += FLUtility.FLXmlToRtf((string)row.Cells[iDSInfo1DataGridViewTextBoxColumn.Index].Value); rtf += "\\pard \\par "; rtf += FLUtility.FLXmlToRtf((string)row.Cells[iDSInfoDataGridViewTextBoxColumn.Index].Value); } else { string xml = (string)row.Cells[iDSInfoDataGridViewTextBoxColumn.Index].Value; if (xml.Length == 0) { xml = "No information available"; } rtf += FLUtility.FLXmlToRtf(xml); } richTextBoxInfo.Rtf = richTextBoxInfo.Rtf.Replace("@@@INSERTED_RTF_CODE_HACK@@@", rtf); break; } }
public MunitionArchetype(Section sec) : base(sec) { Setting tmpSet; if (sec.TryGetFirstOf("hull_damage", out tmpSet)) { HullDamage = float.Parse(tmpSet[0]); } if (sec.TryGetFirstOf("energy_damage", out tmpSet)) { EnergyDamage = float.Parse(tmpSet[0]); } if (sec.TryGetFirstOf("weapon_type", out tmpSet)) { _weaponTypeHash = FLUtility.CreateID(tmpSet[0]); } if (sec.TryGetFirstOf("seeker", out tmpSet)) { Seeker = tmpSet[0]; } if (sec.TryGetFirstOf("time_to_lock", out tmpSet)) { TimeToLock = float.Parse(tmpSet[0]); } if (sec.TryGetFirstOf("seeker_range", out tmpSet)) { SeekerRange = float.Parse(tmpSet[0]); } if (sec.TryGetFirstOf("seeker_fov_deg", out tmpSet)) { SeekerFovDeg = float.Parse(tmpSet[0]); } if (sec.TryGetFirstOf("detonation_dist", out tmpSet)) { DetonationDist = float.Parse(tmpSet[0]); } if (sec.TryGetFirstOf("max_angular_velocity", out tmpSet)) { MaxAngularVelocity = float.Parse(tmpSet[0]); } if (sec.TryGetFirstOf("cruise_disruptor", out tmpSet)) { CruiseDisruptor = bool.Parse(tmpSet[0]); } if (sec.TryGetFirstOf("motor", out tmpSet)) { _motorHash = FLUtility.CreateID(tmpSet[0]); } }
/// <summary> /// Get all the [Base] sections here so we can load the base info. /// </summary> /// <param name="secs">List of [Base] sections.</param> /// <param name="flDataPath">Path to FL's DATA folder.</param> public static void LoadBases(IEnumerable <Section> secs, string flDataPath) { Parallel.ForEach(secs, sec => { var path = Path.Combine(flDataPath, sec.GetFirstOf("file")[0]); var bdata = new Base.Base(new DataFile(path), flDataPath); Bases[FLUtility.CreateID(bdata.Nickname)] = bdata; }); }
public static Good FindGood(string nickname) { uint goodid = FLUtility.CreateID(nickname); if (!Goods.ContainsKey(goodid)) { return(null); } return(Goods[goodid]); }
public static BaseData FindBase(string nickname) { uint baseid = FLUtility.CreateID(nickname); if (!Bases.ContainsKey(baseid)) { return(null); } return(Bases[baseid]); }
public static StarSystem FindSystem(string nickname) { uint systemid = FLUtility.CreateID(nickname); if (!Systems.ContainsKey(systemid)) { return(null); } return(Systems[systemid]); }
/// <summary> /// Load base market data and setup the prices for goods at each base. /// </summary> /// <param name="path"></param> private static void LoadBaseMarketData(string path, ILogController log) { var ini = new FLDataFile(path, true); foreach (var sec in ini.Sections) { string sectionName = sec.SectionName.ToLowerInvariant(); if (sectionName != "basegood") { continue; } var basedata = FindBase(sec.GetSetting("base").Str(0)); if (basedata == null) { log.AddLog(LogType.ERROR, "error: " + sec.Desc); continue; } foreach (FLDataFile.Setting set in sec.Settings) { var settingName = set.SettingName.ToLowerInvariant(); if (settingName != "marketgood") { continue; } var nickname = set.Str(0); var level_needed_to_buy = set.Float(1); var reputation_needed_to_buy = set.Float(2); var baseSells = (set.UInt(5) == 1); var basePriceMultiplier = 1.0f; if (set.NumValues() > 6) { basePriceMultiplier = set.Float(6); } var goodid = FLUtility.CreateID(nickname); var good = FindGood(goodid); if (good == null) { log.AddLog(LogType.ERROR, "error: " + set.Desc); continue; } if (baseSells) { basedata.GoodsForSale[goodid] = good.BasePrice * basePriceMultiplier; } basedata.GoodsToBuy[goodid] = good.BasePrice * basePriceMultiplier; } } }
public static void LoadWeaponType(Section sec) { var type = new WeaponType() { Nickname = sec.GetFirstOf("nickname")[0] }; foreach (var entry in sec.GetSettings("shield_mod")) { type.ShieldMods.Add(FLUtility.CreateID(entry[0]), float.Parse(entry[1])); } WeaponDamageModifier[FLUtility.CreateID(type.Nickname)] = type; }
private void textBox1_TextChanged(object sender, EventArgs e) { string filterText = FLUtility.EscapeLikeExpressionString(textBox1.Text); if (filterText == "") { generalStatisticsTableBindingSource.Filter = null; return; } string expr = "(Description LIKE '%" + filterText + "%')"; generalStatisticsTableBindingSource.Filter = expr; }
/// <summary> /// Load shop information for equipment and commodities. /// </summary> /// <param name="path"></param> private static void LoadGoodData(string path, ILogController log) { var ini = new FLDataFile(path, true); foreach (FLDataFile.Section sec in ini.Sections) { var sectionName = sec.SectionName.ToLowerInvariant(); if (sectionName != "good") { continue; } var good = new Good { Nickname = sec.GetSetting("nickname").Str(0) }; good.GoodID = FLUtility.CreateID(good.Nickname); string category = sec.GetSetting("category").Str(0); if (category == "equipment") { good.category = Good.Category.Equipment; good.BasePrice = sec.GetSetting("price").Float(0); uint archid = FLUtility.CreateID(sec.GetSetting("equipment").Str(0)); good.EquipmentOrShipArch = ArchetypeDB.Find(archid); } else if (category == "commodity") { good.category = Good.Category.Commodity; good.BasePrice = sec.GetSetting("price").Float(0); uint archid = FLUtility.CreateID(sec.GetSetting("equipment").Str(0)); good.EquipmentOrShipArch = ArchetypeDB.Find(archid); } else if (category == "shiphull") { good.category = Good.Category.ShipHull; good.BasePrice = sec.GetSetting("price").Float(0); uint archid = FLUtility.CreateID(sec.GetSetting("ship").Str(0)); good.EquipmentOrShipArch = ArchetypeDB.Find(archid); } else if (category == "ship") { good.category = Good.Category.ShipPackage; uint goodid = FLUtility.CreateID(sec.GetSetting("hull").Str(0)); good.Shiphull = Goods[goodid]; } else { log.AddLog(LogType.ERROR, "error: unknown category " + sec.Desc); } Goods[good.GoodID] = good; } }
private void buttonSearch_Click(object sender, EventArgs e) { string filterText = FLUtility.EscapeLikeExpressionString(textBoxSearch.Text); if (filterText == "") { infocardsBindingSource.Filter = null; return; } string expr = "(desc LIKE '%" + filterText + "%')"; expr += " OR (text LIKE '%" + filterText + "%')"; infocardsBindingSource.Filter = expr; }
/// <summary> /// Update the filter applied to the character list data grid view. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void FilterUpdate() { string filter = "("; if (defaultGameDataType.Length > 0) { filter += "(ItemType = '" + defaultGameDataType + "')"; } if (checkBoxShowAllTypes.Checked || defaultGameDataType.Length == 0) { if (filter.Length > 1) { filter += " OR "; } filter += "(ItemType = '" + FLGameData.GAMEDATA_GUNS + "') OR "; filter += "(ItemType = '" + FLGameData.GAMEDATA_TURRETS + "') OR "; filter += "(ItemType = '" + FLGameData.GAMEDATA_MINES + "') OR "; filter += "(ItemType = '" + FLGameData.GAMEDATA_PROJECTILES + "') OR "; filter += "(ItemType = '" + FLGameData.GAMEDATA_SHIELDS + "') OR "; filter += "(ItemType = '" + FLGameData.GAMEDATA_THRUSTERS + "') OR "; filter += "(ItemType = '" + FLGameData.GAMEDATA_CM + "') OR "; filter += "(ItemType = '" + FLGameData.GAMEDATA_CLOAK + "') OR "; filter += "(ItemType = '" + FLGameData.GAMEDATA_LIGHTS + "') OR "; filter += "(ItemType = '" + FLGameData.GAMEDATA_MISC + "') OR "; filter += "(ItemType = '" + FLGameData.GAMEDATA_SCANNERS + "') OR "; filter += "(ItemType = '" + FLGameData.GAMEDATA_TRACTORS + "') OR "; filter += "(ItemType = '" + FLGameData.GAMEDATA_ENGINES + "') OR "; filter += "(ItemType = '" + FLGameData.GAMEDATA_ARMOR + "') OR "; filter += "(ItemType = '" + FLGameData.GAMEDATA_FX + "') OR "; filter += "(ItemType = '" + FLGameData.GAMEDATA_POWERGEN + "')"; } filter += ")"; if (textBox1.Text.Length > 0) { string filterText = textBox1.Text; if (filter != null) { filter += " AND "; } filter += "((IDSName LIKE '%" + FLUtility.EscapeLikeExpressionString(filterText) + "%')"; filter += " OR (ItemNickName LIKE '%" + FLUtility.EscapeLikeExpressionString(filterText) + "%')"; filter += " OR (ItemType LIKE '%" + FLUtility.EscapeLikeExpressionString(filterText) + "%'))"; } if (filter.Length > 2) { hashListBindingSource.Filter = filter; } }
private void textBox1_TextChanged(object sender, EventArgs e) { string filterText = FLUtility.EscapeLikeExpressionString(textBox1.Text); if (filterText == "") { gameDataTableBindingSource.Filter = null; return; } string expr = "(itemInfo LIKE '%" + filterText + "%')"; expr += " OR (itemKeys LIKE '%" + filterText + "%')"; expr += " OR (itemGameDataType LIKE '%" + filterText + "%')"; expr += " OR (itemNickname LIKE '%" + filterText + "%')"; gameDataTableBindingSource.Filter = expr; }
public Base(DataFile datafile, string flDataPath) { Nickname = datafile.GetSetting("BaseInfo", "nickname")[0]; BaseID = FLUtility.CreateID(Nickname); StartRoom = String.Format("{0:x}_{1}", BaseID, datafile.GetSetting("BaseInfo", "start_room")[0].ToLowerInvariant()); StartRoomID = FLUtility.CreateID(StartRoom); foreach (var sec in datafile.GetSections("Room")) { var nick = sec.GetFirstOf("nickname")[0].ToLowerInvariant(); var file = new DataFile(Path.Combine(flDataPath, sec.GetFirstOf("file")[0])); var room = new Room(nick, file, flDataPath); Rooms.Add(nick, room); } }
// <summary> /// Load the factions from initial world. /// </summary> /// <param name="path"></param> private static void LoadFactions(string path, ILogController log) { var ini = new FLDataFile(path, true); foreach (FLDataFile.Section sec in ini.Sections) { string sectionName = sec.SectionName.ToLowerInvariant(); if (sectionName == "group") { var faction = new Faction { Nickname = sec.GetSetting("nickname").Str(0) }; faction.FactionID = FLUtility.CreateFactionID(faction.Nickname); Factions[faction.Nickname] = faction; } } }
/// <summary> /// Update the filter applied to the character list data grid view. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void FilterUpdate() { // gameDataTableBindingSource.Filter string filter = "(ItemType = '" + FLGameData.GAMEDATA_SHIPS + "')"; if (textBox1.Text.Length > 0) { string filterText = textBox1.Text; if (filter != null) { filter += " AND "; } filter += "((ItemNickName LIKE '%" + FLUtility.EscapeLikeExpressionString(filterText) + "%')"; filter += "OR (IDSName LIKE '%" + FLUtility.EscapeLikeExpressionString(filterText) + "%'))"; } hashListBindingSource.Filter = filter; }
public void Handle(EnterBase message) { _log.Debug("FLID {0} enters base {1}", _flplayerID, message.BaseID); //TODO: debug if null or "" var baseid = FLUtility.CreateID(_account.ShipState.Base); if (_account.ShipState.Base != null && baseid != message.BaseID) { _log.Warn("{0} CHEAT: tried to enter {1} when saved at {2} ({3}", _account.CharName, message.BaseID, baseid, _account.ShipState.Base); //TODO: kick for cheating } var sdata = Context.Child("ship").Ask <ShipData>(new AskShipData(), TimeSpan.FromMilliseconds(850)); Context.Sender.Tell(new AccountShipData(_account, sdata.Result)); Context.Child("ship").Tell(new AskHullStatus(), _socket); }
private void timer1_Tick(object sender, EventArgs e) { string filterText = FLUtility.EscapeLikeExpressionString(textBox1.Text); if (filterText == "") { hashListBindingSource.Filter = null; return; } string expr = "(ItemType = '%" + filterText + "%')"; expr += " OR (ItemNickName LIKE '%" + filterText + "%')"; expr += " OR (IDSName LIKE '%" + filterText + "%')"; expr += " OR (IDSInfo LIKE '%" + filterText + "%')"; expr += " OR (IDSInfo1 LIKE '%" + filterText + "%')"; expr += " OR (IDSInfo2 LIKE '%" + filterText + "%')"; expr += " OR (IDSInfo3 LIKE '%" + filterText + "%')"; expr += " OR (ItemKeys LIKE '%" + filterText + "%')"; hashListBindingSource.Filter = expr; }
private void dataGridViewIDS_CellClick(object sender, DataGridViewCellEventArgs e) { try { DataGridViewRow row = dataGridViewIDS.Rows[e.RowIndex]; textBoxCardInfo.Text = row.Cells[0].Value.ToString(); richTextBoxRawCard.Text = row.Cells[1].Value.ToString(); richTextBoxFormattedCard.Clear(); richTextBoxFormattedCard.AppendText("@@@INSERTED_RTF_CODE_HACK@@@"); string rtf = FLUtility.FLXmlToRtf(row.Cells[1].Value.ToString()); richTextBoxFormattedCard.Rtf = richTextBoxFormattedCard.Rtf.Replace("@@@INSERTED_RTF_CODE_HACK@@@", rtf); } catch { textBoxCardInfo.Clear(); richTextBoxRawCard.Clear(); richTextBoxFormattedCard.Clear(); } }
/// <summary> /// Generate from the results dataset for the specified charNameFilter /// </summary> void GenerateActivityReport(UIDataSet results, string charNameFilter, string title, UIDataSet summaryFactions, DateTime date, bool showChangedOnlineTimeOnly) { string[] colTitles = new string[] { "Name", "Last On Line", "On Line Time" }; string[] colNames = new string[] { "Name", "LastOnLine", "OnLineTime" }; // Prepare the filepath to save the HTML. string escapedFactionName = Regex.Replace(charNameFilter, @"[?:\\/*""<>|]", ""); string filePath = String.Format("{0}\\activity_{1}.html", AppSettings.Default.setStatisticsDir, escapedFactionName); if (date > DateTime.MinValue) { filePath = String.Format("{0}\\activity_{1:yyyyMMdd}.html", AppSettings.Default.setStatisticsDir, date); } // Filter and sort the results table. string query = "(Name LIKE '" + FLUtility.EscapeLikeExpressionString(charNameFilter) + "%'" + " OR Name LIKE '%" + FLUtility.EscapeLikeExpressionString(charNameFilter) + "')"; if (showChangedOnlineTimeOnly) { query += " AND OnLineSecs > 0"; } DataRow[] rows = results.StatPlayer.Select(query, "OnLineTime DESC"); // Save it. SaveAsHTML(filePath, title, rows, colTitles, colNames, 0, rows.Length); // Update faction activity summary table to generate the index table later. string linkName = HtmlEncode(filePath.Substring(AppSettings.Default.setStatisticsDir.Length + 1)); linkName = String.Format("<a href=\"{0}\">{1}</a>", HtmlEncode(linkName), HtmlEncode(linkName)); TimeSpan totalOnLineTime = TimeSpan.Zero; foreach (UIDataSet.StatPlayerRow row in (UIDataSet.StatPlayerRow[])rows) { totalOnLineTime += row.OnLineTime; } summaryFactions.StatPlayer.AddStatPlayerRow(linkName, totalOnLineTime, 0, 0, DateTime.Now, (int)totalOnLineTime.TotalSeconds); }