Пример #1
0
        private static void SET_SetPropertyValue(ref COMPLEX_SET_TYPE complex, LinkedList <string> nameList, string val)
        {
            string name = nameList.First.Value;

            nameList.RemoveFirst();

            PROPERTY_SET_TYPE[] props = complex.property;
            if (props != null)
            {
                for (int i = 0; i < props.Length; i++)
                {
                    if (props[i].sysname == name)
                    {
                        SET_SetPropertyValue(ref props[i], val);
                    }
                }
            }

            COMPLEX_SET_TYPE[] comps = complex.complex;
            if (comps != null)
            {
                for (int i = 0; i < comps.Length; i++)
                {
                    if (comps[i].sysname == name)
                    {
                        SET_SetPropertyValue(ref comps[i], nameList, val);
                    }
                }
            }
        }
Пример #2
0
 //sets the complex array recursively into XML_DOC_SET_TYPE complex
 private static void PopulateComplexSetType(COMPLEX_DSC_TYPE[] settings, ref COMPLEX_SET_TYPE[] complexSET)
 {
     if (settings != null && settings.Length > 0)
     {
         int count = 0;
         complexSET = new COMPLEX_SET_TYPE[settings.Length];
         foreach (COMPLEX_DSC_TYPE complex in settings)
         {
             if (complex != null && (complex.sysname != null && complex.sysname.Length > 0))
             {
                 complexSET[count]         = new COMPLEX_SET_TYPE();
                 complexSET[count].sysname = complex.sysname;//scanner
                 PROPERTY_SET_TYPE[] complexField  = complexSET[count].property;
                 COMPLEX_SET_TYPE[]  complexField1 = complexSET[count].complex;
                 PopulatePropertySetType(complex.property, ref complexField);
                 complexSET[count].property = complexField;
                 if (complex.complex != null)
                 {
                     PopulateComplexSetType(complex.complex, ref complexField1);
                 }
                 complexSET[count].complex = complexField1;
                 count++;
             }
         }
     }
 }
Пример #3
0
        //sets the specified property value in XML_DOC_SET_TYPE, called by the SetThePropValueInXMLDOCSETType
        private static bool SetThePropValueRecursively(ref COMPLEX_SET_TYPE complexSET, string complexName, string name, string new_value)
        {
            bool bRet = false;

            if (complexSET != null)
            {
                if (null == complexName)
                {
                    if (complexSET.property != null && complexSET.property.Length > 0)
                    {
                        for (int i = 0; i < complexSET.property.Length; i++)
                        {
                            if (complexSET.property[i].sysname != null && complexSET.property[i].sysname.Length > 0)
                            {
                                if (complexSET.property[i].sysname == name)
                                {
                                    if (complexSET.property[i].Value != new_value)
                                    {
                                        ////OsaBridge.Direct.Log("The existing value for " + name + " = " + complexSET.property[i].Value.ToString());
                                        complexSET.property[i].Value = new_value;
                                        ////OsaBridge.Direct.Log("The New value = " + new_value);
                                        bRet = true;
                                    }
                                    break;
                                }
                            }
                        }
                    }
                }
                if (!bRet)
                {
                    if (complexSET.complex != null && complexSET.complex.Length > 0)
                    {
                        for (int j = 0; j < complexSET.complex.Length; j++)
                        {
                            if (complexSET.complex[j] != null && (complexSET.complex[j].sysname != null && complexSET.complex[j].sysname.Length > 0))
                            {
                                if (complexSET.complex[j].sysname == complexName)
                                {
                                    complexName = null;
                                }
                                bRet = SetThePropValueRecursively(ref complexSET.complex[j], complexName, name, new_value);
                                if (bRet)
                                {
                                    break;
                                }
                            }
                        }
                    }
                }
            }
            return(bRet);
        }
Пример #4
0
        public static XML_DOC_SET_TYPE DSC_ConvertToSettable(XML_DOC_DSC_TYPE xmlDocDsc)
        {
            XML_DOC_SET_TYPE xmlDocSet = new XML_DOC_SET_TYPE();

            xmlDocSet.property = null;

            COMPLEX_DSC_TYPE[] subComps = xmlDocDsc.complex;
            COMPLEX_SET_TYPE[] tmpComps = new COMPLEX_SET_TYPE[1];
            tmpComps[0] = DSC_ConvertToSettable(subComps[0]);

            xmlDocSet.complex = tmpComps;

            return(xmlDocSet);
        }
Пример #5
0
        private static COMPLEX_SET_TYPE DSC_ConvertToSettable(COMPLEX_DSC_TYPE complexD)
        {
            COMPLEX_SET_TYPE complexS = new COMPLEX_SET_TYPE();

            complexS.sysname = complexD.sysname;

            // inner Property
            PROPERTY_DSC_TYPE[] subprops = complexD.property;
            if (subprops == null)
            {
                complexS.property = null;
            }
            else
            {
                PROPERTY_SET_TYPE[] tmpProps = new PROPERTY_SET_TYPE[subprops.Length];
                for (int i = 0; i < subprops.Length; i++)
                {
                    tmpProps[i] = DSC_ConvertToSettable(subprops[i]);
                }
                complexS.property = tmpProps;
            }

            // inner Complex
            COMPLEX_DSC_TYPE[] subcomps = complexD.complex;
            if (subcomps == null)
            {
                complexS.complex = null;
            }
            else
            {
                COMPLEX_SET_TYPE[] tmpComps = new COMPLEX_SET_TYPE[subcomps.Length];
                for (int i = 0; i < subcomps.Length; i++)
                {
                    tmpComps[i] = DSC_ConvertToSettable(subcomps[i]);
                }
                complexS.complex = tmpComps;
            }

            return(complexS);
        }
Пример #6
0
        //Gets the prop array recursively from the complex
        private static string GetThePropValueRecursively(COMPLEX_SET_TYPE complexSET, string name)
        {
            string str_ret = string.Empty;

            if (complexSET != null)
            {
                if (complexSET.property != null && complexSET.property.Length > 0)
                {
                    foreach (PROPERTY_SET_TYPE propType in complexSET.property)
                    {
                        if (propType.sysname != null && propType.sysname.Length > 0)
                        {
                            if (propType.sysname == name)
                            {
                                str_ret = propType.Value;
                                break;
                            }
                        }
                    }
                }
                if (str_ret.Length == 0)
                {
                    if (complexSET.complex != null && complexSET.complex.Length > 0)
                    {
                        foreach (COMPLEX_SET_TYPE complexcomplex in complexSET.complex)
                        {
                            if (complexcomplex != null && (complexcomplex.sysname != null && complexcomplex.sysname.Length > 0))
                            {
                                str_ret = GetThePropValueRecursively(complexcomplex, name);
                                if (str_ret.Length != 0)
                                {
                                    break;
                                }
                            }
                        }
                    }
                }
            }
            return(str_ret);
        }