public ElementData(EA.Element element)
        {
            _ElementID = element.ElementID;
            Name       = element.Name;
            EAType     = element.Type;

            if (element.ClassifierID != 0)
            {
                ClassifierID = element.ClassifierID;
                EA.Element classifier = Context.EARepository.GetElementByID((int)ClassifierID);
                ClassifierName   = classifier.Name;
                ClassifierEAType = classifier.Type;
            }

            IsLibrary = LibraryHelper.IsLibrary(element);
            if (IsLibrary)
            {
                ComponentLevel = CLHelper.GetComponentLevel(element);
                string ngTag = EATVHelper.GetTaggedValue(element, DAConst.DP_NodeGroupsTag);
                if (ngTag != null)
                {
                    NodeGroups = ngTag.Split(',');
                }
            }
        }
Beispiel #2
0
        /// <summary>
        /// Вспомогательная функция определяет, предназанчен ли библиотечный элемнет для размещения на диаграмме
        /// Правила: Контуры = разрешён Classifier, остальные компоненты - только Instance
        /// </summary>
        /// <param name=""></param>
        /// <returns></returns>
        public static bool AppropriateForDiagram(EA.Element element)
        {
            bool result = false;

            ComponentLevel componentLevel = CLHelper.GetComponentLevel(element);

            switch (componentLevel)
            {
            case ComponentLevel.SystemContour:
            case ComponentLevel.ContourContour:

                result = true;
                break;

            case ComponentLevel.SystemComponent:
            case ComponentLevel.ContourComponent:
            case ComponentLevel.Node:
            case ComponentLevel.Device:
            case ComponentLevel.ExecutionEnv:
            case ComponentLevel.Component:

                result = element.ClassfierID != 0;
                break;
            }

            return(result);
        }
Beispiel #3
0
        /// <summary>
        /// Размещает на диаграмме укзаанный элемент и иерархию его контейнеров
        /// </summary>
        /// <param name="onlyParent"></param>
        /// <returns></returns>
        public ExecResult <Boolean> PutParentHierarchyOnDiagram(bool onlyParent = false)
        {
            ExecResult <Boolean> result = new ExecResult <bool>();

            ElementDesignerHelper.CallLevel = 0;

            try
            {
                ExecResult <List <ComponentLevel> > displayLevelsResult = FSelectComponentLevels.Execute();
                if (displayLevelsResult.code != 0)
                {
                    return(result);
                }


                // Получаем текущий (библиотечный) элемент дерева
                EA.Element curElement = EARepository.GetTreeSelectedObject();
                Logger.Out("элемент:", new EA.Element[] { curElement });
                if (curElement == null || !LibraryHelper.IsLibrary(curElement))
                {
                    throw new Exception("Не выделен библиотечный элемент");
                }

                // Получаем цепочку родительских контейнеров
                List <EA.Element> deployments = LibraryHelper.GetParentHierarchy(curElement);
                Logger.Out("цепочка deploy-родителей:", deployments.ToArray());

                // Размещаем на диаграмме элемент
                PutElementOnDiagram(curElement);

                // Проходимся по иерархии и размещаем элементы на диаграмме
                EA.Element prevElement = null;
                for (int i = 0; i < deployments.Count; i++)
                {
                    // размещает только элементы выбранных уровней
                    ComponentLevel componentLevel = CLHelper.GetComponentLevel(deployments[i]);
                    if (!displayLevelsResult.value.Contains(componentLevel))
                    {
                        continue;
                    }


                    EA.DiagramObject diagramObject = PutElementOnDiagram(deployments[i]);
                    //diagramObject.Sequence = 1000 - (deployments.Count + i); // Это надо нормально сделать
                    diagramObject.Update();
                    prevElement = deployments[i];
                }

                CurrentDiagram.DiagramLinks.Refresh();
                Context.LinkDesigner.SetLinkTypeVisibility(LinkType.Deploy, false);
                EARepository.ReloadDiagram(CurrentDiagram.DiagramID);
            }
            catch (Exception ex)
            {
                result.setException(ex);
            }

            return(result);
        }
