public static string UnRar(string rarPath, string unPath) { string mapPath = FPFile.GetMapPath("/bin/WinRAR.exe"); if (new FileInfo(mapPath).Exists) { try { string text = "x -inul -y -o+ -v[t,b]"; text = text + " " + rarPath + " " + unPath; ProcessStartInfo processStartInfo = new ProcessStartInfo(); processStartInfo.FileName = mapPath; processStartInfo.Arguments = text; processStartInfo.WindowStyle = ProcessWindowStyle.Hidden; Process process = new Process(); processStartInfo.UseShellExecute = false; process.StartInfo = processStartInfo; process.Start(); while (!process.HasExited) { } process.WaitForExit(); return(""); } catch (Exception ex) { return(ex.Message); } } return("请安装WinRar.exe!"); }
public static void CreateXml <T>(string filename) { lock (lockHelper) { XmlDocument xmlDocument = new XmlDocument(); XmlElement newChild = xmlDocument.CreateElement(typeof(T).Name + "s"); xmlDocument.AppendChild(newChild); FPFile.WriteFile(filename, xmlDocument.InnerXml); } }
public static T LoadModel <T>(string filename) where T : new() { string json = FPFile.ReadFile(filename); return(ToModel <T>(json)); }
public static void SaveJson <T>(List <T> list, string filename) { string content = ToJson(list); FPFile.WriteFile(filename, content); }
public static void SaveJson <T>(T model, string filename) { string content = ToJson(model); FPFile.WriteFile(filename, content); }
public static List <T> LoadList <T>(string filename) where T : new() { string json = FPFile.ReadFile(filename); return(ToList <T>(json)); }