Beispiel #1
0
	// Update is called once per frame
	void Update () {
        KeyCode my_key = Values.keys[index];
        RaycastHit hit_info;
        if (Physics.Raycast(transform.position, Vector3.forward, out hit_info, Mathf.Infinity, 1 << 8))
        {
            NoteData note_data = hit_info.collider.GetComponent<NoteData>();
            if (Input.GetKey(my_key) && !playing)
            {
                synthetizer.playNote(note_data.Note);
                note_data.Stroked = true;
                playing_note = note_data;
                playing = true;
            }
            if (playing && Input.GetKeyUp(my_key))
            {
                stopPlaying();
            }
            // Note has ended and new one followed just after
            if (playing && !note_data.Stroked)
            {
                stopPlaying();
            }

        }
        else 
        {
            if (Input.GetKey(my_key))
                song_interface.voidKept(Time.deltaTime);
            if (playing == true)
                stopPlaying();
        }

        collider2D.enabled = Input.GetKey(my_key);
        anim.SetBool("is_pressed", Input.GetKey(my_key));
    }
    // For notes that already exist

    public void CreateNote(GameObject note)
    {
        string id = AddNote(note);

        // Send data to clients
        NoteData noteData = new NoteData(id, note.transform.position.x, note.transform.position.y, note.transform.position.z, "", "CREATE");

        SendNoteData(noteData);
    }
Beispiel #3
0
 public void OnNoteCut(NoteData data, NoteCutInfo info)
 {
     allCuts++;
     if (data.noteType != NoteType.Bomb && info.allIsOK)
     {
         goodCuts++;
     }
     RefreshText();
 }
Beispiel #4
0
 public void OnNoteCut(NoteData data, NoteCutInfo info)
 {
     allCuts++;
     if (data.colorType != ColorType.None && info.allIsOK)
     {
         goodCuts++;
     }
     RefreshText();
 }
Beispiel #5
0
 public void OnNoteMiss(NoteData data)
 {
     if (data.noteType == NoteType.Bomb)
     {
         return;
     }
     allCuts++;
     RefreshText();
 }
        public new void SpawnBombNote(NoteData noteData, Vector3 moveStartPos, Vector3 moveEndPos, Vector3 jumpEndPos, float moveDuration, float jumpDuration, float jumpGravity, float rotation)
        {
            NoteController noteController = _bombNotePool.Spawn();

            SetNoteControllerEventCallbacks(noteController);
            noteController.transform.SetPositionAndRotation(moveStartPos, Quaternion.identity);
            noteController.Init(noteData, rotation, moveStartPos, moveEndPos, jumpEndPos, moveDuration, jumpDuration, jumpGravity, 0f);
            GetNoteWasSpawnedEvent(ref _beatmapObjectManager)?.Invoke(noteController);
        }
Beispiel #7
0
 public void OnNoteMiss(NoteData data)
 {
     if (data.colorType == ColorType.None)
     {
         return;
     }
     allCuts++;
     RefreshText();
 }
