示例#1
0
    public static void initialize(string path)
    {
        string text = System.IO.File.ReadAllText(path);
        string st   = text.Replace("\r", "");

        string[] lines = st.Split(new string[] { "\n" }, StringSplitOptions.RemoveEmptyEntries);
        foreach (string line in lines)
        {
            if (line.Length > 1 && line.Substring(0, 1) == "!")
            {
                string[] mats = line.Substring(1, line.Length - 1).Split(new string[] { " ", "	"}, StringSplitOptions.RemoveEmptyEntries);
                if (mats.Length > 2)
                {
                    hashedString a = new hashedString();
                    a.region = mats[0];
                    try
                    {
                        a.hashCode = helper_stringToInt(mats[1]);
                    }
                    catch (Exception e)
                    {
                        Program.DEBUGLOG(e);
                    }
                    a.content = mats[2];
                    hashedStrings.Add(a);
                    if (a.region == "setname")
                    {
                        xilies.Add(a);
                    }
                }
            }
        }
    }
示例#2
0
    public static void initializeContent(string text)
    {
        string st = text.Replace("\r", "");

        string[] lines = st.Split(new string[] { "\n" }, StringSplitOptions.RemoveEmptyEntries);
        foreach (string line in lines)
        {
            if (line.Length > 1 && line.Substring(0, 1) == "!")
            {
                string[] mats = line.Substring(1, line.Length - 1).Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries);
                if (mats.Length > 2)
                {
                    hashedString a = new hashedString();
                    a.region = mats[0];
                    try
                    {
                        a.hashCode = helper_stringToInt(mats[1]);
                    }
                    catch (Exception e)
                    {
                        Program.DEBUGLOG(e);
                    }
                    a.content = "";
                    for (int i = 2; i < mats.Length; i++)
                    {
                        a.content += mats[i] + " ";
                    }
                    a.content = a.content.Substring(0, a.content.Length - 1);
                    if (get(a.region, a.hashCode) == "")
                    {
                        hashedStrings.Add(a);
                        if (a.region == "setname")
                        {
                            xilies.Add(a);
                        }
                    }
                }
            }
        }
    }