コード例 #1
0
ファイル: PHPC.cs プロジェクト: tjhorner/neroxnex
        public PHPC(Uri URL, bool UseAuth, string Username = "******", string Password = "******")
        {
            this.URL = URL;
            NameValueCollection data = new NameValueCollection();

            data = DataInjector.Foundation(data);
            string str = WebSocket.SendRequest(this.URL, data);

            if (str.ToLower().Contains("request;success"))
            {
                if (UseAuth)
                {
                    throw new Exception("Authorization is not required for this server");
                }
                this.UseAuth  = UseAuth;
                this.Username = Username;
                this.Password = Password;
            }
            else
            {
                if (!str.ToLower().Contains("request;failure"))
                {
                    throw new Exception($"Server returned an unknown response {str}");
                }
                if (str.ToLower().Contains("(error0@1) = auth required"))
                {
                    if (!UseAuth)
                    {
                        throw new Exception("Authorization is required for this server");
                    }
                    data = DataInjector.AddAuth(data, Username, Password);
                    str  = WebSocket.SendRequest(this.URL, data);
                    if (str.ToLower().Contains("request;failure"))
                    {
                        if (str.ToLower().Contains("(error1@1)"))
                        {
                            throw new Exception("Authorization failure, Incorrect username or password");
                        }
                        throw new Exception($"Server returned an unknown response {str}");
                    }
                    if (str.ToLower().Contains("request;success"))
                    {
                        this.UseAuth  = UseAuth;
                        this.Username = Username;
                        this.Password = Password;
                    }
                }
                else
                {
                    if (str.ToLower().Contains("(error 2@2)"))
                    {
                        throw new Exception("The server does not support this client's version");
                    }
                    throw new Exception($"Server returned an unknown response {str}");
                }
            }
        }
コード例 #2
0
    protected void DisposeChildToPool(DataInjector dataInjector)
    {
        if (dataInjector == null)
        {
            return;
        }

        objectsReturningToPool.Add(dataInjector);
        dataInjector?.Dispose(() => ReturnToPool(dataInjector));
    }
コード例 #3
0
    protected void ReturnToPool(DataInjector dataInjector)
    {
        if (objectsReturningToPool.Contains(dataInjector))
        {
            objectsReturningToPool.Remove(dataInjector);
        }

        dataInjector.gameObject.SetActive(false);
        dataInjector.gameObject.name = string.Format("{0} (Pooled)", childPrefab.Value.name);
        pooledObjects.Add(dataInjector);
        dataInjector.transform.SetAsLastSibling();
    }
コード例 #4
0
ファイル: PHPC.cs プロジェクト: tjhorner/neroxnex
        public string SendRequest(Vodka Data)
        {
            NameValueCollection data = new NameValueCollection();

            data = DataInjector.Foundation(data);
            if (this.UseAuth)
            {
                data = DataInjector.AddAuth(data, this.Username, this.Password);
            }
            data.Add("Request-Data", Vodka.Encode(Data));
            return(WebSocket.SendRequest(this.URL, data));
        }
コード例 #5
0
    protected override void ApplySet()
    {
        if (childPrefab.Value == null || dataBundle.Value == null)
        {
            return;
        }

        if (spawnedChild == null)
        {
            spawnedChild = Instantiate(childPrefab.Value, transform);
        }
        spawnedChild.name = string.Format("{0} ({1})", childPrefab.Value.name, dataBundle.Value.id);

        spawnedChild.Inject(dataBundle);
    }
コード例 #6
0
    protected DataInjector GetFromPool()
    {
        DataInjector toReturn = null;

        if (pooledObjects.Count > 0)
        {
            toReturn = pooledObjects[0];
            pooledObjects.RemoveAt(0);
            toReturn.gameObject.SetActive(true);
        }
        else
        {
            toReturn = Instantiate(childPrefab.Value, transform);
        }

        return(toReturn);
    }
コード例 #7
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddMvc((options) =>
            {
                options.Filters.Add(typeof(ValidationActionFilter));
            })
            .AddFluentValidation(fvc => fvc.RegisterValidatorsFromAssemblyContaining <BusinessInjector>())
            .AddJsonOptions(options =>
            {
                options.SerializerSettings.NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore;
                options.SerializerSettings.Formatting        = Newtonsoft.Json.Formatting.Indented;
            });

            //Register Services
            BusinessInjector.RegisterServices(Configuration, services);

            DataInjector.RegisterServices(Configuration, services);
        }
コード例 #8
0
ファイル: DataInjector.cs プロジェクト: grekomp/ArthanorUtils
    protected List <DataInjectionReceiver> GetInjectionReceivers(GameObject obj)
    {
        List <DataInjectionReceiver> dataInjectionReceivers = new List <DataInjectionReceiver>();

        dataInjectionReceivers.AddRange(obj.GetComponents <DataInjectionReceiver>());

        foreach (Transform child in obj.transform)
        {
            DataInjector injector = child.GetComponent <DataInjector>();
            if (injector)
            {
                dataInjectionReceivers.Add(injector);
            }
            else
            {
                dataInjectionReceivers.AddRange(GetInjectionReceivers(child.gameObject));
            }
        }

        dataInjectionReceivers.Remove(this);
        return(dataInjectionReceivers);
    }
コード例 #9
0
ファイル: LoadingOrder.cs プロジェクト: TheRaizer/FarmSim
 private void Awake()
 {
     dataInjector = GetComponent <DataInjector>();
     nodeGrid     = FindObjectOfType <NodeGrid>();
 }