Example #1
0
        public static FileRow GetRow(ScoreCode code)
        {
            var returnRow = new FileRow
            {
                Name  = "scrcode",
                Value = GetScoreCodeValue(code)
            };

            return(returnRow);
        }
Example #2
0
 public override void FromRawData(byte [] buff, int offs, int numRows)
 {
     for (int i = numRows; --i >= 0;)
     {
         Row row = new FileRow(this);
         row.FromRawData(buff, offs);
         Add(row);
         offs += FileRow.LogicalSize;
     }
 }
Example #3
0
        public static FileRow GetRow(UserInterfaceInfo info)
        {
            var returnRow = new FileRow
            {
                Name  = "ui",
                Value = GetUiValue(info)
            };

            return(returnRow);
        }
Example #4
0
        public async Task <IActionResult> ExportAccountAnalysis([FromBody] ListQueryModel <AccountAnalysisQueryModel> listQuery)
        {
            if (listQuery == null)
            {
                throw new ArgumentNullException(nameof(listQuery));
            }
            if (listQuery.Model == null)
            {
                listQuery.Model = new AccountAnalysisQueryModel
                {
                    Month    = DateTime.Now.Month,
                    Year     = DateTime.Now.Year,
                    BranchId = _branchContext.Branch.Id
                }
            }
            ;

            var query = new
            {
                BeginDate = new DateTime(listQuery.Model.Year, listQuery.Model.Month, 1),
                EndDate   = new DateTime(listQuery.Model.Year, listQuery.Model.Month, 1, 23, 59, 59).AddMonths(1).AddDays(-1),
                BranchId  = listQuery.Model.BranchId,
                AccountId = listQuery.Model.AccountId
            };

            var model = new AccountAnalysisModel
            {
                BeginDate  = query.BeginDate,
                EndDate    = query.EndDate,
                BranchId   = listQuery.Model.BranchId,
                BranchName = _memberRepository.Groups(_sessionContext.UserId, null)
                             .FirstOrDefault(g => g.Type == GroupType.Branch && g.Id == listQuery.Model.BranchId)?.DisplayName,
                AccountId   = listQuery.Model.AccountId,
                AccountCode = _accountRepository.Get(listQuery.Model.AccountId)?.Code,
                List        = _accountAnalysisRepository.List(query).ToList(),
                Group       = _accountAnalysisRepository.Group(query),
            };

            using (var stream = _accountAnalysisExcelBuilder.Build(model))
            {
                var fileName = await _storage.Save(stream, ContainerName.Temp, "accountAnalysis.xlsx");

                string contentType;
                new FileExtensionContentTypeProvider().TryGetContentType(fileName, out contentType);

                var fileRow = new FileRow
                {
                    CreateDate  = DateTime.Now,
                    ContentType = contentType ?? "application/octet-stream",
                    FileName    = fileName,
                    FilePath    = fileName
                };
                return(Ok(fileRow));
            }
        }
Example #5
0
        private void SaveMp3(FileRow fileRow, byte[] data)
        {
            Directory.CreateDirectory(Path.GetDirectoryName(fileRow.FileName));

            using (var file = new FileStream(fileRow.FileName, FileMode.Create, FileAccess.Write))
            {
                file.Write(data, 0, data.Length);
            }
            fileRow.Saved = true;
            fileRow.AddLog(string.Format("Uložen soubor: {0}", fileRow.FileName), FileRowState.Finnished);
        }
Example #6
0
        /// <summary>
        /// Reads the specified token.
        /// </summary>
        /// <param name="token">The token.</param>
        /// <param name="result">The result.</param>
        public void Read(TokenTypes token, out FileRow result)
        {
            if ((token & TokenTypes.TableMask) != TokenTypes.File)
            {
                throw new ArgumentException("Invalid token type for FileRow.", "token");
            }

            using (BinaryReader reader = CreateReaderForToken(token))
            {
                result = new FileRow((FileAttributes)reader.ReadUInt32(), ReadIndexValue(reader, IndexType.StringHeap), ReadIndexValue(reader, IndexType.BlobHeap));
            }
        }
Example #7
0
        public override async Task <IEnumerable <FileRow> > GetRows(Column thing)
        {
            var returnRow = new FileRow
            {
                Name  = RowNames.Column,
                Value = GetColumnValue(thing)
            };

            return(new List <FileRow> {
                returnRow
            });
        }
