Exemplo n.º 1
0
        private bool fnc_GetUrlExclusionList()
        {
            bool   blRes;
            int    intCnt;
            string strUrl;

            try
            {
                this.pUrlExclusionList = new string[CON_COB_URL_CNT];
                intCnt = 0;
                for (intCnt = 0; intCnt < CON_COB_URL_CNT; intCnt++)
                {
                    strUrl = SaveImageCommon.GetIniValue("UrlExclusion", "Key" + (intCnt + 1).ToString("00"), SaveImageCommon.CON_SAVEIMAGE_INI);
                    this.pUrlExclusionList[intCnt] = strUrl;
                }

                blRes = true;
            }
            catch (Exception ex)
            {
                blRes = false;
                CommonLogger.WriteLine(ex.Message);
            }
            return(blRes);
        }
Exemplo n.º 2
0
        private bool fnc_GetUrlExclusionList()
        {
            bool   blRes;
            int    intCnt;
            string strExcUrl;

            try
            {
                lst_url_exclustion.Items.Clear();
                intCnt = 0;
                for (intCnt = 0; intCnt < CON_EXT_URL_CNT; intCnt++)
                {
                    strExcUrl = SaveImageCommon.GetIniValue("UrlExclusion", "Key" + (intCnt + 1).ToString("00"), SaveImageCommon.CON_SAVEIMAGE_INI);
                    if (strExcUrl != null && strExcUrl.Trim() != "")
                    {
                        lst_url_exclustion.Items.Add(strExcUrl.Trim());
                    }
                }

                blRes = true;
            }
            catch (Exception ex)
            {
                blRes = false;
                CommonLogger.WriteLine(ex.Message);
            }
            return(blRes);
        }
Exemplo n.º 3
0
        private bool fnc_GetImageVerticalScorllSize()
        {
            bool   blRes;
            string strSize;
            int    intSize;

            try
            {
                // INIファイルから縦スクロールサイズ取得
                strSize = SaveImageCommon.GetIniValue("Option", "VerticalScorllSize", SaveImageCommon.CON_SAVEIMAGE_INI);
                //
                if (int.TryParse(strSize, out intSize) == true)
                {
                    this.pImageVerticalScorllSize = intSize;
                }
                else
                {
                    this.pImageVerticalScorllSize = 0;
                    fnc_SetImageVerticalScorllSize();
                }
                txt_SetVerticalScrollSize.Text = this.pImageVerticalScorllSize.ToString();

                blRes = true;
            }
            catch (Exception ex)
            {
                this.pImageVerticalScorllSize = 0;
                fnc_SetImageVerticalScorllSize();
                blRes = false;
                CommonLogger.WriteLine(ex.Message);
            }
            return(blRes);
        }
Exemplo n.º 4
0
        private bool fnc_GetUrlList()
        {
            bool   blRes;
            int    intCnt;
            string strUrl;

            try
            {
                intCnt = 0;
                for (intCnt = 0; intCnt < CON_COB_URL_CNT; intCnt++)
                {
                    strUrl = SaveImageCommon.GetIniValue("UrlList", "List" + (intCnt + 1).ToString("00"), SaveImageCommon.CON_SAVEIMAGE_INI);
                    if (strUrl.Trim() != "")
                    {
                        cob_url.Items.Add(strUrl);
                    }
                }

                blRes = true;
            }
            catch (Exception ex)
            {
                blRes = false;
                CommonLogger.WriteLine(ex.Message);
            }
            return(blRes);
        }
Exemplo n.º 5
0
 private void tsb_Stop_Click(object sender, EventArgs e)
 {
     try
     {
         fnc_ClearStatus();
         UrlTimer.Enabled = false;
         TargetWebBrowser.Stop();
         this.Text = TargetWebBrowser.DocumentTitle + SaveImageCommon.GetVersionInfo();
     }
     catch (Exception ex) { CommonLogger.WriteLine(ex.Message); }
 }
