Esempio n. 1
0
    private void LoadUserGui(string guiPath)
    {
        mCurrentGuiPath = guiPath;

        string path;

        if (ProtocolUtility.HasProtocol(guiPath))
        {
            path = ProtocolUtility.ConvertToFilePath(guiPath) + ".xml";
        }
        else
        {
            path = guiPath;
        }

        FileInfo fileInfo = new FileInfo(path);
        string   filePath = "file://" + path;

        mLoadedGuiLabel.Text = fileInfo.Name;

        ClearUserGuis();

        try
        {
            GuiController userGuis = new GuiController(mManager, filePath);
            foreach (ITopLevel topLevel in userGuis.AllGuis)
            {
                mManager.SetTopLevelPosition(topLevel, new FixedPosition(0.0f, 0.0f, GuiAnchor.CenterCenter, GuiAnchor.CenterCenter));

                if (mHiddenWindows.Contains(topLevel.Name))
                {
                    topLevel.Showing = false;
                }
            }
            mLoadedGuis.AddRange(userGuis.AllGuis);
        }
        catch (GuiConstructionException ex)
        {
            Debug.LogError(ex);
            ShowError(ex.Message);
        }

        mCurrentGuiMonitors.Clear();
        MonitorIncludes(path);

        SetupLoadedGuiWindowList();
    }
Esempio n. 2
0
    private void MonitorIncludes(string initialPath)
    {
        List <string> pathsToScanForIncludes = new List <string>();

        pathsToScanForIncludes.Add(initialPath);
        mCurrentGuiMonitors.Add(new FileWatcher(new FileInfo(initialPath), ReloadCurrentGui));

        while (pathsToScanForIncludes.Count != 0)
        {
            XmlDocument currentDocumentToScan = new XmlDocument();
            currentDocumentToScan.Load(pathsToScanForIncludes[0]);
            pathsToScanForIncludes.RemoveAt(0);

            foreach (XmlNode includeNode in currentDocumentToScan.SelectNodes("//Include/@path"))
            {
                string path = ProtocolUtility.ConvertToFilePath(includeNode.InnerText) + ".xml";
                pathsToScanForIncludes.Add(path);
                mCurrentGuiMonitors.Add(new FileWatcher(new FileInfo(path), ReloadCurrentGui));
            }
        }
    }