//This function loads source audio files for theme when they are inside a .apk file. //if epro file uses relative paths for audio files this function should receive root directory public void LoadSourcesFromApk(string theme_URI, DecoderFlags flags = DecoderFlags.decoder_default) { string innerPath; string pathToArchive; int splitIndex = theme_URI.IndexOf('!'); innerPath = theme_URI.Substring(splitIndex + 2); pathToArchive = theme_URI.Remove(splitIndex); pathToArchive = pathToArchive.Replace("jar:file:/", ""); IntPtr pathToArchivePtr = UTF8MarshallingHelpers.ConvertToNativeUTF8 (pathToArchive); IntPtr innerPathPtr = UTF8MarshallingHelpers.ConvertToNativeUTF8 (innerPath); int res = elias_theme_prepare_playback_decoders(this.Handle, pathToArchivePtr, innerPathPtr, IntPtr.Zero, (uint)flags); UTF8MarshallingHelpers.FreeStringPointer (pathToArchivePtr); UTF8MarshallingHelpers.FreeStringPointer (innerPathPtr); if (res != 0) { //TODO: This should maybe be a Decoder_Errors isntead? ErrorCode e = (ErrorCode)res; throw new Exception(e.ToString()); } }
public void LoadSourcesFromArchive(string pathToArchive, string pathToThemeDirectory, DecoderFlags flags = DecoderFlags.decoder_default) { if (pathToArchive.EndsWith ("/") == false && pathToArchive.EndsWith ("\\") == false) { pathToArchive += "/"; } IntPtr pathToArchivePtr = UTF8MarshallingHelpers.ConvertToNativeUTF8 (pathToArchive); IntPtr pathToThemeDirectoryPtr = UTF8MarshallingHelpers.ConvertToNativeUTF8 (pathToThemeDirectory); int res = elias_theme_prepare_playback_decoders(this.Handle, pathToArchivePtr, pathToThemeDirectoryPtr, IntPtr.Zero, (uint)flags); UTF8MarshallingHelpers.FreeStringPointer (pathToArchivePtr); UTF8MarshallingHelpers.FreeStringPointer (pathToThemeDirectoryPtr); if (res != 0) { //TODO: This should maybe be a Decoder_Errors isntead? ErrorCode e = (ErrorCode)res; throw new Exception(e.ToString()); } }
//This function loads source audio files for theme. //if epro file uses relative paths for audio files this function should receive root directory public void LoadSources(string theme_directory, DecoderFlags flags = DecoderFlags.decoder_default) { IntPtr s = UTF8MarshallingHelpers.ConvertToNativeUTF8 (theme_directory); int res = elias_theme_prepare_playback_decoders(this.Handle, IntPtr.Zero, s, IntPtr.Zero, (uint)flags); UTF8MarshallingHelpers.FreeStringPointer (s); if(res != 0) { //TODO: This should maybe be a Decoder_Errors isntead? ErrorCode e = (ErrorCode)res; throw new Exception(e.ToString() + " (" +res.ToString() + ")"); } }