Ejemplo n.º 1
0
        private async Task WriteFilter(Filter baseFilter, bool isGeneratingStylesAndSeed, string outputFolder = null)
        {
            if (File.Exists(outputFolder + "RESULTS.zip"))
            {
                File.Delete(outputFolder + "RESULTS.zip");
            }

            var oldSeedVersion = baseFilter.GetHeaderMetaData("version:");
            var newVersion     = LocalConfiguration.GetInstance().YieldConfiguration().First(x => x.Key == "Version Number").Value;

            if (oldSeedVersion == newVersion)
            {
                var isStopping = !InfoPopUpMessageDisplay.DisplayQuestionMessageBox("Error: \n\nVersion did not change!\nDo you want to continue the filter generation?");
                if (isStopping)
                {
                    return;
                }
            }
            else
            {
                baseFilter.SetHeaderMetaData("version:", newVersion);
            }

            await FilterWriter.WriteFilter(baseFilter, isGeneratingStylesAndSeed, outputFolder, Configuration.AppSettings["StyleSheet Folder"]);
        }
Ejemplo n.º 2
0
        public SlnWriter(FilterWriter filterWriter, string namespaceName)
        {
            this.filterWriter = filterWriter;
            this.namespaceName = namespaceName;

            X64 = true;
        }
Ejemplo n.º 3
0
        public void Run(FileRequestResult dataRes)
        {
            if (dataRes != FileRequestResult.Success)
            {
                PublishPrice = false;
            }

            var filterOutFolder = Path.GetTempPath() + "filterGenerationResult";
            var repoFolder      = filterOutFolder + "\\" + RepoName;

            LoggingFacade.LogInfo($"Tempfolder prepared");

            if (!Directory.Exists(filterOutFolder))
            {
                Directory.CreateDirectory(filterOutFolder);
            }

            // clone/pull the repo. after that, we will edit these existing files by generating the new versions
            // and push the update as the actual small changes.
            if (Directory.Exists(repoFolder))
            {
                LoggingFacade.LogInfo($"Repo folder existing... pulling");
                RunCommand(filterOutFolder, "git", "branch --set-upstream-to=origin/master master");
                using (var repo = new Repository(repoFolder))
                {
                    var options = new PullOptions();
                    var author  = Environment.GetEnvironmentVariable("author", EnvironmentVariableTarget.Process) ?? "FilterPolishZ";
                    var email   = Environment.GetEnvironmentVariable("email", EnvironmentVariableTarget.Process) ?? "FilterPolishZ";
                    Commands.Pull(repo, new Signature(author, email, DateTimeOffset.Now), options);
                    LoggingFacade.LogInfo($"Pulling done");
                }
            }
            else
            {
                LoggingFacade.LogInfo($"Repo folder not existing... cloning");
                Repository.Clone("https://github.com/NeverSinkDev/" + RepoName + ".git", repoFolder);
                LoggingFacade.LogInfo($"Cloning done!");
            }

            // create filter
            LoggingFacade.LogInfo($"Performing filter generation operations");
            FilterWriter.WriteFilter(this.Filter, true, repoFolder + "\\", Path.GetDirectoryName(GenerateFilters.DataFiles.FilterStyleFilesPaths.First().Value) + "\\");
            LoggingFacade.LogInfo($"Performing filter generation operations: DONE");

            LoggingFacade.LogInfo($"Starting publishing!");

            PushToFTP("www", repoFolder, "NeverSink_AutoEcoUpdate_" + GenerateFilters.DataFiles.LeagueType);
            LoggingFacade.LogInfo($"Publishing to filterblade: done");

            PushToFTP("beta", repoFolder, "NeverSink_AutoEcoUpdate_" + GenerateFilters.DataFiles.LeagueType);
            LoggingFacade.LogInfo($"Publishing to filterblade-beta: done");

            PushToGit(repoFolder, PublishPrice);
            LoggingFacade.LogInfo($"Publishing to GitHub: done");

            UploadToPoe(repoFolder);
            LoggingFacade.LogInfo($"PoeUpload: done");

            // no cleanUp -> we keep this folder here and just pull/push whenever we generate new filters
        }
