private void RegisterItemIntoMetaTagSystem(ItemSpawnerEntry entry)
        {
            if (!IM.OD.ContainsKey(entry.MainObjectID))
            {
                return;
            }

            FVRObject mainObject        = IM.OD[entry.MainObjectID];
            string    pageString        = entry.EntryPath.Split('/')[0];
            string    subCategoryString = entry.EntryPath.Split('/')[1];

            ItemSpawnerV2.PageMode page = ItemSpawnerV2.PageMode.Firearms;
            if (Enum.IsDefined(typeof(ItemSpawnerV2.PageMode), pageString))
            {
                page = (ItemSpawnerV2.PageMode)Enum.Parse(typeof(ItemSpawnerV2.PageMode), pageString);
            }

            ItemSpawnerID.ESubCategory subCategory = ItemSpawnerID.ESubCategory.None;
            if (Enum.IsDefined(typeof(ItemSpawnerID.ESubCategory), subCategoryString))
            {
                subCategory = (ItemSpawnerID.ESubCategory)Enum.Parse(typeof(ItemSpawnerID.ESubCategory), subCategoryString);
            }

            IM.AddMetaTag(subCategoryString, TagType.SubCategory, entry.MainObjectID, page);

            entry.ModTags.ForEach(tag =>
                                  IM.AddMetaTag(tag, TagType.ModTag, entry.MainObjectID, page));

            RegisterItemIntoMetaTagSystem(mainObject, page);
        }
        private GameObject UpdateCurrentGameObj(GameObject obj)
        {
            if (obj != null)
            {
                m_currentGameObj       = obj;
                m_currentFVRObj        = null;
                m_currentFVRPhysObj    = null;
                m_currentItemSpawnerID = null;

                if (m_currentGameObj.GetComponentInChildren <FVRPhysicalObject>() != null)
                {
                    m_currentFVRPhysObj    = m_currentGameObj.GetComponentInChildren <FVRPhysicalObject>();
                    m_currentFVRObj        = m_currentFVRPhysObj.ObjectWrapper;
                    m_currentItemSpawnerID = m_currentFVRPhysObj.IDSpawnedFrom;

#if !UNITY_EDITOR && !UNITY_STANDALONE
                    if (m_currentFVRObj != null && IM.HasSpawnedID(m_currentFVRObj.SpawnedFromId))
                    {
                        m_currentItemSpawnerID = IM.GetSpawnerID(m_currentFVRObj.SpawnedFromId);
                    }
#endif
                }
                SpawnerRefreshElements();
            }

            return(m_currentGameObj);
        }
Exemple #3
0
        private static bool SpawnItemDetails(ItemSpawnerV2 __instance)
        {
            OtherLogger.Log("Trying to spawn: " + __instance.m_selectedID, OtherLogger.LogType.General);

            //If the selected item has a spawner entry, use that
            if (OtherLoader.SpawnerEntriesByID.ContainsKey(__instance.m_selectedID))
            {
                OtherLogger.Log("Using normal spawn", OtherLogger.LogType.General);

                __instance.Boop(1);
                AnvilManager.Run(SpawnItems(__instance, OtherLoader.SpawnerEntriesByID[__instance.m_selectedID]));
            }

            //Otherwise try to use legacy spawner ID
            else if (IM.HasSpawnedID(__instance.m_selectedID))
            {
                OtherLogger.Log("Using legacy spawn", OtherLogger.LogType.General);

                return(true);
            }

            else
            {
                __instance.Boop(2);
            }

            return(false);
        }
Exemple #4
0
        /// <summary>
        /// Fetch message history from the server.
        ///
        /// The 'start' and 'end' attributes MAY be specified to indicate a date range.
        ///
        /// If the 'with' attribute is omitted then collections with any JID are returned.
        ///
        /// If only 'start' is specified then all collections on or after that date should be returned.
        ///
        /// If only 'end' is specified then all collections prior to that date should be returned.
        /// </summary>
        /// <param name="pageRequest">Paging options</param>
        /// <param name="start">Optional start date range to query</param>
        /// <param name="end">Optional enddate range to query</param>
        /// <param name="with">Optional JID to filter archive results by</param>
        public XmppPage <ArchivedChatId> GetArchivedChatIds(XmppPageRequest pageRequest, DateTimeOffset?start = null, DateTimeOffset?end = null, Jid with = null)
        {
            pageRequest.ThrowIfNull();

            var request = Xml.Element("list", xmlns);

            if (with != null)
            {
                request.Attr("with", with.ToString());
            }

            if (start != null)
            {
                request.Attr("start", start.Value.ToXmppDateTimeString());
            }

            if (end != null)
            {
                request.Attr("end", end.Value.ToXmppDateTimeString());
            }

            var setNode = pageRequest.ToXmlElement();

            request.Child(setNode);

            var response = IM.IqRequest(IqType.Get, null, null, request);

            if (response.Type == IqType.Error)
            {
                throw Util.ExceptionFromError(response, "Failed to get archived chat ids");
            }

            return(new XmppPage <ArchivedChatId>(response.Data["list"], GetChatIdsFromStanza));
        }
Exemple #5
0
    //ASK ABBY ABOUT GAMEFEEL
    //public IEnumerator MainLoop() {
    //while (true) {
    //    ReadInputs();
    //    yield return StartCoroutine(ResolveActions());
    //}
    //}

    void ReadInputs()
    {
        if (IM.Pressed(Inputs.Left))
        {
            MsgAll(new EventMsg(EventType.MonsterMove, null, 0, Inputs.None));
            if (!God.GSM.hasKey)
            {
                MsgAll(new EventMsg(EventType.KeyMove, null, 0, Inputs.None));
            }
            MsgAll(new EventMsg(EventType.ScoreMove, null, 0, Inputs.None));
            MsgAll(new EventMsg(Inputs.Left));
        }
        else if (IM.Pressed(Inputs.Right))
        {
            MsgAll(new EventMsg(EventType.MonsterMove, null, 0, Inputs.None));
            if (!God.GSM.hasKey)
            {
                MsgAll(new EventMsg(EventType.KeyMove, null, 0, Inputs.None));
            }
            MsgAll(new EventMsg(EventType.ScoreMove, null, 0, Inputs.None));
            MsgAll(new EventMsg(Inputs.Right));
        }
        else if (IM.Pressed(Inputs.Up))
        {
            MsgAll(new EventMsg(EventType.MonsterMove, null, 0, Inputs.None));
            if (!God.GSM.hasKey)
            {
                MsgAll(new EventMsg(EventType.KeyMove, null, 0, Inputs.None));
            }
            MsgAll(new EventMsg(EventType.ScoreMove, null, 0, Inputs.None));
            MsgAll(new EventMsg(Inputs.Up));
        }
        else if (IM.Pressed(Inputs.Down))
        {
            MsgAll(new EventMsg(EventType.MonsterMove, null, 0, Inputs.None));
            if (!God.GSM.hasKey)
            {
                MsgAll(new EventMsg(EventType.KeyMove, null, 0, Inputs.None));
            }
            MsgAll(new EventMsg(EventType.ScoreMove, null, 0, Inputs.None));
            MsgAll(new EventMsg(Inputs.Down));
        }

        //if (Input.GetKeyUp(KeyCode.S)) {
        //    ModelManager.SaveGame();
        //}
        //if (Input.GetKeyUp(KeyCode.L)) {
        //    ModelManager.PendingSave = ModelManager.LoadGame();
        //    if (ModelManager.PendingSave != null)
        //        SceneManager.LoadScene(0);
        //    else
        //        Debug.Log("NO FILE TO LOAD");
        //}
        //if (Input.GetKeyUp(KeyCode.D)) {
        //    ModelManager.DeleteSave();
        //}
        //if (Input.GetKeyUp(KeyCode.Space)) {
        //    StartCoroutine(ModelManager.CaptureScreenshot("X"));
        //}
    }
