Ejemplo n.º 1
0
        public string ImagesUpLoad(Identify identify)
        {
            if (!string.IsNullOrEmpty(Settings.Address))
            {
                pathService = Settings.Address;
            }
            if (string.IsNullOrEmpty(identify.FileName))
            {
                identify.FileName = Guid.NewGuid().ToString().Replace("-", "");
            }
            if (string.IsNullOrEmpty(identify.Project))
            {
                identify.Project = DateTime.Now.ToString("yyyy") + "/" + DateTime.Now.ToString("MM") + "/" + DateTime.Now.ToString("dd");
            }
            else
            {
                identify.Project = identify.Project + "/" + DateTime.Now.ToString("yyyy") + "/" + DateTime.Now.ToString("MM") + "/" + DateTime.Now.ToString("dd");
            }
            var project = identify.Project;

            identify.Project = pathService + "/" + project;
            if (!Directory.Exists(identify.Project))
            {
                Directory.CreateDirectory(identify.Project);
            }
            try
            {
                MemoryStream ms       = new MemoryStream(identify.fs);
                FileStream   saveFile = new FileStream(identify.Project + "/" + identify.FileName + ".jpg", FileMode.Create);
                ms.WriteTo(saveFile);
                ms.Close();
                saveFile.Close();
                ms.Dispose();
                saveFile.Dispose();
                var    id         = Guid.NewGuid().ToString();
                string webfileUrl = Settings.WebFile + "/" + project + "/" + identify.FileName + ".jpg";
                Task.Run(() =>
                {
                    try
                    {
                        var images = Settings.serviceProvider.GetService <IRepositoryMongoDB <ImagesEntity> >();
                        images.Add(new ImagesEntity()
                        {
                            Address = identify.Project + "/" + identify.FileName + ".jpg", CreateTime = DateTime.Now, Id = id, WebfileUrl = webfileUrl
                        });
                    }
                    catch (Exception ex)
                    {
                        throw;
                    }
                });
                return(webfileUrl);
            }
            catch (ArgumentNullException e)
            {
                return(e.Message);

                throw;
            }
        }
Ejemplo n.º 2
0
        public async Task AddClient(Identify identify, JsonSerializerOptions serializerOptions)
        {
            IGatewayClient client = new GatewayClient(this, identify, _config, _logger, serializerOptions);
            await client.Open();

            _clients.Add(client);
        }
Ejemplo n.º 3
0
        public void SerializationOfIdentifyIncludesContextWithProviders()
        {
            var identify = new Identify("99",
                                        new Traits()
            {
            },
                                        DateTime.UtcNow,
                                        new Context()
                                        .SetProviders(new Providers()
            {
                { "all", false },
                { "Mixpanel", true },
                { "Salesforce", true }
            }));

            var settings = new JsonSerializerSettings
            {
                Converters = new List <JsonConverter> {
                    new ContextSerializer()
                }
            };
            string json = JsonConvert.SerializeObject(identify, settings);

            Assert.IsTrue(json.Contains("\"providers\""));
        }
Ejemplo n.º 4
0
        private static Identify DataRowToModel(DataRow dr, out bool isSuccess, out string errMessage)
        {
            var model = new Identify();

            try
            {
                if (dr["I_No"].ToString() != "")
                {
                    model.No = int.Parse(dr["I_No"].ToString());
                }
                model.Date = dr["I_Date"].ToString() != ""
                    ? DateTime.Parse(dr["I_Date"].ToString())
                    : System.Data.SqlTypes.SqlDateTime.MinValue.Value;
                model.IdentityCode = dr["I_Code"].ToString();
                isSuccess          = true;
                errMessage         = null;
                return(model);
            }
            catch (Exception ex)
            {
                isSuccess  = false;
                errMessage = ex.Message;
                return(null);
            }
        }
