Exemple #1
0
 public MainForm(OperationModes mode, string file = null)
 {
     XmlConfigurator.Configure();
     _opMode   = mode;
     _fileName = file;
     InitializeComponent();
 }
Exemple #2
0
        /// <summary>
        /// Calls Database stored procedures
        /// </summary>
        /// <exception cref="ConnectionException"></exception>
        /// <exception cref="AuthorizationException"></exception>
        /// <param name="login">User login</param>
        /// <param name="password">User password</param>
        /// <param name="database">Connection type test/production</param>
        public void ConnectionOpen(string login, string password, OperationModes database = OperationModes.Production)
        {
            Login = login;
            if (Connection.State == ConnectionState.Open) return;

            var connect = database == OperationModes.Test
                          ? RMSConnection.RMSTSTN
                          : RMSConnection.RMSP;

            Connection = new OracleConnection(connect.GetConnectionString(login, password));

            try
            {
                foreach (var host in connect.Hosts)
                {
                    using (var tcpClient = new TcpClient())
                    {
                        tcpClient.Connect(host.IP, host.Port);
                    }
                }
            }
            catch
            {
                throw new ConnectionException("Нет связи с базой данных Oracle. Обратитесь в отдел администрирования.");
            }

            try
            {
                Connection.Open();
            }
            catch (Exception e)
            {
                throw new AuthorizationException(e.Message);
            }
        }
 protected virtual void SetCmdQueueDefaults(QualcommDeviceInstance instance)
 {
     this._instance       = instance;
     this._opMode         = OperationModes.Normal;
     this._disableLogging = false;
     this._chkNVItems     = false;
     this._fileName       = string.Empty;
 }
Exemple #4
0
 public Session(string login, string password, OperationModes data, OperationModes database)
 {
     _db = new DBManager();
     _merch = new Merchant(login, password);
     _doc = new Document(_db, null);
     _database = database;
     _data = data;
 }
Exemple #5
0
        public static void TagMyPhotos
        (
            [Required]
            [Description("The Subscription Key for a Microsoft Face AI Service.")]
            string subscriptionKey,

            [Required]
            [Description("The endpoint for a Microsoft Face AI Service.")]
            string endPoint,

            [Required]
            [Description("An Id for the group of faces to be identified. Use the same Id during training and tagging mode.")]
            [RegexMatches(@"[0-9a-z_]+")]
            string photosGroupId,

            [Required]
            [Description("Path to the folder containing the sample images of persons to be identified. This folder should contain one subfolder for each person to be identified."
                         + " The subfolders should contain sample images for that person. These images will be used for training the face recognition engine.")]
            string samplePhotosPath,

            [Required]
            [Description("Path to the folder containing the images to be tagged.")]
            string tagPhotosPath,

            [DefaultValue(OperationModes.Tag)]
            [Description("Indicates whether we are training the engine, or using the engine to tag images.")]
            OperationModes operationMode,

            [DefaultValue(TagModes.CosoleOutput)]
            [Description("Indicates what the result of the tagging should be. ConsoleOutput will show the names of the persons found in each photo in the console. RenameFiles will rename the original files by appending the names of the persons found in the photo to the filename.")]
            TagModes tagMode
        )
        {
            var faceClient = new FaceClient(new ApiKeyServiceClientCredentials(subscriptionKey))
            {
                Endpoint = endPoint
            };

            if (operationMode == OperationModes.Train)
            {
                var groupConfigurationService = new FaceGroupConfigurationService(faceClient);
                groupConfigurationService.ConfigureGroups(samplePhotosPath, photosGroupId).GetAwaiter().GetResult();
            }
            else if (operationMode == OperationModes.Tag)
            {
                var imageTaggingService = TaggingServiceFactory.GetTaggingService(tagMode, faceClient);
                imageTaggingService.TagImages(tagPhotosPath, photosGroupId).GetAwaiter().GetResult();
            }

            Console.WriteLine("Done.");
            Console.ReadLine();
        }
