Example #1
0
 internal XDeclaration(XmlReader r)
 {
     _version = r.GetAttribute("version");
     _encoding = r.GetAttribute("encoding");
     _standalone = r.GetAttribute("standalone");
     r.Read();
 }
Example #2
0
 internal XDocumentType(XmlReader r)
 {
     _name = r.Name;
     _publicId = r.GetAttribute("PUBLIC");
     _systemId = r.GetAttribute("SYSTEM");
     _internalSubset = r.Value;
     r.Read();
 }
Example #3
0
    public void LoadXML(XmlReader r)
    {
        Name=r.GetAttribute ("Name");
        IP=r.GetAttribute ("IP");
        Location=r.GetAttribute ("Location");
        string v=r.GetAttribute ("Longitude");
        if (v != null && v != "")
            lng = double.Parse (v);

        v=r.GetAttribute ("Latitude");
        if (v != null && v != "")
            lat = double.Parse (v);
    }
    /*
    //http://docs.opencv.org/doc/tutorials/calib3d/camera_calibration/camera_calibration.html
    public float fov=60;			//horizontal field of view for the camera measured in degrees
    public float cameraOffset=0;	//physical offset from human eye
    public float stereoOffset=0.065f;	//physical distance between both eyes

    public ECameraRotation[] cameraRotation=new ECameraRotation[2];

    public Vector2 OpticalCenter=new Vector2(0.5f,0.5f);
    public Vector2 FocalCoeff=new Vector2(1,1);
    public Vector4 KPCoeff=Vector4.zero;
    public string Name="";*/
    public void LoadXML(XmlReader r)
    {
        Name=r.GetAttribute ("Name");
        float.TryParse( r.GetAttribute ("FOV"),out FoV);
        float.TryParse( r.GetAttribute ("CameraOffset"),out CameraOffset);
        LensCenter=Utilities.ParseVector2( r.GetAttribute ("OpticalCenter"));
        FocalLength=Utilities.ParseVector2( r.GetAttribute ("FocalCoeff"));
        KPCoeff=Utilities.ParseVector4( r.GetAttribute ("KPCoeff"));
        Vector4 PixelShift=Utilities.ParseVector4( r.GetAttribute ("PixelShift"));
        PixelShiftLeft.Set (PixelShift.x, PixelShift.y);
        PixelShiftRight.Set (PixelShift.z, PixelShift.w);
        string rot;
        string[] names = new string[]{"LeftRotation","RightRotation"};
        for (int i=0; i<2; ++i) {
            rot = r.GetAttribute (names[i]).ToLower ();
            switch (rot) {
            case "none":
                Rotation[i]=ECameraRotation.None;
                break;
            case "flipped":
                Rotation[i]=ECameraRotation.Flipped;
                break;
            case "cw":
                Rotation[i]=ECameraRotation.CW;
                break;
            case "ccw":
                Rotation[i]=ECameraRotation.CCW;
                break;
            }
        }
    }
    public static QuestionGenerator CreateGeneratorFromXml(XmlReader reader)
    {
        bool used = reader.GetAttribute("Used").Equals("y");
        if(!used) return null;
        QuestionGenerator generator = new QuestionGenerator();
        generator.m_tags = reader.GetAttribute("Tags").Split(';');
        generator.m_type = (GeneratorType)System.Enum.Parse(typeof(GeneratorType), reader.GetAttribute("Type"));
        generator.m_weight = System.Convert.ToSingle(reader.GetAttribute("Weight"));
        generator.m_questionText = reader.GetAttribute("QuestionText");
        generator.m_adjacentWithin = System.Convert.ToInt32(reader.GetAttribute("AdjacentWithin"));
        generator.m_infoPrefix = reader.GetAttribute("InfoPrefix");
        generator.m_infoSuffix = reader.GetAttribute("InfoSuffix");
        bool preventDuplicates = generator.m_type == GeneratorType.SortedMultiset;

        reader.ReadToDescendant("Answer");
        do{
            generator.AddAnswer(reader.GetAttribute("Text"), reader.GetAttribute("Value"), preventDuplicates);
        }while(reader.ReadToNextSibling("Answer"));
        return generator;
    }
    public override void gaxb_final(XmlReader reader, object _parent, Hashtable args)
    {
        base.gaxb_final(reader, _parent, args);

        string attrib;

        if (reader != null) {
            attrib = reader.GetAttribute ("resourcePath");
            if (attrib != null) {
                resourcePath = attrib;
            }

            attrib = reader.GetAttribute ("onFinished");
            if (attrib != null) {
                onFinished = attrib;
            }

            attrib = reader.GetAttribute ("loops");
            if (attrib != null) {
                loops = bool.Parse (attrib);
            }
        }
    }
    public override void gaxb_final(XmlReader reader, object _parent, Hashtable args)
    {
        base.gaxb_final (reader, _parent, args);

        string attrib;

        if (reader != null) {
            attrib = reader.GetAttribute ("regexValidation");
            if (attrib != null) {
                regexValidation = attrib;
            }
        }

        ScheduleForStart ();
        ScheduleForUpdate ();
    }
    public override void gaxb_load(XmlReader reader, object _parent, Hashtable args)
    {
        base.gaxb_load(reader, _parent, args);

        if(reader == null && _parent == null)
            return;

        parent = _parent;

        if(this.GetType() == typeof( PUSlider ))
        {
            gaxb_addToParent();
        }

        xmlns = reader.GetAttribute("xmlns");

        string attr;
        attr = reader.GetAttribute("handleResourcePath");
        if(attr != null) { attr = PlanetUnityOverride.processString(_parent, attr); }
        if(attr != null) { handleResourcePath = attr; }

        attr = reader.GetAttribute("handleSize");
        if(attr != null) { attr = PlanetUnityOverride.processString(_parent, attr); }
        if(attr == null) { attr = "32,32"; }
        if(attr != null) { handleSize = new Vector2().PUParse(attr); }

        attr = reader.GetAttribute("fillResourcePath");
        if(attr != null) { attr = PlanetUnityOverride.processString(_parent, attr); }
        if(attr != null) { fillResourcePath = attr; }

        attr = reader.GetAttribute("onValueChanged");
        if(attr != null) { attr = PlanetUnityOverride.processString(_parent, attr); }
        if(attr != null) { onValueChanged = attr; }

        attr = reader.GetAttribute("minValue");
        if(attr != null) { attr = PlanetUnityOverride.processString(_parent, attr); }
        if(attr == null) { attr = "0"; }
        if(attr != null) { minValue = float.Parse(attr); }

        attr = reader.GetAttribute("maxValue");
        if(attr != null) { attr = PlanetUnityOverride.processString(_parent, attr); }
        if(attr == null) { attr = "1"; }
        if(attr != null) { maxValue = float.Parse(attr); }

        attr = reader.GetAttribute("direction");
        if(attr != null) { attr = PlanetUnityOverride.processString(_parent, attr); }
        if(attr != null) { direction = (PlanetUnity2.SliderDirection)Enum.Parse(typeof(PlanetUnity2.SliderDirection), attr); }
    }