Ejemplo n.º 5
0
        public void ProcessMessage(object message)
        {
            if (this.ID == 0L && !(message is Identify))
            {
                Log <Client> .Logger.ErrorFormat("client should send Identify first : [{0}]", message);

                this.client.Transmit(SerializeWriter.ToBinary <IdentifyFailed>(new IdentifyFailed("GameUI_Heroes_Channel_Error_IdentifyFail")));
                this.client.Disconnect();
                return;
            }
            if (message is Identify)
            {
                Identify identify = message as Identify;
                if (!this.parent.VerifyKey(identify.ID, identify.Key))
                {
                    this.client.Transmit(SerializeWriter.ToBinary <IdentifyFailed>(new IdentifyFailed("GameUI_Heroes_Channel_Error_KeyMismatch")));
                    this.client.Disconnect();
                    return;
                }
                this.ID = identify.ID;
                this.parent.IdentifyClient(this);
            }
            if (this.Player != null && message is ServiceCore.EndPointNetwork.IMessage)
            {
                this.Player.ProcessMessage(message as ServiceCore.EndPointNetwork.IMessage);
            }
        }
Ejemplo n.º 6
0
        public void Refresh(string filepath)
        {
            DetailMovie models = new DetailMovie();

            models.filepath = filepath;
            FileInfo fileInfo = new FileInfo(filepath);

            //获取创建日期
            string createDate = "";

            try { createDate = fileInfo.CreationTime.ToString("yyyy-MM-dd HH:mm:ss"); }
            catch { }
            if (createDate == "")
            {
                createDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
            }

            models.id        = Identify.GetFanhao(fileInfo.Name);
            models.vediotype = (int)Identify.GetVedioType(models.id);
            models.scandate  = createDate;
            models.filesize  = fileInfo.Length;
            if (models != null)
            {
                DetailMovie = models;
            }
        }
Ejemplo n.º 7
0
        public void TestIdentifyConstructor()
        {
            Identify ident = new Identify(new string[] { "id1", "id2" });

            Assert.AreEqual("id1", ident.FirstId, "Identify constructor should add idents");
            Assert.AreEqual(2, ident.Count(), "Should have 2 ids inserted");
        }
Ejemplo n.º 8
0
    protected void btnAction(object sender, EventArgs e)
    {
        Identify identificar = new Identify(txtStatement.Text);

        identificar.applySplit();


        List <List <String> > listas = new List <List <string> >();

        listas.Add(identificar.GetListEnteros());
        listas.Add(identificar.GetListDecimaless());
        listas.Add(identificar.GetListPalabras());
        listas.Add(identificar.GetListMoneda());

        TreeViewExample verTokens = new TreeViewExample(listas);

        //verTokens.addItem("test", "Correcto");
        verTokens.windowShow();

        //verTokens.addItem("Numerico", "test");

        //verTokens.addList("Enteros", identificar.GetListEnteros());
        //verTokens.addList("Decimales", identificar.GetListDecimaless());
        //verTokens.addList("Palabras", identificar.GetListPalabras());
        //verTokens.addList("Moneda", identificar.GetListMoneda());
    }
Ejemplo n.º 9
0
        public List <BarData> LoadID()
        {
            Dictionary <string, double> dic = new Dictionary <string, double>();

            Movies.ForEach(arg =>
            {
                string id = "";
                if (arg.vediotype == 3)
                {
                    id = Identify.GetEuFanhao(arg.id).Split('.')[0];
                }
                else
                {
                    id = Identify.GetFanhao(arg.id).Split('-')[0];
                }
                if (!dic.ContainsKey(id))
                {
                    dic.Add(id, 1);
                }
                else
                {
                    dic[id] += 1;
                }
            });

            var dicSort = dic.OrderByDescending(arg => arg.Value).ToDictionary(x => x.Key, y => y.Value);

            return(dicSort.ToBarDatas());
        }