Beispiel #8
0
    public static HeldNoteUp Create(Note parent, NoteData nd)
    {
        HeldNoteUp note = (Instantiate(prefab, nd.lane, Quaternion.identity) as GameObject).GetComponent <HeldNoteUp>();

        note.moveSpeed = nd.moveSpeed;
        note.spawnTime = nd.timePosition;
        note.parent    = parent;
        return(note);
    }
        public void OnNoteWasCut(NoteData noteData, NoteCutInfo noteCutInfo, int multiplier)
        {
            // Event order: combo, multiplier, scoreController.noteWasCut, (LateUpdate) scoreController.scoreDidChange, afterCut, (LateUpdate) scoreController.scoreDidChange

            var gameStatus = statusManager.gameStatus;

            SetNoteCutStatus(noteData, noteCutInfo, true);

            int score            = 0;
            int afterScore       = 0;
            int cutDistanceScore = 0;

            ScoreController.RawScoreWithoutMultiplier(noteCutInfo, out score, out afterScore, out cutDistanceScore);

            gameStatus.initialScore  = score;
            gameStatus.finalScore    = -1;
            gameStatus.cutMultiplier = multiplier;

            if (noteData.noteType == NoteType.Bomb)
            {
                gameStatus.passedBombs++;
                gameStatus.hitBombs++;

                statusManager.EmitStatusUpdate(ChangedProperties.PerformanceAndNoteCut, "bombCut");
            }
            else
            {
                gameStatus.passedNotes++;

                if (noteCutInfo.allIsOK)
                {
                    gameStatus.hitNotes++;

                    statusManager.EmitStatusUpdate(ChangedProperties.PerformanceAndNoteCut, "noteCut");
                }
                else
                {
                    gameStatus.missedNotes++;

                    statusManager.EmitStatusUpdate(ChangedProperties.PerformanceAndNoteCut, "noteMissed");
                }
            }

            List <CutScoreBuffer> list = (List <CutScoreBuffer>)afterCutScoreBuffersField.GetValue(scoreController);

            foreach (CutScoreBuffer acsb in list)
            {
                if (noteCutInfoField.GetValue(acsb) == noteCutInfo)
                {
                    // public CutScoreBuffer#didFinishEvent<CutScoreBuffer>
                    noteCutMapping.Add(noteCutInfo, noteData);

                    acsb.didFinishEvent += OnNoteWasFullyCut;
                    break;
                }
            }
        }
    public void CreateNote(Vector3 position)
    {
        string id = AddNote(position);

        // Send data to clients
        NoteData noteData = new NoteData(id, position.x, position.y, position.z, "", "CREATE");

        SendNoteData(noteData);
    }
Beispiel #11
0
 private void SetNormalNote(int id)
 {
     Anim.enabled     = true;
     NoteId           = id;
     NoteType         = CommonData.NOTE_TYPE.NORMAL;
     NoteData         = DataManager.Instance.NoteDataDic[id];
     NoteImage.sprite = (Sprite)Resources.Load(NoteData.img, typeof(Sprite));
     ShadowImage.gameObject.SetActive(true);
 }
Beispiel #12
0
 // Use this for initialization
 void Start()
 {
     mRenderers = GetComponentsInChildren <SpriteRenderer> ();
     mData      = GetComponent <NoteData> ();
     foreach (var mRenderer in mRenderers)
     {
         mRenderer.color = Color.clear;
     }
 }
Beispiel #13
0
        internal static Note FetchNote(NoteData data)
        {
            var result = new Note();

            result.Fetch(data);
            result.MarkOld();

            return(result);
        }
Beispiel #14
0
        private void RecordHitValueSecondary(CutScoreBuffer score, NoteData data, ScoreFinishEventHandler fn)
        {
            float newEnergy;

            switch (PluginConfig.Instance.secondaryMode)
            {
            case PluginConfig.MeasurementMode.None:
                return;

            case PluginConfig.MeasurementMode.Energy:
                newEnergy = energyCounter.energy;
                break;

            case PluginConfig.MeasurementMode.PercentModified:
                newEnergy = (float)scoreController.modifiedScore / scoreController.immediateMaxPossibleModifiedScore;
                break;

            case PluginConfig.MeasurementMode.PercentRaw:
                newEnergy = rankCounter.relativeScore;
                break;

            case PluginConfig.MeasurementMode.CutValue:
                if (score == null)
                {
                    return;
                }

                newEnergy = score.cutScore / 115.0f;
                break;

            case PluginConfig.MeasurementMode.AvgCutValue:
                if (score == null)
                {
                    return;
                }

                secondaryAverageHitValue = ((secondaryAverageHitValue * secondaryAverageHitValueSize) + score.cutScore / 115.0f) / ++secondaryAverageHitValueSize;
                newEnergy = secondaryAverageHitValue;
                break;

            default:
                Logger.log.Error("An invalid mode was specified! PerformanceMeter will not record scores, resulting in a blank graph. Check the readme for the valid modes.");
                return;
            }

            if (secondaryEnergyList.Count == 0)
            {
                secondaryEnergyList.Add(new Pair <float, float>(0, newEnergy));
            }
            secondaryEnergyList.Add(new Pair <float, float>(data.time, newEnergy));

            if (score != null)
            {
                score.UnregisterDidFinishReceiver(fn);
            }
        }