Example #9
0
    public override void gaxb_load(XmlReader reader, object _parent, Hashtable args)
    {
        base.gaxb_load(reader, _parent, args);

        if(reader == null && _parent == null)
            return;

        parent = _parent;

        if(this.GetType() == typeof( PUCode ))
        {
            gaxb_addToParent();
        }

        xmlns = reader.GetAttribute("xmlns");

        string attr;
        attr = reader.GetAttribute("class");
        if(attr != null && planetOverride != null) { attr = processStringMethod.Invoke(null, new [] {_parent, attr}).ToString(); }
        if(attr != null) { _class = attr; _classExists = true; }

        attr = reader.GetAttribute("singleton");
        if(attr != null && planetOverride != null) { attr = processStringMethod.Invoke(null, new [] {_parent, attr}).ToString(); }
        if(attr == null) { attr = "false"; }
        if(attr != null) { singleton = bool.Parse(attr); singletonExists = true; }
    }
Example #10
0
    // Read and extract into Element class each attribut of node name "element"
    Element check_attribute_element(XmlReader xml_reader, Element element)
    {
        if (xml_reader.HasAttributes)
        {
            while (xml_reader.MoveToNextAttribute() != false)
            {
                string prefab_name = "";

                if ((prefab_name = xml_reader.GetAttribute("prefab")) != null)
                {
                    if (Resources.Load(prefab_name) != null)
                        element.prefab = Resources.Load(prefab_name) as GameObject;
                }
            }
        }
        return element;
    }