Beispiel #4
0
        /// <summary>
        /// Размещает на диаграмме укзаанный элемент и иерархию его контейнеров
        /// </summary>
        /// <param name="onlyParent"></param>
        /// <returns></returns>
        public ExecResult <Boolean> PutChildrenDHierarchyOnDiagram()
        {
            ExecResult <Boolean> result = new ExecResult <bool>();

            ElementDesignerHelper.CallLevel = 0;

            try
            {
                ExecResult <List <ComponentLevel> > displayLevelsResult = FSelectComponentLevels.Execute();
                if (displayLevelsResult.code != 0)
                {
                    return(result);
                }


                // Получаем текущий (библиотечный) элемент дерева
                EA.Element curElement = null;
                if (EARepository.GetTreeSelectedElements().Count > 0)
                {
                    curElement = EARepository.GetTreeSelectedElements().GetAt(0);
                }
                Logger.Out("элемент:", new EA.Element[] { curElement });
                if (curElement == null || !LibraryHelper.IsLibrary(curElement))
                {
                    throw new Exception("Не выделен библиотечный элемент");
                }

                // Получаем список дочерних элементов контейнеров
                List <EA.Element> сhildrenDHierarchy = LibraryHelper.GetChildHierarchy(curElement);


                // Размещаем на диаграмме элемент
                PutElementOnDiagram(curElement);

                // Проходимся по иерархии и размещаем элементы на диаграмме
                for (int i = 0; i < сhildrenDHierarchy.Count; i++)
                {
                    // размещает только элементы выбранных уровней
                    ComponentLevel componentLevel = CLHelper.GetComponentLevel(сhildrenDHierarchy[i]);
                    if (!displayLevelsResult.value.Contains(componentLevel))
                    {
                        continue;
                    }
                    // Размещаем элемент
                    EA.DiagramObject diagramObject = PutElementOnDiagram(сhildrenDHierarchy[i]);
                    diagramObject.Update();
                }

                CurrentDiagram.DiagramLinks.Refresh();
                Context.LinkDesigner.SetLinkTypeVisibility(LinkType.Deploy, false);
                EARepository.ReloadDiagram(CurrentDiagram.DiagramID);
            }
            catch (Exception ex)
            {
                result.setException(ex);
            }

            return(result);
        }
Beispiel #5
0
        /// <summary>
        /// Reloads the database.
        /// </summary>
        /// <param name="progress">The progress object.</param>
        public void Reload(IProgress progress)
        {
            DbDebugHelper.OnUpdate("Reloading database...");
            OnPreviewReloaded();

            try {
                IOHelper.SetupFileManager();
                Commands.ClearCommands();
                DbPathLocator.ClearStoredFiles();
                ResetAllSettings();

                var dbs = _dbs.Values.ToList();

                for (int i = 0; i < dbs.Count; i++)
                {
                    dbs[i].Clear();
                    DbDebugHelper.OnCleared(dbs[i].DbSource, null, dbs[i]);
                }

                DbDebugHelper.OnUpdate("All database tables have been cleared.");

                for (int i = 0; i < dbs.Count; i++)
                {
                    var db = dbs[i];

                    if (db.CanBeLoaded)
                    {
                        CLHelper.CStart(i);

                        db.LoadDb();

                        if (progress != null)
                        {
                            progress.Progress = (i + 1f) / dbs.Count * 100f;
                            //ErrorHandler.HandleException("Now at " + progress.Progress + "% done.");
                        }

                        CLHelper.CStopAndDisplay(db.DbSource.DisplayName, i);
                    }

                    if (progress != null)
                    {
                        AProgress.IsCancelling(progress);
                    }
                }

                ClearCommands();
            }
            finally {
                DbDebugHelper.OnUpdate("Database reloaded...");
            }

            OnReloaded();
            SdeEditor.Instance.Dispatch(p => p.OnSelectionChanged());
        }
Beispiel #6
0
        public static void DbItemsLoader <TKey>(DbDebugItem <TKey> debug, AbstractDb <TKey> db)
        {
            if (debug.FileType == FileType.Txt)
            {
                DbLoaderAny(debug, db, TextFileHelper.GetElementsByCommas);
            }
            else if (debug.FileType == FileType.Conf)
            {
                DbCommaLoader(debug, ServerItemAttributes.AttributeList, DbItemsFunction, TextFileHelper.GetElementsByBrackets);
#if SDE_DEBUG
                CLHelper.WA = ", internal parser : " + CLHelper.CD(-3);
#endif
            }
        }