Beispiel #15
0
#pragma warning disable SA1313 // Parameter names should begin with lower-case letter
        private static void Postfix(NoteData __instance)
#pragma warning restore SA1313 // Parameter names should begin with lower-case letter
        {
            if (__instance is CustomNoteData customData)
            {
                dynamic dynData = customData.customData;
                IEnumerable <float?> position = ((List <object>)Trees.at(dynData, POSITION))?.Select(n => n.ToNullableFloat());
                float?       flipLineIndex    = (float?)Trees.at(dynData, "flipLineIndex");
                List <float> localrot         = ((List <object>)Trees.at(dynData, LOCALROTATION))?.Select(n => Convert.ToSingle(n)).ToList();
                dynamic      rotation         = Trees.at(dynData, ROTATION);

                float?startRow = position?.ElementAtOrDefault(0);

                IDictionary <string, object> dictdata = dynData as IDictionary <string, object>;

                if (startRow.HasValue)
                {
                    dictdata[POSITION] = new List <object>()
                    {
                        ((startRow.Value + 0.5f) * -1) - 0.5f, position.ElementAtOrDefault(1)
                    };
                }

                if (flipLineIndex.HasValue)
                {
                    dynData.flipLineIndex = ((flipLineIndex.Value + 0.5f) * -1) - 0.5f;
                }

                if (localrot != null)
                {
                    List <float> rot            = localrot.Select(n => Convert.ToSingle(n)).ToList();
                    Quaternion   modifiedVector = Quaternion.Euler(rot[0], rot[1], rot[2]);
                    Vector3      vector         = new Quaternion(modifiedVector.x, modifiedVector.y * -1, modifiedVector.z * -1, modifiedVector.w).eulerAngles;
                    dictdata[LOCALROTATION] = new List <object> {
                        vector.x, vector.y, vector.z
                    };
                }

                if (rotation != null)
                {
                    if (rotation is List <object> list)
                    {
                        List <float> rot            = list.Select(n => Convert.ToSingle(n)).ToList();
                        Quaternion   modifiedVector = Quaternion.Euler(rot[0], rot[1], rot[2]);
                        Vector3      vector         = new Quaternion(modifiedVector.x, modifiedVector.y * -1, modifiedVector.z * -1, modifiedVector.w).eulerAngles;
                        dictdata[ROTATION] = new List <object> {
                            vector.x, vector.y, vector.z
                        };
                    }
                    else
                    {
                        dictdata[ROTATION] = rotation * -1;
                    }
                }
            }
        }
Beispiel #16
0
        public void OnNoteWasSpawned(NoteController noteController)
        {
            NoteData noteData = noteController.noteData;

            // Practice plugin can spawn a note multiple times when rewinding: override the controller mapping without throwing
            noteControllerMapping[noteData] = noteController;

            SetNoteDataStatus(noteData);
            statusManager.EmitStatusUpdate(ChangedProperties.NoteCut, "noteSpawned");
        }
Beispiel #17
0
    // Create a new note with the info from a previous note
    public static NoteData CreateNote(NoteData note)
    {
        NoteData new_note = CreateNote();

        new_note.hitBeat       = note.hitBeat;
        new_note.hitPosition   = note.hitPosition;
        new_note.noteDirection = note.noteDirection;

        return(new_note);
    }
Beispiel #18
0
        private void Colorize(NoteController noteController)
        {
            NoteData noteData = noteController.noteData;
            Color    color    = TechnicolorController.GetTechnicolor(
                noteData.colorType == ColorType.ColorA,
                noteData.time + noteController.GetInstanceID(),
                TechnicolorConfig.Instance.TechnicolorBlocksStyle);

            _manager.Colorize(noteController, color);
        }
Beispiel #19
0
    /// <summary>
    /// ノーツを作成する。
    /// TODO 毎回オブジェクトを生成するのはよろしくない気がするので、使い終わったノーツを使い回せるようにする。
    /// </summary>
    /// <param name="data">ノーツ情報。</param>
    /// <param name="setTimeSec">タッチポイントまでの移動にかかる時間(秒)。<</param>
    public void CreateNote(NoteData data, float setTimeSec)
    {
        GameObject obj = Instantiate(noteObj, startPos [data.StartDir], Quaternion.identity, notes.transform);

        obj.name = noteObj.name;

        Note note = obj.GetComponent <Note> ();

        note.SetStart(data, setTimeSec, endPos [data.EndDir], missTimeSec);
    }
