コード例 #1
0
 public static void Add(string subsidiaryName)
 {
     try
     {
         File.AppendAllText(FilePath, subsidiaryName + "\n");
     }
     catch (Exception ex)
     {
         ExceptManager.Write(ex);
     }
 }
コード例 #2
0
 public static void Remove(string subsidiaryName)
 {
     try
     {
         File.WriteAllLines(FilePath,
                            File.ReadLines(FilePath).Where(l => l != subsidiaryName).ToList());
     }
     catch (Exception ex)
     {
         ExceptManager.Write(ex);
     }
 }
コード例 #3
0
        private static void QuaterDataSave(NetworkStream stream, byte[] inputData, string clientIp)
        {
            try
            {
                QuaterDataSerialize quaterData = new QuaterDataSerialize();
                quaterData = quaterData.Deserialize(inputData);

                if (!Directory.Exists(Folder + "/" + quaterData.Subsidiary))
                {
                    Directory.CreateDirectory(Folder + "/" + quaterData.Subsidiary);
                }

                File.WriteAllBytes(Folder + "/" + quaterData.Subsidiary + "/" + quaterData.Quater + ".dat", inputData);
                var message = $"Получены данные \"{quaterData.Subsidiary}\" за {quaterData.Quater} квартал.";
                NetManager.Send(stream, NetManager.ToBytes(message));
                Console.WriteLine("{0}: {1}", clientIp, message);
            }
            catch (Exception ex)
            {
                ExceptManager.Write(ex);
            }
        }