Example #8
0
        public override void VisitResourceCollection(ResourceCollection resources)
        {
            if (!m_tHeap.HasTable(ManifestResourceTable.RId))
            {
                return;
            }

            ManifestResourceTable mrTable = m_tableReader.GetManifestResourceTable();
            FileTable             fTable  = m_tableReader.GetFileTable();

            BinaryReader br;

            for (int i = 0; i < mrTable.Rows.Count; i++)
            {
                ManifestResourceRow mrRow = mrTable [i];
                if (mrRow.Implementation.RID == 0)
                {
                    EmbeddedResource eres = new EmbeddedResource(
                        ReadString(mrRow.Name), mrRow.Flags);

                    br = m_ir.MetadataReader.GetDataReader(
                        m_img.CLIHeader.Resources.VirtualAddress);
                    br.BaseStream.Position += mrRow.Offset;

                    eres.Data = br.ReadBytes(br.ReadInt32());

                    resources.Add(eres);
                    continue;
                }

                switch (mrRow.Implementation.TokenType)
                {
                case TokenType.File:
                    FileRow        fRow = fTable [(int)mrRow.Implementation.RID - 1];
                    LinkedResource lres = new LinkedResource(
                        ReadString(mrRow.Name), mrRow.Flags,
                        ReadString(fRow.Name));
                    lres.Hash = ReadBlob(fRow.HashValue);
                    resources.Add(lres);
                    break;

                case TokenType.AssemblyRef:
                    AssemblyNameReference asm =
                        m_module.AssemblyReferences [(int)mrRow.Implementation.RID - 1];
                    AssemblyLinkedResource alr = new AssemblyLinkedResource(
                        ReadString(mrRow.Name),
                        mrRow.Flags, asm);
                    resources.Add(alr);
                    break;
                }
            }
        }
Example #9
0
        /// <summary>
        /// zahaji zpracovani url
        /// </summary>
        private void ProcessUrl(string url)
        {
            if (string.IsNullOrEmpty(url))
            {
                return;
            }

            var fileRow = new FileRow(Files, url);

            Files.Add(fileRow);
            fileRow.AddLog("Stahuji stránku pořadu.", FileRowState.Started);

            ProcessUrl(fileRow);
        }
Example #10
0
        public override void VisitLinkedResource(LinkedResource res)
        {
            FileTable fTable = m_tableWriter.GetFileTable();
            FileRow   fRow   = m_rowWriter.CreateFileRow(
                Mono.Cecil.FileAttributes.ContainsNoMetaData,
                m_mdWriter.AddString(res.File),
                m_mdWriter.AddBlob(res.Hash));

            fTable.Rows.Add(fRow);

            AddManifestResource(
                0, res.Name, res.Flags,
                new MetadataToken(TokenType.File, (uint)fTable.Rows.IndexOf(fRow) + 1));
        }
Example #11
0
        private MyDbContext AddToContext(MyDbContext context, FileRow entity, int count, int commitCount)
        {
            context.FileRows.Add(entity);

            if (count % commitCount == 0)
            {
                context.SaveChanges();

                context.Dispose();
                context = new MyDbContext();
                context.Configuration.AutoDetectChangesEnabled = false;
            }

            return(context);
        }
Example #12
0
        public void TestSingleRow()
        {
            FileRow        fileRow1 = new FileRow(Convert.ToDateTime("2018-01-01 1:00"), 2);
            List <FileRow> files    = new List <FileRow>
            {
                fileRow1
            };

            DataFile dataFile = new DataFile
            {
                MeterReads = files
            };
            double median = DataFile.CalculateMedian(files);

            Assert.AreEqual(2, median);
        }
