コード例 #1
0
 public MemoryCacheItem()
 {
     version    = VERSION;
     name       = "";
     pfd        = new Packages.PackedFileDescriptor();
     valuenames = new string[0];
 }
コード例 #2
0
 public WantCacheItem()
 {
     version = VERSION;
     name    = "";
     type    = "";
     folder  = "";
     pfd     = new Packages.PackedFileDescriptor();
 }
コード例 #3
0
 public MMATCacheItem()
 {
     version   = VERSION;
     modelname = "";
     family    = "";
     def       = false;
     pfd       = new Packages.PackedFileDescriptor();
 }
コード例 #4
0
        public RcolCacheItem()
        {
            version      = VERSION;
            resourcename = "";
            modelname    = "";
            rtp          = RcolCacheItemType.Unknown;

            pfd = new Packages.PackedFileDescriptor();
        }
コード例 #5
0
 public ObjectCacheItem()
 {
     version   = VERSION;
     name      = "";
     modelname = "";
     objname   = "";
     use       = true;
     pfd       = new Packages.PackedFileDescriptor();
 }
コード例 #6
0
        private void ChangeFile(object sender, System.Windows.Forms.LinkLabelLinkClickedEventArgs e)
        {
            try
            {
                Packages.PackedFileDescriptor pfd = null;
                if (lblist.SelectedIndex >= 0)
                {
                    pfd = (Packages.PackedFileDescriptor)lblist.Items[lblist.SelectedIndex];
                }
                else
                {
                    pfd = new Packages.PackedFileDescriptor();
                }

                pfd.Group    = Convert.ToUInt32(this.tbgroup.Text, 16);
                pfd.Instance = Convert.ToUInt32(this.tbinstance.Text, 16);
                pfd.SubType  = Convert.ToUInt32(this.tbsubtype.Text, 16);
                pfd.Type     = Convert.ToUInt32(this.tbtype.Text, 16);

                if (lblist.SelectedIndex >= 0)
                {
                    lblist.Items[lblist.SelectedIndex] = pfd;
                    try
                    {
                        RefFileItem rfi = (RefFileItem)pfd;
                        rfi.Skin = null;
                    }
                    catch {}
                }
                else
                {
                    lblist.Items.Add(pfd);
                }
            }
            catch (Exception ex)
            {
                Helper.ExceptionMessage(Localization.Manager.GetString("errconvert"), ex);
            }
        }
コード例 #7
0
        public void ExtractAllFiles(string selpath, SimPe.Interfaces.Files.IPackedFileDescriptor[] pfds, SimPe.Packages.ExtractableFile package)
        {
            int    excount   = 0;
            int    filecount = 0;
            string xml       = "";
            bool   run       = WaitingScreen.Running;

            if (!run)
            {
                WaitingScreen.Wait();
            }
            try
            {
                xml += "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>" + Helper.lbr;
                xml += "<package type=\"" + ((uint)package.Header.IndexType).ToString() + "\">" + Helper.lbr;
                for (int i = 0; i < pfds.Length; i++)
                {
                    System.Windows.Forms.Application.DoEvents();
                    Packages.PackedFileDescriptor fii = (Packages.PackedFileDescriptor)pfds[i];
                    Data.TypeAlias a = fii.TypeName;

                    fii.Path = null;
                    string path = System.IO.Path.Combine(selpath, fii.Path);

                    fii.Filename = null;
                    string name = System.IO.Path.Combine(path, fii.Filename);

                    try
                    {
                        if (!System.IO.Directory.Exists(path))
                        {
                            System.IO.Directory.CreateDirectory(path);
                        }

                        //make sure the sub xmls don't have a Filename
                        fii.Path = "";
                        package.SavePackedFile(name, null, fii, true);
                        fii.Path = null;

                        xml += fii.GenerateXmlMetaInfo();

                        filecount++;
                    }
                    catch (Exception ex)
                    {
                        excount++;
                        Helper.ExceptionMessage(Localization.Manager.GetString("errwritingfile") + " " + name, ex);
                        if (excount >= 5)
                        {
                            if (Message.Show(Localization.Manager.GetString("ask000"), Localization.Manager.GetString("proceed"), System.Windows.Forms.MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes)
                            {
                                i = pfds.Length;
                            }
                        }
                    }
                }                //for i
                xml += "</package>" + Helper.lbr;

                System.IO.TextWriter tw = System.IO.File.CreateText(System.IO.Path.Combine(selpath, "package.xml"));
                try
                {
                    tw.Write(xml);
                }
                catch (Exception ex)
                {
                    Helper.ExceptionMessage(Localization.Manager.GetString("err001"), ex);
                }
                finally
                {
                    tw.Close();
                    tw.Dispose();
                    tw = null;
                }
            }
            finally
            {
                if (!run)
                {
                    WaitingScreen.Stop();
                }
            }

            Message.Show(Localization.Manager.GetString("nfo000").Replace("{0}", filecount.ToString()), "Info", System.Windows.Forms.MessageBoxButtons.OK);
        }