Exemple #6
0
    public IM CreateMesh(float[,,] voxels)
    {
        List <Point>    verts     = new List <Point>();
        List <int>      index     = new List <int>();
        HashSet <Point> container = new HashSet <Point>();

        float[] cube = new float[8];

        for (int x = 0; x < voxels.GetLength(0) - 1; x++)
        {
            for (int y = 0; y < voxels.GetLength(1) - 1; y++)
            {
                for (int z = 0; z < voxels.GetLength(2) - 1; z++)
                {
                    //Get the values in the 8 neighbours which make up a cube
                    FillCube(x, y, z, voxels, cube);
                    //Perform algorithm
                    MarchCube(new Point(x, y, z), cube, verts, container, index);
                }
            }
        }

        //if(verts.Count > 65000)
        //{
        //    DebugLog.logConsole("Recursing for optimized vertices.......");
        //    target += 0.01f;
        //    return CreateMesh(voxels);
        //}
        IM mesh = new IM();

        mesh.verts = verts;
        mesh.tris  = index;
        mesh.set   = container;
        return(mesh);
    }
    IEnumerator PlayEssay()
    {
        typingStatus.gameObject.SetActive(false);
        yield return(new WaitForSeconds(2.5f));

        while (chatLog.Count > 0)
        {
            curMessage = chatLog.Dequeue();
            if (curMessage.sender == readerName)
            {
                leadText.text = curMessage.content;
                while (!Input.GetKeyDown(KeyCode.Return))
                {
                    if (Input.anyKeyDown)
                    {
                        leadText.text = "";
                    }
                    yield return(null);
                }
                chatText.text    += "\n<color=red>" + curMessage.sender + "</color>: " + inputtedText.text;
                inputtedText.text = "";
                messageSent.Play();
            }
            else
            {
                yield return(TypingStatus(curMessage.typingTime));

                chatText.text += "\n<color=blue>" + curMessage.sender + "</color>: " + curMessage.content;
                messageReceived.Play();
            }
            yield return(new WaitForSeconds(curMessage.waitTime));
        }
        typingGame.StartGame();
    }
Exemple #8
0
        public MatrixBasedDependencyAnalysis(IEnumerable <WorkflowComponent> models)
        {
            ModelsList = models?.ToList() ?? throw new NullReferenceException();

            List <Data> data = models.GetAllData();

            //Model-Based Incidence Matrix
            IM = LibishMatrixCalculators.GetIncidenceMatrix(models.ToList(), data);
            // Model-Based DSM for model forward tracing
            DSM = CreateDSM(IM);
            // Model-Based transposed DSM for model backward tracing
            DSMT = DSM.Transpose();

            Models       = models.ToArray();
            ModelIndices = Models.Select((m, i) => new { m.Id, Index = i }).ToDictionary(m => m.Id, m => m.Index);

            // Variable-Based Incidence Matrix
            Matrix <double> VBIM = IM.Transpose();

            // Variable-Based DSM for data forward tracing
            VBDSM = CreateDSM(VBIM);
            // Variable-Based transposed DSM for data backward tracing
            VBDSMT = VBDSM.Transpose();

            DataIndices = LibishMatrixCalculators.GetDataIndices(data);
            var allData = data.ToDictionary(d => d.Id);

            Data = new Data[DataIndices.Count];
            foreach (KeyValuePair <string, int> kvp in DataIndices)
            {
                Data[kvp.Value] = allData[kvp.Key];
            }
        }
Exemple #9
0
        public static T NewEntity <T>()
            where T : class, IRepositoryEntity, IRepositoryCreatedEntity, new()
        {
            var entity = new T();

            entity.SetId(IM.AllocID(entity.GetTableName(), 1, -1));
            return(entity);
        }
Exemple #10
0
        public List <AdHocCommand> GetAdHocCommands()
        {
            var query    = Xml.Element("query", "http://jabber.org/protocol/disco#items").Attr("node", "http://jabber.org/protocol/commands");
            var response = IM.IqRequest(IqType.Get, IM.Hostname, IM.Jid, query);
            var commands = response.Data["query"].GetElementsByTagName("item").Cast <XmlElement>().Select(e => new AdHocCommand(e)).ToList();

            return(commands);
        }
