public ContentFolderViewModel(ContentFolder model, ContentFolderViewModel parent, IMessenger messenger)
            : base(messenger)
        {
            this.model = model;

            Parent = parent;
            Children = new ObservableCollection<ContentFolderViewModel>();
            Children.Add(dummyChild);

            CreateSubFolderCommand = new RelayCommand(CreateSubFolder, () => IsSelected);
            DeleteCommand = new RelayCommand(Delete, () => IsSelected);
        }
Esempio n. 2
0
        /// <summary>
        /// 资讯操作日志事件处理
        /// </summary>
        private void ContentFolderOperationLogEventModule_After(ContentFolder sender, CommonEventArgs eventArgs)
        {
            if (eventArgs.EventOperationType == EventOperationType.Instance().Create()
                || eventArgs.EventOperationType == EventOperationType.Instance().Update()
                || eventArgs.EventOperationType == EventOperationType.Instance().Delete()
                )
            {
                OperationLogEntry entry = new OperationLogEntry(eventArgs.OperatorInfo);
                entry.ApplicationId = CmsConfig.Instance().ApplicationId;
                entry.Source = CmsConfig.Instance().ApplicationName;
                entry.OperationType = eventArgs.EventOperationType;
                entry.OperationObjectName = sender.FolderName;
                entry.OperationObjectId = sender.ContentFolderId;
                entry.Description = string.Format(ResourceAccessor.GetString("OperationLog_Pattern_" + eventArgs.EventOperationType, entry.ApplicationId), "资讯栏目", entry.OperationObjectName);

                OperationLogService logService = Tunynet.DIContainer.Resolve<OperationLogService>();
                logService.Create(entry);
            }
        }
Esempio n. 3
0
 internal RouteFolder(string route, ContentFolder parent)
 {
     routeName   = route;
     this.parent = parent;
     routeFolder = Path.Combine(parent.RoutesFolder, routeName);
 }
        public IHttpActionResult CreateContentFolder(string contentType, string storeId, ContentFolder folder)
        {
            var storageProvider = _contentStorageProviderFactory(GetContentBasePath(contentType, storeId));

            storageProvider.CreateFolder(folder.ToBlobModel());
            return(Ok());
        }
 public static ContentFolder ToContentModel(this BlobFolder blobFolder)
 {
     var retVal = new ContentFolder();
     retVal.InjectFrom(blobFolder);
     return retVal;
 }
Esempio n. 6
0
        private void loadFolder(ContentTreeNode node, bool checkSubDirs)
        {
            if (node == null)
            {
                return;
            }

            // Temporary data
            var folder = node.Folder;
            var path   = folder.Path;

            // Check for missing files/folders (skip it during fast tree setup)
            if (!_isDuringFastSetup)
            {
                for (int i = 0; i < folder.Children.Count; i++)
                {
                    var child = folder.Children[i];
                    if (!child.Exists)
                    {
                        // Send info
                        Editor.Log(string.Format($"Content item \'{child.Path}\' has been removed"));

                        // Destroy it
                        Delete(child);

                        i--;
                    }
                }
            }

            // Find elements (use separate path for scripts and assets - perf stuff)
            // TODO: we could make it more modular
            if (node.CanHaveAssets)
            {
                LoadAssets(node, path);
            }
            if (node.CanHaveScripts)
            {
                LoadScripts(node, path);
            }

            // Get child directories
            var childFolders = Directory.GetDirectories(path);

            // Load child folders
            bool sortChildren = false;

            for (int i = 0; i < childFolders.Length; i++)
            {
                var childPath = StringUtils.NormalizePath(childFolders[i]);

                // Check if node already has that element (skip during init when we want to walk project dir very fast)
                ContentFolder childFolderNode = _isDuringFastSetup ? null : node.Folder.FindChild(childPath) as ContentFolder;
                if (childFolderNode == null)
                {
                    // Create node
                    ContentTreeNode n = new ContentTreeNode(node, childPath);
                    if (!_isDuringFastSetup)
                    {
                        sortChildren = true;
                    }

                    // Load child folder
                    loadFolder(n, true);

                    // Fire event
                    if (_enableEvents)
                    {
                        ItemAdded?.Invoke(n.Folder);
                        OnWorkspaceModified?.Invoke();
                    }
                    _itemsCreated++;
                }
                else if (checkSubDirs)
                {
                    // Update child folder
                    loadFolder(childFolderNode.Node, true);
                }
            }
            if (sortChildren)
            {
                node.SortChildren();
            }
        }