Example #13
0
        public async Task <IActionResult> PrintAnnuity([FromBody] int id)
        {
            if (id <= 0)
            {
                throw new ArgumentOutOfRangeException(nameof(id));
            }

            var contract = _repository.Get(id);

            if (contract == null)
            {
                throw new InvalidOperationException();
            }
            if (contract.Status == ContractStatus.Draft && contract.ClientId > 0)
            {
                if (contract.ContractData == null)
                {
                    contract.ContractData = new ContractData();
                }
                var client = _clientRepository.Get(contract.ClientId);
                contract.ContractData.Client = client;
            }

            var stream = await _annuityWordBuilder.Build(contract);

            stream.Position = 0;

            var fileName = await _storage.Save(stream, ContainerName.Temp, "contract.docx");

            string contentType;

            new FileExtensionContentTypeProvider().TryGetContentType(fileName, out contentType);

            var fileRow = new FileRow
            {
                CreateDate  = DateTime.Now,
                ContentType = contentType ?? "application/octet-stream",
                FileName    = fileName,
                FilePath    = fileName
            };

            return(Ok(fileRow));
        }
Example #14
0
        public async Task <IActionResult> Export([FromBody] List <Contract> contracts)
        {
            using (var stream = _excelBuilder.Build(contracts))
            {
                var fileName = await _storage.Save(stream, ContainerName.Temp, "export.xlsx");

                string contentType;
                new FileExtensionContentTypeProvider().TryGetContentType(fileName, out contentType);

                var fileRow = new FileRow
                {
                    CreateDate  = DateTime.Now,
                    ContentType = contentType ?? "application/octet-stream",
                    FileName    = fileName,
                    FilePath    = fileName
                };
                return(Ok(fileRow));
            }
        }
Example #15
0
        /// <summary>
        /// Adds a file to the cabinet.
        /// </summary>
        /// <param name="fileRow">The filerow of the file to add.</param>
        public void AddFile(FileRow fileRow)
        {
            MsiInterop.MSIFILEHASHINFO hashInterop = new MsiInterop.MSIFILEHASHINFO();

            if (null != fileRow.HashRow)
            {
                hashInterop.FileHashInfoSize = 20;
                hashInterop.Data0            = (int)fileRow.HashRow[2];
                hashInterop.Data1            = (int)fileRow.HashRow[3];
                hashInterop.Data2            = (int)fileRow.HashRow[4];
                hashInterop.Data3            = (int)fileRow.HashRow[5];

                this.AddFile(fileRow.Source, fileRow.File, hashInterop);
            }
            else
            {
                this.AddFile(fileRow.Source, fileRow.File);
            }
        }
        public void AddValues_Test()
        {
            //Arrange
            FileRow fileRow1 = new FileRow()
            {
                IP = "1.2.3.4", Values = new RowValues()
                {
                    Values = new List <string>()
                    {
                        "1", "2"
                    }
                }
            };
            FileRow fileRow2 = new FileRow()
            {
                IP = "1.2.3.4", Values = new RowValues()
                {
                    Values = new List <string>()
                    {
                        "1", "2"
                    }
                }
            };

            FileRow expectedFileRow1 = new FileRow()
            {
                IP = "1.2.3.4", Values = new RowValues()
                {
                    Values = new List <string>()
                    {
                        "1", "2"
                    }
                }
            };

            //Act
            bool addValuesSuccess = fileRow1.AddValues(fileRow2.Values.Values);


            //Assert
            Assert.IsTrue(expectedFileRow1.Equals(fileRow1) && addValuesSuccess, "Objects were not equal");
        }
Example #17
0
        private async void ProcessUrl(FileRow fileRow)
        {
            if (fileRow == null)
            {
                return;
            }

            var decoder = await parsers.Chain.CanParse(fileRow.UrlPage);

            if (decoder != null)
            {
                var decoderResult = await decoder.Parse(fileRow.UrlPage);

                if (decoderResult != null)
                {
                    if (!decoderResult.LogSet.Any())
                    {
                        if (decoderResult.RozhlasUrlSet.Any())
                        {
                            ProcessParserResult(fileRow, decoderResult);
                        }
                        else
                        {
                            fileRow.AddLog($"Dekoder '{decoder?.GetType()?.FullName}' nevrátil seznam mp3 url pro: {fileRow.UrlPage}");
                        }
                    }
                    else
                    {
                        decoderResult.LogSet.ForEach(p => fileRow.AddLog(p));
                    }
                }
                else
                {
                    fileRow.AddLog($"Dekoder '{decoder?.GetType()?.FullName}' nevrátil žádná data pro url: {fileRow.UrlPage}");
                }
            }
            else
            {
                fileRow.AddLog($"Nepodařilo se dohledat dekoder pro url: {fileRow.UrlPage}.");
            }
        }