Exemple #6
0
        /// <summary>
        /// This configures the CAN master and its slaves
        /// </summary>
        /// <param name="torqueM">Master torque</param>
        /// <param name="modeM">Master mode</param>
        /// <param name="cS1">Slave 1 torque</param>
        /// <param name="cS2">Slave 2 torque</param>
        /// <param name="cS3">Slave 3 torque</param>
        /// <param name="cS4">Slave 4 torque</param>
        /// <param name="cS5">Slave 5 torque</param>
        /// <param name="cS6">Slave 6 torque</param>
        /// <param name="cS7">Slave 7 torque</param>
        /// <param name="cS8">Slave 8 torque</param>
        /// <param name="mS1">Slave 1 mode</param>
        /// <param name="mS2">Slave 2 mode</param>
        /// <param name="mS3">Slave 3 mode</param>
        /// <param name="mS4">Slave 4 mode</param>
        /// <param name="mS5">Slave 5 mode</param>
        /// <param name="mS6">Slave 6 mode</param>
        /// <param name="mS7">Slave 7 mode</param>
        /// <param name="mS8">Slave 8 mode</param>
        /// <param name="sF1"></param>
        public void ConfigCan(int torqueM, OperationModes modeM, int cS1, int cS2, int cS3, int cS4, int cS5, int cS6, int cS7, int cS8,
                              OperationModes mS1, OperationModes mS2, OperationModes mS3, OperationModes mS4, OperationModes mS5, OperationModes mS6, OperationModes mS7, OperationModes mS8,
                              CanSpecialFunction sF1 = 0, CanSpecialFunction sF2 = 0, CanSpecialFunction sF3 = 0, CanSpecialFunction sF4 = 0, CanSpecialFunction sF5 = 0, CanSpecialFunction sF6 = 0, CanSpecialFunction sF7 = 0, CanSpecialFunction sF8 = 0)
        {
            string s = "<canConf m=\"" + torqueM + "\" m=\"" + (int)modeM +
                       "\" s =\"" + cS1 + "\" s=\"" + cS2 + "\" s=\"" + cS3 + "\" s=\"" + cS4 + "\" s=\"" + cS5 + "\" s=\"" + cS6 + "\" s=\"" + cS7 + "\" s=\"" + cS8 +
                       "\" s =\"" + (int)mS1 + "\" s=\"" + (int)mS2 + "\" s=\"" + (int)mS3 + "\" s=\"" + (int)mS4 + "\" s=\"" + (int)mS5 + "\" s=\"" + (int)mS6 + "\" s=\"" + (int)mS7 + "\" s=\"" + (int)mS8 +
                       "\" s =\"" + (int)sF1 + "\" s=\"" + (int)sF2 + "\" s=\"" + (int)sF3 + "\" s=\"" + (int)sF4 + "\" s=\"" + (int)sF5 + "\" s=\"" + (int)sF6 + "\" s=\"" + (int)sF7 + "\" s=\"" + (int)sF8 +
                       "\" />";

            _tcpConn.Write(s);

            Thread.Sleep(2);
        }
 public void Clear()
 {
     this._opMode         = OperationModes.Normal;
     this._disableLogging = false;
     this._isBusy         = false;
     this._chkNVItems     = false;
     this._fileName       = string.Empty;
     this._qcdmCmd.Clear();
     this._nvCmd.Clear();
     this._commandOutput = null;
     this._errorResponse.Clear();
     this.cmdQueue.Clear();
     this.cmdNVQueue.Clear();
 }
Exemple #8
0
        /// <summary>
        /// Create a new Sqlite EZ Mode object and open a connection to the passed database, or prepare to create it if it doesn't yet exist.
        /// </summary>
        /// <example>
        /// <code>
        ///     var db = new EzDb("storage.db", OperationModes.EXPLICIT_TAGGING);
        /// </code>
        /// </example>
        /// <param name="dbFileName">The path to the database.</param>
        /// <param name="operationMode">The OperationMode that should be utilized for analysing and processing data structures.</param>
        public EzDb(string dbFileName, OperationModes operationMode)
        {
            this.OperationMode = operationMode;
            // Set the connection and prepare create the DB if it doesn't exist
            SqliteConnectionStringBuilder sb = new SqliteConnectionStringBuilder()
            {
                DataSource = dbFileName,
                Mode       = SqliteOpenMode.ReadWriteCreate
            };

            this.Connection = new SqliteConnection(sb.ToString());
            this.Connection.Open();

            this.rowSchemaMap = new Dictionary <Type, MetaSqliteRow>();
        }
Exemple #9
0
        public void SetOperationMode(OperationModes mode)
        {
            if (mode == OperationModes.Integer)
            {
                uint data = m_hmc.ReadRegister(HMC704LP4E_REGS.REG6_SD_CFG);
                m_allRegs.reg6SdCfg             = BF.CreateBitField <REG6_SDCFG>(data);
                m_allRegs.reg6SdCfg.frac_rstb   = 0;
                m_allRegs.reg6SdCfg.frac_bypass = 1;
                m_hmc.WriteRegister(HMC704LP4E_REGS.REG6_SD_CFG, m_allRegs.reg6SdCfg.ToUInt32());


                data = m_hmc.ReadRegister(HMC704LP4E_REGS.FrequencyRegisterFractionalPart);
                m_allRegs.regFreqFrac      = BF.CreateBitField <REG4_FrequencyFractionaPart>(data);
                m_allRegs.regFreqFrac.frac = 1;
                m_hmc.WriteRegister(HMC704LP4E_REGS.FrequencyRegisterFractionalPart, m_allRegs.regFreqFrac.ToUInt32());

                // R = 1 - we will use the default which set to 1 already
            }
            m_operationMode = mode;
        }
 public CommandQueue(QualcommDeviceInstance instance)
 {
     this.enableFastBuffer    = false;
     this.cBufferSize         = 0x100;
     this._opMode             = OperationModes.Normal;
     this._disableLogging     = false;
     this._chkNVItems         = false;
     this._fileName           = string.Empty;
     this._qcdmCmd            = new List <Qcdm.Cmd>();
     this._nvCmd              = new List <NVItemList>();
     this._commandOutput      = null;
     this._errorResponse      = new List <Qcdm.NV_Response>();
     this.myQueue             = new Queue();
     this.cmdQueue            = Queue.Synchronized(this.myQueue);
     this.myNVQueue           = new Queue();
     this.cmdNVQueue          = Queue.Synchronized(this.myNVQueue);
     this.taskIdentifier      = "CommandQueue";
     this.userStateToLifetime = new HybridDictionary();
     this.components          = null;
     this.InitializeComponent();
     this.InitializeDelegates();
     this.SetCmdQueueDefaults(instance);
 }
