public string Create()
{
_imageProfile = ImageProfile.ReadProfile(_group.ImageProfileId);
if (_imageProfile == null) return "The Image Profile Does Not Exist";
if (_imageProfile.Image == null) return "The Image Does Not Exist";
var validation = Image.CheckApprovalAndChecksum(_imageProfile.Image,_userId);
if (!validation.IsValid) return validation.Message;
_multicastSession.Port = Port.GetNextPort();
if (_multicastSession.Port == 0)
{
return "Could Not Determine Current Port Base";
}
var dp = BLL.DistributionPoint.GetPrimaryDistributionPoint();
if (dp == null) return "Could Not Find A Primary Distribution Point";
_multicastSession.UserId = _userId;
//End of the road for starting an on demand multicast
if (_isOnDemand)
{
_multicastSession.Name = _group.Name;
_group.Name =_multicastSession.Port.ToString();
if (!StartMulticastSender())
return "Could Not Start The Multicast Application";
else
return "Successfully Started Multicast " + _group.Name;
}
//Continue On If multicast is for a group
_multicastSession.Name = _group.Name;
_computers = Group.GetGroupMembers(_group.Id);
if (_computers.Count < 1)
{
return "The group Does Not Have Any Members";
}
if (!ActiveMulticastSession.AddActiveMulticastSession(_multicastSession))
{
return "Could Not Create Multicast Database Task. An Existing Task May Be Running.";
}
if (!CreateComputerTasks())
{
ActiveMulticastSession.Delete(_multicastSession.Id);
return "Could Not Create Computer Database Tasks. A Computer May Have An Existing Task.";
}
if (!CreatePxeFiles())
{
ActiveMulticastSession.Delete(_multicastSession.Id);
return "Could Not Create Computer Boot Files";
}
if (!CreateTaskArguments())
{
ActiveMulticastSession.Delete(_multicastSession.Id);
return "Could Not Create Computer Task Arguments";
}
if (!StartMulticastSender())
{
ActiveMulticastSession.Delete(_multicastSession.Id);
return "Could Not Start The Multicast Application";
}
foreach (var computer in _computers)
Utility.WakeUp(computer.Mac);
return "Successfully Started Multicast " + _group.Name;
}