Beispiel #20
0
 private void UpdateScore(NoteData data, NoteCutInfo info, int score)
 {
     if (data.noteType == NoteType.Bomb || !info.allIsOK)
     {
         return;
     }
     noteCutInfos.Add(info.afterCutSwingRatingCounter, info);
     info.afterCutSwingRatingCounter.didFinishEvent -= AfterCutSwingRatingCounter_didFinishEvent;
     info.afterCutSwingRatingCounter.didFinishEvent += AfterCutSwingRatingCounter_didFinishEvent;
 }
        public NoteData Update(NoteData data)
        {
            var note = MockDb.Notes
                       .Where(row => row.NoteId == data.NoteId)
                       .Single();

            Csla.Data.DataMapper.Map(data, note);

            return(data);
        }
    protected void btnSend_Click(object sender, System.EventArgs e)
    {
        ArrayList al = this.getUser();

        NoteData data = new NoteData();

        data.RegisterAdminNoteInfo(this.progCode, ViewState["subClassCode"].ToString(), comment.Value, this.progImg.ImageUrl, al);

        JS.AlertCommand("쪽지를 보냈습니다.", "window.close();");
    }
Beispiel #23
0
 private void OnNoteWasMissed(NoteData data, int score)
 {
     Plugin.Log.Debug(data.time.ToString());
     if (data.time < Configuration.PluginConfig.Instance.failTime)
     {
         Resources.FindObjectsOfTypeAll <StandardLevelGameplayManager>().LastOrDefault()?.HandleGameEnergyDidReach0();
         Resources.FindObjectsOfTypeAll <MissionLevelGameplayManager>().LastOrDefault()?.HandleGameEnergyDidReach0();
     }
     BSEvents.noteWasMissed -= OnNoteWasMissed;
 }
Beispiel #24
0
        public void OnNoteCut(NoteData data, NoteCutInfo info)
        {
            if (data.colorType == ColorType.None || !info.allIsOK)
            {
                return;
            }
            noteCutInfos.Add(info.swingRatingCounter, info);

            info.swingRatingCounter.RegisterDidFinishReceiver(this);
        }
Beispiel #25
0
 private void _redo()
 {
     CurrentData             = HotkeySystem.NewNote(mPrefabPath).GetComponent <NoteData>();
     CurrentData.Position    = mNoteData.Position;
     CurrentData.Time        = mNoteData.Time;
     CurrentData.Width       = mNoteData.Width;
     CurrentData.Direction   = mNoteData.Dir;
     CurrentData.InnerID     = mNoteData.ID;
     CurrentData.NotifyWidth = true;
 }
Beispiel #26
0
 private void BSEvents_noteWasMissed(NoteData noteData, int arg2)
 {
     if (noteData.colorType != ColorType.None)
     {
         LiveData.Combo     = 0;
         LiveData.FullCombo = false;
         LiveData.Misses++;
         LiveData.Send();
     }
 }
 public void Miss(NoteData data, int c)
 {
     if (data.noteType == NoteType.Bomb)
     {
         return;
     }
     misses++;
     notes++;
     UpdateText();
 }
 static void Prefix(ref NoteData noteData, ref Vector3 moveStartPos, ref Vector3 moveEndPos, Vector3 jumpEndPos, float moveDuration, float jumpDuration, float startTime, float jumpGravity, ref NoteController __instance, ref NoteData ____noteData, ref NoteMovement ____noteMovement, ref Action <NoteController> ___didInitEvent)
 {
     if (FuckeryUI.MegaJump.Enabled)
     {
         moveStartPos.x *= FuckeryUI.Mirror.Enabled ? -2 : 2;
         moveStartPos.y *= 100;
         moveStartPos.y += UnityEngine.Random.Range(-4, 4);
         moveEndPos.x   *= FuckeryUI.Mirror.Enabled ? -10 : 10;
     }
 }
