Skip to content

Commit b7dd597

Browse files
author
Justin
committed
Init Push
1 parent e775874 commit b7dd597

7 files changed

+398
-0
lines changed

FastDL Generator.sln

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio 15
4+
VisualStudioVersion = 15.0.27703.2035
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FastDL Generator", "FastDL Generator\FastDL Generator.csproj", "{ECB18800-DA3D-406B-8469-59E49DE9B9EC}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|Any CPU = Debug|Any CPU
11+
Release|Any CPU = Release|Any CPU
12+
test|Any CPU = test|Any CPU
13+
EndGlobalSection
14+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
15+
{ECB18800-DA3D-406B-8469-59E49DE9B9EC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
16+
{ECB18800-DA3D-406B-8469-59E49DE9B9EC}.Debug|Any CPU.Build.0 = Debug|Any CPU
17+
{ECB18800-DA3D-406B-8469-59E49DE9B9EC}.Release|Any CPU.ActiveCfg = Release|Any CPU
18+
{ECB18800-DA3D-406B-8469-59E49DE9B9EC}.Release|Any CPU.Build.0 = Release|Any CPU
19+
{ECB18800-DA3D-406B-8469-59E49DE9B9EC}.test|Any CPU.ActiveCfg = Release|Any CPU
20+
{ECB18800-DA3D-406B-8469-59E49DE9B9EC}.test|Any CPU.Build.0 = Release|Any CPU
21+
EndGlobalSection
22+
GlobalSection(SolutionProperties) = preSolution
23+
HideSolutionNode = FALSE
24+
EndGlobalSection
25+
GlobalSection(ExtensibilityGlobals) = postSolution
26+
SolutionGuid = {45ECC465-C9E7-48BC-832D-593F2D16248A}
27+
EndGlobalSection
28+
EndGlobal

FastDL Generator/App.config

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<configuration>
3+
<startup>
4+
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
5+
</startup>
6+
</configuration>
+106
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
4+
<PropertyGroup>
5+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
6+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
7+
<ProjectGuid>{ECB18800-DA3D-406B-8469-59E49DE9B9EC}</ProjectGuid>
8+
<OutputType>Exe</OutputType>
9+
<RootNamespace>FastDL_Generator</RootNamespace>
10+
<AssemblyName>FastDL Generator</AssemblyName>
11+
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
12+
<FileAlignment>512</FileAlignment>
13+
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
14+
<IsWebBootstrapper>false</IsWebBootstrapper>
15+
<PublishUrl>C:\Users\JustinK\Desktop\FastDLGen\</PublishUrl>
16+
<Install>false</Install>
17+
<InstallFrom>Disk</InstallFrom>
18+
<UpdateEnabled>true</UpdateEnabled>
19+
<UpdateMode>Foreground</UpdateMode>
20+
<UpdateInterval>7</UpdateInterval>
21+
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
22+
<UpdatePeriodically>false</UpdatePeriodically>
23+
<UpdateRequired>false</UpdateRequired>
24+
<MapFileExtensions>true</MapFileExtensions>
25+
<CreateWebPageOnPublish>true</CreateWebPageOnPublish>
26+
<WebPage>publish.htm</WebPage>
27+
<ApplicationRevision>2</ApplicationRevision>
28+
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
29+
<UseApplicationTrust>false</UseApplicationTrust>
30+
<PublishWizardCompleted>true</PublishWizardCompleted>
31+
<BootstrapperEnabled>true</BootstrapperEnabled>
32+
</PropertyGroup>
33+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
34+
<PlatformTarget>AnyCPU</PlatformTarget>
35+
<DebugSymbols>true</DebugSymbols>
36+
<DebugType>full</DebugType>
37+
<Optimize>true</Optimize>
38+
<OutputPath>bin\Debug\</OutputPath>
39+
<DefineConstants>DEBUG;TRACE</DefineConstants>
40+
<ErrorReport>prompt</ErrorReport>
41+
<WarningLevel>4</WarningLevel>
42+
</PropertyGroup>
43+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
44+
<PlatformTarget>AnyCPU</PlatformTarget>
45+
<DebugType>pdbonly</DebugType>
46+
<Optimize>true</Optimize>
47+
<OutputPath>bin\Release\</OutputPath>
48+
<DefineConstants>TRACE</DefineConstants>
49+
<ErrorReport>prompt</ErrorReport>
50+
<WarningLevel>4</WarningLevel>
51+
</PropertyGroup>
52+
<PropertyGroup>
53+
<ManifestCertificateThumbprint>6888C0EABE4B20F1AFFA98FB6AB3E6DF42D2665D</ManifestCertificateThumbprint>
54+
</PropertyGroup>
55+
<PropertyGroup>
56+
<ManifestKeyFile>FastDL Generator_TemporaryKey.pfx</ManifestKeyFile>
57+
</PropertyGroup>
58+
<PropertyGroup>
59+
<GenerateManifests>true</GenerateManifests>
60+
</PropertyGroup>
61+
<PropertyGroup>
62+
<SignManifests>false</SignManifests>
63+
</PropertyGroup>
64+
<PropertyGroup>
65+
<TargetZone>LocalIntranet</TargetZone>
66+
</PropertyGroup>
67+
<PropertyGroup>
68+
<ApplicationManifest>Properties\app.manifest</ApplicationManifest>
69+
</PropertyGroup>
70+
<ItemGroup>
71+
<Reference Include="ICSharpCode.SharpZipLib, Version=0.86.0.518, Culture=neutral, PublicKeyToken=1b03e6acf1164f73, processorArchitecture=MSIL">
72+
<HintPath>..\packages\SharpZipLib.0.86.0\lib\20\ICSharpCode.SharpZipLib.dll</HintPath>
73+
</Reference>
74+
<Reference Include="System" />
75+
<Reference Include="System.Core" />
76+
<Reference Include="System.Xml.Linq" />
77+
<Reference Include="System.Data.DataSetExtensions" />
78+
<Reference Include="Microsoft.CSharp" />
79+
<Reference Include="System.Data" />
80+
<Reference Include="System.Net.Http" />
81+
<Reference Include="System.Xml" />
82+
</ItemGroup>
83+
<ItemGroup>
84+
<Compile Include="Program.cs" />
85+
<Compile Include="Properties\AssemblyInfo.cs" />
86+
</ItemGroup>
87+
<ItemGroup>
88+
<None Include="App.config" />
89+
<None Include="FastDL Generator_TemporaryKey.pfx" />
90+
<None Include="packages.config" />
91+
<None Include="Properties\app.manifest" />
92+
</ItemGroup>
93+
<ItemGroup>
94+
<BootstrapperPackage Include=".NETFramework,Version=v4.6.1">
95+
<Visible>False</Visible>
96+
<ProductName>Microsoft .NET Framework 4.6.1 %28x86 und x64%29</ProductName>
97+
<Install>true</Install>
98+
</BootstrapperPackage>
99+
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
100+
<Visible>False</Visible>
101+
<ProductName>.NET Framework 3.5 SP1</ProductName>
102+
<Install>false</Install>
103+
</BootstrapperPackage>
104+
</ItemGroup>
105+
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
106+
</Project>

FastDL Generator/Program.cs

+148
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.IO;
4+
using ICSharpCode.SharpZipLib.BZip2;
5+
6+
namespace FastDL_Generator
7+
{
8+
class Program
9+
{
10+
11+
public static void Main(string[] args)
12+
{
13+
Console.Title = "FastDL Generator";
14+
string[] FolderWhitelist = new string[] { "maps","cache", "gamemodes", "maps", "materials", "models", "particles", "resource", "sound" };
15+
string[] ZuSuchen = new string[] { "*.mdl", "*.vmt", "*.vtf", "*.wav", "*.mp3", "*.bsp", "*.ain", "*.dx80.vtx", "*.dx90.vtf", "*.phy", "*.sw.vtx", "*.vvd", "*.xbox.vtx", "*.png", "*.ttf", "*.pcf", "*.gif", "*.jpg"} ;
16+
string MainPath;
17+
try
18+
{
19+
MainPath = args[0];
20+
}
21+
catch (Exception)
22+
{
23+
Console.WriteLine("Bitte einen pfad angeben");
24+
return;
25+
}
26+
string copyPath = MainPath + "/../FastDL_Upload/";
27+
if(Directory.Exists(copyPath))
28+
{
29+
Directory.Delete(copyPath, true);
30+
}
31+
32+
if(!Directory.Exists(MainPath))
33+
{
34+
Console.WriteLine("der Angegebene Pfad existiert nicht: {0}",MainPath);
35+
return;
36+
}
37+
38+
39+
List<string> IndexedFiles = new List<string>();
40+
41+
for (int SearchIndex = 0; SearchIndex < ZuSuchen.Length; SearchIndex++)
42+
{
43+
for (int WhitelistCount = 0; WhitelistCount < FolderWhitelist.Length; WhitelistCount++)
44+
{
45+
string[] TestData = TreeScan(MainPath, FolderWhitelist[WhitelistCount], ZuSuchen[SearchIndex]);
46+
47+
for (int FileIndex = 0; FileIndex < TestData.Length; FileIndex++)
48+
{
49+
string EndFile = TestData[FileIndex].Substring(MainPath.Length+1).Replace('\\','/');
50+
IndexedFiles.Add(EndFile);
51+
52+
}
53+
}
54+
}
55+
56+
string FileData = "// fastdl.lua Erstellt mit dem FastDL generator von JustPlayerDE.\n" +
57+
"if (SERVER) then\n";
58+
foreach (var item in IndexedFiles)
59+
{
60+
Console.WriteLine("Kopiere > "+item);
61+
FileData = FileData + " resource.AddFile(\""+item+"\")\n";
62+
CopyFile(item, MainPath, copyPath);
63+
}
64+
65+
FileData = FileData + "end";
66+
File.WriteAllText(copyPath + "/fastdl.lua", FileData);
67+
int temp = 0;
68+
Console.Title = "Komprimiere Dateien...";
69+
foreach (var item in IndexedFiles)
70+
{
71+
temp++;
72+
Console.WriteLine("Komprimiere > "+item);
73+
Console.Title = "Komprimiere Datei "+temp+" / " + IndexedFiles.Count+"...";
74+
75+
BzipFile(copyPath + "/" + item);
76+
}
77+
78+
79+
Console.Title = "FERTIG";
80+
Console.WriteLine("Operation abgeschlossen.");
81+
82+
83+
}
84+
85+
86+
private static void CopyFile(string Filee,string oldFolder, string NewFolder)
87+
{
88+
string oldFile = oldFolder+"/"+ Filee;
89+
string newFile = NewFolder+"/"+ Filee;
90+
Directory.CreateDirectory(newFile);
91+
Directory.Delete(newFile); // hacky way
92+
try
93+
{
94+
File.Copy(oldFile, newFile);
95+
}
96+
catch (Exception)
97+
{
98+
Console.WriteLine("Fehler beim kopieren,\n" + oldFile + " >>> " + newFile);
99+
}
100+
}
101+
102+
private static string[] TreeScan(string mainDir,string GmodDir, string search)
103+
{
104+
string Path = mainDir + "/" + GmodDir+"/";
105+
if (Directory.Exists(Path))
106+
{
107+
return Directory.GetFiles(Path, search, SearchOption.AllDirectories);
108+
} else
109+
{
110+
return new string[] { };
111+
}
112+
}
113+
114+
private static bool BzipFile(string Path)
115+
{
116+
if(!File.Exists(Path))
117+
{
118+
return false;
119+
}
120+
FileInfo fileToBeZipped = new FileInfo(Path);
121+
FileInfo zipFileName = new FileInfo(string.Concat(fileToBeZipped.FullName, ".bz2"));
122+
using (FileStream fileToBeZippedAsStream = fileToBeZipped.OpenRead())
123+
{
124+
using (FileStream zipTargetAsStream = zipFileName.Create())
125+
{
126+
try
127+
{
128+
BZip2.Compress(fileToBeZippedAsStream, zipTargetAsStream, true, 4096);
129+
System.IO.File.Delete(Path);
130+
}
131+
catch (Exception ex)
132+
{
133+
Console.WriteLine(ex.Message);
134+
return false;
135+
}
136+
}
137+
}
138+
return true;
139+
}
140+
141+
private void BZip2Compress(string source)
142+
{
143+
string target = source + ".bz2";
144+
int blockSize = 4096;
145+
BZip2.Compress(File.OpenRead(source), File.Create(target), true, blockSize);
146+
}
147+
}
148+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
using System.Reflection;
2+
using System.Runtime.CompilerServices;
3+
using System.Runtime.InteropServices;
4+
5+
// Allgemeine Informationen über eine Assembly werden über die folgenden
6+
// Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern,
7+
// die einer Assembly zugeordnet sind.
8+
[assembly: AssemblyTitle("FastDL Generator")]
9+
[assembly: AssemblyDescription("")]
10+
[assembly: AssemblyConfiguration("")]
11+
[assembly: AssemblyCompany("")]
12+
[assembly: AssemblyProduct("FastDL Generator")]
13+
[assembly: AssemblyCopyright("Copyright © 2018")]
14+
[assembly: AssemblyTrademark("")]
15+
[assembly: AssemblyCulture("")]
16+
17+
// Durch Festlegen von ComVisible auf FALSE werden die Typen in dieser Assembly
18+
// für COM-Komponenten unsichtbar. Wenn Sie auf einen Typ in dieser Assembly von
19+
// COM aus zugreifen müssen, sollten Sie das ComVisible-Attribut für diesen Typ auf "True" festlegen.
20+
[assembly: ComVisible(false)]
21+
22+
// Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird
23+
[assembly: Guid("ecb18800-da3d-406b-8469-59e49de9b9ec")]
24+
25+
// Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten:
26+
//
27+
// Hauptversion
28+
// Nebenversion
29+
// Buildnummer
30+
// Revision
31+
//
32+
// Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden,
33+
// übernehmen, indem Sie "*" eingeben:
34+
// [assembly: AssemblyVersion("1.0.*")]
35+
[assembly: AssemblyVersion("1.0.0.0")]
36+
[assembly: AssemblyFileVersion("1.0.0.0")]

0 commit comments

Comments
 (0)