Exemple #11
0
        public static void WriteToDb(Record record)
        {
            try
            {
                var logsRs = new IMRecordset(MD.SysLogs.TableName, IMRecordset.Mode.ReadWrite);
                using (var logsRsScope = logsRs.OpenForAdd(
                           MD.SysLogs.Fields.Id,
                           MD.SysLogs.Fields.Event,
                           MD.SysLogs.Fields.TableName,
                           MD.SysLogs.Fields.Count,
                           MD.SysLogs.Fields.Info,
                           MD.SysLogs.Fields.Who,
                           MD.SysLogs.Fields.When
                           ))
                {
                    var currentTime = DateTime.Now;
                    var currentUser = IM.ConnectedUser();

                    logsRs.AddNew(MD.SysLogs.TableName, MD.SysLogs.Fields.Id);
                    logsRs.Put(MD.SysLogs.Fields.Event, record.Type.ToString());
                    logsRs.Put(MD.SysLogs.Fields.TableName, MD.SysLogs.TableName);
                    logsRs.Put(MD.SysLogs.Fields.Count, 1);
                    logsRs.Put(MD.SysLogs.Fields.Info, $"{record.Process}: {record.Message}");
                    logsRs.Put(MD.SysLogs.Fields.Who, currentUser);
                    logsRs.Put(MD.SysLogs.Fields.When, currentTime);
                    logsRs.Update();

                    if (record.Duration > 0)
                    {
                        logsRs.AddNew(MD.SysLogs.TableName, MD.SysLogs.Fields.Id);
                        logsRs.Put(MD.SysLogs.Fields.Event, record.Type.ToString());
                        logsRs.Put(MD.SysLogs.Fields.TableName, MD.SysLogs.TableName);
                        logsRs.Put(MD.SysLogs.Fields.Count, 1);
                        logsRs.Put(MD.SysLogs.Fields.Info, $"{record.Process}: Duration {record.Duration}ms");
                        logsRs.Put(MD.SysLogs.Fields.Who, currentUser);
                        logsRs.Put(MD.SysLogs.Fields.When, currentTime);
                        logsRs.Update();
                    }

                    if (!string.IsNullOrEmpty(record.Data))
                    {
                        logsRs.AddNew(MD.SysLogs.TableName, MD.SysLogs.Fields.Id);
                        logsRs.Put(MD.SysLogs.Fields.Event, record.Type.ToString());
                        logsRs.Put(MD.SysLogs.Fields.TableName, MD.SysLogs.TableName);
                        logsRs.Put(MD.SysLogs.Fields.Count, 1);
                        logsRs.Put(MD.SysLogs.Fields.Info, $"{record.Process}: {record.Data}");
                        logsRs.Put(MD.SysLogs.Fields.Who, currentUser);
                        logsRs.Put(MD.SysLogs.Fields.When, currentTime);
                        logsRs.Update();
                    }
                }
            }
            catch (Exception e)
            {
                System.Windows.Forms.MessageBox.Show(e.ToString(), "Logger.WriteToDb", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
            }
        }
        public override int GetHashCode()
        {
            return(ID.GetHashCode() ^
                   RVK.GetHashCode() ^
                   D_PRIB.GetHashCode() ^

                   NA_UCHETE.GetHashCode() ^
                   SUD.GetHashCode() ^

                   GODN.GetHashCode() ^
                   P_PREDN.GetHashCode() ^
                   TDT.GetHashCode() ^
                   STAT.GetHashCode() ^
                   ZREN.GetHashCode() ^
                   ROST.GetHashCode() ^
                   MASSA.GetHashCode() ^
                   R_G_U.GetHashCode() ^
                   R_O_G.GetHashCode() ^
                   R_OB.GetHashCode() ^
                   IMEET_RAZR.GetHashCode() ^

                   KEM_VIDAN.GetHashCode() ^
                   D_PASPORT.GetHashCode() ^
                   FAM.GetHashCode() ^
                   IM.GetHashCode() ^
                   OTCH.GetHashCode() ^
                   D_ROD.GetHashCode() ^
                   M_ROD.GetHashCode() ^
                   S_PASPORT.GetHashCode() ^
                   N_PASPORT.GetHashCode() ^
                   BRAK.GetHashCode() ^
                   IMEET_REB.GetHashCode() ^

                   LN_SER.GetHashCode() ^
                   LN_NUM.GetHashCode() ^
                   S_V_BIL.GetHashCode() ^
                   N_V_BIL.GetHashCode() ^
                   F_DOP.GetHashCode() ^
                   N_DOP.GetHashCode() ^
                   D_DOP.GetHashCode() ^
                   PROF_P.GetHashCode() ^
                   NPU.GetHashCode() ^
                   OPS.GetHashCode() ^
                   REZH_KOM.GetHashCode() ^

                   OBRAZOV.GetHashCode() ^
                   DO_PRIZ.GetHashCode() ^

                   ODIN_ROD.GetHashCode() ^
                   BEZ_ROD.GetHashCode() ^

                   S_VA.GetHashCode() ^
                   N_VA.GetHashCode() ^
                   SPEC.GetHashCode());
        }
Exemple #13
0
 public void Server_OnReciveMessage(IM.Core.Message Message)
 {
     if (Message.MsgType == Core.MessageType.SetID)
     {
         this.richTextBox1.AppendText(Message.Sender + "上线\n");
     }
     else
     {
         this.richTextBox1.AppendText(Message.Sender+":"+Message.Content + "\n");
     }
     
 }
Exemple #14
0
        public void Recive(string name, byte[] encryptedMessage, byte[] signature)
        {
            ChatUser Reciver      = ChatingUsers.Find(x => x.ChatUserName == Context.User.Identity.Name);
            string   ChatRoomName = Reciver.ChatRoomName;
            String   Message      = IM.OTRReceive(Reciver.CurrentDeriveKey, encryptedMessage);

            if (MAC.Verify(Reciver.KeyForSigning, signature))
            {
                NewsDeriveKey(ChatRoomName);
                Clients.Group(ChatRoomName).showMessage(name, Message + " EM: " + System.Text.Encoding.Default.GetString(encryptedMessage));
            }
        }
Exemple #15
0
    public override void OnInspectorGUI()
    {
        IM t = (IM)target;

        showSpawnTable = EditorGUILayout.Foldout(showSpawnTable, "Spawn Table");

        if (showSpawnTable)
        {
            EditorGUI.indentLevel = 1;

            if (t.SpawnTypes.Length != names.Length)
            {
                IM.InstanceData[] temp = new IM.InstanceData[names.Length];

                if (names.Length > t.SpawnTypes.Length)
                {
                    for (int i = 0; i < t.SpawnTypes.Length; ++i)
                    {
                        temp[i] = t.SpawnTypes[i];
                    }
                }
                else
                {
                    for (int i = 0; i < names.Length; ++i)
                    {
                        temp[i] = t.SpawnTypes[i];
                    }
                }

                t.SpawnTypes = temp;
            }

            for (int i = 0; i < names.Length; ++i)
            {
                EditorGUILayout.BeginHorizontal();
                EditorGUIUtility.labelWidth = 192;
                t.SpawnTypes[i].Instance    = (GameObject)EditorGUILayout.ObjectField(names[i], t.SpawnTypes[i].Instance, typeof(GameObject), true);
                t.SpawnTypes[i].maxCount    = EditorGUILayout.IntField(t.SpawnTypes[i].maxCount, GUILayout.Width(48));

                serializedObject.Update();
                ArrayGUI(serializedObject.FindProperty("SpawnTypes").GetArrayElementAtIndex(i).FindPropertyRelative("sounds"), ref showSounds[i]);
                serializedObject.ApplyModifiedProperties();

                EditorGUILayout.EndHorizontal();
            }
            EditorGUI.indentLevel = 0;
        }

        EditorUtility.SetDirty(t);

        DrawDefaultInspector();
    }
Exemple #16
0
        private static void MetaTagPatch(ItemSpawnerID ID)
        {
            //If this IDs items didn't get added, add it to the firearm page
            if (IM.Instance.PageItemLists.ContainsKey(ItemSpawnerV2.PageMode.Firearms))
            {
                if (!IM.Instance.PageItemLists.Any(o => o.Value.Contains(ID.ItemID)) && IM.OD.ContainsKey(ID.MainObject.ItemID) && IM.OD[ID.MainObject.ItemID].IsModContent)
                {
                    OtherLogger.Log("Adding misc mod item to meta tag system: " + ID.ItemID, OtherLogger.LogType.Loading);

                    IM.AddMetaTag(ID.Category.ToString(), TagType.Category, ID.ItemID, ItemSpawnerV2.PageMode.Firearms);
                    IM.AddMetaTag(ID.SubCategory.ToString(), TagType.SubCategory, ID.ItemID, ItemSpawnerV2.PageMode.Firearms);
                }
            }
        }
Exemple #17
0
        public void Send(string message)
        {
            ChatUser sender       = ChatingUsers.Find(x => x.ChatUserName == Context.User.Identity.Name);
            string   chatRoomName = sender.ChatRoomName;
            string   name         = sender.DisplayUserName;
            ChatUser reciver      = ChatingUsers.Find(x => x.ChatUserName != Context.User.Identity.Name && x.ChatRoomName == chatRoomName);

            if (sender.CurrentDeriveKey != null)
            {
                IM.OTRSend(sender.CurrentDeriveKey, message, out byte[] encryptedMessage);
                byte[] signature = MAC.Sign(sender.KeyForSigning, message);
                Clients.User(reciver.ChatUserName).reciveMessage(name, encryptedMessage, signature, chatRoomName);
            }
        }
Exemple #18
0
        public void DeleteUser(Jid userId)
        {
            // declare namespaces
            XNamespace commandNamespace = "http://jabber.org/protocol/commands";
            XNamespace xNamespace       = "jabber:x:data";

            // request to delete a user
            var command1 = new XElement(commandNamespace + "command",
                                        new XAttribute("action", "execute"),
                                        new XAttribute("node", "http://jabber.org/protocol/admin#delete-user"));

            var response1 = IM.IqRequest(IqType.Set, IM.Hostname, IM.Jid, command1.ToXmlElement());

            response1.ThrowIfError();

            // delete user
            var sessionId = response1.Data["command"].Attributes["sessionid"].Value;
            var command2  = new XElement(commandNamespace + "command",
                                         new XAttribute("node", "http://jabber.org/protocol/admin#delete-user"),
                                         new XAttribute("sessionid", sessionId),
                                         new XElement(xNamespace + "x",
                                                      new XAttribute("type", "submit"),
                                                      new XElement(xNamespace + "field",
                                                                   new XAttribute("type", "hidden"),
                                                                   new XAttribute("var", "FORM_TYPE"),
                                                                   new XElement(xNamespace + "value", "http://jabber.org/protocol/admin")),
                                                      new XElement(xNamespace + "field",
                                                                   new XAttribute("var", "accountjids"),
                                                                   new XElement(xNamespace + "value", userId))));

            var response2 = IM.IqRequest(IqType.Set, IM.Hostname, IM.Jid, command2.ToXmlElement());

            response2.ThrowIfError();

            // validate response
            var noteElement = response2.ToXDocument().Root.Element(commandNamespace + "command").Element(commandNamespace + "note");
            var noteText    = noteElement == null ? null : noteElement.Value;

            if (noteText != null)
            {
                // todo: this is weak but no other way to identify
                if (noteText.StartsWith("The following accounts could not be deleted:"))
                {
                    throw new Exception("The user could not be deleted");
                }
            }
        }
        public static bool AddUncategorizedSubCategory(IM __instance)
        {
            ItemSpawnerCategoryDefinitions.SubCategory subcat = new ItemSpawnerCategoryDefinitions.SubCategory
            {
                Subcat              = ItemSpawnerID.ESubCategory.None,
                DisplayName         = "UNCATEGORIZED",
                DoesDisplay_Sandbox = true,
                DoesDisplay_Unlocks = true,
                Sprite              = null
            };

            List <ItemSpawnerCategoryDefinitions.SubCategory> subcats = __instance.CatDefs.Categories[6].Subcats.ToList();

            subcats.Add(subcat);
            __instance.CatDefs.Categories[6].Subcats = subcats.ToArray();

            return(true);
        }
Exemple #20
0
        private static SDR.MeasTask PreparedMeasTaskInfo(DM.Allotment allotment, DM.FreqPlanChan[] freqPlanChans)
        {
            var measTask = new SDR.MeasTask()
            {
                Name              = allotment.CustText1,
                ExecutionMode     = SDR.MeasTaskExecutionMode.Automatic,
                Task              = SDR.MeasTaskType.Scan,
                DateCreated       = DateTime.Now,
                CreatedBy         = IM.ConnectedUser(),
                Stations          = PreparedStations(allotment),
                MeasDtParam       = PreparedDetectedParam(allotment),
                MeasFreqParam     = PreparedFreqParam(allotment, freqPlanChans),
                MeasOther         = PreparedOther(allotment),
                MeasTimeParamList = PreparedTimeParamList(allotment)
            };

            return(measTask);
        }
Exemple #21
0
    void ReadInputs()
    {
        if (IM.Pressed(Inputs.Left))
        {
            MsgAll(new EventMsg(Inputs.Left));
        }
        else if (IM.Pressed(Inputs.Right))
        {
            MsgAll(new EventMsg(Inputs.Right));
        }
        else if (IM.Pressed(Inputs.Up))
        {
            MsgAll(new EventMsg(Inputs.Up));
        }
        else if (IM.Pressed(Inputs.Down))
        {
            MsgAll(new EventMsg(Inputs.Down));
        }

        if (Input.GetKeyUp(KeyCode.S))
        {
            ModelManager.SaveGame();
        }
        if (Input.GetKeyUp(KeyCode.L))
        {
            ModelManager.PendingSave = ModelManager.LoadGame();
            if (ModelManager.PendingSave != null)
            {
                SceneManager.LoadScene(0);
            }
            else
            {
                Debug.Log("NO FILE TO LOAD");
            }
        }
        if (Input.GetKeyUp(KeyCode.D))
        {
            ModelManager.DeleteSave();
        }
        if (Input.GetKeyUp(KeyCode.Space))
        {
            StartCoroutine(ModelManager.CaptureScreenshot("X"));
        }
    }
Exemple #22
0
        /// <summary>
        /// Fetch a page of archived messages
        /// </summary>
        /// <param name="pageRequest">Paging options</param>
        /// <param name="with">Optional filter to only return messages if they match the supplied JID</param>
        /// <param name="roomId">Optional filter to only return messages if they match the supplied JID</param>
        /// <param name="start">Optional filter to only return messages whose timestamp is equal to or later than the given timestamp.</param>
        /// <param name="end">Optional filter to only return messages whose timestamp is equal to or earlier than the timestamp given in the 'end' field.</param>
        internal Task <XmppPage <Message> > GetArchivedMessages(XmppPageRequest pageRequest, Jid with = null, Jid roomId = null, DateTimeOffset?start = null, DateTimeOffset?end = null)
        {
            string queryId = Guid.NewGuid().ToString().Replace("-", "");

            var request = Xml.Element("query", xmlns)
                          .Attr("queryid", queryId)
                          .Child(pageRequest.ToXmlElement());

            if (with != null || start != null || end != null)
            {
                var filterForm = new SubmitForm();

                filterForm.AddValue("FORM_TYPE", DataFieldType.Hidden, xmlns);

                if (with != null)
                {
                    filterForm.AddUntypedValue("with", with);
                }

                if (start != null)
                {
                    filterForm.AddUntypedValue("start", DateTimeProfiles.ToXmppDateTimeString(start.Value));
                }

                if (end != null)
                {
                    filterForm.AddUntypedValue("end", DateTimeProfiles.ToXmppDateTimeString(end.Value));
                }

                request.Child(filterForm.ToXmlElement());
            }

            var tcs       = new TaskCompletionSource <XmppPage <Message> >();
            var queryTask = pendingQueries[queryId] = new ArchiveQueryTask(tcs);

            var response = IM.IqRequest(Sharp.Xmpp.Core.IqType.Set, roomId, null, request);

            if (response.Type == Core.IqType.Error)
            {
                queryTask.SetException(Util.ExceptionFromError(response, "Failed to get archived messages"));
            }

            return(tcs.Task);
        }
        private static SDR.MeasTask PreparedMeasTaskInfo(DM.Tour tour, DM.Inspection[] inspections)
        {
            var measTask = new SDR.MeasTask()
            {
                Name              = tour.MeasTaskName,
                ExecutionMode     = SDR.MeasTaskExecutionMode.Manual,
                DateCreated       = DateTime.Now,
                CreatedBy         = IM.ConnectedUser(),
                MeasDtParam       = PreparedDetectedParam(tour),
                MeasTimeParamList = new SDR.MeasTimeParamList()
                {
                    PerStart = tour.StartDate, PerStop = tour.StopDate
                },
                Stations = PreparedStations(tour), // new SDR.MeasStation[] { } ,
                StationsForMeasurements = PreparedStationDataForMeasurements(tour, inspections),
            };

            return(measTask);
        }
Exemple #24
0
    /// <summary>
    /// 使用系统账号向其它用户发送信息
    /// </summary>
    /// <param name="subject">信息主题</param>
    /// <param name="content">信息内容</param>
    ///<param name="recvUsername">发送者的ID号</param>
    /// <returns>返回0, 发送失败;返回1, 发送成功</returns>
    public static int SendMessage(string subject, string content, string recvUsername)
    {
        int res = 0;
        IM im = new IM();
        im.IMServer = server;
        im.ContentType = "Text/Html";
        try
        {
            im.Port = Int32.Parse(port);
        }
        catch (Exception ex)
        {
            return res;
        }

        im.Init(server, username, password);
        res = im.SendMsg(subject, content, recvUsername, 0);
        return res;
    }
Exemple #25
0
        public static int GetCurrentUserId()
        {
            var    result   = IM.NullI;
            string userName = IM.ConnectedUser();

            var employeeRs = new IMRecordset(Employee.TableName, IMRecordset.Mode.ReadOnly);

            employeeRs.Select(Employee.Fields.Id);
            employeeRs.SetWhere(Employee.Fields.AppUser, IMRecordset.Operation.Eq, userName);

            using (employeeRs.OpenWithScope())
            {
                if (!employeeRs.IsEOF())
                {
                    result = employeeRs.GetI(Employee.Fields.Id);
                }
            }

            return(result);
        }
Exemple #26
0
        public void InviteUserToMuc(Jid mucService, string roomName, Jid userId, string reason = null, string password = null)
        {
            mucService.ThrowIfNull();
            roomName.ThrowIfNull();
            userId.ThrowIfNull();

            XmlElement inviteNode = Xml.Element("x", xmlns).Attr("jid", roomName + "@" + mucService.ToString());

            if (!string.IsNullOrEmpty(reason))
            {
                inviteNode.Attr("reason", reason);
            }

            if (!string.IsNullOrEmpty(password))
            {
                inviteNode.Attr("password", password);
            }

            IM.SendMessage(new Im.Message(new Message(userId, IM.Jid, inviteNode)));
        }
Exemple #27
0
 /// <summary>
 /// 初始化数据
 /// </summary>
 /// <param name="key"></param>
 /// <param name="secret"></param>
 /// <remarks></remarks>
 private void InitialIM(string key, string secret)
 {
     im = new IM(this.Client.SessionID, key, secret);
     if (System.String.IsNullOrEmpty(im.Token) == true)
     {
         string tokenuser = Client.Session["UserID"].ToString();
         if (System.String.IsNullOrEmpty(tokenuser) == false)
         {
             //在融云用户初始化,如若报“toke失效”请去融云中查看token是否有效
             im.InitialToken(tokenuser, tokenuser, "");
         }
         else
         {
             MessageBox.Show("TokenUser Not Be NullOrEmpty!");
         }
     }
     else
     {
         im.InitialToken();
     }
 }
Exemple #28
0
        /// <summary>
        /// Fetch a page of archived messages from a chat
        /// </summary>
        /// <param name="pageRequest">Paging options</param>
        /// <param name="with">The id of the entity that the chat was with</param>
        /// <param name="start">The start time of the chat</param>
        public ArchivedChatPage GetArchivedChat(XmppPageRequest pageRequest, Jid with, DateTimeOffset start)
        {
            pageRequest.ThrowIfNull();
            with.ThrowIfNull();

            var request = Xml.Element("retrieve", xmlns);

            request.Attr("with", with.ToString());
            request.Attr("start", start.ToXmppDateTimeString());

            var setNode = pageRequest.ToXmlElement();

            request.Child(setNode);

            var response = IM.IqRequest(IqType.Get, null, null, request);

            if (response.Type == IqType.Error)
            {
                throw Util.ExceptionFromError(response, "Failed to get archived chat messages");
            }

            return(new ArchivedChatPage(response.Data["chat"]));
        }
Exemple #29
0
        private static bool SpawnItemRelated(ItemSpawnerV2 __instance, int i)
        {
            //If the selected item has a spawner entry, use that
            if (OtherLoader.SpawnerEntriesByID.ContainsKey(__instance.m_selectedID))
            {
                __instance.Boop(1);

                ItemSpawnerData data = __instance.GetComponent <ItemSpawnerData>();
                AnvilManager.Run(SpawnItems(__instance, data.VisibleSecondaryEntries[i]));
            }

            //Otherwise try to use legacy spawner ID
            else if (IM.HasSpawnedID(__instance.m_selectedID))
            {
                return(true);
            }

            else
            {
                __instance.Boop(2);
            }

            return(false);
        }
Exemple #30
0
        private void RegisterItemIntoMetaTagSystem(FVRObject mainObject, ItemSpawnerV2.PageMode page)
        {
            if (mainObject.Category == FVRObject.ObjectCategory.Firearm)
            {
                IM.AddMetaTag(mainObject.TagSet.ToString(), TagType.Set, mainObject.ItemID, page);
                IM.AddMetaTag(mainObject.TagEra.ToString(), TagType.Era, mainObject.ItemID, page);
                IM.AddMetaTag(mainObject.TagFirearmSize.ToString(), TagType.Size, mainObject.ItemID, page);
                IM.AddMetaTag(mainObject.TagFirearmAction.ToString(), TagType.Action, mainObject.ItemID, page);
                IM.AddMetaTag(mainObject.TagFirearmRoundPower.ToString(), TagType.RoundClass, mainObject.ItemID, page);
                IM.AddMetaTag(mainObject.TagFirearmCountryOfOrigin.ToString(), TagType.CountryOfOrigin, mainObject.ItemID, page);
                IM.AddMetaTag(mainObject.TagFirearmFirstYear.ToString(), TagType.IntroductionYear, mainObject.ItemID, page);
                IM.AddMetaTag(mainObject.MagazineType.ToString(), TagType.MagazineType, mainObject.ItemID, page);

                if (mainObject.UsesRoundTypeFlag)
                {
                    IM.AddMetaTag(mainObject.RoundType.ToString(), TagType.Caliber, mainObject.ItemID, page);
                }

                mainObject.TagFirearmFiringModes.ForEach(tag =>
                                                         IM.AddMetaTag(tag.ToString(), TagType.FiringMode, mainObject.ItemID, page));

                mainObject.TagFirearmFeedOption.ForEach(tag =>
                                                        IM.AddMetaTag(tag.ToString(), TagType.FeedOption, mainObject.ItemID, page));

                mainObject.TagFirearmMounts.ForEach(mode =>
                                                    IM.AddMetaTag(mode.ToString(), TagType.AttachmentMount, mainObject.ItemID, page));
            }

            else if (mainObject.Category == FVRObject.ObjectCategory.Attachment)
            {
                IM.AddMetaTag(mainObject.TagSet.ToString(), TagType.Set, mainObject.ItemID, page);
                IM.AddMetaTag(mainObject.TagEra.ToString(), TagType.Era, mainObject.ItemID, page);
                IM.AddMetaTag(mainObject.TagAttachmentFeature.ToString(), TagType.AttachmentFeature, mainObject.ItemID, page);
                IM.AddMetaTag(mainObject.TagAttachmentMount.ToString(), TagType.AttachmentMount, mainObject.ItemID, page);
            }
        }
Exemple #31
0
        public void Update()
        {
            if (Helpers.BepInExGetKeyDown(_shortcutPrintLayerAndTagsInfo.Value))
            {
                string LayerNames = "Layers:";
                for (int i = 0; i < 32; i++)
                {
                    LayerNames += $"\n{i} - {LayerMask.LayerToName(i)}";
                }
                Debug.Log(LayerNames);

                string LayerCollisions = "Layer Collisions: (+ for ignoring)\n";
                LayerCollisions += "   |  0|  1|  2|  3|  4|  5|  6|  7|  8|  9| 10| 11| 12| 13| 14| 15| 16| 17| 18| 19| 20| 21| 22| 23| 24| 25| 26| 27| 28| 29| 30| 31|";
                for (int i = 0; i < 32; i++)
                {
                    LayerCollisions += $"\n{i,3}|";
                    for (int j = 0; j < 32; j++)
                    {
                        LayerCollisions += !Physics.GetIgnoreLayerCollision(2 ^ i, 2 ^ j) ? " + |" : "   |";
                    }
                }
                Debug.Log(LayerCollisions);
            }
            else if (Helpers.BepInExGetKeyDown(_shortcutPrintAllStreamingAssetsBundles.Value))
            {
                string ootpoot = "";

                foreach (string assBundle in System.IO.Directory.GetFiles(Application.streamingAssetsPath))
                {
                    if (!assBundle.Contains("."))
                    {
                        AssetBundle asset = AnvilManager.GetBundleAsync(System.IO.Path.GetFileName(assBundle)).Result;
                        if (asset != null)
                        {
                            string[] names = System.IO.Path.GetFileName(assBundle).Split(new[] { "_" }, StringSplitOptions.None);
                            string   name  = names[names.Length - 1];
                            ootpoot += $"{name}: {string.Join($"\n{name}: ", asset.GetAllAssetNames())}\n\n\n";
                        }
                    }
                }

                foreach (System.Collections.Generic.KeyValuePair <string, ItemSpawnerID> kvp in (System.Collections.Generic.Dictionary <string, ItemSpawnerID>)AccessTools.Field(typeof(IM), "SpawnerIDDic").GetValue(ManagerSingleton <IM> .Instance))
                {
                    ootpoot += $"{kvp.Key} - {kvp.Value}\n";
                }

                Debug.Log(ootpoot);
            }

            else if (Helpers.BepInExGetKeyDown(_shortcutTelePlayerToReset.Value))
            {
                GM.CurrentMovementManager.TeleportToPoint(GM.CurrentSceneSettings.DeathResetPoint.position, true);
            }
            else if (Helpers.BepInExGetKeyDown(_shortcutTelePlayer2mForward.Value))
            {
                GM.CurrentMovementManager.TeleportToPoint(GM.CurrentPlayerRoot.position + (GM.CurrentPlayerBody.Head.forward * 2.0f), true);
            }
            else if (Helpers.BepInExGetKeyDown(_shortcutTelePlayerToOrigin.Value))
            {
                GM.CurrentMovementManager.TeleportToPoint(Vector3.zero, true);
            }

            else if (Helpers.BepInExGetKeyDown(_shortcutSpawnModPanelV2.Value))
            {
                ItemSpawnerID id = IM.GetSpawnerID("MiscUtModPanelV2");
                if (id != null)
                {
                    GameObject panel = Instantiate(id.MainObject.GetGameObject(), new Vector3(0f, .25f, 0f) + GM.CurrentPlayerRoot.position, Quaternion.identity);
                    if (GM.CurrentPlayerBody.QuickbeltSlots.Count > 0)
                    {
                        foreach (FVRQuickBeltSlot qbSlot in GM.CurrentPlayerBody.QuickbeltSlots)
                        {
                            if (qbSlot.HeldObject == null && qbSlot.CurObject == null)
                            {
                                panel.GetComponent <FVRPhysicalObject>().SetQuickBeltSlot(qbSlot);
                                break;
                            }
                        }
                    }
                }
                else
                {
                    Logger.LogError("ModPanelV2 was null?");
                }
            }
            else if (Helpers.BepInExGetKeyDown(_shortcutScrambleMaterials.Value))
            {
                foreach (Renderer mr in UnityEngine.Object.FindObjectsOfType(typeof(UnityEngine.Renderer)))
                {
                    mr.material = (Resources.FindObjectsOfTypeAll(typeof(Material))[UnityEngine.Random.Range(0, Resources.FindObjectsOfTypeAll(typeof(Material)).Length)] as Material);
                }
            }
            else if (Helpers.BepInExGetKeyDown(_shortcutScrambleMeshes.Value))
            {
                foreach (MeshFilter mf in UnityEngine.Object.FindObjectsOfType(typeof(UnityEngine.MeshFilter)))
                {
                    mf.mesh = (Resources.FindObjectsOfTypeAll(typeof(Mesh))[UnityEngine.Random.Range(0, Resources.FindObjectsOfTypeAll(typeof(Mesh)).Length)] as Mesh);
                }
            }
        }
Exemple #32
0
        //args0 - filepath
        //args1 - resolution
        //args2 - xaxis
        //args3 - yaxis
        //args4 - zaxis
        //args5 - isoLevel
        public static void Main(string[] args)
        {
            DebugLog.resetLog();
            DebugLog.setDebug(true);
            int   resolution;
            float isoLevel;

            #region cmd args handling
            if (args.Length > 6 || args.Length < 1)
            {
                Console.Out.WriteLine(numArgs);
                Console.In.ReadLine();
                return;
            }
            if (args.Length == 1 && (args[0].ToLower() == "--help" || args[0].ToLower() == "help" || args[0].ToLower() == "?" || args[0].ToLower() == "h"))
            {
                Console.Out.WriteLine(help);
                Console.In.ReadLine();
                return;
            }

            if (!File.Exists(args[0]))
            {
                DebugLog.logConsole("Could not find file. Are you sure you are passing in the right string?");
                throw new Exception("Could not find file. Are you sure you are passing in the right string?");
            }
            try
            {
                resolution = Int32.Parse(args[1]);
            }
            catch
            {
                DebugLog.logConsole("Resolution not a number");
                throw new Exception("Resolution not a number");
            }
            try
            {
                isoLevel = float.Parse(args[5]);
            }
            catch
            {
                DebugLog.logConsole("IsoLevel is not a float");
                throw new Exception("IsoLevel is not a float");
            }
            if (resolution < 1)
            {
                DebugLog.logConsole("Resolution cannot be less than 1");
                throw new Exception("Resolution cannot be less than 1");
            }
            #endregion
            SingularMesh mcAlg       = new SingularMesh();
            string       dir         = Directory.GetParent(Directory.GetParent(Directory.GetParent(args[0]).FullName).FullName).Name;
            List <float> minMaxArray = generateMinMaxArray(new string[] { args[2], args[3], args[4] }, dir);


            VoxelArray array = mcAlg.createPointCloud(args[0], resolution, args[2], args[3], args[4], minMaxArray.ToArray());
            //VoxelArray.WriteFloatArray(mcAlg.outputPath + ".FARA", array);
            MarchingCubes test = new MarchingCubes();
            test.SetTarget(isoLevel);
            IM intermediate = test.CreateMesh(array.toFloatArray());
            if (intermediate.verts.Count > 64999)
            {
                IM[] divs = intermediate.divideIntoSmall();
                for (int i = 0; i < divs.Length; i++)
                {
                    divs[i].WriteIntermediateToFile(mcAlg.outputPath + "_" + i + ".IMF");
                }
            }
            else
            {
                intermediate.WriteIntermediateToFile(mcAlg.outputPath + ".IMF");
            }
        }
 internal void PopulateIMType(IMTypes types)
 {
     foreach(IM im in currentContact.GetInstantMessageAccounts())
        {
     if( types != IMTypes.preferred )
     {
      if( (im.Types & IMTypes.preferred) ==
        IMTypes.preferred)
      {
       continue;
      }
     }
     if( (im.Types & types) != types)
     {
      continue;
     }
     if(imOne == null)
     {
      imOne = im;
      IMOneEntry.Text = im.Address;
      SetIMTypeMenu(IMOneLocOptionMenu, im.Types);
      SetIMTypeProvider(IMOneOptionMenu, im.Provider);
     }
     else if(imTwo == null)
     {
      imTwo = im;
      IMTwoEntry.Text = im.Address;
      SetIMTypeMenu(IMTwoLocOptionMenu, im.Types);
      SetIMTypeProvider(IMTwoOptionMenu, im.Provider);
     }
     else if(imThree == null)
     {
      imThree = im;
      IMThreeEntry.Text = im.Address;
      SetIMTypeMenu(IMThreeLocOptionMenu, im.Types);
      SetIMTypeProvider(IMThreeOptionMenu, im.Provider);
     }
        }
 }
 internal void SaveIMInfo()
 {
     if(IMOneEntry.Text.Length > 0)
        {
     IMTypes selType = GetIMType(IMOneLocOptionMenu);
     string selProvider = GetIMProvider(IMOneOptionMenu);
     if(imOne == null)
     {
      imOne = new IM( IMOneEntry.Text, selProvider,
       (selType | IMTypes.preferred));
      currentContact.AddInstantMessage(imOne);
     }
     else
     {
      imOne.Types = (selType | IMTypes.preferred);
      imOne.Address = IMOneEntry.Text;
      imOne.Provider = selProvider;
     }
        }
        else
        {
     if(imOne != null)
     {
      imOne.Delete();
     }
        }
        if(IMTwoEntry.Text.Length > 0)
        {
     IMTypes selType = GetIMType(IMTwoLocOptionMenu);
     string selProvider = GetIMProvider(IMTwoOptionMenu);
     if(imTwo == null)
     {
      imTwo = new IM(IMTwoEntry.Text,
        selProvider, selType);
      currentContact.AddInstantMessage(imTwo);
     }
     else
     {
      imTwo.Types = selType;
      imTwo.Address = IMTwoEntry.Text;
      imTwo.Provider = selProvider;
     }
        }
        else
        {
     if(imTwo != null)
     {
      imTwo.Delete();
     }
        }
        if(IMThreeEntry.Text.Length > 0)
        {
     IMTypes selType = GetIMType(IMThreeLocOptionMenu);
     string selProvider = GetIMProvider(IMThreeOptionMenu);
     if(imThree == null)
     {
      imThree = new IM(IMThreeEntry.Text,
        selProvider, selType);
      currentContact.AddInstantMessage(imThree);
     }
     else
     {
      imThree.Types = selType;
      imThree.Address = IMThreeEntry.Text;
      imThree.Provider = selProvider;
     }
        }
        else
        {
     if(imThree != null)
     {
      imThree.Delete();
     }
        }
 }
 public OverlayGui(IM.Overlay overlay)
 {
     _overlay = overlay;
 }
 public BitmapTextGui(IM.BitmapText bitmapText)
     : base(bitmapText)
 {
     _imBitmapText = bitmapText;
 }
 public void setBaseTexture(IM.BaseTexture baseTexture)
 {
     _baseTexture = baseTexture.cloneBaseTexture();
 }
Exemple #38
0
 public ZiaFacade(IM.DAL.IDSDBDataContext database)
     : base(database)
 {
 }
Exemple #39
0
 public SimpleNotaEditorEvent(IM.Entidades.NotaSimple SimpleNoticia, IM.SimpleNoticia.Editor.MVC.TipoDAO tipoDAO)
 {
     this.SimpleNoticia = SimpleNoticia;
     this.TipoDAO = tipoDAO;
 }
 public BitmapMonoDecalGui(IM.BitmapMonoDecal bitmapMonoDecal)
     : base(bitmapMonoDecal)
 {
     _imBitmapMonoDecal = bitmapMonoDecal;
     _textures = null;
 }
 private void LoadAddresses()
 {
     try
        {
     int n = 1;
     foreach(Email tmpMail in contact.GetEmailAddresses())
     {
      DomainUpDown emailLabel;
      if (tmpMail.Preferred)
      {
       eMail1 = tmpMail;
       email1.DataBindings.Add("Text", eMail1, "Address");
       emailLabel = emailLabel1;
      }
      else
      {
       switch (n)
       {
        case 1:
     eMail2 = tmpMail;
     email2.DataBindings.Add("Text", eMail2, "Address");
     emailLabel = emailLabel2;
     break;
        case 2:
     eMail3 = tmpMail;
     email3.DataBindings.Add("Text", eMail3, "Address");
     emailLabel = emailLabel3;
     break;
        default:
     eMail4 = tmpMail;
     email4.DataBindings.Add("Text", eMail4, "Address");
     emailLabel = emailLabel4;
     break;
       }
       n++;
      }
      if ((tmpMail.Types & EmailTypes.work) == EmailTypes.work)
      {
       emailLabel.SelectedIndex = 0;
      }
      else if ((tmpMail.Types & EmailTypes.personal) == EmailTypes.personal)
      {
       emailLabel.SelectedIndex = 1;
      }
      else if ((tmpMail.Types & EmailTypes.other) == EmailTypes.other)
      {
       emailLabel.SelectedIndex = 2;
      }
     }
        }
        catch (SimiasException e)
        {
     e.LogError();
     MessageBox.Show("An error occurred while reading email addresses.  Please see the log file for additional information.", "Email Address Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
        }
        catch (Exception e)
        {
     logger.Debug(e, "Reading email addresses");
     MessageBox.Show("An error occurred while reading email addresses.  Please see the log file for additional information.", "Email Address Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
        }
        try
        {
     int n = 1;
     foreach(Telephone tmpPhone in contact.GetTelephoneNumbers())
     {
      DomainUpDown phoneLabel;
      if (tmpPhone.Preferred)
      {
       telephone1 = tmpPhone;
       phone1.DataBindings.Add("Text", telephone1, "Number");
       phoneLabel = phoneLabel1;
      }
      else
      {
       switch (n)
       {
        case 1:
     telephone2 = tmpPhone;
     phone2.DataBindings.Add("Text", telephone2, "Number");
     phoneLabel = phoneLabel2;
     break;
        case 2:
     telephone3 = tmpPhone;
     phone3.DataBindings.Add("Text", telephone3, "Number");
     phoneLabel = phoneLabel3;
     break;
        default:
     telephone4 = tmpPhone;
     phone4.DataBindings.Add("Text", telephone4, "Number");
     phoneLabel = phoneLabel4;
     break;
       }
       n++;
      }
      if ((tmpPhone.Types & (PhoneTypes.work | PhoneTypes.voice)) == (PhoneTypes.work | PhoneTypes.voice))
      {
       phoneLabel.SelectedIndex = 0;
      }
      else if ((tmpPhone.Types & (PhoneTypes.work | PhoneTypes.fax)) == (PhoneTypes.work | PhoneTypes.fax))
      {
       phoneLabel.SelectedIndex = 1;
      }
      else if ((tmpPhone.Types & (PhoneTypes.home | PhoneTypes.voice)) == (PhoneTypes.home | PhoneTypes.voice))
      {
       phoneLabel.SelectedIndex = 2;
      }
      else if ((tmpPhone.Types & PhoneTypes.cell) == PhoneTypes.cell)
      {
       phoneLabel.SelectedIndex = 3;
      }
      else if ((tmpPhone.Types & PhoneTypes.pager) == PhoneTypes.pager)
      {
       phoneLabel.SelectedIndex = 4;
      }
     }
        }
        catch (SimiasException e)
        {
     e.LogError();
     MessageBox.Show("An error occurred while reading telephone numbers.  Please see the log file for additional information.", "Telephone Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
        }
        catch (Exception e)
        {
     logger.Debug(e, "Reading telephone numbers");
     MessageBox.Show("An error occurred while reading telephone numbers.  Please see the log file for additional information.", "Telephone Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
        }
        try
        {
     int n = 1;
     foreach (IM im in contact.GetInstantMessageAccounts())
     {
      DomainUpDown imLocation;
      if (im.Preferred)
      {
       iM1 = im;
       im1.DataBindings.Add("Text", iM1, "Address");
       imLocation = im1Location;
       imLabel1.DataBindings.Add("Text", iM1, "Provider");
      }
      else
      {
       switch (n)
       {
        case 1:
     iM2 = im;
     im2.DataBindings.Add("Text", iM2, "Address");
     imLocation = im2Location;
     imLabel2.DataBindings.Add("Text", iM2, "Provider");
     break;
        default:
     iM3 = im;
     im3.DataBindings.Add("Text", iM3, "Address");
     imLocation = im3Location;
     imLabel3.DataBindings.Add("Text", iM3, "Provider");
     break;
       }
       n++;
      }
      if ((im.Types & IMTypes.work) == IMTypes.work)
      {
       imLocation.SelectedIndex = 0;
      }
      else if ((im.Types & IMTypes.home) == IMTypes.home)
      {
       imLocation.SelectedIndex = 1;
      }
      else if ((im.Types & IMTypes.other) == IMTypes.other)
      {
       imLocation.SelectedIndex = 2;
      }
     }
        }
        catch (SimiasException e)
        {
     e.LogError();
     MessageBox.Show("An error occurred while reading IM addresses.  Please see the log file for additional information.", "IM Address Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
        }
        catch (Exception e)
        {
     logger.Debug(e, "Reading IM addresses");
     MessageBox.Show("An error occurred while reading IM addresses.  Please see the log file for additional information.", "IM Address Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
        }
        try
        {
     foreach(Address addr in contact.GetAddresses())
     {
      if((addr.Types & AddressTypes.work) == AddressTypes.work)
      {
       if (workAddress == null)
       {
        workAddress = addr;
        workStreet.DataBindings.Add("Text", workAddress, "Street");
        workAddress2.DataBindings.Add("Text", workAddress, "ExtendedAddress");
        workCity.DataBindings.Add("Text", workAddress, "Locality");
        workState.DataBindings.Add("Text", workAddress, "Region");
        workZip.DataBindings.Add("Text", workAddress, "PostalCode");
        workCountry.DataBindings.Add("Text", workAddress, "Country");
       }
      }
      else if((addr.Types & AddressTypes.home) == AddressTypes.home)
      {
       if (homeAddress == null)
       {
        homeAddress = addr;
        homeStreet.DataBindings.Add("Text", homeAddress, "Street");
        homeAddress2.DataBindings.Add("Text", homeAddress, "ExtendedAddress");
        homeCity.DataBindings.Add("Text", homeAddress, "Locality");
        homeState.DataBindings.Add("Text", homeAddress, "Region");
        homeZip.DataBindings.Add("Text", homeAddress, "PostalCode");
        homeCountry.DataBindings.Add("Text", homeAddress, "Country");
       }
      }
      else
      {
       if (otherAddress == null)
       {
        otherAddress = addr;
        otherStreet.DataBindings.Add("Text", otherAddress, "Street");
        otherAddress2.DataBindings.Add("Text", otherAddress, "ExtendedAddress");
        otherCity.DataBindings.Add("Text", otherAddress, "Locality");
        otherState.DataBindings.Add("Text", otherAddress, "Region");
        otherZip.DataBindings.Add("Text", otherAddress, "PostalCode");
        otherCountry.DataBindings.Add("Text", otherAddress, "Country");
       }
      }
     }
        }
        catch (SimiasException e)
        {
     e.LogError();
     MessageBox.Show("An error occurred while reading addresses.  Please see the log file for additional information.", "Address Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
        }
        catch (Exception e)
        {
     logger.Debug(e, "Reading addresses");
     MessageBox.Show("An error occurred while reading addresses.  Please see the log file for additional information.", "Address Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
        }
        return;
 }
Exemple #42
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                if (Application["online"] != null)
                {
                    string receiver = Request.Params["receiver"];
                    OnLine onLine = Application["online"] as OnLine;

                    if (onLine.CheckLoginer(receiver))
                    {
                        if (onLine.OnLineList[receiver].UserStatus == Profile.offLineStatus)
                        {
                            Response.Write("1");
                        }
                        else
                        {
                            IM im = new IM();

                            im.Custom = Request.Params["flag"];
                            im.Sender = Request.Params["sender"];
                            im.SendDate = DateTime.Now.ToString();
                            im.SendDate = DateTime.Now.ToString();
                            im.IsOuter = Request.Params["isouter"];
                            //im.Content = Request.Params["content"];
                            im.Receiver = Request.Params["receiver"];
                            im.CNSender = Request.Params["cnsender"];
                            im.LoginName = Request.Params["loginname"];
                            im.ContentStyle = Request.Params["contentstyle"];
                            im.Identy = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff");
                            im.Content = Regex.Replace(
                                Request.Params["content"],
                                "<A href\\s*=\\s*(?:\"(?<1>[^\"]*)\"|(?<1>\\S+))>",
                                string.Empty
                                ).Replace("</A>", string.Empty);

                            im.Content = Regex.Replace(im.Content, @"\bon\w*=.*?( |>)|alt=.*?( |>)|title=.*?( |>)", string.Empty);

                            Assistant.AppendContent(im.Identy, im);

                            string content = string.Format(
                                "<font color=\"{4}\">{0}&nbsp;&nbsp;{1}{5}</font><br />&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"{2}\">{3}</span><br />",
                                im.CNSender,
                                im.SendDate,
                                im.ContentStyle,
                                im.Content,
                                Profile.senderHeadColor,
                                (im.Custom.Equals("0") ? string.Empty : string.Format("&nbsp;[{0}]", Profile.userStatusList[1]))
                                );

                            string result = Assistant.SaveCurrentMessage(im.Sender, im.Receiver, content);

                            if (result.Length > 0)
                            {
                                Response.Write(result);
                            }
                            else
                            {
                                Response.Write(content);
                            }
                        }
                    }
                    else
                    {
                        Response.Write("1");
                    }
                }
                else
                {
                    Response.Write("0");
                }
            }
            catch
            {
                Response.Write("0");
            }

            Response.End();
        }
 public MonoOverlayGui(IM.MonoOverlay overlay)
     : base(overlay)
 {
     _overlay = overlay;
 }
 private void SetIMType(ref IM im, ref DomainUpDown type)
 {
     IMTypes imTypes = im.Types & IMTypes.preferred;
        switch (type.SelectedIndex)
        {
     case 0:
      im.Types = imTypes | IMTypes.work;
      break;
     case 1:
      im.Types = imTypes | IMTypes.home;
      break;
     default:
      im.Types = imTypes | IMTypes.other;
      break;
        }
 }
 private void AddNewIMAccount(ref IM im, ref DomainUpDown labelBox, ref TextBox editBox)
 {
     im = new IM(editBox.Text, labelBox.Text);
        try
        {
     editBox.DataBindings.Add("Text", im, "Address");
     labelBox.DataBindings.Add("Text", im, "Provider");
     contact.AddInstantMessage(im);
        }
        catch (SimiasException e)
        {
     e.LogError();
     MessageBox.Show("An error occurred while adding the IM address.  Please see the log file for additional information.", "Add IM Address Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
        }
        catch (Exception e)
        {
     logger.Debug(e, "Adding IM address");
     MessageBox.Show("An error occurred while adding the IM address.  Please see the log file for additional information.", "Add IM Address Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
        }
 }
Exemple #46
0
        /// <summary>
        /// Processes a message received from a chat room -- SNAC(0E,06)
        /// </summary>
        /// <param name="dp">A <see cref="DataPacket"/> object containing SNAC(0E,06)</param>
        internal void ProcessIncomingMessage(DataPacket dp)
        {
            UserInfo sender = new UserInfo();
            byte[] message;
            Encoding encoding = Encoding.ASCII;
            string language = "";

            byte[] cookie = dp.Data.ReadByteArray(8);
            ushort channel = dp.Data.ReadUshort();
            using (TlvBlock outerTlvs = new TlvBlock(dp.Data.ReadByteArrayToEnd()))
            {
                using (ByteStream userStream = new ByteStream(outerTlvs.ReadByteArray(0x0003)))
                {
                    sender = userStream.ReadUserInfo();
                }

                using (TlvBlock innerTlvs = new TlvBlock(outerTlvs.ReadByteArray(0x0005)))
                {
                    message = innerTlvs.ReadByteArray(0x0001);
                    encoding = Marshal.AolMimeToEncoding(innerTlvs.ReadString(0x0002, Encoding.ASCII));
                    language = innerTlvs.ReadString(0x0003, Encoding.ASCII);
                }
            }

            if (MessageReceived != null)
            {
                IM msg = new IM(sender);
                msg.Message = Encoding.Unicode.GetString(Encoding.Convert(encoding, Encoding.Unicode, message));
                msg.Cookie = Cookie.GetReceivedCookie(cookie);
                MessageReceived(this, new MessageReceivedEventArgs(msg));
            }
        }
Exemple #47
0
 private void ClientSocket_OnReciveMessage(IM.Core.Message message)
 {
     this.richTextBox1.AppendText(message.Content+"\n");
 }
Exemple #48
0
 public TextGui(IM.Text text)
     : base(text)
 {
     _imText = text;
 }
Exemple #49
0
        private Contact updateContactData(Contact contact)
        {
            try
            {
                //从界面获取数据更新到contact中
                if (contact == null)
                {
                    contact = new Contact();
                }

                //获取姓名
                if (FirstNameTB.Text.Length > 0)
                {
                    contact.firstName = FirstNameTB.Text;
                }

                if (lastNameTB.Text.Length > 0)
                {
                    contact.lastName = lastNameTB.Text;
                }

                //获取电话号码
                List<Phone> lPhone = contact.phones;
                if (phoneNumTB_1.Text.Length > 0)
                {
                    if (lPhone == null)
                    {
                        lPhone = new List<Phone>();
                    }

                    Phone phone;
                    if (lPhone.Count > 0)
                    {
                        phone = lPhone[0];
                        phone.field = phoneNumTB_1.Text;
                        phone.label = PhoneTypeCb_1.Text;
                    }
                    else
                    {
                        phone = new Phone();
                        phone.field = phoneNumTB_1.Text;
                        phone.label = PhoneTypeCb_1.Text;
                        lPhone.Add(phone);
                    }
                }

                if (phoneNumTB_2.Text.Length > 0)
                {
                    if (lPhone == null)
                    {
                        lPhone = new List<Phone>();
                    }

                    Phone phone;
                    if (lPhone.Count > 1)
                    {
                        phone = lPhone[1];
                        phone.field = phoneNumTB_2.Text;
                        phone.label = PhoneTypeCb_2.Text;
                    }
                    else
                    {
                        phone = new Phone();
                        phone.field = phoneNumTB_2.Text;
                        phone.label = PhoneTypeCb_2.Text;
                        lPhone.Add(phone);
                    }
                }
                contact.phones = lPhone;

                //获取邮件地址
                List<EmailAdr> lEmail = contact.emailAddresses;
                if (EmailTB_1.Text.Length > 0)
                {
                    if (lEmail == null)
                    {
                        lEmail = new List<EmailAdr>();
                    }

                    EmailAdr emailAdr;
                    if (lEmail.Count > 0)
                    {
                        emailAdr = lEmail[0];
                        emailAdr.field = EmailTB_1.Text;
                        emailAdr.label = EmailTypeCb_1.Text;
                    }
                    else
                    {
                        emailAdr = new EmailAdr();
                        emailAdr.field = EmailTB_1.Text;
                        emailAdr.label = EmailTypeCb_1.Text;
                        lEmail.Add(emailAdr);
                    }
                }
                if (EmailTB_2.Text.Length > 0)
                {
                    if (lEmail == null)
                    {
                        lEmail = new List<EmailAdr>();
                    }

                    EmailAdr emailAdr;
                    if (lEmail.Count > 1)
                    {
                        emailAdr = lEmail[1];
                        emailAdr.field = EmailTB_2.Text;
                        emailAdr.label = EmailTypeCb_2.Text;
                    }
                    else
                    {
                        emailAdr = new EmailAdr();
                        emailAdr.field = EmailTB_2.Text;
                        emailAdr.label = EmailTypeCb_2.Text;
                        lEmail.Add(emailAdr);
                    }
                }
                contact.emailAddresses = lEmail;

                //获取即时通讯
                List<IM> lIM = contact.IMs;
                if (IMTB_1.Text.Length > 0)
                {
                    if (lIM == null)
                    {
                        lIM = new List<IM>();
                    }

                    IM im;
                    if (lIM.Count > 0)
                    {
                        im = lIM[0];
                        if (im.field == null)
                        {
                            im.field = new IMsfield();
                        }
                        im.field.userName = IMTB_1.Text;
                        im.field.IMService = IMTypeCb_1.Text;
                    }
                    else
                    {
                        im = new IM();
                        im.field = new IMsfield();
                        im.field.userName = IMTB_1.Text;
                        im.field.IMService = IMTypeCb_1.Text;
                        lIM.Add(im);
                    }
                }
                if (IMTB_2.Text.Length > 0)
                {
                    if (lIM == null)
                    {
                        lIM = new List<IM>();
                    }

                    IM im;
                    if (lIM.Count > 1)
                    {
                        im = lIM[1];
                        if (im.field == null)
                        {
                            im.field = new IMsfield();
                        }
                        im.field.userName = IMTB_2.Text;
                        im.field.IMService = IMTypeCb_2.Text;
                    }
                    else
                    {
                        im = new IM();
                        im.field = new IMsfield();
                        im.field.userName = IMTB_2.Text;
                        im.field.IMService = IMTypeCb_2.Text;
                        lIM.Add(im);
                    }
                }
                contact.IMs = lIM;

                //获取通讯地址
                List<StreetAdr> lStreetAdr = contact.streetAddresses;
                if (AddrCountryTB_1.Text.Length > 0 || AddrProvinceTB_1.Text.Length > 0
                    || AddrCityTB_1.Text.Length > 0 || AddrStreetTB_1.Text.Length > 0)
                {
                    if (lStreetAdr == null)
                    {
                        lStreetAdr = new List<StreetAdr>();
                    }

                    StreetAdr streetAdr;
                    if (lStreetAdr.Count > 0)
                    {
                        streetAdr = lStreetAdr[0];
                        streetAdr.label = AddrTypeCb_1.Text;
                        if (streetAdr.field == null)
                        {
                            streetAdr.field = new StreetField();
                        }
                        streetAdr.field.country = AddrCountryTB_1.Text;
                        streetAdr.field.state = AddrProvinceTB_1.Text;
                        streetAdr.field.city = AddrCityTB_1.Text;
                        streetAdr.field.street = AddrStreetTB_1.Text;
                    }
                    else
                    {
                        streetAdr = new StreetAdr();
                        streetAdr.label = AddrTypeCb_1.Text;
                        streetAdr.field = new StreetField();
                        streetAdr.field.country = AddrCountryTB_1.Text;
                        streetAdr.field.state = AddrProvinceTB_1.Text;
                        streetAdr.field.city = AddrCityTB_1.Text;
                        streetAdr.field.street = AddrStreetTB_1.Text;
                        lStreetAdr.Add(streetAdr);
                    }

                }

                if (AddrCountryTB_2.Text.Length > 0 || AddrProvinceTB_2.Text.Length > 0
                    || AddrCityTB_2.Text.Length > 0 || AddrStreetTB_2.Text.Length > 0
                    || AddrZipTB_2.Text.Length > 0)
                {
                    if (lStreetAdr == null)
                    {
                        lStreetAdr = new List<StreetAdr>();
                    }

                    StreetAdr streetAdr;
                    if (lStreetAdr.Count > 1)
                    {
                        streetAdr = lStreetAdr[1];
                        streetAdr.label = AddrTypeCb_2.Text;
                        if (streetAdr.field == null)
                        {
                            streetAdr.field = new StreetField();
                        }
                        streetAdr.field.country = AddrCountryTB_2.Text;
                        streetAdr.field.state = AddrProvinceTB_2.Text;
                        streetAdr.field.city = AddrCityTB_2.Text;
                        streetAdr.field.street = AddrStreetTB_2.Text;
                    }
                    else
                    {
                        streetAdr = new StreetAdr();
                        streetAdr.label = AddrTypeCb_2.Text;
                        streetAdr.field = new StreetField();
                        streetAdr.field.country = AddrCountryTB_2.Text;
                        streetAdr.field.state = AddrProvinceTB_2.Text;
                        streetAdr.field.city = AddrCityTB_2.Text;
                        streetAdr.field.street = AddrStreetTB_2.Text;
                        lStreetAdr.Add(streetAdr);
                    }
                }

                //获取备注
                if (noteTB.Text.Length > 0)
                {
                    contact.notes = noteTB.Text;
                }
                return contact;
            }
            catch (System.Exception ex)
            {
                Console.WriteLine(ex.StackTrace);
            }

            return null;
        }