Ejemplo n.º 1
0
        /*
         * public static string UTF8_to_EUCKR(string strUTF8)
         * {
         *  Encoding encUTF8;
         *  Encoding encEUCKR;
         *
         *  byte[] byteUTF8;
         *  byte[] byteEUCKR;
         *
         *  // get Encoding class
         *  encUTF8 = Encoding.UTF8;
         *  encEUCKR = Encoding.GetEncoding("euc-kr");
         *
         *  // convert encoding from "UTF8" to "euc-kr"
         *  byteUTF8 = encUTF8.GetBytes(strUTF8);
         *  byteEUCKR = Encoding.Convert(encUTF8, encEUCKR, byteUTF8);
         *
         *  return encEUCKR.GetString(byteEUCKR);
         *
         *
         * }
         *
         * public static string EUCKR_to_UTF8(string strEUCKR)
         * {
         *  Encoding encUTF8;
         *  Encoding encEUCKR;
         *
         *  byte[] byteUTF8;
         *  byte[] byteEUCKR;
         *
         *  // get Encoding class
         *  encUTF8 = Encoding.UTF8;
         *  encEUCKR = Encoding.GetEncoding("euc-kr");
         *
         *  // convert encoding from "euc-kr" to "utf8"
         *  byteEUCKR = encEUCKR.GetBytes(strEUCKR);
         *  byteUTF8 = Encoding.Convert(encEUCKR, encUTF8, byteEUCKR);
         *
         *  return encUTF8.GetString(byteUTF8);
         *
         * }
         */

        /*
         * public static string getTargetDate(int iDay)
         * {
         *
         *  DateTime temp = new DateTime();
         *  //Calend0ar temp = Calendar.getInstance();
         *  StringBuilder sbDate = new StringBuilder();
         *
         *  temp.Add(iDay);
         *
         *  temp.add(Calendar.DAY_OF_MONTH, iDay);
         *
         *  int nYear = temp.get(Calendar.YEAR);
         *  int nMonth = temp.get(Calendar.MONTH) + 1;
         *  int nDay = temp.get(Calendar.DAY_OF_MONTH);
         *
         *  sbDate.Append(nYear);
         *  if (nMonth < 10)
         *  {
         *      sbDate.Append("0");
         *      sbDate.Append(nMonth);
         *  }
         *  if (nDay < 10)
         *  {
         *      sbDate.Append("0");
         *      sbDate.Append(nDay);
         *  }
         *
         *  return sbDate.ToString();
         * }
         */

        /** 이전검색어 히든 태그 생성 후 반환.
         *
         * @param srchParam ParameterVO 오브젝트
         * @return 이전 검색어 태그 문자열
         */

        public static string makeHtmlForPreKwd(ParameterVO srchParam)
        {
            StringBuilder preKwdStr = new StringBuilder("");
            int           tmpCnt    = 0;

            preKwdStr.Append("<input type='hidden' name=\"preKwd\" value=\"" + srchParam.getKwd() + "\">\n");

            if (srchParam.getReSrchFlag())
            {
                System.Diagnostics.Debug.WriteLine("srchParam.getPreKwds()-->" + srchParam.getPreKwds());
                if (srchParam.getPreKwds() != null)
                {
                    int preKwdCnt = srchParam.getPreKwds().Length;

                    tmpCnt = 0;
                    if (srchParam.getPreKwds()[0].Equals(srchParam.getKwd()) && preKwdCnt > 1)
                    {
                        tmpCnt = 1;                                                                             //
                    }
                    for (; tmpCnt < preKwdCnt; tmpCnt++)
                    {
                        preKwdStr.Append("<input type=\"hidden\" name=\"preKwd\" value=\"").Append(srchParam.getPreKwds()[tmpCnt]).Append("\">\n");
                    }

                    /* 이전검색어 & 키워드가 존재하는 경우 / 첫페이지내 검색시만 생성 / 2개 키워드가 같지 않은경우*/
                    if (srchParam.getKwd().Length > 0 && srchParam.getPageNum() == 1 &&
                        !srchParam.getKwd().Equals(srchParam.getPreKwds()[0]))
                    {
                        srchParam.setRecKwd(srchParam.getPreKwds()[0] + "||" + srchParam.getKwd());    // 추천검색어 구성용 단어 생성
                    }
                } // end if
            } // end if

            return(preKwdStr.ToString());
        }
Ejemplo n.º 2
0
        // parameters タグの子要素(paramaterタグ)を複数読み込む
        private static List <ParameterVO> readParameters(XmlNode mcNode)
        {
            List <ParameterVO> retParams = new List <ParameterVO>();

            // パラメータを読み込み
            XmlNodeList prms = mcNode.SelectNodes("parameter");

            if (prms != null)
            {
                foreach (XmlNode pNode in prms)
                {
                    ParameterVO param = readMethodParam(pNode);
                    retParams.Add(param);
                }
            }

            return(retParams);
        }
