Exemplo n.º 1
0
		public static IReadOnlyCollection<FileInfo> GenerateSchema(FileInfo xmlFile)
		{
			try
			{
				LH.Write($"\rGenerating Schema (FileInfo): {xmlFile.Name}\t\t\t\t\t");

				IReadOnlyCollection<string> args = GetXSDArguments(xmlFile);
				bool result = CallXSD(args);

				if (!result)
					throw new FileLoadException($"The call to XSD failed on the file:\r\n{xmlFile.FullName}");

				ImportFileType importType = ESRIHelper.GetImportFileType(xmlFile);
				string fileExtension = ESRIHelper.GetImportFileExtension(importType);

				string fileName = xmlFile.Name.Replace(fileExtension, "")
					.Trim('.')
					.Trim();

				IReadOnlyCollection<FileInfo> results = WorkingDirectory.GetFiles($"{fileName}*{ESRIHelper.XmlSchemaExtension}",
					SearchOption.AllDirectories);

				return results;
			}
			catch (Exception e)
			{
				LH.Error($"\r\n{e.Message}\r\n{e}");
				throw;
			}
		}
Exemplo n.º 2
0
		public static IReadOnlyCollection<string> GetXSDArguments(FileInfo inputFile,
			ImportFileType fileType = ImportFileType.XmlFile)
		{
			try
			{
				string filePathString = inputFile.FullName.Contains(" ")
					? $"\"{inputFile.FullName}\""
					: inputFile.FullName;

				return new[]
				{
					filePathString,
					fileType == ImportFileType.XmlFile ? SchemaOutputArgument : ClassOutputArgument,
					LanguageArgument,
					ClassArgument,
					//DatasetArgument,
					//EnableLinqDataSetArgument,
					//EnableDataBindingArgument,
					//OrderArgument,
					NoLogoArgument
				};
			}
			catch (Exception e)
			{
				LH.Error($"\r\n{e.Message}\r\n{e}");
				throw;
			}
		}
Exemplo n.º 3
0
        public ImportFileBatch CreateImportFileBatch(ImportFileType importFileType, string fileName)
        {
            //TODO Handle errors
            var importFileBatch = new ImportFileBatch();
            var mapper          = new ImportFileBatchDataMapper(importFileType);

            SetSqlConnection();

            using (Connection)
                using (var command = CreateSqlCommand(StoredProcedures.CreateImportFileBatch))
                {
                    AddParameter(command, DbType.Int32, "ImportFileTypeId", importFileType.ImportFileTypeId);
                    AddParameter(command, DbType.String, "ImportFileName", fileName);
                    Connection.Open();
                    using (var reader = command.ExecuteReader())
                    {
                        if (reader.HasRows)
                        {
                            importFileBatch = mapper.MapSingle(reader);
                        }
                    }
                }

            return(importFileBatch);
        }
Exemplo n.º 4
0
        public MoneyDataImporter(String fileName)
        {
            FileInfo fi = new FileInfo(fileName);
            if (!fi.Exists)
            {
                throw new FileNotFoundException("Import file not found", fileName);
            }

            this.fileName = fileName;

            switch (fi.Extension.ToUpper())
            {
                case FILE_CSV:
                    fileType = ImportFileType.Csv;
                    break;

                case FILE_XML:
                    fileType = ImportFileType.Xml;
                    break;

                case FILE_TXT:
                    fileType = ImportFileType.Txt;
                    break;

                default:
                    throw new FormatException("Import file is in invalid format");
            }

            parseFile();
            processRecords();
        }
Exemplo n.º 5
0
 public FileImportException(string message, ImportError error, ImportFileType fileType, string fileName)
 {
     Message  = message;
     Error    = error;
     FileType = fileType;
     FileName = fileName;
 }
