예제 #1
0
 private static void AddPackage(string target, Package package, ReleaseFlags flags)
 {
     foreach (var element in package.Elements)
     {
         AddPackageElement(target, package, element, flags);
     }
 }
예제 #2
0
 private static void CopyResouces(string source, string destination, ReleaseFlags flags)
 {
     if (flags.HasFlag(ReleaseFlags.L10N_FR))
     {
         CopyResouces(source, destination, L10N_FR, flags);
     }
 }
예제 #3
0
        private static void MakeLargeAddressAware(string fileName, ReleaseFlags flags)
        {
            var tool = default(string);

            if (flags.HasFlag(ReleaseFlags.PlatformX86))
            {
                tool = @"..\.tools\x86\editbin.exe";
            }
            else if (flags.HasFlag(ReleaseFlags.PlatformX64))
            {
                tool = @"..\.tools\x64\editbin.exe";
            }
            else
            {
                return;
            }
            var arguments = string.Format("/largeaddressaware \"{0}\"", fileName);

            Console.WriteLine("Running tool: {0} {1}", tool, arguments);
            var info = new ProcessStartInfo(tool, arguments)
            {
                CreateNoWindow         = true,
                UseShellExecute        = false,
                RedirectStandardInput  = true,
                RedirectStandardOutput = true,
                RedirectStandardError  = true
            };

            Process.Start(info).WaitForExit();
        }
예제 #4
0
 internal ReleaseInfo( int version, int revision, DateTime releaseDate,
                       string summary, string changeLog, ReleaseFlags releaseType ) {
     Version = version;
     Revision = revision;
     Date = releaseDate;
     Summary = summary;
     ChangeLog = changeLog.Split( new[] { '\n' } );
     Flags = releaseType;
 }
예제 #5
0
        public static ReleaseFlags StringToReleaseFlags([NotNull] string str)
        {
            if (str == null)
            {
                throw new ArgumentNullException("str");
            }
            ReleaseFlags flags = ReleaseFlags.None;

            for (int i = 0; i < str.Length; i++)
            {
                switch (Char.ToUpper(str[i]))
                {
                case 'A':
                    flags |= ReleaseFlags.APIChange;
                    break;

                case 'B':
                    flags |= ReleaseFlags.Bugfix;
                    break;

                case 'C':
                    flags |= ReleaseFlags.ConfigFormatChange;
                    break;

                case 'D':
                    flags |= ReleaseFlags.Dev;
                    break;

                case 'F':
                    flags |= ReleaseFlags.Feature;
                    break;

                case 'M':
                    flags |= ReleaseFlags.MapFormatChange;
                    break;

                case 'P':
                    flags |= ReleaseFlags.PlayerDBFormatChange;
                    break;

                case 'S':
                    flags |= ReleaseFlags.Security;
                    break;

                case 'U':
                    flags |= ReleaseFlags.Unstable;
                    break;

                case 'O':
                    flags |= ReleaseFlags.Optimized;
                    break;
                }
            }
            return(flags);
        }
예제 #6
0
 public static string ReleaseFlagsToString( ReleaseFlags flags ) {
     StringBuilder sb = new StringBuilder();
     if( (flags & ReleaseFlags.APIChange) == ReleaseFlags.APIChange ) sb.Append( 'A' );
     if( (flags & ReleaseFlags.Bugfix) == ReleaseFlags.Bugfix ) sb.Append( 'B' );
     if( (flags & ReleaseFlags.ConfigFormatChange) == ReleaseFlags.ConfigFormatChange ) sb.Append( 'C' );
     if( (flags & ReleaseFlags.Dev) == ReleaseFlags.Dev ) sb.Append( 'D' );
     if( (flags & ReleaseFlags.Feature) == ReleaseFlags.Feature ) sb.Append( 'F' );
     if( (flags & ReleaseFlags.MapFormatChange) == ReleaseFlags.MapFormatChange ) sb.Append( 'M' );
     if( (flags & ReleaseFlags.PlayerDBFormatChange) == ReleaseFlags.PlayerDBFormatChange ) sb.Append( 'P' );
     if( (flags & ReleaseFlags.Security) == ReleaseFlags.Security ) sb.Append( 'S' );
     if( (flags & ReleaseFlags.Unstable) == ReleaseFlags.Unstable ) sb.Append( 'U' );
     if( (flags & ReleaseFlags.Optimized) == ReleaseFlags.Optimized ) sb.Append( 'O' );
     return sb.ToString();
 }
