public void ReadLibraryAssets()
        {
            ReadStartElement("library");
            while (Name == "asset")
            {
                string path = OSPath(GetAttribute("path"));
                string mode = GetAttribute("mode");

                if (path == null)
                {
                    throw new Exception("All library assets must have a 'path' attribute.");
                }

                LibraryAsset asset = new LibraryAsset(project, path);
                project.LibraryAssets.Add(asset);

                asset.ManualID   = GetAttribute("id");               // could be null
                asset.UpdatePath = OSPath(GetAttribute("update"));   // could be null
                asset.FontGlyphs = GetAttribute("glyphs");           // could be null

                if (mode != null)
                {
                    asset.SwfMode = (SwfAssetMode)Enum.Parse(typeof(SwfAssetMode), mode, true);
                }

                if (asset.SwfMode == SwfAssetMode.Shared)
                {
                    asset.Sharepoint = GetAttribute("sharepoint");                     // could be null
                }
                Read();
            }
            ReadEndElement();
        }
示例#2
0
 public void ChangeAssetPath(string fromPath, string toPath)
 {
     if (IsLibraryAsset(fromPath))
     {
         LibraryAsset asset = libraryAssets[GetRelativePath(fromPath)];
         libraryAssets.Remove(asset);
         asset.Path = GetRelativePath(toPath);
         libraryAssets.Add(asset);
     }
 }
示例#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
                }
            }
        }
示例#4
0
 public void Add(LibraryAsset asset)
 {
     List.Add(asset);
 }
示例#5
0
 public void Remove(LibraryAsset asset)
 {
     List.Remove(asset);
 }
示例#6
0
		public void Add(LibraryAsset asset)
		{
			List.Add(asset);
		}
示例#7
0
		public void Remove(LibraryAsset asset)
		{
			List.Remove(asset);
		}
		public LibraryAssetDialog(LibraryAsset asset)
		{
			this.asset = asset;
			this.Text = "\""+System.IO.Path.GetFileName(asset.Path)+"\"";
			InitializeComponent();

			#region Setup Tabs

			if (asset.IsImage)
			{
				tabControl.TabPages.Remove(swfTabPage);
				tabControl.TabPages.Remove(fontTabPage);
			}
			else if (asset.IsFont)
			{
				tabControl.TabPages.Remove(swfTabPage);
			}
			else if (asset.IsSwf)
			{
				tabControl.TabPages.Remove(fontTabPage);
			}

			#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;

			#endregion

			EnableDisable();
		}
示例#9
0
		public void ReadLibraryAssets()
		{
			ReadStartElement("library");
			while (Name == "asset")
			{
				string path = OSPath(GetAttribute("path"));
				string mode = GetAttribute("mode");
				
				if (path == null)
					throw new Exception("All library assets must have a 'path' attribute.");
				
				LibraryAsset asset = new LibraryAsset(project,path);
				project.LibraryAssets.Add(asset);
				
				asset.ManualID = GetAttribute("id"); // could be null
				asset.UpdatePath = OSPath(GetAttribute("update")); // could be null
				asset.FontGlyphs = GetAttribute("glyphs"); // could be null

				if (mode != null)
					asset.SwfMode = (SwfAssetMode)Enum.Parse(typeof(SwfAssetMode),mode,true);

				if (asset.SwfMode == SwfAssetMode.Shared)
					asset.Sharepoint = GetAttribute("sharepoint"); // could be null

				Read();
			}			
			ReadEndElement();
		}
		private void AddSwf(LibraryAsset asset)
		{
			WriteStartElement("clip");

			if (asset.SwfMode == SwfAssetMode.Library)
				WriteAttributeString("id", asset.ID);

			WriteAttributeString("import", asset.Path);
			AddStampAttributes(asset.Path);
			WriteEndElement();
		}
		private void AddFont(LibraryAsset asset)
		{
			WriteStartElement("font");
			WriteAttributeString("id", 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)
		{
			WriteStartElement("clip");
			WriteAttributeString("id", asset.ID);
			WriteAttributeString("import", asset.Path);
			AddStampAttributes(asset.Path);
			WriteEndElement();
		}
		private void AddAsset(LibraryAsset asset)
		{
			if (asset.IsImage) AddImage(asset);
			else if (asset.IsFont) AddFont(asset);
			else if (asset.IsSwf) AddSwf(asset);
		}