Exemplo n.º 6
0
 private void UrlTimer_Tick(object sender, EventArgs e)
 {
     if (TargetWebBrowser.IsBusy == false)
     {
         UrlTimer.Enabled = false;
         this.Text        = TargetWebBrowser.DocumentTitle + SaveImageCommon.GetVersionInfo();
     }
     else
     {
         this.Text = "Connecting..." + SaveImageCommon.GetVersionInfo();
     }
 }
Exemplo n.º 7
0
        private bool fnc_SetFormSize()
        {
            bool blRes;
            int  intTop;
            int  intLeft;
            int  intWidth;
            int  intHight;

            try
            {
                intTop   = this.Top;
                intLeft  = this.Left;
                intWidth = this.Width;
                intHight = this.Height;

                if (intTop < 0)
                {
                    intTop = 0;
                }
                if (intLeft < 0)
                {
                    intLeft = 0;
                }
                if (intWidth < 0)
                {
                    intWidth = 0;
                }
                if (intHight < 0)
                {
                    intHight = 0;
                }

                SaveImageCommon.SetIniValue("FormSize", "Top", intTop.ToString(), SaveImageCommon.CON_SAVEIMAGE_INI);
                SaveImageCommon.SetIniValue("FormSize", "Left", intLeft.ToString(), SaveImageCommon.CON_SAVEIMAGE_INI);
                SaveImageCommon.SetIniValue("FormSize", "Width", intWidth.ToString(), SaveImageCommon.CON_SAVEIMAGE_INI);
                SaveImageCommon.SetIniValue("FormSize", "Hight", intHight.ToString(), SaveImageCommon.CON_SAVEIMAGE_INI);

                blRes = true;
            }
            catch (Exception ex)
            {
                intTop   = 0;
                intLeft  = 0;
                intWidth = 0;
                intHight = 0;
                blRes    = false;
                CommonLogger.WriteLine(ex.Message);
            }
            return(blRes);
        }
Exemplo n.º 8
0
 private void tsb_ImageFile_ExtList_SelectedIndexChanged(object sender, EventArgs e)
 {
     try
     {
         // 画像拡張子INIファイルに設定
         this.pImageType = tsb_ImageFile_ExtList.Text;
         SaveImageCommon.SetIniValue("Option", "FileExtense", this.pImageType, SaveImageCommon.CON_SAVEIMAGE_INI);
     }
     catch (Exception ex)
     {
         // SaveImageCommon.SetIniValue("Option", "FileExtense", CON_EXTENSE_PNG, SaveImageCommon.CON_SAVEIMAGE_INI);
         SaveImageCommon.SetIniValue("Option", "FileExtense", SaveImageCommon.CON_EXTENSE_JPG, SaveImageCommon.CON_SAVEIMAGE_INI);
         CommonLogger.WriteLine(ex.Message);
     }
 }
Exemplo n.º 9
0
        private bool fnc_SetImageExtense()
        {
            bool blRes;

            try
            {
                SaveImageCommon.SetIniValue("Option", "FileExtense", this.pImageType, SaveImageCommon.CON_SAVEIMAGE_INI);
                blRes = true;
            }
            catch (Exception ex)
            {
                blRes = false;
                CommonLogger.WriteLine(ex.Message);
            }
            return(blRes);
        }
Exemplo n.º 10
0
        private bool fnc_SetImageVerticalScorllSize()
        {
            bool blRes;

            try
            {
                SaveImageCommon.SetIniValue("Option", "VerticalScorllSize", this.pImageVerticalScorllSize.ToString(), SaveImageCommon.CON_SAVEIMAGE_INI);
                blRes = true;
            }
            catch (Exception ex)
            {
                blRes = false;
                CommonLogger.WriteLine(ex.Message);
            }
            return(blRes);
        }
