public frmHardCopyOptions() { // // Required for Windows Form Designer support // InitializeComponent(); string FakeUDN = "DBF54A20-3C3F-477c-A15D-84673C1DDF3B"; NoDevice = Intel.UPNP.UPnPDevice.CreateEmbeddedDevice((double)1,FakeUDN); NoDevice.FriendlyName = "No Device Selected"; NoDevice.SerialNumber = "N/A"; cboOysterDevice.Items.Add(NoDevice); disco = new OysterDeviceDiscovery(); disco.OnAddedDevice += new OysterDeviceDiscovery.DiscoveryHandler(AddSink); disco.OnRemovedDevice += new OysterDeviceDiscovery.DiscoveryHandler(RemoveSink); m_HardCopyOptions = new HardCopyOptions(HardCopyOptions.SaveType.ToRegistry); // // TODO: Add any constructor code after InitializeComponent call // }
private static void WriteToFile(HardCopyOptions This, ref bool bWritten) { if (System.IO.File.Exists(This.m_sPathFileToSave)) { System.Runtime.Serialization.Formatters.Binary.BinaryFormatter formatter = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter(); bWritten = true; formatter.Serialize(new System.IO.FileStream(This.m_sPathFileToSave, System.IO.FileMode.OpenOrCreate),This); } else { throw new System.IO.FileNotFoundException("File was not found.",This.m_sPathFileToSave); } }
public void Save(HardCopyOptions.SaveType HowToSave) { System.Diagnostics.Debug.Assert(HowToSave == HardCopyOptions.SaveType.ToRegistry,"Only Registry save is supported."); switch (HowToSave) { case HardCopyOptions.SaveType.ToRegistry: WriteToRegistry(); break; case HardCopyOptions.SaveType.ToFile: WriteToFile(this,ref m_bHasBeenSaved); break; case HardCopyOptions.SaveType.ToRegistryAndFile: WriteToRegistry(); WriteToFile(this,ref m_bHasBeenSaved); break; } }
private static void ReadFromFile(HardCopyOptions This, string PathFile) { if (System.IO.File.Exists(PathFile)) { System.Runtime.Serialization.Formatters.Binary.BinaryFormatter formatter = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter(); formatter.Serialize(new System.IO.FileStream(PathFile, System.IO.FileMode.OpenOrCreate),This); } else { throw new System.IO.FileNotFoundException("File was not found.",PathFile); } }
public HardCopyOptions(HardCopyOptions.SaveType OptionsSaveType) { System.Diagnostics.Debug.Assert(OptionsSaveType == HardCopyOptions.SaveType.ToRegistry,"Only Registry save is supported."); // System.Reflection.AssemblyTitleAttribute ata = (System.Reflection.AssemblyTitleAttribute) // System.Attribute.GetCustomAttribute(System.Reflection.Assembly.GetAssembly(typeof(DesktopRecorder.HardCopyOptions)), // typeof(System.Reflection.AssemblyTitleAttribute)); switch (OptionsSaveType) { case HardCopyOptions.SaveType.ToRegistry: ClassInit("OysterMini",13075,10904,"N/A","N/A","No Devices Present",System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal) + @"\Oyster\" + CarverLabUtility.AppInfo.Title + @"\Temp",false,OCL.OysterRecordingSessionSearchType.Title,"N/A","N/A"); break; case HardCopyOptions.SaveType.ToFile: HardCopyOptions.ReadFromFile(this,"HardCopyOptions.dat"); break; case HardCopyOptions.SaveType.ToRegistryAndFile: ClassInit("OysterMini",13075,10904,"N/A","N/A","No Devices Present",System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal) + @"\Oyster\" + CarverLabUtility.AppInfo.Title + @"\Temp",false,OCL.OysterRecordingSessionSearchType.Title,"N/A","N/A"); break; } }