public static void Delete(byte[] frame) { IMovieDataAccess movieDataAccess = new MovieDataAccess(); IMovieService movieService = new MovieService(movieDataAccess); IGenreDataAccess genreData = new GenreDataAccess(); IGenreService genreService = new GenreService(genreData); IAsociationHandler asociationHandler = new AssociationHandler(); IAsociationService asociationService = new AsociationService(asociationHandler); IParser parser = new Parser(); var data = parser.GetDataObject(frame); var name = data[0]; var movieToDelete = movieService.GetMovie(name); foreach (var genreName in movieToDelete.Genres) { var genreToDesaciate = genreService.GetGenre(genreName); asociationService.DeAsociateGenreMovie(movieToDelete, genreToDesaciate); } movieService.Delete(movieToDelete); }
public AsociationApiService() { IAsociationHandler asociationHandler = new AssociationHandler(); asociationService = new AsociationService(asociationHandler); movieDataAccess = new MovieDataAccess(); genreDataAccess = new GenreDataAccess(); directorDataAccess = new DirectorDataAccess(); }
private static List <IMenuComponent> CreateContractBlob(int count, Contract contract) { List <IMenuComponent> r = new List <IMenuComponent>(); r.Add(new TextureComponent(new Rectangle(count * 25 + 10, 40, 16, 16), Game1.content.Load <Texture2D>("Maps//springobjects").getTile(contract.Item.ItemId))); r.Add(new TextComponent(new Point(count * 25 + 10, 55), AssociationHandler.StaticDigits(contract.AmountReceived, 3))); r.Add(new TextComponent(new Point(count * 25 + 13, 61), "/" + AssociationHandler.StaticDigits(contract.AmountNeeded, 3))); if (contract.Completed) { AddToMenu(new TextureComponent(new Rectangle(count * 25 + 9, 49, 19, 8), Game1.content.Load <Texture2D>("LooseSprites//Cursors").getArea(new Rectangle(340, 409, 25, 11))), 5); } return(r); }
private static List <IMenuComponent> GenerateContractComponent(Contract c, Point pos) { List <IMenuComponent> r = new List <IMenuComponent>(); r.Add(new TextureComponent(new Rectangle(pos.X + 22, pos.Y + 10, 16, 16), Game1.content.Load <Texture2D>("Maps//springobjects").getTile(c.Item.ItemId))); r.Add(new TextComponent(new Point(pos.X + 10, pos.Y + 18), AssociationHandler.StaticDigits(c.AmountNeeded, 3) + "x", true, 1.25f)); r.Add(new TextComponent(new Point(pos.X + 15, pos.Y + 30), AssociationHandler.StaticDigits(c.RewardFavor, 3))); r.Add(new TextureComponent(new Rectangle(pos.X + 26, pos.Y + 29, 8, 8), Game1.content.Load <Texture2D>("LooseSprites//Cursors").getArea(new Rectangle(294, 392, 16, 16)))); r[0].Layer = 2; r[1].Layer = 3; r[2].Layer = 2; r[3].Layer = 2; return(r); }
public static void Update() { var a = AssociationHandler.Main; if (a.Rank < 4) { Reputation.Value = (int)(a.Reputation / Association.RepAmounts[a.Rank] * 160); RepAmount.Label = "Reputation: " + a.Reputation + "/" + Association.RepAmounts[a.Rank]; } else { Reputation.Value = 160; RepAmount.Label = "Reputation at maximum"; } RankDisplay.Label = "Current Rank: " + Association.RankNames[a.Rank]; FavorAmount.Label = AssociationHandler.StaticDigits(a.Favor, 3); }
public static void DeAsociateDirectorToMovie(byte[] frame) { IDirectorDataAccess dirDa = new DirectorDataAccess(); IDirectorService directorService = new DirectorService(dirDa); IMovieDataAccess movieDataAccess = new MovieDataAccess(); IMovieService movieService = new MovieService(movieDataAccess); IAsociationHandler asociationHandler = new AssociationHandler(); IAsociationService asociationService = new AsociationService(asociationHandler); IParser parser = new Parser(); var directorAndMovieNames = parser.GetDataObject(frame); var movieToAsociate = movieService.GetMovie(directorAndMovieNames[0]); var directorToASociate = directorService.GetDirector(directorAndMovieNames[1]); asociationService.DeAsociatDirMovie(movieToAsociate, directorToASociate); }
public static void DeAsociateGenreToMovie(byte[] frame) { IGenreDataAccess genreDataAccess = new GenreDataAccess(); IGenreService genreService = new GenreService(genreDataAccess); IMovieDataAccess movieDataAccess = new MovieDataAccess(); IMovieService movieService = new MovieService(movieDataAccess); IAsociationHandler asociationHandler = new AssociationHandler(); IAsociationService asociationService = new AsociationService(asociationHandler); IParser parser = new Parser(); var movieAndGenreNames = parser.GetDataObject(frame); var movieToAsociate = movieService.GetMovie(movieAndGenreNames[0]); var genreToAsociate = genreService.GetGenre(movieAndGenreNames[1]); asociationService.DeAsociateGenreMovie(movieToAsociate, genreToAsociate); }
static void Main(string[] args) { if (args.Length != 0) { String ProcessID = null; System.Diagnostics.Process myProcess = System.Diagnostics.Process.GetCurrentProcess(); ProcessID = "[" + myProcess.Id.ToString() + "] "; myProcess.Close(); myProcess.Dispose(); Platform.Log(LogLevel.Debug, "Process ID obtained for title bar and logging is: " + ProcessID); log4net.GlobalContext.Properties["procid"] = ProcessID; for (int i = 0; i < args.Length - 1; i++) { String ArgTemp = null; ArgTemp = args[i]; if (ArgTemp == "-l") { LocalAE = args[i + 1]; i++; } if (ArgTemp == "-r") { RemoteAE = args[i + 1]; i++; } if (ArgTemp == "-h") { RemoteIP = args[i + 1]; i++; } if (ArgTemp == "-p") { RemotePort = args[i + 1]; i++; } if (ArgTemp == "-f") { FilePath = args[i + 1]; i++; } if (ArgTemp == "-u") { MaxPDUSize = uint.Parse(args[i + 1]); i++; } if (ArgTemp == "-n") { MaxPDUTimeoutMilliSeconds = int.Parse(args[i + 1]); } } //for (int i = 1; i < args.Length - 1; i++) ClientAssociationParameters g_assocParams = null; DicomClient g_dicomClient = null; IPAddress addr = null; foreach (IPAddress dnsAddr in Dns.GetHostAddresses(RemoteIP)) { if (dnsAddr.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork) { addr = dnsAddr; Platform.Log(LogLevel.Info, "IP address found to use is: " + addr.ToString()); break; } } if (addr == null) { Platform.Log(LogLevel.Error, "No Valid IP addresses for host {0}", RemoteIP); return; } g_assocParams = new ClientAssociationParameters(LocalAE, RemoteAE, new IPEndPoint(addr, int.Parse(RemotePort))); if (MaxPDUSize != 0) { g_assocParams.LocalMaximumPduLength = MaxPDUSize; Console.WriteLine("LocalMaximumPduLength has been set to: " + g_assocParams.LocalMaximumPduLength.ToString()); Platform.Log(LogLevel.Info, "LocalMaximumPduLength has been set to: " + g_assocParams.LocalMaximumPduLength.ToString()); } else { Console.WriteLine("LocalMaximumPduLength is by default: " + g_assocParams.LocalMaximumPduLength.ToString()); Platform.Log(LogLevel.Info, "LocalMaximumPduLength is by default: " + g_assocParams.LocalMaximumPduLength.ToString()); } try { Console.WriteLine(""); Console.WriteLine("Loading File: " + FilePath + ", please wait..."); Console.WriteLine(""); Platform.Log(LogLevel.Info, "Loading File: " + FilePath + ", please wait..."); DicomFile DF = new DicomFile(FilePath); GC.AddMemoryPressure(1047881834); try { //DF.Load(DicomReadOptions.KeepGroupLengths); DF.Load(DicomReadOptions.Default); } catch (Exception eL) { } Console.WriteLine("SOP Class: " + DF.SopClass.ToString()); Console.WriteLine("Transfer Syntax: " + DF.TransferSyntax.ToString()); Platform.Log(LogLevel.Info, "SOP Class: " + DF.SopClass.ToString()); Platform.Log(LogLevel.Info, "Transfer Syntax: " + DF.TransferSyntax.ToString()); byte pcid = g_assocParams.AddPresentationContext(DF.SopClass); g_assocParams.AddTransferSyntax(pcid, DF.TransferSyntax); DicomMessage msg = new DicomMessage(DF); DF = null; GC.Collect(); GC.WaitForPendingFinalizers(); AssociationHandler handler = new AssociationHandler(); Console.WriteLine("Attempting to connect to remote AE."); Platform.Log(LogLevel.Info, "Attempting to connect to remote AE."); g_dicomClient = DicomClient.Connect(g_assocParams, (IDicomClientHandler)handler); while (Assoc_Accept_Reject == false) { Console.WriteLine("Waiting for Association to be accepted or rejected."); Platform.Log(LogLevel.Info, "Waiting for Association to be accepted or rejected."); Thread.Sleep(1000); } try { if (MaxPDUTimeoutMilliSeconds != 0) { g_dicomClient.InternalSocket.SendTimeout = MaxPDUTimeoutMilliSeconds; g_dicomClient.InternalSocket.ReceiveTimeout = MaxPDUTimeoutMilliSeconds; Console.WriteLine("Internal Socket Send/Receive Timeout has been set to: " + g_dicomClient.InternalSocket.SendTimeout.ToString() + " ms."); Platform.Log(LogLevel.Info, "Internal Socket Send/Receive Timeout has been set to: " + g_dicomClient.InternalSocket.SendTimeout.ToString() + " ms."); g_dicomClient.InternalSocket.SendTimeout = MaxPDUTimeoutMilliSeconds; } Console.WriteLine("Sending C-Store Request."); Platform.Log(LogLevel.Info, "Sending C-Store Request."); g_dicomClient.SendCStoreRequest(pcid, g_dicomClient.NextMessageID(), DicomPriority.Medium, msg); } catch (Exception eS) { Console.WriteLine("Error sending C-Store Request."); Console.WriteLine(eS.ToString()); Platform.Log(LogLevel.Error, "Error sending C-Store Request. The error is: " + eS.ToString()); } while (C_Store_Response == false) { Console.WriteLine("Waiting for C-Store response."); Platform.Log(LogLevel.Info, "Waiting for C-Store response."); Thread.Sleep(1000); } if (NetworkError == false) { Console.WriteLine("Sending release request."); Platform.Log(LogLevel.Info, "Sending release request."); g_dicomClient.SendReleaseRequest(); } Thread.Sleep(1000); Console.WriteLine("Operations have completed."); Console.WriteLine("Press ENTER to exit!"); Console.ReadLine(); } catch (Exception e) { Console.WriteLine("Error reading file. The error is:"); Console.WriteLine(""); Console.WriteLine(e.Message); Console.WriteLine(""); Console.WriteLine("Stack Trace:"); Console.WriteLine(e.ToString()); Console.WriteLine("Press ENTER to exit!"); Console.ReadLine(); Platform.Log(LogLevel.Error, "Error reading file. The error is:"); Platform.Log(LogLevel.Error, e.ToString()); } } //if (args .Length != 0 ) else { Console.WriteLine("You must provide the proper command line arguments."); Console.WriteLine("Required arguments are:"); Console.WriteLine(""); Console.WriteLine("-f [full file path to DCM file] (No whitespaces please!)"); Console.WriteLine("-l [Local AE Title]"); Console.WriteLine("-r [Remote AE Title]"); Console.WriteLine("-h [Remote HostName or IP address]"); Console.WriteLine("-p [Remote Port]"); Console.WriteLine(""); Console.WriteLine("Press ENTER to exit!"); Console.ReadLine(); Platform.Log(LogLevel.Error, "You must provide the proper command line arguments."); Platform.Log(LogLevel.Error, "Required arguments are:"); Platform.Log(LogLevel.Error, ""); Platform.Log(LogLevel.Error, " -f [full file path to DCM file] (No whitespaces please!)"); Platform.Log(LogLevel.Error, " -l [Local AE Title]"); Platform.Log(LogLevel.Error, " -r [Remote AE Title]"); Platform.Log(LogLevel.Error, " -h [Remote HostName or IP address]"); Platform.Log(LogLevel.Error, " -p [Remote Port]"); Platform.Log(LogLevel.Error, ""); } } //static void Main(string[] args)