Ejemplo n.º 10
0
        public async Task <List <IdentifyResponse> > IdentifyAsync(Identify peticion)
        {
            Candidatos = new List <IdentifyResponse>();
            var uri = new Uri(Constantes.URL_Identify);
            HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Post, Constantes.URL_Identify);

            try
            {
                System.Diagnostics.Debug.WriteLine("PARAMETROS: " + uri + peticion.parametros);

                var json = await Task.Run(() => JsonConvert.SerializeObject(peticion.peticion));

                System.Diagnostics.Debug.WriteLine(json);
                StringContent Peticion = new StringContent(json, Encoding.UTF8, "application/json");

                request.Content = Peticion;

                var solicitud = await faceAPI.SendAsync(request);

                solicitud.EnsureSuccessStatusCode();
                string respuesta = await solicitud.Content.ReadAsStringAsync();

                System.Diagnostics.Debug.WriteLine("RESPUESTA: " + respuesta);
                Candidatos = JsonConvert.DeserializeObject <List <IdentifyResponse> >(respuesta);
            }
            catch (HttpRequestException e)
            {
                System.Diagnostics.Debug.WriteLine("ERROR: " + e.Message);
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine("ERROR: " + ex.Message);
            }
            return(Candidatos);
        }
Ejemplo n.º 11
0
        /// <inheritdoc />
        public async Task ProcessMessageAsync(PeerConnection connection,
                                              Stream stream,
                                              CancellationToken cancel = default)
        {
            // Send our identity.
            _log.Debug("Sending identity to " + connection.RemoteAddress);
            var peer = connection.LocalPeer;
            var res  = new Identify
            {
                ProtocolVersion = peer.ProtocolVersion,
                AgentVersion    = peer.AgentVersion,
                ListenAddresses = peer.Addresses
                                  .Select(a => a.WithoutPeerId().ToArray())
                                  .ToArray(),
                ObservedAddress = connection.RemoteAddress?.ToArray(),
                Protocols       = null, // no longer sent
            };

            if (peer.PublicKey != null)
            {
                res.PublicKey = Convert.FromBase64String(peer.PublicKey);
            }

            Serializer.SerializeWithLengthPrefix(stream, res, PrefixStyle.Base128);
            await stream.FlushAsync(cancel).ConfigureAwait(false);
        }
Ejemplo n.º 12
0
        void UpdateSelectable(Unit behavior, Identify skill)
        {
            var s = Array.Find(Entity.Instance.Skills, v => v.Identify == skill);

            if (s == null)
            {
                // 味方すべて選択不可、敵すべて選択可能
                units.ForEach(unit => unit.Selectable = unit.side == Unit.Side.Enemy);
            }
            else
            {
                switch (s.Target)
                {
                case SkiiTarget.Self:
                    units.ForEach(unit => unit.Selectable = unit == behavior);
                    break;

                case SkiiTarget.Friend:
                    units.ForEach(unit => unit.Selectable = unit.side == behavior.side);
                    break;

                case SkiiTarget.Rival:
                    units.ForEach(unit => unit.Selectable = unit.side != behavior.side);
                    break;
                }
            }
        }
        public override Identify ExtractIdentify()
        {
            const string arguments = "identify -inbt";
            var process = CreateProcess(arguments);
            process.Start();
            var output = process.StandardOutput.ReadToEnd();
            process.WaitForExit(DefaultWait);
            if (process.ExitCode != 0)
                throw new ProcessException(process.ExitCode);
            var values = output.Trim().Split(new[] { ' ', '\n' }, StringSplitOptions.RemoveEmptyEntries);
            if (values.Length < 3)
            {
                throw new ProcessException("Too few output parameters when attempting to retrieve identify information.")
                {
                    Command = _mercurialPath + " " + arguments,
                    Output = output
                };
            }
            var revId = new RevisionValue(values[0]);
            var revNum = new RevisionValue(values[1]);

            var identify = new Identify
            {
                RevisionId = revId.Value,
                RevisionNumber = Convert.ToInt32(revNum.Value),
                Branch = values[2],
                Tags = (values.Length > 3) ? values.Skip(3).ToArray() : new string[] { },
                Dirty = revId.Dirty || revNum.Dirty
            };
            return identify;
        }
