示例#1
0
        /// <summary>
        /// Loads all instances from the specified directory
        /// </summary>
        /// <param name="instDir">Directory containing the instances</param>
        /// <returns>The instances loaded</returns>
        public static OldInstance[] LoadInstances(string instDir)
        {
            if (!Directory.Exists(instDir))
            {
                return(new OldInstance[0]);
            }

            ArrayList instList = new ArrayList();

            foreach (string dir in Directory.GetDirectories(instDir))
            {
                Console.WriteLine("Loading instance from " + dir + "...");
                OldInstance inst = null;
                try
                {
                    inst = LoadInstance(dir);
                }
                catch (InvalidInstanceException e)
                {
                    Console.WriteLine(e.Message);
                }

                if (inst != null)
                {
                    instList.Add(inst);
                }
            }
            return((OldInstance[])instList.ToArray(typeof(OldInstance)));
        }
示例#2
0
        public Instance(OldInstance oldInst)
        {
            this.cfgFile = new ConfigFile();
            this.rootDir = oldInst.RootDir;

            this.autosave = true;

            InstMods = new InstanceMods(this);
            InstMods.Update();

            this.IconKey      = oldInst.IconKey;
            this.Name         = oldInst.Name;
            this.NeedsRebuild = oldInst.NeedsRebuild;

            Console.WriteLine(MinecraftDir);
            //this.Notes = oldInst.Notes;
        }