├── Example
├── Quark.unityexport.unitypackage
└── Quark.unitypacker.unitypackage
├── LICENSE
├── README.md
└── Source
├── .gitignore
├── ICSharpCode.SharpZipLib.dll
├── LibPack
├── LibPack.csproj
├── Properties
│ └── AssemblyInfo.cs
├── UnityPacker.cs
└── packages.config
├── UnityPack
├── Program.cs
├── Properties
│ └── AssemblyInfo.cs
└── UnityPacker.csproj
├── UnityPacker.sln
└── UnityUnpack
├── Program.cs
├── Properties
└── AssemblyInfo.cs
└── UnityUnpack.csproj
/Example/Quark.unityexport.unitypackage:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FatihBAKIR/UnityPacker/e04bb6c676828fb3dcabb704b86e449ce3d236af/Example/Quark.unityexport.unitypackage
--------------------------------------------------------------------------------
/Example/Quark.unitypacker.unitypackage:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FatihBAKIR/UnityPacker/e04bb6c676828fb3dcabb704b86e449ce3d236af/Example/Quark.unitypacker.unitypackage
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2015-2017 Fatih BAKIR
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
23 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # UnityPacker
2 |
3 | UnityPacker is a collection of a library and small command line tools that can create, unpack and inspect `UnityPackage` files without a Unity installation. It is great for automated builds of Unity tools.
4 |
5 | Usage is very simple:
6 |
7 | ./UnityPack *directory to pack* *destination pack name*
8 | ./UnityUnpack *pack name* *directory to unpack to*
9 |
10 | For example:
11 |
12 | ./UnityPack . Package
13 |
14 | Will produce a `Package.unitypackage` from the contents current directory recursively in the current directory.
15 |
16 | ./UnityUnpack Package.unitypackage .
17 |
18 | Will unpack the `Package.unitypackage` to the working directory, with proper directory structure.
19 |
20 | + When used with `respectMeta` option, packer will maintain prefab components
21 | and even complete scenes if they are included in the directory.
22 |
23 | + It will maintain meta files through packing and unpacking. You can include a meta file generated by unity.
24 | If no meta file exists for a file, it will be automatically generated.
25 |
26 | + It can omit more using the `extensions` option.
27 |
28 | + It can omit whole directories with the `directories` option.
29 |
30 | + Sizes of the packages exported from Unity itself and UnityPacker are usually the same.
31 |
32 | # Full usage
33 |
34 | ./UnityPack . MyAssets Assets/MyAssets "gitignore,md,exe,dll" ".git"
35 |
36 | Such a run will create a file called `MyAssets.unitypackage` with the contents of this directory,
37 | omitting files with extensions `gitignore, md, exe, dll` and the directory `.git`. When imported
38 | by unity, all files will be put in `MyAssets` folder in project. The path starts from unity project
39 | root, so if it doesn't start with `Assets/` it won't show up in the editor!
40 |
41 | ./UnityUnpack MyAssets.unitypackage .
42 |
43 | Such a run will extract the contents of the unitypackage with proper directory structure to
44 | the working directory.
45 |
46 | *Was tested on Unity 2017.2.0f3 and 5.5 with packages from both Mac and Linux hosts.*
47 |
--------------------------------------------------------------------------------
/Source/.gitignore:
--------------------------------------------------------------------------------
1 | ## Ignore Visual Studio temporary files, build results, and
2 | ## files generated by popular Visual Studio add-ons.
3 |
4 | # User-specific files
5 | *.suo
6 | *.user
7 | *.userosscache
8 | *.sln.docstates
9 |
10 | # User-specific files (MonoDevelop/Xamarin Studio)
11 | *.userprefs
12 |
13 | # Build results
14 | [Dd]ebug/
15 | [Dd]ebugPublic/
16 | [Rr]elease/
17 | [Rr]eleases/
18 | x64/
19 | x86/
20 | build/
21 | bld/
22 | [Bb]in/
23 | [Oo]bj/
24 |
25 | # Visual Studio 2015 cache/options directory
26 | .vs/
27 |
28 | # MSTest test Results
29 | [Tt]est[Rr]esult*/
30 | [Bb]uild[Ll]og.*
31 |
32 | # NUNIT
33 | *.VisualState.xml
34 | TestResult.xml
35 |
36 | # Build Results of an ATL Project
37 | [Dd]ebugPS/
38 | [Rr]eleasePS/
39 | dlldata.c
40 |
41 | # DNX
42 | project.lock.json
43 | artifacts/
44 |
45 | *_i.c
46 | *_p.c
47 | *_i.h
48 | *.ilk
49 | *.meta
50 | *.obj
51 | *.pch
52 | *.pdb
53 | *.pgc
54 | *.pgd
55 | *.rsp
56 | *.sbr
57 | *.tlb
58 | *.tli
59 | *.tlh
60 | *.tmp
61 | *.tmp_proj
62 | *.log
63 | *.vspscc
64 | *.vssscc
65 | .builds
66 | *.pidb
67 | *.svclog
68 | *.scc
69 |
70 | # Chutzpah Test files
71 | _Chutzpah*
72 |
73 | # Visual C++ cache files
74 | ipch/
75 | *.aps
76 | *.ncb
77 | *.opensdf
78 | *.sdf
79 | *.cachefile
80 |
81 | # Visual Studio profiler
82 | *.psess
83 | *.vsp
84 | *.vspx
85 |
86 | # TFS 2012 Local Workspace
87 | $tf/
88 |
89 | # Guidance Automation Toolkit
90 | *.gpState
91 |
92 | # ReSharper is a .NET coding add-in
93 | _ReSharper*/
94 | *.[Rr]e[Ss]harper
95 | *.DotSettings.user
96 |
97 | # JustCode is a .NET coding add-in
98 | .JustCode
99 |
100 | # TeamCity is a build add-in
101 | _TeamCity*
102 |
103 | # DotCover is a Code Coverage Tool
104 | *.dotCover
105 |
106 | # NCrunch
107 | _NCrunch_*
108 | .*crunch*.local.xml
109 |
110 | # MightyMoose
111 | *.mm.*
112 | AutoTest.Net/
113 |
114 | # Web workbench (sass)
115 | .sass-cache/
116 |
117 | # Installshield output folder
118 | [Ee]xpress/
119 |
120 | # DocProject is a documentation generator add-in
121 | DocProject/buildhelp/
122 | DocProject/Help/*.HxT
123 | DocProject/Help/*.HxC
124 | DocProject/Help/*.hhc
125 | DocProject/Help/*.hhk
126 | DocProject/Help/*.hhp
127 | DocProject/Help/Html2
128 | DocProject/Help/html
129 |
130 | # Click-Once directory
131 | publish/
132 |
133 | # Publish Web Output
134 | *.[Pp]ublish.xml
135 | *.azurePubxml
136 | # TODO: Comment the next line if you want to checkin your web deploy settings
137 | # but database connection strings (with potential passwords) will be unencrypted
138 | *.pubxml
139 | *.publishproj
140 |
141 | # NuGet Packages
142 | *.nupkg
143 | # The packages folder can be ignored because of Package Restore
144 | **/packages/*
145 | # except build/, which is used as an MSBuild target.
146 | !**/packages/build/
147 | # Uncomment if necessary however generally it will be regenerated when needed
148 | #!**/packages/repositories.config
149 |
150 | # Windows Azure Build Output
151 | csx/
152 | *.build.csdef
153 |
154 | # Windows Store app package directory
155 | AppPackages/
156 |
157 | # Visual Studio cache files
158 | # files ending in .cache can be ignored
159 | *.[Cc]ache
160 | # but keep track of directories ending in .cache
161 | !*.[Cc]ache/
162 |
163 | # Others
164 | ClientBin/
165 | [Ss]tyle[Cc]op.*
166 | ~$*
167 | *~
168 | *.dbmdl
169 | *.dbproj.schemaview
170 | *.pfx
171 | *.publishsettings
172 | node_modules/
173 | orleans.codegen.cs
174 |
175 | # RIA/Silverlight projects
176 | Generated_Code/
177 |
178 | # Backup & report files from converting an old project file
179 | # to a newer Visual Studio version. Backup files are not needed,
180 | # because we have git ;-)
181 | _UpgradeReport_Files/
182 | Backup*/
183 | UpgradeLog*.XML
184 | UpgradeLog*.htm
185 |
186 | # SQL Server files
187 | *.mdf
188 | *.ldf
189 |
190 | # Business Intelligence projects
191 | *.rdl.data
192 | *.bim.layout
193 | *.bim_*.settings
194 |
195 | # Microsoft Fakes
196 | FakesAssemblies/
197 |
198 | # Node.js Tools for Visual Studio
199 | .ntvs_analysis.dat
200 |
201 | # Visual Studio 6 build log
202 | *.plg
203 |
204 | # Visual Studio 6 workspace options file
205 | *.opt
206 | .idea
207 |
--------------------------------------------------------------------------------
/Source/ICSharpCode.SharpZipLib.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FatihBAKIR/UnityPacker/e04bb6c676828fb3dcabb704b86e449ce3d236af/Source/ICSharpCode.SharpZipLib.dll
--------------------------------------------------------------------------------
/Source/LibPack/LibPack.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {64B390F7-C794-478E-BBE2-203A69A35CC6}
8 | {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
9 | Library
10 | Properties
11 | UnityPacker
12 | LibPack
13 | v2.0
14 | 512
15 |
16 |
17 | AnyCPU
18 | true
19 | full
20 | false
21 | bin\Debug\
22 | DEBUG;TRACE
23 | prompt
24 | 4
25 |
26 |
27 | AnyCPU
28 | pdbonly
29 | true
30 | bin\Release\
31 | TRACE
32 | prompt
33 | 4
34 |
35 |
36 |
37 | ..\ICSharpCode.SharpZipLib.dll
38 |
39 |
40 |
41 |
42 |
43 |
44 | ..\packages\YamlDotNet.4.2.3-pre0454\lib\net35\YamlDotNet.dll
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
62 |
--------------------------------------------------------------------------------
/Source/LibPack/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("LibPack")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("LibPack")]
13 | [assembly: AssemblyCopyright("Copyright © 2017")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("64B390F7-C794-478E-BBE2-203A69A35CC6")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
--------------------------------------------------------------------------------
/Source/LibPack/UnityPacker.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections;
3 | using System.Collections.Generic;
4 | using System.IO;
5 | using System.Linq;
6 | using System.Security.Cryptography;
7 | using System.Text;
8 | using ICSharpCode.SharpZipLib.GZip;
9 | using ICSharpCode.SharpZipLib.Tar;
10 | using YamlDotNet.RepresentationModel;
11 |
12 | namespace UnityPacker
13 | {
14 | public class OnDiskFile
15 | {
16 | private readonly string _diskPath;
17 | private readonly YamlMappingNode _meta;
18 |
19 | public string PackPath { get; }
20 |
21 | public OnDiskFile(string packPath, string diskPath, YamlMappingNode meta)
22 | {
23 | PackPath = packPath;
24 | _diskPath = diskPath;
25 | _meta = meta;
26 | }
27 |
28 | public string GetDiskPath()
29 | {
30 | return _diskPath;
31 | }
32 |
33 | public Stream GetFile()
34 | {
35 | return File.Open(_diskPath, FileMode.Open, FileAccess.Read);
36 | }
37 |
38 | public YamlMappingNode GetMeta()
39 | {
40 | return _meta;
41 | }
42 |
43 | public string GetHash()
44 | {
45 | return ((YamlScalarNode) _meta["guid"]).Value;
46 | }
47 | }
48 |
49 | internal static class RandomUtils
50 | {
51 | static string CreateMd5(string input)
52 | {
53 | var md5 = MD5.Create();
54 | var inputBytes = Encoding.ASCII.GetBytes(input);
55 | var hashBytes = md5.ComputeHash(inputBytes);
56 |
57 | var sb = new StringBuilder();
58 | foreach (byte t in hashBytes)
59 | {
60 | sb.Append(t.ToString("X2"));
61 | }
62 | return sb.ToString();
63 | }
64 |
65 | static readonly Random r = new Random();
66 |
67 | public static string RandomString(int len = 32)
68 | {
69 | var c = "";
70 | for (int i = 0; i < len; i++)
71 | {
72 | c += r.Next(0, 128);
73 | }
74 | return c;
75 | }
76 |
77 | public static string RandomHash()
78 | {
79 | return CreateMd5(RandomString()).ToLower();
80 | }
81 | }
82 |
83 | public class Package : IEnumerable>
84 | {
85 | private readonly string _name;
86 | private readonly Dictionary _files = new Dictionary();
87 |
88 | ///
89 | /// Creates an empty package with the given name
90 | ///
91 | /// name of the package
92 | public Package(string name)
93 | {
94 | _name = name;
95 | }
96 |
97 | ///
98 | /// Adds the given file on disk to this package
99 | ///
100 | /// The file to be added
101 | public void PushFile(OnDiskFile file)
102 | {
103 | _files.Add(file.PackPath, file);
104 | }
105 |
106 | public OnDiskFile GetFile(string path)
107 | {
108 | return _files[path];
109 | }
110 |
111 | ///
112 | /// Generates a .unitypackage file from this package
113 | ///
114 | /// Root directory name, usually starts with Assets/
115 | public void GeneratePackage(string root = "Assets/")
116 | {
117 | var tmpPath = Path.Combine(Path.GetTempPath(), "packUnity" + _name);
118 | if (Directory.Exists(tmpPath))
119 | {
120 | Directory.Delete(tmpPath, true);
121 | }
122 | Directory.CreateDirectory(tmpPath);
123 |
124 | foreach (var file in _files)
125 | {
126 | /*
127 | * For every file there exists a directory named file.guid in the tar archive that looks like:
128 | * + /asset -> actual asset data
129 | * + /asset.meta -> meta file
130 | * + /pathname -> actual path in the package
131 | *
132 | * There can be more files such as preview but are optional.
133 | */
134 |
135 | string fdirpath = Path.Combine(tmpPath, file.Value.GetHash());
136 | Directory.CreateDirectory(fdirpath);
137 |
138 | File.Copy(file.Value.GetDiskPath(), Path.Combine(fdirpath, "asset")); // copy to asset file
139 |
140 | using (StreamWriter writer = new StreamWriter(Path.Combine(fdirpath, "pathname"))) // the pathname file
141 | {
142 | var altName = file.Value.GetDiskPath();
143 | if (altName.StartsWith("."))
144 | altName = altName.Replace("." + Path.DirectorySeparatorChar, "");
145 |
146 | writer.Write(root + altName.Replace(Path.DirectorySeparatorChar + "", "/"));
147 | }
148 | using (StreamWriter writer = new StreamWriter(Path.Combine(fdirpath, "asset.meta"))) // the meta file
149 | {
150 | var doc = new YamlDocument(file.Value.GetMeta());
151 | var ys = new YamlStream(doc);
152 | ys.Save(writer);
153 | }
154 | var fi = new FileInfo(Path.Combine(fdirpath, "asset.meta"));
155 | using (var fs = fi.Open(FileMode.Open))
156 | {
157 | fs.SetLength(fi.Length - 3 - Environment.NewLine.Length);
158 | }
159 | }
160 |
161 | CreateTarGZ(_name + ".unitypackage", tmpPath);
162 | Directory.Delete(tmpPath, true);
163 | }
164 |
165 | static YamlMappingNode ReadMeta(string file)
166 | {
167 | using (var read = new StreamReader(file))
168 | {
169 | var metaYaml = new YamlStream();
170 | metaYaml.Load(read);
171 | return (YamlMappingNode) metaYaml.Documents[0].RootNode;
172 | }
173 | }
174 |
175 | ///
176 | /// Creates a Package object from the given directory
177 | ///
178 | /// Directory to pack
179 | /// Name of the package
180 | /// Whether metadata files should be kept or not
181 | /// Extensions to omit
182 | /// Directories to omit
183 | ///
184 | public static Package FromDirectory(string dir, string packName, bool respectMeta, string[] omitExts,
185 | string[] omitDirs)
186 | {
187 | var files = Directory.GetFiles(dir, "*.*", SearchOption.AllDirectories);
188 |
189 | // Create a package object from the given directory
190 | var pack = new Package(packName);
191 |
192 | foreach (var file in files)
193 | {
194 | var altName = file;
195 | if (file.StartsWith("."))
196 | altName = file.Replace("." + Path.DirectorySeparatorChar, "");
197 |
198 | var skip = omitDirs.Any(d => altName.StartsWith(d)); // if the filename starts with any skipped dirname
199 |
200 | var extension = Path.GetExtension(file).Replace(".", "");
201 | if (skip || omitExts.Contains(extension))
202 | continue;
203 |
204 | var meta = new YamlMappingNode
205 | {
206 | {"guid", RandomUtils.RandomHash()},
207 | {"fileFormatVersion", "2"}
208 | };
209 | if (respectMeta && File.Exists(file + ".meta"))
210 | {
211 | var metaFile = file + ".meta";
212 | meta = ReadMeta(metaFile);
213 | }
214 |
215 | var f = new OnDiskFile(file, file, meta);
216 | pack.PushFile(f);
217 | }
218 |
219 | return pack;
220 | }
221 |
222 | public static Package FromPackage(string pathToPack)
223 | {
224 | Stream inStream = File.Open(pathToPack, FileMode.Open, FileAccess.Read);
225 | Stream gziStream = new GZipInputStream(inStream);
226 | TarArchive ar = TarArchive.CreateInputTarArchive(gziStream);
227 |
228 | var name = Path.GetFileNameWithoutExtension(pathToPack);
229 |
230 | var tmpPath = Path.Combine(Path.GetTempPath(), "packUnity" + name);
231 | if (Directory.Exists(tmpPath))
232 | {
233 | Directory.Delete(tmpPath, true);
234 | }
235 |
236 | ar.ExtractContents(tmpPath);
237 | ar.Close();
238 | gziStream.Close();
239 | inStream.Close();
240 |
241 | var dirs = Directory.GetDirectories(tmpPath);
242 |
243 | var pack = new Package(name);
244 | foreach (var dir in dirs)
245 | {
246 | var assetPath = File.ReadAllText(Path.Combine(dir, "pathname"));
247 | var meta = ReadMeta(Path.Combine(dir, "asset.meta"));
248 | var diskPath = Path.Combine(dir, "asset");
249 | var guid = Path.GetFileName(dir);
250 | if (((YamlScalarNode) meta["guid"]).Value != guid)
251 | {
252 | using (var stderr = new StreamWriter(Console.OpenStandardError()))
253 | {
254 | stderr.WriteLine("Erroneous File In Package! {0}, {1}", assetPath, guid);
255 | }
256 | continue;
257 | }
258 | var file = new OnDiskFile(assetPath, diskPath, meta);
259 | pack.PushFile(file);
260 | }
261 |
262 | return pack;
263 | }
264 |
265 | ///
266 | /// Creates a folder from this package with the correct structure
267 | ///
268 | public void GenerateFolder(string to = "")
269 | {
270 | foreach (var file in this)
271 | {
272 | var outPath = Path.Combine(to, file.Value.PackPath);
273 | var metaPath = outPath + ".meta";
274 | Directory.CreateDirectory(Path.GetDirectoryName(outPath));
275 | File.Copy(file.Value.GetDiskPath(), outPath);
276 | using (var writer = new StreamWriter(metaPath)) // the meta file
277 | {
278 | var doc = new YamlDocument(file.Value.GetMeta());
279 | var ys = new YamlStream(doc);
280 | ys.Save(writer);
281 | }
282 | var fi = new FileInfo(metaPath);
283 | using (var fs = fi.Open(FileMode.Open))
284 | {
285 | fs.SetLength(fi.Length - 3 - Environment.NewLine.Length);
286 | }
287 | }
288 | }
289 |
290 | private static void CreateTarGZ(string tgzFilename, string sourceDirectory)
291 | {
292 | Stream outStream = File.Create(tgzFilename);
293 | Stream gzoStream = new GZipOutputStream(outStream);
294 | TarArchive tarArchive = TarArchive.CreateOutputTarArchive(gzoStream);
295 |
296 | tarArchive.RootPath = sourceDirectory.Replace('\\', '/');
297 | if (tarArchive.RootPath.EndsWith("/"))
298 | tarArchive.RootPath = tarArchive.RootPath.Remove(tarArchive.RootPath.Length - 1);
299 |
300 | AddDirectoryFilesToTar(tarArchive, sourceDirectory, true);
301 |
302 | tarArchive.Close();
303 | }
304 |
305 | private static void AddDirectoryFilesToTar(TarArchive tarArchive, string sourceDirectory, bool recurse)
306 | {
307 | var filenames = Directory.GetFiles(sourceDirectory);
308 | foreach (var filename in filenames)
309 | {
310 | var tarEntry = TarEntry.CreateEntryFromFile(filename);
311 | tarEntry.Name = filename.Remove(0, tarArchive.RootPath.Length + 1);
312 | tarArchive.WriteEntry(tarEntry, true);
313 | }
314 |
315 | if (!recurse) return;
316 |
317 | var directories = Directory.GetDirectories(sourceDirectory);
318 | foreach (var directory in directories)
319 | {
320 | AddDirectoryFilesToTar(tarArchive, directory, true);
321 | }
322 | }
323 |
324 | public IEnumerator> GetEnumerator()
325 | {
326 | return _files.GetEnumerator();
327 | }
328 |
329 | IEnumerator IEnumerable.GetEnumerator()
330 | {
331 | return GetEnumerator();
332 | }
333 | }
334 | }
--------------------------------------------------------------------------------
/Source/LibPack/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/Source/UnityPack/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | namespace UnityPacker
5 | {
6 | class PackProgram
7 | {
8 | static void Main(string[] args)
9 | {
10 | if (args.Length < 2)
11 | {
12 | Console.WriteLine("Usage:");
13 | Console.WriteLine(
14 | "UnityPacker [Source Path] [Package Name] [Respect Meta] [Omitted Extensions] [Omitted Directories]");
15 | return;
16 | }
17 |
18 | var inpath = args[0];
19 | var fileName = args.Length > 1 ? args[1] : "Package";
20 | var rootDir = args.Length > 2 ? args[2] : "Assets/";
21 | var exts = args.Length > 3 ? args[3].Split(',') : new string[0];
22 | var dirs = args.Length > 4 ? args[4].Split(',') : new string[0];
23 |
24 | var extensions = new List(exts)
25 | {
26 | "meta" // always skip meta files
27 | };
28 |
29 | // Create a package object from the given directory
30 | var pack = Package.FromDirectory(inpath, fileName, true, extensions.ToArray(), dirs);
31 | pack.GeneratePackage(rootDir);
32 | }
33 | }
34 | }
--------------------------------------------------------------------------------
/Source/UnityPack/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("UnityPack")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("UnityPack")]
13 | [assembly: AssemblyCopyright("Copyright © 2015")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("f6bbb979-6ad7-4886-9d4d-1fbb7c6bf88e")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/Source/UnityPack/UnityPacker.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {765AC4AF-8B5F-455F-8D4D-4DA1EA4C442E}
8 | Exe
9 | Properties
10 | UnityPacker
11 | UnityPack
12 | v4.0
13 | 512
14 |
15 |
16 | AnyCPU
17 | true
18 | full
19 | false
20 | bin\Debug\
21 | DEBUG;TRACE
22 | prompt
23 | 4
24 |
25 |
26 | AnyCPU
27 | pdbonly
28 | true
29 | bin\Release\
30 | TRACE
31 | prompt
32 | 4
33 |
34 |
35 |
36 |
37 |
38 |
39 | ..\packages\YamlDotNet.4.2.3-pre0454\lib\net35\YamlDotNet.dll
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 | {64b390f7-c794-478e-bbe2-203a69a35cc6}
49 | LibPack
50 |
51 |
52 |
53 |
60 |
--------------------------------------------------------------------------------
/Source/UnityPacker.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 2013
4 | VisualStudioVersion = 12.0.31101.0
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnityPacker", "UnityPack\UnityPacker.csproj", "{765AC4AF-8B5F-455F-8D4D-4DA1EA4C442E}"
7 | EndProject
8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LibPack", "LibPack\LibPack.csproj", "{64B390F7-C794-478E-BBE2-203A69A35CC6}"
9 | EndProject
10 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnityUnpack", "UnityUnpack\UnityUnpack.csproj", "{B5D4485F-8F27-4BE2-AD65-051169ED9453}"
11 | EndProject
12 | Global
13 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
14 | Debug|Any CPU = Debug|Any CPU
15 | Release|Any CPU = Release|Any CPU
16 | EndGlobalSection
17 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
18 | {765AC4AF-8B5F-455F-8D4D-4DA1EA4C442E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
19 | {765AC4AF-8B5F-455F-8D4D-4DA1EA4C442E}.Debug|Any CPU.Build.0 = Debug|Any CPU
20 | {765AC4AF-8B5F-455F-8D4D-4DA1EA4C442E}.Release|Any CPU.ActiveCfg = Release|Any CPU
21 | {765AC4AF-8B5F-455F-8D4D-4DA1EA4C442E}.Release|Any CPU.Build.0 = Release|Any CPU
22 | {64B390F7-C794-478E-BBE2-203A69A35CC6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
23 | {64B390F7-C794-478E-BBE2-203A69A35CC6}.Debug|Any CPU.Build.0 = Debug|Any CPU
24 | {64B390F7-C794-478E-BBE2-203A69A35CC6}.Release|Any CPU.ActiveCfg = Release|Any CPU
25 | {64B390F7-C794-478E-BBE2-203A69A35CC6}.Release|Any CPU.Build.0 = Release|Any CPU
26 | {B5D4485F-8F27-4BE2-AD65-051169ED9453}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
27 | {B5D4485F-8F27-4BE2-AD65-051169ED9453}.Debug|Any CPU.Build.0 = Debug|Any CPU
28 | {B5D4485F-8F27-4BE2-AD65-051169ED9453}.Release|Any CPU.ActiveCfg = Release|Any CPU
29 | {B5D4485F-8F27-4BE2-AD65-051169ED9453}.Release|Any CPU.Build.0 = Release|Any CPU
30 | EndGlobalSection
31 | GlobalSection(SolutionProperties) = preSolution
32 | HideSolutionNode = FALSE
33 | EndGlobalSection
34 | EndGlobal
35 |
--------------------------------------------------------------------------------
/Source/UnityUnpack/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | namespace UnityPacker
5 | {
6 | internal class UnpackProgram
7 | {
8 | public static void Main(string[] args)
9 | {
10 | var p = Package.FromPackage(args[0]);
11 | p.GenerateFolder(args.Length > 0 ? args[1] : "");
12 | }
13 | }
14 | }
--------------------------------------------------------------------------------
/Source/UnityUnpack/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("UnityUnpack")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("UnityUnpack")]
13 | [assembly: AssemblyCopyright("Copyright © 2017")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("B5D4485F-8F27-4BE2-AD65-051169ED9453")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
--------------------------------------------------------------------------------
/Source/UnityUnpack/UnityUnpack.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {B5D4485F-8F27-4BE2-AD65-051169ED9453}
8 | {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
9 | Exe
10 | Properties
11 | UnityPacker
12 | UnityUnpack
13 | v4.5
14 | 512
15 |
16 |
17 | AnyCPU
18 | true
19 | full
20 | false
21 | bin\Debug\
22 | DEBUG;TRACE
23 | prompt
24 | 4
25 |
26 |
27 | AnyCPU
28 | pdbonly
29 | true
30 | bin\Release\
31 | TRACE
32 | prompt
33 | 4
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 | {64b390f7-c794-478e-bbe2-203a69a35cc6}
50 | LibPack
51 |
52 |
53 |
54 |
61 |
--------------------------------------------------------------------------------