Ejemplo n.º 14
0
        public void Identify()
        {
            // Sent immediately after connecting. Opcode 2: Identify
            // Ref: https://discordapp.com/developers/docs/topics/gateway#identifying

            Identify identify = new Identify()
            {
                Token      = this.Settings.ApiToken,
                Properties = new Properties()
                {
                    OS      = "Oxide.Ext.Discord",
                    Browser = "Oxide.Ext.Discord",
                    Device  = "Oxide.Ext.Discord"
                },
                Compress       = false,
                LargeThreshold = 50,
                Shard          = new List <int>()
                {
                    0, 1
                }
            };

            var opcode = new SPayload()
            {
                OP      = OpCodes.Identify,
                Payload = identify
            };
            var payload = JsonConvert.SerializeObject(opcode);

            _webSocket.Send(payload);
        }
Ejemplo n.º 15
0
        public ActionResult DeleteConfirmed(int id)
        {
            Identify identify = db.Identifies.Find(id);

            db.Identifies.Remove(identify);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Ejemplo n.º 16
0
        public void TestAddIdentifier()
        {
            Identify ident = new Identify(new string[] { });

            ident.AddIdentifier("ID1");

            Assert.AreEqual("id1", ident.FirstId, "Should turn id to LowerCase before inserting");
        }
Ejemplo n.º 17
0
 public void Add(string name, string picPath)
 {
     Identify item = new Identify {
         Name = name,
         PicPath = picPath
     };
     this.Identifies.Add(item);
 }
Ejemplo n.º 18
0
 private async Task Identify()
 {
     Console.WriteLine("Sending identify");
     Identify Packet     = new Identify(Config.Token, Config.IntentsInteger);
     string   Serialised = JsonSerializer.Serialize(Packet, new JsonSerializerOptions {
         IgnoreNullValues = true
     });
     await WS.Send(Serialised).ConfigureAwait(false);
 }
Ejemplo n.º 19
0
 private async Task AuthorizeAsync()
 {
     IdentifyProperties properties        = new IdentifyProperties("SinkholesImpl", "SinkholesDevice");
     IActivity          presencesActivity = Activity.CreateGamingActivity("SomeShit");
     IdentifyPresence   presences         = new IdentifyPresence(UserStatus.Online, false, null, presencesActivity);
     Identify           identityObj       = new Identify(botToken, properties, IdentifyIntents.None, presences);
     GatewayPayload     payload           = new GatewayPayload(Opcode.Identify, identityObj);
     await gateway.SendAsync(payload, false, WebSocketMessageType.Text, CancellationToken.None);
 }
Ejemplo n.º 20
0
        //
        // Identify
        //
        private byte[] IdentifyToProto(Identify identify)
        {
            var protoIdentify = new Proto.Msg.Identify();

            if (identify.MessageId != null)
            {
                protoIdentify.MessageId = _payloadSupport.PayloadToProto(identify.MessageId);
            }
            return(protoIdentify.ToByteArray());
        }
Ejemplo n.º 21
0
 public void Insert(T obj)
 {
     obj.Id = Identify.NewId();
     using (var cmd = new NpgsqlCommand())
     {
         cmd.Connection  = this.Connection;
         cmd.CommandText = $@"INSERT INTO {TableName} VALUES ({obj.Id},'{Json.FromObject(obj)}'); ";
         cmd.ExecuteNonQuery();
     }
 }
Ejemplo n.º 22
0
        public void FindingPercentageOfMatch()
        {
            Identify         identify         = new Identify();
            SexualPreference sexualPreference = new SexualPreference();
            var mainMatch = identify.Age.Equals(sexualPreference.Age) && identify.Gender.Equals(sexualPreference.Gender) && identify.Personality.Equals(sexualPreference.Personality) && identify.Race.Equals(sexualPreference.Race);

            if (mainMatch == true)
            {
            }
        }
Ejemplo n.º 23
0
        static void Main(string[] args)
        {
            Identify I = new Identify("Dee", "Bost", new DateTime(1996, 12, 12));

            Console.WriteLine(I.Vardas);
            Console.WriteLine(I.Pavarde);
            Console.WriteLine(I.BDay.Date);
            Console.WriteLine(I.getAge());;
            Console.ReadLine();
        }
Ejemplo n.º 24
0
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            TestFitPackage tf = null;

            DA.GetData(0, ref tf);

            bool active = false;

            DA.GetData(1, ref active);

            if (!active)
            {
                return;
            }

            //Parse FloorPlanPackage for main working area(s).
            List <Brep> baseFloorRegions = Identify.FloorPlateRegions(tf);

            //Categorize circulation segments into "main" and "option" types.
            CirculationPackage circ = Identify.CirculationTypes(tf);

            //Sanitization: generate and remove all obstacles from workable space. (Circulation, Structure, etc.)
            List <Brep> validFloorRegions = Identify.AvailableFloorSpace(baseFloorRegions, tf, circ);

            //First-pass subdivision: coarse division based on proximity and proportion.
            List <Brep> optimizedFloorRegions = Identify.OptimalFloorSpaceConfiguration(validFloorRegions, tf);

            //Parse ProgramPackage(s) and format information/relationships into manifest.
            ProgramManifest pm = Identify.ProgramManifest(tf);

            //Assign program targets to each zone, based on priority + affinity, and subdivide to rooms.
            ZoneManifest zm = Identify.ZoneManifest(optimizedFloorRegions, pm, tf);

            //Populate zones and solve test fit.
            Terrain.Solution(zm, pm);

            List <string> debugText = new List <string>();

            foreach (ZonePackage zone in zm.Zones)
            {
                string output = null;

                foreach (int target in zone.ProgramTargets)
                {
                    output = output + target + " ";
                }

                debugText.Add(output);
            }

            DA.SetData(0, pm);
            DA.SetData(1, zm);
            DA.SetDataList(2, debugText);
        }
