Example #1
0
        /// <summary>
        /// Function to load a dependency file.
        /// </summary>
        /// <param name="dependency">The dependency to load.</param>
        /// <param name="stream">Stream containing the dependency file.</param>
        /// <returns>
        /// The result of the load operation.  If the dependency loaded correctly, then the developer should return a successful result.  If the dependency
        /// is not vital to the content, then the developer can return a continue result, otherwise the developer should return fatal result and the content will
        /// not continue loading.
        /// </returns>
        protected override DependencyLoadResult OnLoadDependencyFile(Dependency dependency, Stream stream)
        {
            if (!string.Equals(dependency.Type, TextureDependencyType, StringComparison.OrdinalIgnoreCase))
            {
                return(new DependencyLoadResult(DependencyLoadState.ErrorContinue,
                                                string.Format(Resources.GORSPR_ERR_UNKNOWN_DEPENDENCY, dependency.Type)));
            }

            using (IImageEditorContent imageContent = ImageEditor.ImportContent(dependency.EditorFile, stream))
            {
                if (imageContent.Image.Settings.ImageType != ImageType.Image2D)
                {
                    return(new DependencyLoadResult(DependencyLoadState.ErrorContinue, string.Format(Resources.GORSPR_ERR_2D_TEXTURE_ONLY)));
                }

                if (imageContent.Image == null)
                {
                    return(new DependencyLoadResult(DependencyLoadState.ErrorContinue, string.Format(Resources.GORSPR_WARN_NO_TEXTURE, Name, dependency.EditorFile.FilePath)));
                }

                if (!Dependencies.Contains(dependency.EditorFile, dependency.Type))
                {
                    Dependencies[dependency.EditorFile, dependency.Type] = dependency.Clone();
                }

                Dependencies.CacheDependencyObject(dependency.EditorFile,
                                                   dependency.Type,
                                                   Graphics.Textures.CreateTexture <GorgonTexture2D>(dependency.EditorFile.FilePath, imageContent.Image));

                return(new DependencyLoadResult(DependencyLoadState.Successful, null));
            }
        }
Example #2
0
        public void AddDependency()
        {
            OpenFileDialog fileDialog = new OpenFileDialog();

            fileDialog.InitialDirectory = System.IO.Directory.GetCurrentDirectory();
            fileDialog.FileName         = "";
            fileDialog.RestoreDirectory = true;
            fileDialog.Filter           = "MSI Merge Modules (*.msm)|*.msm";
            fileDialog.Multiselect      = true;
            if (fileDialog.ShowDialog() == true)
            {
                foreach (var fileName in fileDialog.FileNames)
                {
                    try
                    {
                        var             iswixDependency = new IsWiXDependency(fileName);
                        DependencyModel dependency      = new DependencyModel();
                        dependency.RequiredId       = iswixDependency.RequiredId;
                        dependency.RequiredLanguage = iswixDependency.RequiredLanguage;
                        dependency.RequiredVersion  = iswixDependency.RequiredVersion;
                        _iswixDependencies.Add(iswixDependency);
                        if (!Dependencies.Contains(dependency))
                        {
                            Dependencies.Add(dependency);
                        }
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message);
                    }
                }
            }
        }
Example #3
0
        /// <summary>
        /// Subscribes a given method to any changes in dependencies.
        /// </summary>
        /// <param name="subscribe">A method that takes in a Cell as an argument.</param>
        /// <returns></returns>
        private bool Subscribe(Action <Cell> subscribe)
        {
            if (subscribeCallback == null)
            {
                subscribeCallback = subscribe;
            }
            else
            {
                //Unsubscribe to start fresh.
                Unsubscribe();
            }

            //We have all dependencies, so if the owner is in it, there's a problem.
            if (Dependencies.Contains(Owner.Name))
            {
                ErrorCallback(Owner);
                return(false);
            }

            subscribeCallback = subscribe;

            //Subscribe to all direct dependencies.
            foreach (Dependency dependency in Dependencies.Cast <DictionaryEntry>().Select(d => d.Value as Dependency).Where(dependency => dependency.IsDirect))
            {
                dependency.Cell.Changed += subscribeCallback;
            }

            return(true);
        }
Example #4
0
        internal IEnumerable <SemanticItem> ResultWithDependency(string name)
        {
            if (Dependencies.Contains(name))
            {
                return(_result);
            }

            return(new SemanticItem[0]);
        }
