Ejemplo n.º 1
0
 public string VisitFunctionTemplateDecl(FunctionTemplate template)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 2
0
 internal FunctionTemplate(FunctionTemplate.Internal native)
     : this(__CopyValue(native))
 {
 }
Ejemplo n.º 3
0
 public static FunctionTemplate __CreateInstance(FunctionTemplate.Internal native)
 {
     return new FunctionTemplate(native);
 }
Ejemplo n.º 4
0
 private FunctionTemplate(FunctionTemplate.Internal native)
     : this(__CopyValue(native))
 {
     __ownsNativeInstance = true;
     NativeToManagedMap[__Instance] = this;
 }
Ejemplo n.º 5
0
 private static void* __CopyValue(FunctionTemplate.__Internal native)
 {
     var ret = Marshal.AllocHGlobal(156);
     global::CppSharp.Parser.AST.FunctionTemplate.__Internal.cctor_1(ret, new global::System.IntPtr(&native));
     return ret.ToPointer();
 }
Ejemplo n.º 6
0
 private FunctionTemplate(FunctionTemplate.Internal native, bool skipVTables = false)
     : this(__CopyValue(native), skipVTables)
 {
     __ownsNativeInstance = true;
     NativeToManagedMap[__Instance] = this;
 }
 public bool VisitFunctionTemplateDecl(FunctionTemplate template)
 {
     return(false);
 }
Ejemplo n.º 8
0
 internal FunctionTemplate(FunctionTemplate.Internal native)
     : this(&native)
 {
 }
Ejemplo n.º 9
0
 public override bool VisitFunctionTemplateDecl(FunctionTemplate template)
 {
     return(true);
 }
Ejemplo n.º 10
0
 public virtual void GenerateFunctionTemplate(FunctionTemplate template)
 {
 }
Ejemplo n.º 11
0
 public virtual TypePrinterResult VisitFunctionTemplateDecl(
     FunctionTemplate template)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 12
0
 public string VisitFunctionTemplateDecl(FunctionTemplate template)
 {
     return(VisitDeclaration(template));
 }
Ejemplo n.º 13
0
 public override TypePrinterResult VisitFunctionTemplateDecl(FunctionTemplate template)
 {
     return(VisitDeclaration(template));
 }
Ejemplo n.º 14
0
 private FunctionTemplate(FunctionTemplate.Internal native)
     : this(__CopyValue(native))
 {
     __ownsNativeInstance = true;
 }
Ejemplo n.º 15
0
 public bool VisitFunctionTemplateDecl(FunctionTemplate template)
 {
     throw new System.NotImplementedException();
 }
Ejemplo n.º 16
0
 internal FunctionTemplate(FunctionTemplate.Internal* native)
     : this(new global::System.IntPtr(native))
 {
 }
Ejemplo n.º 17
0
 public virtual bool VisitFunctionTemplateDecl(FunctionTemplate template)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 18
0
        public override bool VisitFunctionTemplateDecl(FunctionTemplate template)
        {
            var expansions = template.PreprocessedEntities.OfType<MacroExpansion>();

            var expansion = expansions.FirstOrDefault(e => e.Text.StartsWith(Prefix + "_CONSTRAINT"));
            if (expansion != null)
            {
                var args = GetArguments(expansion.Text);
                for (var i = 0; i < template.Parameters.Count && i < args.Length; ++i)
                {
                    var param = template.Parameters[i];
                    param.Constraint = args[i];
                    template.Parameters[i] = param;
                }
            }

            return base.VisitFunctionTemplateDecl(template);
        }
Ejemplo n.º 19
0
        public override bool VisitFunctionTemplateDecl(FunctionTemplate template)
        {
            CheckForTemplateConstraints(template);

            return(base.VisitFunctionTemplateDecl(template));
        }
Ejemplo n.º 20
0
 public static FunctionTemplate __CreateInstance(FunctionTemplate.Internal native, bool skipVTables = false)
 {
     return new FunctionTemplate(native, skipVTables);
 }
Ejemplo n.º 21
0
 public override bool VisitFunctionTemplateDecl(FunctionTemplate template)
 {
     return(template.TemplatedFunction.Visit(this));
 }
Ejemplo n.º 22
0
 protected FunctionTemplate(FunctionTemplate.Internal* native, bool skipVTables = false)
     : base((CppSharp.Parser.AST.Template.Internal*) null)
 {
     __PointerAdjustment = 0;
     if (native == null)
         return;
     __Instance = new global::System.IntPtr(native);
 }
Ejemplo n.º 23
0
        public override bool VisitFunctionTemplateDecl(FunctionTemplate template)
        {
            CheckForTemplateConstraints(template);

            return base.VisitFunctionTemplateDecl(template);
        }
Ejemplo n.º 24
0
 private static FunctionTemplate.Internal* __CopyValue(FunctionTemplate.Internal native)
 {
     var ret = Marshal.AllocHGlobal(224);
     CppSharp.Parser.AST.FunctionTemplate.Internal.cctor_2(ret, new global::System.IntPtr(&native));
     return (FunctionTemplate.Internal*) ret;
 }
