Beispiel #1
0
        /// <summary>
        /// build a getting-started url which is used to correctly show the user infos like
        /// warnings related to his dnn or 2sxc version
        /// infos based on his languages
        /// redirects based on the app he's looking at, etc.
        /// </summary>
        /// <param name="app"></param>
        /// <returns></returns>
        private string IntroductionToAppUrl(IApp app)
        {
            var dnn = PortalSettings.Current;
            var mod = Request.FindModuleInfo();
            //int appId = sxc.AppId.Value;
            var gsUrl = "//gettingstarted.2sxc.org/router.aspx?" // change to use protocoll neutral base URL, also change to 2sxc

                                                                 // Add version & module infos
                        + "DnnVersion=" + Assembly.GetAssembly(typeof(Globals)).GetName().Version.ToString(4)
                        + "&2SexyContentVersion=" + Settings.ModuleVersion
                        + "&ModuleName=" + mod.DesktopModule.ModuleName
                        + "&ModuleId=" + mod.ModuleID
                        + "&PortalID=" + dnn.PortalId
                        + "&ZoneID=" + app.ZoneId
                        + "&DefaultLanguage=" + dnn.DefaultLanguage
                        + "&CurrentLanguage=" + dnn.CultureCode;

            // Add AppStaticName and Version
            if (mod.DesktopModule.ModuleName != "2sxc")
            {
                gsUrl += "&AppGuid=" + app.AppGuid;
                if (app.Configuration != null)
                {
                    gsUrl += "&AppVersion=" + app.Configuration.Version
                             + "&AppOriginalId=" + app.Configuration.OriginalId;
                }
            }

            var hostSettings = HostController.Instance.GetSettingsDictionary();

            gsUrl += hostSettings.ContainsKey("GUID") ? "&DnnGUID=" + hostSettings["GUID"] : "";
            return(gsUrl);
        }
Beispiel #2
0
        //---
        public string[] getExItemCount()
        {
            var subclassTypes = Assembly
                                .GetAssembly(typeof(Item))
                                .GetTypes()
                                .Where(t => t.IsSubclassOf(typeof(Item)));

            Type[] ty    = subclassTypes.ToArray();
            int[]  types = new int[ty.Length];

            for (int i = 0; i < data.Count; i++)
            {
                for (int z = 0; z < ty.Length; z++)
                {
                    if (data[i].GetType() == ty[z])
                    {
                        types[z]++;
                        continue;
                    }
                }
            }
            string[] spec = new string[ty.Length];

            for (int i = 0; i < spec.Length; i++)
            {
                spec[i] = ty[i].ToString().Substring(10) +
                          " : " + types[i].ToString();
            }

            return(spec);
        }
Beispiel #3
0
        public string RemoteInstallDialogUrl(string dialog, bool isContentApp)
        {
            // note / warning: some duplicate code with SystemController.cs
            // ReSharper disable StringLiteralTypo

            if (dialog != "gettingstarted")
            {
                throw new Exception("unknown dialog name: " + dialog);
            }


            var moduleInfo = Request.FindModuleInfo();
            var modName    = moduleInfo.DesktopModule.ModuleName;

            // new: check if it should allow this
            // it should only be allowed, if the current situation is either
            // Content - and no views exist (even invisible ones)
            // App - and no apps exist - this is already checked on client side, so I won't include a check here
            if (isContentApp)
            {
                // we'll usually run into errors if nothing is installed yet, so on errors, we'll continue
                try
                {
                    var all = new CmsRuntime(BlockBuilder.App, Log, Edit.Enabled, false).Views.GetAll();
                    if (all.Any())
                    {
                        return(null);
                    }
                }
                catch
                {
                    // ignored
                }
            }

            // Add desired destination
            // Add DNN Version, 2SexyContent Version, module type, module id, Portal ID
            var gettingStartedSrc = "//gettingstarted.2sxc.org/router.aspx?"
                                    + "destination=autoconfigure" + (isContentApp ? Eav.Constants.ContentAppName.ToLower() : "app")
                                    + "&DnnVersion=" + Assembly.GetAssembly(typeof(Globals)).GetName().Version.ToString(4)
                                    + "&2SexyContentVersion=" + Settings.ModuleVersion
                                    + "&ModuleName=" + modName + "&ModuleId=" + moduleInfo.ModuleID
                                    + "&PortalID=" + moduleInfo.PortalID;
            // Add VDB / Zone ID (if set)
            var zoneId = Env.ZoneMapper.GetZoneId(moduleInfo.PortalID);

            gettingStartedSrc += "&ZoneID=" + zoneId;
            // ReSharper restore StringLiteralTypo

            // Add DNN Guid
            var hostSettings = HostController.Instance.GetSettingsDictionary();

            gettingStartedSrc += hostSettings.ContainsKey("GUID") ? "&DnnGUID=" + hostSettings["GUID"] : "";
            // Add Portal Default Language & current language
            gettingStartedSrc += "&DefaultLanguage=" + PortalSettings.DefaultLanguage
                                 + "&CurrentLanguage=" + PortalSettings.CultureCode;

            // Set src to iframe
            return(gettingStartedSrc);
        }