Exemple #11
0
 private void addToolStripMenuItem_Click(object sender, EventArgs e)
 {
     CurrentOpMode = OperationModes.Add;
     AddModifyListGroupControl.Visible = true;
     AddModifyListGroupControl.Text = "Add a List";
     addListSimpleButton.Text = "+";
     listNameTextEdit.Focus();
 }
Exemple #12
0
 private void taskLists_Load(object sender, EventArgs e)
 {
     SetPosition();
     CurrentOpMode = OperationModes.Add;
     CurrentListId = ListId;
     HowClose = CloseLaunchers.xButton;
     AddModifyListGroupControl.Visible = false;
     GetLists();
 }
Exemple #13
0
 private void modifyListToolStripMenuItem_Click(object sender, EventArgs e)
 {
     CurrentOpMode = OperationModes.Modify;
     AddModifyListGroupControl.Visible = true;
     AddModifyListGroupControl.Text = "Modify a List";
     ListId = GetSelectedListId();
     string ListToModify = GetSelectedListName();
     listNameTextEdit.Text = ListToModify;
     addListSimpleButton.Text = "◊";
     listNameTextEdit.Focus();
 }
Exemple #14
0
        /// <summary>
        /// Sets the button that is displayed on the status display.
        /// </summary>
        /// <param name="mode">The mode to be applied.</param>
        public void SetOperationMode(OperationModes mode)
        {
            this.currentMode = mode;

            UpdateMode();
        }
Exemple #15
0
 private void SetMode(OperationModes mode)
 {
     WriteByte(Registers.BNO055_OPR_MODE_ADDR, (byte)mode);
 }
Exemple #16
0
        public static int Main(string[] args)
        {
            ServicePointManager.UseNagleAlgorithm = true;
            ServicePointManager.Expect100Continue = true;
            ServicePointManager.CheckCertificateRevocationList = true;
            ServicePointManager.DefaultConnectionLimit         = ServicePointManager.DefaultPersistentConnectionLimit;
            ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12 | (SecurityProtocolType)3072;
            webClient.Headers.Add("User-Agent", "Unity web player");

            temp_folder_path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "tmp");
            if (Directory.Exists(temp_folder_path))
            {
                Directory.Delete(temp_folder_path, true);
            }
            cache_path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "cache.tmp");
            if (File.Exists(cache_path))
            {
                File.Delete(cache_path);
            }

            if ((args.Length < 1) || (args.Length > 2) || string.IsNullOrEmpty(args[0]))
            {
                Logger.Error("Bad arguments for extractor process; expected arguments: <unityVersion>");
                return(-1);
            }

            string requested_version = args[0];

            OperationMode = (requested_version.EndsWith(";android") ||
                             requested_version.EndsWith(";android_il2cpp"))
                ? OperationModes.Android_Il2Cpp
                : (requested_version.EndsWith(";android_mono")
                ? OperationModes.Android_Mono
                : OperationModes.Normal);

            if (OperationMode != OperationModes.Normal)
            {
                requested_version = requested_version.Substring(0, requested_version.LastIndexOf(";"));
            }

            UnityVersion.Refresh();
            if (UnityVersion.VersionTbl.Count <= 0)
            {
                Logger.Error($"Failed to Get Unity Versions List from {UnityVersion.UnityURL}");
                return(-1);
            }

            if ((args.Length == 2) && !string.IsNullOrEmpty(args[1]))
            {
                UnityVersion version = GetUnityVersionFromString(requested_version);
                if (version == null)
                {
                    Logger.Error($"Failed to Find Unity Version [{requested_version}] in List!");
                    return(-1);
                }
                cache_path = args[1];
                try { return(ExtractFilesFromArchive(version) ? 0 : -1); }
                catch (Exception x) { Logger.Error(x.ToString()); return(-1); }
            }

            return(requested_version.StartsWith("--all") ? (ProcessAll() ? 0 : -1) : (ProcessSpecific(requested_version) ? 0 : -1));
        }
Exemple #17
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="mode">Debug = local test server, live = ISAP live server.</param>
 /// <param name="username"></param>
 /// <param name="password"></param>
 public ApiAccess(OperationModes mode, string username, string password)
 {
     this.Mode     = mode;
     this.username = username;
     this.password = password;
 }