Esempio n. 7
0
            public async Task <PublishResult> SubmitAsync(IProgress <float> progress = null)
                {
                var result = default(PublishResult);

                progress?.Report(0);

                if (consumerAppId == 0)
                {
                    consumerAppId = SteamClient.AppId;
                }

                //
                // Checks
                //
                if (ContentFolder != null)
                {
                    if (!System.IO.Directory.Exists(ContentFolder.FullName))
                    {
                        throw new System.Exception($"UgcEditor - Content Folder doesn't exist ({ContentFolder.FullName})");
                    }

                    if (!ContentFolder.EnumerateFiles("*", System.IO.SearchOption.AllDirectories).Any())
                    {
                        throw new System.Exception($"UgcEditor - Content Folder is empty");
                    }
                }


                //
                // Item Create
                //
                if (creatingNew)
                {
                    result.Result = Steamworks.Result.Fail;

                    var created = await SteamUGC.Internal.CreateItem(consumerAppId, creatingType);

                    if (!created.HasValue)
                    {
                        return(result);
                    }

                    result.Result = created.Value.Result;

                    if (result.Result != Steamworks.Result.OK)
                    {
                        return(result);
                    }

                    FileId = created.Value.PublishedFileId;
                    result.NeedsWorkshopAgreement = created.Value.UserNeedsToAcceptWorkshopLegalAgreement;
                    result.FileId = FileId;
                }

                result.FileId = FileId;

                //
                // Item Update
                //
                {
                    var handle = SteamUGC.Internal.StartItemUpdate(consumerAppId, FileId);
                    if (handle == 0xffffffffffffffff)
                    {
                        return(result);
                    }

                    if (Title != null)
                    {
                        SteamUGC.Internal.SetItemTitle(handle, Title);
                    }
                    if (Description != null)
                    {
                        SteamUGC.Internal.SetItemDescription(handle, Description);
                    }
                    if (MetaData != null)
                    {
                        SteamUGC.Internal.SetItemMetadata(handle, MetaData);
                    }
                    if (Language != null)
                    {
                        SteamUGC.Internal.SetItemUpdateLanguage(handle, Language);
                    }
                    if (ContentFolder != null)
                    {
                        SteamUGC.Internal.SetItemContent(handle, ContentFolder.FullName);
                    }
                    if (PreviewFile != null)
                    {
                        SteamUGC.Internal.SetItemPreview(handle, PreviewFile);
                    }
                    if (Visibility.HasValue)
                    {
                        SteamUGC.Internal.SetItemVisibility(handle, Visibility.Value);
                    }
                    if (Tags != null && Tags.Count > 0)
                    {
                        using (var a = SteamParamStringArray.From(Tags.ToArray()))
                        {
                            var val = a.Value;
                            SteamUGC.Internal.SetItemTags(handle, ref val);
                        }
                    }

                    if (KeyValueTagsToRemove != null)
                    {
                        foreach (var key in KeyValueTagsToRemove)
                        {
                            SteamUGC.Internal.RemoveItemKeyValueTags(handle, key);
                        }
                    }

                    if (KeyValueTags != null)
                    {
                        foreach (var keyWithValues in KeyValueTags)
                        {
                            var key = keyWithValues.Key;
                            foreach (var value in keyWithValues.Value)
                            {
                                SteamUGC.Internal.AddItemKeyValueTag(handle, key, value);
                            }
                        }
                    }

                    result.Result = Steamworks.Result.Fail;

                    if (ChangeLog == null)
                    {
                        ChangeLog = "";
                    }

                    var updating = SteamUGC.Internal.SubmitItemUpdate(handle, ChangeLog);

                    while (!updating.IsCompleted)
                    {
                        if (progress != null)
                        {
                            ulong total     = 0;
                            ulong processed = 0;

                            var r = SteamUGC.Internal.GetItemUpdateProgress(handle, ref processed, ref total);

                            switch (r)
                            {
                            case ItemUpdateStatus.PreparingConfig:
                            {
                                progress?.Report(0.1f);
                                break;
                            }

                            case ItemUpdateStatus.PreparingContent:
                            {
                                progress?.Report(0.2f);
                                break;
                            }

                            case ItemUpdateStatus.UploadingContent:
                            {
                                var uploaded = total > 0 ? ((float)processed / (float)total) : 0.0f;
                                progress?.Report(0.2f + uploaded * 0.7f);
                                break;
                            }

                            case ItemUpdateStatus.UploadingPreviewFile:
                            {
                                progress?.Report(0.8f);
                                break;
                            }

                            case ItemUpdateStatus.CommittingChanges:
                            {
                                progress?.Report(1);
                                break;
                            }
                            }
                        }

                        await Task.Delay(1000 / 60);
                    }

                    progress?.Report(1);

                    var updated = updating.GetResult();

                    if (!updated.HasValue)
                    {
                        return(result);
                    }

                    result.Result = updated.Value.Result;

                    if (result.Result != Steamworks.Result.OK)
                    {
                        return(result);
                    }

                    result.NeedsWorkshopAgreement = updated.Value.UserNeedsToAcceptWorkshopLegalAgreement;
                    result.FileId = FileId;
                }

                return(result);
                }