Beispiel #4
0
        public ViewGui() : base("")
        {
            string fullName = "MainView.gui.glade";

            Assembly a = Assembly.GetAssembly(this.GetType());

            Console.WriteLine(a.CodeBase);

            if (!System.IO.File.Exists(a.CodeBase + "/" + fullName))
            {
                fullName = "gui.glade";
            }

            glade = new XML(Assembly.GetCallingAssembly(), fullName, "ViewGui", null);
            glade.Autoconnect(this);

            Window win = (Window)glade ["ViewGui"];

            win.Maximize();

            //Initialisation du menu principal
            MainUIManager uim = new MainUIManager(this);

            vboxMain.PackStart(uim.MenuBar, false, false, 0);
            ((Gtk.Box.BoxChild)(vboxMain[uim.MenuBar])).Position = 0;

            //Pagecontrol des vues
            notebookViews = new Notebook();
            hpanedMain.Pack2(notebookViews, true, false);
            notebookViews.Show();
            //notebookViews.RemovePage(0);
        }
Beispiel #5
0
        public IEnumerable <Type> GetModuleTypes()
        {
            List <Module> objects = new List <Module>();

            return(Assembly.GetAssembly(typeof(ServicesModule)).GetTypes()
                   .Where(myType => myType.IsClass && !myType.IsAbstract && myType.IsSubclassOf(typeof(Module))));
        }
Beispiel #6
0
        //protected override EnableDto GetEnable()
        //{
        //    var isRealApp = App != null && App.AppGuid != Eav.Constants.DefaultAppName;
        //    var tmp = new JsContextUser(new DnnUser());
        //    return new EnableDto
        //    {
        //        AppPermissions = isRealApp,
        //        CodeEditor = tmp?.CanDevelop ?? false,
        //        Query = isRealApp,
        //    };
        //}

        /// <summary>
        /// build a getting-started url which is used to correctly show the user infos like
        /// warnings related to his dnn or 2sxc version
        /// infos based on his languages
        /// redirects based on the app he's looking at, etc.
        /// </summary>
        /// <returns></returns>
        protected override string GetGettingStartedUrl()
        {
            if (!(App is IApp app))
            {
                return("");
            }

            var gsUrl =
                "//gettingstarted.2sxc.org/router.aspx?" +
                $"DnnVersion={Assembly.GetAssembly(typeof(Globals)).GetName().Version.ToString(4)}" +
                $"&2SexyContentVersion={Settings.ModuleVersion}" +
                $"&ModuleName={Module.DesktopModule.ModuleName}" +
                $"&ModuleId={Module.ModuleID}" +
                $"&PortalID={_portal.PortalId}" +
                $"&ZoneID={app.ZoneId}" +
                $"&DefaultLanguage={_portal.DefaultLanguage}" +
                $"&CurrentLanguage={_portal.CultureCode}";

            // Add AppStaticName and Version
            if (Module.DesktopModule.ModuleName != "2sxc")
            {
                gsUrl += "&AppGuid=" + app.AppGuid;
                if (app.Configuration != null)
                {
                    gsUrl += $"&AppVersion={app.Configuration.Version}&AppOriginalId={app.Configuration.OriginalId}";
                }
            }

            var hostSettings = HostController.Instance.GetSettingsDictionary();

            gsUrl += hostSettings.ContainsKey("GUID") ? "&DnnGUID=" + hostSettings["GUID"] : "";
            return(gsUrl);
        }
