Exemple #1
0
        protected static void Load()
        {
            ArrayList list = new ArrayList();

            XmlRegistryKey rk = Helper.WindowsRegistry.RegistryKey.CreateSubKey("ExtTools");

            string[] names = rk.GetSubKeyNames();

            foreach (string name in names)
            {
                string         rname = ToolLoaderItemExt.SplitName(name);
                XmlRegistryKey srk   = rk.CreateSubKey(name);

                ToolLoaderItemExt tli = new ToolLoaderItemExt(rname);
                tli.Type = Convert.ToUInt32(srk.GetValue("type"));
                //tli.Name = Convert.ToString(srk.GetValue("name"));
                tli.FileName   = Convert.ToString(srk.GetValue("filename"));
                tli.Attributes = Convert.ToString(srk.GetValue("attributes"));

                list.Add(tli);
            }

            items = new ToolLoaderItemExt[list.Count];
            list.CopyTo(items);
        }
Exemple #2
0
        /// <summary>
        /// Returns the List of all known Tools for this Type
        /// </summary>
        /// <param name="type"></param>
        /// <returns></returns>
        public static ToolLoaderItemExt[] UsableItems(uint type)
        {
            if (items == null)
            {
                Load();
            }

            ArrayList list = new ArrayList();

            if (type != 0xffffffff)
            {
                foreach (ToolLoaderItemExt tli in items)
                {
                    if (tli.Type == type)
                    {
                        list.Add(tli);
                    }
                }
            }
            foreach (ToolLoaderItemExt tli in items)
            {
                if (tli.Type == 0xffffffff)
                {
                    list.Add(tli);
                }
            }

            ToolLoaderItemExt[] ret = new ToolLoaderItemExt[list.Count];
            list.CopyTo(ret);

            return(ret);
        }
Exemple #3
0
 public ToolLoaderListBoxItemExt(ToolLoaderItemExt tli) : base(tli.Name)
 {
     name      = tli.Name;
     filename  = tli.FileName;
     arguments = tli.Attributes;
     type      = tli.Type;
 }
Exemple #4
0
 /// <summary>
 /// Remove the passed Item
 /// </summary>
 /// <param name="tli"></param>
 public static void Remove(ToolLoaderItemExt tli)
 {
     if (items == null)
     {
         Load();
     }
     items = (ToolLoaderItemExt[])Helper.Delete(items, tli);
 }
Exemple #5
0
 /// <summary>
 /// Add the Passed item
 /// </summary>
 /// <param name="tli"></param>
 public static void Add(ToolLoaderItemExt tli)
 {
     if (items == null)
     {
         Load();
     }
     items = (ToolLoaderItemExt[])Helper.Add(items, tli);
 }
Exemple #6
0
        public ToolLoaderItemExt Execute()
        {
            tli = null;

            this.tbname.Text = Localization.Manager.GetString("Unknown");
            this.tbtype.Text = "0xffffffff";
            this.tbattr.Text = "{tempfile}";
            this.tbfile.Text = "";

            ShowDialog();
            return(tli);
        }
Exemple #7
0
        private void button1_Click(object sender, System.EventArgs e)
        {
            tli            = new ToolLoaderItemExt(tbname.Text);
            tli.Attributes = tbattr.Text;
            tli.FileName   = tbfile.Text;
            try
            {
                tli.Type = Convert.ToUInt32(tbtype.Text);
            }
            catch (Exception)
            {
                tli.Type = 0xffffffff;
            }

            Close();
        }
Exemple #8
0
        /// <summary>
        /// Load FileDescriptors that are stored in the given File
        /// </summary>
        /// <param name="flname"></param>
        /// <param name="list">null or the list that should be used to add the Items</param>
        /// <returns></returns>
        public static void LoadDescriptorsFromDisk(string flname, PackedFileDescriptors list)
        {
            if (list == null)
            {
                return;
            }
            bool run = WaitingScreen.Running;

            if (!run)
            {
                WaitingScreen.Wait();
            }
            WaitingScreen.UpdateMessage("Load Descriptors From Disk");
            //list = new PackedFileDescriptors();
            try
            {
                if (flname.ToLower().EndsWith("package.xml"))
                {
                    SimPe.Packages.File pkg = Packages.GeneratableFile.LoadFromStream(XmlPackageReader.OpenExtractedPackage(null, flname));
                    foreach (Interfaces.Files.IPackedFileDescriptor pfd in pkg.Index)
                    {
                        Interfaces.Files.IPackedFile file = pkg.Read(pfd);
                        pfd.UserData = file.UncompressedData;
                        if (!list.Contains(pfd))
                        {
                            list.Add(pfd);
                        }
                    }
                }
                else if (flname.ToLower().EndsWith(".xml"))
                {
                    Interfaces.Files.IPackedFileDescriptor pfd = XmlPackageReader.OpenExtractedPackedFile(flname);
                    if (!list.Contains(pfd))
                    {
                        list.Add(pfd);
                    }
                }
                else if (flname.ToLower().EndsWith(".package") || flname.ToLower().EndsWith(".simpedis"))
                {
                    SimPe.Packages.File pkg = SimPe.Packages.File.LoadFromFile(flname);
                    foreach (Interfaces.Files.IPackedFileDescriptor pfd in pkg.Index)
                    {
                        Interfaces.Files.IPackedFile file = pkg.Read(pfd);
                        pfd.UserData = file.UncompressedData;
                        if (!list.Contains(pfd))
                        {
                            list.Add(pfd);
                        }
                    }
                }
                else
                {
                    Packages.PackedFileDescriptor pfd = new SimPe.Packages.PackedFileDescriptor();
                    pfd.Type = 0xffffffff;
                    ToolLoaderItemExt.OpenPackedFile(flname, ref pfd);
                    list.Add(pfd);
                }
            }
            finally
            {
                if (!run)
                {
                    WaitingScreen.Stop();
                }
            }
        }