예제 #7
0
 public static string[] ReleaseFlagsToStringArray( ReleaseFlags flags ) {
     List<string> list = new List<string>();
     if( (flags & ReleaseFlags.APIChange) == ReleaseFlags.APIChange ) list.Add( "API Changes" );
     if( (flags & ReleaseFlags.Bugfix) == ReleaseFlags.Bugfix ) list.Add( "Fixes" );
     if( (flags & ReleaseFlags.ConfigFormatChange) == ReleaseFlags.ConfigFormatChange ) list.Add( "Config Changes" );
     if( (flags & ReleaseFlags.Dev) == ReleaseFlags.Dev ) list.Add( "Developer" );
     if( (flags & ReleaseFlags.Feature) == ReleaseFlags.Feature ) list.Add( "New Features" );
     if( (flags & ReleaseFlags.MapFormatChange) == ReleaseFlags.MapFormatChange ) list.Add( "Map Format Changes" );
     if( (flags & ReleaseFlags.PlayerDBFormatChange) == ReleaseFlags.PlayerDBFormatChange ) list.Add( "PlayerDB Changes" );
     if( (flags & ReleaseFlags.Security) == ReleaseFlags.Security ) list.Add( "Security Patch" );
     if( (flags & ReleaseFlags.Unstable) == ReleaseFlags.Unstable ) list.Add( "Unstable" );
     if( (flags & ReleaseFlags.Optimized) == ReleaseFlags.Optimized ) list.Add( "Optimized" );
     return list.ToArray();
 }
예제 #8
0
        private static void CopyFile(string source, string destination, ReleaseFlags flags)
        {
            var directoryName = Path.GetDirectoryName(destination);

            if (!Directory.Exists(directoryName))
            {
                Console.WriteLine("Creating directory: {0}", directoryName);
                Directory.CreateDirectory(directoryName);
            }

            Console.WriteLine("Creating file: {0}", destination);
            File.Copy(source, destination);

            CopyResouces(source, destination, flags);
        }
예제 #9
0
        private static void CreateRelease(string version, ReleaseFlags flags)
        {
            var target = GetTarget(flags);

            Console.WriteLine("Creating release: {0}", target);
            if (Directory.Exists(target))
            {
                Console.WriteLine("Removing previous release..");
                Directory.Delete(target, true);
            }
            Directory.CreateDirectory(target);

            Console.WriteLine("Creating base files..");

            AddPackage(Path.Combine(target, DEFAULT), Launcher, flags);
            AddPackage(Path.Combine(target, MINIMAL), Launcher, flags);

            AddPackage(Path.Combine(target, DEFAULT, LIB), Core, flags);
            AddPackage(Path.Combine(target, MINIMAL, LIB), Core, flags);

            Console.WriteLine("Installing plugins..");

            foreach (var plugin in Plugins)
            {
                Console.WriteLine("Installing plugins: {0}", plugin.Name);

                if (plugin.Flags.HasFlag(PackageFlags.Default))
                {
                    AddPackage(Path.Combine(target, DEFAULT, LIB), plugin, flags);
                }

                if (plugin.Flags.HasFlag(PackageFlags.Minimal))
                {
                    AddPackage(Path.Combine(target, MINIMAL, LIB), plugin, flags);
                }

                AddPackage(Path.Combine(target, PLUGINS), plugin, flags);
            }
        }
