Exemple #1
0
 public View(View view)
     : this()
 {
     //copy all members (deep copy)
     _name = view._name;
     _isEdited = view._isEdited;
     _showTypeCompleted = view._showTypeCompleted;
     _showTypeAdultContent = view._showTypeAdultContent;
     _showTypeMissingEpisodes = view._showTypeMissingEpisodes;
     _showTypeBluRay = view._showTypeBluRay;
     _showTypeDVD = view._showTypeDVD;
     _showTypeFavorite = view._showTypeFavorite;
     _showTypeNewEps = view._showTypeNewEps;
     _showTypeNewSeason = view._showTypeNewSeason;
     _showTypeRecentlyWatched = view._showTypeRecentlyWatched;
     _showTypeWatched = view._showTypeWatched;
     _showByDefault = view._showByDefault;
     _sortType = view._sortType;
     _labelStyleEps = view._labelStyleEps;
     _labelStyleGroups = view._labelStyleGroups;
     foreach (KeyValuePair<string, eShowType> y in view._dctGenre)
         _dctGenre.Add(y.Key, y.Value);
     foreach (KeyValuePair<string, eShowType> y in view._dctYear)
         _dctYear.Add(y.Key, y.Value);
     foreach (KeyValuePair<string, eShowType> y in view._dctAudioLang)
         _dctAudioLang.Add(y.Key, y.Value);
     foreach (KeyValuePair<string, eShowType> y in view._dctSubtitleLang)
         _dctSubtitleLang.Add(y.Key, y.Value);
     foreach (KeyValuePair<string, eShowType> y in view._dctAnimeType)
         _dctAnimeType.Add(y.Key, y.Value);
 }
Exemple #2
0
    void ChangeShowType(eShowType type)
    {
        _currentShowType = type;

        for (int n = 0; n < (int)eShowType.max; n++)
        {
            _showObjArr[n].SetActive(n == (int)type);
        }
    }
Exemple #3
0
 public static void SetShowType(eShowType value, string str, List <string> show, List <string> hide)
 {
     if (value == eShowType.show)
     {
         show.Add(str);
     }
     else if (value == eShowType.hide)
     {
         hide.Add(str);
     }
 }
Exemple #4
0
        public static bool?ShowValue(eShowType showType, bool bSet)
        {
            switch (showType)
            {
            case eShowType.show:
                return(bSet ? true : (bool?)null);

            case eShowType.hide:
                return(bSet ? false : (bool?)null);

            case eShowType.ignore:
            default:
                return(null);
            }
        }
Exemple #5
0
        public static eShowType NextShowType(eShowType showType)
        {
            switch (showType)
            {
            case eShowType.show:
                return(eShowType.hide);

            case eShowType.hide:
                return(eShowType.ignore);

            case eShowType.ignore:
                return(eShowType.show);
            }

            return(eShowType.ignore);
        }
Exemple #6
0
        public static string ShowTypeToString(eShowType showType)
        {
            switch (showType)
            {
            case eShowType.show:
                return("show");

            case eShowType.hide:
                return("hide");

            case eShowType.ignore:
                return("-");
            }

            return("");
        }
Exemple #7
0
        public void UpdateDefault(eShowType showType)
        {
            if (showType == eShowType.show)
            {
                _showByDefault = false;
                return;
            }

            _showByDefault = _showTypeCompleted != eShowType.show &&
                             _showTypeNewEps != eShowType.show &&
                             _showTypeNewSeason != eShowType.show &&
                             _showTypeWatched != eShowType.show &&
                             _showTypeFavorite != eShowType.show &&
                             _showTypeAdultContent != eShowType.show &&
                             _showTypeMissingEpisodes != eShowType.show &&
                             _showTypeRecentlyWatched != eShowType.show &&
                             _showTypeBluRay != eShowType.show &&
                             _showTypeDVD != eShowType.show &&
                             !ItemIsShown(_dctGenre) &&
                             !ItemIsShown(_dctYear) &&
                             !ItemIsShown(_dctAudioLang) &&
                             !ItemIsShown(_dctSubtitleLang) &&
                             !ItemIsShown(_dctAnimeType);
        }
Exemple #8
0
 public static bool? ShowValue(eShowType showType, bool bSet)
 {
     switch (showType)
     {
         case eShowType.show:
             return bSet ? true : (bool?)null;
         case eShowType.hide:
             return bSet ? false : (bool?)null;
         case eShowType.ignore:
         default:
             return null;
     }
 }
Exemple #9
0
        public static string ShowTypeToString(eShowType showType)
        {
            switch (showType)
            {
                case eShowType.show:
                    return "show";
                case eShowType.hide:
                    return "hide";
                case eShowType.ignore:
                    return "-";
            }

            return "";
        }
