Esempio n. 1
0
        public TDAPIOLELib.QCResource CreateResource(TDAPIOLELib.QCResourceFolder qCResourceFolder, String Name, String ResourceFilePath, ResourceUploadType resourceUploadType, ResourceType resourceType)
        {
            //Check if Resource type is folder and should be uploaded or not
            if ((resourceUploadType == ResourceUploadType.Folder) && (resourceType != TestResources.ResourceType.TestResource))
            {
                throw (new Exception("Folder cant be uploaded to " + GetResourceType(resourceType) + " resource type"));
            }

            TDAPIOLELib.QCResourceFactory qCResourceFactory = qCResourceFolder.QCResourceFactory;
            TDAPIOLELib.QCResource        qCResource        = qCResourceFactory.AddItem(System.DBNull.Value);
            qCResource.Name         = Name;
            qCResource.ResourceType = GetResourceType(resourceType);


            String ResourceType = GetResourceType(resourceType);

            if (resourceUploadType == ResourceUploadType.File)
            {
                UploadFileToResource(qCResource, ResourceFilePath);
            }
            else
            {
                UploadFolderToResource(qCResource, ResourceFilePath);
            }


            return(qCResource);
        }
Esempio n. 2
0
 public TDAPIOLELib.QCResource CreateResource(TDAPIOLELib.QCResourceFolder qCResourceFolder, String Name)
 {
     TDAPIOLELib.QCResourceFactory qCResourceFactory = qCResourceFolder.QCResourceFactory;
     TDAPIOLELib.QCResource        qCResource        = qCResourceFactory.AddItem(System.DBNull.Value);
     qCResource.Name = Name;
     qCResource.Post();
     return(qCResource);
 }
Esempio n. 3
0
        public Boolean UploadFolderToResource(TDAPIOLELib.QCResource qCResource, String FolderPath)
        {
            qCResource.FileName = new System.IO.DirectoryInfo(FolderPath).Name;
            qCResource.Post();

            TDAPIOLELib.IResourceStorage resourceStorage = (IResourceStorage)qCResource;
            resourceStorage.UploadResource(System.IO.Path.GetDirectoryName(FolderPath), true);
            return(true);
        }
Esempio n. 4
0
        public Boolean UploadFileToResource(TDAPIOLELib.QCResource qCResource, String FilePath)
        {
            qCResource.FileName = System.IO.Path.GetFileName(FilePath);
            qCResource.Post();

            TDAPIOLELib.IResourceStorage resourceStorage = (IResourceStorage)qCResource;
            resourceStorage.UploadResource(System.IO.Path.GetDirectoryName(FilePath), true);
            return(true);
        }
Esempio n. 5
0
 public Boolean DownloadResources(TDAPIOLELib.QCResource qCResource, String FolderPath)
 {
     TDAPIOLELib.IResourceStorage resourceStorage = (IResourceStorage)qCResource;
     resourceStorage.DownloadResource(FolderPath, true);
     return(true);
 }