예제 #1
0
        public void MergeInto(Configuration result)
        {
            base.MergeInto(result);

            if (AutoLoadConfigFiles.HasValue)
                result.AutoLoadConfigFiles = AutoLoadConfigFiles;
            if (UseLocalProxies.HasValue)
                result.UseLocalProxies = UseLocalProxies;
            if (ReuseTypeInfoAcrossAssemblies.HasValue)
                result.ReuseTypeInfoAcrossAssemblies = ReuseTypeInfoAcrossAssemblies;
            if (OutputDirectory != null)
                result.OutputDirectory = OutputDirectory;
            if (FileOutputDirectory != null)
                result.FileOutputDirectory = FileOutputDirectory;
            if (Profile != null)
                result.Profile = Profile;
            if (Path != null)
                result.Path = Path;

            foreach (var kvp in ProfileSettings)
                result.ProfileSettings[kvp.Key] = kvp.Value;

            foreach (var kvp in CustomVariables)
                result.CustomVariables[kvp.Key] = kvp.Value;

            SolutionBuilder.MergeInto(result.SolutionBuilder);

            result.ContributingPaths = result.ContributingPaths.Concat(ContributingPaths).ToArray();
        }
예제 #2
0
        public static string ConvertEmbeddedResourceFile(Configuration configuration, string assemblyName, Assembly assembly, string resourceName)
        {
            var output = new StringBuilder();

            using (var stream = assembly.GetManifestResourceStream(resourceName))
            using (var reader = new ResourceReader(stream)) {
                output.AppendLine("{");

                bool first = true;

                var e = reader.GetEnumerator();
                while (e.MoveNext()) {
                    if (!first)
                        output.AppendLine(",");
                    else
                        first = false;

                    var key = Convert.ToString(e.Key);
                    output.AppendFormat("    {0}: ", JSIL.Internal.Util.EscapeString(key));

                    var value = e.Value;

                    if (value == null) {
                        output.Append("null");
                    } else {
                        switch (value.GetType().FullName) {
                            case "System.String":
                                output.Append(JSIL.Internal.Util.EscapeString((string)value));
                                break;
                            case "System.Single":
                            case "System.Double":
                            case "System.UInt16":
                            case "System.UInt32":
                            case "System.UInt64":
                            case "System.Int16":
                            case "System.Int32":
                            case "System.Int64":
                                output.Append(Convert.ToString(value));
                                break;
                            default:
                                output.Append(JSIL.Internal.Util.EscapeString(Convert.ToString(value)));
                                break;
                        }
                    }
                }

                output.AppendLine();
                output.AppendLine("}");
            }

            return output.ToString();
        }
예제 #3
0
        public void MergeInto(Configuration result)
        {
            base.MergeInto(result);

            if (AutoLoadConfigFiles.HasValue)
                result.AutoLoadConfigFiles = AutoLoadConfigFiles;
            if (UseLocalProxies.HasValue)
                result.UseLocalProxies = UseLocalProxies;
            if (OutputDirectory != null)
                result.OutputDirectory = OutputDirectory;

            SolutionBuilder.MergeInto(result.SolutionBuilder);
        }
예제 #4
0
    public static void InitConfiguration(JSIL.Compiler.Configuration result)
    {
        result.ProfileSettings.SetDefault("ContentOutputDirectory", null);
        result.ProfileSettings.SetDefault("JPEGQuality", 90);
        result.ProfileSettings.SetDefault("MP3Quality", "-V 3");
        result.ProfileSettings.SetDefault("OGGQuality", "-q 6");

        result.ProfileSettings.SetDefault("UsePNGQuant", false);
        result.ProfileSettings.SetDefault("PNGQuantColorCount", 256);
        result.ProfileSettings.SetDefault("PNGQuantOptions", "");

        result.ProfileSettings.SetDefault("FileSettings", new Dictionary <string, object>());

        result.ProfileSettings.SetDefault("ForceCopyXNBImporters", new string[0]);
        result.ProfileSettings.SetDefault("ForceCopyXNBProcessors", new string[0]);
    }
예제 #5
0
        public void MergeInto(Configuration result)
        {
            base.MergeInto(result);

            if (AutoLoadConfigFiles.HasValue)
                result.AutoLoadConfigFiles = AutoLoadConfigFiles;
            if (UseLocalProxies.HasValue)
                result.UseLocalProxies = UseLocalProxies;
            if (OutputDirectory != null)
                result.OutputDirectory = OutputDirectory;
            if (Profile != null)
                result.Profile = Profile;
            if (Path != null)
                result.Path = Path;

            foreach (var kvp in ProfileSettings)
                result.ProfileSettings[kvp.Key] = kvp.Value;

            SolutionBuilder.MergeInto(result.SolutionBuilder);
        }
예제 #6
0
        public static void ConvertEmbeddedResources(Configuration configuration, string assemblyPath, TranslationResult result)
        {
            var asm = Assembly.ReflectionOnlyLoadFrom(assemblyPath);

            var resourceFiles = (from fn in asm.GetManifestResourceNames() where fn.EndsWith(".resources") select fn).ToArray();
            var encoding = new UTF8Encoding(false);

            foreach (var resourceName in resourceFiles) {
                if (!resourceName.EndsWith(".resources"))
                    continue;

                var resourceJson = ConvertEmbeddedResourceFile(configuration, assemblyPath, asm, resourceName);
                var bytes = encoding.GetBytes(resourceJson);

                result.AddFile(
                    "Resources",
                    Path.GetFileNameWithoutExtension(resourceName) + ".resj",
                    new ArraySegment<byte>(bytes)
                );
            }
        }
예제 #7
0
 public Configuration Clone()
 {
     var result = new Configuration();
     MergeInto(result);
     return result;
 }
예제 #8
0
 public override Translator.Configuration Clone () {
     var result = new Configuration();
     MergeInto(result);
     return result;
 }