Beispiel #29
0
 public void OnNoteCut(NoteData data, NoteCutInfo info)
 {
     if (data.noteType == NoteType.Bomb || !info.allIsOK)
     {
         return;
     }
     noteCutInfos.Add(info.swingRatingCounter, info);
     info.swingRatingCounter.didFinishEvent -= SaberSwingRatingCounter_didFinishEvent;
     info.swingRatingCounter.didFinishEvent += SaberSwingRatingCounter_didFinishEvent;
 }
 static void Prefix(ref NoteData noteData)
 {
     if (Config.noDirection)
     {
         if (noteData.cutDirection != NoteCutDirection.None)
         {
             noteData.SetNonPublicProperty("cutDirection", NoteCutDirection.Any);
         }
     }
 }
        public static void HandleControlelrNoteWasMissed(NoteData noteData, int multiplayer)
        {
            NoteInfo noteInfo = new NoteInfo(noteData.time, (int)noteData.noteType, (int)noteData.cutDirection);

            noteInfo.ConvertTime2Measure(180f);

            Logger.Write("NoteMissed");
            Logger.Write(noteData.time.ToString());
            Logger.Write(noteInfo.time.ToString());
        }
        public NoteData Fetch(NoteDataCriteria criteria)
        {
            using (var ctx = Csla.Data.ObjectContextManager<ApplicationEntities>
                         .GetManager(Database.ApplicationConnection, false))
            {
                var note = this.Fetch(ctx, criteria)
                    .Single();

                var noteData = new NoteData();

                this.Fetch(note, noteData);

                return noteData;
            }
        }
        public NoteData Insert(NoteData data)
        {
            if (MockDb.Notes.Count() == 0)
            {
                data.NoteId = 1;
            }
            else
            {
                data.NoteId = MockDb.Notes.Select(row => row.NoteId).Max() + 1;
            }

            MockDb.Notes.Add(data);

            return data;
        }
        public NoteData Fetch(NoteData data)
        {
            data.Source = MockDb.Sources
               .Where(row => row.SourceId == data.SourceId
                    && row.SourceTypeId == data.SourceTypeId)
               .Single();

            data.CreatedByUser = MockDb.Users
                .Where(row => row.UserId == data.CreatedBy)
                .Single();

            data.ModifiedByUser = MockDb.Users
                .Where(row => row.UserId == data.ModifiedBy)
                .Single();

            return data;
        }
        public NoteData[] FetchLookupInfoList(NoteDataCriteria criteria)
        {
            using (var ctx = Csla.Data.ObjectContextManager<ApplicationEntities>
                          .GetManager(Database.ApplicationConnection, false))
            {
                var notes = this.Fetch(ctx, criteria)
                    .AsEnumerable();

                var noteDataList = new List<NoteData>();

                foreach (var note in notes)
                {
                    var noteData = new NoteData();

                    this.Fetch(note, noteData);

                    noteDataList.Add(noteData);
                }

                return noteDataList.ToArray();
            }
        }
Beispiel #36
0
 internal static void Map(NoteData source, Note destination)
 {
     destination.NoteId = source.NoteId;
     destination.Body = source.Body;
     destination.IsArchived = source.IsArchived;
     destination.SourceId = source.SourceId;
     destination.SourceTypeId = source.SourceTypeId;
     destination.CreatedBy = source.CreatedBy;
     destination.CreatedDate = source.CreatedDate;
     destination.ModifiedBy = source.ModifiedBy;
     destination.ModifiedDate = source.ModifiedDate;
 }