Beispiel #7
0
 /// <summary>
 /// Checks if we are in internal
 /// </summary>
 public static bool IsInternal()
 {
     if (Assembly.GetAssembly(MethodBase.GetCurrentMethod().DeclaringType).GetType("MetaInternal", false, true) != null)
     {
         return(true);
     }
     return(false);
 }
        public string GetAutoInstallPackagesUiUrl(ITenant tenant, IContainer container, bool isContentApp, int appId)
        {
            var moduleInfo = (container as DnnContainer)?.UnwrappedContents;
            var portal     = (tenant as DnnTenant)?.UnwrappedContents;

            if (moduleInfo == null || portal == null)
            {
                throw new ArgumentException("missing portal/module");
            }

            // new: check if it should allow this
            // it should only be allowed, if the current situation is either
            // Content - and no views exist (even invisible ones)
            // App - and no apps exist - this is already checked on client side, so I won't include a check here
            if (isContentApp)
            {
                try
                {
                    // we'll usually run into errors if nothing is installed yet, so on errors, we'll continue
                    var contentViews = new CmsRuntime(appId, Log, /*Edit.Enabled,*/ false).Views.GetAll();
                    if (contentViews.Any())
                    {
                        return(null);
                    }
                }
                catch { /* ignore */ }
            }

            // ReSharper disable StringLiteralTypo
            // Add desired destination
            // Add DNN Version, 2SexyContent Version, module type, module id, Portal ID
            var gettingStartedSrc =
                "//gettingstarted.2sxc.org/router.aspx?"
                + "destination=autoconfigure" + (isContentApp ? Eav.Constants.ContentAppName.ToLower() : "app")
                + "&DnnVersion=" + Assembly.GetAssembly(typeof(Globals)).GetName().Version.ToString(4)
                + "&2SexyContentVersion=" + Settings.ModuleVersion
                + "&ModuleName=" + moduleInfo.DesktopModule.ModuleName
                + "&ModuleId=" + moduleInfo.ModuleID
                + "&PortalID=" + moduleInfo.PortalID;
            // Add VDB / Zone ID (if set)
            var zoneMapper = Eav.Factory.Resolve <IZoneMapper>().Init(Log);
            var zoneId     = zoneMapper.GetZoneId(moduleInfo.PortalID);

            gettingStartedSrc += "&ZoneID=" + zoneId;
            // ReSharper restore StringLiteralTypo

            // Add DNN Guid
            var hostSettings = HostController.Instance.GetSettingsDictionary();

            gettingStartedSrc += hostSettings.ContainsKey("GUID") ? "&DnnGUID=" + hostSettings["GUID"] : "";
            // Add Portal Default Language & current language
            gettingStartedSrc += "&DefaultLanguage=" + portal.DefaultLanguage
                                 + "&CurrentLanguage=" + portal.CultureCode;

            // Set src to iframe
            return(gettingStartedSrc);
        }