Esempio n. 8
0
        /// <summary>
        /// 指定されたプロジェクト ファイルを開きます。
        /// </summary>
        /// <param name="path">プロジェクト ファイルのパス。</param>
        public void OpenProject(string path)
        {
            if (path == null) throw new ArgumentNullException("path");

            // プロジェクトが既に開かれているならば、それを閉じます。
            // 同一プロジェクトを選択した場合にはロード状態の衝突が発生するため、
            // 選択したプロジェクトを開く前に既存のプロジェクトを閉じます。
            CloseProject();

            // プロジェクトを開きます。
            Project = ContentProject.Load(path, buildLogger);
            Project.OutputPath = AppDomain.CurrentDomain.BaseDirectory;
            // 出力先の変更により IsDirty=true となるため、再評価します。
            Project.ReevaluateIfNecessary();

            // このプロジェクトのコンテンツをロードする AdhocContentManager を生成します。
            ContentManager = new AdhocContentManager(Services, Project.RuntimeContentPath);

            // ルート ディレクトリを設定します。
            RootFolder = new ContentFolder(new DirectoryInfo(Project.DirectoryPath));
        }
Esempio n. 9
0
        public void Initialize(InitializationEngine context)
        {
            // this returns empty if one of your sites does not have a * wildcard hostname
            ContentReference startReference = ContentReference.StartPage;

            // we can use the site definition repo to get the first site's start page instead
            if (ContentReference.IsNullOrEmpty(startReference))
            {
                var siteRepo  = context.Locate.Advanced.GetInstance <ISiteDefinitionRepository>();
                var firstSite = siteRepo.List().FirstOrDefault();
                if (firstSite == null)
                {
                    return;                    // if no sites, give up running this module
                }
                startReference = firstSite.StartPage;
            }

            string enabledString = ConfigurationManager.AppSettings["alloy:CreatePages"];
            bool   enabled;

            if (bool.TryParse(enabledString, out enabled))
            {
                if (enabled)
                {
                    IContentRepository repo = context.Locate.Advanced.GetInstance <IContentRepository>();

                    // create About Us page
                    StandardPage aboutUs;

                    IContent content = repo.GetBySegment(
                        startReference, "about-us",
                        CultureInfo.GetCultureInfo("en"));

                    if (content == null)
                    {
                        aboutUs = repo.GetDefault <StandardPage>(startReference);

                        aboutUs.Name            = "About us";
                        aboutUs.MetaTitle       = "About us title";
                        aboutUs.MetaDescription = "Alloy improves the effectiveness of project teams by putting the proper tools in your hands. Communication is made easy and inexpensive, no matter where team members are located.";
                        aboutUs.MainBody        = new XhtmlString(aboutUs.MetaDescription);
                        aboutUs.SortIndex       = 400;

                        repo.Save(aboutUs, SaveAction.Publish, AccessLevel.NoAccess);
                    }

                    // get the \For All Sites\Products\ folder
                    ContentFolder productsFolder = repo.GetBySegment(
                        ContentReference.GlobalBlockFolder, "Products",
                        CultureInfo.GetCultureInfo("en")) as ContentFolder;

                    // create Alloy Meet page
                    ProductPage alloyMeet;

                    content = repo.GetBySegment(
                        startReference, "alloy-meet",
                        CultureInfo.GetCultureInfo("en"));

                    if (content == null)
                    {
                        alloyMeet = repo.GetDefault <ProductPage>(startReference);

                        alloyMeet.Name                = "Alloy Meet";
                        alloyMeet.MetaDescription     = "You've never had a meeting like this before!";
                        alloyMeet.MainBody            = new XhtmlString("Participants from remote locations appear in your meeting room, around your table, or stand presenting at your white board.");
                        alloyMeet.Theme               = "theme1";
                        alloyMeet.UniqueSellingPoints = new[]
                        {
                            "Project tracking",
                            "White board sketch",
                            "Built-in reminders",
                            "Share meeting results",
                            "Email interface to request meetings"
                        };
                        alloyMeet.SortIndex = 100;
                        alloyMeet.PageImage = repo.GetBySegment(
                            productsFolder.ContentLink, "AlloyMeet.png",
                            CultureInfo.GetCultureInfo("en")).ContentLink;

                        repo.Save(alloyMeet, SaveAction.Publish, AccessLevel.NoAccess);
                    }

                    // create Alloy Plan page
                    ProductPage alloyPlan;

                    content = repo.GetBySegment(
                        startReference, "alloy-plan",
                        CultureInfo.GetCultureInfo("en"));

                    if (content == null)
                    {
                        alloyPlan = repo.GetDefault <ProductPage>(startReference);

                        alloyPlan.Name                = "Alloy Plan";
                        alloyPlan.MetaDescription     = "Project management has never been easier!";
                        alloyPlan.MainBody            = new XhtmlString("Planning is crucial to the success of any project. Alloy Plan takes into consideration all aspects of project planning; from well-defined objectives to staffing, capital investments and management support. Nothing is left to chance.");
                        alloyPlan.Theme               = "theme2";
                        alloyPlan.UniqueSellingPoints = new[]
                        {
                            "Project planning",
                            "Reporting and statistics",
                            "Email handling of tasks",
                            "Risk calculations",
                            "Direct communication to members"
                        };
                        alloyPlan.SortIndex = 200;
                        alloyPlan.PageImage = repo.GetBySegment(
                            productsFolder.ContentLink, "AlloyPlan.png",
                            CultureInfo.GetCultureInfo("en")).ContentLink;

                        repo.Save(alloyPlan, SaveAction.Publish, AccessLevel.NoAccess);
                    }

                    // create Alloy Track page
                    ProductPage alloyTrack;

                    content = repo.GetBySegment(
                        startReference, "alloy-track",
                        CultureInfo.GetCultureInfo("en"));

                    if (content == null)
                    {
                        alloyTrack = repo.GetDefault <ProductPage>(startReference);

                        alloyTrack.Name                = "Alloy Track";
                        alloyTrack.MetaDescription     = "Projects have a natural lifecycle with well-defined stages.";
                        alloyTrack.MainBody            = new XhtmlString("From start-up meetings to final sign-off, we have the solutions for today’s market-driven needs. Leverage your assets to the fullest through the combination of Alloy Plan, Alloy Meet and Alloy Track.");
                        alloyTrack.Theme               = "theme3";
                        alloyTrack.UniqueSellingPoints = new[]
                        {
                            "Shared timeline",
                            "Project emails",
                            "To-do lists",
                            "Workflows",
                            "Status reports"
                        };
                        alloyTrack.SortIndex = 300;
                        alloyTrack.PageImage = repo.GetBySegment(
                            productsFolder.ContentLink, "AlloyTrack.png",
                            CultureInfo.GetCultureInfo("en")).ContentLink;

                        repo.Save(alloyTrack, SaveAction.Publish, AccessLevel.NoAccess);
                    }

                    // change Start page sort order for children
                    if (repo.Get <StartPage>(startReference)
                        .CreateWritableClone() is StartPage startPage)
                    {
                        startPage.ChildSortOrder = FilterSortOrder.Index;
                        repo.Save(startPage, SaveAction.Publish, AccessLevel.NoAccess);
                    }
                }
            }
        }
