Type: IResourceAudioManager

Summary:

Represents the audio manager

Remarks:

Methods:

NewFromFile(System.String)

Summary:

Creates a new audio from an audio file on disk. Only .wav files !

Parameters:

  1. filePath: audio file - only .wav file

Returns:

The newly created audio resource object

StopAll

Summary:

Stops all audio that are currently playing.

New

Summary:

Creates a new object of the specified type. For example if the manager is a IResourceColorManager, a color will be created. A default name will be automatically generated.

Returns:

Returns the newly created object. Will be null if an error occured.

New(System.String)

Summary:

Creates a new object of the specified type. For example if the manager is a IResourceColorManager, a color will be created.

Parameters:

  1. name: Specifies the name of the object that will be created.

Returns:

Returns the newly created object. Will be null if an error occured.

ImportCSV(System.String,System.Char)

Summary:

Import a 'character' separated value file

Parameters:

  1. filename: Name of file to import
  2. splitter: Character to use as a splitter - By default il will be a comma

ExportCSV(System.String,System.Char)

Summary:

Export object to a 'character' seperated value text file. By default it will a comma so the exported file will be a CSV

Parameters:

  1. filename: File name to export to (full path)
  2. splitter: Character to use as a splitter - By default il will be a comma

Example:

This example shows how to export a CSV and TSV

            // Export in CSV (Comma Separated Values)
            Project.Texts.ExportCSV("C:\\Temp\\Test.csv", ',')
            
            // Export in TSV (Tab Separated Values)
            Project.Texts.ExportCSV("C:\\Temp\\Test.tsv", '\t')
            

Add(IBaseObject)

Summary:

Adds an object in the manager. The object has to be of the correct type.

Parameters:

  1. value: Object to add

AddMultiple(System.Collections.ICollection)

Summary:

Adds a collection of object in the manager. Objects have to be of the correct type.

Parameters:

  1. value: The collection of objects to add

Remove(IBaseObject)

Summary:

Removes an object from the manager

Parameters:

  1. value: Object to remove

RemoveSilentlyBecauseSomethingIsNotRight(IBaseObject)

Summary:

Removes an object from the manager without calling events

Parameters:

  1. value: Object to remove

RemoveMultiple(System.Collections.ICollection)

Summary:

Removes an collection of object from the manager

Parameters:

  1. value: The collection of object to remove

RemoveAll

Summary:

Remove all objects from the manager. The manager will be empty after execution.

GetById(System.Guid)

Summary:

Gets an object by its unique ID. A better way to access an object is by using indexer. See example.

Parameters:

  1. id: Unique ID of the object to find

Returns:

Returns the object. Will return null if the object is not found.

Example:

This example shows how to find an object by its id. This example is using the 'GetById' method but also shows how to use indexer operator.

            id = ... // lets say we have an Id
            myManager = Project.Colors;
            myColor = myManager.GetById(id);
            
            // using the indexer. It is shorter but executes the same code behind the scene.
            myColor = myManager[id];
            

Get(System.String)

Summary:

Gets an object by its name. A better way to access an object is by using indexer. See example.

Parameters:

  1. id: Name of the object to find

Returns:

Returns the object. Will return null if the object is not found.

Example:

This example shows how to find an object by its name. This example is using the 'Get' method but also shows how to use indexer operator.

            myManager = Project.Colors;
            myColor = myManager.Get("Sym3 Red");
            
            // using the indexer. It is shorter but executes the same code behind the scene.
            myColor = myManager["Sym3 Red"];
            

CopyToClipboard

Summary:

Copies the object to clipboard

ToCSVString(System.Char)

Summary:

Returns the object in a CSV string.

Returns:

A string that contains properties of the object in a CSV format.

GetUserPropertyInstance(System.String)

Summary:

Gets the user property instance of the specified name

Parameters:

  1. userPropertyName: The user property name.

Returns:

Returns the user property instance object. If not found, the methods returns null.

Example:

This example shows how to set the value of a user property by using this method

            cc1 = Project.Equipment.Get("CC1");
            
            // get the value of a user property using the method
            userPropertyInstance = cc1.GetUserPropertyInstance("UserProperty1");
            if(userPropertyInstance != null) {
               userPropertyInstance.Value = 3;
            }
            

IsUserProperty(System.String)

Summary:

Indicates if the object contains a user property with the name you specify

Parameters:

  1. userPropertyName: user property name

Returns:

Returns true if the object contains a user property with the name you specified in parameter.

GetUserPropertyValue(System.String)

Summary:

Gets the value of a user property. A better way to get the value of a user property is to use the indexer operator [], see example. Instead of using the method 'GetUserPropertyInstance' and then access the 'Value' property of the returned value, this method simplifies the way we get the value of a user property.

Parameters:

  1. userPropertyName: The name of the user property to set.

Returns:

Returns null if user property is not found. Otherwise returns the value of the user property.

