Example #1
0
 public VertexStream(USAGE _Usage, FIELD_TYPE _FieldType, int _Index, object _Content)
 {
     m_Usage     = _Usage;
     m_FieldType = _FieldType;
     m_Index     = _Index;
     m_Content   = _Content;
 }
Example #2
0
 public Field(FIELD_TYPE type, string display_name, string name, string xml_name, string default_value, string category)
 {
     this.type = type;
     this.display_name = display_name;
     this.name = name;
     this.default_value = default_value;
     this.category = category;
     this.xml_name = xml_name;
 }
Example #3
0
 public Field(FIELD_TYPE type, string display_name, string name, string xml_name, string default_value, string category)
 {
     this.type          = type;
     this.display_name  = display_name;
     this.name          = name;
     this.default_value = default_value;
     this.category      = category;
     this.xml_name      = xml_name;
 }
Example #4
0
        public bool DoNotify_Check_IsTrue(FIELD_TYPE Value)
        {
            bool bIsCondition = OnCheckCondition(Value);

            if (bIsCondition)
            {
                OnNotify(Value);
            }

            return(bIsCondition);
        }
Example #5
0
 public Field(FIELD_TYPE type, string display_name, string name, string xml_name, string default_value, string category, params FieldOption[] option_values)
 {
     this.type = type;
     this.display_name = display_name;
     this.name = name;
     this.default_value = default_value;
     this.category = category;
     this.xml_name = xml_name;
     foreach (FieldOption value in option_values)
         _options.Add(value);
 }
Example #6
0
 public Field(FIELD_TYPE type, string display_name, string name, string xml_name, string default_value, string category, params FieldOption[] option_values)
 {
     this.type          = type;
     this.display_name  = display_name;
     this.name          = name;
     this.default_value = default_value;
     this.category      = category;
     this.xml_name      = xml_name;
     foreach (FieldOption value in option_values)
     {
         _options.Add(value);
     }
 }
Example #7
0
        public float getFloat(int col)
        {
            if (col >= m_DataTypeArray.Count)
            {
                return(0);
            }

            FIELD_TYPE ptype = (FIELD_TYPE)m_DataTypeArray[col];

            if (ptype != FIELD_TYPE.T_FLOAT)
            {
                return(-1);
            }

            return((float)m_RowListNow[col]);
        }
Example #8
0
        public int getInt(int col)
        {
            if (col >= m_DataTypeArray.Count)
            {
                return(0);
            }

            FIELD_TYPE ptype = (FIELD_TYPE)m_DataTypeArray[col];

            if (ptype != FIELD_TYPE.T_INT)
            {
                return(-1);
            }

            return((int)m_RowListNow[col]);
        }
Example #9
0
        public string getString(int col)
        {
            if (col >= m_DataTypeArray.Count)
            {
                return(null);
            }

            FIELD_TYPE ptype = (FIELD_TYPE)m_DataTypeArray[col];

            if (ptype != FIELD_TYPE.T_STRING)
            {
                return(null);
            }
            return((string)m_RowListNow[col]);
            //            return AnsiToUnicode((string)m_RowListNow[col]);
        }
