コード例 #1
0
    public MailUser(CsvEntry e)
    {
        this.MailAddress = e[0];
        this.Company     = e[1];
        this.FullName    = e[2];
        this.Language    = CoreLanguageList.GetLanguageClassByName(e[3]);

        if (e.Count >= 5)
        {
            string pStr = e[4];

            this.ParamList = MailUtil.StrToParamList(pStr);
        }

        normalize();
    }
コード例 #2
0
    public MailUser(string mail, string name, string company, string language, List <KeyValuePair <string, string> > paramList)
    {
        this.MailAddress = mail;
        this.Company     = company;
        this.FullName    = name;
        this.Language    = CoreLanguageList.GetLanguageClassByName(language);
        if (paramList == null)
        {
            this.ParamList = new List <KeyValuePair <string, string> >();
        }
        else
        {
            this.ParamList = paramList;
        }

        normalize();
    }
コード例 #3
0
ファイル: MultiLang.cs プロジェクト: AcidCrash0/RPVN
    public MultiLang(Page currentPage, bool fast, string basicHostName, List <KeyValuePair <string, string> > replaceList)
    {
        this.Page = currentPage;

        this.Request       = Page.Request;
        this.Response      = Page.Response;
        this.BasicHostName = basicHostName;
        string tmp     = Page.Request.ServerVariables["HTTPS"];
        string hostRaw = Page.Request.Headers["Host"];

        this.ReplaceList = replaceList;
        bool isSsl = false;

        string[] tokens;
        string   host = "";

        tokens = hostRaw.Split(':');
        if (tokens.Length >= 1)
        {
            host = tokens[0];
        }

        host = host.ToLower();

        if (tmp != null)
        {
            if (tmp.Equals("on", StringComparison.InvariantCultureIgnoreCase))
            {
                isSsl = true;
            }
        }

        this.IsSSL = isSsl;
        this.Host  = host;

        this.IsUrlModified = Str.StrToBool((string)Request.Headers["SEISAPI_MODIFIED_URL"]);
        this.OriginalUrl   = (string)Request.Headers["SEISAPI_ORIGINAL_URL"];

        int i;

        i = this.OriginalUrl.IndexOf("?");
        if (i != -1)
        {
            this.OriginalUrl = this.OriginalUrl.Substring(0, i);
        }

        if (Str.IsEmptyStr(this.OriginalUrl) || this.IsUrlModified == false)
        {
            this.OriginalUrl = AspUtil.RemoveDefaultHtml(AspUtil.GetCurrentRequestUrl(Page));
        }

        string s = (string)Request.Headers["SEISAPI_ORIGINAL_FILENAME"];

        if (Str.IsEmptyStr(s) == false)
        {
            this.IsFilenameModified = true;
            this.OriginalFileName   = s;
            this.OriginalFilePath   = (string)Request.Headers["SEISAPI_ORIGINAL_FILEPATH"];
        }

        string langCode = GetCurrentLangCodeFromPath(this.OriginalUrl);

        this.CurrentLanguage     = CoreLanguageList.GetLanguageClassByName(langCode);
        this.CurrentLanguageCode = CurrentLanguage.Name;

        try
        {
            HtmlFileName = AspUtil.WebPathToFilePath(currentPage, AspUtil.GetCurrentRequestUrl(currentPage));
        }
        catch
        {
        }

        if (this.IsFilenameModified)
        {
            HtmlFileName = Path.Combine(Path.GetDirectoryName(HtmlFileName), Path.GetFileName(OriginalFilePath));
        }

        try
        {
            if (fast == false)
            {
                HtmlBody = File.ReadAllText(HtmlFileName, Str.Utf8Encoding);
            }
        }
        catch
        {
        }

        PhysicalUrl = AspUtil.RemoveDefaultHtml(AspUtil.GetCurrentRequestUrl((currentPage)));

        Args = currentPage.Request.ServerVariables["QUERY_STRING"];

        if (CurrentLanguage == CoreLanguageList.Japanese)
        {
            IsCurrentLanguageSupported = true;
        }
        else
        {
            IsCurrentLanguageSupported = Str.SearchStr(HtmlBody, string.Format("<!-- ml:{0} -->", CurrentLanguage.Name), 0, false) != -1;
        }

        GoogleTranslateUrl = string.Format("http://translate.google.com/translate?js=n&prev=_t&hl=en&ie=UTF-8&layout=2&eotf=1&sl=ja&tl={1}&u={0}",
                                           HttpUtility.UrlEncode((isSsl ? "https://" : "http://") + host + this.OriginalUrl, Str.Utf8Encoding),
                                           this.CurrentLanguageCode);

        OriginalFullUrl = (isSsl ? "https://" : "http://") + host + this.OriginalUrl;

        ContentsPrintLanguage = this.CurrentLanguage;
        if (IsCurrentLanguageSupported == false)
        {
            ContentsPrintLanguage = CoreLanguageList.Japanese;
        }

        if (fast == false)
        {
            mfs             = new MultiLanguageFilterStream(Response.Filter, ContentsPrintLanguage, this.CurrentLanguage, this.BasicHostName, this.ReplaceList);
            mfs.Page        = Page;
            Response.Filter = mfs;
        }
    }