public static string GetUrl(WebsiteSection section, GameVersion version, string versionPostfix, GameLocale locale, WebsiteLanguage websiteLanguage, bool phpLink, int?id = null, int?category = null, int?icon = null, string extra = null)
        {
            if (phpLink)
            {
                string v     = GetPhpUrlGameVersion(version);
                string l     = GetPhpUrlGameLocale(locale);
                string w     = GetPhpUrlWebsiteLanguage(websiteLanguage);
                string begin = "?version=" + v + versionPostfix + "&locale=" + l + "&compare=" + w;
                switch (section)
                {
                case WebsiteSection.Arte: return(begin + "&section=artes" + (id != null ? "&id=" + id : ""));

                case WebsiteSection.Enemy: return(begin + "&section=enemies&category=" + category + (id != null ? "&id=" + id : ""));

                case WebsiteSection.Item: return(begin + "&section=items&icon=" + icon + (id != null ? "&id=" + id : ""));

                case WebsiteSection.Recipe: return(begin + "&section=recipes" + (id != null ? "&id=" + id : ""));

                case WebsiteSection.Skill: return(begin + "&section=skills" + (id != null ? "&id=" + id : ""));

                case WebsiteSection.Location: return(begin + "&section=locations" + (id != null ? "&id=" + id : ""));

                case WebsiteSection.Shop: return(begin + "&section=shops" + (id != null ? "&id=" + id : ""));

                case WebsiteSection.SearchPoint: return(begin + "&section=searchpoint" + (id != null ? "#searchpoint" + id : ""));

                case WebsiteSection.Skit: return(begin + "&section=skit" + (extra != null ? "&name=" + extra : ""));

                case WebsiteSection.Scenario: return(begin + "&section=scenario" + (extra != null ? "&name=" + extra : ""));

                case WebsiteSection.NecropolisMap: return(begin + "&section=necropolis" + (extra != null ? "&map=" + extra : ""));

                default: throw new Exception("Unsupported PHP URL requested.");
                }
            }
            else
            {
                StringBuilder sb = new StringBuilder();
                sb.Append(version.ToString());
                sb.Append("-");
                sb.Append(section.ToString());
                if (category != null)
                {
                    sb.Append("-c");
                    sb.Append(category);
                }
                if (icon != null)
                {
                    sb.Append("-i");
                    sb.Append(icon);
                }
                if (extra != null)
                {
                    sb.Append("-");
                    sb.Append(extra);
                }
                sb.Append(".html");
                if (id != null)
                {
                    sb.Append("#");
                    sb.Append(section.ToString().ToLowerInvariant());
                    sb.Append(id);
                }
                return(sb.ToString());
            }
        }
Exemplo n.º 2
0
 public static string GetUrl( WebsiteSection section, GameVersion version, bool phpLink, int? id = null, int? category = null, int? icon = null, string extra = null )
 {
     if ( phpLink ) {
         string v = GetPhpUrlGameVersion( version );
         switch ( section ) {
             case WebsiteSection.Enemy: return "?version=" + v + "&section=enemies&category=" + category + ( id != null ? "#enemy" + id : "" );
             case WebsiteSection.Item: return "?version=" + v + "&section=items&icon=" + icon + ( id != null ? "#item" + id : "" );
             case WebsiteSection.Recipe: return "?version=" + v + "&section=recipes" + ( id != null ? "#recipe" + id : "" );
             case WebsiteSection.Skill: return "?version=" + v + "&section=skills" + ( id != null ? "#skill" + id : "" );
             case WebsiteSection.Location: return "?version=" + v + "&section=locations" + ( id != null ? "#location" + id : "" );
             case WebsiteSection.Shop: return "?version=" + v + "&section=shops" + ( id != null ? "#shop" + id : "" );
             case WebsiteSection.Skit: return "?version=" + v + "&section=skit" + ( extra != null ? "&name=" + extra : "" );
             case WebsiteSection.Scenario: return "?version=" + v + "&section=scenario" + ( extra != null ? "&name=" + extra : "" );
             default: throw new Exception( "Unsupported PHP URL requested." );
         }
     } else {
         StringBuilder sb = new StringBuilder();
         sb.Append( version.ToString() );
         sb.Append( "-" );
         sb.Append( section.ToString() );
         if ( category != null ) {
             sb.Append( "-c" );
             sb.Append( category );
         }
         if ( icon != null ) {
             sb.Append( "-i" );
             sb.Append( icon );
         }
         if ( extra != null ) {
             sb.Append( "-" );
             sb.Append( extra );
         }
         sb.Append( ".html" );
         if ( id != null ) {
             sb.Append( "#" );
             sb.Append( section.ToString().ToLowerInvariant() );
             sb.Append( id );
         }
         return sb.ToString();
     }
 }