예제 #10
0
        private static string GetTarget(ReleaseFlags flags)
        {
            var parts = new List <string>();

            if (flags.HasFlag(ReleaseFlags.PlatformX86))
            {
                parts.Add(X86);
            }
            if (flags.HasFlag(ReleaseFlags.PlatformX64))
            {
                parts.Add(X64);
            }
            if (flags.HasFlag(ReleaseFlags.FrameworkNET40))
            {
                parts.Add(NET40);
            }
            if (flags.HasFlag(ReleaseFlags.FrameworkNET461))
            {
                parts.Add(NET461);
            }
            return(Path.Combine(parts.ToArray()));
        }
예제 #11
0
파일: Updater.cs 프로젝트: fragmer/fCraft
 public bool IsFlagged( ReleaseFlags flag ) {
     return ( Flags & flag ) == flag;
 }
예제 #12
0
파일: Updater.cs 프로젝트: fragmer/fCraft
 public static string[] ReleaseFlagsToStringArray( ReleaseFlags flags ) {
     List<string> list = new List<string>();
     if( ( flags & ReleaseFlags.APIChange ) == ReleaseFlags.APIChange ) list.Add( "API Changes" );
     if( ( flags & ReleaseFlags.Bugfix ) == ReleaseFlags.Bugfix ) list.Add( "Fixes" );
     if( ( flags & ReleaseFlags.ConfigFormatChange ) == ReleaseFlags.ConfigFormatChange )
         list.Add( "Config Changes" );
     if( ( flags & ReleaseFlags.Dev ) == ReleaseFlags.Dev ) list.Add( "Developer" );
     if( ( flags & ReleaseFlags.Feature ) == ReleaseFlags.Feature ) list.Add( "New Features" );
     if( ( flags & ReleaseFlags.MapFormatChange ) == ReleaseFlags.MapFormatChange )
         list.Add( "Map Format Changes" );
     if( ( flags & ReleaseFlags.PlayerDBFormatChange ) == ReleaseFlags.PlayerDBFormatChange )
         list.Add( "PlayerDB Changes" );
     if( ( flags & ReleaseFlags.Security ) == ReleaseFlags.Security ) list.Add( "Security Patch" );
     if( ( flags & ReleaseFlags.Unstable ) == ReleaseFlags.Unstable ) list.Add( "Unstable" );
     if( ( flags & ReleaseFlags.Optimized ) == ReleaseFlags.Optimized ) list.Add( "Optimized" );
     return list.ToArray();
 }
예제 #13
0
파일: Updater.cs 프로젝트: fragmer/fCraft
 public static string ReleaseFlagsToString( ReleaseFlags flags ) {
     StringBuilder sb = new StringBuilder();
     if( ( flags & ReleaseFlags.APIChange ) == ReleaseFlags.APIChange ) sb.Append( 'A' );
     if( ( flags & ReleaseFlags.Bugfix ) == ReleaseFlags.Bugfix ) sb.Append( 'B' );
     if( ( flags & ReleaseFlags.ConfigFormatChange ) == ReleaseFlags.ConfigFormatChange ) sb.Append( 'C' );
     if( ( flags & ReleaseFlags.Dev ) == ReleaseFlags.Dev ) sb.Append( 'D' );
     if( ( flags & ReleaseFlags.Feature ) == ReleaseFlags.Feature ) sb.Append( 'F' );
     if( ( flags & ReleaseFlags.MapFormatChange ) == ReleaseFlags.MapFormatChange ) sb.Append( 'M' );
     if( ( flags & ReleaseFlags.PlayerDBFormatChange ) == ReleaseFlags.PlayerDBFormatChange ) sb.Append( 'P' );
     if( ( flags & ReleaseFlags.Security ) == ReleaseFlags.Security ) sb.Append( 'S' );
     if( ( flags & ReleaseFlags.Unstable ) == ReleaseFlags.Unstable ) sb.Append( 'U' );
     if( ( flags & ReleaseFlags.Optimized ) == ReleaseFlags.Optimized ) sb.Append( 'O' );
     return sb.ToString();
 }
예제 #14
0
파일: Updater.cs 프로젝트: fragmer/fCraft
 internal ReleaseInfo( int version, int revision, DateTime releaseDate,
                       string summary, string changeLog, ReleaseFlags releaseType ) {
     Version = version;
     Revision = revision;
     Date = releaseDate;
     Summary = summary;
     ChangeLog = changeLog.Split( new[] { '\n' } );
     Flags = releaseType;
 }