Ejemplo n.º 25
0
 public override bool VisitFunctionTemplateDecl(FunctionTemplate template)
 {
     return template.TemplatedFunction.Visit(this);
 }
Ejemplo n.º 26
0
 protected FunctionTemplate(FunctionTemplate.Internal* native, bool isInternalImpl = false)
     : base((CppSharp.Parser.AST.Template.Internal*) native)
 {
 }
Ejemplo n.º 27
0
        public async Task <HttpResponseMessage> CreateResource(BaseTemplate template)
        {
            try
            {
                var payload = JsonConvert.SerializeObject(template);
                SimpleTrace.TraceInformation($"CREATE {template?.AppService} : {payload}. Request Received");
            }
            catch (Exception ex)
            {
                SimpleTrace.TraceError($"Error Logging Create Start Information: {ex.Message} -> {ex.StackTrace}");
            }
            var tempTemplate = WebsiteTemplate.EmptySiteTemplate;

            if (template == null)
            {
                template = WebsiteTemplate.EmptySiteTemplate;
            }
            else if (template.AppService.Equals(AppService.Function))
            {
                tempTemplate = FunctionTemplate.DefaultFunctionTemplate(template.Name);
            }
            else if (template.AppService.Equals(AppService.Containers))
            {
                var containersTemplate = ContainersTemplate.DefaultContainersTemplate(template.Name);
                containersTemplate.DockerContainer = template.DockerContainer;
                tempTemplate = containersTemplate;
            }
            else if (template.Name != null && !template.Name.Equals("GitHub Repo") && !template.AppService.Equals(AppService.Function))
            {
                var temp = TemplatesManager.GetTemplates()
                           .FirstOrDefault(t => t.Name == template.Name);

                tempTemplate = WebsiteTemplate.DefaultTemplate(temp.Name, temp.AppService, temp.Language, temp.FileName, template.DockerContainer, temp.MSDeployPackageUrl);
            }
            else if (template.Name != null && template.Name.Equals("GitHub Repo"))
            {
                tempTemplate = new WebsiteTemplate
                {
                    AppService = AppService.Web,
                    GithubRepo = template.GithubRepo,
                    Name       = template.Name,
                    Language   = "GitHub"
                };
            }

            var identity          = HttpContext.Current.User.Identity as TryWebsitesIdentity;
            var anonymousUserName = SecurityManager.GetAnonymousUserName(new HttpContextWrapper(HttpContext.Current));

            try
            {
                var resourceManager = await ResourcesManager.GetInstanceAsync();

                if ((await resourceManager.GetResourceGroup(identity.Name)) != null)
                {
                    SimpleTrace.Diagnostics.Fatal(AnalyticsEvents.MoreThanOneError, 1);
                    //This should use the server version of the error, but due to a string bug they are not the same.
                    return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, Resources.Client.Information_YouCantHaveMoreThanOne));
                }

                ResourceGroup resourceGroup = null;
                SimpleTrace.TraceInformation($"Searching for {tempTemplate?.AppService} {tempTemplate?.Name}.");
                switch (tempTemplate.AppService)
                {
                case AppService.Linux:
                    resourceGroup = await resourceManager.ActivateLinuxResource(tempTemplate, identity, anonymousUserName);

                    break;

                case AppService.VSCodeLinux:
                    resourceGroup = await resourceManager.ActivateVSCodeLinuxResource(tempTemplate, identity, anonymousUserName);

                    break;

                case AppService.Web:
                    resourceGroup = await resourceManager.ActivateWebApp(tempTemplate, identity, anonymousUserName);

                    break;

                case AppService.Api:
                    resourceGroup = await resourceManager.ActivateApiApp(tempTemplate, identity, anonymousUserName);

                    break;

                case AppService.Function:
                    resourceGroup = await resourceManager.ActivateFunctionApp(tempTemplate, identity, anonymousUserName);

                    break;

                case AppService.Containers:
                    resourceGroup = await resourceManager.ActivateContainersResource(tempTemplate, identity, anonymousUserName);

                    break;
                }
                try
                {
                    SimpleTrace.TraceInformation($"CREATE {template?.AppService}. Returning { GetUIResource(resourceGroup).SiteName } with template { GetUIResource(resourceGroup).TemplateName } for user {identity.FilteredName}");
                }
                catch (Exception ex)
                {
                    SimpleTrace.TraceError($"Error Logging Create End Information: {ex.Message} -> {ex.StackTrace}");
                }
                return(Request.CreateResponse(HttpStatusCode.OK, resourceGroup == null ? null : GetUIResource(resourceGroup)));
            }
            catch (Exception ex)
            {
                var message = ex is NullReferenceException ? Resources.Server.Error_GeneralErrorMessage : ex.Message;
                SimpleTrace.Diagnostics.Fatal(ex, AnalyticsEvents.UserGotError, message, Interlocked.Increment(ref _userGotErrorErrorCount));
                return(Request.CreateErrorResponse(HttpStatusCode.ServiceUnavailable, message));
            }
        }