示例#1
0
        public static Overrides FromJSON(string json)
        {
            Serializeable serializeable = JsonUtility.FromJson <Serializeable>(json);

            if (serializeable.keys == null || serializeable.values == null)
            {
                return(new Overrides());
            }

            if (serializeable.keys.Length != serializeable.values.Length)
            {
                Debug.LogError("Corrupt keybind dictionary! Key and Value count don't match! Falling back to empty!");
                return(new Overrides());
            }

            Overrides overrides = new Overrides();

            for (int i = 0; i < serializeable.keys.Length; i++)
            {
                if (System.Guid.TryParse(serializeable.keys[i], out System.Guid guid))
                {
                    overrides.Add(guid, serializeable.values[i]);
                }
                else
                {
                    Debug.LogWarning($"Failed to parse guid: {serializeable.keys[i]}, mapped to {serializeable.values[i]}. Resetting to default!");
                }
            }
            return(overrides);
        }
示例#2
0
        protected virtual void SetRoot(XmlRootAttribute root)
        {
            if (root != default)
            {
                var rootAttributes = new XmlAttributes
                {
                    XmlRoot = root,
                };

                Overrides.Add(
                    type: typeof(T),
                    attributes: rootAttributes);
            }
        }
示例#3
0
        protected override void SetRoot(XmlRootAttribute root)
        {
            var rootAttributes = new XmlAttributes
            {
                XmlRoot = root,
            };

            Overrides.Add(
                type: typeof(Envelope <T>),
                attributes: rootAttributes);

            SetSoapOverrides();
            SetContentOverrides();
        }
示例#4
0
            internal LabyrinthSection(Memory M, long addr)
            {
                SectionType = M.ReadStringU(M.ReadLong(addr + 0x8, 0));

                var overridesCount    = M.ReadInt(addr + 0x5c);
                var overridesArrayPtr = M.ReadLong(addr + 0x64);

                var overridePointers = M.ReadSecondPointerArray_Count(overridesArrayPtr, overridesCount);

                if (overridesCount > 50)
                {
                    overridesCount = 50;
                }

                for (int i = 0; i < overridesCount; i++)
                {
                    var newOverride  = new LabyrinthSectionOverrides();
                    var overrideAddr = overridePointers[i];
                    newOverride.OverrideName = M.ReadStringU(M.ReadLong(overrideAddr));
                    newOverride.Name         = M.ReadStringU(M.ReadLong(overrideAddr + 0x8));
                    Overrides.Add(newOverride);
                }

                SectionAreas = new LabyrinthSectionAreas();
                var areasPtr = M.ReadLong(addr + 0x4c);

                SectionAreas.Name = M.ReadStringU(M.ReadLong(areasPtr));

                var normalCount    = M.ReadInt(areasPtr + 0x8);
                var normalArrayPtr = M.ReadLong(areasPtr + 0x10);

                SectionAreas.NormalAreasPtrs = M.ReadSecondPointerArray_Count(normalArrayPtr, normalCount);

                var cruelCount    = M.ReadInt(areasPtr + 0x18);
                var cruelArrayPtr = M.ReadLong(areasPtr + 0x20);

                SectionAreas.CruelAreasPtrs = M.ReadSecondPointerArray_Count(cruelArrayPtr, cruelCount);

                var mercCount    = M.ReadInt(areasPtr + 0x28);
                var mercArrayPtr = M.ReadLong(areasPtr + 0x30);

                SectionAreas.MercilesAreasPtrs = M.ReadSecondPointerArray_Count(mercArrayPtr, mercCount);

                var endgameCount    = M.ReadInt(areasPtr + 0x38);
                var endgameArrayPtr = M.ReadLong(areasPtr + 0x40);

                SectionAreas.EndgameAreasPtrs = M.ReadSecondPointerArray_Count(endgameArrayPtr, endgameCount);
            }
示例#5
0
        private void SetSoapOverrides()
        {
            var type = typeof(Envelope <T>);

            var properties = type.GetProperties()
                             .Where(m => !m.PropertyType.IsValueType)
                             .Where(m => m.PropertyType != typeof(string)).ToArray();

            foreach (var property in properties)
            {
                var attributes = property.GetAttributes();

                Overrides.Add(
                    type: type,
                    member: property.Name,
                    attributes: attributes);
            }
        }
示例#6
0
            internal LabyrinthSection(IMemory M, long addr, WorldAreas filesWorldAreas)
            {
                FilesWorldAreas = filesWorldAreas;
                SectionType     = M.ReadStringU(M.Read <long>(addr + 0x8, 0));

                var overridesCount    = M.Read <int>(addr + 0x5c);
                var overridesArrayPtr = M.Read <long>(addr + 0x64);

                var overridePointers = M.ReadSecondPointerArray_Count(overridesArrayPtr, overridesCount);

                for (var i = 0; i < overridesCount; i++)
                {
                    var newOverride  = new LabyrinthSectionOverrides();
                    var overrideAddr = overridePointers[i];
                    newOverride.OverrideName = M.ReadStringU(M.Read <long>(overrideAddr));
                    newOverride.Name         = M.ReadStringU(M.Read <long>(overrideAddr + 0x8));
                    Overrides.Add(newOverride);
                }

                SectionAreas = new LabyrinthSectionAreas(FilesWorldAreas);
                var areasPtr = M.Read <long>(addr + 0x4c);

                SectionAreas.Name = M.ReadStringU(M.Read <long>(areasPtr));

                var normalCount    = M.Read <int>(areasPtr + 0x8);
                var normalArrayPtr = M.Read <long>(areasPtr + 0x10);

                SectionAreas.NormalAreasPtrs = M.ReadSecondPointerArray_Count(normalArrayPtr, normalCount);

                var cruelCount    = M.Read <int>(areasPtr + 0x18);
                var cruelArrayPtr = M.Read <long>(areasPtr + 0x20);

                SectionAreas.CruelAreasPtrs = M.ReadSecondPointerArray_Count(cruelArrayPtr, cruelCount);

                var mercCount    = M.Read <int>(areasPtr + 0x28);
                var mercArrayPtr = M.Read <long>(areasPtr + 0x30);

                SectionAreas.MercilesAreasPtrs = M.ReadSecondPointerArray_Count(mercArrayPtr, mercCount);

                var endgameCount    = M.Read <int>(areasPtr + 0x38);
                var endgameArrayPtr = M.Read <long>(areasPtr + 0x40);

                SectionAreas.EndgameAreasPtrs = M.ReadSecondPointerArray_Count(endgameArrayPtr, endgameCount);
            }
示例#7
0
        private static void LoadOverrides()
        {
            var proxyOverride = (string)_proxyKey.GetValue("ProxyOverride");

            if (string.IsNullOrWhiteSpace(proxyOverride))
            {
                return;
            }

            string[] overrides = proxyOverride.Split(';');
            foreach (string @override in overrides)
            {
                if (@override == "<local>")
                {
                    IsIgnoringLocalTraffic = true;
                }
                else if (!Overrides.Contains(@override))
                {
                    Overrides.Add(@override);
                }
            }
        }
示例#8
0
 /// <summary>
 /// Adds the supplied <paramref name="theOverride"/> to the overrides contained
 /// within this instance.
 /// </summary>
 /// <param name="theOverride">
 /// The <see cref="Oragon.Spring.Objects.Factory.Support.MethodOverride"/> to be
 /// added.
 /// </param>
 public void Add(MethodOverride theOverride)
 {
     Overrides.Add(theOverride);
 }