Exemplo n.º 1
0
        public static void LoadProfile(string profile)
        {
            if (IsCurrentProfile(profile))
            {
                return;
            }

            string sProfilePath = string.Empty;

            if (profile.Contains("Loader"))
            {
                sProfilePath = XmlLoaderProfile;
            }
            else
            {
                sProfilePath = DataPath + @"\" + profile;
            }

            if (sProfilePath == null || profile == null)
            {
                DebugLogging.Log("[LoadProfile] Failed to Load Profile, file: " + sProfilePath);
                return;
            }

            try
            {
                DebugLogging.Log("[LoadProfile] Load Profile, file: " + sProfilePath);
                ProfileManager.Load(sProfilePath);
            }
            catch { }
        }
        public void DrillAction(PossibleDrillActions Mode)
        {
            DebugLogging.WriteLine("MemberCell.DrillAction({0})", Mode);

            if ((Mode & PossibleDrillActions) != Mode)
            {
                var S = "";
                if (Mode == PossibleDrillActions.esCollapsed)
                {
                    S = RadarUtils.GetResStr("rsDrillAction0");
                }
                if (Mode == PossibleDrillActions.esParentChild)
                {
                    S = RadarUtils.GetResStr("rsDrillAction1");
                }
                if (Mode == PossibleDrillActions.esNextLevel)
                {
                    S = RadarUtils.GetResStr("rsDrillAction2");
                }
                if (Mode == PossibleDrillActions.esNextHierarchy)
                {
                    S = RadarUtils.GetResStr("rsDrillAction3");
                }

                throw new Exception(
                          string.Format(RadarUtils.GetResStr("rsInadmissibleDrillAction"), S, Value));
            }

            CellSet.DrillAction_Inner(Mode, RealMember);
        }
Exemplo n.º 3
0
 public override string getPeopleListMetadata()
 {
     try
     {
         XmlNode node       = searchData.SelectSingleNode("rdf:RDF/rdf:Description/prns:numberOfConnections", namespaceManager);
         Int32   resultSize = Convert.ToInt32(node.InnerText);
         if (resultSize == 1)
         {
             return("" + resultSize + " profile");
         }
         else if (resultSize <= searchLimit)
         {
             return("" + resultSize + " profiles");
         }
         else
         {
             return("top " + searchLimit + " profiles");
         }
     }
     catch (Exception e)
     {
         DebugLogging.Log(e.Message);
     }
     return("Error reading results");
 }
Exemplo n.º 4
0
    private void Update()
    {
        DebugLogging.CustomDebug("så det funkar", size: 20);

        if (Input.GetMouseButtonDown(0))
        {
            Ray        ray = Camera.main.ScreenPointToRay(Input.mousePosition);
            RaycastHit hit;
            if (Physics.Raycast(ray, out hit))
            {
                if (hit.transform.CompareTag("Par"))
                {
                    GatheredParasites.Add(hit.transform.GetComponent <ParasiteController>());
                    hit.transform.GetComponent <ParasiteController>().enabled = false;
                    hit.transform.gameObject.SetActive(false);
                }
            }
        }

        if (health > 0)
        {
            if (frameCount % 60 == 0)
            {
                DrainHealth();
                // Debug.Log("Health : " + health);
            }
        }
        else
        {
            Debug.Log("PlayerDead");
            Destroy(this);
            this.gameObject.SetActive(false);
        }
        frameCount++;
    }
Exemplo n.º 5
0
    public void Toggle()
    {
        if (BOUND_OBJECT)
        {
            BOUND_OBJECT.Unbind();
            _bound_object = null;
        }
        DebugLogging.DrawDebugRay(
            transform.position,
            Constants.PLAYER_INTERACTION_DISTANCE * transform.forward);

        RaycastHit hit;

        if (Physics.Raycast(transform.position, transform.forward, out hit, Constants.PLAYER_INTERACTION_DISTANCE, Constants.INTERACTABLE_CULLING_MASK))
        {
            InteractableObjectBindable obj_bindable = Lib.GetComponentInTree <InteractableObjectBindable> (hit.collider.gameObject);
            if (!obj_bindable)
            {
                InteractableObject obj = Lib.GetComponentInTree <InteractableObject> (hit.collider.gameObject);
                obj.Interacted();
                return;
            }
            else
            {
                _bound_object = obj_bindable;
                BOUND_OBJECT.Bind(this);
                return;
            }
        }
        else
        {
            //Eventually we'll play a sound or something here.  Maybe draw a raycast.
        }
    }
