Example #1
0
 public static void SaveToFile <T>(string filePath, T entity, Action callBackF)
 {
     using (BinaryStreamServer bss = BinaryStreamServerPool.Single.GetBinaryStreamServer())
     {
         bss.SaveToFile(filePath, entity, callBackF);
     }
 }
Example #2
0
 public static MemoryStream Load(string filePath, FileMode fileMode)
 {
     using (BinaryStreamServer bss = BinaryStreamServerPool.Single.GetBinaryStreamServer())
     {
         return(bss.Load(filePath, fileMode));
     }
 }
        internal BinaryStreamServer GetBinaryStreamServer()
        {
            BinaryStreamServer temp = null;

            foreach (var item in pool)
            {
                if (!item.IsUsed)
                {
                    temp = item;
                    break;
                }
            }

            if (temp == null)
            {
                temp = new BinaryStreamServer();
                pool.Add(temp);
            }

            temp.IsUsed = true;
            return(temp);
        }