func init // adds using namespace sys.add_use('System.ServiceModel') sys.add_use('System.ServiceModel.Description') // use external class sys.UseClass("ImageService") sys.UseClass("IImageService") // adds assembly sys.add_assembly('Emgu.CV', 'Emgu.CV.dll', 'assembly\\Emgu\\2.0.0\\') sys.add_assembly('Emgu.Util', 'Emgu.Util.dll', 'assembly\\Emgu\\2.0.0\\') sys.file_copyto('' + code(packet_dir()) + 'assembly\\Emgu\\2.0.0\\cxcore110.dll', code(project_dir()) && 'cxcore110.dll') sys.file_copyto('' + code(packet_dir()) + 'assembly\\Emgu\\2.0.0\\highgui110.dll', code(project_dir()) && 'highgui110.dll') sys.file_copyto('' + code(packet_dir()) + 'assembly\\Emgu\\2.0.0\\zlib.net.dll', code(project_dir()) && 'zlib.net.dll') // initialize instance sys.add_var(this.name, 'ServiceHost') sys.add_var('binding', 'BasicHttpBinding') // initialize properties if(platform_target != 'x86') warning(this.name + ' - change property «Platform» to «x86»') end // makes implementation methods for properties sys._prop_init('State', 1, 0, 0) end func doOpen(data) blk.println(this.codename, ' = new ServiceHost(typeof(Webservice_Host.ImageService));') .println('ServiceBehaviorAttribute serviceBehavior = ', this.codename, '.Description.Behaviors.Find();') .println('serviceBehavior.IncludeExceptionDetailInFaults = true;') .println(this.binding, ' = new BasicHttpBinding();') .println(this.codename, '.AddServiceEndpoint(typeof(Webservice_Host.IImageService), ', this.binding, ', ', d("URI"), ');') .println(this.codename, '.Open();') end func doClose() blk.println(this.codename, '.Close();') .println(this.codename, ' = null;') .println(this.binding, ' = null;') end func Host return(this.codename) end