Exemplo n.º 6
0
        public void PutSocket(CustomSocket socket)
        {
            DebugLogging.Log("Put Socket -> Pool size: " + availableSockets.Count.ToString());
            lock (availableSockets)
            {
                TimeSpan socketLifeTime = DateTime.Now.Subtract(socket.TimeCreated);
                if (availableSockets.Count < POOL_MAX_SIZE && socketLifeTime.Seconds < EXPIRE_SECONDS)
                {
                    if (socket != null)
                    {
                        if (socket.Connected)
                        {
                            availableSockets.Enqueue(socket);

                            DebugLogging.Log("Socket Queued -> Pool size: " + availableSockets.Count.ToString());
                        }
                        else
                        {
                            socket.Close();
                        }
                    }
                }
                else
                {
                    socket.Close();
                    DebugLogging.Log("PutSocket - Socket is forced " +
                                     "to closed -> Pool size: " +
                                     availableSockets.Count.ToString());
                }
            }
        }
Exemplo n.º 7
0
    void Start()
    {
        Debug.Log("A log");

        Debug.LogWarning("A Warning");

        Debug.LogError("An Error");

        Debug.Log("A <b>Bold</b> log");

        Debug.LogWarning("An <i>Italic</i> Warning");

        Debug.LogError("A <size=20> Sized up</size> Error");

        Debug.Log("A debug log with an object reference", gameObject);

        Debug.Log("A <color=red> red </color> message");

        string rainbowColored = string.Empty;
        for (int i = 0; i < rainbowMessage.Length; i++)
        {
            rainbowColored += colorprefix;
            rainbowColored += colors[UnityEngine.Random.Range(0, colors.Count - 1)];
            rainbowColored += rainbowMessage[i];
            rainbowColored += colorSufix;
        }

        Debug.Log("a <size=20>" + rainbowColored + "</size> message");

        DebugLogging.CustomDebug("A custom message", LogType.Log, "blue", 20, true, false);
        DebugLogging.CustomDebug("Another custom message", logType: LogType.Warning, color: "green", italic: true);

    }
Exemplo n.º 8
0
        public CustomSocket GetSocket()
        {
            DebugLogging.Log("Get Socket -> Pool size: " + availableSockets.Count.ToString());
            if (availableSockets.Count > 0)
            {
                lock (availableSockets)
                {
                    CustomSocket socket = null;
                    while (availableSockets.Count > 0)
                    {
                        socket = availableSockets.Dequeue();

                        if (socket.Connected)
                        {
                            DebugLogging.Log("Socket Dequeued -> Pool size: " +
                                             availableSockets.Count.ToString());

                            return(socket);
                        }
                        else
                        {
                            socket.Close();
                            System.Threading.Interlocked.Decrement(ref SocketCounter);
                            DebugLogging.Log("GetSocket -- Close -- Count: " +
                                             SocketCounter.ToString());
                        }
                    }
                }
            }
            return(ConnectSocket());
        }
Exemplo n.º 9
0
            public override string getCallbackResponse()
            {
                try
                {
                    searchRequest.SelectSingleNode("/SearchOptions/OutputOptions/Offset").InnerText = "0";
                    searchRequest.SelectSingleNode("/SearchOptions/OutputOptions/Limit").InnerText  = "500";
                    XmlDocument searchData = new Profiles.Search.Utilities.DataIO().Search(searchRequest, false, false);

                    DebugLogging.Log("SeachCallbackResponse :" + searchRequest.ToString());

                    List <string> peopleURIs = new List <string>();
                    XmlNodeList   people     = searchData.GetElementsByTagName("rdf:object");
                    for (int i = 0; i < people.Count; i++)
                    {
                        peopleURIs.Add(people[i].Attributes["rdf:resource"].Value);
                    }
                    if (peopleURIs.Count > 0)
                    {
                        return(BuildJSONPersonIds(peopleURIs, "" + peopleURIs.Count + " people found"));
                    }
                }
                catch (Exception e)
                {
                    DebugLogging.Log(e.Message);
                }

                return(null);
            }