Ejemplo n.º 4
0
        protected void WriteFilter <T>(T filter, byte[] etalon) where T : BaseFilter
        {
            var mem          = new MemoryStream();
            var writer       = new SwfStreamWriter(mem);
            var actionWriter = new FilterWriter();

            actionWriter.Write(writer, filter);
            var buffer = mem.ToArray();

            Assert.AreEqual(etalon, buffer);
        }
Ejemplo n.º 5
0
        public void Init(FileRequestResult dataRes)
        {
            if (dataRes != FileRequestResult.Success)
            {
                PublishPrice = false;
            }

            var filterOutFolder = Path.GetTempPath() + "filterGenerationResult";
            var repoFolder      = filterOutFolder + "\\" + RepoName;

            this.RepoFolder = repoFolder;

            LoggingFacade.LogInfo($"Tempfolder prepared");

            if (!Directory.Exists(filterOutFolder))
            {
                Directory.CreateDirectory(filterOutFolder);
            }

            // clone/pull the repo. after that, we will edit these existing files by generating the new versions
            // and push the update as the actual small changes.
            if (Directory.Exists(repoFolder))
            {
                LoggingFacade.LogInfo($"Repo folder existing... renewing");
                DeleteDirectory(repoFolder);
//                RunCommand(filterOutFolder, "git", "branch --set-upstream-to=origin/master master");
//                using (var repo = new Repository(repoFolder))
//                {
//                    var options = new PullOptions();
//                    var author = Environment.GetEnvironmentVariable("author", EnvironmentVariableTarget.Process) ?? "FilterPolishZ";
//                    var email = Environment.GetEnvironmentVariable("email", EnvironmentVariableTarget.Process) ?? "FilterPolishZ";
//                    Commands.Pull(repo, new Signature(author, email, DateTimeOffset.Now), options);
//                    LoggingFacade.LogInfo($"Pulling done");
//                }
            }

            {
                LoggingFacade.LogInfo($"Repo folder not existing... cloning");
                Repository.Clone("https://github.com/NeverSinkDev/" + RepoName + ".git", repoFolder);
                LoggingFacade.LogInfo($"Cloning done!");
            }

            // create filter
            LoggingFacade.LogInfo($"Performing filter generation operations");
            var filterWriter = FilterWriter.WriteFilter(this.Filter, true, repoFolder + "\\", Path.GetDirectoryName(MainGenerationRoutine.DataFiles.FilterStyleFilesPaths.First().Value) + "\\");

            filterWriter.Wait();

            LoggingFacade.LogInfo($"Performing filter generation operations: DONE");

            LoggingFacade.LogInfo($"Repofolder is: {RepoFolder}");
        }
        private static Filter ConvertStreamToFilter(Stream stream)
        {
            using var memoryStream = new MemoryStream();
            stream.CopyTo(memoryStream);

            var byteArray = memoryStream.ToArray();

            var memoryFilter = new MemoryFilter(byteArray.Length, false);

            using var filterWriter = new FilterWriter(memoryFilter);

            filterWriter.WriteBuffer(byteArray);
            memoryFilter.SetAsInputFilter();

            return(memoryFilter);
        }
Ejemplo n.º 7
0
        public void Run()
        {
            var repoName        = "NeverSink-EconomyUpdated-Filter";
            var filterOutFolder = Path.GetTempPath() + "filterGenerationResult";
            var repoFolder      = filterOutFolder + "\\" + repoName;

            if (!Directory.Exists(filterOutFolder))
            {
                Directory.CreateDirectory(filterOutFolder);
            }

            if (Directory.Exists(repoFolder))
            {
                DeleteDirectory(repoFolder);
            }
            Repository.Clone("https://github.com/NeverSinkDev/" + repoName + ".git", repoFolder);

            // create filter
            FilterWriter.WriteFilter(this.Filter, false, repoFolder, null);

            var author   = Environment.GetEnvironmentVariable("author", EnvironmentVariableTarget.Process) ?? "FilterPolishZ";
            var email    = Environment.GetEnvironmentVariable("email", EnvironmentVariableTarget.Process) ?? "FilterPolishZ";
            var gitToken = Environment.GetEnvironmentVariable("githubPAT", EnvironmentVariableTarget.Process);

            Signature sig       = new Signature(author, email, DateTime.Now);
            Signature committer = sig;

            using (var repo = new Repository(repoFolder))
            {
                Commands.Stage(repo, "*");
                Commit commit = repo.Commit("automated economy update " + DateTime.Today.ToString(), sig, committer);

                LibGit2Sharp.PushOptions options = new LibGit2Sharp.PushOptions();
                options.CredentialsProvider = new CredentialsHandler(
                    (url, usernameFromUrl, types) =>
                    new UsernamePasswordCredentials()
                {
                    Username = author,
                    Password = gitToken
                });
                repo.Network.Push(repo.Branches["master"], options);
            }

            // cleanUp
            DeleteDirectory(repoFolder);
        }
