private void AddAsset(LibraryAsset asset)
 {
     if (asset.IsImage) AddImage(asset);
     else if (asset.IsFont) AddFont(asset);
     else if (asset.IsSwf) AddSwf(asset);
     else if (asset.IsSound) AddSound(asset);
 }
Exemplo n.º 2
0
 public virtual void ChangeAssetPath(string fromPath, string toPath)
 {
     if (IsLibraryAsset(fromPath))
     {
         LibraryAsset asset = libraryAssets[GetRelativePath(fromPath)];
         libraryAssets.Remove(asset);
         asset.Path = GetRelativePath(toPath);
         libraryAssets.Add(asset);
     }
 }
Exemplo n.º 3
0
        /// <summary>
        /// Removes any paths below the given path.
        /// </summary>
        public void RemoveBelow(string path)
        {
            for (int i = 0; i < List.Count; i++)
            {
                LibraryAsset asset = List[i] as LibraryAsset;

                if (asset.Path.StartsWith(path + Path.DirectorySeparatorChar) ||
                    asset.Path == path)
                {
                    List.RemoveAt(i--); // search this index again
                }
            }
        }
        private void AddFont(LibraryAsset asset)
        {
            WriteStartElement("font");
            WriteAttributeString("id", asset.ID);
            WriteAttributeString("name", asset.ID);
            WriteAttributeString("import", asset.Path);

            if (asset.FontGlyphs != null)
                WriteAttributeString("glyphs",asset.FontGlyphs);
            else
                WriteAttributeString("glyphs", "1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ `~!@#$%^&*()-_=+[]{}\\|;:'\",./<>?");

            AddStampAttributes(asset.Path);
            WriteEndElement();
        }
 private void AddImage(LibraryAsset asset)
 {
     if (asset.BitmapLinkage)
     {
         WriteStartElement("bitmap");
     }
     else
     {
         WriteStartElement("clip");
     }
     WriteAttributeString("id", asset.ID);
     WriteAttributeString("name", asset.ID);
     WriteAttributeString("import", asset.Path);
     AddStampAttributes(asset.Path);
     WriteEndElement();
 }
        private string[] ReadLibrary(string name, SwfAssetMode mode)
        {
            ReadStartElement(name);
            List<string> elements = new List<string>();
            while (Name == "element")
            {
                string path = OSPath(GetAttribute("path"));
                elements.Add(path);

                if (mode != SwfAssetMode.Ignore)
                {
                    LibraryAsset asset = new LibraryAsset(project, path);
                    asset.SwfMode = mode;
                    project.LoomLibraries.Add(asset);
                }
                Read();
            }
            ReadEndElement();
            string[] result = new string[elements.Count];
            elements.CopyTo(result);
            return result;
        }
Exemplo n.º 7
0
 public override void SetLibraryAsset(string path, bool isLibraryAsset)
 {
     if (!IsLoomLib(path)) return;
     else
     {
         string relPath = GetRelativePath(path);
         if (isLibraryAsset)
         {
             LibraryAsset asset = new LibraryAsset(this, relPath);
             asset.SwfMode = SwfAssetMode.Library;
             LoomLibraries.Add(asset);
         }
         else
         {
             LoomLibraries.Remove(path);
             LoomLibraries.Remove(relPath);
         }
         RebuildCompilerOptions();
         OnClasspathChanged();
     }
 }
Exemplo n.º 8
0
 public override void PropertiesChanged()
 {
     // rebuild Swc assets list
     LoomLibraries.Clear();
     LibraryAsset asset;
     foreach (string path in CompilerOptions.LibraryPaths)
     {
         asset = new LibraryAsset(this, path);
         asset.SwfMode = SwfAssetMode.Library;
         LoomLibraries.Add(asset);
     }
     base.PropertiesChanged();
 }
        private void AddSwf(LibraryAsset asset)
        {
            WriteStartElement("clip");

            if (asset.SwfMode == SwfAssetMode.Library)
            {
                WriteAttributeString("id", asset.ID);
                WriteAttributeString("name", asset.ID);
            }
            WriteAttributeString("import", asset.Path);
            AddStampAttributes(asset.Path);
            WriteEndElement();
        }
 private void AddSound(LibraryAsset asset)
 {
     //<sound id="Funk" name="Funk" import="Funk.mp3"/>
     WriteStartElement("sound");
     WriteAttributeString("id", asset.ID);
     WriteAttributeString("name", asset.ID);
     WriteAttributeString("import", asset.Path);
     AddStampAttributes(asset.Path);
     WriteEndElement();
 }
Exemplo n.º 11
0
		public void Add(LibraryAsset asset)
		{
			List.Add(asset);
		}
Exemplo n.º 12
0
		public void Remove(LibraryAsset asset)
		{
			List.Remove(asset);
		}
        public LibraryAssetDialog(LibraryAsset asset, Project project)
        {
            this.asset = asset;
            this.Text = "\"" + System.IO.Path.GetFileName(asset.Path) + "\"";
            InitializeComponent();
            isAS3 = (project.Language == "as3");
            isSWC = asset.IsSwc 
                || asset.SwfMode == SwfAssetMode.Library 
                || asset.SwfMode == SwfAssetMode.IncludedLibrary 
                || asset.SwfMode == SwfAssetMode.ExternalLibrary;

            #region Setup Tabs

            if (isSWC)
            {
                tabControl.TabPages.Remove(fontTabPage);
                tabControl.TabPages.Remove(advancedTabPage);
                switch (asset.SwfMode)
                {
                    case SwfAssetMode.Library: swcLibOption.Checked = true; break;
                    case SwfAssetMode.IncludedLibrary: swcIncOption.Checked = true; break;
                    case SwfAssetMode.ExternalLibrary: swcExtOption.Checked = true; break;
                }
            }
            else tabControl.TabPages.Remove(swcTabPage);

            if (asset.IsImage || asset.IsSound)
            {
                tabControl.TabPages.Remove(swfTabPage);
                tabControl.TabPages.Remove(fontTabPage);
            }
            else if (asset.IsFont)
            {
                tabControl.TabPages.Remove(swfTabPage);
            }
            else if (isSWC)
            {
                tabControl.TabPages.Remove(fontTabPage);
            }
            
            if (isAS3) tabControl.TabPages.Remove(swfTabPage);

            #endregion

            #region Setup Form

            autoIDBox.Checked = asset.ManualID == null;
            idTextBox.Text = asset.ID;
            keepUpdatedBox.Checked = (asset.UpdatePath != null);
            updatedTextBox.Text = asset.UpdatePath;
            addLibraryButton.Checked = (asset.SwfMode == SwfAssetMode.Library);
            addPreloaderButton.Checked = (asset.SwfMode == SwfAssetMode.Preloader);
            sharedLibraryButton.Checked = (asset.SwfMode == SwfAssetMode.Shared);
            specifySharepointBox.Checked = asset.Sharepoint != null;
            sharepointTextBox.Text = asset.Sharepoint;
            embedAllButton.Checked = (asset.FontGlyphs == null);
            embedTheseButton.Checked = (asset.FontGlyphs != null);
            charactersTextBox.Text = asset.FontGlyphs;
            bitmapLinkageBox.Checked = asset.BitmapLinkage;

            #endregion

            EnableDisable();
            InitializeLocalization();
            this.Font = PluginCore.PluginBase.Settings.DefaultFont;
        }
Exemplo n.º 14
0
 public void Remove(LibraryAsset asset)
 {
     List.Remove(asset);
 }
Exemplo n.º 15
0
 public void Add(LibraryAsset asset)
 {
     List.Add(asset);
 }