Ejemplo n.º 1
0
 protected void SetContentResponder()
 {
     _contentResponder = new ContentResponder(GetCurrentConf(true), MainLogger);
     _contentResponder.FileUploading += (o, a) => FileUploading?.Invoke(o, a);
     _contentResponder.FileUploaded  += (o, a) => FileUploaded?.Invoke(o, a);
     AddResponder(_contentResponder);
 }
Ejemplo n.º 2
0
        private void InitializeAppResponders(AppConf[] configs)
        {
            string currentMode = ProcessMode.Current.Mode.ToString();

            configs.Where(c => c.ProcessMode.Equals(currentMode)).Each(ac =>
            {
                OnAppContentResponderInitializing(ac);
                Logger.RestartLoggingThread();
                AppContentResponder responder = new AppContentResponder(this, ac)
                {
                    Logger = Logger
                };
                Subscribers.Each(logger =>
                {
                    logger.RestartLoggingThread();
                    responder.Subscribe(logger);
                });
                string appName = ac.Name.ToLowerInvariant();
                responder.Initialize();
                responder.FileUploading      += (o, a) => FileUploading?.Invoke(o, a);
                responder.FileUploaded       += (o, a) => FileUploaded?.Invoke(o, a);
                responder.Responded          += (r, context) => OnResponded(context);
                responder.NotResponded       += (r, context) => OnNotResponded(context);
                AppContentResponders[appName] = responder;

                OnAppContentResponderInitialized(ac);
            });
        }
Ejemplo n.º 3
0
        public bool Upload(out Exception e)
        {
            try
            {
                string fileToUpload = IsTerrainPng ? TerrainGenerator.Output : _baseZip;
                if (!IsTerrainPng)
                {
                    using (ZipFile zip = new ZipFile(fileToUpload))
                    {
                        zip.RemoveEntry("terrain.png");
                        zip.AddFile(TerrainGenerator.Output);
                        zip.Save();
                    }
                }
                int    name = new Random().Next();
                string ext  = IsTerrainPng ? ".png" : ".zip";
                URL = $"http://gemz.christplay.x10host.com/textures/{name}{ext}";
                byte[] res = FileUploading.UploadFile(
                    $"http://gemz.christplay.x10host.com/texture.php?new={name}{ext}",
                    fileToUpload);

                e = null;
                return(true);
            }
            catch (Exception exception)
            {
                e = exception;
                return(false);
            }
        }
Ejemplo n.º 4
0
        private void InitializeAppResponders(AppConf[] configs)
        {
            configs.Each(ac =>
            {
                OnAppContentResponderInitializing(ac);
                Logger.RestartLoggingThread();
                AppContentResponder responder = new AppContentResponder(this, ac);
                responder.Logger = Logger;
                Subscribers.Each(logger =>
                {
                    logger.RestartLoggingThread();
                    responder.Subscribe(logger);
                });
                string appName = ac.Name.ToLowerInvariant();
                responder.Initialize();
                responder.FileUploading      += (o, a) => FileUploading?.Invoke(o, a);
                responder.FileUploaded       += (o, a) => FileUploaded?.Invoke(o, a);
                AppContentResponders[appName] = responder;

                OnAppContentResponderInitialized(ac);
            });
        }