Esempio n. 10
0
 private static PathInfo _GetPathInfo(int id) => ContentFolder.GetPathInfo(id);
Esempio n. 11
0
        public async Task <ActionResult> CreateContentFolder(string contentType, string storeId, [FromBody] ContentFolder folder)
        {
            var validation = new ContentFolderValidator().Validate(folder);

            if (!validation.IsValid)
            {
                return(BadRequest(new
                {
                    Message = string.Join(" ", validation.Errors.Select(x => x.ErrorMessage)),
                    Errors = validation.Errors
                }));
            }

            var storageProvider = _blobContentStorageProviderFactory.CreateProvider(GetContentBasePath(contentType, storeId));

            await storageProvider.CreateFolderAsync(folder.ToBlobModel(AbstractTypeFactory <BlobFolder> .TryCreateInstance()));

            return(NoContent());
        }
Esempio n. 12
0
 public void SetUp()
 {
     theFolder = ContentFolder.ForApplication();
 }
Esempio n. 13
0
        private void ShowContextMenuForItem(ContentItem item, ref Vector2 location)
        {
            // TODO: verify this logic during elements searching

            Assert.IsNull(_newElement);

            // Cache data
            bool          isValidElement = item != null;
            var           proxy          = Editor.ContentDatabase.GetProxy(item);
            ContentFolder folder         = null;
            bool          isFolder       = false;

            if (isValidElement)
            {
                isFolder = item.IsFolder;
                folder   = isFolder ? (ContentFolder)item : item.ParentFolder;
            }
            else
            {
                folder = CurrentViewFolder;
            }
            Assert.IsNotNull(folder);
            bool isRootFolder = CurrentViewFolder == _root.Folder;

            // Create context menu
            ContextMenuButton    b;
            ContextMenuChildMenu c;
            ContextMenu          cm = new ContextMenu();

            cm.Tag = item;
            if (isValidElement)
            {
                b         = cm.AddButton("Open", () => Open(item));
                b.Enabled = proxy != null || isFolder;

                cm.AddButton("Show in explorer", () => Application.StartProcess(System.IO.Path.GetDirectoryName(item.Path)));

                if (item.HasDefaultThumbnail == false)
                {
                    cm.AddButton("Refresh thumbnail", item.RefreshThumbnail);
                }

                if (!isFolder)
                {
                    b         = cm.AddButton("Reimport", ReimportSelection);
                    b.Enabled = proxy != null && proxy.CanReimport(item);

                    if (item is BinaryAssetItem binaryAsset)
                    {
                        string importPath;
                        if (!binaryAsset.GetImportPath(out importPath))
                        {
                            string importLocation = System.IO.Path.GetDirectoryName(importPath);
                            if (!string.IsNullOrEmpty(importLocation) && System.IO.Directory.Exists(importLocation))
                            {
                                cm.AddButton("Show import location", () => Application.StartProcess(importLocation));
                            }
                        }
                    }

                    if (Editor.CanExport(item.Path))
                    {
                        b = cm.AddButton("Export", ExportSelection);
                    }
                }

                cm.AddButton("Delete", () => Delete(item));

                cm.AddSeparator();

                // TODO: exportig assets
                //b = cm.AddButton(4, "Export");
                //b.Enabled = proxy != null && proxy.CanExport;

                b         = cm.AddButton("Clone", _view.Duplicate);
                b.Enabled = !isFolder;

                cm.AddButton("Copy", _view.Copy);

                cm.AddButton("Paste", _view.Paste);
                b.Enabled = _view.CanPaste();

                cm.AddButton("Rename", () => Rename(item));

                // Custom options
                ContextMenuShow?.Invoke(cm, item);
                proxy?.OnContentWindowContextMenu(cm, item);

                cm.AddButton("Copy name to Clipboard", () => Application.ClipboardText = item.NamePath);

                cm.AddButton("Copy path to Clipboard", () => Application.ClipboardText = item.Path);
            }
            else
            {
                cm.AddButton("Show in explorer", () => Application.StartProcess(CurrentViewFolder.Path));

                b         = cm.AddButton("Paste", _view.Paste);
                b.Enabled = _view.CanPaste();

                cm.AddButton("Refresh", () => Editor.ContentDatabase.RefreshFolder(CurrentViewFolder, true));

                cm.AddButton("Refresh all thumbnails", RefreshViewItemsThumbnails);
            }

            cm.AddSeparator();

            if (!isRootFolder)
            {
                cm.AddButton("New folder", NewFolder);
            }

            c = cm.AddChildMenu("New");
            c.ContextMenu.Tag = item;
            int newItems = 0;

            for (int i = 0; i < Editor.ContentDatabase.Proxy.Count; i++)
            {
                var p = Editor.ContentDatabase.Proxy[i];
                if (p.CanCreate(folder))
                {
                    c.ContextMenu.AddButton(p.Name, () => NewItem(p));
                    newItems++;
                }
            }
            c.Enabled = newItems > 0;

            if (folder.CanHaveAssets)
            {
                cm.AddButton("Import file", () =>
                {
                    _view.ClearSelection();
                    Editor.ContentImporting.ShowImportFileDialog(CurrentViewFolder);
                });
            }

            // Show it
            cm.Show(this, location);
        }
        public IHttpActionResult CreateContentFolder(string contentType, string storeId, ContentFolder folder)
        {
            var storageProvider = _contentStorageProviderFactory(GetContentBasePath(contentType, storeId));

            storageProvider.CreateFolder(folder.ToBlobModel());
            return StatusCode(HttpStatusCode.NoContent);
        }
