Example #1
0
 private void SetWebRequestPriperties(HttpWebRequest webRequest)
 {
     webRequest.KeepAlive   = true;
     webRequest.Method      = SourceElement.GetAttribute("MethodDispatch");
     webRequest.Timeout     = Utils.StringToInt(SourceObject.Root.GetAttribute("Timeout"));
     webRequest.Credentials = CredentialCache.DefaultCredentials;
 }
Example #2
0
        public void Init(Gender gender = Gender.None)
        {
            if (IsInitialized)
            {
                return;
            }
            _gender = UnassignedSpritePath.Contains("[GENDER]") ? gender : Gender.None;
            ParsePath(false);
            Sprite?.Remove();
            Sprite                      = new Sprite(SourceElement, file: SpritePath);
            Limb                        = (LimbType)Enum.Parse(typeof(LimbType), SourceElement.GetAttributeString("limb", "Head"), true);
            HideLimb                    = SourceElement.GetAttributeBool("hidelimb", false);
            HideOtherWearables          = SourceElement.GetAttributeBool("hideotherwearables", false);
            CanBeHiddenByOtherWearables = SourceElement.GetAttributeBool("canbehiddenbyotherwearables", true);
            InheritLimbDepth            = SourceElement.GetAttributeBool("inheritlimbdepth", true);
            var scale = SourceElement.GetAttribute("inheritscale");

            if (scale != null)
            {
                InheritScale = scale.GetAttributeBool(false);
            }
            else
            {
                InheritScale = SourceElement.GetAttributeBool("inherittexturescale", false);
            }
            IgnoreLimbScale    = SourceElement.GetAttributeBool("ignorelimbscale", false);
            IgnoreTextureScale = SourceElement.GetAttributeBool("ignoretexturescale", false);
            IgnoreRagdollScale = SourceElement.GetAttributeBool("ignoreragdollscale", false);
            SourceElement.GetAttributeBool("inherittexturescale", false);
            InheritOrigin     = SourceElement.GetAttributeBool("inheritorigin", false);
            InheritSourceRect = SourceElement.GetAttributeBool("inheritsourcerect", false);
            DepthLimb         = (LimbType)Enum.Parse(typeof(LimbType), SourceElement.GetAttributeString("depthlimb", "None"), true);
            Sound             = SourceElement.GetAttributeString("sound", "");
            Scale             = SourceElement.GetAttributeFloat("scale", 1.0f);
            Rotation          = MathHelper.ToRadians(SourceElement.GetAttributeFloat("rotation", 0.0f));
            var index = SourceElement.GetAttributePoint("sheetindex", new Point(-1, -1));

            if (index.X > -1 && index.Y > -1)
            {
                SheetIndex = index;
            }

            HideWearablesOfType = new List <WearableType>();
            var wearableTypes = SourceElement.GetAttributeStringArray("hidewearablesoftype", null);

            if (wearableTypes != null && wearableTypes.Length > 0)
            {
                foreach (var value in wearableTypes)
                {
                    if (Enum.TryParse(value, ignoreCase: true, out WearableType wearableType))
                    {
                        HideWearablesOfType.Add(wearableType);
                    }
                }
            }

            IsInitialized = true;
        }
Example #3
0
        private void SetContentType(HttpWebRequest webRequest)
        {
            string contentType = SourceElement.GetAttribute("ContentType");

            if (contentType == "multipart/form-data")
            {
                string boundary = "---------------------------" + DateTime.Now.Ticks.ToString("x");
                webRequest.ContentType = "multipart/form-data; boundary=" + boundary;
                SetMultipartFormData(boundary);
            }
            else
            {
                webRequest.ContentType = contentType;
            }

            ContentType = contentType;
        }