Example #18
0
        private void DataGridView_item_CellValueChanged(object sender, DataGridViewCellEventArgs e)
        {
            if (locked)
            {
                return;
            }
            locked = true;
            if (selectedItem != null)
            {
                var    editedCell = dataGridView_item.Rows[e.RowIndex].Cells[e.ColumnIndex];
                string newValue   = editedCell.EditedFormattedValue.ToString();
                DataGridViewSelectedRowCollection selected = listBox_items.SelectedRows;
                for (int x = 0; x < listBox_items.SelectedRows.Count; x++)
                {
                    int      ItemId = selected[x].Index;
                    FileItem item   = NestedFileDatabase.Collection.GetItem(GetList, ItemId);
                    switch (e.ColumnIndex)
                    {
                    case 1:
                        item.GetRow(e.RowIndex).RowName = newValue;
                        break;

                    case 2:
                        item.GetRow(e.RowIndex).RowType = (FileRowType)Enum.Parse(typeof(FileRowType), newValue);
                        break;

                    case 3:
                        FileRow row = item.GetRow(e.RowIndex);
                        if (row != null)
                        {
                            row.RowValue = newValue;
                            item.SetRow(row);
                        }
                        break;
                    }
                    NestedFileDatabase.Collection.SetItem(GetList, item);
                }
            }
            locked = false;
        }
Example #19
0
        public PriceListModel Parse(UserInputMessage message)
        {
            FileStream stream = File.Open(message.FileUrl, FileMode.Open, FileAccess.Read);

            //Choose one of either 1 or 2
            //1. Reading from a binary Excel file ('97-2003 format; *.xls)
            using (IExcelDataReader excelReader = ExcelReaderFactory.CreateBinaryReader(stream))
            {
                //Choose one of either 3, 4, or 5
                //3. DataSet - The result of each spreadsheet will be created in the result.Tables
                DataSet table = excelReader.AsDataSet();


                var rowCnt = table.Tables[0].Rows.Count;
                var result = new PriceListModel
                {
                    Items = new List <PriceListItemModel>()
                };

                for (int rowNum = 0; rowNum < rowCnt; rowNum++)
                {
                    var row = new FileRow
                    {
                        Id    = table.Tables[0].Rows[rowNum].ItemArray[message.TitleColumn - 1]?.ToString(),
                        Price = table.Tables[0].Rows[rowNum].ItemArray[message.PriceColumn - 1]?.ToString()
                    };

                    var rowModel = _parseInputRowService.ParsePriceFromRow(row);

                    if (rowModel != null)
                    {
                        result.Items.Add(rowModel);
                    }
                }


                return(result);
            }
        }
Example #20
0
        private async void DownloadMp3Stream(FileRow fileRow)
        {
            fileRow.AddLog(string.Format("Zahájení stahování streamu: {0}", fileRow.UrlPage));

            var asyncDownloader = new AsyncDownloader();
            var output          = await asyncDownloader.GetData(fileRow.UrlMp3Download,
                                                                p =>
            {
                fileRow.Progress      = p.ProgressPercentage;
                fileRow.BytesReceived = p.BytesReceived;
                TotalProgress.UpdateProgress(Files);
            });

            if (output.DownloadOk)
            {
                SaveMp3(fileRow, output.Output);
            }
            else
            {
                fileRow.AddLog(string.Format("Chyba při stahování streamu: {0}.", output.Exception?.Message), FileRowState.Error);
            }
        }
        private static UserInterfaceInfo ParseRow(FileRow row)
        {
            var elements = row.Value.Split('|');

            return(new UserInterfaceInfo
            {
                ExtraCompetitorFields = Utilities.GetBool(elements[2]) ?? false,
                HighPointScoring = Utilities.GetBool(elements[13]) ?? false,
                NonStandardRaceTieOptions = Utilities.GetBool(elements[9]) ?? false,
                NonStandardSeriesTieOptions = Utilities.GetBool(elements[10]) ?? false,
                QualificationProfile = Utilities.GetBool(elements[5]) ?? false,
                NonStandardAccumulationOfPoints = Utilities.GetBool(elements[11]) ?? false,
                SplitStarts = Utilities.GetBool(elements[4]) ?? false,
                AppendixLE = Utilities.GetBool(elements[8]) ?? false,
                MedalRace = Utilities.GetBool(elements[7]) ?? false,
                MultipleScoringSystems = Utilities.GetBool(elements[1]) ?? false,
                CompetitorAliasing = Utilities.GetBool(elements[3]) ?? false,
                WindIndexedRatings = Utilities.GetBool(elements[12]) ?? false,
                RaceWeightings = Utilities.GetBool(elements[6]) ?? false,
                NationBasedPublishingTemplates = Utilities.GetBool(elements[14]) ?? false
            });
        }