Exemplo n.º 11
0
        private bool fnc_GetFormSize()
        {
            bool   blRes;
            string strTemp;
            int    intTop;
            int    intLeft;
            int    intWidth;
            int    intHight;

            try
            {
                intTop   = 0;
                intLeft  = 0;
                intWidth = 0;
                intHight = 0;

                strTemp  = SaveImageCommon.GetIniValue("FormSize", "Top", SaveImageCommon.CON_SAVEIMAGE_INI);
                intTop   = int.Parse(strTemp);
                strTemp  = SaveImageCommon.GetIniValue("FormSize", "Left", SaveImageCommon.CON_SAVEIMAGE_INI);
                intLeft  = int.Parse(strTemp);
                strTemp  = SaveImageCommon.GetIniValue("FormSize", "Width", SaveImageCommon.CON_SAVEIMAGE_INI);
                intWidth = int.Parse(strTemp);
                strTemp  = SaveImageCommon.GetIniValue("FormSize", "Hight", SaveImageCommon.CON_SAVEIMAGE_INI);
                intHight = int.Parse(strTemp);

                if (intTop >= 0 && intLeft >= 0 && intWidth >= 0 && intHight >= 0)
                {
                    this.Top    = intTop;
                    this.Left   = intLeft;
                    this.Width  = intWidth;
                    this.Height = intHight;
                }

                blRes = true;
            }
            catch (Exception ex)
            {
                intTop   = 0;
                intLeft  = 0;
                intWidth = 0;
                intHight = 0;
                blRes    = false;
                CommonLogger.WriteLine(ex.Message);
            }
            return(blRes);
        }
Exemplo n.º 12
0
        private bool fnc_SetImageExtenseCombox()
        {
            bool   blRes;
            string strImageType;

            try
            {
                this.pImageType = "";
                // INIファイルから画像拡張子取得
                strImageType = SaveImageCommon.GetIniValue("Option", "FileExtense", SaveImageCommon.CON_SAVEIMAGE_INI);
                strImageType = strImageType.ToUpper();

                tsb_ImageFile_ExtList.Items.Clear();
                foreach (string strExt in CON_EXTENSE)
                {
                    // 画像拡張子値設定
                    tsb_ImageFile_ExtList.Items.Add(strExt);
                    // デフォルト(ユーザ指定)取得
                    if (this.pImageType == "" && strImageType == strExt)
                    {
                        this.pImageType = strExt;
                    }
                }
                if (this.pImageType == "")
                {
                    this.pImageType = SaveImageCommon.CON_EXTENSE_JPG;
                }

                // 画像拡張子デフォルト(ユーザ指定)値設定
                tsb_ImageFile_ExtList.Text = this.pImageType;

                blRes = true;
            }
            catch (Exception ex)
            {
                // this.pImageType = CON_EXTENSE_PNG; // TODO
                this.pImageType = SaveImageCommon.CON_EXTENSE_JPG;
                blRes           = false;
                CommonLogger.WriteLine(ex.Message);
            }
            return(blRes);
        }
Exemplo n.º 13
0
        private bool fnc_SetUrlExclusionList()
        {
            bool   blRes;
            int    intCnt, intList;
            string strExcUrl;

            try
            {
                // INIファイル定義をいったん削除
                SaveImageCommon.SetIniValue("UrlExclusion", null, null, SaveImageCommon.CON_SAVEIMAGE_INI);

                if (lst_url_exclustion.Items.Count <= 0)
                {
                    SaveImageCommon.SetIniValue("UrlExclusion", "Key01", SaveImageCommon.CON_DEF_EXC_KEY, SaveImageCommon.CON_SAVEIMAGE_INI);
                }
                else
                {
                    // 保存対象をINIファイルに出力
                    intCnt = 0;
                    for (intList = 0; intList < lst_url_exclustion.Items.Count; intList++)
                    {
                        strExcUrl = lst_url_exclustion.Items[intList].ToString().Trim();
                        if (lst_url_exclustion.Items[intList].ToString().Trim() != "")
                        {
                            intCnt = intCnt + 1;
                            SaveImageCommon.SetIniValue("UrlExclusion", "Key" + (intCnt).ToString("00"), strExcUrl, SaveImageCommon.CON_SAVEIMAGE_INI);
                        }
                    }
                }

                blRes = true;
            }
            catch (Exception ex)
            {
                CommonLogger.WriteLine(ex.Message);
                blRes = false;
            }
            return(blRes);
        }