Beispiel #7
0
        public static void DbItemsFunction <TKey>(DbDebugItem <TKey> debug, AttributeList list, string[] elements, Table <TKey, ReadableTuple <TKey> > table)
        {
#if SDE_DEBUG
            CLHelper.CR(-3);
#endif
            ItemParser itemHelper = new ItemParser(elements[0]);
#if SDE_DEBUG
            CLHelper.CS(-3);
#endif
            TKey itemId = (TKey)(object)Int32.Parse(itemHelper.Id);

            // This is not allowed because it doesn't follow the Table rules consistency
            // The table is the one generating the events, calling table.Add() will not update
            // the list views properly.
            //ReadableTuple<TKey> tuple = new ReadableTuple<TKey>(itemId, ServerItemAttributes.AttributeList);
            //table.Add(itemId, tuple);

            table.SetRaw(itemId, ServerItemAttributes.AegisName, itemHelper.AegisName);
            table.SetRaw(itemId, ServerItemAttributes.Name, itemHelper.Name);
            table.SetRaw(itemId, ServerItemAttributes.Type, itemHelper.Type);
            table.SetRaw(itemId, ServerItemAttributes.Buy, itemHelper.Buy);
            table.SetRaw(itemId, ServerItemAttributes.Sell, itemHelper.Sell);
            table.SetRaw(itemId, ServerItemAttributes.Weight, itemHelper.Weight);
            table.SetRaw(itemId, ServerItemAttributes.Attack, itemHelper.Atk);
            table.SetRaw(itemId, ServerItemAttributes.Defense, itemHelper.Def);
            table.SetRaw(itemId, ServerItemAttributes.Range, itemHelper.Range);
            table.SetRaw(itemId, ServerItemAttributes.NumberOfSlots, itemHelper.Slots);
            table.SetRaw(itemId, ServerItemAttributes.ApplicableJob, itemHelper.Job);
            table.SetRaw(itemId, ServerItemAttributes.Upper, itemHelper.Upper);
            table.SetRaw(itemId, ServerItemAttributes.Gender, itemHelper.Gender);
            table.SetRaw(itemId, ServerItemAttributes.Location, itemHelper.Loc);
            table.SetRaw(itemId, ServerItemAttributes.WeaponLevel, itemHelper.WeaponLv);
            table.SetRaw(itemId, ServerItemAttributes.EquipLevel, itemHelper.EquipLv);
            table.SetRaw(itemId, ServerItemAttributes.Refineable, itemHelper.Refineable);
            table.SetRaw(itemId, ServerItemAttributes.ClassNumber, itemHelper.View);
            table.SetRaw(itemId, ServerItemAttributes.Script, itemHelper.Script);
            table.SetRaw(itemId, ServerItemAttributes.OnEquipScript, itemHelper.OnEquipScript);
            table.SetRaw(itemId, ServerItemAttributes.OnUnequipScript, itemHelper.OnUnequipScript);

            table.SetRaw(itemId, ServerItemAttributes.Matk, itemHelper.Matk);
            table.SetRaw(itemId, ServerItemAttributes.BindOnEquip, itemHelper.BindOnEquip);
            table.SetRaw(itemId, ServerItemAttributes.BuyingStore, itemHelper.BuyingStore);
            table.SetRaw(itemId, ServerItemAttributes.Delay, itemHelper.Delay);
            table.SetRaw(itemId, ServerItemAttributes.Stack, itemHelper.Stack);
            table.SetRaw(itemId, ServerItemAttributes.Sprite, itemHelper.Sprite);
            table.SetRaw(itemId, ServerItemAttributes.Trade, itemHelper.Trade);
            table.SetRaw(itemId, ServerItemAttributes.NoUse, itemHelper.Nouse);
        }
