private static void Confirm <T>(string sourceName, T sourceType) { string targetPath = Path.Combine(Properties.Resource.RootPath, sourceName); if (!string.IsNullOrEmpty(targetPath) && File.Exists(targetPath)) { return; } if (sourceType.GetType() == typeof(string)) { FileOprateHelp.SaveTextFile(sourceType.ToString(), targetPath); } else if (sourceType.GetType() == typeof(Bitmap)) { Bitmap bitmap = sourceType as Bitmap; bitmap.Save(targetPath, System.Drawing.Imaging.ImageFormat.Jpeg); } else { byte[] buffer = sourceType as byte[]; File.WriteAllBytes(targetPath, buffer); } }
/// <summary> /// 设置Log4net日志管理工具开始工作 /// </summary> /// <param name="project"></param> public static void SetLog4netWatch(this Project project) { string assemblyInfoPath = Path.Combine(project.GetDirectory(), "Properties", "AssemblyInfo.cs"); StringBuilder build1 = FileOprateHelp.ReadTextFile(assemblyInfoPath); build1.AppendLine("[assembly: log4net.Config.XmlConfigurator(Watch = true)]");//日志监视 FileOprateHelp.SaveTextFile(build1.ToString(), assemblyInfoPath); }