public static void EnsureResources(System.Reflection.Assembly assembly, string dataPath) { var contentIdentifier = assembly.GetName().Name + ".Content."; var scriptIdentifier = assembly.GetName().Name + ".Scripts."; var dataIdentifier = assembly.GetName().Name + ".App_Data."; foreach (var resource in assembly.GetManifestResourceNames()) { if (resource.StartsWith (contentIdentifier)) { // Treat Content resources as though every "." except the last is a directory separator var path = resource.Substring (contentIdentifier.Length); var lastDot = path.LastIndexOf ("."); if (lastDot > -1) path = path.Substring (0, lastDot).Replace ('.', Path.DirectorySeparatorChar) + "." + path.Substring (lastDot + 1); else path = path.Replace('.', Path.DirectorySeparatorChar); path = Path.Combine (dataPath, path); EnsureResource (assembly, path, resource); } else if (resource.StartsWith (scriptIdentifier)) { var path = Path.Combine (dataPath, resource.Substring (scriptIdentifier.Length)); EnsureResource (assembly, path, resource); } else if (resource.StartsWith (dataIdentifier)) { var path = Path.Combine (dataPath, resource.Substring (dataIdentifier.Length)); EnsureResource (assembly, path, resource); } } }
/// <summary> /// Reads the values from an <see cref="IDataReader"/> and assigns the read values to this /// object's properties. Unlike ReadValues(), this method not only doesn't require /// all values to be in the <see cref="IDataReader"/>, but also does not require the values in /// the <see cref="IDataReader"/> to be a defined field for the table this class represents. /// Because of this, you need to be careful when using this method because values /// can easily be skipped without any indication. /// </summary> /// <param name="source">The object to add the extension method to.</param> /// <param name="dataRecord">The <see cref="IDataReader"/> to read the values from. Must already be ready to be read from.</param> public static void TryReadValues(this EventCountersItemTemplateTable source, System.Data.IDataRecord dataRecord) { for (int i = 0; i < dataRecord.FieldCount; i++) { switch (dataRecord.GetName(i)) { case "counter": source.Counter = (System.Int64)(System.Int64)dataRecord.GetInt64(i); break; case "item_template_event_counter_id": source.ItemTemplateEventCounterId = (System.Byte)(System.Byte)dataRecord.GetByte(i); break; case "item_template_id": source.ItemTemplateID = (DemoGame.ItemTemplateID)(DemoGame.ItemTemplateID)dataRecord.GetUInt16(i); break; } } }
/// <summary> /// Reads the values from an <see cref="IDataReader"/> and assigns the read values to this /// object's properties. Unlike ReadValues(), this method not only doesn't require /// all values to be in the <see cref="IDataReader"/>, but also does not require the values in /// the <see cref="IDataReader"/> to be a defined field for the table this class represents. /// Because of this, you need to be careful when using this method because values /// can easily be skipped without any indication. /// </summary> /// <param name="source">The object to add the extension method to.</param> /// <param name="dataRecord">The <see cref="IDataReader"/> to read the values from. Must already be ready to be read from.</param> public static void TryReadValues(this CharacterSkillTable source, System.Data.IDataRecord dataRecord) { for (int i = 0; i < dataRecord.FieldCount; i++) { switch (dataRecord.GetName(i)) { case "character_id": source.CharacterID = (DemoGame.CharacterID)(DemoGame.CharacterID)dataRecord.GetInt32(i); break; case "skill_id": source.SkillID = (DemoGame.SkillType)(DemoGame.SkillType)dataRecord.GetByte(i); break; case "time_added": source.TimeAdded = (System.DateTime)(System.DateTime)dataRecord.GetDateTime(i); break; } } }
/// <summary> /// Reads the values from an <see cref="IDataReader"/> and assigns the read values to this /// object's properties. Unlike ReadValues(), this method not only doesn't require /// all values to be in the <see cref="IDataReader"/>, but also does not require the values in /// the <see cref="IDataReader"/> to be a defined field for the table this class represents. /// Because of this, you need to be careful when using this method because values /// can easily be skipped without any indication. /// </summary> /// <param name="source">The object to add the extension method to.</param> /// <param name="dataRecord">The <see cref="IDataReader"/> to read the values from. Must already be ready to be read from.</param> public static void TryReadValues(this CharacterInventoryTable source, System.Data.IDataRecord dataRecord) { for (int i = 0; i < dataRecord.FieldCount; i++) { switch (dataRecord.GetName(i)) { case "character_id": source.CharacterID = (DemoGame.CharacterID)(DemoGame.CharacterID)dataRecord.GetInt32(i); break; case "item_id": source.ItemID = (DemoGame.ItemID)(DemoGame.ItemID)dataRecord.GetInt32(i); break; case "slot": source.Slot = (NetGore.InventorySlot)(NetGore.InventorySlot)dataRecord.GetByte(i); break; } } }
/// <summary> /// Reads the values from an <see cref="IDataReader"/> and assigns the read values to this /// object's properties. Unlike ReadValues(), this method not only doesn't require /// all values to be in the <see cref="IDataReader"/>, but also does not require the values in /// the <see cref="IDataReader"/> to be a defined field for the table this class represents. /// Because of this, you need to be careful when using this method because values /// can easily be skipped without any indication. /// </summary> /// <param name="source">The object to add the extension method to.</param> /// <param name="dataRecord">The <see cref="IDataReader"/> to read the values from. Must already be ready to be read from.</param> public static void TryReadValues(this WorldStatsCountShopBuyTable source, System.Data.IDataRecord dataRecord) { for (int i = 0; i < dataRecord.FieldCount; i++) { switch (dataRecord.GetName(i)) { case "count": source.Count = (System.Int32)(System.Int32)dataRecord.GetInt32(i); break; case "last_update": source.LastUpdate = (System.DateTime)(System.DateTime)dataRecord.GetDateTime(i); break; case "shop_id": source.ShopID = (NetGore.Features.Shops.ShopID)(NetGore.Features.Shops.ShopID)dataRecord.GetUInt16(i); break; } } }
/// <summary> /// Reads the values from an <see cref="IDataReader"/> and assigns the read values to this /// object's properties. Unlike ReadValues(), this method not only doesn't require /// all values to be in the <see cref="IDataReader"/>, but also does not require the values in /// the <see cref="IDataReader"/> to be a defined field for the table this class represents. /// Because of this, you need to be careful when using this method because values /// can easily be skipped without any indication. /// </summary> /// <param name="source">The object to add the extension method to.</param> /// <param name="dataRecord">The <see cref="IDataReader"/> to read the values from. Must already be ready to be read from.</param> public static void TryReadValues(this WorldStatsCountItemBuyTable source, System.Data.IDataRecord dataRecord) { for (int i = 0; i < dataRecord.FieldCount; i++) { switch (dataRecord.GetName(i)) { case "count": source.Count = (System.Int32)(System.Int32)dataRecord.GetInt32(i); break; case "item_template_id": source.ItemTemplateID = (DemoGame.ItemTemplateID)(DemoGame.ItemTemplateID)dataRecord.GetUInt16(i); break; case "last_update": source.LastUpdate = (System.DateTime)(System.DateTime)dataRecord.GetDateTime(i); break; } } }
/// <summary> /// Reads the values from an <see cref="IDataReader"/> and assigns the read values to this /// object's properties. Unlike ReadValues(), this method not only doesn't require /// all values to be in the <see cref="IDataReader"/>, but also does not require the values in /// the <see cref="IDataReader"/> to be a defined field for the table this class represents. /// Because of this, you need to be careful when using this method because values /// can easily be skipped without any indication. /// </summary> /// <param name="source">The object to add the extension method to.</param> /// <param name="dataRecord">The <see cref="IDataReader"/> to read the values from. Must already be ready to be read from.</param> public static void TryReadValues(this EventCountersShopTable source, System.Data.IDataRecord dataRecord) { for (int i = 0; i < dataRecord.FieldCount; i++) { switch (dataRecord.GetName(i)) { case "counter": source.Counter = (System.Int64)(System.Int64)dataRecord.GetInt64(i); break; case "shop_event_counter_id": source.ShopEventCounterId = (System.Byte)(System.Byte)dataRecord.GetByte(i); break; case "shop_id": source.ShopID = (NetGore.Features.Shops.ShopID)(NetGore.Features.Shops.ShopID)dataRecord.GetUInt16(i); break; } } }
/// <summary> /// Reads the values from an <see cref="IDataReader"/> and assigns the read values to this /// object's properties. Unlike ReadValues(), this method not only doesn't require /// all values to be in the <see cref="IDataReader"/>, but also does not require the values in /// the <see cref="IDataReader"/> to be a defined field for the table this class represents. /// Because of this, you need to be careful when using this method because values /// can easily be skipped without any indication. /// </summary> /// <param name="source">The object to add the extension method to.</param> /// <param name="dataRecord">The <see cref="IDataReader"/> to read the values from. Must already be ready to be read from.</param> public static void TryReadValues(this AccountCharacterTable source, System.Data.IDataRecord dataRecord) { for (int i = 0; i < dataRecord.FieldCount; i++) { switch (dataRecord.GetName(i)) { case "account_id": source.AccountID = (DemoGame.AccountID)(DemoGame.AccountID)dataRecord.GetInt32(i); break; case "character_id": source.CharacterID = (DemoGame.CharacterID)(DemoGame.CharacterID)dataRecord.GetInt32(i); break; case "time_deleted": source.TimeDeleted = (System.Nullable<System.DateTime>)(System.Nullable<System.DateTime>)(dataRecord.IsDBNull(i) ? (System.Nullable<System.DateTime>)null : dataRecord.GetDateTime(i)); break; } } }
/// <summary> /// Reads the values from an <see cref="IDataReader"/> and assigns the read values to this /// object's properties. Unlike ReadValues(), this method not only doesn't require /// all values to be in the <see cref="IDataReader"/>, but also does not require the values in /// the <see cref="IDataReader"/> to be a defined field for the table this class represents. /// Because of this, you need to be careful when using this method because values /// can easily be skipped without any indication. /// </summary> /// <param name="source">The object to add the extension method to.</param> /// <param name="dataRecord">The <see cref="IDataReader"/> to read the values from. Must already be ready to be read from.</param> public static void TryReadValues(this EventCountersUserTable source, System.Data.IDataRecord dataRecord) { for (int i = 0; i < dataRecord.FieldCount; i++) { switch (dataRecord.GetName(i)) { case "counter": source.Counter = (System.Int64)(System.Int64)dataRecord.GetInt64(i); break; case "user_event_counter_id": source.UserEventCounterId = (System.Byte)(System.Byte)dataRecord.GetByte(i); break; case "user_id": source.UserID = (DemoGame.CharacterID)(DemoGame.CharacterID)dataRecord.GetInt32(i); break; } } }
public void buildTreeFromAssembly(System.Reflection.Assembly CurrentAsm) { //code from Platt's example TreeNode BaseNode; BaseNode = treeViewAssembly.Nodes.Add("Assy:" + CurrentAsm.GetName().ToString()); BaseNode.Tag = CurrentAsm; // Enumerate each type contained in the assembly foreach (System.Type ThisType in CurrentAsm.GetTypes()) { TreeNode MyNode; MyNode = BaseNode.Nodes.Add(ThisType.ToString() + " : " + ThisType.BaseType.ToString()); MyNode.Tag = ThisType; // Enumerate all the members of this type // Add each member to the tree foreach (System.Reflection.MemberInfo Member in ThisType.GetMembers(System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Static)) { TreeNode typenode = MyNode.Nodes.Add(Member.MemberType.ToString() + " : " + Member.Name); typenode.Tag = Member; } } }
/// <summary> /// Reads the values from an <see cref="IDataReader"/> and assigns the read values to this /// object's properties. Unlike ReadValues(), this method not only doesn't require /// all values to be in the <see cref="IDataReader"/>, but also does not require the values in /// the <see cref="IDataReader"/> to be a defined field for the table this class represents. /// Because of this, you need to be careful when using this method because values /// can easily be skipped without any indication. /// </summary> /// <param name="source">The object to add the extension method to.</param> /// <param name="dataRecord">The <see cref="IDataReader"/> to read the values from. Must already be ready to be read from.</param> public static void TryReadValues(this ShopTable source, System.Data.IDataRecord dataRecord) { for (int i = 0; i < dataRecord.FieldCount; i++) { switch (dataRecord.GetName(i)) { case "can_buy": source.CanBuy = (System.Boolean)(System.Boolean)dataRecord.GetBoolean(i); break; case "id": source.ID = (NetGore.Features.Shops.ShopID)(NetGore.Features.Shops.ShopID)dataRecord.GetUInt16(i); break; case "name": source.Name = (System.String)(System.String)dataRecord.GetString(i); break; } } }
/// <summary> /// Reads the values from an <see cref="IDataReader"/> and assigns the read values to this /// object's properties. Unlike ReadValues(), this method not only doesn't require /// all values to be in the <see cref="IDataReader"/>, but also does not require the values in /// the <see cref="IDataReader"/> to be a defined field for the table this class represents. /// Because of this, you need to be careful when using this method because values /// can easily be skipped without any indication. /// </summary> /// <param name="source">The object to add the extension method to.</param> /// <param name="dataRecord">The <see cref="IDataReader"/> to read the values from. Must already be ready to be read from.</param> public static void TryReadValues(this QuestRequireStartItemTable source, System.Data.IDataRecord dataRecord) { for (int i = 0; i < dataRecord.FieldCount; i++) { switch (dataRecord.GetName(i)) { case "amount": source.Amount = (System.Byte)(System.Byte)dataRecord.GetByte(i); break; case "item_template_id": source.ItemTemplateID = (DemoGame.ItemTemplateID)(DemoGame.ItemTemplateID)dataRecord.GetUInt16(i); break; case "quest_id": source.QuestID = (NetGore.Features.Quests.QuestID)(NetGore.Features.Quests.QuestID)dataRecord.GetUInt16(i); break; } } }
///<summary> ///Version info. ///</summary> /// <param name="assembly">Assembly</param> /// <remarks><para>Version of this assembly.</para> /// <para>0.0.0.0 if wrong.</para></remarks> public static Version GetVersion(System.Reflection.Assembly assembly) { if (assembly != null) { Version version = assembly.GetName().Version; if (version != null) { return version; } } return new Version(0, 0, 0, 0); }
private string FormatApplicationName(System.Reflection.Assembly asm) { object[] customAttributes = asm.GetCustomAttributes(typeof(ApplicationNameAttribute), true); if (customAttributes.Length > 0) { return ((ApplicationNameAttribute) customAttributes[0]).Value; } return asm.GetName().Name; }
///<summary> ///Name info. ///</summary> /// <param name="assembly">Assembly</param> /// <remarks>Unknown name if wrong.</remarks> public static string GetName(System.Reflection.Assembly assembly) { if (assembly != null) { string name = assembly.GetName().Name; if (name != null) { return name; } } return "Unknown name"; }
public HibernateItem(System.Data.Common.DbDataReader reader) { values = new Dictionary<string, object>(64, StringComparer.Ordinal); for (int i = 0; i < reader.FieldCount; i++) { string column = reader.GetName(i); values[column] = reader.GetValue(i); } }
public static int getFiledInx(System.Data.Odbc.OdbcDataReader rd,string fieldName) { if (System.Environment.OSVersion.Platform == PlatformID.Win32NT) return rd.GetOrdinal(fieldName); for (int i = 0; i < rd.FieldCount; i++) if(fieldName.ToUpper()== System.Text.Encoding.Unicode.GetString(System.Text.Encoding.BigEndianUnicode.GetBytes(rd.GetName(i))).ToUpper()) return i; throw new Exception(fieldName + " not found"); }
private static Stream GetStream(string resourceName, System.Reflection.Assembly containingAssembly) { #if DEBUG string filePath = null; if (ResRepo.TryGetPath(containingAssembly.GetName().FullName, resourceName, out filePath)) return new FileStream(filePath, FileMode.Open); return null; #else return containingAssembly.GetManifestResourceStream(resourceName); #endif }
internal static List<DataReaderField> GetDataReaderFields(System.Data.IDataReader reader) { var columns = new List<DataReaderField>(); for (var i = 0; i < reader.FieldCount; i++) { var column = new DataReaderField(i, reader.GetName(i), reader.GetFieldType(i)); if (columns.SingleOrDefault(x => x.LowerName == column.LowerName) == null) columns.Add(column); } return columns; }
public static string GetString(string strResourceContainer, string strResourceName, System.Reflection.Assembly asmContainer) { try { System.Resources.ResourceManager rm = new System.Resources.ResourceManager(asmContainer.GetName().Name + "." + strResourceContainer, asmContainer); return rm.GetString(strResourceName); } catch (Exception e) { ShowException(e, System.Reflection.Assembly.GetExecutingAssembly().FullName + ".GetString()", null); return String.Empty; } }
/// <summary> /// Reads the values from an <see cref="IDataReader"/> and assigns the read values to this /// object's properties. Unlike ReadValues(), this method not only doesn't require /// all values to be in the <see cref="IDataReader"/>, but also does not require the values in /// the <see cref="IDataReader"/> to be a defined field for the table this class represents. /// Because of this, you need to be careful when using this method because values /// can easily be skipped without any indication. /// </summary> /// <param name="source">The object to add the extension method to.</param> /// <param name="dataRecord">The <see cref="IDataReader"/> to read the values from. Must already be ready to be read from.</param> public static void TryReadValues(this ServerTimeTable source, System.Data.IDataRecord dataRecord) { for (int i = 0; i < dataRecord.FieldCount; i++) { switch (dataRecord.GetName(i)) { case "server_time": source.ServerTime = (System.DateTime)(System.DateTime)dataRecord.GetDateTime(i); break; } } }
public static ExchangeResourceManager GetResourceManager(string baseName, System.Reflection.Assembly assembly) { if (null == assembly) throw new System.ArgumentNullException(nameof(assembly)); var key = baseName + assembly.GetName() .Name; lock (resourceManagers) { ExchangeResourceManager local_1 = null; if (!resourceManagers.TryGetValue(key, out local_1)) { local_1 = new ExchangeResourceManager(baseName, assembly); resourceManagers.Add(key, local_1); } return local_1; } }
internal static bool columnExists(string columnName, System.Data.IDataReader rdr) { if (String.IsNullOrEmpty(columnName) || rdr == null || rdr.FieldCount == 0) { return false; } for (int i = 0; i < rdr.FieldCount; i++) { if (String.Equals(rdr.GetName(i), columnName, StringComparison.CurrentCultureIgnoreCase)) { return true; } } return false; }
public static String VersionFor(System.Reflection.Assembly a) { #if DEBUG string[] v = a.GetName().Version.ToString().Split('.'); return String.Format("{0}-{1}{2}-{3}", v[0].Substring(0, 2), v[0].Substring(2), v[1], v[2]); #else string version_txt = Path.Combine(Path.GetDirectoryName(PortableSettingsProvider.ExecutablePath), PortableSettingsProvider.ExecutableName + "-Version.txt"); if (!File.Exists(version_txt)) return "Unknown"; using (System.IO.StreamReader sr = new StreamReader(version_txt)) { String line1 = sr.ReadLine(); sr.Close(); return line1.Trim(); } #endif }
/// <summary> /// Reads the values from an <see cref="IDataReader"/> and assigns the read values to this /// object's properties. Unlike ReadValues(), this method not only doesn't require /// all values to be in the <see cref="IDataReader"/>, but also does not require the values in /// the <see cref="IDataReader"/> to be a defined field for the table this class represents. /// Because of this, you need to be careful when using this method because values /// can easily be skipped without any indication. /// </summary> /// <param name="source">The object to add the extension method to.</param> /// <param name="dataRecord">The <see cref="IDataReader"/> to read the values from. Must already be ready to be read from.</param> public static void TryReadValues(this ActiveTradeItemTable source, System.Data.IDataRecord dataRecord) { for (int i = 0; i < dataRecord.FieldCount; i++) { switch (dataRecord.GetName(i)) { case "character_id": source.CharacterID = (DemoGame.CharacterID)(DemoGame.CharacterID)dataRecord.GetInt32(i); break; case "item_id": source.ItemID = (DemoGame.ItemID)(DemoGame.ItemID)dataRecord.GetInt32(i); break; } } }
/// <summary> /// Reads the values from an <see cref="IDataReader"/> and assigns the read values to this /// object's properties. Unlike ReadValues(), this method not only doesn't require /// all values to be in the <see cref="IDataReader"/>, but also does not require the values in /// the <see cref="IDataReader"/> to be a defined field for the table this class represents. /// Because of this, you need to be careful when using this method because values /// can easily be skipped without any indication. /// </summary> /// <param name="source">The object to add the extension method to.</param> /// <param name="dataRecord">The <see cref="IDataReader"/> to read the values from. Must already be ready to be read from.</param> public static void TryReadValues(this AllianceTable source, System.Data.IDataRecord dataRecord) { for (int i = 0; i < dataRecord.FieldCount; i++) { switch (dataRecord.GetName(i)) { case "id": source.ID = (DemoGame.AllianceID)(DemoGame.AllianceID)dataRecord.GetByte(i); break; case "name": source.Name = (System.String)(System.String)dataRecord.GetString(i); break; } } }
/// <summary> /// Reads the values from an <see cref="IDataReader"/> and assigns the read values to this /// object's properties. Unlike ReadValues(), this method not only doesn't require /// all values to be in the <see cref="IDataReader"/>, but also does not require the values in /// the <see cref="IDataReader"/> to be a defined field for the table this class represents. /// Because of this, you need to be careful when using this method because values /// can easily be skipped without any indication. /// </summary> /// <param name="source">The object to add the extension method to.</param> /// <param name="dataRecord">The <see cref="IDataReader"/> to read the values from. Must already be ready to be read from.</param> public static void TryReadValues(this AllianceHostileTable source, System.Data.IDataRecord dataRecord) { for (int i = 0; i < dataRecord.FieldCount; i++) { switch (dataRecord.GetName(i)) { case "alliance_id": source.AllianceID = (DemoGame.AllianceID)(DemoGame.AllianceID)dataRecord.GetByte(i); break; case "hostile_id": source.HostileID = (DemoGame.AllianceID)(DemoGame.AllianceID)dataRecord.GetByte(i); break; } } }
/// <summary> /// Reads the values from an <see cref="IDataReader"/> and assigns the read values to this /// object's properties. Unlike ReadValues(), this method not only doesn't require /// all values to be in the <see cref="IDataReader"/>, but also does not require the values in /// the <see cref="IDataReader"/> to be a defined field for the table this class represents. /// Because of this, you need to be careful when using this method because values /// can easily be skipped without any indication. /// </summary> /// <param name="source">The object to add the extension method to.</param> /// <param name="dataRecord">The <see cref="IDataReader"/> to read the values from. Must already be ready to be read from.</param> public static void TryReadValues(this AppliedPatchesTable source, System.Data.IDataRecord dataRecord) { for (int i = 0; i < dataRecord.FieldCount; i++) { switch (dataRecord.GetName(i)) { case "date_applied": source.DateApplied = (System.DateTime)(System.DateTime)dataRecord.GetDateTime(i); break; case "file_name": source.FileName = (System.String)(System.String)dataRecord.GetString(i); break; } } }
/// <summary> /// Reads the values from an <see cref="IDataReader"/> and assigns the read values to this /// object's properties. Unlike ReadValues(), this method not only doesn't require /// all values to be in the <see cref="IDataReader"/>, but also does not require the values in /// the <see cref="IDataReader"/> to be a defined field for the table this class represents. /// Because of this, you need to be careful when using this method because values /// can easily be skipped without any indication. /// </summary> /// <param name="source">The object to add the extension method to.</param> /// <param name="dataRecord">The <see cref="IDataReader"/> to read the values from. Must already be ready to be read from.</param> public static void TryReadValues(this CharacterTemplateSkillTable source, System.Data.IDataRecord dataRecord) { for (int i = 0; i < dataRecord.FieldCount; i++) { switch (dataRecord.GetName(i)) { case "character_template_id": source.CharacterTemplateID = (DemoGame.CharacterTemplateID)(DemoGame.CharacterTemplateID)dataRecord.GetUInt16(i); break; case "skill_id": source.SkillID = (DemoGame.SkillType)(DemoGame.SkillType)dataRecord.GetByte(i); break; } } }
/// <summary> /// Reads the values from an <see cref="IDataReader"/> and assigns the read values to this /// object's properties. Unlike ReadValues(), this method not only doesn't require /// all values to be in the <see cref="IDataReader"/>, but also does not require the values in /// the <see cref="IDataReader"/> to be a defined field for the table this class represents. /// Because of this, you need to be careful when using this method because values /// can easily be skipped without any indication. /// </summary> /// <param name="source">The object to add the extension method to.</param> /// <param name="dataRecord">The <see cref="IDataReader"/> to read the values from. Must already be ready to be read from.</param> public static void TryReadValues(this MapTable source, System.Data.IDataRecord dataRecord) { for (int i = 0; i < dataRecord.FieldCount; i++) { switch (dataRecord.GetName(i)) { case "id": source.ID = (NetGore.World.MapID)(NetGore.World.MapID)dataRecord.GetUInt16(i); break; case "name": source.Name = (System.String)(System.String)dataRecord.GetString(i); break; } } }
public string GetDocumentName(string path, bool isLeaf, bool loadIndex, out int index) { var name = System.GetName(path); if (isLeaf) { name = name.Substring(0, name.LastIndexOf(".")); } index = 0; if (loadIndex) { var sections = name.Split('.'); if (!int.TryParse(sections.First(), out index)) { index = 0; } else if (sections.Length > 1) { name = sections.Skip(1).Aggregate((a, b) => a + "." + b); } } return(name); }
public IEnumerable <string> GetNodes(string path) => System.GetNodes(path, "*", SearchOption.TopDirectoryOnly).Where(o => !System.GetName(o).StartsWith("."));
public IEnumerable <string> GetLeaves(string path) => System.GetLeaves(path).Where(o => o.EndsWith(".md") && !System.GetName(o).StartsWith("."));