Esempio n. 1
0
    private void RenderTODOList()
    {
        float TOP_PANEL_MARGING = 40;

        if (TCore.size == TODOListSize.SMALL)
        {
            TOP_PANEL_MARGING = 25;
        }

        int i = 1;

        GUILayout.BeginArea(new Rect(0, TOP_PANEL_MARGING + 2, TAGS_PANLE_WIDTH, position.height - TOP_PANEL_MARGING), ""); {
            foreach (TagTemplate tpl in tags)
            {
                TagRenderer.renderTag(tpl, i);
                i++;
            }
        } GUILayout.EndArea();


        GUILayout.BeginArea(new Rect(TAGS_PANLE_WIDTH, TOP_PANEL_MARGING + 2, position.width - TAGS_PANLE_WIDTH, position.height - TOP_PANEL_MARGING), ""); {
            scrollPos = EditorGUILayout.BeginScrollView(scrollPos, GUILayout.Width(position.width - TAGS_PANLE_WIDTH), GUILayout.Height(position.height - TOP_PANEL_MARGING));
            GUILayout.Box("", GUIStyle.none, new GUILayoutOption[] { GUILayout.ExpandWidth(true), GUILayout.Height(maxYPos) });

            i = 1;

            Rect DrawArea = position;
            DrawArea.width -= TAGS_PANLE_WIDTH;


            foreach (TNode node in TCore.nodes)
            {
                if (!selectedTagName.Equals(string.Empty))
                {
                    if (node.tag != selectedTagName)
                    {
                        continue;
                    }
                }

                if (search != string.Empty)
                {
                    if (node.text.ToLower().Contains(search.ToLower()))
                    {
                        NodeRenderer.renderNode(node, i, DrawArea);
                        i++;
                    }
                }
                else
                {
                    NodeRenderer.renderNode(node, i, DrawArea);
                    i++;
                }
            }

            maxYPos = (i - 1) * NODE_HEIGHT + 20;
            EditorGUILayout.EndScrollView();
        } GUILayout.EndArea();
    }
Esempio n. 2
0
        /// <summary>
        /// </summary>
        public static void OnStart()
        {
            Statistic.Instantiate();

            ScmManager = new ScmManager();
            IOQueue    = new AsyncIOQueue();
            ManifestDownloadManager = new ManifestDownloadManager();

            DownloadManager = new DownloadManager();
            DownloadManager.OnRequestReplicatedBuilds += (List <Guid> SelectTags, List <Guid> IgnoreTags, DateTime NewerThan) =>
            {
                NetClient.RequestFilteredBuilds(SelectTags, IgnoreTags, NewerThan);

                Settings.ReplicationNewerThanTime = DownloadManager.ReplicationNewerThanTime;
                SaveSettings();
            };

            Logger.Log(LogLevel.Info, LogCategory.Main, "OnStart: Initializing settings");
            InitSettings();

            NetClient          = new Core.Client.Client();
            RemoteActionClient = new RemoteActionClient(NetClient, ManifestDownloadManager);

            TagRegistry   = new TagRegistry();
            RouteRegistry = new RouteRegistry(null, TagRegistry);
            BuildRegistry = new BuildManifestRegistry(TagRegistry);

            StorageManager = new StorageManager(Settings.StorageLocations, ManifestDownloadManager, BuildRegistry, IOQueue, Settings.StorageHeuristic, Settings.PrioritizeKeepingBuildTagIds, Settings.PrioritizeDeletingBuildTagIds);

            Logger.Log(LogLevel.Info, LogCategory.Main, "OnStart: Setting up network client");
            BuildRegistry.Open(Path.Combine(AppDataDir, "Manifests"), int.MaxValue);

            Logger.Log(LogLevel.Info, LogCategory.Main, "OnStart: Setting up network client");
            NetClient.Start(
                Settings.ServerHostname,
                Settings.ServerPort,
                Settings.ClientPortRangeMin,
                Settings.ClientPortRangeMax,
                Settings.AllowRemoteActions,
                Settings.TagIds,
                BuildRegistry,
                StorageManager,
                ManifestDownloadManager,
                TagRegistry,
                RouteRegistry
                );
            NetClient.TagIds = new List <Guid>(Settings.TagIds);

            // Setup the virtual file system we will store our available builds in.
            Logger.Log(LogLevel.Info, LogCategory.Main, "OnStart: Setting up build file system");

            BuildFileSystem = new VirtualFileSystem();
            NetClient.OnClientTagsUpdatedByServer += () =>
            {
                Settings.TagIds = NetClient.TagIds;

                NetClient.RestartConnections();
                SaveSettings();
            };
            NetClient.OnTagListRecieved += (List <Tag> InTags) =>
            {
                TagRenderer.InvalidateResources();
            };
            NetClient.OnPermissionsUpdated += () =>
            {
                BuildFileSystem.ForceRefresh();
                DownloadManager.ForceRefresh();
            };
            NetClient.OnBuildPublished += (string Path, Guid Id) =>
            {
                BuildFileSystem.ForceRefresh();
                DownloadManager.ForceRefresh();
            };
            NetClient.OnBuildUpdated += (string Path, Guid Id) =>
            {
                BuildFileSystem.ForceRefresh();
                DownloadManager.ForceRefresh();
            };
            NetClient.OnConnectedToServer      += () => { BuildFileSystem.ForceRefresh(); };
            NetClient.OnFilteredBuildsRecieved += (Builds) =>
            {
                DownloadManager.RecieveReplicatedBuilds(Builds);
            };
            NetClient.OnBuildsRecieved += (RootPath, Builds) =>
            {
                List <VirtualFileSystemInsertChild> NewChildren = new List <VirtualFileSystemInsertChild>();
                foreach (NetMessage_GetBuildsResponse.BuildInfo Build in Builds)
                {
                    NewChildren.Add(
                        new VirtualFileSystemInsertChild
                    {
                        VirtualPath = Build.VirtualPath,
                        CreateTime  = Build.Guid == Guid.Empty ? DateTime.UtcNow : Build.CreateTime,
                        Metadata    = Build
                    }
                        );
                }

                BuildFileSystem.ReconcileChildren(RootPath, NewChildren);
            };
            BuildFileSystem.OnRequestChildren += (FileSystem, Path) =>
            {
                if (NetClient.IsConnected)
                {
                    NetClient.RequestBuilds(Path);
                }
            };
            BuildFileSystem.Init();

            // Setup download managers for the manifest and app level.
            Logger.Log(LogLevel.Info, LogCategory.Main, "OnStart: Setting up manifest download manager");

            ManifestDownloadManager.Start(
                StorageManager,
                Settings.ManifestDownloadStates,
                BuildRegistry,
                IOQueue
                );

            Logger.Log(LogLevel.Info, LogCategory.Main, "OnStart: Setting up download manager");

            DownloadManager.Start(
                ManifestDownloadManager,
                Settings.DownloadStates,
                BuildFileSystem,
                ScmManager,
                Settings.ReplicationNewerThanTime
                );

            Logger.Log(LogLevel.Info, LogCategory.Main, "OnStart: Setting up update download");

            // Ensure we are downloading the latest update.
            string UpdateDownloadName = "$ Buildsync Update $";

            foreach (DownloadState State in DownloadManager.States.States)
            {
                if (State.Name == UpdateDownloadName)
                {
                    InternalUpdateDownload = State;
                    break;
                }
            }

            if (InternalUpdateDownload == null)
            {
                InternalUpdateDownload = DownloadManager.AddDownload(UpdateDownloadName, "$Internal$/Updates", 2, BuildSelectionRule.Newest, BuildSelectionFilter.None, "", "", true, false, "", "", new List <Guid>(), new List <Guid>());
            }

            // Make sure we have to get the latest manifest id before updating.
            InternalUpdateDownload.ActiveManifestId = Guid.Empty;

            // Clean up any orphan builds.
            StorageManager.CleanUpOrphanBuilds();

            Logger.Log(LogLevel.Info, LogCategory.Main, "OnStart: Complete");
        }