Exemplo n.º 10
0
        public object Search(queryrequest xml)
        {
            SemWeb.Query.Query query = null;

            string q = string.Empty;

            try
            {
                query = new SparqlEngine(new StringReader(xml.query));
            }
            catch (QueryFormatException ex)
            {
                var malformed = new malformedquery();

                malformed.faultdetails = ex.Message;

                return(malformed);
            }

            // Load the data from sql server
            SemWeb.Stores.SQLStore store;

            string connstr = ConfigurationManager.ConnectionStrings["SemWebDB"].ConnectionString;

            DebugLogging.Log(connstr);

            store = (SemWeb.Stores.SQLStore)SemWeb.Store.CreateForInput(connstr);

            //Create a Sink for the results to be writen once the query is run.
            MemoryStream    ms     = new MemoryStream();
            XmlTextWriter   writer = new XmlTextWriter(ms, System.Text.Encoding.UTF8);
            QueryResultSink sink   = new SparqlXmlQuerySink(writer);

            try
            {
                // Run the query.
                query.Run(store, sink);
            }
            catch (Exception ex)
            {
                // Run the query.
                query.Run(store, sink);
                DebugLogging.Log("Run the query a second time");
                DebugLogging.Log(ex.Message);
            }
            //flush the writer then  load the memory stream
            writer.Flush();
            ms.Seek(0, SeekOrigin.Begin);

            //Write the memory stream out to the response.
            ASCIIEncoding ascii = new ASCIIEncoding();

            DebugLogging.Log(ascii.GetString(ms.ToArray()).Replace("???", ""));
            writer.Close();

            DebugLogging.Log("End of Processing");

            return(SerializeXML.DeserializeObject(ascii.GetString(ms.ToArray()).Replace("???", ""), typeof(sparql)) as sparql);
        }
        private string BuildJSONPersonIds(string uri)
        {
            DebugLogging.Log("BuildJSONPersonIds " + uri);
            List <string> personIds = new List <string>();

            personIds.Add(uri);
            return(BuildJSONPersonIds(personIds));
        }
Exemplo n.º 12
0
 public bool IsVisible()
 {
     // always have turned on for Profile/Display.aspx because we want to generate the "profile was viewed" in Javascript (bot proof) 
     // regardless of any gadgets being visible, and we need this to be True for the shindig javascript libraries to load
     bool retval = shindigURL != null && (GetVisibleGadgets().Count > 0);
     DebugLogging.Log("OpenSocialIsVisible = " + retval);
     return retval;
 }
Exemplo n.º 13
0
        public static string BuildJSONPersonIds(string uri, string message)
        {
            DebugLogging.Log("BuildJSONPersonIds " + uri + " : " + message);
            List <string> personIds = new List <string>();

            personIds.Add(uri);
            return(BuildJSONPersonIds(personIds, message));
        }
Exemplo n.º 14
0
 internal override void StartMergeSeries(int estimatedCount)
 {
     DebugLogging.WriteLine("MdLine.StartMergeSeries(estimatedCount={0})", estimatedCount);
     CheckLineAlive();
     fNewIndexes = new long[estimatedCount];
     fNewData    = new LineData[estimatedCount];
     fCounter    = 0;
 }
Exemplo n.º 15
0
        internal MdLine(MetaLine AMetaLine, string ID, string MeasureID, MeasureShowMode Mode, int HierID)
            : base(AMetaLine, ID, MeasureID, Mode, HierID)
        {
            DebugLogging.WriteLine("MdLine.ctor(ID={0} of MetaLine.ID={1})", ID, AMetaLine.ID);

            fData    = new LineData[0];
            fIndexes = new long[0];
        }