Exemplo n.º 6
0
        public ImportFileType CreateImportFileType(ImportFileType importFileType)
        {
            var newImportFileType = new ImportFileType();
            var mapper            = new ImportFileTypeDataMapper();

            SetSqlConnection();
            using (Connection)
                using (var command = CreateSqlCommand(StoredProcedures.CreateImportFileType))
                {
                    AddParameter(command, DbType.String, "Description", importFileType.Description);
                    AddParameter(command, DbType.String, "FileExtension", importFileType.FileExtension);
                    AddParameter(command, DbType.String, "ColumnDelimiter", importFileType.ColumnDelimiter);
                    AddParameter(command, DbType.String, "SourceDirectory", importFileType.SourceDirectory);
                    AddParameter(command, DbType.String, "FileNamePattern", importFileType.FileNamePattern);
                    AddParameter(command, DbType.String, "PostLoadProcedure", importFileType.PostLoadProcedure);
                    AddParameter(command, DbType.String, "StagingTable", importFileType.StagingTable);
                    AddParameter(command, DbType.Boolean, "IsActive", importFileType.IsActive);
                    Connection.Open();
                    using (var reader = command.ExecuteReader())
                    {
                        if (reader.HasRows)
                        {
                            newImportFileType = mapper.MapSingle(reader);
                        }
                    }
                }

            return(newImportFileType);
        }
Exemplo n.º 7
0
 public frmImport(ImportFileType importFileType, Company company, CustomerKey customerKey)
 {
     InitializeComponent();
     this._importFileType = importFileType;
     this._company        = company;
     this._customerKey    = customerKey;
 }