Example #5
0
        public ModuleDescriptor(IInitializableModule module, Type moduleType, IEnumerable <Type> dependencies)
        {
            Weight       = 0;
            Module       = module;
            ModuleType   = moduleType;
            Dependencies = dependencies.ToList();

            if (Dependencies.Contains(moduleType))
            {
                throw new InvalidOperationException("Dependency cannot be module itself");
            }
        }
Example #6
0
        /// <summary>
        /// Method to check if a required dependency is set.
        /// </summary>
        /// <param name="dependency">A dependency</param>
        /// <returns>True if the(all) dependency(ies) is(are) set.</returns>
        public bool IsDependOn(EnumEntitiesDependencies dependency)
        {
            if (Dependencies == null || Dependencies.Contains(EnumEntitiesDependencies.None))
            {
                return(false);
            }

            if (Dependencies.Contains(EnumEntitiesDependencies.All) || Dependencies.Contains(dependency))
            {
                return(true);
            }

            return(false);
        }
Example #7
0
        public IOperationResponse Detect(Project project, string nugetPackageName)
        {
            switch (project)
            {
            case var proj when proj.Framework.IsDefined &&
                proj.Framework.Dependencies.Any(d => d.Equals(nugetPackageName, StringComparison.OrdinalIgnoreCase)):
                return(OperationResponse <Project> .Success(project));

            case var proj when proj.Path.Exists():
                var frameworkResponse = DependencyGraphService.GetProjectFramework(proj.Path);

                return(frameworkResponse.IsSuccessful && frameworkResponse.Payload !.Dependencies.Contains(nugetPackageName)
                        ? OperationResponse <Project> .Success(project)
                        : OperationResponse <Project> .Error(frameworkResponse.Message));

            default:
                return(OperationResponse <Project> .Error(Resources.Info.Errors.SeedBucketProjectCouldNotBeFound));
            }
        }
Example #8
0
 public void RegisterDependencies(
     object @object,
     params object[] dependencies
     )
 {
     if (!DependencyAnalyser.IsDependableObject(@object))
     {
         return;
     }
     if (!InitialiserDependencies.ContainsKey(@object))
     {
         InitialiserDependencies.Add(@object, new List <object>());
     }
     foreach (var dependency in dependencies
              .Where(DependencyAnalyser.IsDependableObject)
              .Where(dependency => !Dependencies.Contains(@object) || !Dependencies[@object].Contains(dependency))
              .Where(dependency => dependency != @object)
              )
     {
         InitialiserDependencies[@object].Add(dependency);
     }
 }
 /// <summary>
 /// Returns true if the Entity Dependency Info depends on given Entity Dependency Info.
 /// </summary>
 /// <param name="info">The info to check to see if it is a dependency.</param>
 /// <returns></returns>
 public bool DependsOn(EntityDependencyInfo info)
 {
     return(Dependencies.Contains(info.LogicalName) || info.Dependents.Contains(LogicalName));
 }