Exemple #10
0
 public static void SetShowType(eShowType value, string str, List<string> show, List<string> hide)
 {
     if (value == eShowType.show)
         show.Add(str);
     else if (value == eShowType.hide)
         hide.Add(str);
 }
Exemple #11
0
        public static eShowType NextShowType(eShowType showType)
        {
            switch (showType)
            {
                case eShowType.show:
                    return eShowType.hide;
                case eShowType.hide:
                    return eShowType.ignore;
                case eShowType.ignore:
                    return eShowType.show;
            }

            return eShowType.ignore;
        }
Exemple #12
0
 private void OnEnable()
 {
     _currentShowType = eShowType.Rank;
     ChangeShowType(_currentShowType);
 }
        void OnGUI()
        {
            handleCommandEvent();
            // main bar
            GUILayout.BeginHorizontal();
            int connectedIndex = GUI.SelectionGrid(new Rect(0, 0, 180, 20), (int)_selectedProfilerMode, _ConnectedOptions, _ConnectedOptions.Length, MemStyles.ToolbarButton);

            if (connectedIndex != (int)_selectedProfilerMode)
            {
                _isRemoteConnected = false;

                if (_SnapshotChunks.Count > 0 &&
                    !_snapshotIOperator.isSaved(_SnapshotChunks.Count, _selectedProfilerMode, lastLoginIP) &&
                    !switchProfilerModeDialog())
                {
                }
                else
                {
                    clearSnapshotChunk();
                    _selectedProfilerMode = (eProfilerMode)connectedIndex;

                    if (_selectedProfilerMode == (int)eProfilerMode.Editor)
                    {
                        connectEditor();
                    }
                }
            }

            GUILayout.Space(200);
            drawProfilerModeGUI();
            if (GUILayout.Button("Open Dir", GUILayout.MaxWidth(100)))
            {
                EditorUtility.RevealInFinder(MemUtil.SnapshotsDir);
            }
            GUILayout.EndHorizontal();

            // view bar
            GUILayout.BeginArea(new Rect(0, MemConst.TopBarHeight, position.width - MemConst.InspectorWidth, 30));
            GUILayout.BeginHorizontal(MemStyles.Toolbar);
            int selected = GUILayout.SelectionGrid((int)m_selectedView, MemConst.ShowTypes, MemConst.ShowTypes.Length, MemStyles.ToolbarButton);

            if (m_selectedView != (eShowType)selected)
            {
                m_selectedView = (eShowType)selected;
                RefreshCurrentView();
            }

            GUILayout.EndHorizontal();
            GUILayout.EndArea();

            // selected views
            float TabHeight = 30;
            float yoffset   = MemConst.TopBarHeight + TabHeight;
            Rect  view      = new Rect(0f, yoffset, position.width - MemConst.InspectorWidth, position.height - yoffset);

            switch (m_selectedView)
            {
            case eShowType.InTable:
                if (_tableBrowser != null)
                {
                    _tableBrowser.Draw(view);
                }
                break;

            case eShowType.InTreemap:
                if (_treeMapView != null)
                {
                    _treeMapView.Draw(view);
                }
                break;

            default:
                break;
            }

            if (_inspector != null)
            {
                _inspector.Draw();
            }
        }
