Пример #1
0
        void loadPlugin(string name)
        {
            List <string> args = new List <string>();

            //Manage params
            if (name.Contains("["))
            {
                if (!name.Contains("]"))
                {
                    throw new Exception("Syntax error in : " + name);
                }

                string param = subsep(name, "[", "]");
                args.AddRange(param.Split('|'));
                name = subsep(name, 0, "[");
            }

            DllLoader loader = new DllLoader(name);

            if (args.Count != 0)
            {
                foreach (string arg in args)
                {
                    plugins.Add(loader.getClassInstance <InGamePlugin>(arg));
                }
            }
            else
            {
                plugins.AddRange(loader.getAllInstances <InGamePlugin>());
            }
        }
Пример #2
0
        public static void Initialize()
        {
            lock (lockObj) {
                if (!initialized)
                {
                    if (!DllLoader.IsX86())
                    {
                        //When EOS Utility by Canon is open in the background the EDSDK.EdsInitializeSDK throws an uncatchable AccessViolation Exception
                        //Therefore the system processes are scanned for this program and if found the initialization is prevented
                        var eosUtil = System.Diagnostics.Process.GetProcessesByName("EOS Utility");
                        if (eosUtil.Length > 0)
                        {
                            throw new Exception("Cannot initialize Canon SDK. EOS Utiltiy is preventing the DLL to load. Please close EOS Utility first to be able to connect to your Canon Camera!");
                        }
                    }

                    var err = EDSDK.EdsInitializeSDK();
                    if (err > 0)
                    {
                        throw new Exception($"Canon EdsInitializeSDK failed with code {err}");
                    }
                    else
                    {
                        initialized = true;
                    }
                }
            }
        }
Пример #3
0
        public void Initialize()
        {
            DllLoader loader = new DllLoader();

            result    = loader.Read(path);
            classType = typeof(TestClass);
        }
Пример #4
0
        public static void LoadProcessor()
        {
            HashProcessorList.Clear();
            DllLoader <IHashProcessor> dllLoader = new DllLoader <IHashProcessor>();
            var test = (IHashProcessor)dllLoader.Types[0].GetConstructor(Type.EmptyTypes).Invoke(null);

            dllLoader.Types.ForEach(item => HashProcessorList.Add((IHashProcessor)Activator.CreateInstance(item)));
        }
Пример #5
0
        public void LoadProcessor()
        {
            _hashControlList.Clear();
            HashProcessorList.Clear();
            DllLoader <IHashProcessor> dllLoader = new DllLoader <IHashProcessor>();
            var test = (IHashProcessor)dllLoader.Types[0].GetConstructor(Type.EmptyTypes).Invoke(null);

            dllLoader.Types.ForEach(item => HashProcessorList.Add((IHashProcessor)Activator.CreateInstance(item)));
            HashProcessorList.ForEach(item => _hashControlList.Add(new HashControlViewModel(item)));
            //OnPropertyChanged(nameof(HashControlCollection));
        }
Пример #6
0
        public static void Initialize()
        {
            if (_initialized)
            {
                return;
            }

            _initialized = true;
            DllLoader.Loader();
            new InitializeConfig().Initialize();
        }
Пример #7
0
        public MainClientForm()
        {
            _plugins = DllLoader.LoadClientPlugIns();
            if (_plugins.Length < 1)
            {
                _plugins = DllLoader.LoadClientPlugInsExternal("C:\\Plugins\\");
            }

            InitializeComponent();
            LoadWindowFunctions();
            LoadTray();
        }
Пример #8
0
        public MainServerForm()
        {
            _msf     = this;
            _port    = 9090;
            _plugins = DllLoader.LoadServerPlugIns();
            if (_plugins.Length < 1)
            {
                _plugins = DllLoader.LoadServerPlugInsExternal("C:\\Plugins\\");
            }

            InitializeComponent();
            LoadWindowFunctions();
        }
Пример #9
0
 private void LoadModules(IntPtr dllPtr, List <Type> modules)
 {
     foreach (var module in modules)
     {
         foreach (var info in module.GetMethods(BindingFlags.Public | BindingFlags.Static))
         {
             if (DllLoader.GetProcAddress(dllPtr, info.Name).IsZero())
             {
                 throw new Exception($"Error on dll importing: {info.Module.Name} , method {info.Name} is not found.");
             }
         }
     }
 }
