示例#1
0
        private void ScanSemiGlobals(object sender, System.Windows.Forms.LinkLabelLinkClickedEventArgs e)
        {
            this.Cursor = Cursors.WaitCursor;
            lbfiles.Items.Clear();
            this.btimport.Enabled = false;

            if (cbsemi.SelectedIndex < 0)
            {
                return;
            }
            ArrayList loaded = new ArrayList();

            try
            {
                SimPe.Plugin.NamedGlob glob = (SimPe.Plugin.NamedGlob)cbsemi.Items[cbsemi.SelectedIndex];
                Interfaces.Scenegraph.IScenegraphFileIndexItem[] items = FileTable.FileIndex.FindFileByGroup(glob.SemiGlobalGroup);

                lbfiles.Sorted = false;
                foreach (Interfaces.Scenegraph.IScenegraphFileIndexItem item in items)
                {
                    if (item.FileDescriptor.Type == Data.MetaData.BHAV_FILE)
                    {
                        SimPe.Plugin.Bhav bhav = new SimPe.Plugin.Bhav(null);
                        bhav.ProcessData(item);
                        item.FileDescriptor.Filename = item.FileDescriptor.TypeName.shortname + ": " + bhav.FileName + " (" + item.FileDescriptor.ToString() + ")";
                    }
                    else if (item.FileDescriptor.Type == Data.MetaData.STRING_FILE)
                    {
                        SimPe.PackedFiles.Wrapper.Str str = new SimPe.PackedFiles.Wrapper.Str();
                        str.ProcessData(item);
                        item.FileDescriptor.Filename = item.FileDescriptor.TypeName.shortname + ": " + str.FileName + " (" + item.FileDescriptor.ToString() + ")";
                    }
                    else if (item.FileDescriptor.Type == 0x42434F4E)                      //BCON
                    {
                        SimPe.Plugin.Bcon bcon = new SimPe.Plugin.Bcon();
                        bcon.ProcessData(item);
                        item.FileDescriptor.Filename = item.FileDescriptor.TypeName.shortname + ": " + bcon.FileName + " (" + item.FileDescriptor.ToString() + ")";
                    }
                    else
                    {
                        item.FileDescriptor.Filename = item.FileDescriptor.ToString();
                    }

                    if (!loaded.Contains(item.FileDescriptor))
                    {
                        lbfiles.Items.Add(item, ((item.FileDescriptor.Type == Data.MetaData.BHAV_FILE) || (item.FileDescriptor.Type == 0x42434F4E)));
                        loaded.Add(item.FileDescriptor);
                    }
                }
                lbfiles.Sorted        = true;
                this.btimport.Enabled = (lbfiles.Items.Count > 0);
            }
            catch (Exception) {}

            this.Cursor = Cursors.Default;
        }
示例#2
0
        public ImportSemi()
        {
            //
            // Erforderlich für die Windows Form-Designerunterstützung
            //
            InitializeComponent();

            WaitingScreen.Wait();
            try
            {
                WaitingScreen.UpdateMessage("getting all SemiGlobal Groups");
                FileTable.FileIndex.Load();

                Interfaces.Scenegraph.IScenegraphFileIndexItem[] globs = FileTable.FileIndex.FindFile(Data.MetaData.GLOB_FILE, true);
                ArrayList names = new ArrayList();
                string    max   = " / " + globs.Length.ToString();
                int       ct    = 0;
                foreach (Interfaces.Scenegraph.IScenegraphFileIndexItem item in globs)
                {
                    if (ct % 17 == 0)
                    {
                        WaitingScreen.UpdateMessage(ct.ToString() + max);
                    }
                    ct++;

                    SimPe.Plugin.NamedGlob glob = new SimPe.Plugin.NamedGlob();
                    glob.ProcessData(item.FileDescriptor, item.Package);

                    if (!names.Contains(glob.SemiGlobalName.Trim().ToLower()))
                    {
                        cbsemi.Items.Add(glob);
                        names.Add(glob.SemiGlobalName.Trim().ToLower());
                    }
                }
                cbsemi.Sorted = true;
            }
            finally { WaitingScreen.Stop(); }
        }