示例#1
0
        public static string[] Get( )
        {
            try
            {
                DBProvider.SQLite sqliteProvider = new DBProvider.SQLite("core.db", GlobalVar.THREAD_DATA_CREATE_SQLITE);
                List <string>     array          = new List <string>( );

                sqliteProvider.ExecuteDataReader("SELECT * FROM ThreadIDStored", ( SQLiteDataReader reader ) =>                  // order by 추가바람
                {
                    array.Add(reader["id"].ToString( ));
                    return(true);
                });

                sqliteProvider.Close( );

                return(array.ToArray( ));
            }
            catch (SQLiteException ex)
            {
                Utility.WriteErrorLog("SQLiteException - " + ex.Message, Utility.LogSeverity.EXCEPTION);
                return(new string[] { });
            }
            catch (Exception ex)
            {
                Utility.WriteErrorLog(ex.Message, Utility.LogSeverity.EXCEPTION);
                return(new string[] { });
            }

            //JsonArrayCollection collection = ( JsonArrayCollection ) new JsonTextParser( ).Parse( File.ReadAllText( DATA_FILE_LOCATION ) );
            //string[ ] dataTable = new string[ collection.Count ];
            //int count = 0;

            //foreach ( JsonStringValue i in collection )
            //{
            //	dataTable[ count ] = i.Value;
            //	count++;
            //}

            //return dataTable;
            //}
            //catch { return new string[ ] { }; }
        }
示例#2
0
        public static void Initialize( )
        {
            try
            {
                DBProvider.SQLite sqliteProvider = new DBProvider.SQLite("core.db", GlobalVar.NOTIFY_ARTICLE_CREATE_SQLITE);

                sqliteProvider.ExecuteDataReader("SELECT * FROM ArticleNotification ORDER BY threadID DESC", (System.Data.SQLite.SQLiteDataReader reader) =>
                {
                    LISTS.Add(new NotifyData( )
                    {
                        threadID      = reader["threadID"].ToString( ),
                        threadTitle   = HttpUtility.HtmlDecode(reader["threadTitle"].ToString( )),
                        threadURL     = reader["threadURL"].ToString( ),
                        threadHit     = int.Parse(reader["threadHit"].ToString( )),
                        threadTime    = reader["threadTime"].ToString( ),
                        threadAuthor  = HttpUtility.HtmlDecode(reader["threadAuthor"].ToString( )),
                        personaconURL = reader["personaconURL"].ToString( ),
                        articleName   = reader["articleName"].ToString( ),
                        authorRank    = reader["authorRank"].ToString( ),
                        focused       = reader["focused"].ToString( ) == "1" ? true : false
                    });

                    //newNotifyData.threadID = reader[ "threadID" ].ToString( );
                    //newNotifyData.threadTitle = HttpUtility.HtmlDecode( reader[ "threadTitle" ].ToString( ) );
                    //newNotifyData.threadURL = reader[ "threadURL" ].ToString( );
                    //newNotifyData.threadHit = int.Parse( reader[ "threadHit" ].ToString( ) );

                    //newNotifyData.threadTime = reader[ "threadTime" ].ToString( );
                    //newNotifyData.threadAuthor = reader[ "threadAuthor" ].ToString( );
                    //newNotifyData.personaconURL = reader[ "personaconURL" ].ToString( );
                    //newNotifyData.articleName = reader[ "articleName" ].ToString( );
                    //newNotifyData.authorRank = reader[ "authorRank" ].ToString( );

                    //if ( reader[ "focused" ] != null )
                    //	newNotifyData.focused = reader[ "focused" ].ToString( ) == "1" ? true : false;
                    //else
                    //	newNotifyData.focused = false;

                    return(true);
                });

                sqliteProvider.Close( );
                RefreshMainNotifyPanel( );
                //foreach( JsonObjectCollection i in collection )
                //{
                //	NotifyData newNotifyData = new NotifyData( );
                //	newNotifyData.threadID = i[ "threadID" ].GetValue( ).ToString( );
                //	newNotifyData.threadTitle = HttpUtility.HtmlDecode( i[ "threadTitle" ].GetValue( ).ToString( ) );
                //	newNotifyData.threadURL = i[ "threadURL" ].GetValue( ).ToString( );
                //	newNotifyData.threadHit = int.Parse( i[ "threadHit" ].GetValue( ).ToString( ) );

                //	newNotifyData.threadTime = i[ "threadTime" ].GetValue( ).ToString( );
                //	newNotifyData.threadAuthor = i[ "threadAuthor" ].GetValue( ).ToString( );
                //	newNotifyData.personaconURL = i[ "personaconURL" ].GetValue( ).ToString( );
                //	newNotifyData.articleName = i[ "articleName" ].GetValue( ).ToString( );
                //	newNotifyData.authorRank = i[ "authorRank" ].GetValue( ).ToString( );

                //	if ( i[ "focused" ] != null )
                //		newNotifyData.focused = bool.Parse( i[ "focused" ].GetValue( ).ToString( ) );
                //	else
                //		newNotifyData.focused = false;

                //	LISTS.Add( newNotifyData );
                //}
            }
            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 ( FormatException ex )
            //{
            //	Utility.WriteErrorLog( "FormatException - " + 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);
            }
        }