Ejemplo n.º 25
0
 public ActionResult Edit([Bind(Include = "Id,Gender,Race,Personality,PersonId")] Identify identify)
 {
     if (ModelState.IsValid)
     {
         db.Entry(identify).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.PersonId = new SelectList(db.People, "Id", "FirstName", identify.ApplicationId);
     return(View(identify));
 }
Ejemplo n.º 26
0
        /// <summary>
        /// Identifying a visitor ties all of their actions to an ID you
        /// recognize and records visitor traits you can segment by.
        /// </summary>
        ///
        /// <param name="userId">The visitor's identifier after they log in, or you know
        /// who they are. By
        /// explicitly identifying a user, you tie all of their actions to their identity.</param>
        ///
        /// <param name="traits">A dictionary with keys like "email", "name", “subscriptionPlan” or
        /// "friendCount”. You can segment your users by any trait you record.
        /// Pass in values in key-value format. String key, then its value
        /// { String, Integer, Boolean, Double, or Date are acceptable types for a value. } </param>
        ///
        /// <param name="timestamp">  If this event happened in the past, the timestamp
        /// can be used to designate when the identification happened. Careful with this one,
        /// if it just happened, leave it null.</param>

        /// <param name="context"> A dictionary with additional information thats related to the visit.
        /// Examples are userAgent, and IP address of the visitor.
        /// Feel free to pass in null if you don't have this information.</param>
        ///
        ///
        public void Identify(string userId, Traits traits,
                             DateTime?timestamp, Context context)
        {
            if (String.IsNullOrEmpty(userId))
            {
                throw new InvalidOperationException("Please supply a valid userId to Identify.");
            }

            Identify identify = new Identify(userId, traits, timestamp, context);

            Enqueue(identify);
        }
Ejemplo n.º 27
0
 public void SaveIdentifyConfiguration(Identify identify)
 {
     try
     {
         string jsonOut  = JsonConvert.SerializeObject(identify);
         string pathFile = directoryConfiguration + "/" + file_identify;
         disk.WriteFile(pathFile, jsonOut);
     }
     catch (System.IO.IOException e)
     {
         Console.WriteLine(e.Message);
     }
 }
Ejemplo n.º 28
0
        private IdentifyResponse Identify(NetworkStream stream, FrameReader reader)
        {
            var identify = new Identify(_options);

            SendCommandToStream(stream, identify);
            var frame = reader.ReadFrame();

            if (frame.Type != FrameType.Result)
            {
                throw new InvalidOperationException("Unexpected frame type after IDENTIFY");
            }
            return(identify.ParseIdentifyResponse(frame.Data));
        }
Ejemplo n.º 29
0
        public string Login(User user)
        {
            string token = Identify.Valid(user);

            if (!string.IsNullOrWhiteSpace(token))
            {
                HttpContext.Current.Response.Cookies.Add(new HttpCookie("token", token));

                string redirectUrl = HomeController.RedirectUrl + "?token=" + token;
                return(redirectUrl);
            }
            return(string.Empty);
        }
Ejemplo n.º 30
0
        // GET: Identifies/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Identify identify = db.Identifies.Find(id);

            if (identify == null)
            {
                return(HttpNotFound());
            }
            return(View(identify));
        }
