1

¿Es posible crear un archivo de configuración .cfg con este formato en lugar del XML que te permite crear Visual Studio?

[Settings]
  SeparatorChar = ";;"
  ColumnWidth = "003-030-005-015-004-030-030-050-003-050-020-002-010-030-010-030-030-010-007-002-050-015-002-002-010-000-000-000-000-000-000-000-000-000-000-000-000-000-000-000-000-000-000-000-"
  ExportColumns = "00-01-02-03-05-06-99-99-99-99-99-99-99-99-99-99-99-99-99-99-99-99-99-99-99-99-99-99-99-99-99-99-99-99-99-99-99-99-99-99-99-99-99-99-"
  ImportColumns = "99-99-99-99-99-99-99-99-99-99-99-99-99-99-99-99-00-00-00-00-00-00-00-00-00-00-00-00-00-00-"
  WidthColumn = "040-485-050-120-180-079-000-000-000-000-000-000-000-000-000-000-000-000-000-000-000-000-000-000-000-000-000-000-000-000-000-000-000-000-000-000-000-000-000-000-000-000-"
  MainColumns = "00-01-02-03-05-06-99-99-99-99-99-99-99-99-99-99-99-99-99-99-99-99-99-99-99-99-99-99-99-99-99-99-99-99-99-99-99-99-99-99-99-99-"
  ToolTipDelay = 500
  SimpleToolTips = 1
  ToolTipOnRightClick = 0
  ToolTipOnSelectedOnly = 1
  ShowToolTipsInBookShelf = 1
  SortInGroupsMode = 0
  UseGroupsWhenSortingIndexes = 0
  UseGroupsWhenSortingTitles = 1
  UseTBDbThumbnailAsMainThumbnail = 1
  UseTVDbPlotoutlineAsMainPlotOutline = 1
  TVDBLanguageId = 7
  LastRanVersion = 256
  UseRelativePathsForPlayingMovies = 0
  ShowLoanDuration = 1
  SortOnLoanDuration = 1
  ShowToolBar = 1
  Bookshelf = 1
  ShowMovieDetails = 0
  AutoBackup = 2
  Last Options Page = 0
  DontUpdateTitles = 1
  Dont Overwrite Covers = 1
  Only Query New Movies = 0
  MultipleIMDBResultsMode = 1
  PrintRowColor = 16247513
  UseColoredRowsForPrinting = 1
  LoanedLabelColor = 25600
  SeenLabelColor = 139
  ToolbarButtonColor = 16309445
  Labels Color = 8388608
  Selection Text Color = 0
  Selection Color = 55295
  Even Color = 15794160
  Glow Color = 0
  Odd Color = 16777215
  LastUsedExportFile = ""
  PrintFont = "Arial"
  LastUsedTemplate = 0
  PrintFontSize = 10
  OutputPath = ""
  DatabasePath = ""
  Prefixes = "The,A,De,Het"
  CreateHTMLPatchFolder = 0
  CreateHTMLPatchFrom = 0
  CustomJPEGQualityInHtmlExport = 90
  AddYearToTitleInHtmlExport = 1
  UseThumbnailsInHtmlExport = 1
  Include3DInHtmlExport = 1
  IncludeGenresInHtmlExport = 1
  CreateBackupWhenExportingHTML = 1
  UseCustomJPEGQualityInHtmlExport = 0
  RoundPersonalRatings = 1
  ShowNumberOfVotes = 1
  ShowRatings = 0
  ShowAKAinSearchResults = 0
  FixTitlePrefix = 0
  CheckForUpdates = 1
  NumberOfLatestAdditions = 10
  EnableLoanHistory = 1
  ShowHTMLResult = 1
  HTMLSortOrder = 1
  IncludeLatestAdditions = 1
  IncludeAllMovies = 1
  ShowExport = 1
  ImportMode = 0
  UseAddMovieDefaults = 1
  UseLastFilter = 0
  UseLastSort = 1
  Language = 5
  LastUsedFilter = 34
  SortDirection = 1
  SortColumn = 0
  OnlyUnseenRandom = 1
  BrowseUseCover = 1
  IgnoreDriveLetters = 1
  BrowseUseNFO = 1
  BrowsePosponeSelection = 1
  BrowseQueryIMDB = 1
  BrowseUseFirstEntry = 0
  BrowseRecursive = 1
  OverriddenGenres = "||||||||||||||||||||||||||||||||||"
  AlternativeTitleSearch = 0
  MatchWholeWordSearch = 0
  MatchCaseSearch = 1
  LastUsedTitleSearch = "Venganza"
  PlotOutlineLanguageTMDb = 0
  ShowSeasonInfoInTVSeriesNames = 1
  ShowCharacters = 1
  ShowTopAfterSorting = 0
  TMDbPlotOutlineFallback = 1
  ImportPlotOutlineTMDb = 0
  ImportThumbNailTMDb = 0
  ImportMovieTrailerTMDb = 0
  ImportMovieTrailer = 1
  TitleType = 1
  Import Thumbnail FreeCovers = 0
  Import Thumbnail MovieMeter = 0
  Import Thumbnail = 1
  CertificationCountry = "USA"
  ImportDuration = 1
  ImportLanguage = 1
  ImportCountry = 1
  ImportYear = 1
  ImportAwards = 1
  ImportCertification = 1
  ImportAlternativeTitle = 3
  ImportPlotOutline MovieMeter = 0
  ImportPlotOutline = 1
  ImportRating = 1
  ImportNrActors = 5
  ImportDirector = 1
  ImportGenres = 1
  UseActorsWithPictureFirst = 1
  ImportAspectRatio = 1
  ImportActorPhotos = 1
  ImportActors = 1
  ShowTVSeriesBoxes = 1
  MediaInfoPath = ""
  UseMediaInfo = 0
  IgnorePrefixOnTitleSort = 1
  CustomBackground = ""
  CustomBackgroundOffset = 0
  BookShelfStyle = 3
  DVDBOX_MARGIN = 6
  UseFixedGlowColors = 1
  ShowBluRayBoxes = 7
  BookshelfShowSeen = 1
  BookshelfShowLoaned = 1
  BookshelfShowTitles = 1
  BookshelfShowNumbers = 0
  NumberDisplayMode = 0
  ShowSeenMode = 0
  IgnoreKeywords = 1
  IgnoreKeywordsString = "Trailer"
  DefaultThumbnail = ""
  RenameMediaFormat = "%T (%C, %Y) %V %3"
  UseFolderName = 0
  RenameMediaAll = 0
  Renumber = 0
  EnableDelete = 0
  ProxyServer = ""
  PosterMode = 1
  UseProxy = 0
  Skin = ""
  ScreenFont = "Tahoma"
  ZoomFactor = 100
  DoubleClickMode = 0
  ScreenFontSize = 8
  ShowReservedPositions = 1
  SortSecondaryColumn = 1
  DeleteMediaFiles = 0
  NrLimitNumberOfMoviesToAdd = 10
  LimitNumberOfMoviesToAdd = 0
  CurrentDatabase = 0
  Databases = "*"
  cy = 665
  cx = 987
  y pos = 164
  x pos = 638
  WindowState = 0
  LastUsedSearchTab = 0
  LastSaved = "42584.825799"

  [Paths]
  BrowseHD = ""

  [Defaults]
  SoundLanguages = ""
  SoundTypes = ""
  Features = 0
  SeenOwnWishList = 0
  Region = 0
  System = 0
  SubtitleLanguages = ""
  Languages = ""
  Case = 0
  Media = 0
  Source = 0
  AspectRatio = 0
  Codec = 0
  Location = ""
  Resolution = "720×576 (PAL DVD)"

  [Custom Settings]
  CustomField2 = "Campo 2"
  CustomField1 = "Campo 1"
  Language 5 = ""
  Language 4 = ""
  Language 3 = ""
  Language 2 = ""
  Language 1 = ""
  Genre 5 = ""
  Genre 4 = ""
  Genre 3 = ""
  Genre 2 = ""
  Genre 1 = ""
1
  • La respuesta corta: sí.
    – NaCl
    Commented el 4 ago. 2016 a las 10:31

1 respuesta 1

0

Ese archivo .cfg que mencionas me suena a la estructura de un .ini

INI (extensión de archivo)

Si bien ese formato esta algo anticuado existen librerias que permiten trabajarlo

ini-parser

agregas la referencia usando nuget

Despues solo seria

var parser = new FileIniDataParser();
IniData data = parser.ReadFile("nombrefile.cfg");

string separatorChar = data["Settings"]["SeparatorChar"];

de esta forma tomas el valor y puedes escribir usando

data["Settings"]["SeparatorChar"] = ".";
parser.WriteFile("nombrefile.cfg", data);

Tu Respuesta

By clicking “Publica tu respuesta”, you agree to our terms of service and acknowledge you have read our privacy policy.

¿No es la respuesta que buscas? Examina otras preguntas con la etiqueta o formula tu propia pregunta.