public static void Add(string subsidiaryName) { try { File.AppendAllText(FilePath, subsidiaryName + "\n"); } catch (Exception ex) { ExceptManager.Write(ex); } }
public static void Remove(string subsidiaryName) { try { File.WriteAllLines(FilePath, File.ReadLines(FilePath).Where(l => l != subsidiaryName).ToList()); } catch (Exception ex) { ExceptManager.Write(ex); } }
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); } }