Пример #1
0
        // フィルタに合致したら追加
        public HITRESULT AddFiltered(PostClass post)
        {
            if (IsInnerStorageTabType)
            {
                return(HITRESULT.None);
            }

            var rslt = HITRESULT.None;

            // 全フィルタ評価(優先順位あり)
            lock (_lockObj)
            {
                foreach (FiltersClass ft in _filters)
                {
                    try
                    {
                        switch (ft.IsHit(post))
                        {
                        // フィルタクラスでヒット判定
                        case HITRESULT.None:
                            break;

                        case HITRESULT.Copy:
                            if (rslt != HITRESULT.CopyAndMark)
                            {
                                rslt = HITRESULT.Copy;
                            }

                            break;

                        case HITRESULT.CopyAndMark:
                            rslt = HITRESULT.CopyAndMark;
                            break;

                        case HITRESULT.Move:
                            rslt = HITRESULT.Move;
                            break;

                        case HITRESULT.Exclude:
                            rslt = HITRESULT.Exclude;
                            break;
                        }
                    }
                    catch (NullReferenceException)
                    {
                        // IsHitでNullRef出る場合あり。暫定対応
                        MyCommon.TraceOut("IsHitでNullRef: " + ft);
                        rslt = HITRESULT.None;
                    }
                }
            }

            if (rslt != HITRESULT.None && rslt != HITRESULT.Exclude)
            {
                _tmpIds.Add(new TemporaryId(post.StatusId, post.IsRead));
            }

            // マーク付けは呼び出し元で行うこと
            return(rslt);
        }
Пример #2
0
        public InternetSecurityManager(WebBrowser webBrowser)
        {
            // ActiveXコントロール取得
            webBrowser.DocumentText = "about:blank";

            // ActiveXを初期化する
            do
            {
                Thread.Sleep(100);
                Application.DoEvents();
            }while (webBrowser.ReadyState != WebBrowserReadyState.Complete);

            _ocx = webBrowser.ActiveXInstance;

            // IServiceProvider.QueryService() を使って IProfferService を取得
            _ocxServiceProvider = (WebBrowserAPI.IServiceProvider)_ocx;
            try
            {
                _ocxServiceProvider.QueryService(ref WebBrowserAPI.SID_SProfferService, ref WebBrowserAPI.IID_IProfferService, out _profferServicePtr);
            }
            catch (SEHException)
            {
            }
            catch (ExternalException ex)
            {
                MyCommon.TraceOut(ex, string.Format("ocxServiceProvider.QueryService() HRESULT:{0:X8}{1}", ex.ErrorCode, Environment.NewLine));
                return;
            }

            _profferService = (WebBrowserAPI.IProfferService)Marshal.GetObjectForIUnknown(_profferServicePtr);

            // IProfferService.ProfferService() を使って
            // 自分を IInternetSecurityManager として提供
            try
            {
                int cookie;
                _profferService.ProfferService(ref WebBrowserAPI.IID_IInternetSecurityManager, this, out cookie);
            }
            catch (SEHException)
            {
            }
            catch (ExternalException ex)
            {
                MyCommon.TraceOut(ex, string.Format("IProfferSerive.ProfferService() HRESULT:{0:X8}{1}", ex.ErrorCode, Environment.NewLine));
            }
        }
Пример #3
0
        private ApiAccessLevel GetApiAccessLevelFromHttpHeader()
        {
            switch (HttpHeaders["X-Access-Level"])
            {
            case "read":
                return(ApiAccessLevel.Read);

            case "read-write":
                return(ApiAccessLevel.ReadWrite);

            case "read-write-directmessages":
            case "read-write-privatemessages":
                return(ApiAccessLevel.ReadWriteAndDirectMessage);

            default:

                // 未知のアクセスレベルの場合Read/Write/Dmと仮定して処理継続
                MyCommon.TraceOut("Unknown ApiAccessLevel:" + HttpHeaders["X-Access-Level"]);
                return(ApiAccessLevel.ReadWriteAndDirectMessage);
            }
        }