Esempio n. 3
0
        /// <summary>
        /// </summary>
        /// <param name="Users"></param>
        private void TagsRecieved(List <Tag> InTags)
        {
            bool ForceUpdate = false;

            InTags.Sort((Item1, Item2) => - Item1.Name.CompareTo(Item2.Name));

            // Add new tags.
            foreach (Tag Tag in InTags)
            {
                bool Found = false;

                foreach (TagTreeNode Node in Model.Nodes)
                {
                    if (Node.BuildTag.Id == Tag.Id)
                    {
                        if (!Node.BuildTag.EqualTo(Tag))
                        {
                            Node.BuildTag     = Tag;
                            Node.BuildTags    = new Tag[1];
                            Node.BuildTags[0] = Tag;
                            Node.Name         = Tag.Name;
                            Node.Unique       = Tag.Unique ? "True" : "False";

                            if (Tag.DecayTagId != Guid.Empty)
                            {
                                Node.DecayTags    = new Tag[1];
                                Node.DecayTags[0] = Program.TagRegistry.GetTagById(Tag.DecayTagId);
                            }
                            else
                            {
                                Node.DecayTags = new Tag[0];
                            }

                            ForceUpdate = true;
                        }

                        Found = true;
                        break;
                    }
                }

                if (!Found)
                {
                    TagTreeNode Node = new TagTreeNode();
                    Node.BuildTag     = Tag;
                    Node.BuildTags    = new Tag[1];
                    Node.BuildTags[0] = Tag;
                    Node.Unique       = Tag.Unique ? "True" : "False";
                    Node.Name         = Tag.Name;
                    Node.Icon         = Resources.appbar_tag;
                    if (Tag.DecayTagId != Guid.Empty)
                    {
                        Node.DecayTags    = new Tag[1];
                        Node.DecayTags[0] = Program.TagRegistry.GetTagById(Tag.DecayTagId);
                    }
                    else
                    {
                        Node.DecayTags = new Tag[0];
                    }
                    Model.Nodes.Add(Node);

                    ForceUpdate = true;
                }
            }

            // Remove old tags.
            List <TagTreeNode> RemovedNodes = new List <TagTreeNode>();

            foreach (TagTreeNode Node in Model.Nodes)
            {
                bool Found = false;

                foreach (Tag Tag in InTags)
                {
                    if (Node.BuildTag.Id == Tag.Id)
                    {
                        Found = true;
                        break;
                    }
                }

                if (!Found)
                {
                    RemovedNodes.Add(Node);
                }
            }

            foreach (TagTreeNode Node in RemovedNodes)
            {
                Model.Nodes.Remove(Node);
                ForceUpdate = true;
            }

            if (ForceUpdate)
            {
                TagRenderer.InvalidateResources();
                Invalidate();
                Refresh();
            }
        }