Example #11
0
    public override void gaxb_load(XmlReader reader, object _parent, Hashtable args)
    {
        base.gaxb_load(reader, _parent, args);

        if(reader == null && _parent == null)
            return;

        parent = _parent;

        if(this.GetType() == typeof( PUCode ))
        {
            gaxb_addToParent();
        }

        //xmlns = reader.GetAttribute("xmlns");

        string attr;
        attr = reader.GetAttribute("class");
        if(attr != null) { attr = PlanetUnityOverride.processString(_parent, attr); }
        if(attr != null) { _class = attr; }

        attr = reader.GetAttribute("singleton");
        if(attr != null) { attr = PlanetUnityOverride.processString(_parent, attr); }
        if(attr == null) { attr = "false"; }
        if(attr != null) { singleton = bool.Parse(attr); }
    }
    public override void gaxb_load(XmlReader reader, object _parent, Hashtable args)
    {
        base.gaxb_load(reader, _parent, args);

        if(reader == null && _parent == null)
            return;

        parent = _parent;

        if(this.GetType() == typeof( PUHorizontalLayoutGroup ))
        {
            gaxb_addToParent();
        }

        xmlns = reader.GetAttribute("xmlns");

        string attr;
        attr = reader.GetAttribute("spacing");
        if(attr != null) { attr = PlanetUnityOverride.processString(_parent, attr); }
        if(attr == null) { attr = "0"; }
        if(attr != null) { spacing = float.Parse(attr); }

        attr = reader.GetAttribute("padding");
        if(attr != null) { attr = PlanetUnityOverride.processString(_parent, attr); }
        if(attr == null) { attr = "0,0,0,0"; }
        if(attr != null) { padding = new Vector4().PUParse(attr); }

        attr = reader.GetAttribute("childAlignment");
        if(attr != null) { attr = PlanetUnityOverride.processString(_parent, attr); }
        if(attr != null) { childAlignment = (PlanetUnity2.GridLayoutChildAlignment)Enum.Parse(typeof(PlanetUnity2.GridLayoutChildAlignment), attr); }
    }
    public override void gaxb_load(XmlReader reader, object _parent, Hashtable args)
    {
        base.gaxb_load(reader, _parent, args);

        if(reader == null && _parent == null)
            return;

        parent = _parent;

        if(this.GetType() == typeof( PUGridLayoutGroup ))
        {
            gaxb_addToParent();
        }

        //xmlns = reader.GetAttribute("xmlns");

        string attr;
        attr = reader.GetAttribute("cellSize");
        if(attr != null) { attr = PlanetUnityOverride.processString(_parent, attr); }
        if(attr == null) { attr = "100,100"; }
        if(attr != null) { cellSize = new Vector2().PUParse(attr); }

        attr = reader.GetAttribute("spacing");
        if(attr != null) { attr = PlanetUnityOverride.processString(_parent, attr); }
        if(attr == null) { attr = "0,0"; }
        if(attr != null) { spacing = new Vector2().PUParse(attr); }

        attr = reader.GetAttribute("startCorner");
        if(attr != null) { attr = PlanetUnityOverride.processString(_parent, attr); }
        if(attr != null) { startCorner = (PlanetUnity2.GridLayoutStartCorner)Enum.Parse(typeof(PlanetUnity2.GridLayoutStartCorner), attr); }

        attr = reader.GetAttribute("startAxis");
        if(attr != null) { attr = PlanetUnityOverride.processString(_parent, attr); }
        if(attr != null) { startAxis = (PlanetUnity2.GridLayoutStartAxis)Enum.Parse(typeof(PlanetUnity2.GridLayoutStartAxis), attr); }

        attr = reader.GetAttribute("childAlignment");
        if(attr != null) { attr = PlanetUnityOverride.processString(_parent, attr); }
        if(attr != null) { childAlignment = (PlanetUnity2.GridLayoutChildAlignment)Enum.Parse(typeof(PlanetUnity2.GridLayoutChildAlignment), attr); }

        attr = reader.GetAttribute("fixedRows");
        if(attr != null) { attr = PlanetUnityOverride.processString(_parent, attr); }
        if(attr != null) { fixedRows = (int)float.Parse(attr); }

        attr = reader.GetAttribute("fixedColumns");
        if(attr != null) { attr = PlanetUnityOverride.processString(_parent, attr); }
        if(attr != null) { fixedColumns = (int)float.Parse(attr); }
    }
Example #14
0
    public override void gaxb_load(XmlReader reader, object _parent, Hashtable args)
    {
        base.gaxb_load(reader, _parent, args);

        if(reader == null && _parent == null)
            return;

        parent = _parent;

        if(this.GetType() == typeof( PUGameObject ))
        {
            gaxb_addToParent();
        }

        xmlns = reader.GetAttribute("xmlns");

        string attr;
        attr = reader.GetAttribute("bounds");
        if(attr != null && planetOverride != null) { attr = processStringMethod.Invoke(null, new [] {_parent, attr}).ToString(); }
        if(attr != null) { bounds = attr; boundsExists = true; }

        attr = reader.GetAttribute("rotation");
        if(attr != null && planetOverride != null) { attr = processStringMethod.Invoke(null, new [] {_parent, attr}).ToString(); }
        if(attr != null) { rotation = attr; rotationExists = true; }

        attr = reader.GetAttribute("hidden");
        if(attr != null && planetOverride != null) { attr = processStringMethod.Invoke(null, new [] {_parent, attr}).ToString(); }
        if(attr != null) { hidden = bool.Parse(attr); hiddenExists = true; }

        attr = reader.GetAttribute("lastY");
        if(attr != null && planetOverride != null) { attr = processStringMethod.Invoke(null, new [] {_parent, attr}).ToString(); }
        if(attr != null) { lastY = float.Parse(attr); lastYExists = true; }

        attr = reader.GetAttribute("lastX");
        if(attr != null && planetOverride != null) { attr = processStringMethod.Invoke(null, new [] {_parent, attr}).ToString(); }
        if(attr != null) { lastX = float.Parse(attr); lastXExists = true; }

        attr = reader.GetAttribute("renderQueueOffset");
        if(attr != null && planetOverride != null) { attr = processStringMethod.Invoke(null, new [] {_parent, attr}).ToString(); }
        if(attr != null) { renderQueueOffset = int.Parse(attr); renderQueueOffsetExists = true; }

        attr = reader.GetAttribute("clipDepth");
        if(attr != null && planetOverride != null) { attr = processStringMethod.Invoke(null, new [] {_parent, attr}).ToString(); }
        if(attr == null) { attr = "false"; }
        if(attr != null) { clipDepth = bool.Parse(attr); clipDepthExists = true; }

        attr = reader.GetAttribute("clipStencil");
        if(attr != null && planetOverride != null) { attr = processStringMethod.Invoke(null, new [] {_parent, attr}).ToString(); }
        if(attr == null) { attr = "false"; }
        if(attr != null) { clipStencil = bool.Parse(attr); clipStencilExists = true; }
    }