Esempio n. 15
0
        public List <TextContentObject> take(int count)
        {
            var sitedb = this.txtObjRepo.context.WebSite.SiteDb();

            var allContentTypes = sitedb.ContentTypes.All();

            ContentType   onlyType   = null;
            ContentFolder onlyFolder = null;

            var condition = this.txtObjRepo.ParseCondition(this.SearchCondition);

            var tablequery = sitedb.TextContent.Query.Where(o => o.Online == true);

            if (condition.FolderId != default(Guid))
            {
                tablequery.Where(o => o.FolderId == condition.FolderId);

                var folder = sitedb.ContentFolders.Get(condition.FolderId);
                if (folder != null)
                {
                    onlyFolder = folder;
                    onlyType   = sitedb.ContentTypes.Get(folder.ContentTypeId);
                }
            }

            if (condition.ContentTypeId != default(Guid))
            {
                tablequery.Where(o => o.ContentTypeId == condition.ContentTypeId);
                var type = sitedb.ContentTypes.Get(condition.ContentTypeId);
                if (type != null)
                {
                    onlyType = type;
                }
            }


            if (condition.CategoryId != default(Guid))
            {
                var allcontentids = sitedb.ContentCategories.Query.Where(o => o.CategoryId == condition.CategoryId).SelectAll().Select(o => o.ContentId).ToList();

                tablequery.WhereIn("Id", allcontentids);
            }

            var all = tablequery.SelectAll();


            var filteritems = this.txtObjRepo.filterItems(all, condition.Conditions, onlyType, onlyFolder);

            if (filteritems == null || !filteritems.Any())
            {
                return(new List <TextContentObject>());
            }


            if (!string.IsNullOrWhiteSpace(this.OrderByField))
            {
                ContentProperty prop = null;
                if (onlyType != null)
                {
                    prop = onlyType.Properties.Find(o => Kooboo.Lib.Helper.StringHelper.IsSameValue(o.Name, this.OrderByField));
                }

                if (prop == null)
                {
                    var uniqueC = filteritems
                                  .Select(p => p.ContentTypeId)
                                  .Distinct();

                    foreach (var item in uniqueC)
                    {
                        var uniquetype = sitedb.ContentTypes.Get(item);
                        if (uniquetype != null)
                        {
                            var find = uniquetype.Properties.Find(o => Kooboo.Lib.Helper.StringHelper.IsSameValue(o.Name, this.OrderByField));
                            if (find != null)
                            {
                                prop = find;
                                break;
                            }
                        }
                    }
                }

                if (prop != null)
                {
                    if (this.Ascending)
                    {
                        filteritems = filteritems.OrderBy(o => GetValue(o.GetValue(this.OrderByField), prop.DataType)).ToList();
                    }
                    else
                    {
                        filteritems = filteritems.OrderByDescending(c => GetValue(c.GetValue(OrderByField), prop.DataType)).ToList();
                    }
                }
            }


            var txtResult = filteritems.Skip(this.skipcount).Take(count);

            List <TextContentObject> result = new List <TextContentObject>();

            foreach (var item in txtResult)
            {
                var obj = new TextContentObject(item, this.txtObjRepo.context);
                result.Add(obj);
            }
            return(result);
        }