Example #10
0
        void ProxyStr(string str, int line)
        {
            int index   = 0;
            int end     = 0;
            int dataNum = 0;

            if (line == 1)
            {
                while (end > -1)
                {
                    end = str.IndexOf("\t", index);
                    string tempStr = string.Empty;
                    if (end > -1)
                    {
                        tempStr = str.Substring(index, end - index);
                    }
                    else
                    {
                        tempStr = str.Substring(index, str.Length - index);
                    }
                    index = end + 1;

                    FIELD_TYPE ptype = FIELD_TYPE.T_INT;
                    if (tempStr == "INT")
                    {
                        ptype = FIELD_TYPE.T_INT;
                    }
                    else if (tempStr == "FLOAT")
                    {
                        ptype = FIELD_TYPE.T_FLOAT;
                    }
                    else if (tempStr == "STRING")
                    {
                        ptype = FIELD_TYPE.T_STRING;
                    }
                    m_DataTypeArray.Add(ptype);
                }
            }
            else if (line > 2)
            {
                ArrayList mRowDataList = new ArrayList(16);  //某一行的数据
                m_DataList.Add(mRowDataList);
                dataNum = 0;
                while (dataNum < m_DataTypeArray.Count)
                {
                    end = str.IndexOf("\t", index);
                    string tempStr = string.Empty;
                    if (end > -1)
                    {
                        tempStr = str.Substring(index, end - index);
                    }
                    else
                    {
                        if (index < str.Length)
                        {
                            tempStr = str.Substring(index, str.Length - index);
                        }
                        else
                        {
                            tempStr = string.Empty;
                        }
                        end = str.Length - 1;
                    }
                    index = end + 1;

                    FIELD_TYPE ptype = (FIELD_TYPE)m_DataTypeArray[dataNum];
                    dataNum++;

                    if (ptype == FIELD_TYPE.T_INT)
                    {
                        if (tempStr == "")
                        {
                            int tempInt = 0;
                            mRowDataList.Add(tempInt);
                        }
                        else
                        {
                            int tempInt = Convert.ToInt32(tempStr);
                            mRowDataList.Add(tempInt);
                        }
                    }
                    else if (ptype == FIELD_TYPE.T_FLOAT)
                    {
                        if (tempStr == "")
                        {
                            float tempFloat = 0;
                            mRowDataList.Add(tempFloat);
                        }
                        else
                        {
                            float tempFloat = (float)Convert.ToDouble(tempStr);
                            mRowDataList.Add(tempFloat);
                        }
                    }
                    else if (ptype == FIELD_TYPE.T_STRING)
                    {
                        mRowDataList.Add(tempStr);
                    }
                }
            }
        }
Example #11
0
 static bool Default_CheckCondition(FIELD_TYPE Value)
 {
     return(true);
 }
Example #12
0
                public void Load( System.IO.BinaryReader _Reader )
                {
                    m_Usage = (USAGE) _Reader.ReadInt32();
                    m_FieldType = (FIELD_TYPE) _Reader.ReadInt32();
                    m_Index = _Reader.ReadInt32();

                    int	ArraySize = _Reader.ReadInt32();
                    switch ( m_FieldType )
                    {
                        case FIELD_TYPE.FLOAT:
                            {
                                float[]	T = new float[ArraySize];
                                m_Content = T;
                                for ( int i=0; i < ArraySize; i++ )
                                {
                                    T[i] = _Reader.ReadSingle();
                                }
                            }
                            break;
                        case FIELD_TYPE.FLOAT2:
                            {
                                Vector2D[]	T = new Vector2D[ArraySize];
                                m_Content = T;
                                for ( int i=0; i < ArraySize; i++ )
                                {
                                    T[i].X = _Reader.ReadSingle();
                                    T[i].Y = _Reader.ReadSingle();
                                }
                            }
                            break;
                        case FIELD_TYPE.FLOAT3:
                            {
                                Vector[]	T = new Vector[ArraySize];
                                m_Content = T;
                                for ( int i=0; i < ArraySize; i++ )
                                {
                                    T[i].X = _Reader.ReadSingle();
                                    T[i].Y = _Reader.ReadSingle();
                                    T[i].Z = _Reader.ReadSingle();
                                }
                            }
                            break;
                        case FIELD_TYPE.FLOAT4:
                            {
                                Vector4D[]	T = new Vector4D[ArraySize];
                                m_Content = T;
                                for ( int i=0; i < ArraySize; i++ )
                                {
                                    T[i].X = _Reader.ReadSingle();
                                    T[i].Y = _Reader.ReadSingle();
                                    T[i].Z = _Reader.ReadSingle();
                                    T[i].W = _Reader.ReadSingle();
                                }
                            }
                            break;
                        case FIELD_TYPE.UINT32:
                            {
                                UInt32[]	T = new UInt32[ArraySize];
                                m_Content = T;
                                for ( int i=0; i < ArraySize; i++ )
                                {
                                    T[i] = _Reader.ReadUInt32();
                                }
                            }
                            break;
                    }
                }