Example:

This example shows how to get the value of a user property using this method and also by using the indexer

            cc1 = Project.Equipment.Get("CC1");
            
            // get the value of a user property using the method
            val = cc1.GetUserPropertyValue("UserProperty1");
            
            // get the value of a user property using the indexer operator
            val = cc1["UserProperty1"];
            

SetUserPropertyValue(System.String,System.Object)

Summary:

Sets the value of a user property. A better way to set the value of a user property is to use the indexer operator [], see example. Instead of using the method 'GetUserPropertyInstance' and then access the 'Value' property of the returned value, this method simplifies the way we set the value of a user property.

Parameters:

  1. userPropertyName: The name of the user property to set.
  2. value: If the user property is not found, this methods does nothing.

Example:

This example shows how to set the value of a user property using this method and also by using the indexer

            cc1 = Project.Equipment.Get("CC1");
            
            // set the value of a user property using the method
            cc1.SetUserPropertyValue("UserProperty1", 3);
            
            // set the value of a user property using the indexer operator
            cc1["UserProperty1"] = 3;
            

ToXmlString

Summary:

Converts the object in an xml string

Returns:

the string that contains xml version of the object

FromXmlString(System.String)

Summary:

Init object from xml. All properties found in the xml will be set with the value in the xml file

Parameters:

  1. xmlText: Xml string

Properties

ManagedObjectType

Summary:

Gets the .Net type of the object that this manager is managing.

Type:

System.Type

Access:

Read

Objects

Summary:

Gets the list of objects

Type:

System.Collections.ObjectModel.ObservableCollection`1[BCS.IBaseObject]

Access:

Read

Example:

This example shows how to loop through every object of the manager

            count = Project.Colors.Count;
            for(i=0; i

Count

Summary:

Get number of objects

Type:

System.Int32

Access:

Read

Id

Summary:

Gets the globally unique identifier (GUID) id of the object. This unique identifier is generated once at the object creation. This id will be kept unique for the entire life of the object, event after saving/loading the project.

Type:

System.Guid

Access:

Read

Example:

This example shows how to get the id of an object in a string format. The following script will output a string like 'b3122ae0-dcf7-43b6-b17c-5381afaca5cb'

            strid = Project.Colors.Get("myColor").Id.ToString();
            print(strid)
            

Name

Summary:

Gets or sets the name of the object. All objects of the same type have a unique name.

Type:

System.String

Access:

Read and Write

Example:

This example shows how to get and set the name of an object.

            // get the color name
            colorname = Project.Colors.Get("myColor").Name;
            
            // set the color name
            Project.Colors.Get("myColor").Name = "myNewName";
            

TypeName

Summary:

Gets the typename of the object. A type name doesn't contain any space characters.

Type:

System.String

Access:

Read

DisplayTypeName

Summary:

Gets the display name of the type name of the object. It returns the english display name of the type name.

Type:

System.String

Access:

Read

BaseProject

Summary:

Gets the project

Type:

IBaseProject

Access:

Read

UserPropertyInstances

Summary:

Gets a list of all the instances of user properties.

Type:

System.Collections.ObjectModel.ObservableCollection`1[BCS.IUserPropertyInstance]

Access:

Read

Examples:

//******************************************************************************
// HOW TO : Audios
//******************************************************************************


//------------------------------------------------------------------------------
// How to create
//------------------------------------------------------------------------------

// create a new entity
var newEntity = Project.Audios.NewFromFile("C:\\temp\\MySound.wav")
print("A new entity has been created with default name: " + newEntity.Name)



//------------------------------------------------------------------------------
// How to access entity
//------------------------------------------------------------------------------

// get by name using method 'Get'
var entity1 = Project.Audios.Get("Audio1")
print("Get entity by name: " + entity1.Name)

// get by name using operator []
var entity2 = Project.Audios["Audio1"]
print("Get entity by name: " + entity2.Name)

// get by index:
var entity3 = Project.Audios[1]
print("Get entity by index: " + entity3.Name)


//------------------------------------------------------------------------------
// How to loop
//------------------------------------------------------------------------------


var entities = Project.Audios.Objects;
for (var i = 0; i < Project.Audios.Count; i++) {
    
    print(entities[i].Name);
}


//------------------------------------------------------------------------------
// How to delete
//------------------------------------------------------------------------------

// remove entity
Project.Audios.Remove(newEntity)


//------------------------------------------------------------------------------
// How to control the audio
//------------------------------------------------------------------------------

var entityToEdit = Project.Audios.NewFromFile("C:\\temp\\MyAudio.wav")

// how to change its name:
entityToEdit.Name = "MyNewAudioName";

// how to play (no loop):
entityToEdit.Play(false);

// how to play (loop):
entityToEdit.Play(true);

// how to pause
entityToEdit.Pause();

// how to stop
entityToEdit.Stop();