Example #22
0
        // rows should come in filtered for a single race.
        public static ScoreCode GetCode(FileRow row)
        {
            if (!row.Name.Equals("scrcode", StringComparison.InvariantCultureIgnoreCase))
            {
                return(null);
            }
            ScoreCode code     = new ScoreCode();
            var       elements = row.Value.Split('|');

            code.Code            = elements[0];
            code.Method          = elements[1];
            code.Value           = elements[2];
            code.Discardable     = Utilities.GetBool(elements[3]) ?? false;
            code.CameToStartArea = Utilities.GetBool(elements[4]) ?? false;
            code.Started         = Utilities.GetBool(elements[11]) ?? false;
            code.Finished        = Utilities.GetBool(elements[12]) ?? false;
            code.RuleA6d2Applies = Utilities.GetBool(elements[13]) ?? false;
            code.ScoringSystemId = Utilities.GetInt(elements[14]) ?? 1;
            code.Format          = elements[15];
            code.Description     = elements[16];

            return(code);
        }
Example #23
0
        /// <summary>
        /// Parse values from Excel sheet and add to Rows collection.
        /// </summary>
        public static List <FileRow> GetValues(string path, string sheetName, bool skipFirstLine)
        {
            var rowItems = new List <FileRow>();

            using (var stream = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read))
            {
                using (var excelReader = GetExcelDataReader(path, stream))
                {
                    excelReader.IsFirstRowAsColumnNames = skipFirstLine;
                    var dataset = excelReader.AsDataSet();
                    foreach (DataRow row in dataset.Tables[sheetName].Rows)
                    {
                        var rowItem = new FileRow();
                        foreach (var value in row.ItemArray)
                        {
                            rowItem.Values.Add(value);
                        }
                        rowItems.Add(rowItem);
                    }
                }
            }
            return(rowItems);
        }
Example #24
0
        private void ProcessParserResult(FileRow mainFileRow, ParserResult decoderResult)
        {
            if (mainFileRow == null || decoderResult == null || !decoderResult.RozhlasUrlSet.Any())
            {
                return;
            }

            var isMultipart = (decoderResult.RozhlasUrlSet.Count > 1);

            // first or main download link
            DownloadMp3StreamStart(decoderResult, decoderResult.RozhlasUrlSet[0], mainFileRow);

            // next download links... (more part on one html page)
            if (isMultipart)
            {
                for (int i = 1; i < decoderResult.RozhlasUrlSet.Count; i++)
                {
                    var fileRow = new FileRow(Files, mainFileRow.UrlPage);
                    Files.Add(fileRow);

                    DownloadMp3StreamStart(decoderResult, decoderResult.RozhlasUrlSet[i], fileRow);
                }
            }
        }
        protected override async Task Handle(UserInputMessage message)
        {
            using (var package = new ExcelPackage(new FileInfo(message.FileUrl)))
            {
                var result = new PriceListModel
                {
                    Items     = new List <PriceListItemModel>(),
                    PriceType = message.CurrentPriceType
                };

                var sheet = package.Workbook.Worksheets.FirstOrDefault();
                if (sheet == null)
                {
                    throw new FileNotFoundException($"file {message.FileUrl} not found or does not have any sheets");
                }
                var rowCnt = sheet?.Dimension?.End?.Row ?? 0;

                for (int rowNum = 1; rowNum < rowCnt + 1; rowNum++)
                {
                    var row = new FileRow
                    {
                        Id    = sheet.Cells[message.TitleColumn + rowNum].Value?.ToString(),
                        Price = sheet.Cells[message.PriceColumn + rowNum].Value?.ToString()
                    };

                    var rowModel = await _rowParser.Ask(row) as PriceListItemModel;

                    if (rowModel != null)
                    {
                        result.Items.Add(rowModel);
                    }
                }

                _comparator.Tell(result);
            }
        }