Exemplo n.º 16
0
        private static string SocketSendReceive(string viewer, string owner, string gadget)
        {
            //  These keys need to match what you see in edu.ucsf.profiles.shindig.service.SecureTokenGeneratorService in Shindig
            string request = "c=default" + (viewer != null ? "&v=" + HttpUtility.UrlEncode(viewer) : "") +
                             (owner != null ? "&o=" + HttpUtility.UrlEncode(owner) : "") + "&u=" + HttpUtility.UrlEncode(gadget) + "\r\n";

            Byte[] bytesSent     = System.Text.Encoding.ASCII.GetBytes(request);
            Byte[] bytesReceived = new Byte[256];

            // Create a socket connection with the specified server and port.
            //Socket s = ConnectSocket(tokenService[0], Int32.Parse(tokenService[1]));

            // during startup we might fail a few times, so be will to retry
            string page = "";

            for (int i = 0; i < 3 && page.Length == 0; i++)
            {
                CustomSocket s = null;
                try
                {
                    s = sockets.GetSocket();

                    if (s == null)
                    {
                        return("Connection failed");
                    }

                    // Send request to the server.
                    DebugLogging.Log("Sending Bytes");
                    s.Send(bytesSent, bytesSent.Length, 0);

                    // Receive the server home page content.
                    int bytes = 0;

                    // The following will block until te page is transmitted.
                    do
                    {
                        DebugLogging.Log("Receiving Bytes");
                        bytes = s.Receive(bytesReceived, bytesReceived.Length, 0);
                        page  = page + Encoding.ASCII.GetString(bytesReceived, 0, bytes);
                        DebugLogging.Log("Socket Page=" + page + "|");
                    }while (page.Length == page.TrimEnd().Length&& bytes > 0);
                }
                catch (Exception ex)
                {
                    DebugLogging.Log("Socket Error :" + ex.Message);
                    page = "";
                }
                finally
                {
                    if (sockets != null)
                    {
                        sockets.PutSocket(s);
                    }
                }
            }
            return(page.TrimEnd());
        }
Exemplo n.º 17
0
        public static string CallORNGRPC(string guid, string channel, string opt_params)
        {
            DebugLogging.Log("CallORNGRPC " + guid + ":" + channel);
            ORNGRPCService responder = ORNGRPCService.GetRPCService(new Guid(guid), channel);
            string         retval    = responder != null?responder.call(channel, opt_params) : null;

            DebugLogging.Log("CallORNGRPC " + (responder == null ? "ORNGRPCService not found! guid =" : guid));
            return(retval != null ? retval : "");
        }
Exemplo n.º 18
0
        public static string CallORNGRPC(string guid, string request)
        {
            DebugLogging.Log("CallORNGRPC " + guid + ":" + request);
            ORNGRPCService responder = ORNGRPCService.GetRPCService(new Guid(guid));
            string         retval    = responder != null?responder.call(request) : null;

            DebugLogging.Log("CallORNGRPC " + (responder == null ? "ORNGRPCService not found! guid =" : guid));
            return(retval != null ? retval : "");
        }
Exemplo n.º 19
0
 public ORNGRPCService(string uri, Page page, bool editMode, string[] chnls)
 {
     this.om = OpenSocialManager.GetOpenSocialManager(uri, page, false);
     this.channels.AddRange(chnls);
     // Add to Session so that it does not get prematurely garbage collected
     HttpContext.Current.Session[KEY_PREFIX + ":" + om.GetGuid().ToString()] = this;
     managers.Add(new WeakReference(this));
     DebugLogging.Log("ORNGRPCService created :" + om.GetGuid().ToString() + " channels " + this.channels.ToString());
 }