Beispiel #37
0
		public static NoteData ToNoteData (NoteInfo noteInfo)
		{
			// NOTE: For now, we absolutely require values for
			//       Guid, Title, NoteContent, and NoteContentVersion
			// TODO: Is this true? What happens if dates are excluded?
			NoteData noteData = new NoteData (NoteUriFromGuid (noteInfo.Guid));
			noteData.Title = noteInfo.Title
				.Replace ("&amp;", "&")
				.Replace ("&lt;", "<")
				.Replace ("&gt;", ">")
				.Replace ("&quot;", "\"")
				.Replace ("&apos;", "\'");
			noteData.Text = string.Format ("<note-content version=\"{0}\">{1}\n\n{2}</note-content>",
				noteInfo.NoteContentVersion,
				noteInfo.Title,
				noteInfo.NoteContent);
			if (noteInfo.LastChangeDate.HasValue)
				noteData.ChangeDate = noteInfo.LastChangeDate.Value;
			if (noteInfo.LastMetadataChangeDate.HasValue)
				noteData.MetadataChangeDate = noteInfo.LastMetadataChangeDate.Value;
			if (noteInfo.CreateDate.HasValue)
				noteData.CreateDate = noteInfo.CreateDate.Value;
			if (noteInfo.OpenOnStartup.HasValue)
				noteData.IsOpenOnStartup = noteInfo.OpenOnStartup.Value;
			// TODO: support Pinned -- http://bugzilla.gnome.org/show_bug.cgi?id=433412

			if (noteInfo.Tags != null) {
				foreach (string tagName in noteInfo.Tags) {
					Tag tag = TagManager.GetOrCreateTag (tagName);
					noteData.Tags [tag.NormalizedName] = tag;
				}
			}

			return noteData;
		}
Beispiel #38
0
	public void AddNote(object obj, EventArgs args){

		NotesDatabase database = new NotesDatabase();
		database.QueryNoResults("INSERT INTO notes (text, color, pos_x, pos_y) VALUES ('', '#ffffff', 100, 100)");

		NoteData new_note_data = new NoteData("", RandomNoteColor(), 450, 450, database.get_last_id());
		NoteWindow new_window = new NoteWindow(new_note_data, this.background_window);
		new_window.ShowAll();
		this.note_windows.Append(new_window);

	}
        public NoteData Insert(NoteData data)
        {
            using (var ctx = Csla.Data.ObjectContextManager<ApplicationEntities>
                           .GetManager(Database.ApplicationConnection, false))
            {
                var note = new Note();

                DataMapper.Map(data, note);

                ctx.ObjectContext.AddToNotes(note);

                ctx.ObjectContext.SaveChanges();

                data.NoteId = note.NoteId;

                return data;
            }
        }
Beispiel #40
0
	public NoteWindow (NoteData note_data, Window parent) : base ("Note") {
		this.data = note_data;
		TransientFor = parent;
		DestroyWithParent = true;
		SetSizeRequest (250, 210);
		Resizable = false;
		Move(this.data.get_pos_x(), this.data.get_pos_y());
		Decorated = false;
		SkipPagerHint = true;
		SkipTaskbarHint = true;
		BorderWidth = 12;
		ConfigureEvent += window_position_changed;

		Gdk.Color note_color = new Gdk.Color();
		Gdk.Color.Parse(note_data.get_color(), ref note_color);

        ModifyBg(StateType.Normal,note_color);

		this.view = new Gtk.TextView ();
        this.view.WrapMode = Gtk.WrapMode.WordChar;
        this.view.ModifyBase( StateType.Normal,note_color);

		this.view.KeyReleaseEvent += new KeyReleaseEventHandler(this.check_deletion);

		this.buffer = this.view.Buffer;
		this.buffer.Text = this.data.get_text();
		this.buffer.Changed += this.text_change;
		this.font_size = "14";
		this.max_lines = 8;
		this.resize_font();

		//image = new Gdk.Pixbuf( "noise.png" );
		Add(view);
	}
Beispiel #41
0
	public NoteData[] FetchNotes() {
		this.OpenConnection();
		this.dbcmd.CommandText = "SELECT COUNT(id) FROM notes";
		IDataReader count_reader = dbcmd.ExecuteReader();
		count_reader.Read();
		string count = count_reader.GetString (0);
		count_reader.Close();
		NoteData[] arr = new NoteData[int.Parse(count)];

		this.dbcmd.CommandText = "SELECT * FROM notes";
		IDataReader note_reader = dbcmd.ExecuteReader();
		int row = 0;
		while(note_reader.Read()){
			arr[row] = new NoteData(
				note_reader.GetString (0),
				note_reader.GetString (1),
				int.Parse(note_reader.GetString (2)),
				int.Parse(note_reader.GetString (3)),
				int.Parse(note_reader.GetString (4))
			);
			row++;
		}

		note_reader.Close();
		note_reader = null;
		this.CloseConnection();
		return arr;
	}