Ejemplo n.º 3
0
        private static void writeTaggedValuePrm(ParameterVO param, List <ParamTagVO> paramTags, StreamWriter sw)
        {
            sw.WriteLine("###### パラメータタグ付き値: " + param.name);
            sw.WriteLine("");

            sw.WriteLine("[cols = \"1,3\"]");
            sw.WriteLine("|===");
            sw.WriteLine("| キー | 値");

            foreach (ParamTagVO tv in paramTags)
            {
                sw.Write("|" + tv.name);
                sw.Write(" |" + tv.notes);
                sw.WriteLine("");
            }
            sw.WriteLine("|===");
            sw.WriteLine("");
        }
        /// <summary>
        /// パラメータのタグ付き値を出力。
        /// パラメータのStreamに向けてXML文書を出力
        /// </summary>
        /// <param name="prm">パラメータVO</param>
        /// <param name="depth">現在のインデントの深さ</param>
        /// <param name="sw">出力用に開かれたStreamWriter</param>
        private static void outputParameterTags(ParameterVO prm, int depth, StreamWriter sw)
        {
            if (prm.paramTags == null || prm.paramTags.Count <= 0)
            {
                return;
            }

            sw.WriteLine(indent(depth) + "<paramTags>");

            //  取得できたタグ付き値の情報をファイルに展開する
            foreach (ParamTagVO ptagv in prm.paramTags)
            {
                if (ptagv.notes != null)
                {
                    sw.WriteLine(indent(depth + 1) + "<ptg guid=\"" + escapeXML(ptagv.guid) + "\" name=\"" + escapeXML(ptagv.name) + "\" >" + escapeXML(ptagv.notes) + "</ptg>");
                }
            }

            sw.WriteLine(indent(depth) + "</paramTags>");
        }
