Пример #1
0
        public static void DbLoaderComma <T>(DbDebugItem <T> debug, AttributeList list, DbIOItems.DbCommaFunctionDelegate <T> function, TextFileHelper.TextFileHelperGetterDelegate getter, bool addAutomatically = true)
        {
            var table = debug.AbsractDb.Table;

            foreach (string[] elements in getter(FtpHelper.ReadAllBytes(debug.FilePath)))
            {
                try {
                    if (!addAutomatically)
                    {
                        T id = (T)TypeDescriptor.GetConverter(typeof(T)).ConvertFrom(elements[0]);

                        if (!table.ContainsKey(id))
                        {
                            TkDictionary <T, string[]> phantomTable;

                            if (!debug.AbsractDb.Attached.ContainsKey("Phantom." + debug.DbSource.Filename))
                            {
                                phantomTable = new TkDictionary <T, string[]>();
                                debug.AbsractDb.Attached["Phantom." + debug.DbSource.Filename] = phantomTable;
                            }
                            else
                            {
                                phantomTable = (TkDictionary <T, string[]>)debug.AbsractDb.Attached["Phantom." + debug.DbSource.Filename];
                            }

                            phantomTable[id] = elements;
                            continue;
                        }
                    }

                    function(debug, list, elements, table);
                }
                catch (Exception err) {
                    if (!debug.ReportException(err))
                    {
                        return;
                    }
                }
            }
        }
Пример #2
0
 public static void DbLoaderComma <T>(DbDebugItem <T> debug, AttributeList list, DbIOItems.DbCommaFunctionDelegate <T> function, bool addAutomatically = true)
 {
     DbLoaderComma(debug, list, function, TextFileHelper.GetElementsByCommas, addAutomatically);
 }