Beispiel #9
0
        public string RemoteInstallDialogUrl(string dialog)
        {
            // note / warning: some duplicate code with SystemController.cs

            if (dialog != "gettingstarted")
            {
                throw new Exception("unknown dialog name: " + dialog);
            }

            var moduleInfo = Request.FindModuleInfo();
            var modName    = moduleInfo.DesktopModule.ModuleName;

            var isContent         = modName == "2sxc";
            var gettingStartedSrc = "//gettingstarted.2sxc.org/router.aspx?";

            // Add desired destination
            gettingStartedSrc += "destination=autoconfigure" + (isContent ? "content" : "app");

            // Add DNN Version
            gettingStartedSrc += "&DnnVersion=" + Assembly.GetAssembly(typeof(Globals)).GetName().Version.ToString(4);
            // Add 2SexyContent Version
            gettingStartedSrc += "&2SexyContentVersion=" + Settings.ModuleVersion;
            // Add module type
            gettingStartedSrc += "&ModuleName=" + modName;
            // Add module id
            gettingStartedSrc += "&ModuleId=" + moduleInfo.ModuleID;
            // Add Portal ID
            gettingStartedSrc += "&PortalID=" + moduleInfo.PortalID;
            // Add VDB / Zone ID (if set)
            var ZoneID = ZoneHelpers.GetZoneID(moduleInfo.PortalID);

            gettingStartedSrc += ZoneID.HasValue ? "&ZoneID=" + ZoneID.Value : "";
            // Add AppStaticName and Version
            //if (App.AppId > 0 && !isContent)
            //{
            //    //var app =  SexyContent.GetApp(ZoneId.Value, AppId.Value, Sexy.OwnerPS);

            //    gettingStartedSrc += "&AppGuid=" + App.AppGuid;
            //    if (App.Configuration != null)
            //    {
            //        gettingStartedSrc += "&AppVersion=" + App.Configuration.Version;
            //        gettingStartedSrc += "&AppOriginalId=" + App.Configuration.OriginalId;
            //    }
            //}
            // Add DNN Guid
            var HostSettings = HostController.Instance.GetSettingsDictionary();

            gettingStartedSrc += HostSettings.ContainsKey("GUID") ? "&DnnGUID=" + HostSettings["GUID"] : "";
            // Add Portal Default Language
            gettingStartedSrc += "&DefaultLanguage=" + PortalSettings.DefaultLanguage;
            // Add current language
            gettingStartedSrc += "&CurrentLanguage=" + PortalSettings.CultureCode;

            // Set src to iframe
            return(gettingStartedSrc);
        }
        static ILPostProcessResult ProcessAssembly(AssemblyDefinition compiledAssembly)
        {
            var module         = compiledAssembly.MainModule;
            var componentTypes = new List <TypeContainer>();

#if UNITY_2020_2_OR_NEWER
            var editorAssemblyPath = Assembly.GetAssembly(typeof(EditorApplication)).Location;
            var editorPath         = editorAssemblyPath.Substring(0, editorAssemblyPath.Length - k_EditorAssemblyPathSuffix);
#else
            var editorPath = EditorApplication.applicationContentsPath;
#endif

            var assemblyExceptions  = RuntimeSerializationSettingsUtils.GetAssemblyExceptions();
            var namespaceExceptions = RuntimeSerializationSettingsUtils.GetNamespaceExceptions();
            var typeExceptions      = RuntimeSerializationSettingsUtils.GetTypeExceptions();
            ReflectionUtils.ForEachAssembly(assembly =>
            {
                if (assembly.IsDynamic)
                {
                    return;
                }

                if (!CodeGenUtils.IsBuiltInAssembly(assembly, editorPath) && !k_PlayerAssemblies.Contains(assembly.GetName().Name))
                {
                    return;
                }

                if (assemblyExceptions.Contains(assembly.FullName))
                {
                    return;
                }

                PostProcessAssembly(namespaceExceptions, typeExceptions, module, assembly, componentTypes);
            });

            PostProcessGenericMethodWrapper(componentTypes, module);

            return(CreatePostProcessResult(compiledAssembly));
        }