Example #15
0
    public override void gaxb_load(XmlReader reader, object _parent, Hashtable args)
    {
        base.gaxb_load(reader, _parent, args);

        if(reader == null && _parent == null)
            return;

        parent = _parent;

        if(this.GetType() == typeof( PUCanvas ))
        {
            gaxb_addToParent();
        }

        //xmlns = reader.GetAttribute("xmlns");

        string attr;
        attr = reader.GetAttribute("renderMode");
        if(attr != null) { attr = PlanetUnityOverride.processString(_parent, attr); }
        if(attr == null) { attr = "ScreenSpaceOverlay"; }
        if(attr != null) { renderMode = (PlanetUnity2.CanvasRenderMode)Enum.Parse(typeof(PlanetUnity2.CanvasRenderMode), attr); }

        attr = reader.GetAttribute("pixelPerfect");
        if(attr != null) { attr = PlanetUnityOverride.processString(_parent, attr); }
        if(attr == null) { attr = "false"; }
        if(attr != null) { pixelPerfect = bool.Parse(attr); }
    }
Example #16
0
    public override void gaxb_load(XmlReader reader, object _parent, Hashtable args)
    {
        base.gaxb_load(reader, _parent, args);

        if(reader == null && _parent == null)
            return;

        parent = _parent;

        if(this.GetType() == typeof( PUText ))
        {
            gaxb_addToParent();
        }

        //xmlns = reader.GetAttribute("xmlns");

        string attr;
        attr = reader.GetAttribute("font");
        if(attr != null) { attr = PlanetUnityOverride.processString(_parent, attr); }
        if(attr != null) { font = attr; }

        attr = reader.GetAttribute("fontSize");
        if(attr != null) { attr = PlanetUnityOverride.processString(_parent, attr); }
        if(attr == null) { attr = "12"; }
        if(attr != null) { fontSize = (int)float.Parse(attr); }

        attr = reader.GetAttribute("fontStyle");
        if(attr != null) { attr = PlanetUnityOverride.processString(_parent, attr); }
        if(attr != null) { fontStyle = (PlanetUnity2.FontStyle)Enum.Parse(typeof(PlanetUnity2.FontStyle), attr); }

        attr = reader.GetAttribute("fontColor");
        if(attr != null) { attr = PlanetUnityOverride.processString(_parent, attr); }
        if(attr == null) { attr = "0,0,0,1"; }
        if(attr != null) { fontColor = new Color().PUParse(attr); }

        attr = reader.GetAttribute("lineSpacing");
        if(attr != null) { attr = PlanetUnityOverride.processString(_parent, attr); }
        if(attr != null) { lineSpacing = float.Parse(attr); }

        attr = reader.GetAttribute("alignment");
        if(attr != null) { attr = PlanetUnityOverride.processString(_parent, attr); }
        if(attr == null) { attr = "middleCenter"; }
        if(attr != null) { alignment = (PlanetUnity2.TextAlignment)Enum.Parse(typeof(PlanetUnity2.TextAlignment), attr); }

        attr = reader.GetAttribute("value");
        if(attr != null) { attr = PlanetUnityOverride.processString(_parent, attr); }
        if(attr != null) { value = attr; }

        attr = reader.GetAttribute("sizeToFit");
        if(attr != null) { attr = PlanetUnityOverride.processString(_parent, attr); }
        if(attr != null) { sizeToFit = bool.Parse(attr); }

        attr = reader.GetAttribute("maxFontSize");
        if(attr != null) { attr = PlanetUnityOverride.processString(_parent, attr); }
        if(attr != null) { maxFontSize = (int)float.Parse(attr); }

        attr = reader.GetAttribute("minFontSize");
        if(attr != null) { attr = PlanetUnityOverride.processString(_parent, attr); }
        if(attr != null) { minFontSize = (int)float.Parse(attr); }

        attr = reader.GetAttribute("vOverflow");
        if(attr != null) { attr = PlanetUnityOverride.processString(_parent, attr); }
        if(attr != null) { vOverflow = bool.Parse(attr); }

        attr = reader.GetAttribute("hOverflow");
        if(attr != null) { attr = PlanetUnityOverride.processString(_parent, attr); }
        if(attr != null) { hOverflow = bool.Parse(attr); }

        attr = reader.GetAttribute("onLinkClick");
        if(attr != null) { attr = PlanetUnityOverride.processString(_parent, attr); }
        if(attr != null) { onLinkClick = attr; }
    }
    private void ComputeFieldInfo(DynamicTraceEventData template, XmlReader reader)
    {
        List<string> payloadNames = new List<string>();
        List<DynamicTraceEventData.PayloadFetch> payloadFetches = new List<DynamicTraceEventData.PayloadFetch>();
        short offset = 0;
        while (reader.Read())
        {
            if (reader.Name == "data")
            {
                Type type = GetTypeForManifestTypeName(reader.GetAttribute("inType"));
                short size = DynamicTraceEventData.SizeOfType(type);

                // TODO There is disagreement in what win:Boolean means.  Currently it is serialized as 1 byte
                // by manage code.  However all other windows tools assume it is 4 bytes.   we are likely
                // to change this to align with windows at some point.

                payloadNames.Add(reader.GetAttribute("name"));
                payloadFetches.Add(new DynamicTraceEventData.PayloadFetch(offset, size, type));
                if (offset >= 0)
                {
                    Debug.Assert(size != 0);
                    if (size >= 0)
                        offset += size;
                    else
                        offset = short.MinValue;
                }
            }
        }
        template.payloadNames = payloadNames.ToArray();
        template.payloadFetches = payloadFetches.ToArray();
    }
