Ejemplo n.º 1
0
    private static void UpdateSceneBuildIndex()
    {
        var builder = new StringBuilder();

        builder.AppendLine("// Generated by LevelSceneBuildUpdater");

        builder.AppendLine("using System.Collections.Generic;");

        builder.AppendFormat("public static partial class {0}", Path.GetFileNameWithoutExtension(LevelBuildIndexClassPath)).AppendLine();
        builder.AppendLine("{");
        builder.AppendLine("\tpublic static readonly Dictionary<int, int> levelSceneBuildIndex = new Dictionary<int, int>");
        builder.AppendLine("\t{");

        EditorBuildSettings.scenes
        .Select(s => s.path)
        .Where(p => p.Contains(LevelDirectoryPath))
        .ForEach(p =>
        {
            builder.Append("\t\t").AppendFormat("{{ {0}, {1} }},",
                                                Convert.ToInt32(Path.GetFileNameWithoutExtension(p).Split('_')[1]),
                                                SceneUtility.GetBuildIndexByScenePath(p)
                                                ).AppendLine();
        });

        builder.AppendLine("\t};");
        builder.AppendLine("}");

        ScriptGenerator.CreateScript(LevelBuildIndexClassPath, builder.ToString());
    }
Ejemplo n.º 2
0
        public static string GenerateScript(string entity)
        {
            //ErpDTO.Microsoft.Dynamics.DataEntities.PurchaseOrderLine
            Type entityObject = Type.GetType("ErpDTO.Microsoft.Dynamics.DataEntities." + entity + ",ErpDTO");

            if (entityObject != null)
            {
                ScriptGenerator sg = new ScriptGenerator(entityObject);
                return(sg.CreateScript("[ax].[" + entity + "]"));
            }
            return("");
        }
Ejemplo n.º 3
0
        public void GenerateUser_CreateScript()
        {
            IScriptGenerator generator = new ScriptGenerator(new RepositoryMock());

            string expectedResult =
                @"INSERT INTO BlogUser (Name, Surname, Patronymic, Email, UserLogin, Password, RegistrationDate)" +
                Environment.NewLine +
                "VALUES ('Иван', 'Иванов', 'Иванович', '*****@*****.**', 'ivan', '12345', '20160101')";

            string result = generator.CreateScript(1);

            Assert.That(result, Is.EqualTo(expectedResult));
        }
Ejemplo n.º 4
0
        public void GenerateUser_CreateScript()
        {
            IScriptGenerator generator = new ScriptGenerator(new RepositoryMock());

            string expectedResult =
                @"INSERT INTO BlogUser (Name, Surname, Patronymic, Email, UserLogin, Password, RegistrationDate)" +
                Environment.NewLine +
                "VALUES ('Иван', 'Иванов', 'Иванович', '*****@*****.**', 'ivan', '12345', '20160101')";

            string result = generator.CreateScript(1);

            Assert.That(result, Is.EqualTo(expectedResult));
        }