Esempio n. 1
0
        //private Dictionary<string, FileSimpleExXmlElement> _dicPathAndFiles = new Dictionary<string, FileSimpleExXmlElement>();

        /// <summary>
        /// Image存到System下
        /// </summary>
        /// <param name="img"></param>
        /// <param name="fileName">直接的文件名,非全路径</param>
        /// <returns></returns>
        public string ImageSaveAsResources(Image img, string fileName)
        {
            fileName += ".jpg";

            ///将文件名翻译成拼音,生成一个不重名的文件名
            string pinyinFileName = Utility.File.FormatFileName(fileName, false);
            string formatFileName = Utility.File.BuildFileName(OwnerDocument.Resources.SystemFolder.AbsoluteFilePath, pinyinFileName, false, true);

            img.Save(Path.Combine(OwnerDocument.Resources.SystemFolder.AbsoluteFilePath, formatFileName));

            FileSimpleExXmlElement fileEle = OwnerDocument.CreateFileElementNoCreateFile(OwnerDocument.Resources.SystemFolder, formatFileName, fileName);

            return(fileEle.Id);
        }