Example #18
0
    public override void gaxb_load(XmlReader reader, object _parent, Hashtable args)
    {
        base.gaxb_load(reader, _parent, args);

        if(reader == null && _parent == null)
            return;

        parent = _parent;

        if(this.GetType() == typeof( PUTable ))
        {
            gaxb_addToParent();
        }

        xmlns = reader.GetAttribute("xmlns");
    }
Example #19
0
    public override void gaxb_load(XmlReader reader, object _parent, Hashtable args)
    {
        base.gaxb_load(reader, _parent, args);

        if(reader == null && _parent == null)
            return;

        parent = _parent;

        if(this.GetType() == typeof( PUMovie ))
        {
            gaxb_addToParent();
        }

        xmlns = reader.GetAttribute("xmlns");

        string attr;
        attr = reader.GetAttribute("hasAlpha");
        if(attr != null && planetOverride != null) { attr = processStringMethod.Invoke(null, new [] {_parent, attr}).ToString(); }
        if(attr != null) { hasAlpha = bool.Parse(attr); hasAlphaExists = true; }

        attr = reader.GetAttribute("looping");
        if(attr != null && planetOverride != null) { attr = processStringMethod.Invoke(null, new [] {_parent, attr}).ToString(); }
        if(attr != null) { looping = bool.Parse(attr); loopingExists = true; }

        attr = reader.GetAttribute("resourcePath");
        if(attr != null && planetOverride != null) { attr = processStringMethod.Invoke(null, new [] {_parent, attr}).ToString(); }
        if(attr != null) { resourcePath = attr; resourcePathExists = true; }

        attr = reader.GetAttribute("shader");
        if(attr != null && planetOverride != null) { attr = processStringMethod.Invoke(null, new [] {_parent, attr}).ToString(); }
        if(attr != null) { shader = attr; shaderExists = true; }

        attr = reader.GetAttribute("anchor");
        if(attr != null && planetOverride != null) { attr = processStringMethod.Invoke(null, new [] {_parent, attr}).ToString(); }
        if(attr == null) { attr = "0,0"; }
        if(attr != null) { anchor = attr; anchorExists = true; }

        attr = reader.GetAttribute("color");
        if(attr != null && planetOverride != null) { attr = processStringMethod.Invoke(null, new [] {_parent, attr}).ToString(); }
        if(attr != null) { color = attr; colorExists = true; }
    }
Example #20
0
                public StackPanel( CreateParams parentParams, XmlReader reader )
                {
                    Initialize( );

                    // Always get our style first
                    mStyle = parentParams.Style;
                    Styles.Style.ParseStyleAttributesWithDefaults( reader, ref mStyle, ref ControlStyles.mStackPanel );

                    // check for attributes we support
                    RectangleF bounds = new RectangleF( );
                    SizeF parentSize = new SizeF( parentParams.Width, parentParams.Height );
                    ParseCommonAttribs( reader, ref parentSize, ref bounds );

                    // Get margins and padding
                    RectangleF padding;
                    RectangleF margin;
                    GetMarginsAndPadding( ref mStyle, ref parentSize, ref bounds, out margin, out padding );

                    // apply margins to as much of the bounds as we can (bottom must be done by our parent container)
                    ApplyImmediateMargins( ref bounds, ref margin, ref parentSize );
                    Margin = margin;

                    // check for border styling
                    int borderPaddingPx = 0;
                    if ( mStyle.mBorderColor.HasValue )
                    {
                        BorderView.BorderColor = mStyle.mBorderColor.Value;
                    }

                    if( mStyle.mBorderRadius.HasValue )
                    {
                        BorderView.CornerRadius = mStyle.mBorderRadius.Value;
                    }

                    if( mStyle.mBorderWidth.HasValue )
                    {
                        BorderView.BorderWidth = mStyle.mBorderWidth.Value;
                        borderPaddingPx = (int)Rock.Mobile.Graphics.Util.UnitToPx( mStyle.mBorderWidth.Value + PrivateNoteConfig.BorderPadding );
                    }

                    if( mStyle.mBackgroundColor.HasValue )
                    {
                        BorderView.BackgroundColor = mStyle.mBackgroundColor.Value;
                    }
                    //

                    // now calculate the available width based on padding. (Don't actually change our width)
                    float availableWidth = bounds.Width - padding.Left - padding.Width - (borderPaddingPx * 2);

                    // now read what our children's alignment should be
                    // check for alignment
                    string result = reader.GetAttribute( "ChildAlignment" );
                    if( string.IsNullOrEmpty( result ) == false )
                    {
                        switch( result )
                        {
                            case "Left":
                            {
                                ChildHorzAlignment = Alignment.Left;
                                break;
                            }
                            case "Right":
                            {
                                ChildHorzAlignment = Alignment.Right;
                                break;
                            }
                            case "Center":
                            {
                                ChildHorzAlignment = Alignment.Center;
                                break;
                            }
                            default:
                            {
                                ChildHorzAlignment = mStyle.mAlignment.Value;
                                break;
                            }
                        }
                    }
                    else
                    {
                        // if it wasn't specified, use left alignment.
                        ChildHorzAlignment = Alignment.Left;
                    }

                    // Parse Child Controls
                    bool finishedParsing = false;
                    while( finishedParsing == false && reader.Read( ) )
                    {
                        switch( reader.NodeType )
                        {
                            case XmlNodeType.Element:
                            {
                                // let each child have our available width.
                                Style style = new Style( );
                                style = mStyle;
                                style.mAlignment = ChildHorzAlignment;
                                IUIControl control = Parser.TryParseControl( new CreateParams( this, availableWidth, parentParams.Height, ref style ), reader );
                                if( control != null )
                                {
                                    ChildControls.Add( control );
                                }
                                break;
                            }

                            case XmlNodeType.EndElement:
                            {
                                // if we hit the end of our label, we're done.
                                //if( reader.Name == "StackPanel" || reader.Name == "SP" )
                                if( ElementTagMatches( reader.Name ) )
                                {
                                    finishedParsing = true;
                                }

                                break;
                            }
                        }
                    }

                    LayoutStackPanel( bounds, padding.Left, padding.Top, availableWidth, padding.Height, borderPaddingPx );
                }
