Exemple #1
0
        /// <summary>
        /// 取得圖紙各區域座標
        /// </summary>
        /// <param name="jsonPath"></param>
        /// <param name="cCoordinateData"></param>
        /// <returns></returns>
        public static bool ReadCoordinateData(string jsonPath, out CoordinateData cCoordinateData)
        {
            cCoordinateData = null;
            try
            {
                if (!System.IO.File.Exists(jsonPath))
                {
                    return(false);
                }

                bool status;

                string jsonText;
                status = ReadFileDataUTF8(jsonPath, out jsonText);
                if (!status)
                {
                    return(false);
                }

                cCoordinateData = JsonConvert.DeserializeObject <CoordinateData>(jsonText);
            }
            catch (System.Exception ex)
            {
                return(false);
            }
            return(true);
        }
Exemple #2
0
        /// <summary>
        /// 取得圖紙區域資料
        /// </summary>
        /// <param name="cCoordinateData"></param>
        /// <returns></returns>
        public static bool GetDraftingCoordinateData(out CoordinateData cCoordinateData)
        {
            cCoordinateData = new CoordinateData();
            try
            {
                string DraftingCoordinate_dat  = "DraftingCoordinate.dat";
                string DraftingCoordinate_Path = string.Format(@"{0}\{1}\{2}\{3}", CaxEnv.GetGlobaltekEnvDir(), "ME_Config", "Config", DraftingCoordinate_dat);
                if (!System.IO.File.Exists(DraftingCoordinate_Path))
                {
                    MessageBox.Show("路徑:" + DraftingCoordinate_Path + "不存在");
                    return(false);
                }

                CaxPublic.ReadCoordinateData(DraftingCoordinate_Path, out cCoordinateData);
            }
            catch (System.Exception ex)
            {
                return(false);
            }
            return(true);
        }