Beispiel #8
0
        /// <summary>
        /// Функция возвращает список данных элементов библиотеки, соответствующих переданному уровню
        /// Даные возвращаются в формате NodeData
        /// </summary>
        /// <param name="clList"></param>
        public static List <NodeData> GetNodeData(List <ComponentLevel> clList, bool onlyAppropriateForDiagram = true)
        {
            List <NodeData> result = new List <NodeData>();


            EA.Package LibRoot = Context.CurrentLibrary;

            List <EA.Package> curLevelPackages = new List <EA.Package>();

            curLevelPackages.Add(LibRoot);


            // Последовательно проходимся по уровням дерева пакетов
            while (curLevelPackages.Count > 0)
            {
                List <EA.Package> nextLevelPackages = new List <EA.Package>(); // список пакетов для перехода на следующий уровень

                foreach (EA.Package curPackage in curLevelPackages)
                {
                    // Выбираем из списка пакетов текущего уровня требуемые элементы
                    foreach (EA.Element curElement in curPackage.Elements)
                    {
                        if (IsLibrary(curElement) && clList.Contains(CLHelper.GetComponentLevel(curElement)) && (onlyAppropriateForDiagram ? AppropriateForDiagram(curElement) : true))
                        {
                            NodeData nodeData = new NodeData();
                            nodeData.Element        = curElement;
                            nodeData.ComponentLevel = CLHelper.GetComponentLevel(curElement);
                            nodeData.Contour        = GetElementContour(curElement);
                            nodeData.GroupNames     = EATVHelper.GetTaggedValue(curElement, DAConst.DP_NodeGroupsTag).Split(',');
                            result.Add(nodeData);
                        }
                    }

                    // строим список пакетов для перехода на следующий уровень
                    foreach (EA.Package nextPackage in curPackage.Packages)
                    {
                        nextLevelPackages.Add(nextPackage);
                    }
                }

                curLevelPackages = nextLevelPackages;
            }

            return(result);
        }
Beispiel #9
0
        public static void DbCommaLoader <T>(DbDebugItem <T> debug, AttributeList list, DbCommaFunctionDelegate <T> function, TextFileHelper.TextFileHelperGetterDelegate getter, bool addAutomatically = true)
        {
            var table = debug.AbsractDb.Table;

#if SDE_DEBUG
            Z.StopAndRemoveWithoutDisplay(-1);
            Z.StopAndRemoveWithoutDisplay(-2);
            CLHelper.CR(-2);
#endif
            foreach (string[] elements in getter(File.ReadAllBytes(debug.FilePath)))
            {
#if SDE_DEBUG
                CLHelper.CS(-2);
                CLHelper.CR(-1);
#endif
                try {
                    if (!addAutomatically)
                    {
                        T id = (T)TypeDescriptor.GetConverter(typeof(T)).ConvertFrom(elements[0]);

                        if (!table.ContainsKey(id))
                        {
                            Z.F();
                            continue;
                        }
                    }

                    function(debug, list, elements, table);
                }
                catch (Exception err) {
                    if (!debug.ReportException(err))
                    {
                        return;
                    }
                }
#if SDE_DEBUG
                CLHelper.CS(-1);
                CLHelper.CR(-2);
#endif
            }
#if SDE_DEBUG
            CLHelper.CS(-2);
            CLHelper.WA = ", method core : " + CLHelper.CD(-1) + "ms, loop getter : " + CLHelper.CD(-2) + "ms";
#endif
        }