Example #21
0
    public override void gaxb_load(XmlReader reader, object _parent, Hashtable args)
    {
        base.gaxb_load(reader, _parent, args);

        if(reader == null && _parent == null)
            return;

        parent = _parent;

        if(this.GetType() == typeof( PUSwitcher ))
        {
            gaxb_addToParent();
        }

        //xmlns = reader.GetAttribute("xmlns");

        string attr;
        attr = reader.GetAttribute("currentIndex");
        if(attr != null) { attr = PlanetUnityOverride.processString(_parent, attr); }
        if(attr == null) { attr = "0"; }
        if(attr != null) { currentIndex = (int)float.Parse(attr); }
    }
Example #22
0
    // Read and extract into InterfaceRight class each attribut of node name "group"
    InterfaceElement check_attribute_group(XmlReader xml_reader)
    {
        InterfaceElement s_InterfaceElement = new InterfaceElement();
        s_InterfaceElement.mse_type = 0;
        s_InterfaceElement.b_toggle_type = false;
        s_InterfaceElement.s_content = "undefined";
        s_InterfaceElement.s_text_area = "Choose a title";

        if (xml_reader.HasAttributes)
        {
            while (xml_reader.MoveToNextAttribute() != false)
            {
                bool valide_type = true;
                string save_type = "";
                string save_readstring = "";
                string save_content = "";

                // if type exist, else, a button will be created
                if ((save_type = xml_reader.GetAttribute("type")) != null)
                {
                    if (Enum.IsDefined(typeof(me_button_type),save_type) == true)
                        s_InterfaceElement.mse_type = (me_button_type)Enum.Parse(typeof(me_button_type), save_type);
                    else
                        valide_type = false;
                }

                // if content as attribute or string exist, else, "undefined" has been saved
                if ((save_content = xml_reader.GetAttribute("content")) != null || (save_readstring = xml_reader.ReadString()) != null)
                {
                    s_InterfaceElement.s_content = save_content != null ? save_content : save_readstring;
                    if (valide_type == false)
                        s_InterfaceElement.s_content += " (Coming Soon)";
                }
            }
        }
        return s_InterfaceElement;
    }
    public override void gaxb_load(XmlReader reader, object _parent, Hashtable args)
    {
        base.gaxb_load(reader, _parent, args);

        if(reader == null && _parent == null)
            return;

        parent = _parent;

        if(this.GetType() == typeof( PUSimpleTable ))
        {
            gaxb_addToParent();
        }

        //xmlns = reader.GetAttribute("xmlns");

        string attr;
        attr = reader.GetAttribute("cellSize");
        if(attr != null) { attr = PlanetUnityOverride.processString(_parent, attr); }
        if(attr != null) { cellSize = new Vector2().PUParse(attr); }

        attr = reader.GetAttribute("headerSize");
        if(attr != null) { attr = PlanetUnityOverride.processString(_parent, attr); }
        if(attr == null) { attr = "0,0"; }
        if(attr != null) { headerSize = new Vector2().PUParse(attr); }

        attr = reader.GetAttribute("asynchronous");
        if(attr != null) { attr = PlanetUnityOverride.processString(_parent, attr); }
        if(attr == null) { attr = "true"; }
        if(attr != null) { asynchronous = bool.Parse(attr); }
    }
    public override void gaxb_load(XmlReader reader, object _parent, Hashtable args)
    {
        base.gaxb_load(reader, _parent, args);

        if(reader == null && _parent == null)
            return;

        parent = _parent;

        if(this.GetType() == typeof( PUNotification ))
        {
            gaxb_addToParent();
        }

        //xmlns = reader.GetAttribute("xmlns");

        string attr;
        attr = reader.GetAttribute("name");
        if(attr != null) { attr = PlanetUnityOverride.processString(_parent, attr); }
        if(attr != null) { name = attr; }
    }
	static void AddElementToList(string in_currentPathInProj, XmlReader in_reader, AssetType in_type, LinkedList<AkWwiseProjectData.PathElement> in_pathAndIcons, int in_wwuIndex)
	{
		if (in_type.RootDirectoryName == "Events" || in_type.RootDirectoryName == "Master-Mixer Hierarchy" || in_type.RootDirectoryName == "SoundBanks")
		{
			AkWwiseProjectData.Event valueToAdd = new AkWwiseProjectData.Event();
			
			valueToAdd.Name = in_reader.GetAttribute("Name");
			valueToAdd.Guid = new Guid(in_reader.GetAttribute("ID")).ToByteArray();
			valueToAdd.ID = (int)AkUtilities.ShortIDGenerator.Compute(valueToAdd.Name);
			valueToAdd.Path = in_type.RootDirectoryName == "Master-Mixer Hierarchy" ? in_currentPathInProj : Path.Combine(in_currentPathInProj, valueToAdd.Name);
			valueToAdd.PathAndIcons = new List<AkWwiseProjectData.PathElement>(in_pathAndIcons);
			
			if (in_type.RootDirectoryName == "Events")
			{
				valueToAdd.PathAndIcons.Add(new AkWwiseProjectData.PathElement(valueToAdd.Name, AkWwiseProjectData.WwiseObjectType.EVENT));
				AkWwiseProjectInfo.GetData().EventWwu[in_wwuIndex].List.Add(valueToAdd);
			}
			else if (in_type.RootDirectoryName == "SoundBanks")
			{
				valueToAdd.PathAndIcons.Add(new AkWwiseProjectData.PathElement(valueToAdd.Name, AkWwiseProjectData.WwiseObjectType.SOUNDBANK));
				AkWwiseProjectInfo.GetData().BankWwu[in_wwuIndex].List.Add(valueToAdd);
			}
			else
			{
				AkWwiseProjectInfo.GetData().AuxBusWwu[in_wwuIndex].List.Add(valueToAdd);
			}
			
			in_reader.Read();
		}
		else if (in_type.RootDirectoryName == "States" || in_type.RootDirectoryName == "Switches")
		{
			var XmlElement = XNode.ReadFrom(in_reader) as XElement;
			
			AkWwiseProjectData.GroupValue valueToAdd = new AkWwiseProjectData.GroupValue();
			AkWwiseProjectData.WwiseObjectType SubElemIcon;
			valueToAdd.Name = XmlElement.Attribute("Name").Value;
			valueToAdd.Guid = new Guid(XmlElement.Attribute("ID").Value).ToByteArray();
			valueToAdd.ID = (int)AkUtilities.ShortIDGenerator.Compute(valueToAdd.Name);
			valueToAdd.Path = Path.Combine(in_currentPathInProj, valueToAdd.Name);
			valueToAdd.PathAndIcons = new List<AkWwiseProjectData.PathElement>(in_pathAndIcons);
			
			if (in_type.RootDirectoryName == "States")
			{
				SubElemIcon = AkWwiseProjectData.WwiseObjectType.STATE;
				valueToAdd.PathAndIcons.Add(new AkWwiseProjectData.PathElement(valueToAdd.Name, AkWwiseProjectData.WwiseObjectType.STATEGROUP));
			}
			else
			{
				SubElemIcon = AkWwiseProjectData.WwiseObjectType.SWITCH;
				valueToAdd.PathAndIcons.Add(new AkWwiseProjectData.PathElement(valueToAdd.Name, AkWwiseProjectData.WwiseObjectType.SWITCHGROUP));
			}
			
			XName ChildrenList = XName.Get("ChildrenList");
			XName ChildElem = XName.Get(in_type.ChildElementName);
			
			XElement ChildrenElement = XmlElement.Element(ChildrenList);
			if (ChildrenElement != null)
			{
				foreach (var element in ChildrenElement.Elements(ChildElem))
				{
					if (element.Name == in_type.ChildElementName)
					{
						string elementName = element.Attribute("Name").Value;
						valueToAdd.values.Add(elementName);
						valueToAdd.ValueGuids.Add(new AkWwiseProjectData.ByteArrayWrapper( new Guid(element.Attribute("ID").Value).ToByteArray()));
						valueToAdd.valueIDs.Add((int)AkUtilities.ShortIDGenerator.Compute(elementName));
						valueToAdd.ValueIcons.Add(new AkWwiseProjectData.PathElement(elementName, SubElemIcon));
					}
				}
			}
			
			if (in_type.RootDirectoryName == "States")
			{
				AkWwiseProjectInfo.GetData().StateWwu[in_wwuIndex].List.Add(valueToAdd);
			}
			else
			{
				AkWwiseProjectInfo.GetData().SwitchWwu[in_wwuIndex].List.Add(valueToAdd);
			}
		}
		else
		{
			Debug.LogError("WwiseUnity: Unknown asset type in WWU parser");
		}
	}    
