コード例 #1
0
ファイル: XmlHelper.cs プロジェクト: TonyDongGuaPi/joework
    public static T ParseXml <T>(string filePath, System.Type type, bool _DoDecrypt = false)
    {
        object   instance = null;
        FileInfo t        = new FileInfo(filePath);

        if (t.Exists)
        {
            StreamReader r     = t.OpenText();
            string       _info = r.ReadToEnd();
            r.Close();
            string _data = _info;
            if (_data.ToString() != "")
            {
                if (_DoDecrypt)
                {
                    _data = MyTools.Decrypt_DES(_data, "12345678", "12345678");
                }

                instance = DeserializeObject(_data, type);
            }
        }
        return((T)instance);
    }