Exemple #1
0
    void StringChangeCallBack(object obj)
    {
        object[]       data  = obj as object[];
        LineConfigInfo lci   = data[0] as LineConfigInfo;
        string         value = data[1] as string;

        lci.OnStringChange(value);
    }
Exemple #2
0
    public void Init(ReadConfigDelegate delegate_, ReadConfigDelegate editConfigReader, string clientConfigPath, string editorPath)
    {
        configDic.Clear();
        List <string> showConfigLine = new List <string>();

        editConfigReader(BasePath + "filter.txt", delegate(int currentLine, string line)
        {
            if (!YangMenuHelper.digOutAnnotation(line))
            {
                showConfigLine.Add(line);
            }
            return(true);
        });

        List <LineConfigInfo> configLines = new List <LineConfigInfo>();
        bool startTag = false;

        delegate_(clientConfigPath, delegate(int currentLine, string line)
        {
            line = line.Trim();
            //if (!startTag)
            //{
            //    if (line.Contains("<ClientConfig>"))
            //    {
            //        startTag = true;
            //    }
            //}
            //else
            //{
            //    if (line.Contains("</ClientConfig>"))
            //    {
            //        return false;//末尾了
            //    }

            //    if (startTag)
            //    {
            if (!YangMenuHelper.digOutAnnotation(line))
            {
                for (int i = 0; i < showConfigLine.Count; i++)
                {
                    if (line.Contains(showConfigLine[i] + "="))
                    {
                        LineConfigInfo lci = new LineConfigInfo();
                        lci.myType         = GetType(YangMenuHelper.GetKVValue(line));
                        if (lci.myType == CONFIG_TYPE.STRING)
                        {
                            ReadStringConfigValue(editConfigReader, BasePath + "_" + YangMenuHelper.GetKVKey(line) + ".txt", lci);
                        }
                        else if (lci.myType == CONFIG_TYPE.INPUT || lci.myType == CONFIG_TYPE.INT)
                        {
                        }

                        lci.lineValue = line;
                        lci.xmlValue  = YangMenuHelper.GetKVValue(line);
                        lci.lineIndex = currentLine;
                        configDic.Add(currentLine, lci);
                        break;
                    }
                }
            }
            //    }
            //}
            return(true);
        });
    }
Exemple #3
0
    private void ReadStringConfigValue(ReadConfigDelegate editConfigReader, string path, LineConfigInfo lci)
    {
        List <string> values = new List <string>();

        editConfigReader(path, delegate(int currentLine, string line)
        {
            values.Add(line);
            return(true);
        });
        lci.lineValues = values;
    }