Ejemplo n.º 5
0
        private static ParameterVO readMethodParam(XmlNode pNode)
        {
            ParameterVO prmvo = new ParameterVO();
            Int32       p     = 0;

            foreach (XmlAttribute attr in pNode.Attributes)
            {
                switch (attr.Name)
                {
                case "name":
                    prmvo.name = attr.Value;
                    break;

                case "alias":
                    prmvo.alias = attr.Value;
                    break;

                case "stereotype":
                    prmvo.stereoType = attr.Value;
                    break;

                case "type":
                    prmvo.eaType = attr.Value;
                    break;

                case "guid":
                    prmvo.guid = attr.Value;
                    break;

                case "pos":
                    if (!Int32.TryParse(attr.Value, out p))
                    {
                        p = 0;
                    }
                    prmvo.pos = p;
                    break;

                case "classifier":
                    prmvo.classifierID = attr.Value;
                    break;

                case "objectType":
                    prmvo.objectType = attr.Value;
                    break;

                case "default":
                    prmvo.defaultValue = attr.Value;
                    break;

                case "const":
                    if (!Int32.TryParse(attr.Value, out p))
                    {
                        p = 0;
                    }

                    if (p != 0)
                    {
                        prmvo.isConst = true;
                    }
                    else
                    {
                        prmvo.isConst = false;
                    }
                    break;

                case "kind":
                    prmvo.kind = attr.Value;
                    break;

                case "style":
                    prmvo.styleEx = attr.Value;
                    break;
                }
            }

            if (pNode.SelectSingleNode("notes") != null)
            {
                prmvo.notes = pNode.SelectSingleNode("notes").InnerText;
            }

            return(prmvo);
        }
        public static MethodVO getMethodFromEAObject(EA.Method eaMethodObj)
        {
            MethodVO mthvo = new MethodVO();

            mthvo.name  = excludeSpecialChar(eaMethodObj.Name);
            mthvo.alias = excludeSpecialChar(eaMethodObj.Alias);
            if (eaMethodObj.StereotypeEx != null && !"".Equals(eaMethodObj.StereotypeEx))
            {
                mthvo.stereoType = eaMethodObj.StereotypeEx;
            }
            else
            {
                mthvo.stereoType = null;
            }

            mthvo.guid          = eaMethodObj.MethodGUID;
            mthvo.pos           = eaMethodObj.Pos;
            mthvo.classifierID  = eaMethodObj.ClassifierID;
            mthvo.isConst       = eaMethodObj.IsConst;
            mthvo.isLeaf        = eaMethodObj.IsLeaf;
            mthvo.isPure        = eaMethodObj.IsPure;
            mthvo.isQuery       = eaMethodObj.IsQuery;
            mthvo.isRoot        = eaMethodObj.IsRoot;
            mthvo.returnIsArray = eaMethodObj.ReturnIsArray;
            mthvo.stateFlags    = eaMethodObj.StateFlags;
            mthvo.behavior      = eaMethodObj.Behavior;
            mthvo.notes         = eaMethodObj.Notes;
            mthvo.returnType    = excludeSpecialChar(eaMethodObj.ReturnType);
            mthvo.visibility    = excludeSpecialChar(eaMethodObj.Visibility);

            List <ParameterVO> outParamList = new List <ParameterVO>();

            foreach (EA.Parameter eaParamObj in eaMethodObj.Parameters)
            {
                ParameterVO prm = new ParameterVO();
                prm.name         = excludeSpecialChar(eaParamObj.Name);
                prm.alias        = excludeSpecialChar(eaParamObj.Alias);
                prm.eaType       = excludeSpecialChar(eaParamObj.Type);
                prm.stereoType   = excludeSpecialChar(eaParamObj.StereotypeEx);
                prm.guid         = eaParamObj.ParameterGUID;
                prm.pos          = eaParamObj.Position;
                prm.classifierID = eaParamObj.ClassifierID;
                prm.defaultValue = excludeSpecialChar(eaParamObj.Default);
                prm.isConst      = eaParamObj.IsConst;
                prm.kind         = eaParamObj.Kind;
                prm.styleEx      = excludeSpecialChar(eaParamObj.StyleEx);
                prm.notes        = eaParamObj.Notes;
                prm.objectType   = "25";
                outParamList.Add(prm);
            }
            mthvo.parameters = outParamList;

            List <TaggedValueVO> outTagList = new List <TaggedValueVO>();

            foreach (EA.MethodTag mtag in eaMethodObj.TaggedValues)
            {
                outTagList.Add(getMethodTagFromEAObject(mtag));
            }
            mthvo.taggedValues = outTagList;

            return(mthvo);
        }
        /// <summary>
        /// メソッドパラメータを全件読み、operationID でヒットした引数のメソッドリストにセット
        /// </summary>
        /// <param name="methods">全メソッドのリスト</param>
        private void setMethodParams(List <MethodVO> methods)
        {
            Console.WriteLine("setMethodParams(): methods.Count=" + methods.Count);
            // 全メソッドのリストをソート(キー=methodId)
            methods.Sort(new MethodIdComparer());

            int    methodIdx = 0;
            int    operationId, savedOperationId = 0;
            string strSQL, strFields;

            // 読み込む項目リスト
            strFields =
                " oprm.Name,       oprm.[Type],    oprm.[Default],  oprm.Notes,      oprm.Pos,     " +
                " oprm.Const,      oprm.Style,     oprm.Kind,       oprm.Classifier, oprm.ea_guid, " +
                " oprm.StyleEx,    oprm.OperationID ";

            // SQL文 を作成
            strSQL = "select " + strFields +
                     " from t_operationparams oprm " +
                     " where oprm.OperationID > 0 " +
                     " order by oprm.OperationID, oprm.Pos, oprm.Name ";

            OleDbCommand dbCom = new OleDbCommand();

            // SQLを実行する
            dbCom.CommandText = strSQL;
            dbCom.Connection  = objConn;

            // DBから取得したパラメータデータをいったんリストに貯める
            List <ParameterVO> paramList = new List <ParameterVO>();
            OleDbDataReader    reader    = dbCom.ExecuteReader();

            while (reader.Read())
            {
                operationId = DbUtil.readIntField(reader, 11);

                ParameterVO prm = new ParameterVO();

                prm.name         = StringUtil.excludeSpecialChar("t_operationparams", "name", prm.guid, DbUtil.readStringField(reader, 0));
                prm.eaType       = DbUtil.readStringField(reader, 1);
                prm.defaultValue = StringUtil.excludeSpecialChar("t_operationparams", "Default", prm.guid, DbUtil.readStringField(reader, 2));
                prm.notes        = DbUtil.readStringField(reader, 3);
                prm.pos          = DbUtil.readIntField(reader, 4);
                prm.isConst      = DbUtil.readBoolField(reader, 5);
                prm.stereoType   = DbUtil.readStringField(reader, 6);
                prm.kind         = DbUtil.readStringField(reader, 7);
                prm.classifierID = DbUtil.readStringField(reader, 8);
                prm.guid         = DbUtil.readStringField(reader, 9);
                string buf = DbUtil.readStringField(reader, 10);
                if (buf.Length > 7)
                {
                    prm.alias = buf.Substring(7, buf.Length - 8);
                }
                else
                {
                    prm.alias = buf;
                }

                prm.styleEx    = buf;
                prm.objectType = "25";

                // 作成したパラメータVOに、パラメータタグ付き値のマップ
                // Map内にキー(パラメータのGUID)が含まれていたら
                if (g_AllParamTagsInParamMap.ContainsKey(prm.guid))
                {
                    // paramTags項目にマップからの取得値をセット
                    prm.paramTags = g_AllParamTagsInParamMap[prm.guid];
                }
                else
                {
                    // 持っていなければ空のリストをセット
                    prm.paramTags = new List <ParamTagVO>();
                }


                if (savedOperationId > 0 && savedOperationId < operationId)
                {
                    methodIdx = searchMethodAndSetParameter(methods, savedOperationId, methodIdx, paramList);
                    paramList = new List <ParameterVO>();
                }

                paramList.Add(prm);
                savedOperationId = operationId;
            }

            // 最後に retParamtersに溜まっている分をメソッドにセット
            if (savedOperationId > 0)
            {
                methodIdx = searchMethodAndSetParameter(methods, savedOperationId, methodIdx + 1, paramList);
            }

            reader.Close();
        }