Example #10
0
        /// <summary>
        /// Function to load a dependency file.
        /// </summary>
        /// <param name="dependency">The dependency to load.</param>
        /// <param name="stream">Stream containing the dependency file.</param>
        /// <returns>
        /// The result of the load operation.  If the dependency loaded correctly, then the developer should return NoError.  If the dependency
        /// is not vital to the content, then the developer can return CanContinue, otherwise the developer should return FatalError and the content will
        /// not continue loading.
        /// </returns>
        protected override DependencyLoadResult OnLoadDependencyFile(Dependency dependency, Stream stream)
        {
            if (ImageEditor == null)
            {
                return(new DependencyLoadResult(DependencyLoadState.ErrorContinue, Resources.GORFNT_ERR_EXTERN_IMAGE_EDITOR_MISSING));
            }

            if ((!string.Equals(dependency.Type, TextureBrushTextureType, StringComparison.OrdinalIgnoreCase)) &&
                (!string.Equals(dependency.Type, GlyphTextureType, StringComparison.OrdinalIgnoreCase)))
            {
                return(new DependencyLoadResult(DependencyLoadState.ErrorContinue,
                                                string.Format(Resources.GORFNT_ERR_DEPENDENCY_UNKNOWN_TYPE, dependency.Type)));
            }

            IImageEditorContent imageContent = null;

            try
            {
                Size newSize = Size.Empty;

                // We need to load the image as transformed (either clipped or stretched).
                if (string.Equals(dependency.Type, GlyphTextureType, StringComparison.OrdinalIgnoreCase))
                {
                    var converter  = new SizeConverter();
                    var sizeObject = converter.ConvertFromInvariantString(dependency.Properties[GlyphTextureSizeProp].Value);

                    if (!(sizeObject is Size))
                    {
                        return(new DependencyLoadResult(DependencyLoadState.ErrorContinue,
                                                        Resources.GORFNT_ERR_DEPENDENCY_GLYPH_TEXTURE_BAD_TRANSFORM));
                    }

                    newSize = (Size)sizeObject;
                }

                imageContent = ImageEditor.ImportContent(dependency.EditorFile, stream);

                if (newSize.Width == 0)
                {
                    newSize.Width = imageContent.Image.Settings.Width;
                }

                if (newSize.Height == 0)
                {
                    newSize.Height = imageContent.Image.Settings.Height;
                }

                // Clip the image to a new size if necessary.
                if ((newSize.Width != imageContent.Image.Settings.Width) ||
                    (newSize.Height != imageContent.Image.Settings.Height))
                {
                    imageContent.Image.Resize(newSize.Width, newSize.Height, true);
                }

                if (imageContent.Image == null)
                {
                    return(new DependencyLoadResult(DependencyLoadState.ErrorContinue, Resources.GORFNT_ERR_EXTERN_IMAGE_MISSING));
                }

                if (imageContent.Image.Settings.ImageType != ImageType.Image2D)
                {
                    return(new DependencyLoadResult(DependencyLoadState.ErrorContinue,
                                                    string.Format(Resources.GORFNT_ERR_IMAGE_NOT_2D, dependency.EditorFile.FilePath)));
                }

                if (!Dependencies.Contains(dependency.EditorFile, dependency.Type))
                {
                    Dependencies[dependency.EditorFile, dependency.Type] = dependency.Clone();
                }

                Dependencies.CacheDependencyObject(dependency.EditorFile,
                                                   dependency.Type,
                                                   Graphics.Textures.CreateTexture <GorgonTexture2D>(dependency.EditorFile.FilePath, imageContent.Image));

                return(new DependencyLoadResult(DependencyLoadState.Successful, null));
            }
            finally
            {
                if (imageContent != null)
                {
                    imageContent.Dispose();
                }
            }
        }
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);

            //WebForms.InitURLLibrary(this);

            //Request Services Framework
            ServicesFramework.Instance.RequestAjaxScriptSupport();
            ServicesFramework.Instance.RequestAjaxAntiForgerySupport();

            //Request jQuery & UI Support
            JavaScript.RequestRegistration(CommonJs.jQuery);

            if (Dependencies.Contains(Frameworks.jQueryUI.ToString()))
            {
                JavaScript.RequestRegistration(CommonJs.jQueryUI);
                WebForms.LinkCSS(Page, "JQuery" + "-JQuery-css", FrameworkManager.Request("JQuery", "css", "smoothness.css"));
            }

            WebForms.RegisterClientScriptInclude(Page, "DNNModal", Page.ResolveUrl("js/dnn.modalpopup.js"));

            //Load Angular JS
            FrameworkManager.Load(this, "AngularJS");

            //Load Angular Common Service
            FrameworkManager.LoadPlugin(this, "AngularJS", "mnCommonService", "mnCommonService.min.js");

            //Load Ckeditor
            if (Dependencies.Contains(AngularPlugins.CKEditor.ToString()))
            {
                FrameworkManager.Load(this, "Ckeditor", false);
            }

            //Load ColorPicker
            if (Dependencies.Contains(JavaScriptPlugins.ColorPicker.ToString()))
            {
                FrameworkManager.Load(this, "ColorPicker");
            }

            if (Dependencies.Contains(JavaScriptPlugins.ValidationJS.ToString()))
            {
                FrameworkManager.Load(this, "ValidationJS");
            }

            if (Dependencies.Contains(Frameworks.FontAwesome.ToString()))
            {
                FrameworkManager.Load(this, "FontAwesome");
            }

            if (Dependencies.Contains(JavaScriptPlugins.SpectrumColorPicker.ToString()))
            {
                FrameworkManager.Load(this, "SpectrumColorPicker");
            }

            if (Dependencies.Contains(JavaScriptPlugins.ContextMenu.ToString()))
            {
                FrameworkManager.Load(this, "ContextMenu");
            }

            //Load JsonViewer
            if (Dependencies.Contains(JavaScriptPlugins.JsonViewer.ToString()))
            {
                FrameworkManager.Load(this, "JsonViewer");
            }

            //Load JsonViewer
            if (Dependencies.Contains(JavaScriptPlugins.Barcode.ToString()))
            {
                FrameworkManager.Load(this, "Barcode");
            }

            if (Dependencies.Contains(JavaScriptPlugins.Notify.ToString()))
            {
                FrameworkManager.Load(this, "Notify");
            }

            if (Dependencies.Contains(JavaScriptPlugins.Numeral.ToString()))
            {
                FrameworkManager.Load(this, "Numeral");
            }

            if (Dependencies.Contains(JavaScriptPlugins.CodeMirror.ToString()))
            {
                FrameworkManager.Load(this, "CodeMirror");
            }

            if (Dependencies.Contains(JavaScriptPlugins.Toastr.ToString()))
            {
                FrameworkManager.Load(this, "Toastr");
            }

            if (Dependencies.Contains(JavaScriptPlugins.BootstrapDatepicker.ToString()))
            {
                FrameworkManager.Load(this, "BootstrapDatepicker");
            }

            if (Dependencies.Contains(AngularPlugins.Grid.ToString()))
            {
                FrameworkManager.LoadPlugin(this, "AngularJS", "SmartTable", "smart-table.min.js");
            }

            if (Dependencies.Contains(AngularPlugins.FileUpload.ToString()))
            {
                FrameworkManager.LoadPlugin(this, "AngularJS", "FileUpload", "ng-file-upload.min.js");
            }

            if (Dependencies.Contains(AngularPlugins.CSVImport.ToString()))
            {
                FrameworkManager.LoadPlugin(this, "AngularJS", "AngularCsvImport", "angular-csv-import.min.js");
                WebForms.RegisterClientScriptBlock(Page, "ImportHandler", "var mnImportHandler = '" + Page.ResolveUrl("DesktopModules/Vanjaro/Common/Handlers/ImportMapHandler.ashx?portalid=" + PortalId.ToString()) + "';", true);
            }


            WebForms.LinkCSS(Page, "AngularJS" + "-SweetAlert-css", FrameworkManager.Request("AngularJs", "Plugins", "SweetAlert/sweetalert.css"));
            FrameworkManager.LoadPlugin(this, "AngularJS", "SweetAlert", "alert.min.js");
            FrameworkManager.LoadPlugin(this, "AngularJS", "SweetAlert", "SweetAlert.min.js");


            if (Dependencies.Contains(AngularPlugins.TreeView.ToString()))
            {
                WebForms.LinkCSS(Page, "AngularJS" + "-TreeView-css", FrameworkManager.Request("AngularJs", "Plugins", "TreeView/angular-ui-tree.min.css"));
                FrameworkManager.LoadPlugin(this, "AngularJS", "TreeView", "angular-ui-tree.min.js");
            }

            if (Dependencies.Contains(AngularPlugins.Dialog.ToString()))
            {
                WebForms.LinkCSS(Page, "AngularJS" + "-Dialog-css", FrameworkManager.Request("AngularJs", "Plugins", "Dialog/ngDialog.min.css"));
                WebForms.LinkCSS(Page, "AngularJS" + "-Dialog-default-css", FrameworkManager.Request("AngularJs", "Plugins", "Dialog/ngDialog-theme-default.min.css"));
                FrameworkManager.LoadPlugin(this, "AngularJS", "Dialog", "ngDialog.min.js");
            }

            //Load Angular Loading Bar
            FrameworkManager.LoadPlugin(this, "AngularJS", "loading-bar", "loading-bar.min.js");
            WebForms.LinkCSS(Page, "AngularJS" + "-loading-css", FrameworkManager.Request("AngularJs", "Plugins", "loading-bar/loading-bar.min.css"));

            //Load Angular XEditable
            if (Dependencies.Contains(AngularPlugins.InlineEditor.ToString()))
            {
                FrameworkManager.LoadPlugin(this, "AngularJS", "x-editable", "js/xeditable.min.js");
                WebForms.LinkCSS(Page, "AngularJS" + "-xeditable-css", FrameworkManager.Request("AngularJs", "Plugins", "x-editable/css/xeditable.css"));
            }

            //Load Angular Tags Input
            if (Dependencies.Contains(AngularPlugins.Tags.ToString()))
            {
                FrameworkManager.LoadPlugin(this, "AngularJS", "TagsInput", "js/ng-tags-input.min.js");
                WebForms.LinkCSS(Page, "AngularJS" + "-tags-input-css", FrameworkManager.Request("AngularJs", "Plugins", "tagsinput/css/ng-tags-input.min.css"));
                WebForms.LinkCSS(Page, "AngularJS" + "-tags-input-bootstrap-css", FrameworkManager.Request("AngularJs", "Plugins", "tagsinput/css/ng-tags-input.bootstrap.min.css"));
            }

            //Load autocomplete
            if (Dependencies.Contains(AngularPlugins.AutoComplete.ToString()))
            {
                FrameworkManager.LoadPlugin(this, "AngularJS", "autocomplete", "js/autocomplete.min.js");
                WebForms.LinkCSS(Page, "AngularJS" + "-autocomplete-css", FrameworkManager.Request("AngularJs", "Plugins", "autocomplete/css/autocomplete.css"));
            }



            //Load Bootstrap
            FrameworkManager.Load(this, "Bootstrap");

            //Load WebAPI
            FrameworkManager.Load(this, "WebAPI");

            if (Dependencies.Contains(JavaScriptPlugins.ReCaptcha.ToString()))
            {
                FrameworkManager.Load(this, "ReCaptcha");
            }

            //Add Necessary Markup for Angular App
            Literal lit = new Literal
            {
                Text = "<div class=\"container-fluid " + App.Name + " \" id=\"" + App.Name + ModuleId.ToString() + "\" data-app-name=\"" + App.Name + " \" data-show-missing-keys=\"" + ShowMissingKeys.ToString().ToLower() + "\" data-roles=\"" + string.Join(",", AccessRoles) + "\" data-ModuleId=\"" + ModuleId.ToString() + "\" ng-controller=\"" + ControllerName + "\"><div ng-view=\"\" class=\"view-animate\"></div></div>"
            };

            Controls.Add(lit);

            if (!IsPostBack)
            {
                //Add Necessary Script to Initialize App
                string AngularAppScript = "angular.element(document).ready(function () {angular.bootstrap(document.getElementById(\"" + App.Name + ModuleId.ToString() + "\"), [\"" + App.Name + "\"]);});";
                WebForms.RegisterStartupScript(Page, "angular-init" + ModuleId.ToString(), AngularAppScript, true);

                //serialized form data into hidden field
                Dictionary <string, object> dicFormData = new Dictionary <string, object>();
                foreach (string key in HttpContext.Current.Request.Form.AllKeys)
                {
                    if (!string.IsNullOrEmpty(key))
                    {
                        if (!string.IsNullOrEmpty(HttpContext.Current.Request.Form[key]))
                        {
                            dicFormData.Add(key, HttpContext.Current.Request.Form[key].Replace("'", "&#39;"));
                        }
                        else
                        {
                            dicFormData.Add(key, HttpContext.Current.Request.Form[key]);
                        }
                    }
                }
                Controls.Add(new Literal()
                {
                    Text = "<input type=\"hidden\" name=\"hfFormData\" value=\'" + JsonConvert.SerializeObject(dicFormData) + "\'>"
                });
            }

            //serialized form data into hidden field
            //Dictionary<string, object> dicFormData = new Dictionary<string, object>();
            //foreach (string key in HttpContext.Current.Request.Form.AllKeys)
            //{
            //    dicFormData.Add(key, HttpContext.Current.Request.Form[key]);
            //}
            //this.Controls.Add(new Literal() { Text = "<input type=\"hidden\" name=\"hfFormData\" value=\'" + JsonConvert.SerializeObject(dicFormData) + "\'>" });


            //Literal s = new Literal();
            //lit.Text = "<script>" + AngularAppScript + "</script>";
            //this.Controls.Add(s);
        }