Example #26
0
 public IFileFacade CreateFileFacade(FileRow fileRow)
 {
     return(new FileFacade(fileRow));
 }
Example #27
0
        /// <summary>
        /// Выполнение процедуры экспорта данных
        /// </summary>
        private void StartExport()
        {
            SqlConnection cnt = Site.GetDatabaseConnection();

            if (cnt != null && cnt.State == System.Data.ConnectionState.Open)
            {
                dsParserTableAdapters.tInventItemsTableAdapter taItems = new dsParserTableAdapters.tInventItemsTableAdapter();
                int itemsCount;
                try { itemsCount = (int)taItems.ItemsCount(); }
                catch { itemsCount = 0; }

                // Работаем с товарами через SqlDataReader, поскольку в выборке очень много записей
                string        query     = @"SELECT * FROM [dbo].[tInventItems]";
                SqlCommand    cndInvent = new SqlCommand(query, cnt);
                SqlDataReader rdrInvent = cndInvent.ExecuteReader();

                if (rdrInvent.HasRows)
                {
                    FileRow exportRow;
                    int     exportedItems = 0;
                    string  logMessage    = @"{0} {1} из {2}";
                    string  logCaption;

                    while (rdrInvent.Read() && IsActive && (!ExportFragments || exportedItems < PreviousFragment + FragmentSize))
                    {
                        List <ImageResource> imgList = GetImagesList((int)rdrInvent["Id"]);

                        exportRow             = new FileRow();
                        exportRow.XmlId       = (int)rdrInvent["Id"];
                        exportRow.Name        = rdrInvent["Name"].ToString().Replace(";", " ").Replace("\n", " ").Replace("\r", " ").Replace(@"""", " ");
                        exportRow.PreviewText = rdrInvent["ShortDescr"].ToString().Replace(";", " ").Replace("\n", " ").Replace("\r", " ").Replace(@"""", " ");
                        exportRow.DetailText  = rdrInvent["Descr"].ToString().Replace(";", " ").Replace("\n", " ").Replace("\r", " ").Replace(@"""", " ");
                        exportRow.ArtNumber   = @"SMR-" + rdrInvent["Id"].ToString().Trim();
                        exportRow.Price       = (decimal)rdrInvent["Price"];

                        FillOptions(ref exportRow);

                        FillGroups(ref exportRow, (int)rdrInvent["ParentId"]);

                        if (!ExportFragments || exportedItems >= PreviousFragment)
                        {
                            // Выгрузка с учётом изображений
                            if (imgList.Count > 0)
                            {
                                foreach (ImageResource img in imgList)
                                {
                                    if (img.LocalImageFile != null && img.LocalImageFile.Exists)
                                    {
                                        //string remoteFileName = @"invent_export/" + img.LocalImageFile.Name;
                                        string remoteFileName = img.LocalImageFile.Name;
                                        exportRow.MorePhoto = remoteFileName;
                                        ExportFile.FileWriter.WriteLine(exportRow.ToString());
                                    }
                                }
                            }
                            else
                            {
                                ExportFile.FileWriter.WriteLine(exportRow.ToString());
                            }

                            logCaption = @"Экспортировано";
                        }
                        else
                        {
                            logCaption = @"Пропущено";
                        }

                        // Формирование сообщения пользователю
                        exportedItems++;
                        if (exportedItems % 100 == 0)
                        {
                            Log = string.Format(logMessage, logCaption, exportedItems, itemsCount);
                        }
                    }

                    // Фиксируем значение границы выгрузки
                    PreviousFragment = exportedItems >= itemsCount ? 0 : exportedItems;
                }

                rdrInvent.Close();
                cnt.Close();
            }
        }
Example #28
0
        /// <summary>
        /// Adds a file to the cabinet.
        /// </summary>
        /// <param name="fileRow">The filerow of the file to add.</param>
        public void AddFile(FileRow fileRow)
        {
            MsiInterop.MSIFILEHASHINFO hashInterop = new MsiInterop.MSIFILEHASHINFO();

            if (null != fileRow.HashRow)
            {
                hashInterop.FileHashInfoSize = 20;
                hashInterop.Data0 = (int)fileRow.HashRow[2];
                hashInterop.Data1 = (int)fileRow.HashRow[3];
                hashInterop.Data2 = (int)fileRow.HashRow[4];
                hashInterop.Data3 = (int)fileRow.HashRow[5];

                this.AddFile(fileRow.Source, fileRow.File, hashInterop);
            }
            else
            {
                this.AddFile(fileRow.Source, fileRow.File);
            }
        }
        internal void MReadFile(string path)
        {
            lists = new FileListColection();
            if (File.Exists(path))
            {
                DataReader reader     = new DataReader(File.ReadAllBytes(path));
                int        listscount = reader.ReadInt32();
                for (int l = 0; l < listscount; l++)
                {
                    int    listId    = reader.ReadInt32();
                    string ListName  = reader.ReadString();
                    int    ItemCount = reader.ReadInt32();
                    for (int i = 0; i < ItemCount; i++)
                    {
                        int    itemId       = reader.ReadInt32();
                        string itemtName    = reader.ReadString();
                        int    itemRowCount = reader.ReadInt32();

                        FileItem item = new FileItem()
                        {
                            ItemId   = itemId,
                            ItemName = itemtName
                        };
                        for (int r = 0; r < itemRowCount; r++)
                        {
                            FileRow row = new FileRow
                            {
                                RowIndex = reader.ReadInt32(),
                                RowName  = reader.ReadString(),
                                RowType  = (FileRowType)reader.ReadByte()
                            };
                            switch (row.RowType)
                            {
                            case FileRowType.Byte:
                                row.RowValue = reader.ReadByte();
                                break;

                            case FileRowType.Int:
                                row.RowValue = reader.ReadInt32();
                                break;

                            case FileRowType.Short:
                                row.RowValue = reader.ReadInt16();
                                break;

                            case FileRowType.Float:
                                row.RowValue = reader.ReadSingle();
                                break;

                            case FileRowType.Double:
                                row.RowValue = reader.ReadDouble();
                                break;

                            case FileRowType.Boolean:
                                row.RowValue = reader.ReadBoolean();
                                break;

                            case FileRowType.String:
                                row.RowValue = reader.ReadString();
                                break;
                            }
                            item.SetRow(row);
                        }
                        lists.SetItem(listId, item);
                        lists.SetListName(listId, ListName);
                    }
                }
                _IsLoaded = true;
                return;
            }

            _IsLoaded = false;
        }
Example #30
0
        /// <summary>
        /// Creates a new row in the table.
        /// </summary>
        /// <param name="sourceLineNumbers">Original source lines for this row.</param>
        /// <param name="add">Specifies whether to only create the row or add it to the table automatically.</param>
        /// <returns>Row created in table.</returns>
        public Row CreateRow(SourceLineNumber sourceLineNumbers, bool add = true)
        {
            Row row;

            switch (this.Name)
            {
            case "BBControl":
                row = new BBControlRow(sourceLineNumbers, this);
                break;

            case "WixBundlePackage":
                row = new WixBundlePackageRow(sourceLineNumbers, this);
                break;

            case "WixBundleExePackage":
                row = new WixBundleExePackageRow(sourceLineNumbers, this);
                break;

            case "WixBundleMsiPackage":
                row = new WixBundleMsiPackageRow(sourceLineNumbers, this);
                break;

            case "WixBundleMspPackage":
                row = new WixBundleMspPackageRow(sourceLineNumbers, this);
                break;

            case "WixBundleMsuPackage":
                row = new WixBundleMsuPackageRow(sourceLineNumbers, this);
                break;

            case "Component":
                row = new ComponentRow(sourceLineNumbers, this);
                break;

            case "WixBundleContainer":
                row = new WixBundleContainerRow(sourceLineNumbers, this);
                break;

            case "Control":
                row = new ControlRow(sourceLineNumbers, this);
                break;

            case "File":
                row = new FileRow(sourceLineNumbers, this);
                break;

            case "WixBundleMsiFeature":
                row = new WixBundleMsiFeatureRow(sourceLineNumbers, this);
                break;

            case "WixBundleMsiProperty":
                row = new WixBundleMsiPropertyRow(sourceLineNumbers, this);
                break;

            case "Media":
                row = new MediaRow(sourceLineNumbers, this);
                break;

            case "WixBundlePayload":
                row = new WixBundlePayloadRow(sourceLineNumbers, this);
                break;

            case "Property":
                row = new PropertyRow(sourceLineNumbers, this);
                break;

            case "WixRelatedBundle":
                row = new WixRelatedBundleRow(sourceLineNumbers, this);
                break;

            case "WixBundleRelatedPackage":
                row = new WixBundleRelatedPackageRow(sourceLineNumbers, this);
                break;

            case "WixBundleRollbackBoundary":
                row = new WixBundleRollbackBoundaryRow(sourceLineNumbers, this);
                break;

            case "Upgrade":
                row = new UpgradeRow(sourceLineNumbers, this);
                break;

            case "WixBundleVariable":
                row = new WixBundleVariableRow(sourceLineNumbers, this);
                break;

            case "WixAction":
                row = new WixActionRow(sourceLineNumbers, this);
                break;

            case "WixApprovedExeForElevation":
                row = new WixApprovedExeForElevationRow(sourceLineNumbers, this);
                break;

            case "WixBundle":
                row = new WixBundleRow(sourceLineNumbers, this);
                break;

            case "WixBundlePackageExitCode":
                row = new WixBundlePackageExitCodeRow(sourceLineNumbers, this);
                break;

            case "WixBundlePatchTargetCode":
                row = new WixBundlePatchTargetCodeRow(sourceLineNumbers, this);
                break;

            case "WixBundleSlipstreamMsp":
                row = new WixBundleSlipstreamMspRow(sourceLineNumbers, this);
                break;

            case "WixBundleUpdate":
                row = new WixBundleUpdateRow(sourceLineNumbers, this);
                break;

            case "WixBundleCatalog":
                row = new WixBundleCatalogRow(sourceLineNumbers, this);
                break;

            case "WixChain":
                row = new WixChainRow(sourceLineNumbers, this);
                break;

            case "WixChainItem":
                row = new WixChainItemRow(sourceLineNumbers, this);
                break;

            case "WixBundlePackageCommandLine":
                row = new WixBundlePackageCommandLineRow(sourceLineNumbers, this);
                break;

            case "WixComplexReference":
                row = new WixComplexReferenceRow(sourceLineNumbers, this);
                break;

            case "WixDeltaPatchFile":
                row = new WixDeltaPatchFileRow(sourceLineNumbers, this);
                break;

            case "WixDeltaPatchSymbolPaths":
                row = new WixDeltaPatchSymbolPathsRow(sourceLineNumbers, this);
                break;

            case "WixFile":
                row = new WixFileRow(sourceLineNumbers, this);
                break;

            case "WixGroup":
                row = new WixGroupRow(sourceLineNumbers, this);
                break;

            case "WixMedia":
                row = new WixMediaRow(sourceLineNumbers, this);
                break;

            case "WixMediaTemplate":
                row = new WixMediaTemplateRow(sourceLineNumbers, this);
                break;

            case "WixMerge":
                row = new WixMergeRow(sourceLineNumbers, this);
                break;

            case "WixPayloadProperties":
                row = new WixPayloadPropertiesRow(sourceLineNumbers, this);
                break;

            case "WixProperty":
                row = new WixPropertyRow(sourceLineNumbers, this);
                break;

            case "WixSimpleReference":
                row = new WixSimpleReferenceRow(sourceLineNumbers, this);
                break;

            case "WixUpdateRegistration":
                row = new WixUpdateRegistrationRow(sourceLineNumbers, this);
                break;

            case "WixVariable":
                row = new WixVariableRow(sourceLineNumbers, this);
                break;

            default:
                row = new Row(sourceLineNumbers, this);
                break;
            }

            if (add)
            {
                this.Rows.Add(row);
            }

            return(row);
        }
 public virtual void VisitFileRow(FileRow row)
 {
 }
Example #32
0
 public FileFacade(bool fromModule, FileRow file, WixFileRow wixFile)
 {
     this.FromModule = fromModule;
     this.File       = file;
     this.WixFile    = wixFile;
 }