Beispiel #42
0
 void stopPlaying()
 {
     synthetizer.stopNote(playing_note.Note);
     playing_note = null;
     playing = false;
 }
        private void Fetch(Note note, NoteData noteData)
        {
            DataMapper.Map(note, noteData);

            noteData.Source = new SourceData();
            DataMapper.Map(note.Source, noteData.Source);

            noteData.CreatedByUser = new UserData();
            DataMapper.Map(note.CreatedByUser, noteData.CreatedByUser);

            noteData.ModifiedByUser = new UserData();
            DataMapper.Map(note.ModifiedByUser, noteData.ModifiedByUser);
        }
        public NoteData Update(NoteData data)
        {
            var note = MockDb.Notes
                .Where(row => row.NoteId == data.NoteId)
                .Single();

            Csla.Data.DataMapper.Map(data, note);

            return data;
        }
		public void ToNoteInfoTest ()
		{
			// Note content stress tests
			string [] titles = new string [18];
			string [] contents = new string [18];
			string [] expectedInfoContents = new string [18];
			
			titles [0] = "(Untitled 238)";
			contents [0] = @"<note-content version=""0.1"">

Title Actually on Third Line

(edited before moving to third line)

<link:internal>new note 322</link:internal>

title on second lin</note-content>";
			expectedInfoContents [0] = @"Title Actually on Third Line

(edited before moving to third line)

<link:internal>new note 322</link:internal>

title on second lin";

			titles [1] = "Title on Fourth Line";
			contents [1] = @"<note-content version=""0.1"">


Title on Fourth Line

Describe your new note here.</note-content>";
			expectedInfoContents [1] = @"
Title on Fourth Line

Describe your new note here.";

			titles [2] = "New Note 322";
			contents [2] = @"<note-content version=""0.1"">
Title on second lin

(edited after moving to second line)</note-content>";
			expectedInfoContents [2] = @"Title on second lin

(edited after moving to second line)";

			titles [3] = "New Note 326";
			contents [3] = @"<note-content version=""0.1"">







New Note 326

Describe your new note here.</note-content>";
			expectedInfoContents [3] = @"





New Note 326

Describe your new note here.";

			titles [4] = "(Untitled 331)";
			contents [4] = @"<note-content version=""0.1"" />";
			expectedInfoContents [4] = string.Empty;

			titles [5] = "(Untitled 329)";
			contents [5] = @"<note-content version=""0.1"">
Text on second line added after first line totally deleted
Describe your new note here.</note-content>";
			expectedInfoContents [5] = @"Text on second line added after first line totally deleted
Describe your new note here.";

			titles [6] = "Seventy Six trombones in the big parade blah blah blah blah blah blah blah blah hlkjsfdijsdflksjf lsajfsdlj lskjf sljk lsjf sljflsjf lsjkf sljfsl slfj sljfslkjf lsjf lsjf lsj fsdlj fsdlj fsljkf sljkf slfjk slkfj slfj sldfj sljkf lsakjfslajf sljf lsfjk sl dfjlsf j";
			contents [6] = @"<note-content version=""0.1"">Seventy Six trombones in the big parade blah blah blah blah blah blah blah blah hlkjsfdijsdflksjf lsajfsdlj lskjf sljk lsjf sljflsjf lsjkf sljfsl slfj sljfslkjf lsjf lsjf lsj fsdlj fsdlj fsljkf sljkf slfjk slkfj slfj sldfj sljkf lsakjfslajf sljf lsfjk sl dfjlsf j
Title on Third Lne yeah?

(edited before moving to second line...didn't mean third)</note-content>";
			expectedInfoContents [6] = @"Title on Third Lne yeah?

(edited before moving to second line...didn't mean third)";

			titles [7] = "New Note 329";
			contents [7] = @"<note-content version=""0.1"">New Note 329

Describe your new note here.</note-content>";
			expectedInfoContents [7] = @"Describe your new note here.";

			titles [8] = "New Note 329";
			contents [8] = @"<note-content version=""0.1""><note-title>New Note 329</note-title>

Describe your new note here.</note-content>";
			expectedInfoContents [8] = @"<note-title></note-title>Describe your new note here.";

			titles [9] = "New Note 329";
			contents [9] = @"<note-content version=""0.1""><note-title><b>New Note 329</b></note-title>

Describe your new note here.</note-content>";
			expectedInfoContents [9] = @"<note-title><b></b></note-title>Describe your new note here.";

			titles [10] = "New Note 329";
			contents [10] = @"<note-content version=""0.1""><size:huge><note-title>New Note 329</note-title>

Describe your new note here.</size:huge></note-content>";
			expectedInfoContents [10] = @"<size:huge><note-title></note-title>Describe your new note here.</size:huge>";

			titles [11] = "New Note 329";
			contents [11] = @"<note-content version=""0.1""><size:huge>New Note 329

Describe your new note here.</size:huge></note-content>";
			expectedInfoContents [11] = @"<size:huge>Describe your new note here.</size:huge>";

			titles [12] = "New Note 330";
			contents [12] = @"<note-content version=""0.1"">New Note 330
Describe your new note here.</note-content>";
			expectedInfoContents [12] = @"Describe your new note here.";

			titles [13] = "New Note 331";
			contents [13] = @"<note-content version=""0.1"">New Note 331


Describe your new note here.</note-content>";
			expectedInfoContents [13] = @"
Describe your new note here.";

			titles [14] = "New Note 331";
			contents [14] = @"<note-content version="""">New Note 331

Describe your new note here.</note-content>";
			expectedInfoContents [14] = @"Describe your new note here.";

			titles [15] = "New Note 331";
			contents [15] = @"<note-content xmlns:link=""http://beatniksoftware.com/tomboy/link"" xmlns:size=""http://beatniksoftware.com/tomboy/size"" version=""0.1"">New Note 331

Describe your new note here.</note-content>";
			expectedInfoContents [15] = @"Describe your new note here.";

			titles [16] = "New Note 331";
			contents [16] = @"<note-content xmlns:link=""http://beatniksoftware.com/tomboy/link"" version=""0.1"" xmlns:size=""http://beatniksoftware.com/tomboy/size"">New Note 331

Describe your new note here.</note-content>";
			expectedInfoContents [16] = @"Describe your new note here.";

			titles [17] = "New Note 331";
			contents [17] = @"<note-content version=""0.1"" xmlns:size=""http://beatniksoftware.com/tomboy/size"">New Note 331

Describe your new note here.</note-content>";
			expectedInfoContents [17] = @"Describe your new note here.";
			

			for (int i = 0; i < titles.Length; i++) {
				NoteData data = new NoteData ("note://tomboy/12345");
				data.Title = titles [i];
				data.Text = contents [i];
				string tmpFileName = "ToNoteInfoTest.tmp";
				File.Create (tmpFileName).Close ();
				File.SetCreationTime (tmpFileName, new DateTime (2009, 1, 5));
				File.SetLastWriteTime (tmpFileName, new DateTime (2009, 1, 6));
	
				Note note = Note.CreateExistingNote (data, tmpFileName, null);
				
				NoteInfo info = NoteConvert.ToNoteInfo (note);
				Assert.AreEqual (titles [i], info.Title, "Title " + i.ToString ());
				Assert.AreEqual (expectedInfoContents [i], info.NoteContent, "NoteContent " + i.ToString ());
				Assert.AreEqual (0.1, info.NoteContentVersion.Value, "NoteContentVersion " + i.ToString ());
			}
		}
        public NoteData Update(NoteData data)
        {
            using (var ctx = Csla.Data.ObjectContextManager<ApplicationEntities>
                         .GetManager(Database.ApplicationConnection, false))
            {
                var note =
                    new Note
                    {
                        NoteId = data.NoteId
                    };

                ctx.ObjectContext.Notes.Attach(note);

                DataMapper.Map(data, note);

                ctx.ObjectContext.SaveChanges();

                return data;
            }
        }