private static void ProcessSampleDataFile(DataSetContext dataSetContext, IProjectItem projectItem, string sampleDataFolder, List <SampleDataCollection.SampleDataSetProjectInfo> collection)
        {
            string path = projectItem.DocumentReference.Path;

            if (!path.StartsWith(sampleDataFolder, StringComparison.OrdinalIgnoreCase))
            {
                return;
            }
            string extension = Path.GetExtension(path);

            if (!extension.Equals(".xsd", StringComparison.OrdinalIgnoreCase) && !extension.Equals(".xaml", StringComparison.OrdinalIgnoreCase))
            {
                return;
            }
            string withoutExtension = Path.GetFileNameWithoutExtension(path);

            if (!string.Format((IFormatProvider)CultureInfo.InvariantCulture, "{0}{1}{2}{1}{3}", (object)sampleDataFolder, (object)withoutExtension, (object)Path.DirectorySeparatorChar, (object)extension).Equals(path, StringComparison.OrdinalIgnoreCase))
            {
                return;
            }
            SampleDataCollection.SampleDataSetProjectInfo sampleDataSetInfo = SampleDataCollection.GetOrCreateSampleDataSetInfo(dataSetContext, withoutExtension, collection);
            if (extension.Equals(".xsd", StringComparison.OrdinalIgnoreCase))
            {
                sampleDataSetInfo.XsdItem = projectItem;
            }
            else
            {
                sampleDataSetInfo.XamlItem = projectItem;
            }
        }
        private void SafelyRemoveSampleDataAndRootFolder(SampleDataSet dataSet, bool forceDeleteFiles)
        {
            dataSet.Close();
            if (forceDeleteFiles)
            {
                SampleDataCollection.DeleteFolder(dataSet.SampleDataFolder, false);
            }
            else
            {
                SampleDataCollection.DeleteFolder(dataSet.AssetFilesFolder, true);
                SampleDataCollection.DeleteFolder(dataSet.SampleDataFolder, true);
            }
            this.OnSampleDataRemoving(dataSet);
            this.dataSets.Remove(dataSet);
            if (Enumerable.FirstOrDefault <SampleDataSet>(Enumerable.Where <SampleDataSet>((IEnumerable <SampleDataSet>) this.dataSets, (Func <SampleDataSet, bool>)(item => item.Context == dataSet.Context))) != null)
            {
                return;
            }
            string       path        = Path.Combine(Path.GetDirectoryName(this.projectContext.ProjectPath), dataSet.Context.DataRootFolder);
            IProject     project     = (IProject)this.projectContext.GetService(typeof(IProject));
            IProjectItem projectItem = project.FindItem(DocumentReference.Create(path));

            if (projectItem == null || Enumerable.FirstOrDefault <IProjectItem>(projectItem.Children) != null)
            {
                return;
            }
            project.RemoveItems(0 != 0, projectItem);
            SampleDataCollection.DeleteFolder(dataSet.Context.DataRootFolder, true);
        }
        public void LoadFromProject(Microsoft.Expression.Framework.IReadOnlyCollection <IProjectItem> projectItems)
        {
            string directoryName     = Path.GetDirectoryName(this.projectContext.ProjectPath);
            string sampleDataFolder1 = Path.Combine(directoryName, DataSetContext.SampleData.DataRootFolder) + (object)Path.DirectorySeparatorChar;
            string sampleDataFolder2 = Path.Combine(directoryName, DataSetContext.DataStore.DataRootFolder) + (object)Path.DirectorySeparatorChar;
            List <SampleDataCollection.SampleDataSetProjectInfo> collection = new List <SampleDataCollection.SampleDataSetProjectInfo>();

            foreach (IProjectItem projectItem in (IEnumerable <IProjectItem>)projectItems)
            {
                SampleDataCollection.ProcessSampleDataFile(DataSetContext.SampleData, projectItem, sampleDataFolder1, collection);
                SampleDataCollection.ProcessSampleDataFile(DataSetContext.DataStore, projectItem, sampleDataFolder2, collection);
            }
            for (int index = 0; index < collection.Count; ++index)
            {
                this.LoadSampleDataSetFromProjectInfo(collection[index]);
            }
        }