Example #1
0
        public static void CreateOffLineClasses()
        {
            try
            {
                ModelGen modelGen = new ModelGen();

                // To save time we will only create objects we are going to work with
                List <string> onlyObjects = new List <string>
                {
                    "Contact",
                    "Account",
                    "User",
                    "UserRole",
                    "Profile",
                    "UserLicense",
                    "RecordType"
                };

                modelGen.CreateOfflineSymbolTable(onlyObjects, "Demo.SObjects");
            }
            catch (ApexSharpHttpException exp)
            {
                Console.WriteLine(exp.Message);
            }
        }
Example #2
0
        public static void Start()
        {
            // Always Initialize your settings
            Setup.InitializeSession();

            // Keep Track of the API Limits
            Console.WriteLine($"Api Request Remaining {Limits.GetApiLimits().DailyApiRequests.Remaining}");

            // Create Offline classes for SObjects

            ModelGen modelGen = new ModelGen();

            // To save time we will only create objects we are going to work with
            List <string> onlyObjects = new List <string>
            {
                "Customer__c",
                "BankAccount__c",
                "AccountType__c"
            };

            //modelGen.CreateOfflineSymbolTableForSql(onlyObjects.ToList(), "Demo.SObjects");

            CreateOffLineClasses();

            //SoqlParentChild.ParentChildDemo();



            try
            {
                // Location of your APEX and C# Files that we will be converting
                DirectoryInfo apexLocation   = new DirectoryInfo(@"../SalesForce/src/classes/");
                DirectoryInfo cSharpLocation = new DirectoryInfo(@"../Demo/CSharpClasses/");



                // Convert Apex to C#
                // CodeConverter.ConvertToCSharp(apexLocation, cSharpLocation, "Demo.CSharpClasses");

                // Convert C# to APEX
                // CodeConverter.ConvertToApex(cSharpLocation, apexLocation, 40);
            }
            catch (DirectoryNotFoundException e)
            {
                Console.WriteLine(e.Message);
            }


            // Keep Track of the API Limits
            //Console.WriteLine($"Api Request Remaining {Limits.GetApiLimits().DailyApiRequests.Remaining}");

            // Flush and Close
            Setup.StopLogging();
        }
Example #3
0
 // Create Offline DTO for all the Salesforce Objects
 public static void CreateAllOffLineClasses()
 {
     try
     {
         ModelGen modelGen = new ModelGen();
         modelGen.CreateOfflineSymbolTable(modelGen.GetAllObjectNames().ToList(), "Demo.SObjects");
     }
     catch (ApexSharpHttpException exp)
     {
         Console.WriteLine(exp.Message);
     }
 }
        public ApiDeclaration GetApi(string controllerName)
        {
            var r       = SwaggerGen.CreateApiDeclaration(ControllerContext);
            var actions = _apiDescriptions.Where(
                a => a.ActionDescriptor.ControllerDescriptor.ControllerName
                .Equals(controllerName, StringComparison.InvariantCultureIgnoreCase)
                );

            var swaggerGen = new SwaggerGen();

            r.Apis   = actions.Select(swaggerGen.CreateApi);
            r.Models = ModelGen.CreateModels(actions, _docProvider);

            return(r);
        }
Example #5
0
        public void GetFieldTypeTranslatesFieldType()
        {
            var mg    = new ModelGen();
            var field = new Field {
                type = "anytype", name = "test"
            };
            var type = mg.GetFieldType(field);

            Assert.AreEqual("object", type);

            // by default, the type is translated as string
            field = new Field {
                type = "SomeUnknownType", name = "test"
            };
            type = mg.GetFieldType(field);
            Assert.AreEqual("string", type);
        }
Example #6
0
        // Create Offline DTO for a set of Salesforce objects
        public static void CreateOffLineClasses()
        {
            try
            {
                ModelGen modelGen = new ModelGen();
                modelGen.GetAllObjectNames();

                // To save time we will only create objects we are going to work with
                List <string> onlyObjects = new List <string>
                {
                    "Account",
                };

                modelGen.CreateOfflineSymbolTable(onlyObjects, "Demo.SObjects");
            }
            catch (ApexSharpHttpException exp)
            {
                Console.WriteLine(exp.Message);
            }
        }
    public void GenerateBlockInstance(int x, int z)
    {
        if (!MapDatabaseScript.IsVacent(x, z))
        {
            Debug.Log("Tried to generate block at (" + x + ", " + z + "). Aborted.");
            return;
        }

        Vector3 GetWorldCoordinates(float xIndex, float zIndex)
        {
            return(new Vector3(xIndex * block_VertexWidth, 0, zIndex * block_VertexWidth));
        }

        // Generate biome and sub-biome, and get the gradient
        MapDatabaseScript.GeneratePossibleBiome(x, z);
        Tuple <uint[, ], float[, ]> subBiomeGradient = MapDatabaseScript.GetSubBiome(x, z);

        // Generate heightmap
        float[,] Heightmap = HeightmapGenScript.GenerateHeightmap(x, z, subBiomeGradient.Item1, subBiomeGradient.Item2);

        // Generate material
        Texture2D Texture = MaterialGenScript.GenerateTexture(Heightmap, subBiomeGradient.Item1);
        // TODO generate bumpmap and misc.

        // Generate model
        GameObject ModelGenInstance = (GameObject)GameObject.Instantiate(ModelGenPrefab, GetWorldCoordinates(x, z), Quaternion.identity);
        ModelGen   ModelGenScript   = ModelGenInstance.GetComponent <ModelGen>();

        ModelGenScript.GenerateMesh(Heightmap, Texture, block_VertexWidth);

        // Place possible models on top of block
        Vector3 topLeft = new Vector3(ModelGenInstance.transform.position.x, 0f, ModelGenInstance.transform.position.z + block_VertexWidth);

        ModelPlacerScript.PlacePossibleModels(Heightmap, subBiomeGradient.Item1, topLeft);

        // Merge model to master mesh
        ModelGenInstance.transform.parent = MasterTerrainInstance.transform;
    }
Example #8
0
        public static void CreateOffLineClasses()
        {
            try
            {
                ModelGen modelGen   = new ModelGen();
                var      allObjects = modelGen.GetAllObjectNames();

                List <string> onlyObjects = new List <string>
                {
                    "Contact",
                    "Account",
                    "User",
                    "UserRole",
                    "Profile",
                    "UserLicense",
                };

                modelGen.CreateOfflineSymbolTable(onlyObjects);
            }
            catch (ApexSharpHttpException exp)
            {
                Console.WriteLine(exp.Message);
            }
        }