예제 #15
0
 public bool IsFlagged(ReleaseFlags flag)
 {
     return((Flags & flag) == flag);
 }
예제 #16
0
 internal ReleaseInfo(int version, int revision, ReleaseFlags releaseType)
 {
     Version  = version;
     Revision = revision;
     Flags    = releaseType;
 }
예제 #17
0
        private static void AddPackageElement(string target, Package package, PackageElement element, ReleaseFlags flags)
        {
            //Filter by framework.
            if (element.Flags.HasFlag(PackageElementFlags.FrameworkNET40) || element.Flags.HasFlag(PackageElementFlags.FrameworkNET461))
            {
                if (flags.HasFlag(ReleaseFlags.FrameworkNET40) && !element.Flags.HasFlag(PackageElementFlags.FrameworkNET40))
                {
                    return;
                }
                if (flags.HasFlag(ReleaseFlags.FrameworkNET461) && !element.Flags.HasFlag(PackageElementFlags.FrameworkNET461))
                {
                    return;
                }
            }

            //Filter by platform.
            if (element.Flags.HasFlag(PackageElementFlags.PlatformX86) || element.Flags.HasFlag(PackageElementFlags.PlatformX64))
            {
                if (flags.HasFlag(ReleaseFlags.PlatformX86) && !element.Flags.HasFlag(PackageElementFlags.PlatformX86))
                {
                    return;
                }
                if (flags.HasFlag(ReleaseFlags.PlatformX64) && !element.Flags.HasFlag(PackageElementFlags.PlatformX64))
                {
                    return;
                }
            }

            var source      = GetSource(target, package, element, flags);
            var destination = GetDestination(target, package, element, flags);

            CopyFile(source, destination, flags);
        }
예제 #18
0
        private static void CopyResouces(string source, string destination, string culture, ReleaseFlags flags)
        {
            var sourceDirectoryName = Path.Combine(Path.GetDirectoryName(source), culture);

            if (!Directory.Exists(sourceDirectoryName))
            {
                return;
            }
            var fileNames = Directory.GetFiles(sourceDirectoryName, string.Format("{0}.resources.dll", Path.GetFileNameWithoutExtension(source)));

            if (fileNames.Length == 0)
            {
                return;
            }
            var destinationDirectoryName = Path.Combine(Path.GetDirectoryName(destination), culture);

            if (!Directory.Exists(destinationDirectoryName))
            {
                Console.WriteLine("Creating directory: {0}", destinationDirectoryName);
                Directory.CreateDirectory(destinationDirectoryName);
            }
            foreach (var fileName in fileNames)
            {
                Console.WriteLine("Creating satellite: {0}", destination);
                File.Copy(fileName, Path.Combine(destinationDirectoryName, Path.GetFileName(fileName)));
            }
        }
예제 #19
0
        private static string GetDestination(string target, Package package, PackageElement element, ReleaseFlags flags)
        {
            var parts = new List <string>()
            {
                target
            };

            if (!string.IsNullOrEmpty(package.Name))
            {
                parts.Add(package.Name);
            }
            parts.Add(element.FileName);
            return(Path.Combine(parts.ToArray()));
        }
예제 #20
0
        private static string GetSource(string target, Package package, PackageElement element, ReleaseFlags flags)
        {
            var parts = new List <string>()
            {
                "..",
                DISTRIBUTION
            };

            if (flags.HasFlag(ReleaseFlags.PlatformX86))
            {
                parts.Add(X86);
            }
            if (flags.HasFlag(ReleaseFlags.PlatformX64))
            {
                parts.Add(X64);
            }
            if (flags.HasFlag(ReleaseFlags.FrameworkNET40))
            {
                parts.Add(NET40);
            }
            if (flags.HasFlag(ReleaseFlags.FrameworkNET461))
            {
                parts.Add(NET461);
            }
            parts.Add(element.FileName);
            return(Path.Combine(parts.ToArray()));
        }