public static LogicJSONObject DownloadJSON(string path)
        {
            try
            {
                using (WebClient client = ServerHttpClient.CreateWebClient())
                {
                    return(LogicJSONParser.ParseObject(client.DownloadString(string.Format("{0}/{1}", ServerCore.ConfigurationServer, path))));
                }
            }
            catch (Exception)
            {
                Logging.Warning(string.Format("ServerHttpClient: file {0} doesn't exist", path));
            }

            return(null);
        }
        public static byte[] DownloadAsset(string resourceSha, string path)
        {
            try
            {
                using (WebClient client = ServerHttpClient.CreateWebClient())
                {
                    return(client.DownloadData(string.Format("{0}/{1}/{2}", ResourceSettings.GetContentUrl(), resourceSha, path)));
                }
            }
            catch (Exception)
            {
                Logging.Warning(string.Format("ServerHttpClient: file {0} doesn't exist", path));
            }

            return(null);
        }
        public static byte[] DownloadBytes(string path)
        {
            try
            {
                using (WebClient client = ServerHttpClient.CreateWebClient())
                {
                    return(client.DownloadData(string.Format("{0}/{1}", ServerCore.ConfigurationServer, path)));
                }
            }
            catch (Exception)
            {
                Logging.Warning(string.Format("ServerHttpClient: file {0} doesn't exist", path));
            }

            return(null);
        }
        private static void LoadResources()
        {
            ZLibHelper.CompressInZLibFormat(LogicStringUtil.GetBytes(ServerHttpClient.DownloadString("/data/calendar.json")), out ResourceManager.SERVER_SAVE_FILE_CALENDAR);
            ZLibHelper.CompressInZLibFormat(LogicStringUtil.GetBytes(ResourceManager.LoadAssetString("globals.json")), out ResourceManager.SERVER_SAVE_FILE_GLOBAL);

            LogicDataTables.Init();
            LogicArrayList <LogicDataTableResource> resources = LogicResources.CreateDataTableResourcesArray();

            for (int i = 0; i < resources.Size(); i++)
            {
                string fileName = resources[i].GetFileName();
                string content  = ResourceManager.LoadAssetString(fileName);

                if (content != null)
                {
                    LogicResources.Load(resources, i, new CSVNode(content.Split(new[] { "\r\n", "\n" }, StringSplitOptions.None), fileName));
                }
                else
                {
                    Logging.Error(string.Format("ResourceManager.loadResources: file {0} not exist.", fileName));
                }
            }
        }
 public static byte[] LoadAsset(string file)
 {
     return(ResourceManager.DecompressAsset(file, ServerHttpClient.DownloadAsset(ResourceSettings.ResourceSHA, file)));
 }