Example #26
0
    public override void gaxb_load(XmlReader reader, object _parent, Hashtable args)
    {
        base.gaxb_load(reader, _parent, args);

        if(reader == null && _parent == null)
            return;

        parent = _parent;

        if(this.GetType() == typeof( PUSprite ))
        {
            gaxb_addToParent();
        }

        xmlns = reader.GetAttribute("xmlns");

        string attr;
        attr = reader.GetAttribute("resourcePath");
        if(attr != null && planetOverride != null) { attr = processStringMethod.Invoke(null, new [] {_parent, attr}).ToString(); }
        if(attr != null) { resourcePath = attr; resourcePathExists = true; }

        attr = reader.GetAttribute("position");
        if(attr != null && planetOverride != null) { attr = processStringMethod.Invoke(null, new [] {_parent, attr}).ToString(); }
        if(attr != null) { position = attr; positionExists = true; }

        attr = reader.GetAttribute("scale");
        if(attr != null && planetOverride != null) { attr = processStringMethod.Invoke(null, new [] {_parent, attr}).ToString(); }
        if(attr != null) { scale = float.Parse(attr); scaleExists = true; }
    }
 private void Init()
 {
     try
     {
         XmlReaderSettings settings = new XmlReaderSettings();
         settings.IgnoreComments = true;
         settings.IgnoreWhitespace = true;
         System.IO.MemoryStream stream = new System.IO.MemoryStream(serializedManifest);
         reader = XmlReader.Create(stream, settings);
         if (reader.Read() && reader.Name == "provider")
         {
             guid = new Guid(reader.GetAttribute("guid"));
             name = reader.GetAttribute("name");
             fileName = reader.GetAttribute("resourceFileName");
         }
     }
     catch (Exception e)
     {
         Debug.Assert(false, "Exception during manifest parsing");
         name = "";
         error = e;
     }
     inited = true;
 }
    public override void gaxb_load(XmlReader reader, object _parent, Hashtable args)
    {
        base.gaxb_load(reader, _parent, args);

        if(reader == null && _parent == null)
            return;

        parent = _parent;

        if(this.GetType() == typeof( PUAspectFit ))
        {
            gaxb_addToParent();
        }

        xmlns = reader.GetAttribute("xmlns");

        string attr;
        attr = reader.GetAttribute("contentSize");
        if(attr != null) { attr = PlanetUnityOverride.processString(_parent, attr); }
        if(attr == null) { attr = "0,0"; }
        if(attr != null) { contentSize = new Vector2().PUParse(attr); }

        attr = reader.GetAttribute("mode");
        if(attr != null) { attr = PlanetUnityOverride.processString(_parent, attr); }
        if(attr == null) { attr = "FitInParent"; }
        if(attr != null) { mode = (PlanetUnity2.AspectFitMode)Enum.Parse(typeof(PlanetUnity2.AspectFitMode), attr); }
    }
    public override void gaxb_load(XmlReader reader, object _parent, Hashtable args)
    {
        base.gaxb_load(reader, _parent, args);

        if(reader == null && _parent == null)
            return;

        parent = _parent;

        if(this.GetType() == typeof( PUColorButton ))
        {
            gaxb_addToParent();
        }

        xmlns = reader.GetAttribute("xmlns");

        string attr;
        attr = reader.GetAttribute("onTouchUp");
        if(attr != null) { attr = PlanetUnityOverride.processString(_parent, attr); }
        if(attr != null) { onTouchUp = attr; }

        attr = reader.GetAttribute("onTouchDown");
        if(attr != null) { attr = PlanetUnityOverride.processString(_parent, attr); }
        if(attr != null) { onTouchDown = attr; }

        attr = reader.GetAttribute("pressedColor");
        if(attr != null) { attr = PlanetUnityOverride.processString(_parent, attr); }
        if(attr != null) { pressedColor = new Color().PUParse(attr); }
    }
