Ejemplo n.º 1
0
        /// <summary>
        ///     This is an internal API that supports the Entity Framework Core infrastructure and not subject to
        ///     the same compatibility standards as public APIs. It may be changed or removed without notice in
        ///     any release. You should only use it directly in your code with extreme caution and knowing that
        ///     doing so can result in application failures when updating to a new Entity Framework Core release.
        /// </summary>
        public ModelCreationDependencies(
            [NotNull] IModelSource modelSource,
            [NotNull] IConventionSetBuilder conventionSetBuilder,
            [NotNull] ModelDependencies modelDependencies)
        {
            Check.NotNull(modelSource, nameof(modelSource));
            Check.NotNull(conventionSetBuilder, nameof(conventionSetBuilder));
            Check.NotNull(modelDependencies, nameof(modelDependencies));

            ModelSource          = modelSource;
            ConventionSetBuilder = conventionSetBuilder;
            ModelDependencies    = modelDependencies;
        }
Ejemplo n.º 2
0
 void IPatchServiceInjectionSite.InjectServices(IServiceProvider serviceProvider)
 => ModelSource = serviceProvider.GetService <IModelSource>();
Ejemplo n.º 3
0
 /// <summary>
 ///     Clones this dependency parameter object with one service replaced.
 /// </summary>
 /// <param name="modelSource"> A replacement for the current dependency of this type. </param>
 /// <returns> A new parameter object with the given service replaced. </returns>
 public ModelCreationDependencies With([NotNull] IModelSource modelSource)
 => new ModelCreationDependencies(modelSource, ConventionSetBuilder, ModelDependencies);
Ejemplo n.º 4
0
        /// <summary>
        /// Reads the file specified by fileName into the program.
        /// </summary>
        /// <param name="fileName">File to read into the program</param>
        public void Open(string fileName)
        {
            if (isDataLoaded)
            {
                Close();
            }

            IModelSource source = null;

            try
            {
                string[] fileNameExtension = fileName.Split('.');

                if (fileNameExtension.Count() >= 2)
                {
                    switch (fileNameExtension[fileNameExtension.Count() - 1])
                    {
                        case "arc":
                        case "rarc":
                            source = new ARC();
                            break;
                        case "dae":
                            source = new DAE();
                            break;
                        case "dzb":
                            source = new DZB();
                            break;
                        case "obj":
                            source = new OBJ();
                            break;
                        default:
                            Console.WriteLine("Unknown file type " + 
                                fileNameExtension[fileNameExtension.Count() - 1] + ". Aborting...");
                            return;
                    }

                    Categories = (ObservableCollection<Category>)source.Load(fileName);

                    // Probably a hotfix. If the user tried to open an archive, but the archive didn't have any DZBs in it,
                    // the archive loader will return null.
                    if (Categories == null)
                    {
                        MessageBox.Show("The archive you opened did not contain any DZB collision files.", "No DZB files found");

                        return;
                    }

                    AddRenderableObjs();

                    FocusCameraAll();

                    CurrentFile = fileName;

                    m_recentFileList.InsertFile(CurrentFile);

                    isDataLoaded = true;
                }
            }

            catch
            {
                if (m_recentFileList.RecentFiles.Contains(fileName))
                {
                    MessageBox.Show("The file '" + fileName + "' no longer exists. It will be removed from the recently used files.", "File Not Found");

                    m_recentFileList.RemoveFile(fileName);
                }
            }
        }
Ejemplo n.º 5
0
        // Dingletons

        public static EntityServicesBuilder UseModelSource([NotNull] this EntityServicesBuilder builder, [NotNull] IModelSource modelSource)
        {
            Check.NotNull(modelSource, "modelSource");

            builder.ServiceCollection.AddInstance(modelSource);

            return(builder);
        }