Beispiel #10
0
        public void Initialize(GTabSettings <TKey, TValue> settings)
        {
            Settings = settings;
            _unclickableBorder.Init(_cbSubMenu);
            Database     = settings.ClientDatabase;
            DbComponent  = GenericDatabase.GetDb <TKey>(settings.DbData);
            Table        = Settings.Table;
            Header       = Settings.TabName;
            Style        = TryFindResource(settings.Style) as Style ?? Style;
            SearchEngine = settings.SearchEngine;
            SearchEngine.Init(_gridSearchContent, _searchTextBox, this);

            if (Settings.SearchEngine.SetupImageDataGetter != null)
            {
                Extensions.GenerateListViewTemplate(_listView, new ListViewDataTemplateHelper.GeneralColumnInfo[] {
                    new ListViewDataTemplateHelper.GeneralColumnInfo {
                        Header = Settings.AttId.DisplayName, DisplayExpression = "[" + Settings.AttId.Index + "]", SearchGetAccessor = Settings.AttId.AttributeName, FixedWidth = Settings.AttIdWidth, TextAlignment = TextAlignment.Right, ToolTipBinding = "[" + Settings.AttId.Index + "]"
                    },
                    new ListViewDataTemplateHelper.ImageColumnInfo {
                        Header = "", DisplayExpression = "DataImage", SearchGetAccessor = Settings.AttId.AttributeName, FixedWidth = 26, MaxHeight = 24
                    },
                    new ListViewDataTemplateHelper.RangeColumnInfo {
                        Header = Settings.AttDisplay.DisplayName, DisplayExpression = "[" + Settings.AttDisplay.Index + "]", SearchGetAccessor = Settings.AttDisplay.AttributeName, IsFill = true, ToolTipBinding = "[" + Settings.AttDisplay.Index + "]", MinWidth = 100, TextWrapping = TextWrapping.Wrap
                    }
                }, new DatabaseItemSorter(Settings.AttributeList), new string[] { "Deleted", "Red", "Modified", "Green", "Added", "Blue", "Normal", "Black" }, "generateStyle", "false");
            }
            else
            {
                Extensions.GenerateListViewTemplate(_listView, new ListViewDataTemplateHelper.GeneralColumnInfo[] {
                    new ListViewDataTemplateHelper.GeneralColumnInfo {
                        Header = Settings.AttId.DisplayName, DisplayExpression = "[" + Settings.AttId.Index + "]", SearchGetAccessor = Settings.AttId.AttributeName, FixedWidth = Settings.AttIdWidth, TextAlignment = TextAlignment.Right, ToolTipBinding = "[" + Settings.AttId.Index + "]"
                    },
                    new ListViewDataTemplateHelper.RangeColumnInfo {
                        Header = Settings.AttDisplay.DisplayName, DisplayExpression = "[" + Settings.AttDisplay.Index + "]", SearchGetAccessor = Settings.AttDisplay.AttributeName, IsFill = true, ToolTipBinding = "[" + Settings.AttDisplay.Index + "]", MinWidth = 100, TextWrapping = TextWrapping.Wrap
                    }
                }, new DatabaseItemSorter(Settings.AttributeList), new string[] { "Deleted", "Red", "Modified", "Green", "Added", "Blue", "Normal", "Black" }, "generateStyle", "false");
            }

#if SDE_DEBUG
            CLHelper.WA = CLHelper.CP(-10);
#endif
            if (!Settings.CanBeDelayed || Settings.AttributeList.Attributes.Any(p => p.IsSkippable))
            {
                _deployTabControls();
            }
#if SDE_DEBUG
            CLHelper.WA = ", deploy time : " + CLHelper.CS(-10) + CLHelper.CD(-10) + "ms";
#endif
            _initTableEvents();

            if (Settings.ContextMenu != null)
            {
                if (Header is Control)
                {
                    ((Control)Header).ContextMenu = Settings.ContextMenu;
                }
            }

            if (Settings.Loaded != null)
            {
                Settings.Loaded((GDbTabWrapper <TKey, ReadableTuple <TKey> >)(object) this, (GTabSettings <TKey, ReadableTuple <TKey> >)(object) Settings, ((GenericDatabase)Database).GetDb <TKey>(Settings.DbData));
            }

            if (Settings.DisplayablePropertyMaker.OnTabVisible != null)
            {
                Settings.DisplayablePropertyMaker.OnTabVisible(this);
            }

            Loaded += delegate {
                TabControl parent = WpfUtilities.FindParentControl <TabControl>(this);

                if (parent != null)
                {
                    parent.SelectionChanged += new SelectionChangedEventHandler(_parent_SelectionChanged);
                }
            };

            _listView.PreviewMouseDown += delegate {
                _listView.Focus();
            };

            ApplicationShortcut.Link(ApplicationShortcut.Paste, () => ImportFromFile("clipboard"), _listView);
            ApplicationShortcut.Link(ApplicationShortcut.Cut, () => _miCut_Click(null, null), _listView);
        }
Beispiel #11
0
        /// <summary>
        /// Возвращает, если есть, название (ближайшего) контура, в который включен компонент
        /// </summary>
        /// <param name="curElement"></param>
        /// <returns></returns>
        public static EA.Element GetElementContour(EA.Element curElement)
        {
            EA.Element result = null;

            List <EA.Element> parentDeployHierrchy = GetParentHierarchy(curElement);

            foreach (EA.Element curParent in parentDeployHierrchy)
            {
                if (LibraryHelper.IsLibrary(curParent) && new ComponentLevel[] { ComponentLevel.ContourComponent, ComponentLevel.ContourContour }.Contains(CLHelper.GetComponentLevel(curParent)))
                {
                    result = curParent;
                    break;
                }
            }

            return(result);
        }
