Example #1
0
        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!");
        }
Example #2
0
 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);
     }
 }
Example #3
0
        public static T LoadModel <T>(string filename) where T : new()
        {
            string json = FPFile.ReadFile(filename);

            return(ToModel <T>(json));
        }
Example #4
0
        public static void SaveJson <T>(List <T> list, string filename)
        {
            string content = ToJson(list);

            FPFile.WriteFile(filename, content);
        }
Example #5
0
        public static void SaveJson <T>(T model, string filename)
        {
            string content = ToJson(model);

            FPFile.WriteFile(filename, content);
        }
Example #6
0
        public static List <T> LoadList <T>(string filename) where T : new()
        {
            string json = FPFile.ReadFile(filename);

            return(ToList <T>(json));
        }