Exemplo n.º 14
0
        private void TargetWebBrowser_Navigated(object sender, WebBrowserNavigatedEventArgs e)
        {
            int    i;
            bool   bFound;
            string sUrl;

            fnc_ClearStatus();
            this.Text = TargetWebBrowser.DocumentTitle + SaveImageCommon.GetVersionInfo();

            sUrl = TargetWebBrowser.Url.ToString();

            // Enterキー押下時のみURLを保存
            if (this.pSaveUrlList == true)
            {
                bFound = false;
                for (i = 0; i < cob_url.Items.Count; i++)
                {
                    if (cob_url.Items[i].ToString() == sUrl)
                    {
                        bFound = true;  break;
                    }
                }

                this.pDontNavigateNow = true;
                if (bFound == false)
                {
                    cob_url.Items.Add(sUrl);
                }
                this.pDontNavigateNow = false;

                this.pSaveUrlList = false;
            }

            cob_url.Text = sUrl;
            TargetWebBrowser.Select();
        }
Exemplo n.º 15
0
        private bool fnc_SetUrlList()
        {
            bool blRes;
            int  intCnt;
            int  intList, intExcList;

            string[] strTempUrl, strUrl;
            string   strExc;

            try
            {
                // 保存除外キーを含む対象を取得
                fnc_GetUrlExclusionList();

                strTempUrl = new string[cob_url.Items.Count];
                intList    = 0;
                // コンボボックスからアイテムを取得
                for (intList = 0; intList < cob_url.Items.Count; intList++)
                {
                    if (intList < CON_COB_URL_CNT)
                    {
                        strTempUrl[intList] = cob_url.Items[intList].ToString().Trim();
                    }
                }

                // 保存除外キーを含む対象を除外
                intCnt = 0;
                strUrl = new string[cob_url.Items.Count];
                for (intList = 0; intList < strTempUrl.Length; intList++)
                {
                    strExc = "";
                    for (intExcList = 0; intExcList < this.pUrlExclusionList.Length; intExcList++)
                    {
                        strExc = this.pUrlExclusionList[intExcList].Trim();
                        if (strExc == "")
                        {
                            break;
                        }

                        // 両端は「*」の場合
                        if (strExc[0] == char.Parse("*") && strExc[strExc.Length - 1] == char.Parse("*"))
                        {
                            strExc = strExc.Substring(1, strExc.Length - 2);
                            if (strExc != "")
                            {
                                if (strTempUrl[intList].Contains(strExc) == false)
                                {
                                    strUrl[intCnt] = strTempUrl[intList].Trim(); intCnt = intCnt + 1;
                                }
                            }
                        }
                        else
                        {
                            // 先頭は「*」の場合
                            if (strExc[0] == char.Parse("*"))
                            {
                                strExc = strExc.Substring(1, strExc.Length - 1);
                                if (strExc != "")
                                {
                                    if (strTempUrl[intList].EndsWith(strExc) == false)
                                    {
                                        strUrl[intCnt] = strTempUrl[intList].Trim(); intCnt = intCnt + 1;
                                    }
                                }
                            }
                            // 最後は「*」の場合
                            else if (strExc[strExc.Length - 1] == char.Parse("*"))
                            {
                                strExc = strExc.Substring(0, strExc.Length - 1);
                                if (strExc != "")
                                {
                                    if (strTempUrl[intList].StartsWith(strExc) == false)
                                    {
                                        strUrl[intCnt] = strTempUrl[intList].Trim(); intCnt = intCnt + 1;
                                    }
                                }
                            }
                            else
                            {
                                // 両端は「*」以外の場合
                                if (strTempUrl[intList] != strExc)
                                {
                                    strUrl[intCnt] = strTempUrl[intList].Trim(); intCnt = intCnt + 1;
                                }
                            }
                        }
                    }
                }

                // INIファイル定義をいったん削除
                SaveImageCommon.SetIniValue("UrlList", null, null, SaveImageCommon.CON_SAVEIMAGE_INI);

                // 保存対象をINIファイルに出力
                if (intCnt == 0)
                {
                    // 除外キー情報は存在しない場合
                    intCnt = 0;
                    for (intList = 0; intList < strTempUrl.Length; intList++)
                    {
                        if (strTempUrl[intList] != null && strTempUrl[intList] != "")
                        {
                            intCnt = intCnt + 1;
                            SaveImageCommon.SetIniValue("UrlList", "List" + (intCnt).ToString("00"), strTempUrl[intList], SaveImageCommon.CON_SAVEIMAGE_INI);
                        }
                    }
                }
                else
                {
                    // 除外キー情報は存在し、突合せ実施した場合
                    intCnt = 0;
                    for (intList = 0; intList < strUrl.Length; intList++)
                    {
                        if (strUrl[intList] != null && strUrl[intList] != "")
                        {
                            intCnt = intCnt + 1;
                            SaveImageCommon.SetIniValue("UrlList", "List" + (intCnt).ToString("00"), strUrl[intList], SaveImageCommon.CON_SAVEIMAGE_INI);
                        }
                    }
                }

                blRes = true;
            }
            catch (Exception ex)
            {
                CommonLogger.WriteLine(ex.Message);
                blRes = false;
            }
            return(blRes);
        }
