private bool WriteFlag(DirectoryInfo writeDir, FileInfo f, string flagName, TitleLevel level) { ReadOnlyDictionary <string, Title> list; if (level == TitleLevel.Duchy) { list = m_options.Data.Duchies; } else if (level == TitleLevel.Kingdom) { list = m_options.Data.Kingdoms; } else { list = m_options.Data.Empires; } Title t = FetchTitle(flagName, list); if (t != null) { return(false); } Log(" --Writing Flag"); string newPath = Path.Combine(writeDir.FullName, flagName).Replace('\\', '/') + ".tga"; if (!File.Exists(newPath)) { Log(" --" + flagName); f.CopyTo(newPath); } return(true); }
private bool TitleExists(List <string> skippedList, Title c, TitleLevel level) { ReadOnlyDictionary <string, Title> titles; string prefix; if (level == TitleLevel.Duchy) { prefix = "d_"; titles = m_options.Data.Duchies; } else if (level == TitleLevel.Kingdom) { prefix = "k_"; titles = m_options.Data.Kingdoms; } else { prefix = "e_"; titles = m_options.Data.Empires; } Title t = titles.ToList().Find(d => d.Value.TitleID == prefix + c.TitleID.Substring(2)).Value; if (t != null) { skippedList.Add(string.Format("{0}: {1} already exists.", c.TitleID, level)); return(true); } return(false); }
private bool MakeNameForTitle(StreamWriter names, string titleID, string countyTitleID, bool shortName, TitleLevel level) { ReadOnlyDictionary <string, Title> titles; titles = level == TitleLevel.Kingdom ? m_options.Data.Kingdoms : m_options.Data.Empires; string id = countyTitleID ?? titleID; string prefix = level == TitleLevel.Kingdom ? "k_" : "e_"; Log(" --Writing names for " + prefix + id.Substring(2)); Title t = titles.ToList().Find(e => e.Value.TitleID == prefix + id.Substring(2)).Value; if (t != null) { return(false); } string noun = GetNoun(shortName, titleID, level, countyTitleID); if (noun == null) { Log(" --Localisation for " + titleID + " doesn't exist."); return(false); } names.WriteLine(prefix + id.Substring(2) + noun.Substring(noun.IndexOf(';'))); if (m_options.Data.Localisations.ContainsKey(id + "_adj")) { names.WriteLine(prefix + m_options.Data.Localisations[id + "_adj"].Substring(2)); } return(true); }
private string GetNoun(bool shortNames, string titleID, TitleLevel titleLevel, string countyTitleID) { string value = null; if (shortNames) { value = GetNewName(titleID, titleLevel, countyTitleID); } else if (m_options.Data.Localisations.ContainsKey(titleID)) { value = m_options.Data.Localisations[titleID]; } return(value); }
private bool CreateTableEntry(StreamWriter nations, string titleID, TitleLevel level) { ReadOnlyDictionary <string, Title> titles; string prefix; switch (level) { case TitleLevel.Duchy: titles = m_options.Data.Duchies; prefix = "d_"; break; case TitleLevel.Kingdom: titles = m_options.Data.Kingdoms; prefix = "k_"; break; default: titles = m_options.Data.Empires; prefix = "e_"; break; } string convert; if (!m_options.Data.NationTable.TryGetValue(titleID, out convert)) { return(false); } Title t = titles.ToList().Find(e => e.Value.TitleID == prefix + titleID.Substring(2)).Value; if (t != null) { return(false); } nations.WriteLine(prefix + convert.Substring(2)); return(true); }
private string GetNewName(string titleID, TitleLevel titleLevel, string countyTitleID) { string id = countyTitleID ?? titleID; Log(" --Creating short name for: " + id); if (!m_options.Data.Localisations.ContainsKey(id + "_adj")) { if (m_options.Data.Localisations.ContainsKey(titleID)) { return(m_options.Data.Localisations[titleID]); } return(null); } string noun, adj; noun = m_options.Data.Localisations[titleID]; adj = m_options.Data.Localisations[id + "_adj"]; string[] nounBits = noun.Split(';'); string[] adjBits = adj.Split(';'); if (titleLevel == TitleLevel.Duchy) { nounBits[1] = adjBits[1] + " Duchy"; } else if (titleLevel == TitleLevel.Kingdom) { nounBits[1] = adjBits[1] + " Kingdom"; } else { nounBits[1] = adjBits[1] + " Empire"; } noun = nounBits.Aggregate(String.Empty, (c, bit) => c + (bit + ";")); noun = noun.TrimEnd(';'); return(noun); }
public TitleLevel GetTitleLevel(string doctorID) { TitleLevel tl = TitleLevel.Nothing; if (docDoctors == null) { return(tl); } foreach (XmlNode doctor in docDoctors.DocumentElement.SelectNodes(ElementNames.Doctor)) { if (doctor.Attributes[AttributeNames.Code].Value == doctorID) { string titleLevel = doctor.Attributes[AttributeNames.TitleLevel].Value; if (titleLevel.Length > 0) { tl = (TitleLevel)Convert.ToInt32(titleLevel); } break; } } return(tl); }
internal static AbstractEmployee SetManager(TitleLevel level) { AbstractEmployee employee = null; switch (level) { case TitleLevel.worker: employee = new Employee("Leader", TitleLevel.Leader); break; case TitleLevel.Leader: employee = new Employee("Manager", TitleLevel.Manager); break; case TitleLevel.Manager: employee = new Employee("Boss", TitleLevel.Boss); break; case TitleLevel.Boss: default: break; } return(employee); }
private bool TitleExists( List<string> skippedList, Title c, TitleLevel level ) { ReadOnlyDictionary<string, Title> titles; string prefix; if( level == TitleLevel.Duchy ) { prefix = "d_"; titles = m_options.Data.Duchies; } else if( level == TitleLevel.Kingdom ) { prefix = "k_"; titles = m_options.Data.Kingdoms; } else { prefix = "e_"; titles = m_options.Data.Empires; } Title t = titles.ToList().Find( d => d.Value.TitleID == prefix + c.TitleID.Substring( 2 ) ).Value; if( t != null ) { skippedList.Add( string.Format( "{0}: {1} already exists.", c.TitleID, level ) ); return true; } return false; }
private string GetNewName( string titleID, TitleLevel titleLevel, string countyTitleID ) { string id = countyTitleID ?? titleID; Log( " --Creating short name for: " + id ); if( !m_options.Data.Localisations.ContainsKey( id + "_adj" ) ) { if( m_options.Data.Localisations.ContainsKey( titleID ) ) return m_options.Data.Localisations[titleID]; return null; } string noun, adj; noun = m_options.Data.Localisations[titleID]; adj = m_options.Data.Localisations[id + "_adj"]; string[] nounBits = noun.Split( ';' ); string[] adjBits = adj.Split( ';' ); if( titleLevel == TitleLevel.Duchy ) nounBits[1] = adjBits[1] + " Duchy"; else if( titleLevel == TitleLevel.Kingdom ) nounBits[1] = adjBits[1] + " Kingdom"; else nounBits[1] = adjBits[1] + " Empire"; noun = nounBits.Aggregate( String.Empty, ( c, bit ) => c + ( bit + ";" ) ); noun = noun.TrimEnd( ';' ); return noun; }
private string GetNoun( bool shortNames, string titleID, TitleLevel titleLevel, string countyTitleID ) { string value = null; if( shortNames ) value = GetNewName( titleID, titleLevel, countyTitleID ); else if( m_options.Data.Localisations.ContainsKey( titleID ) ) value = m_options.Data.Localisations[titleID]; return value; }
private bool MakeNameForTitle( StreamWriter names, string titleID, string countyTitleID, bool shortName, TitleLevel level ) { ReadOnlyDictionary<string, Title> titles; titles = level == TitleLevel.Kingdom ? m_options.Data.Kingdoms : m_options.Data.Empires; string id = countyTitleID ?? titleID; string prefix = level == TitleLevel.Kingdom ? "k_" : "e_"; Log( " --Writing names for " + prefix + id.Substring( 2 ) ); Title t = titles.ToList().Find( e => e.Value.TitleID == prefix + id.Substring( 2 ) ).Value; if( t != null ) return false; string noun = GetNoun( shortName, titleID, level, countyTitleID ); if ( noun == null ) { Log( " --Localisation for " + titleID + " doesn't exist." ); return false; } names.WriteLine( prefix + id.Substring( 2 ) + noun.Substring( noun.IndexOf( ';' ) ) ); if( m_options.Data.Localisations.ContainsKey( id + "_adj" ) ) names.WriteLine( prefix + m_options.Data.Localisations[id + "_adj"].Substring( 2 ) ); return true; }
private bool WriteFlag( DirectoryInfo writeDir, FileInfo f, string flagName, TitleLevel level ) { ReadOnlyDictionary<string, Title> list; if( level == TitleLevel.Duchy ) list = m_options.Data.Duchies; else if( level == TitleLevel.Kingdom ) list = m_options.Data.Kingdoms; else list = m_options.Data.Empires; Title t = FetchTitle( flagName, list ); if( t != null ) return false; Log( " --Writing Flag" ); string newPath = Path.Combine( writeDir.FullName, flagName ).Replace( '\\', '/' ) + ".tga"; if( !File.Exists( newPath ) ) { Log( " --" + flagName ); f.CopyTo( newPath ); } return true; }
public Employee(string name, TitleLevel titleLevel) { Name = name; Level = titleLevel; Manager = ManagerArchitecture.SetManager(Level); }
private bool CreateTableEntry( StreamWriter nations, string titleID, TitleLevel level ) { ReadOnlyDictionary<string, Title> titles; string prefix; switch ( level ) { case TitleLevel.Duchy: titles = m_options.Data.Duchies; prefix = "d_"; break; case TitleLevel.Kingdom: titles = m_options.Data.Kingdoms; prefix = "k_"; break; default: titles = m_options.Data.Empires; prefix = "e_"; break; } string convert; if( !m_options.Data.NationTable.TryGetValue( titleID, out convert ) ) return false; Title t = titles.ToList().Find( e => e.Value.TitleID == prefix + titleID.Substring( 2 ) ).Value; if ( t != null ) return false; nations.WriteLine( prefix + convert.Substring( 2 ) ); return true; }