Exemplo n.º 20
0
        public static string CallORNGResponder(string guid, string request)
        {
            DebugLogging.Log("OpenSocialManager CallORNGResponder " + guid + ":" + request);
            ORNGCallbackResponder responder = ORNGCallbackResponder.GetORNGCallbackResponder(new Guid(guid), request);
            string retval = responder != null?responder.getCallbackResponse() : null;

            DebugLogging.Log("OpenSocialManager CallORNGResponder " + (responder == null ? "CallbackReponder not found! " : retval));
            return(retval);
        }
        internal virtual void LoadTo(OlapControl aGrid)
        {
            DebugLogging.WriteLine("OlapAxisLayoutSerializer.LoadTo");

            if (!aGrid.Active)
            {
                return;
            }

            aGrid.FEmptyDataString      = EmptyDataString;
            aGrid.FCurrencyFormatString = CurrencyFormatString;


            aGrid.BeginUpdate();

            Clear(aGrid);

            if (AxesLayout != null)
            {
                aGrid.FLayout.fMeasureLayout              = AxesLayout.MeasureLayout;
                aGrid.FLayout.fMeasurePosition            = AxesLayout.MeasurePosition;
                aGrid.FLayout.fHideMeasureIfPossible      = AxesLayout.HideMeasureIfPossible;
                aGrid.FLayout.fHideMeasureModesIfPossible = AxesLayout.HideMeasureModesIfPossible;

                aGrid.FCellSet.FSortingDirection = AxesLayout.ValueSortingDirection;
                aGrid.FCellSet.ValueSortedColumn = AxesLayout.ValueSortedColumn;
            }

            var assignedMeasures = aGrid.Measures.Where(item => item.Visible).ToList();

            LoadMeasuresXandY(aGrid, assignedMeasures);
            LoadHierarchies(aGrid, assignedMeasures);

            aGrid.FCellSet.Rebuild();

            LoadMeasures(aGrid);

            assignedMeasures = aGrid.Measures.Where(item => item.Visible).ToList();

            aGrid.FCellSet.Rebuild();

            if (AxesLayout != null)
            {
                aGrid.FCellSet.FSortingDirection = AxesLayout.ValueSortingDirection;
                aGrid.FCellSet.ValueSortedColumn = AxesLayout.ValueSortedColumn;
            }

            foreach (var item in assignedMeasures)
            {
                aGrid.Pivoting(item, LayoutArea.laRow, null, LayoutArea.laNone);
            }
            LoadComments(aGrid);
            LoadColumnsWidth(aGrid);

            aGrid.EndUpdate();
        }
Exemplo n.º 22
0
        public static void LeaveGame()
        {
            DebugLogging.Log("LeaveGame");

            LoadProfile("UberBotLeaveGame.xml");

            MyUsedProfiles.Clear();
            UberBot.MyRunInfos.GameCount++;
            UberBot.MyRunInfos.LastProfile = 0;
        }
Exemplo n.º 23
0
    int GetRoomId()
    {
        RaycastHit hit;

        if (Physics.Raycast(transform.position, Vector3.down, out hit, Constants.ROOM_DETECTION_RAYCAST_DISTANCE, Constants.ROOM_DETECTION_CULLING_MASK))
        {
            return(hit.transform.GetComponentInParent <RoomObject> ().id);
        }
        DebugLogging.DrawDebugRay(transform.position, new Vector3(0, -Constants.ROOM_DETECTION_RAYCAST_DISTANCE, 0));
        return(-1);
    }
        internal IEnumerable <CellsetMember> AllChildren()
        {
            DebugLogging.WriteLine("CellsetLevel.AllChildren() ({0})", ToString());

            return(FLevel.Grid.CellSet.FRowMembers
                   .SelectMany(item => item.AllChildren())
                   .Union(
                       FLevel.Grid.CellSet.FColumnMembers
                       .SelectMany(item => item.AllChildren()))
                   .Where(item => item.FLevel == this));
        }
Exemplo n.º 25
0
        private void DebugLogging_WriteLine(IList <int> LevelIndexes)
        {
            if (DebugLogging.Verify("OlapCubeMetaLine.ctor()"))
            {
                return;
            }

            var levels = "(" + string.Join(", ", Levels.Select(x => x.DisplayName).ToArray()) + ")";

            DebugLogging.WriteLine("OlapCubeMetaLine.ctor(ID={0} AGrid, LevelIndexes={1}={2})", ID,
                                   Extentions.ConvertToString(LevelIndexes), levels);
        }
        protected virtual void WriteXMLInner(Stream stream)
        {
            DebugLogging.WriteLine("OlapAxisLayoutSerializer.WriteXMLInner");

            //if (fGrid != null)
            LoadFrom(fGrid);

            fGrid.BeforSave(fGrid, new OnSerializeArgs(this));

            var bf = XmlSerializator.GetXmlSerializer(GetType());

            bf.Serialize(stream, this);
        }