Beispiel #11
0
        private static void Main(string[] args)
        {
            bool showHelp = false;
            bool verbose = false;

            var options = new OptionSet()
            {
                {"v|verbose", "be verbose", v => verbose = v != null},
                {"h|help", "show this message and exit",v => showHelp = v != null},
            };

            List<string> extras;

            try
            {
                extras = options.Parse(args);
            }
            catch (OptionException e)
            {
                Console.Write("{0}: ", GetExecutableName());
                Console.WriteLine(e.Message);
                Console.WriteLine("Try `{0} --help' for more information.", GetExecutableName());
                return;
            }

            if (extras.Count < 1 || extras.Count > 2 || showHelp == true)
            {
                Console.WriteLine("Usage: {0} [OPTIONS]+ input_fc3map [output_dir]", GetExecutableName());
                Console.WriteLine();
                Console.WriteLine("Options:");
                options.WriteOptionDescriptions(Console.Out);
                return;
            }

            string inputPath = extras[0];
            string outputPath = extras.Count > 1 ? extras[1] : Path.ChangeExtension(inputPath, null) + "_unpack";

            var map = new CustomMapGameFile();
            using (var input = File.OpenRead(inputPath))
            {
                map.Deserialize(input);
            }

            Directory.CreateDirectory(outputPath);

            var config = new MapConfiguration();

            if (map.Header != null)
            {
                config.Header = new MapHeader()
                {
                    Unknown2 = map.Header.Unknown2,
                    Unknown3 = map.Header.Unknown3,
                    Unknown4 = map.Header.Unknown4,
                    Unknown5 = map.Header.Unknown5,
                    Creator = map.Header.Creator,
                    Unknown7 = map.Header.Unknown7,
                    Author = map.Header.Author,
                    Name = map.Header.Name,
                    MapId = new MapId()
                    {
                        Guid = map.Header.MapId.Guid,
                        Unknown2 = map.Header.MapId.Unknown2,
                        Unknown3 = map.Header.MapId.Unknown3,
                    },
                    VersionId = map.Header.VersionId,
                    TimeModified = map.Header.TimeModified,
                    TimeCreated = map.Header.TimeCreated,
                    MapSize = map.Header.MapSize,
                    PlayerRange = map.Header.PlayerRange,
                    Unknown16 = map.Header.Unknown16,
                    Unknown17 = map.Header.Unknown17,
                };
            }

            if (map.Snapshot != null)
            {
                using (var temp = new MemoryStream())
                {
                    var extension = ExportSnapshot(map.Snapshot, temp, map.Endian);
                    config.SnapshotPath = Path.ChangeExtension("snapshot", extension);

                    using (var output = File.Create(Path.Combine(outputPath, config.SnapshotPath)))
                    {
                        temp.Position = 0;
                        output.WriteFromStream(temp, temp.Length);
                    }
                }
            }

            if (map.ExtraSnapshot != null)
            {
                using (var temp = new MemoryStream())
                {
                    var extension = ExportSnapshot(map.ExtraSnapshot, temp, map.Endian);
                    config.SnapshotPath = Path.ChangeExtension("extra_snapshot", extension);

                    using (var output = File.Create(Path.Combine(outputPath, config.SnapshotPath)))
                    {
                        temp.Position = 0;
                        output.WriteFromStream(temp, temp.Length);
                    }
                }
            }

            if (map.Data != null)
            {
                config.Data = new MapData()
                {
                    Unknown1 = map.Data.Unknown1,
                    Unknown2Path = "data_unknown2.bin",
                };

                using (var output = File.Create(Path.Combine(outputPath, "data_unknown2.bin")))
                {
                    output.WriteBytes(map.Data.Unknown2);
                }
            }

            using (var input = map.Archive.Header.Unpack())
            {
                config.FilesystemHeaderPath = "filesystem.fat";
                using (var output = File.Create(Path.Combine(outputPath, config.FilesystemHeaderPath)))
                {
                    output.WriteFromStream(input, input.Length);
                }
            }

            using (var input = map.Archive.Data.Unpack())
            {
                config.FilesystemDataPath = "filesystem.dat";
                using (var output = File.Create(Path.Combine(outputPath, config.FilesystemDataPath)))
                {
                    output.WriteFromStream(input, input.Length);
                }
            }

            using (var input = map.Archive.Descriptor.Unpack())
            {
                config.FilesystemDescriptorPath = "filesystem.xml";
                using (var output = File.Create(Path.Combine(outputPath, config.FilesystemDescriptorPath)))
                {
                    output.WriteFromStream(input, input.Length);
                }
            }

            using (var output = new StreamWriter(Path.Combine(outputPath, "config.json"), false, Encoding.Unicode))
            using (var writer = new Newtonsoft.Json.JsonTextWriter(output))
            {
                writer.Indentation = 2;
                writer.IndentChar = ' ';
                writer.Formatting = Newtonsoft.Json.Formatting.Indented;

                var serializer = new Newtonsoft.Json.JsonSerializer();
                serializer.Serialize(writer, config);
            }

            using (var output = new StreamWriter(Path.Combine(outputPath, "filesystem_unpack.bat")))
            {
                output.WriteLine("@echo off");
                output.WriteLine("\"{0}\" -v -o \"filesystem.fat\" \"filesystem\"",
                                 Assembly.GetAssembly(typeof(Dunia2.Unpack.Dummy)).Location);
                output.WriteLine("pause");
            }

            using (var output = new StreamWriter(Path.Combine(outputPath, "filesystem_pack.bat")))
            {
                output.WriteLine("@echo off");
                output.WriteLine("\"{0}\" -v \"filesystem.fat\" \"filesystem\"",
                                 Assembly.GetAssembly(typeof(Dunia2.Pack.Dummy)).Location);
                output.WriteLine("pause");
            }
        }