Esempio n. 16
0
        public void NewProject(string path)
        {
            if (path == null) throw new ArgumentNullException("path");

            // プロジェクトが既に開かれているならば、それを閉じます。
            CloseProject();

            // プロジェクトを作成します。
            Project = ContentProject.Create(path, buildLogger);
            Project.OutputPath = AppDomain.CurrentDomain.BaseDirectory;

            // このプロジェクトのコンテンツをロードする AdhocContentManager を生成します。
            ContentManager = new AdhocContentManager(Services, Project.RuntimeContentPath);

            // ルート ディレクトリを設定します。
            RootFolder = new ContentFolder(new DirectoryInfo(Project.DirectoryPath));
        }
 /// <inheritdoc />
 public override bool CanCreate(ContentFolder targetLocation)
 {
     return(targetLocation.CanHaveScripts);
 }
        private IEnumerable<ImageData> GetImageFiles(ContentFolder contentFolder)
        {
            var contentLoader = ServiceLocator.Current.GetInstance<IContentLoader>();

            var queue = new Queue<ContentFolder>();
            queue.Enqueue(contentFolder);
            while (queue.Count > 0)
            {
                contentFolder = queue.Dequeue();
                try
                {
                    foreach (ContentFolder subDir in contentLoader.GetChildren<ContentFolder>(contentFolder.ContentLink))
                    {
                        queue.Enqueue(subDir);
                    }
                }
                catch
                {
                }
                IEnumerable<ImageData> files = null;
                try
                {
                    files = contentLoader.GetChildren<ImageData>(contentFolder.ContentLink);
                }
                catch
                {
                }
                if (files != null)
                {
                    foreach (var imageData in files)
                    {
                        yield return imageData;
                    }
                }
            }
        }
Esempio n. 19
0
        /// <summary>
        /// Imports the specified file.
        /// </summary>
        /// <param name="file">The file.</param>
        /// <param name="targetLocation">The target location.</param>
        /// <param name="skipSettingsDialog">True if skip any popup dialogs showing for import options adjusting. Can be used when importing files from code.</param>
        /// <param name="settings">Import settings to override. Use null to skip this value.</param>
        public void Import(string file, ContentFolder targetLocation, bool skipSettingsDialog = false, object settings = null)
        {
            bool skipDialog = skipSettingsDialog;

            Import(file, targetLocation, skipSettingsDialog, settings, ref skipDialog);
        }