Ejemplo n.º 1
0
 /// <summary>
 /// 设置FastDFS对象信息
 /// </summary>
 private static void SetFtpConfigInfo()
 {
     fastdfsList = (FastDFSConfigInfoCollection)Serializer.Load(typeof(FastDFSConfigInfoCollection), m_configfilepath);
     FastDFSConfigInfoCollection.FastDFSConfigInfoCollectionEnumerator fastdfss = fastdfsList.GetEnumerator();
     //遍历集合并设置相应的FastDFS信息(静态)对象
     while (fastdfss.MoveNext())
     {
         if (fastdfss.Current.Default == 1 && fastdfss.Current.Enable == 1)
         {
             currentFtp = fastdfss.Current;
             break;
         }
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// 根据FastDFS groupName获取FastDFS配置信息
 /// </summary>
 public static FastDFSConfigInfo GetFastDFS(string groupName)
 {
     FtpFileMonitor();
     if (string.IsNullOrEmpty(groupName))
     {
         return(CurrentFastDFS);
     }
     FastDFSConfigInfoCollection.FastDFSConfigInfoCollectionEnumerator fastdfss = fastdfsList.GetEnumerator();
     while (fastdfss.MoveNext())
     {
         if (fastdfss.Current.Enable == 1 && fastdfss.Current.Groupname == groupName)
         {
             return(fastdfss.Current);
         }
     }
     throw ExceptionManager.MessageException("对不起,存储系统组名【" + groupName + "】不存在或未启用,请检查!");
 }