HISP/Horse Isle Server/HorseIsleServer/Security/CrossDomainPolicy.cs
2021-01-28 23:27:58 +13:00

30 lines
946 B
C#
Executable file

using HISP.Properties;
using System;
using System.IO;
using HISP.Server;
namespace HISP.Security
{
class CrossDomainPolicy
{
public static byte[] GetPolicy()
{
if (!File.Exists(ConfigReader.CrossDomainPolicyFile)) {
if (ConfigReader.Debug)
Console.WriteLine("[DEBUG] Cross-Domain-Policy file not found, using default");
File.WriteAllText(ConfigReader.CrossDomainPolicyFile, Resources.DefaultCrossDomain);
}
MemoryStream ms = new MemoryStream();
byte[] policyFileBytes = File.ReadAllBytes(ConfigReader.CrossDomainPolicyFile);
ms.Write(policyFileBytes, 0x00, policyFileBytes.Length);
ms.WriteByte(0x00);
ms.Seek(0x00, SeekOrigin.Begin);
byte[] policyFileData = ms.ToArray();
ms.Close();
return policyFileData;
}
}
}