跳至內容

使用者:Cwek/工作室/MediaMix Code

維基百科,自由的百科全書
public string ProcessArticle(string ArticleText, string ArticleTitle, int wikiNamespace, out string Summary, out bool Skip)
{   
    string workspace=ArticleText;//String.Copy(ArticleText);
    int endMark=workspace.IndexOf("{{Infobox animanga/Footer");
    if(endMark<0)
        endMark=workspace.IndexOf("{{infobox animanga/Footer");
    string replaceSearch="|}";
    string replaceStr="{{Infobox animanga/MediaMixFooter}}";    
    int start=0;
    int count=0;    
        
    while(((start=workspace.IndexOf(replaceSearch,start))<=endMark)){
        if(start<0)break;
        string aPart=workspace.Substring(0,start);
        string bPart=workspace.Substring(start+2);
        workspace = aPart+replaceStr+bPart;
        endMark = workspace.IndexOf("{{Infobox animanga/Footerofja}}");
        if(endMark<0)
            endMark=workspace.IndexOf("{{infobox animanga/Footer");
        Console.WriteLine("start:"+start+",count:"+(++count));
    }
    
    Skip = count<=0;
    Summary = "";

    Console.WriteLine("count:"+count);
    Console.WriteLine(workspace);

    ArticleText = workspace;
    return ArticleText;
}