Esempio n. 1
0
        public static void Save( )
        {
            Main mainForm = Utility.GetMainForm( );

            if (mainForm != null)
            {
                mainForm.MaskShow( );
            }

            try
            {
                DBProvider.SQLite sqliteProvider = new DBProvider.SQLite("core.db", GlobalVar.NOTIFY_ARTICLE_CREATE_SQLITE);

                sqliteProvider.ExecuteQuery("DELETE FROM ArticleNotification");

                foreach (NotifyData i in LISTS)
                {
                    sqliteProvider.ExecuteQuery(
                        string.Format("INSERT INTO ArticleNotification VALUES ( {0}, '{1}', '{2}', '{3}', '{4}', {5}, {6}, '{7}', '{8}', '{9}' )",
                                      i.threadID,
                                      i.threadTitle.Replace("'", "''"),
                                      i.threadAuthor,
                                      i.threadURL,
                                      i.threadTime,
                                      i.threadHit,
                                      i.focused == true ? 1 : 0,
                                      i.personaconURL,
                                      i.articleName,
                                      i.authorRank
                                      )
                        );


                    Application.DoEvents( );
                }

                sqliteProvider.Close( );
            }
            catch (System.Data.SQLite.SQLiteException ex)
            {
                Utility.WriteErrorLog("SQLiteException - " + ex.Message, Utility.LogSeverity.EXCEPTION);
                NotifyBox.Show(null, "오류", "죄송합니다, 데이터를 저장하지 못했습니다, SQLite 오류가 발생했습니다.\n\n" + ex.Message + " (0x" + (ex.ErrorCode > 0 ? ex.ErrorCode : 0) + ")", NotifyBoxType.OK, NotifyBoxIcon.Error);
            }
            catch (Exception ex)
            {
                Utility.WriteErrorLog(ex.Message, Utility.LogSeverity.EXCEPTION);
                NotifyBox.Show(null, "오류", "죄송합니다, 데이터를 저장하지 못했습니다, 알 수 없는 오류가 발생했습니다.", NotifyBoxType.OK, NotifyBoxIcon.Error);
            }
            finally
            {
                if (mainForm != null)
                {
                    mainForm.MaskClose( );
                }
            }
        }
Esempio n. 2
0
        public static void Add(List <string> threadIDList)
        {
            try
            {
                DBProvider.SQLite sqliteProvider = new DBProvider.SQLite("core.db", GlobalVar.THREAD_DATA_CREATE_SQLITE);

                foreach (string i in threadIDList)
                {
                    sqliteProvider.ExecuteQuery("INSERT OR IGNORE INTO ThreadIDStored ( id ) VALUES ( " + i + " )");
                }

                sqliteProvider.Close( );
            }
            catch (SQLiteException ex)
            {
                Utility.WriteErrorLog("SQLiteException - " + ex.Message, Utility.LogSeverity.EXCEPTION);
                NotifyBox.Show(null, "오류", "죄송합니다, 데이터를 정의하지 못했습니다, SQLite 오류입니다.\n\n" + ex.Message + " (0x" + (ex.ErrorCode > 0 ? ex.ErrorCode : 0) + ")", NotifyBoxType.OK, NotifyBoxIcon.Error);
            }
            catch (IOException ex)
            {
                Utility.WriteErrorLog("IOException - " + ex.Message, Utility.LogSeverity.EXCEPTION);
            }
            catch (Exception ex)
            {
                Utility.WriteErrorLog(ex.Message, Utility.LogSeverity.EXCEPTION);
            }
        }
Esempio n. 3
0
        public static bool RemoveAll( )
        {
            try
            {
                DBProvider.SQLite sqliteProvider = new DBProvider.SQLite("core.db", GlobalVar.NOTIFY_ARTICLE_CREATE_SQLITE);

                sqliteProvider.ExecuteQuery("DELETE FROM ArticleNotification");

                sqliteProvider.Close( );

                return(true);
            }
            catch (System.Data.SQLite.SQLiteException ex)
            {
                Utility.WriteErrorLog("SQLiteException - " + ex.Message, Utility.LogSeverity.EXCEPTION);
                NotifyBox.Show(null, "오류", "죄송합니다, 데이터를 삭제하지 못했습니다, SQLite 오류가 발생했습니다.\n\n" + ex.Message + " (0x" + (ex.ErrorCode > 0 ? ex.ErrorCode : 0) + ")", NotifyBoxType.OK, NotifyBoxIcon.Error);

                return(false);
            }
            catch (Exception ex)
            {
                Utility.WriteErrorLog(ex.Message, Utility.LogSeverity.EXCEPTION);
                NotifyBox.Show(null, "오류", "죄송합니다, 데이터를 삭제하지 못했습니다, 알 수 없는 오류가 발생했습니다.", NotifyBoxType.OK, NotifyBoxIcon.Error);

                return(false);
            }
        }
Esempio n. 4
0
        public static void Initialize(bool force = true)
        {
            try
            {
                if (!Directory.Exists(GlobalVar.DATA_DIR))
                {
                    Directory.CreateDirectory(GlobalVar.DATA_DIR);
                }

                Notify.Initialize( );

                if (force)                   // 데이터 파일이 없을 시
                {
                    NaverRequest.New("http://cafe.naver.com/ArticleList.nhn?search.clubid=" + GlobalVar.CAFE_ID + "&search.boardtype=L&userDisplay=15", NaverRequest.RequestMethod.GET, Encoding.Default, (value) =>
                    {
                        DBProvider.SQLite sqliteProvider = new DBProvider.SQLite("core.db", GlobalVar.THREAD_DATA_CREATE_SQLITE);

                        List <TableDataTable> dataTable = Parse.TotalArticlePageCrawling(value);

                        foreach (TableDataTable i in dataTable)
                        {
                            sqliteProvider.ExecuteQuery("INSERT OR IGNORE INTO ThreadIDStored ( id ) VALUES ( " + i.number + " )");
                        }

                        sqliteProvider.Close( );

                        TopProgressMessage.End( );
                    }, ( Exception ex ) =>
                    {
                        NotifyBox.Show(null, "오류", "죄송합니다, 데이터를 불러오지 못했습니다.\n\n" + ex.Message + " (0x" + (ex.HResult > 0 ? ex.HResult : 0) + ")", NotifyBoxType.OK, NotifyBoxIcon.Error);
                    });
                }
            }
            catch (SQLiteException ex)
            {
                Utility.WriteErrorLog("SQLiteException - " + ex.Message, Utility.LogSeverity.EXCEPTION);
                NotifyBox.Show(null, "오류", "죄송합니다, 데이터를 불러오지 못했습니다, SQLite 오류입니다.\n\n" + ex.Message + " (0x" + (ex.ErrorCode > 0 ? ex.ErrorCode : 0) + ")", NotifyBoxType.OK, NotifyBoxIcon.Error);
            }
            catch (IOException ex)
            {
                Utility.WriteErrorLog("IOException - " + ex.Message, Utility.LogSeverity.EXCEPTION);
                NotifyBox.Show(null, "오류", "죄송합니다, 데이터를 불러오지 못했습니다, 파일 접근 오류가 발생했습니다.", NotifyBoxType.OK, NotifyBoxIcon.Error);
            }
            catch (Exception ex)
            {
                Utility.WriteErrorLog(ex.Message, Utility.LogSeverity.EXCEPTION);
                NotifyBox.Show(null, "오류", "죄송합니다, 데이터를 불러오지 못했습니다, 알 수 없는 오류가 발생했습니다.", NotifyBoxType.OK, NotifyBoxIcon.Error);
            }
        }