Example #13
0
                public void             Load(System.IO.BinaryReader _Reader)
                {
                    m_Usage     = (USAGE)_Reader.ReadInt32();
                    m_FieldType = (FIELD_TYPE)_Reader.ReadInt32();
                    m_Index     = _Reader.ReadInt32();

                    int ArraySize = _Reader.ReadInt32();

                    switch (m_FieldType)
                    {
                    case FIELD_TYPE.FLOAT:
                    {
                        float[] T = new float[ArraySize];
                        m_Content = T;
                        for (int i = 0; i < ArraySize; i++)
                        {
                            T[i] = _Reader.ReadSingle();
                        }
                    }
                    break;

                    case FIELD_TYPE.FLOAT2:
                    {
                        Vector2D[] T = new Vector2D[ArraySize];
                        m_Content = T;
                        for (int i = 0; i < ArraySize; i++)
                        {
                            T[i].X = _Reader.ReadSingle();
                            T[i].Y = _Reader.ReadSingle();
                        }
                    }
                    break;

                    case FIELD_TYPE.FLOAT3:
                    {
                        Vector[] T = new Vector[ArraySize];
                        m_Content = T;
                        for (int i = 0; i < ArraySize; i++)
                        {
                            T[i].X = _Reader.ReadSingle();
                            T[i].Y = _Reader.ReadSingle();
                            T[i].Z = _Reader.ReadSingle();
                        }
                    }
                    break;

                    case FIELD_TYPE.FLOAT4:
                    {
                        Vector4D[] T = new Vector4D[ArraySize];
                        m_Content = T;
                        for (int i = 0; i < ArraySize; i++)
                        {
                            T[i].X = _Reader.ReadSingle();
                            T[i].Y = _Reader.ReadSingle();
                            T[i].Z = _Reader.ReadSingle();
                            T[i].W = _Reader.ReadSingle();
                        }
                    }
                    break;

                    case FIELD_TYPE.UINT32:
                    {
                        UInt32[] T = new UInt32[ArraySize];
                        m_Content = T;
                        for (int i = 0; i < ArraySize; i++)
                        {
                            T[i] = _Reader.ReadUInt32();
                        }
                    }
                    break;
                    }
                }
Example #14
0
 public bool SetDataFieldFloat(uint id, ID_SPACE idspace, DATA_TYPE dt, FIELD_TYPE field, float value)
 {
     return(SetDataFieldFloat(nativePtr, id, idspace, dt, field, value));
 }
Example #15
0
 private extern static bool SetDataFieldFloat(IntPtr p, uint id, ID_SPACE idspace, DATA_TYPE dt, FIELD_TYPE field, float value);
Example #16
0
    public override void OnInspectorGUI()
    {
        TTDBMonoTunner tempTunner = target as TTDBMonoTunner;
        int            lineIndex  = (int)tempTunner.TDLine.m_Fields[0].m_Value;

        GUILayout.BeginHorizontal();
        {
            GUILayout.FlexibleSpace();
            GUILayout.Label("------------- Data Tunner -------------");
            GUILayout.FlexibleSpace();
        }
        GUILayout.EndHorizontal();
        //Table Name
        GUILayout.BeginHorizontal();
        {
            GUILayout.Label("Table:");
            GUILayout.Label(tempTunner.TableName);
            GUILayout.FlexibleSpace();
        }
        GUILayout.EndHorizontal();
        //Index ID
        GUILayout.BeginHorizontal();
        {
            GUILayout.Label("Index:");
            GUILayout.Label(lineIndex.ToString());
            GUILayout.FlexibleSpace();
        }
        GUILayout.EndHorizontal();

        //Data Field

        for (int i = 1; i < tempTunner.TDLine.m_Fields.Count; i++)
        {
            Table      tempTable      = TDRoot.Instance.getTable(tempTunner.TableName);
            Field      item_field     = tempTunner.TDLine.m_Fields[i];
            FIELD_TYPE item_fieldType = tempTable.GetFieldType(i);



            string item_filedName = tempTable.GetFieldName(i);
            GUILayout.BeginHorizontal();
            {
                GUILayout.Label(item_filedName + ":");

                switch (item_fieldType)
                {
                case FIELD_TYPE.T_INT:
                    item_field.m_Value = EditorGUILayout.IntField((int)item_field.m_Value);
                    break;

                case FIELD_TYPE.T_FLOAT:
                    item_field.m_Value = EditorGUILayout.FloatField((float)item_field.m_Value);

                    break;

                case FIELD_TYPE.T_STRING:
                    item_field.m_Value = EditorGUILayout.TextField((string)item_field.m_Value);
                    break;
                }

                //Editor
                GUILayout.FlexibleSpace();
            }
            GUILayout.EndHorizontal();
        }

        GUILayout.Label(" ");

        GUILayout.BeginHorizontal();
        {
            GUILayout.FlexibleSpace();
            if (GUILayout.Button("Save File"))
            {
                //   tempTunner.SaveFile();
            }
            GUILayout.FlexibleSpace();
        }
        GUILayout.EndHorizontal();

        GUILayout.Label(" ");
        GUILayout.BeginHorizontal();
        {
            GUILayout.FlexibleSpace();
            GUILayout.Label("------------------ End ------------------");
            GUILayout.FlexibleSpace();
        }
        GUILayout.EndHorizontal();
    }