Exemplo n.º 27
0
 internal string GetSecurityToken(String gadgetURL)
 {
     if (Convert.ToBoolean(ConfigurationSettings.AppSettings["DEBUG"]) == true)
     {
         Stopwatch sw = new Stopwatch();
         sw.Start();
         string retval = SocketSendReceive(GetViewerURI(), GetOwnerURI(), gadgetURL);
         sw.Stop();
         socketTime += sw.Elapsed.TotalSeconds;
         DebugLogging.Log("Average socket = " + (socketTime / socketCounter++) + ", Elapsed = " + sw.Elapsed);
         return retval;
     }
     else
     {
         return SocketSendReceive(GetViewerURI(), GetOwnerURI(), gadgetURL);
     }
 }
Exemplo n.º 28
0
        public void LoadAssets()
        {
            // Only do this once per page, and do it only for the last request!
            // should synchronize
            int currentCount = (int)page.Items[OPENSOCIAL_PAGE_REQUESTS];

            page.Items[OPENSOCIAL_PAGE_REQUESTS] = --currentCount;

            DebugLogging.Log("OpenSocialCurrentCount = " + currentCount);
            if (!IsVisible() || currentCount > 0)
            {
                return;
            }

            // trigger the javascript to render gadgets
            HtmlGenericControl body = (HtmlGenericControl)page.Master.FindControl("bodyMaster");

            body.Attributes.Add("onload", "my.init();");

            HtmlLink gadgetscss = new HtmlLink();

            gadgetscss.Href = Root.Domain + "/ORNG/CSS/gadgets.css";
            gadgetscss.Attributes["rel"]   = "stylesheet";
            gadgetscss.Attributes["type"]  = "text/css";
            gadgetscss.Attributes["media"] = "all";
            page.Header.Controls.Add(gadgetscss);

            HtmlGenericControl containerjs = new HtmlGenericControl("script");

            containerjs.Attributes.Add("type", "text/javascript");
            containerjs.Attributes.Add("src", GetContainerJavascriptSrc());
            page.Header.Controls.Add(containerjs);

            HtmlGenericControl gadgetjs = new HtmlGenericControl("script");

            gadgetjs.Attributes.Add("type", "text/javascript");
            gadgetjs.InnerHtml = GetGadgetJavascipt();
            page.Header.Controls.Add(gadgetjs);

            HtmlGenericControl shindigjs = new HtmlGenericControl("script");

            shindigjs.Attributes.Add("type", "text/javascript");
            shindigjs.Attributes.Add("src", Root.Domain + "/ORNG/JavaScript/orng.js");
            page.Header.Controls.Add(shindigjs);
        }
Exemplo n.º 29
0
        public static ORNGRPCService GetRPCService(Guid guid)
        {
            DebugLogging.Log("ORNGRPCService guid :" + guid);
            ORNGRPCService retval = null;

            foreach (WeakReference wr in managers.ToArray <WeakReference>())
            {
                if (wr.Target == null)
                {
                    DebugLogging.Log("ORNGRPCService removing WeakReference :" + wr);
                    managers.Remove(wr);
                }
                else if (guid.Equals(((ORNGRPCService)wr.Target).om.GetGuid()))
                {
                    retval = wr.Target as ORNGRPCService;
                }
            }
            return(retval);
        }
Exemplo n.º 30
0
        public static ORNGCallbackResponder GetORNGCallbackResponder(Guid guid, string request)
        {
            DebugLogging.Log("GetORNGCallbackResponder guid :" + guid + ":" + request);
            ORNGCallbackResponder retval = null;

            foreach (WeakReference wr in managers.ToArray <WeakReference>())
            {
                if (wr.Target == null)
                {
                    DebugLogging.Log("GetORNGCallbackResponder removing WeakReference :" + wr);
                    managers.Remove(wr);
                }
                else if (request.Equals(((ORNGCallbackResponder)wr.Target).requestToRespondTo) && guid.Equals(((ORNGCallbackResponder)wr.Target).om.GetGuid()))
                {
                    retval = wr.Target as ORNGCallbackResponder;
                }
            }
            return(retval);
        }