private void SaveBT_Click(object sender, EventArgs e) { SaveFileDialog sfd = new SaveFileDialog(); sfd.FileName = ""; sfd.InitialDirectory = @"C:\"; sfd.Filter = "Windows Play List(*.wpl)|*.wpl|All Files(*.*)|*.*"; sfd.FilterIndex = 1; sfd.Title = "Please select a file destination"; sfd.RestoreDirectory = true; sfd.OverwritePrompt = true; sfd.CheckPathExists = true; //Create WPL File. //First argument: Path of file to be saved //Second argument: ArrayList of the MediaList if (sfd.ShowDialog() == DialogResult.OK) { WPLLib.Writer wplWrite = new Writer(sfd.FileName); foreach (string filePath in MusicList.Items) { wplWrite.Add(filePath); } wplWrite.Write(); } }
protected override async Task Handle(GenreCreated notification) { var view = new GenreReadModel { Id = notification.Id, Name = notification.Name }; await Writer.Add(view); }
protected override async Task Handle(RegionCreated notification) { var view = new RegionReadModel { Id = notification.Id, Name = notification.Name, GroupIds = new List <string>() }; await Writer.Add(view); }
protected override async Task Handle(AccountRegistered e) { var view = new AccountReadModel { Id = e.Id, BuddyId = e.BuddyId, Password = e.Password }; await Writer.Add(view); }
protected override async Task Handle(BuddyCreated notification) { var view = new BuddyReadModel { Id = notification.Id, AccountId = notification.AccountId, GenreIds = new List <string>(), Tasks = new List <Domain.Task>() }; await Writer.Add(view); }
protected override async Task Handle(GroupCreated notification) { var view = new GroupReadModel { Id = notification.Id, RegionId = notification.RegionId, GenreIds = notification.GenreIds, BuddyIds = new List <string>() }; await Writer.Add(view); }
public void TestAdd() { string connectionString = "some string"; int interval = 100; Writer writer = new Writer(connectionString, interval); Registry registry = new Registry(); writer.Add(registry); var report = GetInstanceField(typeof(Writer), writer, "_report") as IList <Registry>; Assert.IsNotNull(report, "report != null"); Assert.IsTrue(report.Contains(registry), "report.Contains(registry)"); Assert.IsTrue(report.Count == 1, "report.Count == 1"); }
/// <summary> /// 添加节点 /// </summary> /// <param name="node"></param> public void Add(params IHtmlNode[] node) { Writer.Add(node); }
static void Main(string[] args) { while (true) { Console.WriteLine("╔════════════╤══════════════════════════════╗"); Console.WriteLine(" Hot key │ Function "); Console.WriteLine("╠════════════╪══════════════════════════════╣"); Console.WriteLine(" A │ Add new concert "); Console.WriteLine("╠════════════╪══════════════════════════════╣"); Console.WriteLine(" C │ Change concert "); Console.WriteLine("╠════════════╪══════════════════════════════╣"); Console.WriteLine(" D │ Delete concert "); Console.WriteLine("╠════════════╪══════════════════════════════╣"); Console.WriteLine(" T │ Show all concerts "); Console.WriteLine("╠════════════╪══════════════════════════════╣"); Console.WriteLine(" H │ All listeners "); Console.WriteLine("╠════════════╪══════════════════════════════╣"); Console.WriteLine(" P │ Lenth of surname"); Console.WriteLine("╠════════════╪══════════════════════════════╣"); Console.WriteLine(" M │ Day with the least listeners"); Console.WriteLine("╠════════════╪══════════════════════════════╣"); Console.WriteLine(" Space │ Clear console "); Console.WriteLine("╠════════════╪══════════════════════════════╣"); Console.WriteLine(" Esc │ Exit program "); Console.WriteLine("╚════════════╧══════════════════════════════╝"); if (!File.Exists(FileName)) { File.Create(FileName).Close(); } var Writer = JsonConvert.DeserializeObject <List <Concert> >(File.ReadAllText(FilePath)); Concert cp = new Concert(); switch (Console.ReadKey().Key) { case ConsoleKey.A: if (Writer == null) { Writer = new List <Concert>(); Writer.Add(CreateNewDay()); } else { Writer.Add(CreateNewDay()); } break; case ConsoleKey.C: ChangeData(Writer); break; case ConsoleKey.D: DelteDay(Writer); break; case ConsoleKey.T: ShowAll(Writer); break; case ConsoleKey.Escape: Environment.Exit(0); break; case ConsoleKey.H: cp.ListenersCount(Writer); break; case ConsoleKey.P: SurnLen(Writer); break; case ConsoleKey.M: cp.DayWithLow(Writer); break; case ConsoleKey.Spacebar: Console.Clear(); break; } string serialize = JsonConvert.SerializeObject(Writer, Formatting.Indented); if (serialize.Count() > 1) { if (!File.Exists(FileName)) { File.Create(FileName).Close(); } File.WriteAllText(FilePath, serialize, Encoding.UTF8); } } }
private void generateColoredBytes(DepthImageFrame depthFrame) { if (mDepthData == null || mDepthData.Length != depthFrame.PixelDataLength) { mDepthData = new short[depthFrame.PixelDataLength]; if (WRITER_ON) { mFileFrameBuffer = new short[depthFrame.PixelDataLength]; } } if (mFileFrameBuffer == null) { if (WRITER_ON) { mFileFrameBuffer = new short[depthFrame.PixelDataLength]; } } depthFrame.CopyPixelDataTo(mDepthData); const int BlueIndex = 0; const int GreenIndex = 1; const int RedIndex = 2; int player = 0; short depth = 0; //byte intensity = 0; for (int depthIndex = 0, colorIndex = 0; depthIndex < mDepthData.Length && colorIndex < mPxData.Length; depthIndex++, colorIndex += 4) { player = mDepthData[depthIndex] & DepthImageFrame.PlayerIndexBitmask; depth = (short)(mDepthData[depthIndex] >> DepthImageFrame.PlayerIndexBitmaskWidth); //intensity = getIntensity(depth); if (player > 0) { mPxData[colorIndex + BlueIndex] = 14; mPxData[colorIndex + GreenIndex] = 201; mPxData[colorIndex + RedIndex] = 255; if (WRITER_ON) { mFileFrameBuffer[depthIndex] = depth; } } else { mPxData[colorIndex + BlueIndex] = 0; mPxData[colorIndex + GreenIndex] = 0; mPxData[colorIndex + RedIndex] = 0; if (WRITER_ON) { mFileFrameBuffer[depthIndex] = -1; } } } if (WRITER_ON) { mWT.Add(mFileFrameBuffer, mGraphIndex); mGraphIndex++; } }