Ejemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ResourceManagerControl"/> class.
        /// </summary>
        public ResourceManagerControl()
        {
            this.InitializeComponent();
            InitializeDropDown();

            currentProj = ResourceManagerUtil.getCurrentProject();
            if (currentProj == null)
            {
                return;
            }
            projPath = currentProj.FullName;
            string projFilePath = projPath.Substring(0, projPath.LastIndexOf("\\") + 1);

            //Check if this is a Tizen project.
            if (!ResourceManagerUtil.isTizenProject(projFilePath))
            {
                return;
            }

            var resFolderPath = projFilePath + "res\\";

            ContentsWatcher watcher = new ContentsWatcher(this, currentProj);

            watcher.watch(projFilePath);

            viewContextMenu = new ResourceManagerContextMenu(currentProj);
            ctxMenu         = viewContextMenu.createContextMenu();
            updateResourceView();
            viewComboLang.ItemsSource           = viewLangComboList;
            resolutionComboView.ItemsSource     = viewDpiComboList;
            viewComboLang.DropDownOpened       += fetchViewLangComboData;
            resolutionComboView.DropDownOpened += fetchViewDpiComboData;
            btnAdd.IsEnabled = false;
        }
Ejemplo n.º 2
0
        private void createResourceViewTreeHeader(string projPath, TreeView parent)
        {
            DirectoryInfo d = new DirectoryInfo(projPath);

            FileAttributes attr = File.GetAttributes(projPath);

            if (!attr.HasFlag(FileAttributes.Directory))
            {
                return;
            }
            DirectoryInfo[] directories = d.GetDirectories();

            foreach (DirectoryInfo dir in directories)
            {
                String[] names = dir.Name.Split('-');
                if (parent.Equals(defaultExpanderTreeHeader) && names.Count() > 1 && ResourceManagerUtil.isValidLanguageID(names[0]) && ResourceManagerUtil.isValidResolution(names[1].Trim()))
                {
                    continue;
                }
                TreeViewItem item = createTreeItem(projPath, dir.Name, false);
                parent.Items.Add(item);
                createResourceViewTree(projPath + "\\" + dir.Name, item);
            }
            FileInfo[] Files = d.GetFiles();
            foreach (FileInfo file in Files)
            {
                TreeViewItem item = createTreeItem(projPath, file.Name, true);
                parent.Items.Add(item);
            }
        }
        /// <summary>
        /// Context menu Delete click Handler
        /// </summary>
        private void Delete_Ctx_Click(object sender, RoutedEventArgs e)
        {
            MenuItem mi = sender as MenuItem;

            if (mi != null)
            {
                ContextMenu cm = mi.Parent as ContextMenu;
                if (cm != null)
                {
                    TreeViewItem node = cm.PlacementTarget as TreeViewItem;
                    if (node != null)
                    {
                        string      fullPath = node.Tag.ToString();
                        string      nodePath = fullPath;
                        ProjectItem prjItem  = ResourceManagerUtil.getContentFolder(currProj);
                        string      contents = "res\\contents\\";
                        nodePath = nodePath.Substring(nodePath.IndexOf(contents) + contents.Length);
                        string[] srcSplit = nodePath.Split('\\');
                        for (int i = 0; i < srcSplit.Length - 1; ++i)
                        {
                            try
                            {
                                prjItem = ResourceManagerUtil.getProjectItem(srcSplit[i], prjItem);
                            }
                            catch (Exception)
                            {
                            }
                        }

                        try
                        {
                            ResourceManagerUtil.removeProjectItem(srcSplit.Last(), prjItem);
                        }
                        catch (Exception)
                        {
                            // If not in project delete from the filesystem.
                            FileAttributes attr = File.GetAttributes(@fullPath);

                            //detect whether its a directory or file
                            if ((attr & FileAttributes.Directory) == FileAttributes.Directory)
                            {
                                Directory.Delete(fullPath);
                            }
                            else
                            {
                                File.Delete(fullPath);
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 4
0
        private void updateResourceView()
        {
            if (currentProj == null)
            {
                return;
            }

            var projFilePath = projPath;

            projFilePath = projFilePath.Substring(0, projFilePath.LastIndexOf("\\") + 1);

            //Check if this is a Tizen project.
            if (!ResourceManagerUtil.isTizenProject(projFilePath))
            {
                return;
            }

            var resFolderPath = projFilePath + "res\\";

            if (!Directory.Exists(resFolderPath))
            {
                return;
            }
            var contentsFolderPath = resFolderPath + "contents";

            if (!Directory.Exists(contentsFolderPath))
            {
                return;
            }

            createDefaultPanel();
            // Add all folders to config and view
            DirectoryInfo di = new DirectoryInfo(contentsFolderPath);

            foreach (DirectoryInfo fi in di.GetDirectories())
            {
                populateConfigurationTab(fi.FullName.Substring(fi.FullName.IndexOf("res\\") + 4));
                populateViewTab(fi.FullName);
            }
            // Add all files to view
            FileInfo[] Files = di.GetFiles();
            foreach (FileInfo file in Files)
            {
                TreeViewItem item = createTreeItem(contentsFolderPath, file.Name, false);
                defaultExpanderTreeHeader.Items.Add(item);
            }
        }
Ejemplo n.º 5
0
        private void addToConfigurationTab(string folderPath)
        {
            folderPath = folderPath.Replace("\\", "/");
            folderPath = folderPath.Replace("res/", "");
            string directoryPath = folderPath;
            string langString    = folderPath.Substring(folderPath.IndexOf("/") + 1);
            string langId        = "";
            string language      = "";
            string resolution    = "";

            string[] split = langString.Split('-');
            if (split.Length != 2)
            {
                return;
            }
            langId = split[0];
            if (langId.Equals("default_All"))
            {
                language = "All";
            }
            else
            {
                if (!langMap.TryGetValue(langId, out language))
                {
                    // the key isn't in the dictionary.
                    return;
                }
            }
            resolution = split[1];

            if (!split[1].Equals("All"))
            {
                resolution = (ResourceManagerUtil.getResolution(split[1]).Length == 0) ? "" : split[1];
            }


            if (isValidConfig(directoryPath, language, resolution))
            {
                this.Dispatcher.Invoke(() =>
                                       ConfigurationDataGrid.Items.Add(CreateResourceItem(directoryPath, language, resolution))
                                       );
            }
        }
Ejemplo n.º 6
0
        private void Delete_Row_Button_Click(object sender, RoutedEventArgs e)
        {
            object           item   = ConfigurationDataGrid.SelectedItem;
            string           path   = (ConfigurationDataGrid.SelectedCells[0].Column.GetCellContent(item) as TextBlock).Text;
            MessageBoxResult result = System.Windows.MessageBox.Show("Are you sure you want to delete the configuration of " + path + "?", "Confirmation", MessageBoxButton.OKCancel, MessageBoxImage.Warning);

            if (result == MessageBoxResult.OK && currentProj != null)
            {
                try
                {
                    ProjectItem contents = ResourceManagerUtil.getContentFolder(currentProj);
                    string      name     = path.Substring(path.LastIndexOf('/') + 1);
                    ResourceManagerUtil.removeProjectItem(name, contents);
                }
                catch (ArgumentException exe)
                {
                    System.Windows.MessageBox.Show("Folder cannot be deleted..." + exe);
                }
            }
        }
Ejemplo n.º 7
0
        private void InitializeDropDown()
        {
            XmlDocument doc     = new XmlDocument();
            var         dirPath = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);

            doc.Load(dirPath + @"\ViewAndUI\ResourceManager\Resource\lang_country_lists.xml");
            XmlNode nodeEle = doc.SelectSingleNode("//languages");


            XDocument document = XDocument.Load(dirPath + @".\ViewAndUI\ResourceManager\Resource\lang_country_lists.xml");

            langMap = document.Descendants("languages").Descendants("lang")
                      .ToDictionary(d => (string)d.Attribute("id"),
                                    d => (string)d.Attribute("name"));

            int           c          = langMap.Count;
            ExpandoObject utilExpObj = ResourceManagerUtil.getExpandoObj();

            foreach (XmlElement nodeE in nodeEle.ChildNodes)
            {
                AddProperty(expando, nodeE.GetAttribute("id"), nodeE.GetAttribute("name"));
                ResourceManagerUtil.AddProperty(utilExpObj, nodeE.GetAttribute("name"), nodeE.GetAttribute("id"));
            }

            XmlElement   node        = doc.CreateElement("lang");
            XmlAttribute idAttribute = doc.CreateAttribute("id");

            idAttribute.Value = "default_All";

            XmlAttribute nameAttribute = doc.CreateAttribute("name");

            nameAttribute.Value = "All";

            node.Attributes.Append(idAttribute);
            node.Attributes.Append(nameAttribute);

            nodeEle.InsertBefore(node, nodeEle.ChildNodes.Item(0));
            configLangCombo.ItemsSource = nodeEle;
            //configLangComboView.ItemsSource = nodeEle;
        }
        public void launch(Package package)
        {
            int     winID;
            Project proj = ResourceManagerUtil.getCurrentProject();

            if (proj == null)
            {
                return;
            }
            string projPath   = proj.FullName;
            string projFolder = projPath.Substring(0, projPath.LastIndexOf("\\") + 1);

            //Check if this is a Tizen project.
            if (!ResourceManagerUtil.isTizenProject(projFolder))
            {
                return;
            }

            if (projectIdMap.ContainsKey(projPath))
            {
                projectIdMap.TryGetValue(projPath, out winID);
            }
            else
            {
                winID = id++;
                projectIdMap[projPath] = winID;
            }
            // Create a new instance of Resource Manager when tool is invoked on project.
            ToolWindowPane window = package.FindToolWindow(typeof(ResourceManager), winID, true);

            if ((null == window))
            {
                return;
                //throw new NotSupportedException("Failed to open Resource Manager. Cannot create tool window");
            }

            IVsWindowFrame windowFrame = (IVsWindowFrame)window.Frame;

            Microsoft.VisualStudio.ErrorHandler.ThrowOnFailure(windowFrame.Show());
        }
Ejemplo n.º 9
0
        private void Add_Button_Click(object sender, RoutedEventArgs e)
        {
            XmlNode element            = configLangCombo.SelectedItem as XmlNode;
            string  langSelected       = element.Attributes.GetNamedItem("name").Value.ToString();
            string  resolutionSelected = resolutionCombo.Text.ToString();
            string  id = element.Attributes.GetNamedItem("id").Value.ToString();

            id = id.Replace('-', '_');
            bool canAdd = validateAddParams(langSelected, resolutionSelected);

            if (!canAdd)
            {
                System.Windows.MessageBox.Show("Language-DPI is already present in the list");
                return;
            }
            string folderName    = id + "-" + resolutionSelected;
            string directoryPath = ("/res/contents/" + folderName);

            if (canAdd && currentProj != null)
            {
                ProjectItem contents = ResourceManagerUtil.getContentFolder(currentProj);
                ResourceManagerUtil.addProjectFolder(folderName, contents);
            }
        }
Ejemplo n.º 10
0
        public static void updateResourceXML(Project project)
        {
            string      projFullName  = project.FullName;
            string      projPath      = projFullName.Substring(0, projFullName.LastIndexOf("\\") + 1);
            string      resFolderPath = projPath + "res\\";
            XmlDocument doc           = new XmlDocument();
            XmlNode     docNode       = doc.CreateXmlDeclaration("1.0", "UTF-8", "yes");

            doc.AppendChild(docNode);

            XmlNode rootNode = doc.CreateElement(STR_res, "http://tizen.org/ns/rm");

            doc.AppendChild(rootNode);

            XmlElement groupImageNode = doc.CreateElement("group-image", "http://tizen.org/ns/rm");

            groupImageNode.SetAttribute(STR_folder, STR_contents);
            rootNode.AppendChild(groupImageNode);

            XmlElement groupLayoutNode = doc.CreateElement("group-layout", "http://tizen.org/ns/rm");

            groupLayoutNode.SetAttribute(STR_folder, STR_contents);
            rootNode.AppendChild(groupLayoutNode);

            XmlElement groupSoundNode = doc.CreateElement("group-sound", "http://tizen.org/ns/rm");

            groupSoundNode.SetAttribute(STR_folder, STR_contents);
            rootNode.AppendChild(groupSoundNode);

            XmlElement groupBinNode = doc.CreateElement("group-bin", "http://tizen.org/ns/rm");

            groupBinNode.SetAttribute(STR_folder, STR_contents);
            rootNode.AppendChild(groupBinNode);

            DirectoryInfo di = new DirectoryInfo(@resFolderPath + STR_contents);

            if (!di.Exists)
            {
                return;
            }
            foreach (XmlNode groupNode in doc.DocumentElement.ChildNodes)
            {
                foreach (var fi in di.GetDirectories())
                {
                    String languageID      = null;
                    String resolutionRange = null;
                    String folderPath      = null;

                    String fileName = fi.Name;
                    folderPath = "contents/" + fileName;
                    if (fileName.Contains("-"))
                    {
                        String[] names = fileName.Split('-');
                        names[0] = names[0];
                        if (ResourceManagerUtil.isValidLanguageID(names[0]))
                        {
                            languageID = names[0].Equals("default_All") ? "All" : names[0];
                        }
                        if (ResourceManagerUtil.isValidResolution(names[1]))
                        {
                            resolutionRange = ResourceManagerUtil.getResolution(names[1]);
                        }
                    }
                    if (languageID == null || resolutionRange == null)
                    {
                        continue;
                    }
                    else
                    {
                        XmlElement   node   = doc.CreateElement("node", "http://tizen.org/ns/rm");
                        XmlAttribute folder = doc.CreateAttribute(STR_folder);
                        folder.Value = folderPath;
                        node.Attributes.Append(folder);
                        if (resolutionRange.Length != 0)
                        {
                            XmlAttribute screen_dpi_range = doc.CreateAttribute("screen-dpi-range");
                            screen_dpi_range.Value = resolutionRange;
                            node.Attributes.Append(screen_dpi_range);
                        }
                        // Language attribute is not emitted when ALL language is selected
                        if (!languageID.Equals("All"))
                        {
                            XmlAttribute language = doc.CreateAttribute("language");
                            language.Value = languageID;
                            node.Attributes.Append(language);
                        }

                        groupNode.AppendChild(node);
                    }
                }
            }

            doc.Save(@resFolderPath + "res.xml");
        }
        /// <summary>
        /// Sub menu click Handler for CopyTo/MoveTo
        /// </summary>
        private void subMenu_Click(object sender, RoutedEventArgs e)
        {
            MenuItem mi = sender as MenuItem;

            if (mi != null)
            {
                string[]      destNameArray = mi.Header.ToString().Split(',');
                ExpandoObject expObj        = ResourceManagerUtil.getExpandoObj();
                //destNameArray[0].Equals("default_All") ? destNameArray[0] : GetProperty(expando, (ResourceManagerUtil.GetProperty(expObj, destNameArray[0]) as string));
                string      expStoredName      = (destNameArray[0].Equals("default_All") ? destNameArray[0] : (ResourceManagerUtil.GetProperty(expObj, destNameArray[0]) as string));
                string[]    expStoredNameArray = expStoredName.Split('_');
                string      destName           = (expStoredNameArray[0] + "_" + (expStoredNameArray[1].Equals("All") ? expStoredNameArray[1] : expStoredNameArray[1].ToUpper()) + "-" + destNameArray[1].Trim());
                MenuItem    cm  = mi.Parent as MenuItem;
                string      opt = cm.Header.ToString();//Either copy to or move to selected
                ProjectItem contentsDirItems = ResourceManagerUtil.getContentFolder(currProj);
                string[]    srcHierarchy     = parentSelected.Split('/');
                Boolean     isAllConf        = false;//since All Configuration points to directory res/contents folder, we have to change the path.
                ProjectItem destProjItem     = ResourceManagerUtil.getProjectItem(destName, contentsDirItems);
                string      projPath         = Path.GetDirectoryName(currProj.FullName);
                srcHierarchy = srcHierarchy.Take(srcHierarchy.Count() - 1).ToArray();
                if (srcHierarchy.Count() == 0)
                {
                    return;
                }
                if (srcHierarchy[0].Equals("ALL"))
                {
                    isAllConf    = true;
                    srcHierarchy = srcHierarchy.Skip(1).ToArray();
                }
                string srcPath = projPath.ToString() + "\\res\\contents\\" + String.Join("\\", srcHierarchy);

                string   extResult    = Path.GetExtension(String.Join("/", srcHierarchy));
                string[] srcPathArray = Path.GetDirectoryName(srcPath).Split(new string[] { srcHierarchy[0] }, StringSplitOptions.None);

                ProjectItem srcParentPrjItem = contentsDirItems;

                string srcLastItem = srcHierarchy.Last();
                foreach (string folderName in srcHierarchy)
                {
                    if (!object.ReferenceEquals(folderName, srcLastItem))
                    {
                        try
                        {
                            srcParentPrjItem = ResourceManagerUtil.getProjectItem(folderName, srcParentPrjItem);
                        }
                        catch (Exception)
                        {
                        }
                    }
                }

                //If path is Folder
                if (extResult.Equals(""))
                {
                    if (isAllConf)
                    {
                        List <string> srcHierList = new List <string>(srcHierarchy);
                        srcHierList.Insert(0, "ALL");
                        srcHierarchy = srcHierList.ToArray();
                    }

                    for (int i = 1; i < srcHierarchy.Length - 1; i++)
                    {
                        if (i < 0)
                        {
                            break;
                        }
                        if (!srcHierarchy[i].Equals(""))
                        {
                            destProjItem = ResourceManagerUtil.addProjectFolder(srcHierarchy[i], destProjItem);
                        }
                    }
                    ResourceManagerUtil.copyDir(srcPath, destProjItem);
                }
                //If path is file
                else
                {
                    if (isAllConf)
                    {
                        srcPathArray = Path.GetDirectoryName(srcPath).Split(new string[] { "\\res\\contents\\" }, StringSplitOptions.None);
                    }
                    if (srcPathArray.Count() > 1)
                    {
                        foreach (string folderName in srcPathArray[1].Split('\\'))
                        {
                            if (!folderName.Equals(""))
                            {
                                destProjItem = ResourceManagerUtil.addProjectFolder(folderName, destProjItem);
                            }
                        }
                    }
                    ResourceManagerUtil.copyFile(srcPath, destProjItem);
                }

                if (opt.Equals("Move To"))
                {
                    try
                    {
                        ResourceManagerUtil.removeProjectItem(srcLastItem, srcParentPrjItem);
                    }
                    catch (Exception)
                    {
                        FileAttributes attr = File.GetAttributes(@srcPath);

                        //detect whether its a directory or file
                        if ((attr & FileAttributes.Directory) == FileAttributes.Directory)
                        {
                            Directory.Delete(srcPath);
                        }
                        else
                        {
                            File.Delete(srcPath);
                        }
                    }
                }
            }
        }
Ejemplo n.º 12
0
        private void removeFromViewTab(string name, string fullPath, Boolean isFile)
        {
            object         viewChildElements = ((StackPanel)(StackPanelGrid.Children[0])).Children;
            ItemCollection treeViewItems     = null;

            string[] removedHierarchy = name.Split('\\');
            string   seleExt          = Path.GetExtension(fullPath);

            if (removedHierarchy.Count() == 3)
            {
                var      convViewElem = (dynamic)viewChildElements;
                string[] hieItem      = removedHierarchy[2].Split('-');
                if (hieItem.Length != 2)
                {
                    return;
                }
                string[] splittedLang = hieItem[0].Split('_');
                string   hieLang      = "";
                if (!(splittedLang.Count() < 2))
                {
                    hieLang = (hieItem[0].Equals("default_All") ? hieItem[0] : GetProperty(expando, (splittedLang[0] + "_" + splittedLang[1])));
                }

                if (!(hieLang != null && ResourceManagerUtil.isValidLanguageID(hieItem[0]) && isValidDpi(hieItem[1]) && defaultExpanderTreeHeader != null))
                {
                    return;
                }
                foreach (StackPanel sp in convViewElem)
                {
                    var      exp     = sp.Children[0];
                    string[] expItem = ((string)((Expander)exp).Header).Split(',');

                    if (hieLang.Equals(expItem[0]) && hieItem[1].Equals(expItem[1].Trim()))
                    {
                        viewContextMenu.removeSubMenuItem(((Expander)exp).Header.ToString());
                        ((StackPanel)(StackPanelGrid.Children[0])).Children.Remove(sp);
                        break;
                    }
                }
                return;
            }
            else if (removedHierarchy.Count() < 2)
            {
                ((StackPanel)(StackPanelGrid.Children[0])).Children.Clear();
                return;
            }

            for (int idx = 2; idx < removedHierarchy.Count() - 1; idx++)
            {
                var convViewElem = (dynamic)viewChildElements;
                foreach (var ele in convViewElem)
                {
                    if (ele is StackPanel)
                    {
                        StackPanel sp           = ele as StackPanel;
                        var        exp          = sp.Children[0];
                        string[]   hieItem      = removedHierarchy[idx].Split('-');
                        string[]   splittedLang = hieItem[0].Split('_');
                        string     hieLang      = "";
                        if (!(splittedLang.Count() < 2))
                        {
                            hieLang = (hieItem[0].Equals("default_All") ? hieItem[0] : GetProperty(expando, (splittedLang[0] + "_" + splittedLang[1])));
                        }

                        if (!(hieLang != null && ResourceManagerUtil.isValidLanguageID(hieItem[0]) && isValidDpi(hieItem[1]) && defaultExpanderTreeHeader != null))
                        {
                            return;
                        }
                        string[] expItem = ((string)((Expander)exp).Header).Split(',');
                        if (hieLang.Equals(expItem[0]) && hieItem[1].Equals(expItem[1].Trim()))
                        {
                            treeViewItems = (((Expander)exp).Content as TreeView).Items;
                            break;
                        }
                    }
                    else if (ele is TreeViewItem)
                    {
                        TreeViewItem tvi = ele as TreeViewItem;
                        if (tvi.Header.ToString().Equals(removedHierarchy[idx]))
                        {
                            treeViewItems = tvi.Items;
                            break;
                        }
                    }
                }
            }
            if (treeViewItems == null)
            {
                return;
            }

            if (isFile)
            {
                foreach (TreeViewItem tvcItem in treeViewItems)
                {
                    string sp = tvcItem.Header.ToString();
                    if (seleExt.Equals(Path.GetExtension(tvcItem.Tag.ToString())) && (sp.Equals(removedHierarchy[removedHierarchy.Count() - 1])))
                    {
                        treeViewItems.Remove(tvcItem);
                        break;
                    }
                }
            }
            else
            {
                foreach (TreeViewItem tvcItem in treeViewItems)
                {
                    if (tvcItem.Header.ToString().Equals(removedHierarchy[removedHierarchy.Count() - 1]))
                    {
                        treeViewItems.Remove(tvcItem);
                        break;
                    }
                }
            }
        }
Ejemplo n.º 13
0
        private void addToViewTab(string name, string fullPath, Boolean isFile)
        {
            object viewChildElements = ((StackPanel)(StackPanelGrid.Children[0])).Children;

            string[] createdHierarchy   = name.Split('\\');
            int      contentNotFoundIdx = -1;
            Boolean  isDefaultConf      = false;

            if (createdHierarchy.Count() == 2 && createdHierarchy[1].Equals("contents"))
            {
                createDefaultPanel();
                return;
            }
            for (int idx = 2; idx < createdHierarchy.Count(); idx++)
            {
                Boolean isContentFound = false;
                var     convViewElem   = (dynamic)viewChildElements;
                try
                {
                    convViewElem = convViewElem.Items;
                }
                catch (Exception)
                {
                    convViewElem = (dynamic)viewChildElements;
                }
                foreach (var ele in convViewElem)
                {
                    if (ele is StackPanel)
                    {
                        StackPanel sp      = ele as StackPanel;
                        var        exp     = sp.Children[0];
                        string[]   hieItem = createdHierarchy[idx].Split('-');
                        if (hieItem.Length != 2)
                        {
                            return;
                        }
                        string[] splittedLang = hieItem[0].Split('_');
                        if (splittedLang.Count() < 2)
                        {
                            viewChildElements = defaultExpanderTreeHeader;
                            isContentFound    = false;
                            isDefaultConf     = true;
                            break;
                        }

                        string hieLang = hieItem[0].Equals("default_All") ? hieItem[0] : GetProperty(expando, (splittedLang[0] + "_" + splittedLang[1]));
                        if (!(hieLang != null && ResourceManagerUtil.isValidLanguageID(hieItem[0]) && isValidDpi(hieItem[1]) && defaultExpanderTreeHeader != null))
                        {
                            viewChildElements = defaultExpanderTreeHeader;
                            isContentFound    = false;
                            isDefaultConf     = true;
                            break;
                        }
                        string[] expItem = ((string)((Expander)exp).Header).Split(',');
                        if (hieLang.Equals(expItem[0]) && hieItem[1].Equals(expItem[1].Trim()))
                        {
                            viewChildElements = (((Expander)exp).Content as TreeView);
                            isContentFound    = true;
                            isDefaultConf     = false;
                            break;
                        }
                    }
                    else if (ele is TreeViewItem)
                    {
                        TreeViewItem tvi = ele as TreeViewItem;
                        if (tvi.Header is StackPanel)
                        {
                            StackPanel sp = tvi.Header as StackPanel;
                            if ((sp.Children[0] as TextBlock).Text.ToString().Equals(createdHierarchy[idx]))
                            {
                                isContentFound = true;
                                isDefaultConf  = false;
                                break;
                            }
                        }
                        if (tvi.Header.ToString().Equals(createdHierarchy[idx]))
                        {
                            viewChildElements = tvi;
                            isContentFound    = true;
                            isDefaultConf     = false;
                            break;
                        }
                    }
                }
                if (!isContentFound)
                {
                    contentNotFoundIdx = idx;
                    break;
                }
            }

            if (contentNotFoundIdx == 2 && !isDefaultConf)
            {
                createdHierarchy = createdHierarchy.Take(3).ToArray();
                var projFilePath = projPath.Substring(0, projPath.LastIndexOf("\\") + 1) + (string.Join("\\", createdHierarchy));
                populateViewTab(projFilePath);
            }
            else if (contentNotFoundIdx != -1)
            {
                var      foundTVI     = (dynamic)viewChildElements;
                string[] projPathArr  = createdHierarchy.Take(contentNotFoundIdx).ToArray();
                var      projFilePath = projPath.Substring(0, projPath.LastIndexOf("\\") + 1) + (string.Join("\\", projPathArr));
                if (isFile && (contentNotFoundIdx == createdHierarchy.Count() - 1))
                {
                    projFilePath = Path.GetDirectoryName(fullPath);
                    TreeViewItem item = createTreeItem(projFilePath, createdHierarchy[createdHierarchy.Count() - 1], true);
                    foundTVI.Items.Remove(item);
                    foundTVI.Items.Add(item);
                }
                else
                {
                    if (foundTVI is TreeView)
                    {
                        TreeView tv = foundTVI as TreeView;
                        tv.Items.Clear();
                        createResourceViewTreeHeader(projFilePath, tv);
                    }
                    else
                    {
                        TreeViewItem tvi = foundTVI;
                        tvi.Items.Clear();
                        createResourceViewTree(projFilePath, tvi);
                    }
                }
            }
        }