Exemplo n.º 16
0
        private Bitmap fnc_GetWebImageFullScreen()
        {
            int intWbWidthDefault;
            int intWbHeightDefault;
            int intBodyWidth;
            int intBodyHeight;

            Bitmap bitmap = null;

            try
            {
                intWbWidthDefault  = TargetWebBrowser.Width;
                intWbHeightDefault = TargetWebBrowser.Height;

                // キャプチャサイズを指定
                intBodyWidth            = TargetWebBrowser.Document.Body.ScrollRectangle.Width;
                intBodyHeight           = TargetWebBrowser.Document.Body.ScrollRectangle.Height;
                TargetWebBrowser.Width  = intBodyWidth;
                TargetWebBrowser.Height = intBodyHeight;

                // キャプチャの保存先bitmapを生成
                bitmap = new Bitmap(intBodyWidth, intBodyHeight);

                Graphics graphic = null;
                IntPtr   ptrObj  = IntPtr.Zero;
                IntPtr   ptrHdc  = IntPtr.Zero;
                try
                {
                    graphic = Graphics.FromImage(bitmap);
                    ptrHdc  = graphic.GetHdc();
                    ptrObj  = Marshal.GetIUnknownForObject(TargetWebBrowser.ActiveXInstance);
                    Rectangle rect = new Rectangle(0, 0, intBodyWidth, intBodyHeight);

                    // ptrObj画像内のrectで指定した領域を,HDCのエリアに貼付
                    SaveImageCommon.OleDraw(ptrObj, (int)DVASPECT.DVASPECT_CONTENT, ptrHdc, ref rect);
                }
                finally
                {
                    if (ptrObj != IntPtr.Zero)
                    {
                        Marshal.Release(ptrObj);
                    }
                    if (ptrHdc != IntPtr.Zero)
                    {
                        graphic.ReleaseHdc(ptrHdc);
                    }
                    if (graphic != null)
                    {
                        graphic.Dispose();
                    }

                    TargetWebBrowser.Width  = intWbWidthDefault;
                    TargetWebBrowser.Height = intWbHeightDefault;
                }

                // 取得したbmp情報を返す
                return(bitmap);
            }
            catch (Exception ex)
            {
                CommonLogger.WriteLine(ex.Message);
                MessageBox.Show(ex.Message);
                return(null);
            }
        }