Exemplo n.º 8
0
		public static IReadOnlyCollection<string> GetXSDArguments(IReadOnlyCollection<FileInfo> inputFiles,
			ImportFileType fileType = ImportFileType.XmlFile,
			bool reverseOrder = false)
		{
			try
			{
				string[] filePaths = inputFiles.Select(s => s.FullName)
					.Select(filePath => filePath.Contains(" ") ? $"\"{filePath.Trim('"').Trim()}\"" : filePath.Trim())
					.ToArray();

				if (reverseOrder)
					Array.Reverse(filePaths);

				string filePathsString = string.Join(" ", filePaths);

				return new[]
				{
					filePathsString,
					fileType == ImportFileType.XmlFile ? SchemaOutputArgument : ClassOutputArgument,
					LanguageArgument,
					ClassArgument,
					//DatasetArgument,
					//EnableLinqDataSetArgument,
					//EnableDataBindingArgument,
					//OrderArgument,
					NoLogoArgument
				};
			}
			catch (Exception e)
			{
				LH.Error($"\r\n{e.Message}\r\n{e}");
				throw;
			}
		}
Exemplo n.º 9
0
        public MoneyDataImporter(String fileName)
        {
            FileInfo fi = new FileInfo(fileName);

            if (!fi.Exists)
            {
                throw new FileNotFoundException("Import file not found", fileName);
            }

            this.fileName = fileName;

            switch (fi.Extension.ToUpper())
            {
            case FILE_CSV:
                fileType = ImportFileType.Csv;
                break;

            case FILE_XML:
                fileType = ImportFileType.Xml;
                break;

            case FILE_TXT:
                fileType = ImportFileType.Txt;
                break;

            default:
                throw new FormatException("Import file is in invalid format");
            }

            parseFile();
            processRecords();
        }
Exemplo n.º 10
0
        /// <summary>
        /// Creates a new loan in Encompass using loan data imported from a Fannie Mae 3.x loan file and returns the loan id of the loan created.
        /// </summary>
        /// <param name="importFileType">The format of the file being sent in the request body.</param>
        /// <param name="importFile">The Fannie Mae loan file to import.</param>
        /// <param name="createLoanOptions">The loan creation options.</param>
        /// <param name="cancellationToken">The token to monitor for cancellation requests. The default value is <see cref="CancellationToken.None"/>.</param>
        /// <returns></returns>
        public Task <string> CreateLoanFromImportFileAsync(ImportFileType importFileType, Stream importFile, CreateLoanOptions createLoanOptions = null, CancellationToken cancellationToken = default)
        {
            if (createLoanOptions?.Populate == true)
            {
                throw new InvalidOperationException("Use other CreateLoanFromImportFileAsync overload to populate a loan object.");
            }

            return(CreateLoanFromImportFileAsync(importFileType, importFile, createLoanOptions, out _, cancellationToken));
        }
        public static ITransactionProcessor GetTransactionProcessor(ImportFileType importFileType, IEtlRepository etlRepository)
        {
            switch (importFileType.ImportFileTypeId)
            {
            case 1: return(new MonzoTransactionProcessor(importFileType, etlRepository));

            case 2: return(new SantanderTransactionProcessor(importFileType, etlRepository));

            default: throw new ArgumentException();
            }
        }
Exemplo n.º 12
0
 public ImportFileCommand()
 {
     filePath = string.Empty;
     fileName = string.Empty;
     checkForDuplicateFullName         = false;
     checkForDuplicateContactEmail     = false;
     checkForDuplicateOrganizationName = false;
     checkForDuplicateCompanyEmail     = false;
     checkForDuplicateMainPhone        = false;
     fileType = ImportFileType.Contacts;
 }
Exemplo n.º 13
0
		public static IReadOnlyCollection<string> GetXSDArguments(IReadOnlyCollection<string> inputFilePaths,
			ImportFileType fileType = ImportFileType.XmlFile)
		{
			try
			{
				return GetXSDArguments(inputFilePaths.Select(s => new FileInfo(s)).ToArray(), fileType);
			}
			catch (Exception e)
			{
				LH.Error($"\r\n{e.Message}\r\n{e}");
				throw;
			}
		}
Exemplo n.º 14
0
		public static IReadOnlyCollection<string> GetXSDArguments(string inputFilePath,
			ImportFileType fileType = ImportFileType.XmlFile)
		{
			try
			{
				return GetXSDArguments(new FileInfo(inputFilePath), fileType);
			}
			catch (Exception e)
			{
				LH.Error($"\r\n{e.Message}\r\n{e}");
				throw;
			}
		}
Exemplo n.º 15
0
        /// <summary>
        /// Creates a new loan in Encompass using loan data imported from a Fannie Mae 3.x loan file and returns the loan id of the loan created.
        /// </summary>
        /// <param name="importFileType">The format of the file being sent in the request body.</param>
        /// <param name="importFile">The Fannie Mae loan file to import.</param>
        /// <param name="createLoanOptions">The loan creation options.</param>
        /// <param name="loan">Returns a loan object if <paramref name="createLoanOptions"/>.Populate is <c>true</c>.</param>
        /// <param name="cancellationToken">The token to monitor for cancellation requests. The default value is <see cref="CancellationToken.None"/>.</param>
        /// <returns></returns>
        public Task <string> CreateLoanFromImportFileAsync(ImportFileType importFileType, Stream importFile, CreateLoanOptions createLoanOptions, out Loan loan, CancellationToken cancellationToken = default)
        {
            importFileType.Validate(nameof(importFileType));
            Preconditions.NotNull(importFile, nameof(importFile));

            var populate = createLoanOptions?.Populate == true;

            loan = populate ? new Loan(Client) : null;
            var content = new StreamContent(importFile);

            content.Headers.ContentType = new MediaTypeHeaderValue(importFileType.GetValue());
            return(CreateLoanFromImportFileInternalAsync(content, loan, populate, createLoanOptions, cancellationToken));
        }
        private string ImportGetSourceFilePath(PinballTable table, ImportFileType type)
        {
            switch (type)
            {
            case ImportFileType.Video:
                return(FileUtility.OpenFileDatalogMP4());

            case ImportFileType.Audio:
                return(FileUtility.OpenFileDatalogMP3());

            case ImportFileType.Image:
                return(FileUtility.OpenFileDatalogPNG());
            }
            return(null);
        }
Exemplo n.º 17
0
        public ReadFile(ImportFileType importFileType)
        {
            SettingsImportSF settings = new SettingsImportSF();

            fileName = settings.GetFileName(importFileType);

            if (!File.Exists(fileName))
            {
                LogManager.Logger.Information("File " + importFileType.ToString() + " not found");
                return;
            }

            string[] lines = File.ReadAllLines(fileName);

            SplitLines(lines);
        }
Exemplo n.º 18
0
        public ReadFile(ImportFileType importFileType)
        {
            SettingsImportSF settings = new SettingsImportSF();

            fileName = settings.GetFileName(importFileType);

            if (!File.Exists(fileName))
            {
                LogManager.Logger.Information("File " + importFileType.ToString() + " not found");
                return;
            }

            string[] lines = File.ReadAllLines(fileName);

            SplitLines(lines);
        }
Exemplo n.º 19
0
		public static IReadOnlyCollection<FileInfo> GenerateClass(IReadOnlyCollection<FileInfo> schemaFiles)
		{
			try
			{
				IReadOnlyCollection<string> args = GetXSDArguments(schemaFiles, ImportFileType.XmlSchema, true);
				List<string> cleanArgs = args.ToList();
				cleanArgs.Remove(DatasetArgument);
				args = cleanArgs.AsReadOnly();

				FileInfo firstSchemaFile = schemaFiles.FirstOrDefault();

				if (firstSchemaFile == null
					|| !firstSchemaFile.Exists)
					throw new FileNotFoundException("The first schema file in the collection does not exist or was not found");

				ImportFileType importType = ESRIHelper.GetImportFileType(firstSchemaFile);
				string fileExtension = ESRIHelper.GetImportFileExtension(importType);

				string fileName = firstSchemaFile.Name.Replace(fileExtension, "")
					.Trim('.')
					.Replace(".", "_")
					.Trim();

				LH.Write($"\rGenerating Classes (FileInfo): {fileName}\t\t\t\t\t");
				bool result = CallXSD(args);

				if (!result)
					throw new FileLoadException(
						$"The call to XSD failed on the files:\r\n{fileName}");

				IReadOnlyCollection<FileInfo> results = OutputDirectory.GetFiles($"{fileName}*.cs", SearchOption.AllDirectories);

				int resultCount = results.Count;
				LH.Write(
					$"\r{resultCount} Class{(resultCount == 1 ? "" : "es")} Generated for {fileName}\t\t\t\t\t");

				return results;
			}
			catch (Exception e)
			{
				LH.Error($"\r\n{e.Message}\r\n{e}");
				throw;
			}
		}
Exemplo n.º 20
0
        public static string GetImportFileExtension(ImportFileType fileType)
        {
            try
            {
                string value = FileTypes[fileType];

                if (value == null)
                {
                    throw new ArgumentException("The file specified is not a valid import file!");
                }

                return(value);
            }
            catch (Exception e)
            {
                Console.WriteLine($"\r\n{e.Message}\r\n{e}");
                throw;
            }
        }
Exemplo n.º 21
0
        public void UpdateImportFileType(ImportFileType importFileType)
        {
            SetSqlConnection();
            using (Connection)
                using (var command = CreateSqlCommand(StoredProcedures.UpdateImportFileType))
                {
                    AddParameter(command, DbType.Int32, "ImportFileTypeId", importFileType.ImportFileTypeId);
                    AddParameter(command, DbType.String, "Description", importFileType.Description);
                    AddParameter(command, DbType.String, "FileExtension", importFileType.FileExtension);
                    AddParameter(command, DbType.String, "ColumnDelimiter", importFileType.ColumnDelimiter);
                    AddParameter(command, DbType.String, "SourceDirectory", importFileType.SourceDirectory);
                    AddParameter(command, DbType.String, "FileNamePattern", importFileType.FileNamePattern);
                    AddParameter(command, DbType.String, "PostLoadProcedure", importFileType.PostLoadProcedure);
                    AddParameter(command, DbType.String, "StagingTable", importFileType.StagingTable);
                    AddParameter(command, DbType.Boolean, "IsActive", importFileType.IsActive);

                    Connection.Open();
                    command.ExecuteNonQuery();
                }
        }
Exemplo n.º 22
0
        public static FileInfo CreateWorkingFile(FileInfo file)
        {
            try
            {
                ImportFileType fileType      = ESRIHelper.GetImportFileType(file);
                string         fileExtension = ESRIHelper.GetImportFileExtension(fileType);
                string         tempName      = Path.GetRandomFileName().Split('.')[0];
                tempName = tempName.Length > 8 ? tempName.Substring(0, 8) : tempName;
                string tableName       = $"{tempName}{fileExtension}";
                string workingFilePath = Path.Combine(EXEHelper.WorkingPath, tableName);

                FileInfo workingFile = file.CopyTo(workingFilePath, true);
                return(workingFile);
            }
            catch (Exception e)
            {
                Console.WriteLine($"\r\n{e.Message}\r\n{e}");
                throw;
            }
        }
Exemplo n.º 23
0
        public Collection <ImportFileBatch> GetImportFileBatchesByTypeAndDate(ImportFileType importFileType, DateTime fromDate)
        {
            var importFileBatches = new Collection <ImportFileBatch>();
            var mapper            = new ImportFileBatchDataMapper(importFileType);

            SetSqlConnection();

            using (Connection)
                using (var command = CreateSqlCommand(StoredProcedures.GetImportFileBatchesByTypeAndDate))
                {
                    AddParameter(command, DbType.Byte, "ImportFileTypeId", importFileType.ImportFileTypeId);
                    AddParameter(command, DbType.DateTime, "DateFrom", fromDate);
                    Connection.Open();
                    using (var reader = command.ExecuteReader())
                    {
                        if (reader.HasRows)
                        {
                            importFileBatches = mapper.MapAll(reader);
                        }
                    }
                }

            return(importFileBatches);
        }
 public ImportFileBatchDataMapper(ImportFileType importFileType)
 {
     _importFileType = importFileType;
 }
Exemplo n.º 25
0
 /// <summary>
 /// Informs browser which type of records will be contained inside import file.
 /// </summary>
 /// <param name="type"></param>
 /// <returns></returns>
 public ImportFileCommand Containing(ImportFileType type)
 {
     fileType = type;
     return(this);
 }
Exemplo n.º 26
0
 public frmImport(ImportFileType importFileType)
 {
     InitializeComponent();
     this._importFileType = importFileType;
 }
Exemplo n.º 27
0
        public void ProcessFile(FileInfo file)
        {
            try
            {
                if (file == null ||
                    !file.Exists)
                {
                    throw new FileNotFoundException("Please specify a valid file and try the ProcessFile method again.");
                }

                Console.Write($"\rProcessing {file.Name}\t\t\t\t\t");

                ImportFileType importFileType = GetImportFileType(file);
                string         fileExtension  = GetImportFileExtension(importFileType);

                //Console.Write($"\r{file.Name} is a(n) {importFileType} file with an extension of {fileExtension}\t\t\t\t\t");

                switch (importFileType)
                {
                case ImportFileType.CodePage:
                    //CodePageFile codePageFile = new CodePageFile(file);
                    break;

                case ImportFileType.XmlFile:
                    MetadataFile metadataFile = new MetadataFile(file);
                    break;

                case ImportFileType.Projection:
                    ProjectionFile projectionFile = new ProjectionFile(file);
                    break;

                case ImportFileType.Attribute:
                    //AttributeFile attributeFile = new AttributeFile(file);
                    break;

                case ImportFileType.Index:
                    //IndexFile indexFile = new IndexFile(file);
                    break;

                case ImportFileType.Shape:
                    //ShapeFile shapeFile = new ShapeFile(file);
                    //Console.Write($"\rShapeFile Inserted: {shapeFile.Name}\t\t\t\t\t");
                    break;

                case ImportFileType.GeocodingIndex:
                case ImportFileType.ODBGeocodingIndex:
                    throw new NotImplementedException(
                              "We currently do not handle the processing of Geocoding Indexes or ODB Geocoding indexes. (We make our own in SQL Server)");

                case ImportFileType.XmlSchema:
                    Console.WriteLine(
                        $"\rNo data is contained within {file.Name}. This application generates and utilizes it's own schema XML schema documentation. No actions performed with this file.");
                    break;

                default:
                    throw new NotImplementedException(
                              $"{file.Extension} is not a supported file type. Extensions must match the ESRI Shapefile specifications.");
                }
            }
            catch (Exception e)
            {
                Console.WriteLine($"\r\n{e.Message}\r\n{e}");
                throw;
            }
        }
Exemplo n.º 28
0
 public string GetFileName(ImportFileType importFileType)
 {
     return(fileNames[(int)importFileType]);
 }
Exemplo n.º 29
0
        public DialogResult ShowDialog(string filePath, string searchDir, ImportError error, ImportFileType fileType, bool criticalError)
        {
            bool isUrl = filePath.ToLower().StartsWith("http");

            findInFolderBtn.Visible       = !isUrl;
            folderDialog.InitialDirectory = searchDir;

            string fileTypeString = fileType == ImportFileType.Note ? "Note" : "Audio";

            if (error == ImportError.Missing)
            {
                errorLabel.Text = $"{fileTypeString} file missing: ";
            }
            else
            {
                errorLabel.Text = $"Invalid {fileTypeString.ToLower()} file format: ";
            }

            cancelBtn.Text  = criticalError ? "Cancel" : "Ignore";
            filePathTb.Text = filePath;
            FilePath        = filePath;

            if (isUrl)
            {
                fileDialog.InitialDirectory = searchDir;
                fileDialog.FileName         = "";
            }
            else
            {
                fileDialog.InitialDirectory = Path.GetDirectoryName(FilePath);
                fileDialog.FileName         = FilePath;
            }
            return(base.ShowDialog());
        }
Exemplo n.º 30
0
        private void convertToBinFileButton_Click(object sender, EventArgs e)
        {
            //Are we using PVR or BMP?
            importFileType = bmpRadioButton.Checked ? ImportFileType.PNG : ImportFileType.PVR;

            ImportErrorLabel.Text   = String.Empty;
            ImportSuccessLabel.Text = String.Empty;

            if (String.IsNullOrEmpty(ExportedBinOutputDirectoryTextBox.Text))
            {
                ImportErrorLabel.Text = "Please enter an output directory for the .bin file";
                return;
            }

            if (String.IsNullOrEmpty(FilesToImportDirectory.Text))
            {
                ImportErrorLabel.Text = "Please enter a directory for where the ." + importFileType.ToString() + " file(s) are located";
                return;
            }

            //If using bitmaps, make sure a config file exists
            PVRConfig config = null;

            if (importFileType == ImportFileType.PNG)
            {
                try
                {
                    config = new PVRConfig();
                    config.Load(FilesToImportDirectory.Text + "/" + Preferences.PVR_CONFIG_FILENAME);
                }
                catch
                {
                    ImportErrorLabel.Text = "Cannot find the file \"" + Preferences.PVR_CONFIG_FILENAME + "\". Please locate it";
                    return;
                }
            }

            int    numFiles = 0;
            String outFile  = null;

            JSR.Character character = JSR.Character.Gum;
            JSR.Stage     stage     = JSR.Stage.ShibuyaArea3Part1;

            if (Mode == TextureModderMode.Character)
            {
                CharacterTexture sc;
                try
                {
                    sc = textures.characterTextures.Where(ct => ct.GetName() == comboBox1.Text).First();
                }
                catch (Exception ex)
                {
                    ImportErrorLabel.Text = "Please select a character";
                    return;
                }
                numFiles  = sc.GetNumPvrFiles();
                outFile   = sc.GetFileName();
                character = sc.GetCharacter();
            }
            else if (Mode == TextureModderMode.Stage)
            {
                StageTexture ss;
                try
                {
                    ss = textures.StageTextures.Where(st => st.GetName() == comboBox1.Text).First();
                }
                catch (Exception ex)
                {
                    ImportErrorLabel.Text = "Please select a stage";
                    return;
                }
                numFiles = ss.GetNumPvrFiles();
                outFile  = ss.GetFileName();
                stage    = ss.GetStage();
            }

            //Find the RIPPED_X files
            List <List <Byte> > pvrData = new List <List <Byte> >();

            try
            {
                for (int i = 0; i < numFiles; i++)
                {
                    if (importFileType == ImportFileType.PVR)
                    {
                        pvrData.Add(new List <Byte>());
                        pvrData[i].AddRange(System.IO.File.ReadAllBytes(FilesToImportDirectory.Text + "/RIPPED_" + i + ".pvr"));
                        Console.WriteLine("Added RIPPED_" + i + ".pvr");
                    }
                    else if (importFileType == ImportFileType.PNG)
                    {
                        //Load the bitmap - if the png file doesn't exist, the decode may have failed so we need to hunt for the PVR File
                        Bitmap bitmap;
                        try
                        {
                            bitmap = (Bitmap)Bitmap.FromFile(FilesToImportDirectory.Text + "/RIPPED_" + i + ".png");
                        }
                        catch (System.IO.FileNotFoundException)
                        {
                            //Look for PVR
                            pvrData.Add(new List <Byte>());
                            pvrData[i].AddRange(System.IO.File.ReadAllBytes(FilesToImportDirectory.Text + "/RIPPED_" + i + ".pvr"));
                            Console.WriteLine("Added RIPPED_" + i + ".pvr");
                            continue;
                        }
                        var data = config.Get(i);

                        //Bit of a hack, but run pvrconv from command line, saves PVR importing having to be done
                        //First convert png to bmp
                        var adjustedDepthBitmap = new Bitmap(bitmap.Width, bitmap.Height, System.Drawing.Imaging.PixelFormat.Format24bppRgb);
                        using (Graphics g = Graphics.FromImage(adjustedDepthBitmap))
                        {
                            g.DrawImage(bitmap, new Rectangle(0, 0, adjustedDepthBitmap.Width, adjustedDepthBitmap.Height));
                            adjustedDepthBitmap.Save(FilesToImportDirectory.Text + "/RIPPED_" + i + ".bmp", ImageFormat.Bmp);
                        }

                        //Get the location of pvrconv
                        String exeLoc = "\"" + (Preferences.PVR_CONV_EXE_LOCATION == String.Empty ? String.Empty : Preferences.PVR_CONV_EXE_LOCATION + "/");
                        exeLoc += "pvrconv.exe\"";

                        var cmd = data.ToPVRConvFlags() + " \"" + FilesToImportDirectory.Text + "/RIPPED_" + i + ".bmp\"";

                        var process = new System.Diagnostics.Process();
                        process.StartInfo.FileName  = exeLoc;
                        process.StartInfo.Arguments = cmd;
                        process.Start();
                        process.WaitForExit();
                        Console.WriteLine("Added RIPPED_" + i + ".png");

                        //Add PVR file data
                        pvrData.Add(new List <Byte>());
                        pvrData[i].AddRange(System.IO.File.ReadAllBytes(FilesToImportDirectory.Text + "/RIPPED_" + i + ".pvr"));
                        Console.WriteLine("Added RIPPED_" + i + ".pvr");

                        //Clean up files
                        System.IO.File.Delete(FilesToImportDirectory.Text + "/RIPPED_" + i + ".bmp");
                        System.IO.File.Delete(FilesToImportDirectory.Text + "/RIPPED_" + i + ".pvr");
                    }
                }
            }
            catch (Exception ex)
            {
                ImportErrorLabel.Text = ex.Message;
                return;
            }

            try
            {
                if (Mode == TextureModderMode.Character)
                {
                    System.IO.File.WriteAllBytes(ExportedBinOutputDirectoryTextBox.Text + "/" + outFile, JSReverse.JSR.PVRToBin(character, pvrData));
                }
                else if (Mode == TextureModderMode.Stage)
                {
                    System.IO.File.WriteAllBytes(ExportedBinOutputDirectoryTextBox.Text + "/" + outFile, JSReverse.JSR.PVRToTXP(stage, pvrData));
                }
            }
            catch (Exception ex)
            {
                ImportErrorLabel.Text = ex.Message;
                return;
            }

            ImportSuccessLabel.Text = "Success!";
        }
Exemplo n.º 31
0
 public SantanderTransactionProcessor(ImportFileType importFileType, IEtlRepository etlRepository)
 {
     _importFileType    = importFileType;
     _etlRepository     = etlRepository;
     _transactionReader = new SantanderTransactionReader(new SantanderTransactionMapper(importFileType.ColumnDelimiter));
 }
Exemplo n.º 32
0
 private void ImportDescriptorFile(ImportFileType importFileType)
 {
     OpenFileDialog ofd = new OpenFileDialog();
     ofd.Filter = "AS2 documents|*.as2";
     if (importFileType == ImportFileType.A2L) ofd.Filter = "A2L documents|*.a2l";
     else if (importFileType == ImportFileType.CSV) ofd.Filter = "CSV documents|*.csv";
     else if (importFileType == ImportFileType.Damos) ofd.Filter = "Damos documents|*.dam";
     else if (importFileType == ImportFileType.XML) ofd.Filter = "XML documents|*.xml";
     ofd.Multiselect = false;
     if (ofd.ShowDialog() == DialogResult.OK)
     {
         TryToLoadAdditionalSymbols(ofd.FileName, importFileType, Tools.Instance.m_symbols, false);
         gridControl1.DataSource = Tools.Instance.m_symbols;
         gridControl1.RefreshDataSource();
         SaveAdditionalSymbols();
     }
 }
Exemplo n.º 33
0
 private void TryToLoadAdditionalSymbols(string filename, ImportFileType importFileType, SymbolCollection symbolCollection, bool fromRepository)
 {
     if (importFileType == ImportFileType.XML)
     {
         ImportXMLFile(filename, symbolCollection, fromRepository);
     }
     else if (importFileType == ImportFileType.AS2)
     {
         TryToLoadAdditionalAS2Symbols(filename, symbolCollection);
     }
     else if (importFileType == ImportFileType.CSV)
     {
         TryToLoadAdditionalCSVSymbols(filename, symbolCollection);
     }
 }
Exemplo n.º 34
0
 public string GetFileName(ImportFileType importFileType)
 {
     return fileNames[(int)importFileType];
 }
 /// <summary>
 /// Informs browser which type of records will be contained inside import file.
 /// </summary>
 /// <param name="type"></param>
 /// <returns></returns>
 public ImportFileCommand Containing(ImportFileType type)
 {
     fileType = type;
     return this;
 }