Beispiel #12
0
        public string RemoteInstallDialogUrl(string dialog)
        {
            // note / warning: some duplicate code with SystemController.cs

            if (dialog != "gettingstarted")
            {
                throw new Exception("unknown dialog name: " + dialog);
            }


            var moduleInfo = Request.FindModuleInfo();
            var modName    = moduleInfo.DesktopModule.ModuleName;

            var isContent = modName == "2sxc";

            // new: check if it should allow this
            // it should only be allowed, if the current situation is either
            // Content - and no views exist (even invisible ones)
            // App - and no apps exist - this is already checked on client side, so I won't include a check here
            if (isContent)
            {
                // we'll usually run into errors if nothing is installed yet, so on errors, we'll continue
                try
                {
                    var all = SxcContext.App.TemplateManager /*.AppTemplates*/.GetAllTemplates();
                    if (all.Any())
                    {
                        return(null);
                    }
                }
                catch { }
            }

            var gettingStartedSrc = "//gettingstarted.2sxc.org/router.aspx?";

            // Add desired destination
            gettingStartedSrc += "destination=autoconfigure" + (isContent ? Constants.ContentAppName.ToLower() : "app");

            // Add DNN Version
            gettingStartedSrc += "&DnnVersion=" + Assembly.GetAssembly(typeof(Globals)).GetName().Version.ToString(4);
            // Add 2SexyContent Version
            gettingStartedSrc += "&2SexyContentVersion=" + Settings.ModuleVersion;
            // Add module type
            gettingStartedSrc += "&ModuleName=" + modName;
            // Add module id
            gettingStartedSrc += "&ModuleId=" + moduleInfo.ModuleID;
            // Add Portal ID
            gettingStartedSrc += "&PortalID=" + moduleInfo.PortalID;
            // Add VDB / Zone ID (if set)
            var ZoneID = ZoneHelpers.GetZoneID(moduleInfo.PortalID);

            gettingStartedSrc += ZoneID.HasValue ? "&ZoneID=" + ZoneID.Value : "";
            // Add AppStaticName and Version
            //if (App.AppId > 0 && !isContent)
            //{
            //    //var app =  SexyContent.GetApp(ZoneId.Value, AppId.Value, Sexy.OwnerPS);

            //    gettingStartedSrc += "&AppGuid=" + App.AppGuid;
            //    if (App.Configuration != null)
            //    {
            //        gettingStartedSrc += "&AppVersion=" + App.Configuration.Version;
            //        gettingStartedSrc += "&AppOriginalId=" + App.Configuration.OriginalId;
            //    }
            //}
            // Add DNN Guid
            var HostSettings = HostController.Instance.GetSettingsDictionary();

            gettingStartedSrc += HostSettings.ContainsKey("GUID") ? "&DnnGUID=" + HostSettings["GUID"] : "";
            // Add Portal Default Language
            gettingStartedSrc += "&DefaultLanguage=" + PortalSettings.DefaultLanguage;
            // Add current language
            gettingStartedSrc += "&CurrentLanguage=" + PortalSettings.CultureCode;

            // Set src to iframe
            return(gettingStartedSrc);
        }