Beispiel #12
0
        public static void DbLoaderAny <TKey>(DbDebugItem <TKey> debug, AbstractDb <TKey> db, TextFileHelper.TextFileHelperGetterDelegate getter, bool uniqueKey = true)
        {
            List <DbAttribute> attributes = new List <DbAttribute>(db.AttributeList.Attributes);
            int indexOffset      = uniqueKey ? 1 : 0;
            int attributesOffset = uniqueKey ? 0 : 1;

            if (!uniqueKey)
            {
                TextFileHelper.SaveLastLine = true;
            }

#if SDE_DEBUG
            Z.StopAndRemoveWithoutDisplay(-1);
            Z.StopAndRemoveWithoutDisplay(-2);
            CLHelper.CR(-2);
#endif
            foreach (string[] elements in getter(File.ReadAllBytes(debug.FilePath)))
            {
#if SDE_DEBUG
                CLHelper.CS(-2);
                CLHelper.CR(-1);
#endif
                try {
                    _guessAttributes(elements, attributes, -1, db);

                    TKey id;

                    if (uniqueKey)
                    {
                        id = (TKey)TypeDescriptor.GetConverter(typeof(TKey)).ConvertFrom(elements[0]);
                    }
                    else
                    {
                        id = (TKey)(object)TextFileHelper.LastLineRead;
                    }

                    for (int index = indexOffset; index < elements.Length; index++)
                    {
                        DbAttribute property = attributes[index + attributesOffset];
                        db.Table.SetRaw(id, property, elements[index]);
                    }
                }
                catch {
                    if (!debug.ReportIdException(elements[0]))
                    {
                        return;
                    }
                }
#if SDE_DEBUG
                CLHelper.CS(-1);
                CLHelper.CR(-2);
#endif
            }
#if SDE_DEBUG
            CLHelper.CS(-2);
            CLHelper.WA = ", method core : " + CLHelper.CD(-1) + "ms, loop getter : " + CLHelper.CD(-2) + "ms";
#endif
            if (!uniqueKey)
            {
                TextFileHelper.SaveLastLine = false;
            }
        }
        public static void DbItemGroups <TKey>(DbDebugItem <TKey> debug, AbstractDb <TKey> db)
        {
            foreach (DbAttribute attribute in ServerItemGroupSubAttributes.AttributeList.Attributes)
            {
                db.Attached[attribute.DisplayName] = false;
            }

            if (debug.FileType == FileType.Txt)
            {
                if (db.Attached["FromUserRawInput"] != null && (bool)db.Attached["FromUserRawInput"])
                {
                    _loadItemsGroupdDb(db, debug.FilePath);
                    return;
                }

                using (StreamReader reader = new StreamReader(File.OpenRead(debug.FilePath))) {
                    string line;

                    while (!reader.EndOfStream)
                    {
                        line = reader.ReadLine();

                        if (line != null && line.StartsWith("import: "))
                        {
                            string dbPath = AllLoaders.DetectPathAll(line.Replace("import: ", ""));

                            if (dbPath == null)
                            {
                                ErrorHandler.HandleException("Couldn't find the file '" + line.Replace("import: ", "") + "'.");
                            }
                            else
                            {
                                db.Attached[dbPath] = new Tuple <string, HashSet <int> >(line.Replace("import: ", ""), new HashSet <int>());
                                _loadItemsGroupdDb(db, dbPath);
                            }
                        }
                    }
                }
            }
            else if (debug.FileType == FileType.Conf)
            {
                ItemGroupParser itemHelper = new ItemGroupParser();
                Table <int, ReadableTuple <int> > itemsDb = db.GetMeta <int>(ServerDbs.Items);
                int index = ServerItemAttributes.AegisName.Index;
                var table = db.Table;

                var items = itemsDb.FastItems;

                // The reverse table is used for an optimization (~3 seconds to ~50 ms)
                // All the items are stored in a dictionary by their name instead of their ID
                TkDictionary <string, int> reverseTable = new TkDictionary <string, int>();

                foreach (var item in items)
                {
                    reverseTable[item.GetStringValue(index).ToLowerInvariant()] = item.GetKey <int>();
                }

#if SDE_DEBUG
                Z.StopAndRemoveWithoutDisplay(-1);
                Z.StopAndRemoveWithoutDisplay(-2);
                Z.StopAndRemoveWithoutDisplay(-3);
                CLHelper.CR(-2);
#endif
                foreach (string elements in TextFileHelper.GetElementsByParenthesis(File.ReadAllBytes(debug.FilePath)))
                {
#if SDE_DEBUG
                    CLHelper.CS(-2);
                    CLHelper.CR(-1);
                    CLHelper.CR(-3);
#endif
                    if (!itemHelper.Init(debug, elements))
                    {
                        return;
                    }
#if SDE_DEBUG
                    CLHelper.CS(-3);
#endif

                    try {
                        Tuple tupleItem = itemsDb.TryGetTuple(reverseTable[itemHelper.Id.ToLowerInvariant()]);

                        if (tupleItem == null)
                        {
                            if (itemHelper.Id.StartsWith("ID"))
                            {
                                int ival;

                                if (Int32.TryParse(itemHelper.Id.Substring(2), out ival))
                                {
                                    tupleItem = itemsDb.TryGetTuple(ival);
                                }

                                if (tupleItem == null)
                                {
                                    debug.ReportIdException("Item ID '" + ival + "' couldn't be found.", itemHelper.Id, ErrorLevel.Critical);
                                    continue;
                                }
                            }

                            if (tupleItem == null)
                            {
                                debug.ReportIdException("Item ID '" + itemHelper.Id + "' couldn't be found.", itemHelper.Id, ErrorLevel.Critical);
                                continue;
                            }
                        }

                        TKey itemId = tupleItem.GetKey <TKey>();

                        if (!table.ContainsKey(itemId))
                        {
                            ReadableTuple <TKey> tuple = new ReadableTuple <TKey>(itemId, db.AttributeList);
                            tuple.SetRawValue(ServerItemGroupAttributes.Table, new Dictionary <int, ReadableTuple <int> >());
                            table.Add(itemId, tuple);
                        }

                        for (int i = 0; i < itemHelper.Quantities.Count; i++)
                        {
                            string onameId = itemHelper.Quantities[i].Item1;
                            string orate   = itemHelper.Quantities[i].Item2;
                            int    id      = 0;
                            int    rate;

                            tupleItem = itemsDb.TryGetTuple(reverseTable[onameId.ToLowerInvariant()]);

                            if (tupleItem == null)
                            {
                                if (onameId.StartsWith("ID"))
                                {
                                    if (!Int32.TryParse(onameId.Substring(2), out id))
                                    {
                                        debug.ReportIdException("Item ID '" + itemHelper.Quantities[i].Item1 + "' couldn't be found in group '" + itemHelper.Id + "'.", itemHelper.Id, ErrorLevel.Critical);
                                        continue;
                                    }
                                }
                                else
                                {
                                    debug.ReportIdException("Item ID '" + itemHelper.Quantities[i].Item1 + "' couldn't be found in group '" + itemHelper.Id + "'.", itemHelper.Id, ErrorLevel.Critical);
                                    continue;
                                }
                            }

                            int nameId = tupleItem == null ? id : tupleItem.GetKey <int>();
                            Int32.TryParse(orate, out rate);

                            Dictionary <int, ReadableTuple <int> > dico = (Dictionary <int, ReadableTuple <int> >)table.GetRaw(itemId, ServerItemGroupAttributes.Table);

                            ReadableTuple <int> tuple = new ReadableTuple <int>(nameId, ServerItemGroupSubAttributes.AttributeList);
                            tuple.SetRawValue(ServerItemGroupSubAttributes.Rate, rate);
                            dico[nameId] = tuple;
                        }
                    }
                    catch {
                        if (!debug.ReportIdException(itemHelper.Id))
                        {
                            return;
                        }
                    }
#if SDE_DEBUG
                    CLHelper.CS(-1);
                    CLHelper.CR(-2);
#endif
                }
#if SDE_DEBUG
                CLHelper.CS(-2);
                CLHelper.CS(-3);
                CLHelper.WA = ", method core : " + CLHelper.CD(-1) + "ms, loop getter : " + CLHelper.CD(-2) + "ms, internal parser : " + CLHelper.CD(-3);
#endif
            }
        }