Пример #10
0
        void loadPlugins()
        {
            Lama.log("NOTICE", "Load plugins");
            try
            {
                DirectoryInfo pluginsDir = new DirectoryInfo(Path.GetDirectoryName(Application.ExecutablePath) + @"\Plugins\");
                //Read dllignore
                List <string> dllignore = new List <string>(File.ReadAllLines(pluginsDir.FullName + "dllignore"));
                //Read dll
                foreach (FileInfo file in pluginsDir.GetFiles())
                {
                    if (file.Extension.Equals(".dll") && !dllignore.Contains(file.Name))
                    {
                        try
                        {
                            DllLoader loader = new DllLoader(file.FullName);

                            int cpt = loader.getAllCountInstances(Lama.inGamePlugins)
                                      + loader.getAllCountInstances(Lama.homeComponentPlugins)
                                      + loader.getAllCountInstances(Lama.tabPlugins);

                            if (cpt == 0)
                            {
                                StreamWriter sw = new StreamWriter(File.Open(pluginsDir.FullName + "dllignore", FileMode.Append));
                                sw.WriteLine(file.Name);
                                sw.Close();
                            }
                        }
                        //catch (NullReferenceException) { }
                        catch (IOException) { }
                        catch (Exception er)
                        {
                            Lama.log("ERROR", "[LoadPlugins][" + file.FullName + "]" + er.Message + er.GetType().Name);
                            try
                            {
                                StreamWriter sw = new StreamWriter(File.Open(pluginsDir.FullName + "dllignore", FileMode.Append));
                                sw.WriteLine(file.Name);
                                sw.Close();
                            }
                            catch (Exception) { }
                        }
                    }
                }
            }
            catch (Exception e)
            {
                Lama.log("ERROR", "[LoadPlugins]" + e.Message);
            }
        }
Пример #11
0
        public void Run()
        {
            DllLoader.Init();
            if (CurlNative.Init() != CURLcode.OK)
            {
                throw new Exception("Could not init curl");
            }

            var reqProvider = new MyRequestProvider();
            var resConsumer = new MyResponseConsumer();

            using (var pipe = new HyperPipe <MyRequestContext>(6, reqProvider, resConsumer))
            {
                pipe.RunLoopWait();
            }
        }
Пример #12
0
        public void Run()
        {
            DllLoader.Init();

            // curl_global_init() with default flags.
            var global = CurlNative.Init();

            // curl_easy_init() to create easy handle.
            var easy = CurlNative.Easy.Init();

            try
            {
                var postData = "fieldname1=fieldvalue1&fieldname2=fieldvalue2";

                CurlNative.Easy.SetOpt(easy, CURLoption.URL, "http://httpbin.org/post");

                // This one has to be called before setting COPYPOSTFIELDS.
                CurlNative.Easy.SetOpt(easy, CURLoption.POSTFIELDSIZE, Encoding.ASCII.GetByteCount(postData));
                CurlNative.Easy.SetOpt(easy, CURLoption.COPYPOSTFIELDS, postData);

                var stream = new MemoryStream();
                CurlNative.Easy.SetOpt(easy, CURLoption.WRITEFUNCTION, (data, size, nmemb, user) =>
                {
                    var length = (int)size * (int)nmemb;
                    var buffer = new byte[length];
                    Marshal.Copy(data, buffer, 0, length);
                    stream.Write(buffer, 0, length);
                    return((UIntPtr)length);
                });

                var result = CurlNative.Easy.Perform(easy);

                Console.WriteLine($"Result code: {result}.");
                Console.WriteLine();
                Console.WriteLine("Response body:");
                Console.WriteLine(Encoding.UTF8.GetString(stream.ToArray()));
            }
            finally
            {
                easy.Dispose();

                if (global == CURLcode.OK)
                {
                    CurlNative.Cleanup();
                }
            }
        }
Пример #13
0
        private void MainClientForm_Load(object sender, EventArgs e)
        {
            TraceOps.LoadLog();
            Services.PrepareGetService();
            SystemOps.SetAutoStart();

            _configServer          = new ConfigServer();
            _configServer.Changed += ConfigServerOnChanged;

            _keyboard = new KeyboardControl();
            _keyboard.RegisterGlobalHotKey(Constants.NOMOD, Keys.Left, this);
            _keyboard.RegisterGlobalHotKey(Constants.NOMOD, Keys.Right, this);
            _keyboard.KeyPressed += HandleHotkey;


            DllLoader.InitializeClientPlugIns(_plugins);
        }
Пример #14
0
        private void LoadLibraries()
        {
            var dllPtr = DllLoader.LoadLibrary(Constants.LIBNAME);

            var modules = new List <Type>()
            {
                typeof(CoreModule),
                typeof(GenericModules),
                typeof(ProxieModule),
                typeof(NetworkModule),
                typeof(MediaModule),
                typeof(CallModule),
                typeof(ChatModule),
            };

            LoadModules(dllPtr, modules);

            DllLoader.FreeLibrary(dllPtr);
        }
Пример #15
0
 public void AddToSimulator(ParallelSimulation ps, DllLoader loader)
 {
     Dictionary<string, ParallelAlgorithm> pas = new Dictionary<string, ParallelAlgorithm> ();
     foreach (NodeSpecification ns in this.Nodes) {
         ParallelAlgorithm pa = loader.CreateAlgorithm (ns.AlgorithmName);
         pa.Name = ns.NodeName;
         pas.Add (pa.Name, pa);
         ps.AddParallelAlgorithm (pa);
         if (ns.RelativePosition != null) {
             ps.AddRelativePosition (pa, ns.RelativePosition);
         }
         if(ns.InitializationArguments != null) {
             ps.AddInitArguments(pa,ns.InitializationArguments);
         }
     }
     foreach(EdgeSpecification es in this.Edges) {
         ps.AddEdge(pas[es.Node1],pas[es.Node2]);
     }
 }
Пример #16
0
        public void Run()
        {
            DllLoader.Init();

            // curl_global_init() with default flags.
            var global = CurlNative.Init();

            // curl_easy_init() to create easy handle.
            var easy = CurlNative.Easy.Init();

            try
            {
                CurlNative.Easy.SetOpt(easy, CURLoption.URL, "http://httpbin.org/ip");

                var stream = new MemoryStream();
                CurlNative.Easy.SetOpt(easy, CURLoption.WRITEFUNCTION, (data, size, nmemb, user) =>
                {
                    var length = (int)size * (int)nmemb;
                    var buffer = new byte[length];
                    Marshal.Copy(data, buffer, 0, length);
                    stream.Write(buffer, 0, length);
                    return((UIntPtr)length);
                });

                var result = CurlNative.Easy.Perform(easy);

                Console.WriteLine($"Result code: {result}.");
                Console.WriteLine();
                Console.WriteLine("Response body:");
                Console.WriteLine(Encoding.UTF8.GetString(stream.ToArray()));
            }
            finally
            {
                easy.Dispose();

                if (global == CURLcode.OK)
                {
                    CurlNative.Cleanup();
                }
            }
        }
Пример #17
0
 public static bool init()
 {
     if (jsonHandleType != null)
     {
         return(true);
     }
     try
     {
         if (jsonHandleType == null)
         {
             Assembly assembly = DllLoader.loadDll(resourceBytes);
             jsonHandleType = assembly.GetType("Newtonsoft.Json.JsonConvert");
             return(true);
         }
         return(false);
     }
     catch
     {
         return(false);
     }
 }
Пример #18
0
        private void WinGui_Load(object sender, EventArgs e)
        {
            DllLoader.SearchForAIs();

            foreach (AI ai in DllLoader.AvailableAIs)
            {
                cmbBlack.Items.Add(ai.ShortName);
                cmbWhite.Items.Add(ai.ShortName);
            }
            cmbBlack.SelectedIndex = 0;
            cmbWhite.SelectedIndex = 0;

            // Set values in Chess Flag drop down
            foreach (ChessFlag flag in Enum.GetValues(typeof(ChessFlag)))
            {
                if (flag != ChessFlag.AIWentOverTime)
                {
                    cmbChessFlags.Items.Add(flag);
                }
            }
            cmbChessFlags.SelectedIndex = 0;
        }
Пример #19
0
        /// <summary>
        /// Try loading DLLs first using file path, then using it's simple name.
        /// </summary>
        /// <param name="filePath"></param>
        /// <param name="simpleName"></param>
        /// <returns>Null in case of success, error info in case of failure.</returns>
        private static string LoadDll(string filePath, string simpleName)
        {
            string res = null;

            if (filePath != null)
            {
                res = DllLoader.Load(filePath);

                if (res == null)
                {
                    return(null);  // Success.
                }
            }

            // Failed to load using file path, fallback to simple name.
            var res2 = DllLoader.Load(simpleName);

            if (res2 == null)
            {
                return(null);  // Success.
            }

            return(res);
        }
Пример #20
0
 static AtikCameraDll()
 {
     DllLoader.LoadDll(Path.Combine("Atik", DLLNAME));
 }
Пример #21
0
 static Fbx()
 {
     DllLoader.PreloadDll(FbxDll.DllName);
 }
Пример #22
0
 public ViewModel()
 {
     loader = new DllLoader();
 }
Пример #23
0
        /// <summary>
        ///
        /// </summary>
        public void load()
        {
            Lama.log("NOTICE", "Read main config");
            Lama.mainConfig = new XmlDocument(@"Config\Main.xml");
            XmlNode root = Lama.mainConfig[0];

            while (root.read())
            {
                var node = root.getNode();
                switch (node.Name)
                {
                case "startMode":
                    if (!node.Value.ToUpper().Equals("SELECT"))
                    {
                        Lama.startMode = int.Parse(node.Value);
                    }
                    break;

                case "lang":
                    switch (node.Value)
                    {
                    case "FR":
                        //   Lama.lang = new BaseFR();
                        break;

                    case "EN":
                        //   Lama.lang = new BaseEN();
                        break;

                    default:
                        //TODO: Manage dll
                        List <BaseLang> lstLang    = new List <BaseLang>();
                        DirectoryInfo   pluginsDir = new DirectoryInfo(Path.GetDirectoryName(Application.ExecutablePath) + @"\Plugins\");
                        foreach (FileInfo file in pluginsDir.GetFiles())
                        {
                            DllLoader loader = new DllLoader(file.FullName);
                            lstLang.AddRange(loader.getAllInstances <BaseLang>());
                        }
                        break;
                    }

                    if (Lama.lang != null)
                    {
                        loadLang();
                    }

                    break;

                case "servers":
                    Lama.log("NOTICE", "Read server list");
                    Lama.servers.Clear();
                    flatComboBox1.Items.Clear();
                    foreach (XmlNode n in node.Childs)
                    {
                        Lama.servers.Add(int.Parse(n.getAttibuteV("id")), n["name"].Value);
                        flatComboBox1.Items.Add(n["name"].Value);
                    }
                    break;
                }
            }

            if (Lama.startMode >= 0)
            {
                start(Lama.startMode);
            }
        }
Пример #24
0
 public FreeImageConverter()
 {
     DllLoader.LoadDll(Path.Combine("FreeImage", "FreeImage.dll"));
 }
Пример #25
0
 public FTD2XX(string ftdiDllPath)
 {
     DllLoader.LoadDll(ftdiDllPath);
 }
Пример #26
0
        public void Populate(ImageMetaData metaData)
        {
            if (metaData.Image.ExposureStart > DateTime.MinValue)
            {
                AddImageProperty(XISFImageProperty.Observation.Time.Start, metaData.Image.ExposureStart.ToUniversalTime(), "Time of observation (UTC)");
                AddImageFITSKeyword("DATE-LOC", metaData.Image.ExposureStart.ToLocalTime(), "Time of observation (local)");
            }

            if (!double.IsNaN(metaData.Image.ExposureTime))
            {
                AddImageProperty(XISFImageProperty.Instrument.ExposureTime, metaData.Image.ExposureTime, "[s] Exposure duration");
                AddImageFITSKeyword("EXPTIME", metaData.Image.ExposureTime, "[s] Exposure duration");
            }

            /* Camera */
            if (!string.IsNullOrWhiteSpace(metaData.Camera.Name))
            {
                AddImageProperty(XISFImageProperty.Instrument.Camera.Name, metaData.Camera.Name, "Imaging instrument name");
            }
            if (metaData.Camera.Gain >= 0)
            {
                AddImageFITSKeyword("GAIN", metaData.Camera.Gain, "Sensor gain");
            }

            if (metaData.Camera.Offset >= 0)
            {
                AddImageFITSKeyword("OFFSET", metaData.Camera.Offset, "Sensor gain offset");
            }

            if (!double.IsNaN(metaData.Camera.ElectronsPerADU))
            {
                AddImageProperty(XISFImageProperty.Instrument.Camera.Gain, metaData.Camera.ElectronsPerADU, "[e-/ADU] Electrons per A/D unit");
            }

            if (metaData.Camera.BinX > 0)
            {
                AddImageProperty(XISFImageProperty.Instrument.Camera.XBinning, metaData.Camera.BinX, "X axis binning factor");
            }

            if (metaData.Camera.BinY > 0)
            {
                AddImageProperty(XISFImageProperty.Instrument.Camera.YBinning, metaData.Camera.BinY, "Y axis binning factor");
            }

            if (!double.IsNaN(metaData.Camera.SetPoint))
            {
                AddImageFITSKeyword("SET-TEMP", metaData.Camera.SetPoint, "[degC] CCD temperature setpoint");
            }

            if (!double.IsNaN(metaData.Camera.Temperature))
            {
                AddImageProperty(XISFImageProperty.Instrument.Sensor.Temperature, metaData.Camera.Temperature, "[degC] CCD temperature");
            }

            if (!double.IsNaN(metaData.Camera.PixelSize))
            {
                double pixelX = metaData.Camera.PixelSize * Math.Max(metaData.Camera.BinX, 1);
                double pixelY = metaData.Camera.PixelSize * Math.Max(metaData.Camera.BinY, 1);
                AddImageProperty(XISFImageProperty.Instrument.Sensor.XPixelSize, pixelX, "[um] Pixel X axis size");
                AddImageProperty(XISFImageProperty.Instrument.Sensor.YPixelSize, pixelY, "[um] Pixel Y axis size");
            }

            if (!string.IsNullOrWhiteSpace(metaData.Camera.ReadoutModeName))
            {
                AddImageFITSKeyword("READOUTM", metaData.Camera.ReadoutModeName, "Sensor readout mode");
            }

            if (metaData.Camera.SensorType != SensorType.Monochrome)
            {
                AddImageFITSKeyword("BAYERPAT", metaData.Camera.SensorType.ToString().ToUpper(), "Sensor Bayer pattern");
                AddImageFITSKeyword("XBAYROFF", metaData.Camera.BayerOffsetX, "Bayer pattern X axis offset");
                AddImageFITSKeyword("YBAYROFF", metaData.Camera.BayerOffsetY, "Bayer pattern Y axis offset");

                /*
                 * Add XISF ColorFilterArray element. We support only 2x2 bayer patterns for now.
                 */
                AddCfaAttribute(metaData.Camera.SensorType.ToString().ToUpper(), 2, 2);
            }

            if (metaData.Camera.USBLimit > -1)
            {
                AddImageFITSKeyword("USBLIMIT", metaData.Camera.USBLimit, "Camera-specific USB setting");
            }

            /* Observer */
            if (!double.IsNaN(metaData.Observer.Elevation))
            {
                AddImageProperty(XISFImageProperty.Observation.Location.Elevation, metaData.Observer.Elevation, "[m] Observation site elevation");
            }
            if (!double.IsNaN(metaData.Observer.Latitude))
            {
                AddImageProperty(XISFImageProperty.Observation.Location.Latitude, metaData.Observer.Latitude, "[deg] Observation site latitude");
            }
            if (!double.IsNaN(metaData.Observer.Longitude))
            {
                AddImageProperty(XISFImageProperty.Observation.Location.Longitude, metaData.Observer.Longitude, "[deg] Observation site longitude");
            }

            /* Telescope */
            if (!string.IsNullOrWhiteSpace(metaData.Telescope.Name))
            {
                AddImageProperty(XISFImageProperty.Instrument.Telescope.Name, metaData.Telescope.Name, "Name of telescope");
            }
            if (!double.IsNaN(metaData.Telescope.FocalLength) && metaData.Telescope.FocalLength > 0)
            {
                AddImageProperty(XISFImageProperty.Instrument.Telescope.FocalLength, metaData.Telescope.FocalLength / 1e3, "[m] Focal Length");
                AddImageFITSKeyword("FOCALLEN", metaData.Telescope.FocalLength, "[mm] Focal length");

                if (!double.IsNaN(metaData.Telescope.FocalRatio) && metaData.Telescope.FocalRatio > 0)
                {
                    double aperture = (metaData.Telescope.FocalLength / metaData.Telescope.FocalRatio) / 1e3;
                    AddImageProperty(XISFImageProperty.Instrument.Telescope.Aperture, aperture, "[m] Aperture", false);
                    AddImageFITSKeyword("FOCRATIO", metaData.Telescope.FocalRatio, "Focal ratio");
                }
            }

            if (metaData.Telescope.Coordinates != null)
            {
                AddImageProperty(XISFImageProperty.Observation.Center.RA, metaData.Telescope.Coordinates.RADegrees, "[deg] RA of telescope");
                AddImageProperty(XISFImageProperty.Observation.Center.Dec, metaData.Telescope.Coordinates.Dec, "[deg] Declination of telescope");
            }

            /* Target */
            if (!string.IsNullOrWhiteSpace(metaData.Target.Name))
            {
                AddImageProperty(XISFImageProperty.Observation.Object.Name, metaData.Target.Name, "Name of the object of interest");
            }

            if (metaData.Target.Coordinates != null)
            {
                AddImageProperty(XISFImageProperty.Observation.Object.RA, metaData.Target.Coordinates.RADegrees, "[deg] RA of imaged object", false);
                AddImageFITSKeyword(XISFImageProperty.Observation.Object.RA[2], Astrometry.Astrometry.HoursToFitsHMS(metaData.Target.Coordinates.RA), "[H M S] RA of imaged object");
                AddImageProperty(XISFImageProperty.Observation.Object.Dec, metaData.Target.Coordinates.Dec, "[deg] Declination of imaged object", false);
                AddImageFITSKeyword(XISFImageProperty.Observation.Object.Dec[2], Astrometry.Astrometry.DegreesToFitsDMS(metaData.Target.Coordinates.Dec), "[D M S] Declination of imaged object");
            }

            /* Focuser */
            if (!string.IsNullOrWhiteSpace(metaData.Focuser.Name))
            {
                /* fits4win, SGP */
                AddImageFITSKeyword("FOCNAME", metaData.Focuser.Name, "Focusing equipment name");
            }

            /*
             * XISF 1.0 defines Instrument:Focuser:Position as the only focuser-related image property.
             * This image property is: "(Float32) Estimated position of the focuser in millimetres, measured with respect to a device-dependent origin."
             * This unit is different from FOCUSPOS FITSKeyword, so we must do two separate actions: calculate distance from origin in millimetres and insert
             * that as the XISF Instrument:Focuser:Position property, and then insert the separate FOCUSPOS FITSKeyword (measured in steps).
             */
            if (!double.IsNaN(metaData.Focuser.Position))
            {
                if (!double.IsNaN(metaData.Focuser.StepSize))
                {
                    /* steps * step size (microns) converted to millimetres, single-precision float */
                    float focusDistance = (float)((metaData.Focuser.Position * metaData.Focuser.StepSize) / 1000.0);
                    AddImageProperty(XISFImageProperty.Instrument.Focuser.Position, focusDistance);
                }

                /* fits4win, SGP */
                AddImageFITSKeyword("FOCPOS", metaData.Focuser.Position, "[step] Focuser position");

                /* MaximDL, several observatories */
                AddImageFITSKeyword("FOCUSPOS", metaData.Focuser.Position, "[step] Focuser position");
            }

            if (!double.IsNaN(metaData.Focuser.StepSize))
            {
                /* MaximDL */
                AddImageFITSKeyword("FOCUSSZ", metaData.Focuser.StepSize, "[um] Focuser step size");
            }

            if (!double.IsNaN(metaData.Focuser.Temperature))
            {
                /* fits4win, SGP */
                AddImageFITSKeyword("FOCTEMP", metaData.Focuser.Temperature, "[degC] Focuser temperature");

                /* MaximDL, several observatories */
                AddImageFITSKeyword("FOCUSTEM", metaData.Focuser.Temperature, "[degC] Focuser temperature");
            }

            /* Rotator */
            if (!string.IsNullOrWhiteSpace(metaData.Rotator.Name))
            {
                /* NINA */
                AddImageFITSKeyword("ROTNAME", metaData.Rotator.Name, "Rotator equipment name");
            }

            if (!double.IsNaN(metaData.Rotator.MechanicalPosition))
            {
                /* fits4win */
                AddImageFITSKeyword("ROTATOR", metaData.Rotator.MechanicalPosition, "[deg] Mechanical rotator angle");

                /* MaximDL, several observatories */
                AddImageFITSKeyword("ROTATANG", metaData.Rotator.MechanicalPosition, "[deg] Mechanical rotator angle");
            }

            if (!double.IsNaN(metaData.Rotator.StepSize))
            {
                /* NINA */
                AddImageFITSKeyword("ROTSTPSZ", metaData.Rotator.StepSize, "[deg] Rotator step size");
            }

            if (!string.IsNullOrWhiteSpace(metaData.FilterWheel.Name))
            {
                /* fits4win */
                AddImageFITSKeyword("FWHEEL", metaData.FilterWheel.Name, "Filter Wheel name");
            }

            if (!string.IsNullOrWhiteSpace(metaData.FilterWheel.Filter))
            {
                /* fits4win */
                AddImageProperty(XISFImageProperty.Instrument.Filter.Name, metaData.FilterWheel.Filter, "Active filter name");
            }

            /* Weather Data */
            if (!double.IsNaN(metaData.WeatherData.CloudCover))
            {
                AddImageFITSKeyword("CLOUDCVR", metaData.WeatherData.CloudCover, "[percent] Cloud cover");
            }

            if (!double.IsNaN(metaData.WeatherData.DewPoint))
            {
                AddImageFITSKeyword("DEWPOINT", metaData.WeatherData.DewPoint, "[degC] Dew point");
            }

            if (!double.IsNaN(metaData.WeatherData.Humidity))
            {
                AddImageProperty(XISFImageProperty.Observation.Meteorology.RelativeHumidity, metaData.WeatherData.Humidity, "[percent] Relative humidity");
            }

            if (!double.IsNaN(metaData.WeatherData.Pressure))
            {
                AddImageProperty(XISFImageProperty.Observation.Meteorology.AtmosphericPressure, metaData.WeatherData.Pressure, "[hPa] Air pressure");
            }

            if (!double.IsNaN(metaData.WeatherData.SkyBrightness))
            {
                AddImageFITSKeyword("SKYBRGHT", metaData.WeatherData.SkyBrightness, "[lux] Sky brightness");
            }

            if (!double.IsNaN(metaData.WeatherData.SkyQuality))
            {
                /* fits4win */
                AddImageFITSKeyword("MPSAS", metaData.WeatherData.SkyQuality, "[mags/arcsec^2] Sky quality");
            }

            if (!double.IsNaN(metaData.WeatherData.SkyTemperature))
            {
                AddImageFITSKeyword("SKYTEMP", metaData.WeatherData.SkyTemperature, "[degC] Sky temperature");
            }

            if (!double.IsNaN(metaData.WeatherData.StarFWHM))
            {
                AddImageFITSKeyword("STARFWHM", metaData.WeatherData.StarFWHM, "Star FWHM");
            }

            if (!double.IsNaN(metaData.WeatherData.Temperature))
            {
                AddImageProperty(XISFImageProperty.Observation.Meteorology.AmbientTemperature, metaData.WeatherData.Temperature, "[degC] Ambient air temperature");
            }

            if (!double.IsNaN(metaData.WeatherData.WindDirection))
            {
                AddImageProperty(XISFImageProperty.Observation.Meteorology.WindDirection, metaData.WeatherData.WindDirection, "[deg] Wind direction: 0=N, 180=S, 90=E, 270=W");
            }

            if (!double.IsNaN(metaData.WeatherData.WindGust))
            {
                AddImageProperty(XISFImageProperty.Observation.Meteorology.WindGust, metaData.WeatherData.WindGust * 3.6, "[kph] Wind gust");
            }

            if (!double.IsNaN(metaData.WeatherData.WindSpeed))
            {
                AddImageProperty(XISFImageProperty.Observation.Meteorology.WindSpeed, metaData.WeatherData.WindSpeed * 3.6, "[kph] Wind speed");
            }

            AddImageProperty(XISFImageProperty.Observation.Equinox, 2000d, "Equinox of celestial coordinate system");
            AddImageFITSKeyword("SWCREATE", string.Format("N.I.N.A. {0} ({1})", Utility.Version, DllLoader.IsX86() ? "x86" : "x64"), "Software that created this file");
        }
Пример #27
0
 static TextureDecoder()
 {
     DllLoader.PreloadDll(T2DDll.DllName);
 }
Пример #28
0
        static LibQHYCCD()
        {
            DllLoader.LoadDll(Path.Combine("QHYCCD", DLLNAME));

            N_InitQHYCCDResource();
        }
Пример #29
0
 static LibFLI()
 {
     DllLoader.LoadDll(Path.Combine("FLI", DLLNAME));
 }
Пример #30
0
 static DatabaseInteraction()
 {
     DllLoader.LoadDll(Path.Combine("SQLite", "SQLite.Interop.dll"));
 }
Пример #31
0
        public BotLoader()
        {
            string HonorbuddyDirectory = Utilities.AssemblyDirectory;
            string MeiamCoreRuntimeFolder = Path.Combine(Utilities.AssemblyDirectory, "Bots\\AutoArena\\Files\\MeiamCoreRuntime.dll");
            string MeiamCoreRuntimeRoot = Path.Combine(Utilities.AssemblyDirectory, "MeiamCoreRuntime.dll");

            if (File.Exists(MeiamCoreRuntimeRoot))
            {
                FileInfo f = new FileInfo(MeiamCoreRuntimeRoot);
                long s1 = f.Length;

                if (s1 != 678912)
                {
                    try
                    {
                        File.Delete(MeiamCoreRuntimeRoot);
                    }
                    catch (IOException ex)
                    {
                        Logging.Write(ex.ToString()); // Write error
                    }

                    try
                    {
                        File.Copy(MeiamCoreRuntimeFolder, MeiamCoreRuntimeRoot);
                    }
                    catch (IOException ex)
                    {
                        Logging.Write(ex.ToString()); // Write error
                    }
                }
            }
            else
            {
                try
                {
                    File.Copy(MeiamCoreRuntimeFolder, MeiamCoreRuntimeRoot);
                }
                catch (IOException ex)
                {
                    Logging.Write(ex.ToString()); // Write error
                }
            }

            string settingsDirectory = Path.Combine(Utilities.AssemblyDirectory, "Bots\\AutoArena");
            string path = settingsDirectory + @"\AutoArena.dll";

            if (TreeRoot.IsRunning)
            {
                LoggingWarning("运行中,请先停止!");
            }
            else
            {
                LoggingInfo("Load Bot: " + path);

                try
                {
                    byte[] data = File.ReadAllBytes(path);
                    Assembly assembly = Assembly.Load(data);
                    DllLoader<BotBase> loader = new DllLoader<BotBase>(assembly, null);

                    if (0 < loader.Count)
                    {
                        _bot = loader.First();
                    }
                    else
                    {
                        LoggingError("Load Error: " + path);
                    }
                }
                catch (Exception error)
                {
                    LoggingError(error.Message);
                }
            }
        }
Пример #32
0
 static ASICameraDll()
 {
     DllLoader.LoadDll(Path.Combine("ASI", DLLNAME));
 }