Example #30
0
                public static void ParseBounds( XmlReader reader, ref SizeF parentSize, ref RectangleF bounds )
                {
                    // first check without the Margin prefix.
                    string result = reader.GetAttribute( "Left" );
                    if( string.IsNullOrEmpty( result ) == false )
                    {
                        bounds.X = ParsePositioningValue( result );
                    }

                    result = reader.GetAttribute( "Top" );
                    if( string.IsNullOrEmpty( result ) == false )
                    {
                        bounds.Y = ParsePositioningValue( result );
                    }
                    //TODO: Support Right, Bottom

                    // Get width/height
                    result = reader.GetAttribute( "Width" );
                    if( string.IsNullOrEmpty( result ) == false )
                    {
                        bounds.Width = ParsePositioningValue( result );
                    }

                    result = reader.GetAttribute( "Height" );
                    if( string.IsNullOrEmpty( result ) == false )
                    {
                        bounds.Height = ParsePositioningValue( result );
                    }

                    // Convert percentages to whole values
                    if( bounds.X < 1 )
                    {
                        bounds.X = parentSize.Width * bounds.X;
                    }
                    if( bounds.Y < 1 )
                    {
                        bounds.Y = parentSize.Height * bounds.Y;
                    }
                    if( bounds.Width < 1 )
                    {
                        bounds.Width = Math.Max( 1, parentSize.Width - bounds.X ) * bounds.Width;
                        if( bounds.Width == 0 )
                        {
                            // if 0, just take the our parents width
                            bounds.Width = Math.Max( 1, parentSize.Width - bounds.X );
                        }
                    }
                    if( bounds.Height < 1 )
                    {
                        bounds.Height = Math.Max( 1, parentSize.Height - bounds.Y ) * bounds.Height;
                        if( bounds.Height == 0 )
                        {
                            // if 0, just take the our parents width
                            bounds.Height = Math.Max( 1, parentSize.Height - bounds.Y );
                        }
                    }
                }