public MainForm() { m_versions = new VersionStorage(); m_client = new ClientImpl(); m_client.ClientLoaded += new EventHandler(ClientLoaded_Handler); m_client.ProgressChanged += new ProgressHandler(ClientProgressChanged_Handler); m_worker = new BackgroundWorker(); m_worker.WorkerReportsProgress = true; m_worker.DoWork += new DoWorkEventHandler(DoWork_Handler); m_worker.ProgressChanged += new ProgressChangedEventHandler(ProgressChanged_Handler); m_worker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(RunWorkerCompleted_Handler); InitializeComponent(); LoadVersions(); obdVersionComboBox.Items.Add(ObdVersion.Version1); obdVersionComboBox.Items.Add(ObdVersion.Version2); obdVersionComboBox.SelectedIndex = 0; itemsListBox.Client = m_client; outfitsListBox.Client = m_client; effectsListBox.Client = m_client; missilesListBox.Client = m_client; thingTypeListBox.Client = m_client; saveButton.Enabled = false; }
public override void Refresh() { // Primitives are immutable if (IsPrimitive) { return; } // Update each field, this will make sure its type is still up to date var fields = Fields; for (var i = 0; i < fields.Count; i++) { fields[i].Refresh(Registry); } var typeCodeVersion = VersionStorage.GetVersion(s_TypeCodeProperty, this); var fieldsVersion = VersionStorage.GetVersion(s_FieldsProperty, this); if (m_DefaultValue.TypeCodeVersion != typeCodeVersion) { // Rebuild the default value property if (null != m_DefaultValueProperty) { m_PropertyBag.RemoveProperty(m_DefaultValueProperty); } m_DefaultValueProperty = CreateDefaultValueProperty(TypeCode); if (null == m_DefaultValue.Object) { // @TODO Overload constructor m_DefaultValue.Object = new UTinyObject(Registry, (Reference)this, this, false) { IsDefaultValue = true }; } m_DefaultValue.Object.Refresh(); if (null != m_DefaultValueProperty) { m_PropertyBag.AddProperty(m_DefaultValueProperty); } } else if (!IsPrimitive && (m_DefaultValue.FieldsVersion != fieldsVersion || m_DefaultValue.ObjectVersion != m_DefaultValue.Object?.Version)) { m_DefaultValue.Object?.Refresh(); } else { return; } m_DefaultValue.ObjectVersion = m_DefaultValue.Object?.Version ?? -0; m_DefaultValue.TypeCodeVersion = typeCodeVersion; m_DefaultValue.FieldsVersion = fieldsVersion; }
private bool SaveKnxUiProject(string fileName) { Cursor = Cursors.WaitCursor; bool result = false; try { VersionStorage.Save(); // 保存项目文件的版本信息。 this.ucdo.SaveNode(); // 保存界面到JSON文件 GroupAddressStorage.Save(); // 保存组地址到JSON文件 // 是否指定了项目文件名 if (fileName == MyConst.DefaultKnxUiProjectName) { var myDialog = new SaveFileDialog(); myDialog.InitialDirectory = MyCache.DefaultKnxProjectFolder; myDialog.OverwritePrompt = true; myDialog.FileName = MyConst.DefaultKnxUiProjectName; myDialog.DefaultExt = MyConst.KnxUiEditorFileExt; myDialog.Filter = KnxFilter; myDialog.FilterIndex = 1; myDialog.RestoreDirectory = true; var myResult = myDialog.ShowDialog(this); if (DialogResult.OK == myResult) { ProjectFile = myDialog.FileName; ZipProject(this.ProjectFile); result = true; } } else { ZipProject(this.ProjectFile); result = true; } } catch (Exception ex) { string errorMsg = ResourceMng.GetString("Message5") + " " + "exception message: " + ex.Message; MessageBox.Show(errorMsg, ResourceMng.GetString("Message6"), MessageBoxButtons.OK, MessageBoxIcon.Error); Log.Error(errorMsg + LogHelper.Format(ex)); } finally { Cursor = Cursors.Default; } if (result) // 保存成功 { ProjectSaved(); } return(result); }
public void CopyFrom(UTinyTextureSettings other) { base.CopyFrom(other); m_FormatType = other.m_FormatType; m_JpgCompressionQuality = other.m_JpgCompressionQuality; m_WebPCompressionQuality = other.m_WebPCompressionQuality; VersionStorage.IncrementVersion(null, this); }
public void VersionStorage_SavesCorrectly() { var msut = new MockVersionStorage("itsamock"); VersionStorage sut = msut; var cv = new CompleteVersion(new VersionUnit("1"), new VersionUnit("1"), new VersionUnit("1"), new VersionUnit("1")); sut.Persist(cv); Assert.True(msut.PersistWasCalled, "The persist method was not called"); Assert.Equal("1111", msut.VersionStringPersisted); }
private void LoadVersions() { try { this.versions = new VersionStorage(); this.versions.Load(@"versions.xml"); } catch (Exception ex) { MessageBox.Show(ex.Message); return; } this.inputVersionComboBox.Items.AddRange(this.versions.GetAllVersions()); this.inputVersionComboBox.SelectedIndex = 0; this.outputVersionComboBox.Items.AddRange(this.versions.GetAllVersions()); this.outputVersionComboBox.SelectedIndex = 0; }
/// <summary> /// Most of the versioning approaches require a version store of some sort. This initialises the version store from the command line using the /// initialisation data that is passed in to determine which version store to load. /// </summary> private static void GetVersionStorageFromCommandLine() { if (!options.VersionPersistanceValue.Contains("|")) { // Default to file based using a filepath. storage = new JsonVersionPersister(options.VersionPersistanceValue); } else { string pluginName = options.VersionPersistanceValue.Substring(0, options.VersionPersistanceValue.IndexOf('|')); if (!pluginName.EndsWith("-plugin")) { pluginName += "-plugin"; } string assemblyName = Path.Combine(Environment.CurrentDirectory, pluginName); assemblyName = Path.ChangeExtension(assemblyName, ".dll"); if (!File.Exists(assemblyName)) { throw new FileNotFoundException($"The versioning plugin {pluginName} could not be found", assemblyName); } } }
private void tsmiSaveAs_Click(object sender, EventArgs e) { SaveFileDialog saveFileDialog = new SaveFileDialog(); saveFileDialog.Filter = KnxFilter; saveFileDialog.FilterIndex = 0; saveFileDialog.RestoreDirectory = true; if (saveFileDialog.ShowDialog() == DialogResult.OK) { if (!string.IsNullOrEmpty(saveFileDialog.FileName)) { Cursor = Cursors.WaitCursor; try { VersionStorage.Save(); // 保存项目文件的版本信息。 this.ucdo.SaveNode(); // 保存界面到JSON文件 GroupAddressStorage.Save(); // 保存组地址到JSON文件 ZipProject(saveFileDialog.FileName); ProjectSaved(); } catch (Exception ex) { string errorMsg = ResourceMng.GetString("Message5") + " " + "exception message: " + ex.Message; MessageBox.Show(errorMsg, ResourceMng.GetString("Message6"), MessageBoxButtons.OK, MessageBoxIcon.Error); Log.Error(errorMsg + LogHelper.Format(ex)); } finally { Cursor = Cursors.Default; } } } }
public void CopyFrom(UTinyAudioClipSettings other) { base.CopyFrom(other); VersionStorage.IncrementVersion(null, this); }
public MockVersioning(VersionStorage vs) : base(vs) { Mock = new Mocking(this); }
public void CopyFrom(UTinyGenericAssetExportSettings other) { base.CopyFrom(other); VersionStorage.IncrementVersion(null, this); }