Exemple #14
0
        void OnGUI()
        {
            // main bar
            {
                GUILayout.BeginHorizontal();
                if (GUILayout.Button("Take Snapshot", GUILayout.Width(150)))
                {
                    UnityEditor.MemoryProfiler.MemorySnapshot.RequestNewSnapshot();
                }

                // add time point snapshots
                var snapShotOptArray = _SnapshotOptions.ToArray();
                int currentIndex     = GUI.SelectionGrid(new Rect(200, 0, 900, 20), _SnapshotChunkIndex, snapShotOptArray, snapShotOptArray.Length);
                if (currentIndex != Invalid_Int && currentIndex != _SnapshotChunkIndex)
                {
                    _SnapshotChunkIndex = currentIndex;
                    showSnapshotInfo();
                }

                GUILayout.FlexibleSpace();
                //save
                if (GUILayout.Button("Save Snapshot", GUILayout.MaxWidth(100)))
                {
                    EditorUtility.RevealInFinder(MemUtil.SnapshotsDir);
                }

                //load
                if (GUILayout.Button("Load Snapshot", GUILayout.MaxWidth(100)))
                {
                    EditorUtility.RevealInFinder(MemUtil.SnapshotsDir);
                }

                if (GUILayout.Button("Open Dir", GUILayout.MaxWidth(100)))
                {
                    EditorUtility.RevealInFinder(MemUtil.SnapshotsDir);
                }
                GUILayout.EndHorizontal();
            }

            // view bar
            GUILayout.BeginArea(new Rect(0, MemConst.TopBarHeight, position.width - MemConst.InspectorWidth, 30));
            GUILayout.BeginHorizontal(MemStyles.Toolbar);
            int selected = GUILayout.SelectionGrid((int)m_selectedView, MemConst.ShowTypes, MemConst.ShowTypes.Length, MemStyles.ToolbarButton);

            if (m_selectedView != (eShowType)selected)
            {
                m_selectedView = (eShowType)selected;
                RefreshCurrentView();
            }
            GUILayout.EndHorizontal();
            GUILayout.EndArea();

            // selected views
            float TabHeight = 30;
            float yoffset   = MemConst.TopBarHeight + TabHeight;
            Rect  view      = new Rect(0f, yoffset, position.width - MemConst.InspectorWidth, position.height - yoffset);

            switch (m_selectedView)
            {
            case eShowType.InTable:
                if (_tableBrowser != null)
                {
                    _tableBrowser.Draw(view);
                }
                break;

            case eShowType.InTreemap:
                if (_treeMapView != null)
                {
                    _treeMapView.Draw(view);
                }
                break;

            default:
                break;
            }

            if (_inspector != null)
            {
                _inspector.Draw();
            }
        }
        void OnGUI()
        {
            try
            {
                if (Event.current.type == EventType.ExecuteCommand && Event.current.commandName.Equals("AppStarted"))
                {
                    InitNet();

                    var curMode = _modeMgr.GetCurrentMode();
                    if (curMode != null)
                    {
                        curMode.OnAppStarted();
                    }
                }

                _modeMgr.OnGUI();

                // view bar
                GUILayout.BeginHorizontal(MemStyles.Toolbar);
                GUI.backgroundColor = Color.cyan;
                int selected = GUILayout.SelectionGrid((int)m_selectedView, MemConst.ShowTypes, MemConst.ShowTypes.Length, MemStyles.ToolbarButton);
                if (m_selectedView != (eShowType)selected)
                {
                    m_selectedView = (eShowType)selected;
                    RefreshView();
                }
                GUI.backgroundColor = Color.white;
                GUILayout.EndHorizontal();

                // selected view
                float yoffset = MemConst.TopBarHeight /*+ 30*/; // view bar is temporarily disabled
                Rect  view    = new Rect(0f, yoffset, position.width - MemConst.InspectorWidth, position.height - yoffset);
                switch (m_selectedView)
                {
                case eShowType.InTable:
                    if (_tableBrowser != null)
                    {
                        if (Event.current.type == EventType.KeyDown)
                        {
                            if (Event.current.keyCode == KeyCode.UpArrow)
                            {
                                _tableBrowser.MoveSelectItem(-1);
                            }
                            else if (Event.current.keyCode == KeyCode.DownArrow)
                            {
                                _tableBrowser.MoveSelectItem(1);
                            }
                            else if (Event.current.keyCode == KeyCode.RightArrow || Event.current.keyCode == KeyCode.LeftArrow)
                            {
                                _tableBrowser.ChangeSelectTable();
                            }
                        }
                        _tableBrowser.Draw(view);
                    }
                    break;

                case eShowType.InTreemap:
                    if (_treeMapView != null)
                    {
                        _treeMapView.Draw(view);
                    }
                    break;

                default:
                    break;
                }

                if (_inspector != null)
                {
                    _inspector.Draw();
                }
            }
            catch (Exception ex)
            {
                Debug.LogException(ex);
            }
        }
