コード例 #1
0
ファイル: ShareInfoService.cs プロジェクト: gmcclelland90/FAP
        public void RenameShareByID(string ID, string destinationName)
        {
            RootShare search = shares.Where(s => s.ID == ID).FirstOrDefault();

            if (null != search)
            {
                search.Data.Name = destinationName;
                search.Data.Save(ID);
            }
        }
コード例 #2
0
ファイル: ShareInfoService.cs プロジェクト: gmcclelland90/FAP
        public void RemoveShareByID(string id)
        {
            RootShare search = shares.Where(s => s.ID == id).FirstOrDefault();

            if (null != search)
            {
                shares.Remove(search);
            }
            string path = SaveLocation + Convert.ToBase64String(Encoding.UTF8.GetBytes(id)) + ".cache";

            if (File.Exists(path))
            {
                File.Delete(path);
            }
        }
コード例 #3
0
ファイル: ShareInfoService.cs プロジェクト: gmcclelland90/FAP
        public Directory RefreshPath(Share share)
        {
            try
            {
                model.GetAntiShutdownLock();
                lock (share)
                {
                    RootShare rs = shares.Where(s => s.ID == share.ID).FirstOrDefault();
                    if (null == rs)
                    {
                        rs      = new RootShare();
                        rs.ID   = share.ID;
                        rs.Data = new Directory();
                        shares.Add(rs);
                    }
                    rs.Data.Name      = share.Name;
                    rs.Data.Size      = 0;
                    rs.Data.ItemCount = 0;

                    RefreshFileInfo(new DirectoryInfo(share.Path), rs.Data);
                    try
                    {
                        rs.Data.Save(share.ID);
                    }
                    catch (Exception e)
                    {
                        LogManager.GetLogger("faplog").Warn("Failed save share info for " + share.Name, e);
                    }
                    return(rs.Data);
                }
            }
            finally
            {
                model.ReleaseAntiShutdownLock();
            }
        }
コード例 #4
0
ファイル: ShareInfoService.cs プロジェクト: Kayomani/FAP
        public Directory RefreshPath(Share share)
        {
            try
            {
                model.GetAntiShutdownLock();
                lock (share)
                {
                    RootShare rs = shares.Where(s => s.ID == share.ID).FirstOrDefault();
                    if (null == rs)
                    {
                        rs = new RootShare();
                        rs.ID = share.ID;
                        rs.Data = new Directory();
                        shares.Add(rs);
                    }
                    rs.Data.Name = share.Name;
                    rs.Data.Size = 0;
                    rs.Data.ItemCount = 0;

                    RefreshFileInfo(new DirectoryInfo(share.Path), rs.Data);
                    try
                    {
                        rs.Data.Save(share.ID);
                    }
                    catch (Exception e)
                    {
                        LogManager.GetLogger("faplog").Warn("Failed save share info for " + share.Name, e);
                    }
                    return rs.Data;
                }
            }
            finally
            {
                model.ReleaseAntiShutdownLock();
            }
        }