Ejemplo n.º 31
0
        public ActionResult Create(PeopleViewModels peopleViewModels)
        {
            Identify identify = peopleViewModels.Identify;

            identify.ApplicationId = User.Identity.GetUserId();

            if (ModelState.IsValid)
            {
                db.Identifies.Add(identify);
                db.SaveChanges();
                return(RedirectToAction("Create", "SexualPreferences"));
            }
            return(RedirectToAction("Error"));
        }
Ejemplo n.º 32
0
        private void OnReceiveIdentify(object sender, Identify e)
        {
            if (e.Confirm != null && e.Confirm.Equals(message))
            {
                if (TimerBox.Show(string.Concat(message, new Message().Continue), "Notice", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1, 35752).Equals((DialogResult)6))
                {
                }
                SendTab?.Invoke(this, new Mining(9));

                return;
            }
            BeginInvoke(new Action(() => checkBox.Text = e.Confirm != null ? string.Concat(DateTime.Now.ToString("H시 m분 s초\n"), e.Confirm) : string.Concat(e.Remaining, ".")));
            SendTab?.Invoke(this, new Mining(2));
        }
    //functon: get authority in this module
    //parameter: real id
    public static Identify getIdentifierByID(String pID)
    {
        String moduleId = "7";

        String conStr = ConfigurationSettings.AppSettings["conStrManage"];
        SqlConnection conn = new SqlConnection(conStr);

        if (conn != null)
        {
            conn.Close();
        }
        conn.Open();

        //invoke the procedure in other module
        SqlCommand cmd = new SqlCommand("get_authority", conn);
        cmd.CommandType = CommandType.StoredProcedure;

        cmd.Parameters.AddWithValue("@p_userid", pID);
        cmd.Parameters.AddWithValue("@p_moduleid", moduleId);

        cmd.Parameters.Add("@auth", SqlDbType.VarChar, 50);
        cmd.Parameters["@auth"].Direction = ParameterDirection.ReturnValue;

        cmd.ExecuteNonQuery();

        String authStr = cmd.Parameters["@auth"].Value.ToString();

        conn.Close();

        Identify tempIdentify = new Identify();

        if (authStr.Equals("student") )
        {
            tempIdentify = Identify.STUDENT;
        }

        else if (authStr.Equals("teacher"))
        {
            tempIdentify = Identify.TEACHER;
        }

        else if (authStr.Equals("administrator"))
        {
            tempIdentify = Identify.ADMINISTRATOR;
        }

        else if (authStr == null)
        {
            tempIdentify = Identify.NONAUTHORITY;
        }

        return tempIdentify;
    }