Exemple #16
0
        public void UpdateDefault(eShowType showType)
        {
            if (showType == eShowType.show)
            {
                _showByDefault = false;
                return;
            }

            _showByDefault = (_showTypeCompleted != eShowType.show)
                && (_showTypeNewEps != eShowType.show)
                && (_showTypeNewSeason != eShowType.show)
                && (_showTypeWatched != eShowType.show)
                && (_showTypeFavorite != eShowType.show)
                && (_showTypeAdultContent != eShowType.show)
                && (_showTypeMissingEpisodes != eShowType.show)
                && (_showTypeRecentlyWatched != eShowType.show)
                && (_showTypeBluRay != eShowType.show)
                && (_showTypeDVD != eShowType.show)
                && (!ItemIsShown(_dctGenre) )
                && (!ItemIsShown(_dctYear))
                && (!ItemIsShown(_dctAudioLang))
                && (!ItemIsShown(_dctSubtitleLang))
                && (!ItemIsShown(_dctAnimeType));
        }
        void OnGUI()
        {
            GUILayout.BeginHorizontal();

            _enhancedMode = GUILayout.Toggle(_enhancedMode, "Enhanced Mode", GUILayout.MaxWidth(150));

            if (GUILayout.Button("Take Snapshot"))
            {
                UnityEditor.MemoryProfiler.MemorySnapshot.RequestNewSnapshot();

                // the above call (RequestNewSnapshot) is a sync-invoke so we can process it immediately
                if (_enhancedMode && _autoSaveForComparison)
                {
                    string filename = MemUtil.Save(_snapshot);
                    if (!string.IsNullOrEmpty(filename))
                    {
                        Debug.LogFormat("snapshot '{0}' saved.", filename);

                        RefreshSnapshotList();
                    }
                }
            }

            if (_enhancedMode)
            {
                _autoSaveForComparison = GUILayout.Toggle(_autoSaveForComparison, "Auto-Save");
            }

            if (GUILayout.Button("Save Snapshot..."))
            {
                if (_snapshot != null)
                {
                    string fileName = EditorUtility.SaveFilePanel("Save Snapshot", null, "MemorySnapshot", "memsnap");
                    if (!string.IsNullOrEmpty(fileName))
                    {
                        System.Runtime.Serialization.Formatters.Binary.BinaryFormatter bf = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter();
                        using (Stream stream = File.Open(fileName, FileMode.Create))
                        {
                            bf.Serialize(stream, _snapshot);
                        }
                    }
                }
                else
                {
                    UnityEngine.Debug.LogWarning("No snapshot to save.  Try taking a snapshot first.");
                }
            }
            if (GUILayout.Button("Load Snapshot..."))
            {
                string fileName = EditorUtility.OpenFilePanel("Load Snapshot", null, "memsnap");
                if (!string.IsNullOrEmpty(fileName))
                {
                    System.Runtime.Serialization.Formatters.Binary.BinaryFormatter bf = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter();
                    using (Stream stream = File.Open(fileName, FileMode.Open))
                    {
                        IncomingSnapshot(bf.Deserialize(stream) as PackedMemorySnapshot);
                    }
                }
            }

            if (_enhancedMode)
            {
                GUILayout.FlexibleSpace();

                {
                    GUILayout.Space(50);
                    EditorGUIUtility.labelWidth = 40;
                    _selectedBegin = EditorGUILayout.Popup(string.Format("Begin"), _selectedBegin, _snapshotFiles, GUILayout.Width(250));

                    GUILayout.Space(50);

                    _selectedEnd = EditorGUILayout.Popup(string.Format("End"), _selectedEnd, _snapshotFiles, GUILayout.Width(250));
                    EditorGUIUtility.labelWidth = 0; // reset to default
                    GUILayout.Space(50);
                }

                if (_selectedBegin == _selectedEnd)
                {
                    GUI.enabled = false;
                }
                if (GUILayout.Button("Compare", GUILayout.MaxWidth(120)))
                {
                    Debug.LogFormat("Compare '{0}' with '{1}'", _snapshotFiles[_selectedBegin], _snapshotFiles[_selectedEnd]);

                    var snapshotBegin = MemUtil.Load(_snapshotFiles[_selectedBegin]);
                    var snapshotEnd   = MemUtil.Load(_snapshotFiles[_selectedEnd]);

                    if (snapshotBegin != null && snapshotEnd != null)
                    {
                        MemCompareTarget.Instance.SetCompareTarget(snapshotBegin);

                        IncomingSnapshot(snapshotEnd);

                        if (_treeMapView != null)
                        {
                            _treeMapView.Setup(this, _unpackedCrawl, MemCompareTarget.Instance.GetNewlyAdded(_unpackedCrawl));
                        }
                    }
                }
                if (_selectedBegin == _selectedEnd)
                {
                    GUI.enabled = true;
                }

                if (GUILayout.Button("Open Dir", GUILayout.MaxWidth(120)))
                {
                    EditorUtility.RevealInFinder(MemUtil.SnapshotsDir);
                }
            }

            GUILayout.EndHorizontal();

            GUILayout.BeginArea(new Rect(0, MemConst.TopBarHeight, position.width - MemConst.InspectorWidth, 30));
            GUILayout.BeginHorizontal(MemStyles.Toolbar);
            int selected = GUILayout.SelectionGrid((int)m_selectedView, MemConst.ShowTypes, MemConst.ShowTypes.Length, MemStyles.ToolbarButton);

            if (m_selectedView != (eShowType)selected)
            {
                m_selectedView = (eShowType)selected;
                RefreshCurrentView();
            }
            GUILayout.EndHorizontal();
            GUILayout.EndArea();

            float TabHeight = 30;
            float yoffset   = MemConst.TopBarHeight + TabHeight;
            Rect  view      = new Rect(0f, yoffset, position.width - MemConst.InspectorWidth, position.height - yoffset);

            switch (m_selectedView)
            {
            case eShowType.InTable:
                if (_tableBrowser != null)
                {
                    _tableBrowser.Draw(view);
                }
                break;

            case eShowType.InTreemap:
                if (_treeMapView != null)
                {
                    _treeMapView.Draw(view);
                }
                break;

            default:
                break;
            }

            if (_inspector != null)
            {
                _inspector.Draw();
            }

            //RenderDebugList();
        }