Exemple #1
0
        public ActionResult ShareFile(string name)
        {
            List <FileInfo>      f = new List <FileInfo>();
            List <DirectoryInfo> d = new List <DirectoryInfo>();

            try
            {
                var dirs  = new DirectoryInfo(AppDomain.CurrentDomain.BaseDirectory + "\\Share\\" + name + "\\").GetDirectories();
                var files = new DirectoryInfo(AppDomain.CurrentDomain.BaseDirectory + "\\Share\\" + name + "\\").GetFiles();

                foreach (var file in files)
                {
                    f.Add(file);
                }

                foreach (var dir in dirs)
                {
                    d.Add(dir);
                }

                ApplicationLog.Debug(name);

                ViewData.Add("name", name.ToUpper());
            }
            catch (Exception ee)
            {
                ApplicationLog.Error(ee.ToString());
            }

            ViewData.Add("file", f);
            ViewData.Add("dir", d);

            return(View());
        }
Exemple #2
0
        public JsonResult SaveJavSetting(string category, string url, string name)
        {
            var ret = 0;

            try
            {
                FaviScan fs = new FaviScan();

                fs.Category = category;
                fs.Url      = url;
                fs.Name     = name;

                ret = ScanDataBaseManager.InsertFaviScan(fs);
            }
            catch (Exception ee)
            {
                ApplicationLog.Debug(ee.ToString());
            }

            if (ret > 0)
            {
                return(Json(new { success = "success" }, JsonRequestBehavior.AllowGet));
            }

            return(Json(new { success = "fail" }, JsonRequestBehavior.AllowGet));
        }
 public void Debug(string message, Exception exception = null)
 {
     if (string.IsNullOrWhiteSpace(message))
     {
         return;
     }
     message = string.Concat(LogPrefix, message);
     ApplicationLog.Debug(message + (exception == null ? "" : exception.Message));
 }
Exemple #4
0
        public ActionResult Catelog(int limitGiga = 0, int page = 1, int pageSize = 200)
        {
            var    scanResult = new List <ScanResult>();
            var    toBe       = new List <ScanResult>();
            string scanCache  = "scan";

            if (CacheTools.HasCache(scanCache))
            {
                scanResult = CacheTools.GetCache <List <ScanResult> >(scanCache);
            }
            else
            {
                scanResult = ScanDataBaseManager.GetMatchScanResult();
                CacheTools.CacheInsert(scanCache, scanResult, DateTime.Now.AddHours(3));
            }

            scanResult = scanResult.Where(x => !string.IsNullOrEmpty(x.Location)).ToList();

            if (limitGiga > 0)
            {
                double limit = (double)limitGiga * 1024 * 1024 * 1024;
                ApplicationLog.Debug("catelog -> limitGiga: " + limitGiga + " limit: " + limit);
                ApplicationLog.Debug("catelog -> beforeCount: " + scanResult.Count);

                foreach (var s in scanResult)
                {
                    if (new FileInfo(s.AvFilePath).Length >= limit)
                    {
                        toBe.Add(s);
                    }
                }

                ApplicationLog.Debug("catelog -> afterCount: " + toBe.Count);
            }
            else
            {
                toBe = scanResult;
            }

            var pageContent = toBe.OrderByDescending(x => x.ReleaseDate).Skip((page - 1) * pageSize).Take(pageSize).ToList();

            ViewData.Add("avs", pageContent);
            ViewData.Add("count", (int)Math.Ceiling((decimal)toBe.Count / pageSize));
            ViewData.Add("size", pageSize);
            ViewData.Add("current", page);
            ViewData.Add("total", toBe.Count);
            ViewData.Add("limit", limitGiga);

            return(View());
        }
Exemple #5
0
        public JsonResult SaveIniSetting(string cookieMode, string magUrl)
        {
            bool ret = true;

            try
            {
                JavINIClass.IniWriteValue("Jav", "cookieMode", cookieMode);
                JavINIClass.IniWriteValue("Mag", "sukebei", magUrl);
            } catch (Exception ee)
            {
                ApplicationLog.Debug(ee.ToString());
                ret = false;
            }

            if (ret)
            {
                return(Json(new { success = "success" }, JsonRequestBehavior.AllowGet));
            }

            return(Json(new { success = "fail" }, JsonRequestBehavior.AllowGet));
        }