Example #17
0
 public void treatment(string name, CookComputing.XmlRpc.XmlRpcStruct donnees)
 {
     IEnumerator boucle;
     IEnumerator boucle2;
     try
     {
         _name = name;
         boucle = donnees.GetEnumerator();
         while (boucle.MoveNext())
         {
             switch ((string)((DictionaryEntry)(boucle.Current)).Key)
             {
                 case "help":
                     _help = (string)((DictionaryEntry)(boucle.Current)).Value;
                     break;
                 case "context":
                     boucle2 = ((CookComputing.XmlRpc.XmlRpcStruct)(((DictionaryEntry)(boucle.Current)).Value)).GetEnumerator();
                     while (boucle2.MoveNext())
                         _context.Add((string)((DictionaryEntry)(boucle.Current)).Key, ((DictionaryEntry)(boucle.Current)).Value);
                     break;
                 case "relation":
                     _relation = (string)((DictionaryEntry)(boucle.Current)).Value;
                     break;
                 case "type":
                     switch ((string)((DictionaryEntry)(boucle.Current)).Value)
                     {
                         case "integer":
                             _type = FIELD_TYPE.INTEGER;
                             break;
                         case "float":
                             _type = FIELD_TYPE.FLOAT;
                             break;
                         case "date":
                             _type = FIELD_TYPE.DATE;
                             break;
                         case "datetime":
                             _type = FIELD_TYPE.DATETIME;
                             break;
                         case "boolean":
                             _type = FIELD_TYPE.BOOLEAN;
                             break;
                         case "char":
                             _type = FIELD_TYPE.CHAR;
                             break;
                         case "text":
                             _type = FIELD_TYPE.TEXT;
                             break;
                         case "selection":
                             _type = FIELD_TYPE.SELECTION;
                             break;
                         case "binary":
                             _type = FIELD_TYPE.BINARY;
                             break;
                         case "many2one":
                             _type = FIELD_TYPE.MANY2ONE;
                             break;
                         case "many2many":
                             _type = FIELD_TYPE.MANY2MANY;
                             break;
                         case "one2one":
                             _type = FIELD_TYPE.ONE2ONE;
                             break;
                         case "one2many":
                             _type = FIELD_TYPE.ONE2MANY;
                             break;
                         case "reference":
                             _type = FIELD_TYPE.REFERENCE;
                             break;
                         default:
                             throw new Exception("Type de champs OpenERP inconnu");
                     }
                     break;
                 case "string":
                     _desc = (string)((DictionaryEntry)(boucle.Current)).Value;
                     break;
                 case "selectable":
                     _selectable = (bool)((DictionaryEntry)(boucle.Current)).Value;
                     break;
                 case "fnct_inv_arg":
                     treatmentArrayOrString(_fnct_inv_arg, ((DictionaryEntry)(boucle.Current)).Value);
                     break;
                 case "fnct_search":
                     treatmentArrayOrString(_fnct_search, ((DictionaryEntry)(boucle.Current)).Value);
                     break;
                 case "func_method":
                     treatmentArrayOrString(_fnct_method, ((DictionaryEntry)(boucle.Current)).Value);
                     break;
                 case "fnct_inv":
                     treatmentArrayOrString(_fnct_inv, ((DictionaryEntry)(boucle.Current)).Value);
                     break;
                 case "func_obj":
                     treatmentArrayOrString(_fnct_obj, ((DictionaryEntry)(boucle.Current)).Value);
                     break;
                 case "function":
                     _function = (string)((DictionaryEntry)(boucle.Current)).Value;
                     break;
                 case "store":
                     if ((((DictionaryEntry)(boucle.Current)).Value.GetType() != typeof(bool)))
                         _functionStore = (string)((DictionaryEntry)(boucle.Current)).Value;
                     else
                         _store = (bool)((DictionaryEntry)(boucle.Current)).Value;
                     break;
                 case "digits":
                     boucle2 = ((System.Array)(((DictionaryEntry)(boucle.Current)).Value)).GetEnumerator();
                     while (boucle2.MoveNext())
                         _digit.Add(boucle2.Current);
                     break;
                 case "size":
                     _size = (int)((DictionaryEntry)(boucle.Current)).Value;
                     break;
                 case "readonly":
                     if (((DictionaryEntry)(boucle.Current)).Value.GetType() == typeof(int))
                     {
                         if ((int)((DictionaryEntry)(boucle.Current)).Value == 0)
                             _readOnly = false;
                         else
                             _readOnly = true;
                     }
                     else
                         _readOnly = (bool)((DictionaryEntry)(boucle.Current)).Value;
                     break;
                 case "required":
                     if (((DictionaryEntry)(boucle.Current)).Value.GetType() == typeof(bool))
                         _required = (bool)((DictionaryEntry)(boucle.Current)).Value;
                     else
                         _required = int.Parse((string)((DictionaryEntry)(boucle.Current)).Value) == 1 ? true : false;
                     break;
                 case "selection":
                     boucle2 = ((System.Array)(((DictionaryEntry)(boucle.Current)).Value)).GetEnumerator();
                     while (boucle2.MoveNext())
                         _selection.Add(((System.Array)(boucle2.Current)).GetValue(0), ((System.Array)(boucle2.Current)).GetValue(1));
                     break;
                 case "translate":
                     _translate = (bool)((DictionaryEntry)(boucle.Current)).Value;
                     break;
                 case "change_default":
                     _change_default = (bool)((DictionaryEntry)(boucle.Current)).Value;
                     break;
                 case "select":
                     if (((DictionaryEntry)(boucle.Current)).Value.GetType() == typeof(bool))
                         _select = (bool)((DictionaryEntry)(boucle.Current)).Value ? 1 : 0;
                     else
                         _select = (int)((DictionaryEntry)(boucle.Current)).Value;
                     break;
                 case "related_columns":
                     boucle2 = ((System.Array)(((DictionaryEntry)(boucle.Current)).Value)).GetEnumerator();
                     while (boucle2.MoveNext())
                         _relatedColumns.Add(boucle2.Current);
                     break;
                 case "third_table":
                     _thirdTable = (string)((DictionaryEntry)(boucle.Current)).Value;
                     break;
                 case "domain":
                     if (((DictionaryEntry)(boucle.Current)).Value.GetType() == typeof(string))
                         _domain.Add((string)((DictionaryEntry)(boucle.Current)).Value);
                     else
                     {
                         boucle2 = ((System.Array)(((DictionaryEntry)(boucle.Current)).Value)).GetEnumerator();
                         while (boucle2.MoveNext())
                             _domain.Add(boucle2.Current);
                     }
                     break;
                 case "states":
                     boucle2 = ((CookComputing.XmlRpc.XmlRpcStruct)(((DictionaryEntry)(boucle.Current)).Value)).GetEnumerator();
                     while (boucle2.MoveNext())
                         _states.Add(boucle2.Current);
                     break;
                 case "invisible":
                     _invisible = (bool)((DictionaryEntry)(boucle.Current)).Value;
                     break;
                 default:
                     throw new Exception("Parametre de champs OpenERP inconnu");
             }
         }
     }
     catch (Exception ex)
     {
         _type = FIELD_TYPE.NC;
         throw new Systeme.exceptionOpenERP(IMDEV.OpenERP.Systeme.exceptionOpenERP.ERRORS.ERR_READ_FIELD, ex.Message);
     }
 }
Example #18
0
                protected USAGE m_Usage = USAGE.UNKNOWN; // Stream purpose

                #endregion Fields

                #region Constructors

                public VertexStream( USAGE _Usage, FIELD_TYPE _FieldType, int _Index, object _Content )
                {
                    m_Usage = _Usage;
                    m_FieldType = _FieldType;
                    m_Index = _Index;
                    m_Content = _Content;
                }