Ejemplo n.º 8
0
        static void OutputSolution(TargetVS targetVS, DotNetParser parser)
        {
            string targetVersionString;
            switch (targetVS)
            {
                case TargetVS.VS2008:
                    targetVersionString = "2008";
                    break;
                case TargetVS.VS2010:
                    targetVersionString = "2010";
                    break;
                case TargetVS.VS2012:
                    targetVersionString = "2012";
                    break;
                case TargetVS.VS2013:
                    targetVersionString = "2013";
                    break;
                case TargetVS.VS2015:
                    targetVersionString = "2015";
                    break;
                default:
                    throw new NotImplementedException();
            }

            string slnRelDir = (targetVS == TargetVS.VS2010) ? "" : "..\\";
            string rootFolder = slnRelDir + "src\\";

            var confs = new List<ProjectConfiguration>
            {
                new ProjectConfiguration("Axiom", true, "GRAPHICS_AXIOM",
                    slnRelDir + "..\\Axiom-SDK-0.8.3376.12322\\bin\\Net35"),
                new ProjectConfiguration("Axiom", false, "GRAPHICS_AXIOM",
                    slnRelDir + "..\\Axiom-SDK-0.8.3376.12322\\bin\\Net35"),
                new ProjectConfiguration("Generic", true, "GRAPHICS_GENERIC"),
                new ProjectConfiguration("Generic", false, "GRAPHICS_GENERIC"),
                new ProjectConfiguration("Mogre", true, "GRAPHICS_MOGRE", "C:\\MogreSDK\\bin\\Debug"),
                new ProjectConfiguration("Mogre", false, "GRAPHICS_MOGRE", "C:\\MogreSDK\\bin\\Release")
            };
            if (targetVS != TargetVS.VS2008)
            {
                confs.Add(new ProjectConfiguration("MonoGame", true, "GRAPHICS_MONOGAME", "$(ProgramFiles)\\MonoGame\\v3.0\\Assemblies\\WindowsGL\\;$(ProgramFiles(x86))\\MonoGame\\v3.0\\Assemblies\\WindowsGL\\"));
                confs.Add(new ProjectConfiguration("MonoGame", false, "GRAPHICS_MONOGAME", "$(ProgramFiles)\\MonoGame\\v3.0\\Assemblies\\WindowsGL\\;$(ProgramFiles(x86))\\MonoGame\\v3.0\\Assemblies\\WindowsGL\\"));
            }
            if (targetVS != TargetVS.VS2008 && targetVS != TargetVS.VS2010)
            {
                confs.Add(new ProjectConfiguration("Numerics", true, "GRAPHICS_NUMERICS"));
                confs.Add(new ProjectConfiguration("Numerics", false, "GRAPHICS_NUMERICS"));
            }
            if (targetVS == TargetVS.VS2008)
            {
                confs.Add(new ProjectConfiguration("OpenTK", true, "GRAPHICS_OPENTK", "$(USERPROFILE)\\My Documents\\OpenTK\\1.1\\Binaries\\OpenTK\\Release"));
                confs.Add(new ProjectConfiguration("OpenTK", false, "GRAPHICS_OPENTK", "$(USERPROFILE)\\My Documents\\OpenTK\\1.1\\Binaries\\OpenTK\\Release"));
                confs.Add(new ProjectConfiguration("SharpDX", true, "GRAPHICS_SHARPDX", slnRelDir + "..\\SharpDX\\Bin\\DirectX11-net20"));
                confs.Add(new ProjectConfiguration("SharpDX", false, "GRAPHICS_SHARPDX", slnRelDir + "..\\SharpDX\\Bin\\DirectX11-net20"));
                confs.Add(new ProjectConfiguration("SharpDX Signed", true, "GRAPHICS_SHARPDX", slnRelDir + "..\\SharpDX\\Bin\\DirectX11-Signed-net20"));
                confs.Add(new ProjectConfiguration("SharpDX Signed", false, "GRAPHICS_SHARPDX", slnRelDir + "..\\SharpDX\\Bin\\DirectX11-Signed-net20"));
                confs.Add(new ProjectConfiguration("SlimDX", true, "GRAPHICS_SLIMDX", "$(PROGRAMFILES)\\SlimDX SDK (January 2012)\\Bin\\net20\\;$(PROGRAMFILES(x86))\\SlimDX SDK (June 2010)\\Bin\\net20\\"));
                confs.Add(new ProjectConfiguration("SlimDX", false, "GRAPHICS_SLIMDX", "$(PROGRAMFILES)\\SlimDX SDK (January 2012)\\Bin\\net20\\;$(PROGRAMFILES(x86))\\SlimDX SDK (June 2010)\\Bin\\net20\\"));
            }
            else
            {
                confs.Add(new ProjectConfiguration("OpenTK", true, "GRAPHICS_OPENTK")
                {
                    ConditionalRef = "OpenTK",
                    ConditionalRefAssembly = "OpenTK, Version=1.1.0.0, Culture=neutral, PublicKeyToken=bad199fe84eb3df4"
                });
                confs.Add(new ProjectConfiguration("OpenTK", false, "GRAPHICS_OPENTK")
                {
                    ConditionalRef = "OpenTK",
                    ConditionalRefAssembly = "OpenTK, Version=1.1.0.0, Culture=neutral, PublicKeyToken=bad199fe84eb3df4"
                });
                confs.Add(new ProjectConfiguration("SharpDX", true, "GRAPHICS_SHARPDX", slnRelDir + "..\\SharpDX\\Bin\\DirectX11-net40"));
                confs.Add(new ProjectConfiguration("SharpDX", false, "GRAPHICS_SHARPDX", slnRelDir + "..\\SharpDX\\Bin\\DirectX11-net40"));
                confs.Add(new ProjectConfiguration("SharpDX Signed", true, "GRAPHICS_SHARPDX", slnRelDir + "..\\SharpDX\\Bin\\DirectX11-Signed-net40"));
                confs.Add(new ProjectConfiguration("SharpDX Signed", false, "GRAPHICS_SHARPDX", slnRelDir + "..\\SharpDX\\Bin\\DirectX11-Signed-net40"));
                confs.Add(new ProjectConfiguration("SlimDX", true, "GRAPHICS_SLIMDX", "$(PROGRAMFILES)\\SlimDX SDK (January 2012)\\Bin\\net40\\;$(PROGRAMFILES(x86))\\SlimDX SDK (June 2010)\\Bin\\net40\\"));
                confs.Add(new ProjectConfiguration("SlimDX", false, "GRAPHICS_SLIMDX", "$(PROGRAMFILES)\\SlimDX SDK (January 2012)\\Bin\\net40\\;$(PROGRAMFILES(x86))\\SlimDX SDK (June 2010)\\Bin\\net40\\"));
            }
            //confs.Add(new ProjectConfiguration("SlimMath", true, "GRAPHICS_SLIMMATH", slnRelDir + "..\\SlimMath\\SlimMath\\bin\\Release"));
            //confs.Add(new ProjectConfiguration("SlimMath", false, "GRAPHICS_SLIMMATH", slnRelDir + "..\\SlimMath\\SlimMath\\bin\\Debug"));
            if (targetVS != TargetVS.VS2008)
            {
                confs.Add(new ProjectConfiguration("Windows API Code Pack", true, "GRAPHICS_WAPICODEPACK", slnRelDir + "..\\Windows API Code Pack 1.1\\binaries\\DirectX"));
                confs.Add(new ProjectConfiguration("Windows API Code Pack", false, "GRAPHICS_WAPICODEPACK", slnRelDir + "..\\Windows API Code Pack 1.1\\binaries\\DirectX"));
            }
            /*
            confs.Add(new ProjectConfiguration("XNA 3.1", true, "GRAPHICS_XNA31", "$(ProgramFiles)\\Microsoft XNA\\XNA Game Studio\\v3.1\\References\\Windows\\x86\\;$(ProgramFiles(x86))\\Microsoft XNA\\XNA Game Studio\\v3.1\\References\\Windows\\x86\\"));
            confs.Add(new ProjectConfiguration("XNA 3.1", false, "GRAPHICS_XNA31", "$(ProgramFiles)\\Microsoft XNA\\XNA Game Studio\\v3.1\\References\\Windows\\x86\\;$(ProgramFiles(x86))\\Microsoft XNA\\XNA Game Studio\\v3.1\\References\\Windows\\x86\\"));
            if (targetVS != TargetVS.VS2008)
            {
                confs.Add(new ProjectConfiguration("XNA 4.0", true, "GRAPHICS_XNA40", "$(ProgramFiles)\\Microsoft XNA\\XNA Game Studio\\v4.0\\References\\Windows\\x86\\;$(ProgramFiles(x86))\\Microsoft XNA\\XNA Game Studio\\v4.0\\References\\Windows\\x86\\"));
                confs.Add(new ProjectConfiguration("XNA 4.0", false, "GRAPHICS_XNA40", "$(ProgramFiles)\\Microsoft XNA\\XNA Game Studio\\v4.0\\References\\Windows\\x86\\;$(ProgramFiles(x86))\\Microsoft XNA\\XNA Game Studio\\v4.0\\References\\Windows\\x86\\"));
            }
            */

            var project = parser.Project;
            var filterWriter = new FilterWriter(project.NamespaceName);
            var sourceFilter = new Filter("Source Files", "4FC737F1-C7A5-4376-A066-2A32D752A2FF", "cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx");
            var headerFilter = new Filter("Header Files", "93995380-89BD-4b04-88EB-625FBE52EBFB", "h;hh;hpp;hxx;hm;inl;inc;xsd");
            var resourceFilter = new Filter("Resource Files", "67DA6AB6-F800-4c08-8B7A-83BB121AAD01", "rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms");
            filterWriter.RootFilter.Add(sourceFilter);
            filterWriter.RootFilter.Add(headerFilter);
            filterWriter.RootFilter.Add(resourceFilter);

            sourceFilter.AddFile("", rootFolder + "Stdafx");
            sourceFilter.AddFile("", rootFolder + "AssemblyInfo");
            sourceFilter.AddFile("", rootFolder + "Collections");
            sourceFilter.AddFile("", rootFolder + "Math");
            sourceFilter.AddFile("", rootFolder + "StringConv");
            sourceFilter.AddFile("", rootFolder + "DataStream");
            sourceFilter.AddFile("", rootFolder + "Matrix");
            sourceFilter.AddFile("", rootFolder + "Quaternion");
            sourceFilter.AddFile("", rootFolder + "Utilities");
            sourceFilter.AddFile("", rootFolder + "Vector3");
            sourceFilter.AddFile("", rootFolder + "Vector4");

            headerFilter.AddFile("", rootFolder + "Stdafx");
            headerFilter.AddFile("", rootFolder + "Collections");
            headerFilter.AddFile("", rootFolder + "Enums");
            headerFilter.AddFile("", rootFolder + "ITrackingDisposable");
            headerFilter.AddFile("", rootFolder + "Math");
            headerFilter.AddFile("", rootFolder + "StringConv");
            headerFilter.AddFile("", rootFolder + "Version");
            headerFilter.AddFile("", rootFolder + "DataStream");
            headerFilter.AddFile("", rootFolder + "Matrix");
            headerFilter.AddFile("", rootFolder + "Quaternion");
            headerFilter.AddFile("", rootFolder + "Utilities");
            headerFilter.AddFile("", rootFolder + "Vector3");
            headerFilter.AddFile("", rootFolder + "Vector4");

            foreach (ManagedHeader header in parser.Headers.Values)
            {
                if (header.Classes.Count == 0) continue;

                sourceFilter.AddFile(header.Native.Filename, rootFolder + header.Name);
                headerFilter.AddFile(header.Native.Filename, rootFolder + header.Name);
            }

            sourceFilter.AddFile("BulletCollision/CollisionDispatch/", rootFolder + "InternalEdgeUtility");
            sourceFilter.AddFile("BulletCollision/CollisionShapes/", rootFolder + "BulletMaterial");
            sourceFilter.AddFile("BulletCollision/NarrowPhaseCollision/", rootFolder + "SimplexSolverInterface");
            sourceFilter.AddFile("LinearMath/", rootFolder + "DebugDraw");
            sourceFilter.AddFile("SoftBody/", rootFolder + "SoftBodySolver");
            headerFilter.AddFile("BulletCollision/CollisionDispatch/", rootFolder + "InternalEdgeUtility");
            headerFilter.AddFile("BulletCollision/CollisionShapes/", rootFolder + "BulletMaterial");
            headerFilter.AddFile("BulletCollision/NarrowPhaseCollision/", rootFolder + "SimplexSolverInterface");
            headerFilter.AddFile("LinearMath/", rootFolder + "DebugDraw");
            headerFilter.AddFile("BulletDynamics/Character/", rootFolder + "ICharacterController");
            headerFilter.AddFile("LinearMath/", rootFolder + "IDebugDraw");
            headerFilter.AddFile("SoftBody/", rootFolder + "SoftBodySolver");

            resourceFilter.AddFile("", rootFolder + "Resources.rc");

            filterWriter.RootFilter.Sort();

            string bulletRoot = "..\\bullet3";

            /*
            foreach (string sourceRootFolder in project.SourceRootFolders)
            {
                string sourceRootFolderRel = WrapperProject.MakeRelativePath(project.ProjectFilePath, sourceRootFolder);
                sourceRootFolderRel.ToString();
            }
            */

            var slnWriter = new SlnWriter(filterWriter, project.NamespaceName)
            {
                IncludeDirectories = string.Format("{0}\\src;{0}\\Extras\\HACD;{0}\\Extras\\Serialize\\BulletWorldImporter;{0}\\Extras\\Serialize\\BulletXmlWorldImporter;", slnRelDir + bulletRoot),
                FilterWriter = filterWriter
            };
            if (targetVS == TargetVS.VS2008)
            {
                slnWriter.LibraryDirectoriesRelease = slnRelDir + bulletRoot + "\\msvc\\2008\\lib\\MinSizeRel";
                slnWriter.LibraryDirectoriesDebug = slnRelDir + bulletRoot + "\\msvc\\2008\\lib\\Debug";
            }
            else
            {
                slnWriter.LibraryDirectoriesRelease = slnRelDir + bulletRoot + "\\msvc\\" + targetVersionString + "\\lib\\MinSizeRel;";
                slnWriter.LibraryDirectoriesDebug = slnRelDir + bulletRoot + "\\msvc\\" + targetVersionString + "\\lib\\Debug;";
            }
            slnWriter.Output(targetVS, confs, "sln" + targetVersionString);
        }
        /// <summary>
        /// Saves the filters.
        /// </summary>
        /// <param name="path">The path.</param>
        public void SaveFilters(string path)
        {
            /*			using (TextWriter writer = new StreamWriter("test.xml"))
            {
                System.Xml.Serialization.XmlSerializer x = new System.Xml.Serialization.XmlSerializer(this.GetType());
                x.Serialize(writer, this);
            }*/
            using (FilterWriter writer = new FilterWriter(path))
            {
                try
                {
                    // Clone list of filters to avoid multithreading problems
                    ArrayList allFilters = null;
                    lock (m_filters.SyncRoot)
                    {
                        allFilters = (ArrayList)m_filters.Clone();
                    }

                    // Copy data
                    writer.CombineFilters	= CombineFilters;
                    writer.InvertCheck		= InvertCheck;

                    // Save all active filters
                    writer.ProcessHeader();
                    writer.WriteFilters(allFilters);
                    writer.ProcessEpilogue();
                }
                catch(Exception e)
                {
                    Log.Error("Saving filters", e);
                }
            }
        }
Ejemplo n.º 10
0
 private async Task WriteFilter(Filter baseFilter, bool isGeneratingStylesAndSeed, string outputFolder = null)
 {
     await FilterWriter.WriteFilter(baseFilter, isGeneratingStylesAndSeed, outputFolder);
 }