-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
coverts to legacy modcsv in the buildzone() also created zone_source dir is not existing
- Loading branch information
Showing
3 changed files
with
69 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
using EasyZoneBuilder.Core.Interfaces; | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using System.Text; | ||
|
||
namespace EasyZoneBuilder.Core | ||
{ | ||
public class LegacyModCSV : Dictionary<string, AssetType>, IFileInfo, ISync | ||
{ | ||
public LegacyModCSV( FileInfo File ) | ||
{ | ||
this.File = File; | ||
if ( File.Exists ) | ||
{ | ||
Pull(); | ||
} | ||
} | ||
|
||
public LegacyModCSV( ModCSV csv ) | ||
{ | ||
foreach ( KeyValuePair<string, ModCSV.EntryInfomation> entry in csv ) | ||
{ | ||
this[ entry.Key ] = entry.Value.AssetType; | ||
} | ||
} | ||
|
||
public FileInfo File { get; private set; } | ||
|
||
public void Pull() | ||
{ | ||
if ( !File.Exists ) | ||
{ | ||
Push(); | ||
} | ||
this.Clear(); | ||
foreach ( string line in System.IO.File.ReadAllLines(this.File.FullName) ) | ||
{ | ||
string[] splitLine = line.Split(new char[] { ',' }, System.StringSplitOptions.RemoveEmptyEntries); | ||
this[ splitLine[ 1 ].Trim() ] = AssetTypeUtil.Parse(splitLine[ 0 ].Trim()); | ||
} | ||
} | ||
|
||
public void Push() | ||
{ | ||
StringBuilder sb = new StringBuilder(); | ||
foreach ( KeyValuePair<string, AssetType> item in this ) | ||
{ | ||
sb.AppendLine($"{item.Value},{item.Key}"); | ||
} | ||
System.IO.File.WriteAllText(File.FullName, sb.ToString()); | ||
} | ||
|
||
public TempFileCopy TempCopy( FileInfo destination ) | ||
{ | ||
return new TempFileCopy(this.File, destination); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters