commit c8cb41fecfd04d7ccce08e6bbd0adb0d866d6f15 Author: Eugen Höglinger Date: Thu Feb 27 15:06:19 2020 +0100 Projekt neu angelegt. diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..5a5f80a --- /dev/null +++ b/.gitignore @@ -0,0 +1,32 @@ + +#Ignore thumbnails created by Windows +Thumbs.db +#Ignore files built by Visual Studio +*.obj +*.exe +*.pdb +*.user +*.aps +*.pch +*.vspscc +*_i.c +*_p.c +*.ncb +*.suo +*.tlb +*.tlh +*.bak +*.cache +*.ilk +*.log +[Bb]in +[Dd]ebug*/ +*.lib +*.sbr +obj/ +[Rr]elease*/ +_ReSharper*/ +[Tt]est[Rr]esult* +.vs/ +#Nuget packages folder +packages/ diff --git a/LocalSynchronizationSetup.sln b/LocalSynchronizationSetup.sln new file mode 100644 index 0000000..e68b623 --- /dev/null +++ b/LocalSynchronizationSetup.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.28010.2041 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LocalSynchronizationSetup", "LocalSynchronizationSetup\LocalSynchronizationSetup.csproj", "{E725F0A2-755F-4A90-A9ED-C69EA20C5621}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {E725F0A2-755F-4A90-A9ED-C69EA20C5621}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E725F0A2-755F-4A90-A9ED-C69EA20C5621}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E725F0A2-755F-4A90-A9ED-C69EA20C5621}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E725F0A2-755F-4A90-A9ED-C69EA20C5621}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {6B47EB17-1F0A-4AD7-9863-FC933D5C73B5} + EndGlobalSection +EndGlobal diff --git a/LocalSynchronizationSetup/App.config b/LocalSynchronizationSetup/App.config new file mode 100644 index 0000000..731f6de --- /dev/null +++ b/LocalSynchronizationSetup/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/LocalSynchronizationSetup/DlgLocalSynchronizationSetup.Designer.cs b/LocalSynchronizationSetup/DlgLocalSynchronizationSetup.Designer.cs new file mode 100644 index 0000000..4facfe2 --- /dev/null +++ b/LocalSynchronizationSetup/DlgLocalSynchronizationSetup.Designer.cs @@ -0,0 +1,495 @@ +namespace LocalSynchronizationSetup +{ + partial class DlgLocalSynchronizationSetup + { + /// + /// Erforderliche Designervariable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Verwendete Ressourcen bereinigen. + /// + /// True, wenn verwaltete Ressourcen gelöscht werden sollen; andernfalls False. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Vom Windows Form-Designer generierter Code + + /// + /// Erforderliche Methode für die Designerunterstützung. + /// Der Inhalt der Methode darf nicht mit dem Code-Editor geändert werden. + /// + private void InitializeComponent() + { + this.menuStrip1 = new System.Windows.Forms.MenuStrip(); + this.infoToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.showSynchronizationInfoToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); + this.aboutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.bnCreateRemoveSynchronisation = new System.Windows.Forms.Button(); + this.bnRunSynchronization = new System.Windows.Forms.Button(); + this.bnCancel = new System.Windows.Forms.Button(); + this.label6 = new System.Windows.Forms.Label(); + this.lbStartuppath = new System.Windows.Forms.Label(); + this.groupBox5 = new System.Windows.Forms.GroupBox(); + this.lbNxPortalSyncStatus = new System.Windows.Forms.Label(); + this.rBCreateNxPortalSync = new System.Windows.Forms.RadioButton(); + this.label11 = new System.Windows.Forms.Label(); + this.rBRemoveNxPortalSync = new System.Windows.Forms.RadioButton(); + this.rBNoActionNxPortalSync = new System.Windows.Forms.RadioButton(); + this.groupBox4 = new System.Windows.Forms.GroupBox(); + this.lbNxMachineryLibrarySyncStatus = new System.Windows.Forms.Label(); + this.label4 = new System.Windows.Forms.Label(); + this.rBNoActionNxMachineryLibrarySync = new System.Windows.Forms.RadioButton(); + this.rBRemoveNxMachineryLibrarySync = new System.Windows.Forms.RadioButton(); + this.rBCreateNxMachineryLibrarySync = new System.Windows.Forms.RadioButton(); + this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.label3 = new System.Windows.Forms.Label(); + this.lbNxEnvironmentSyncStatus = new System.Windows.Forms.Label(); + this.rBNoActionNxEnvironmentSync = new System.Windows.Forms.RadioButton(); + this.rBRemoveNxEnvironmentSync = new System.Windows.Forms.RadioButton(); + this.rBCreateNxEnvironmentSync = new System.Windows.Forms.RadioButton(); + this.groupBox2 = new System.Windows.Forms.GroupBox(); + this.label5 = new System.Windows.Forms.Label(); + this.rBCreateModul3DSync = new System.Windows.Forms.RadioButton(); + this.rBRemoveModul3DSync = new System.Windows.Forms.RadioButton(); + this.lbModul3DSyncStatus = new System.Windows.Forms.Label(); + this.rBNoActionModul3DSync = new System.Windows.Forms.RadioButton(); + this.menuStrip1.SuspendLayout(); + this.groupBox5.SuspendLayout(); + this.groupBox4.SuspendLayout(); + this.groupBox1.SuspendLayout(); + this.groupBox2.SuspendLayout(); + this.SuspendLayout(); + // + // menuStrip1 + // + this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.infoToolStripMenuItem}); + this.menuStrip1.Location = new System.Drawing.Point(0, 0); + this.menuStrip1.Name = "menuStrip1"; + this.menuStrip1.Size = new System.Drawing.Size(489, 24); + this.menuStrip1.TabIndex = 0; + this.menuStrip1.Text = "menuStrip1"; + // + // infoToolStripMenuItem + // + this.infoToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.showSynchronizationInfoToolStripMenuItem, + this.toolStripSeparator1, + this.aboutToolStripMenuItem}); + this.infoToolStripMenuItem.Name = "infoToolStripMenuItem"; + this.infoToolStripMenuItem.Size = new System.Drawing.Size(40, 20); + this.infoToolStripMenuItem.Text = "Info"; + // + // showSynchronizationInfoToolStripMenuItem + // + this.showSynchronizationInfoToolStripMenuItem.Name = "showSynchronizationInfoToolStripMenuItem"; + this.showSynchronizationInfoToolStripMenuItem.Size = new System.Drawing.Size(215, 22); + this.showSynchronizationInfoToolStripMenuItem.Text = "Show Synchronization Info"; + this.showSynchronizationInfoToolStripMenuItem.Click += new System.EventHandler(this.showSynchronizationInfoToolStripMenuItem_Click); + // + // toolStripSeparator1 + // + this.toolStripSeparator1.Name = "toolStripSeparator1"; + this.toolStripSeparator1.Size = new System.Drawing.Size(212, 6); + // + // aboutToolStripMenuItem + // + this.aboutToolStripMenuItem.Name = "aboutToolStripMenuItem"; + this.aboutToolStripMenuItem.Size = new System.Drawing.Size(215, 22); + this.aboutToolStripMenuItem.Text = "About"; + this.aboutToolStripMenuItem.Click += new System.EventHandler(this.aboutToolStripMenuItem_Click); + // + // bnCreateRemoveSynchronisation + // + this.bnCreateRemoveSynchronisation.Location = new System.Drawing.Point(12, 264); + this.bnCreateRemoveSynchronisation.Name = "bnCreateRemoveSynchronisation"; + this.bnCreateRemoveSynchronisation.Size = new System.Drawing.Size(175, 41); + this.bnCreateRemoveSynchronisation.TabIndex = 1; + this.bnCreateRemoveSynchronisation.Text = "Create/Remove Synchronization"; + this.bnCreateRemoveSynchronisation.UseVisualStyleBackColor = true; + this.bnCreateRemoveSynchronisation.Click += new System.EventHandler(this.bnCreateRemoveSynchronisation_Click); + // + // bnRunSynchronization + // + this.bnRunSynchronization.Location = new System.Drawing.Point(193, 264); + this.bnRunSynchronization.Name = "bnRunSynchronization"; + this.bnRunSynchronization.Size = new System.Drawing.Size(175, 41); + this.bnRunSynchronization.TabIndex = 2; + this.bnRunSynchronization.Text = "Run Synchronization Now"; + this.bnRunSynchronization.UseVisualStyleBackColor = true; + this.bnRunSynchronization.Click += new System.EventHandler(this.bnRunSynchronization_Click); + // + // bnCancel + // + this.bnCancel.Location = new System.Drawing.Point(374, 264); + this.bnCancel.Name = "bnCancel"; + this.bnCancel.Size = new System.Drawing.Size(103, 41); + this.bnCancel.TabIndex = 3; + this.bnCancel.Text = "Cancel"; + this.bnCancel.UseVisualStyleBackColor = true; + this.bnCancel.Click += new System.EventHandler(this.bnCancel_Click); + // + // label6 + // + this.label6.AutoSize = true; + this.label6.Location = new System.Drawing.Point(9, 34); + this.label6.Name = "label6"; + this.label6.Size = new System.Drawing.Size(89, 13); + this.label6.TabIndex = 4; + this.label6.Text = "Startup Directory:"; + // + // lbStartuppath + // + this.lbStartuppath.AutoSize = true; + this.lbStartuppath.Location = new System.Drawing.Point(104, 34); + this.lbStartuppath.MaximumSize = new System.Drawing.Size(380, 0); + this.lbStartuppath.Name = "lbStartuppath"; + this.lbStartuppath.Size = new System.Drawing.Size(65, 13); + this.lbStartuppath.TabIndex = 5; + this.lbStartuppath.Text = "Startup path"; + // + // groupBox5 + // + this.groupBox5.Controls.Add(this.lbNxPortalSyncStatus); + this.groupBox5.Controls.Add(this.rBCreateNxPortalSync); + this.groupBox5.Controls.Add(this.label11); + this.groupBox5.Controls.Add(this.rBRemoveNxPortalSync); + this.groupBox5.Controls.Add(this.rBNoActionNxPortalSync); + this.groupBox5.Location = new System.Drawing.Point(12, 207); + this.groupBox5.Name = "groupBox5"; + this.groupBox5.Size = new System.Drawing.Size(465, 40); + this.groupBox5.TabIndex = 6; + this.groupBox5.TabStop = false; + this.groupBox5.Text = "NX-Portal"; + // + // lbNxPortalSyncStatus + // + this.lbNxPortalSyncStatus.AutoSize = true; + this.lbNxPortalSyncStatus.Location = new System.Drawing.Point(306, 19); + this.lbNxPortalSyncStatus.Name = "lbNxPortalSyncStatus"; + this.lbNxPortalSyncStatus.Size = new System.Drawing.Size(109, 13); + this.lbNxPortalSyncStatus.TabIndex = 4; + this.lbNxPortalSyncStatus.Text = "Sync. Proc. not exists"; + // + // rBCreateNxPortalSync + // + this.rBCreateNxPortalSync.AutoSize = true; + this.rBCreateNxPortalSync.Location = new System.Drawing.Point(6, 17); + this.rBCreateNxPortalSync.Name = "rBCreateNxPortalSync"; + this.rBCreateNxPortalSync.Size = new System.Drawing.Size(56, 17); + this.rBCreateNxPortalSync.TabIndex = 0; + this.rBCreateNxPortalSync.TabStop = true; + this.rBCreateNxPortalSync.Text = "Create"; + this.rBCreateNxPortalSync.UseVisualStyleBackColor = true; + // + // label11 + // + this.label11.AutoSize = true; + this.label11.Location = new System.Drawing.Point(260, 19); + this.label11.Name = "label11"; + this.label11.Size = new System.Drawing.Size(40, 13); + this.label11.TabIndex = 3; + this.label11.Text = "Status:"; + // + // rBRemoveNxPortalSync + // + this.rBRemoveNxPortalSync.AutoSize = true; + this.rBRemoveNxPortalSync.Location = new System.Drawing.Point(86, 17); + this.rBRemoveNxPortalSync.Name = "rBRemoveNxPortalSync"; + this.rBRemoveNxPortalSync.Size = new System.Drawing.Size(65, 17); + this.rBRemoveNxPortalSync.TabIndex = 1; + this.rBRemoveNxPortalSync.TabStop = true; + this.rBRemoveNxPortalSync.Text = "Remove"; + this.rBRemoveNxPortalSync.UseVisualStyleBackColor = true; + // + // rBNoActionNxPortalSync + // + this.rBNoActionNxPortalSync.AutoSize = true; + this.rBNoActionNxPortalSync.Checked = true; + this.rBNoActionNxPortalSync.Location = new System.Drawing.Point(168, 17); + this.rBNoActionNxPortalSync.Name = "rBNoActionNxPortalSync"; + this.rBNoActionNxPortalSync.Size = new System.Drawing.Size(71, 17); + this.rBNoActionNxPortalSync.TabIndex = 2; + this.rBNoActionNxPortalSync.TabStop = true; + this.rBNoActionNxPortalSync.Text = "No action"; + this.rBNoActionNxPortalSync.UseVisualStyleBackColor = true; + // + // groupBox4 + // + this.groupBox4.Controls.Add(this.lbNxMachineryLibrarySyncStatus); + this.groupBox4.Controls.Add(this.label4); + this.groupBox4.Controls.Add(this.rBNoActionNxMachineryLibrarySync); + this.groupBox4.Controls.Add(this.rBRemoveNxMachineryLibrarySync); + this.groupBox4.Controls.Add(this.rBCreateNxMachineryLibrarySync); + this.groupBox4.Location = new System.Drawing.Point(12, 160); + this.groupBox4.Name = "groupBox4"; + this.groupBox4.Size = new System.Drawing.Size(465, 40); + this.groupBox4.TabIndex = 7; + this.groupBox4.TabStop = false; + this.groupBox4.Text = "NX_Machinery_Library"; + // + // lbNxMachineryLibrarySyncStatus + // + this.lbNxMachineryLibrarySyncStatus.AutoSize = true; + this.lbNxMachineryLibrarySyncStatus.Location = new System.Drawing.Point(306, 19); + this.lbNxMachineryLibrarySyncStatus.Name = "lbNxMachineryLibrarySyncStatus"; + this.lbNxMachineryLibrarySyncStatus.Size = new System.Drawing.Size(109, 13); + this.lbNxMachineryLibrarySyncStatus.TabIndex = 5; + this.lbNxMachineryLibrarySyncStatus.Text = "Sync. Proc. not exists"; + // + // label4 + // + this.label4.AutoSize = true; + this.label4.Location = new System.Drawing.Point(260, 19); + this.label4.Name = "label4"; + this.label4.Size = new System.Drawing.Size(40, 13); + this.label4.TabIndex = 4; + this.label4.Text = "Status:"; + // + // rBNoActionNxMachineryLibrarySync + // + this.rBNoActionNxMachineryLibrarySync.AutoSize = true; + this.rBNoActionNxMachineryLibrarySync.Checked = true; + this.rBNoActionNxMachineryLibrarySync.Location = new System.Drawing.Point(168, 17); + this.rBNoActionNxMachineryLibrarySync.Name = "rBNoActionNxMachineryLibrarySync"; + this.rBNoActionNxMachineryLibrarySync.Size = new System.Drawing.Size(71, 17); + this.rBNoActionNxMachineryLibrarySync.TabIndex = 3; + this.rBNoActionNxMachineryLibrarySync.TabStop = true; + this.rBNoActionNxMachineryLibrarySync.Text = "No action"; + this.rBNoActionNxMachineryLibrarySync.UseVisualStyleBackColor = true; + // + // rBRemoveNxMachineryLibrarySync + // + this.rBRemoveNxMachineryLibrarySync.AutoSize = true; + this.rBRemoveNxMachineryLibrarySync.Location = new System.Drawing.Point(86, 18); + this.rBRemoveNxMachineryLibrarySync.Name = "rBRemoveNxMachineryLibrarySync"; + this.rBRemoveNxMachineryLibrarySync.Size = new System.Drawing.Size(65, 17); + this.rBRemoveNxMachineryLibrarySync.TabIndex = 2; + this.rBRemoveNxMachineryLibrarySync.TabStop = true; + this.rBRemoveNxMachineryLibrarySync.Text = "Remove"; + this.rBRemoveNxMachineryLibrarySync.UseVisualStyleBackColor = true; + // + // rBCreateNxMachineryLibrarySync + // + this.rBCreateNxMachineryLibrarySync.AutoSize = true; + this.rBCreateNxMachineryLibrarySync.Location = new System.Drawing.Point(6, 17); + this.rBCreateNxMachineryLibrarySync.Name = "rBCreateNxMachineryLibrarySync"; + this.rBCreateNxMachineryLibrarySync.Size = new System.Drawing.Size(56, 17); + this.rBCreateNxMachineryLibrarySync.TabIndex = 1; + this.rBCreateNxMachineryLibrarySync.TabStop = true; + this.rBCreateNxMachineryLibrarySync.Text = "Create"; + this.rBCreateNxMachineryLibrarySync.UseVisualStyleBackColor = true; + // + // groupBox1 + // + this.groupBox1.Controls.Add(this.label3); + this.groupBox1.Controls.Add(this.lbNxEnvironmentSyncStatus); + this.groupBox1.Controls.Add(this.rBNoActionNxEnvironmentSync); + this.groupBox1.Controls.Add(this.rBRemoveNxEnvironmentSync); + this.groupBox1.Controls.Add(this.rBCreateNxEnvironmentSync); + this.groupBox1.Location = new System.Drawing.Point(12, 68); + this.groupBox1.Name = "groupBox1"; + this.groupBox1.Size = new System.Drawing.Size(465, 40); + this.groupBox1.TabIndex = 8; + this.groupBox1.TabStop = false; + this.groupBox1.Text = "NX_Environment"; + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Location = new System.Drawing.Point(260, 19); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(40, 13); + this.label3.TabIndex = 5; + this.label3.Text = "Status:"; + // + // lbNxEnvironmentSyncStatus + // + this.lbNxEnvironmentSyncStatus.AutoSize = true; + this.lbNxEnvironmentSyncStatus.Location = new System.Drawing.Point(306, 19); + this.lbNxEnvironmentSyncStatus.Name = "lbNxEnvironmentSyncStatus"; + this.lbNxEnvironmentSyncStatus.Size = new System.Drawing.Size(109, 13); + this.lbNxEnvironmentSyncStatus.TabIndex = 4; + this.lbNxEnvironmentSyncStatus.Text = "Sync. Proc. not exists"; + // + // rBNoActionNxEnvironmentSync + // + this.rBNoActionNxEnvironmentSync.AutoSize = true; + this.rBNoActionNxEnvironmentSync.Checked = true; + this.rBNoActionNxEnvironmentSync.Location = new System.Drawing.Point(168, 17); + this.rBNoActionNxEnvironmentSync.Name = "rBNoActionNxEnvironmentSync"; + this.rBNoActionNxEnvironmentSync.Size = new System.Drawing.Size(71, 17); + this.rBNoActionNxEnvironmentSync.TabIndex = 3; + this.rBNoActionNxEnvironmentSync.TabStop = true; + this.rBNoActionNxEnvironmentSync.Text = "No action"; + this.rBNoActionNxEnvironmentSync.UseVisualStyleBackColor = true; + // + // rBRemoveNxEnvironmentSync + // + this.rBRemoveNxEnvironmentSync.AutoSize = true; + this.rBRemoveNxEnvironmentSync.Location = new System.Drawing.Point(86, 17); + this.rBRemoveNxEnvironmentSync.Name = "rBRemoveNxEnvironmentSync"; + this.rBRemoveNxEnvironmentSync.Size = new System.Drawing.Size(65, 17); + this.rBRemoveNxEnvironmentSync.TabIndex = 2; + this.rBRemoveNxEnvironmentSync.TabStop = true; + this.rBRemoveNxEnvironmentSync.Text = "Remove"; + this.rBRemoveNxEnvironmentSync.UseVisualStyleBackColor = true; + // + // rBCreateNxEnvironmentSync + // + this.rBCreateNxEnvironmentSync.AutoSize = true; + this.rBCreateNxEnvironmentSync.Location = new System.Drawing.Point(6, 17); + this.rBCreateNxEnvironmentSync.Name = "rBCreateNxEnvironmentSync"; + this.rBCreateNxEnvironmentSync.Size = new System.Drawing.Size(56, 17); + this.rBCreateNxEnvironmentSync.TabIndex = 1; + this.rBCreateNxEnvironmentSync.TabStop = true; + this.rBCreateNxEnvironmentSync.Text = "Create"; + this.rBCreateNxEnvironmentSync.UseVisualStyleBackColor = true; + // + // groupBox2 + // + this.groupBox2.Controls.Add(this.label5); + this.groupBox2.Controls.Add(this.rBCreateModul3DSync); + this.groupBox2.Controls.Add(this.rBRemoveModul3DSync); + this.groupBox2.Controls.Add(this.lbModul3DSyncStatus); + this.groupBox2.Controls.Add(this.rBNoActionModul3DSync); + this.groupBox2.Location = new System.Drawing.Point(12, 114); + this.groupBox2.Name = "groupBox2"; + this.groupBox2.Size = new System.Drawing.Size(465, 40); + this.groupBox2.TabIndex = 9; + this.groupBox2.TabStop = false; + this.groupBox2.Text = "Modul_3D"; + // + // label5 + // + this.label5.AutoSize = true; + this.label5.Location = new System.Drawing.Point(260, 19); + this.label5.Name = "label5"; + this.label5.Size = new System.Drawing.Size(40, 13); + this.label5.TabIndex = 5; + this.label5.Text = "Status:"; + // + // rBCreateModul3DSync + // + this.rBCreateModul3DSync.AutoSize = true; + this.rBCreateModul3DSync.Location = new System.Drawing.Point(6, 17); + this.rBCreateModul3DSync.Name = "rBCreateModul3DSync"; + this.rBCreateModul3DSync.Size = new System.Drawing.Size(56, 17); + this.rBCreateModul3DSync.TabIndex = 3; + this.rBCreateModul3DSync.TabStop = true; + this.rBCreateModul3DSync.Text = "Create"; + this.rBCreateModul3DSync.UseVisualStyleBackColor = true; + // + // rBRemoveModul3DSync + // + this.rBRemoveModul3DSync.AutoSize = true; + this.rBRemoveModul3DSync.Location = new System.Drawing.Point(86, 17); + this.rBRemoveModul3DSync.Name = "rBRemoveModul3DSync"; + this.rBRemoveModul3DSync.Size = new System.Drawing.Size(65, 17); + this.rBRemoveModul3DSync.TabIndex = 2; + this.rBRemoveModul3DSync.TabStop = true; + this.rBRemoveModul3DSync.Text = "Remove"; + this.rBRemoveModul3DSync.UseVisualStyleBackColor = true; + // + // lbModul3DSyncStatus + // + this.lbModul3DSyncStatus.AutoSize = true; + this.lbModul3DSyncStatus.Location = new System.Drawing.Point(306, 19); + this.lbModul3DSyncStatus.Name = "lbModul3DSyncStatus"; + this.lbModul3DSyncStatus.Size = new System.Drawing.Size(109, 13); + this.lbModul3DSyncStatus.TabIndex = 1; + this.lbModul3DSyncStatus.Text = "Sync. Proc. not exists"; + // + // rBNoActionModul3DSync + // + this.rBNoActionModul3DSync.AutoSize = true; + this.rBNoActionModul3DSync.Checked = true; + this.rBNoActionModul3DSync.Location = new System.Drawing.Point(168, 17); + this.rBNoActionModul3DSync.Name = "rBNoActionModul3DSync"; + this.rBNoActionModul3DSync.Size = new System.Drawing.Size(71, 17); + this.rBNoActionModul3DSync.TabIndex = 0; + this.rBNoActionModul3DSync.TabStop = true; + this.rBNoActionModul3DSync.Text = "No action"; + this.rBNoActionModul3DSync.UseVisualStyleBackColor = true; + // + // DlgLocalSynchronizationSetup + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(489, 317); + this.Controls.Add(this.groupBox2); + this.Controls.Add(this.groupBox1); + this.Controls.Add(this.groupBox4); + this.Controls.Add(this.groupBox5); + this.Controls.Add(this.lbStartuppath); + this.Controls.Add(this.label6); + this.Controls.Add(this.bnCancel); + this.Controls.Add(this.bnRunSynchronization); + this.Controls.Add(this.bnCreateRemoveSynchronisation); + this.Controls.Add(this.menuStrip1); + this.MainMenuStrip = this.menuStrip1; + this.Name = "DlgLocalSynchronizationSetup"; + this.Text = "Local Synchronization Setup"; + this.menuStrip1.ResumeLayout(false); + this.menuStrip1.PerformLayout(); + this.groupBox5.ResumeLayout(false); + this.groupBox5.PerformLayout(); + this.groupBox4.ResumeLayout(false); + this.groupBox4.PerformLayout(); + this.groupBox1.ResumeLayout(false); + this.groupBox1.PerformLayout(); + this.groupBox2.ResumeLayout(false); + this.groupBox2.PerformLayout(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.MenuStrip menuStrip1; + private System.Windows.Forms.ToolStripMenuItem infoToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem showSynchronizationInfoToolStripMenuItem; + private System.Windows.Forms.ToolStripSeparator toolStripSeparator1; + private System.Windows.Forms.ToolStripMenuItem aboutToolStripMenuItem; + private System.Windows.Forms.Button bnCreateRemoveSynchronisation; + private System.Windows.Forms.Button bnRunSynchronization; + private System.Windows.Forms.Button bnCancel; + private System.Windows.Forms.Label label6; + private System.Windows.Forms.Label lbStartuppath; + private System.Windows.Forms.GroupBox groupBox5; + private System.Windows.Forms.GroupBox groupBox4; + private System.Windows.Forms.GroupBox groupBox1; + private System.Windows.Forms.GroupBox groupBox2; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.Label lbNxEnvironmentSyncStatus; + private System.Windows.Forms.RadioButton rBNoActionNxEnvironmentSync; + private System.Windows.Forms.RadioButton rBRemoveNxEnvironmentSync; + private System.Windows.Forms.RadioButton rBCreateNxEnvironmentSync; + private System.Windows.Forms.Label label5; + private System.Windows.Forms.RadioButton rBCreateModul3DSync; + private System.Windows.Forms.RadioButton rBRemoveModul3DSync; + private System.Windows.Forms.Label lbModul3DSyncStatus; + private System.Windows.Forms.RadioButton rBNoActionModul3DSync; + private System.Windows.Forms.Label lbNxPortalSyncStatus; + private System.Windows.Forms.RadioButton rBCreateNxPortalSync; + private System.Windows.Forms.Label label11; + private System.Windows.Forms.RadioButton rBRemoveNxPortalSync; + private System.Windows.Forms.RadioButton rBNoActionNxPortalSync; + private System.Windows.Forms.RadioButton rBCreateNxMachineryLibrarySync; + private System.Windows.Forms.Label label4; + private System.Windows.Forms.RadioButton rBNoActionNxMachineryLibrarySync; + private System.Windows.Forms.RadioButton rBRemoveNxMachineryLibrarySync; + private System.Windows.Forms.Label lbNxMachineryLibrarySyncStatus; + } +} + diff --git a/LocalSynchronizationSetup/DlgLocalSynchronizationSetup.cs b/LocalSynchronizationSetup/DlgLocalSynchronizationSetup.cs new file mode 100644 index 0000000..e402783 --- /dev/null +++ b/LocalSynchronizationSetup/DlgLocalSynchronizationSetup.cs @@ -0,0 +1,205 @@ +using System; +using System.Diagnostics; +using System.Drawing; +using System.IO; +using System.Reflection; +using System.Windows.Forms; + +namespace LocalSynchronizationSetup +{ + public partial class DlgLocalSynchronizationSetup : Form + { + #region Version und Copyright + // Version und Copyright + string programName = Path.GetFileNameWithoutExtension(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase); //Den Programmnamen auslesen + string version = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString(); + static object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyCopyrightAttribute), false); + string copyright = ((AssemblyCopyrightAttribute)attributes[0]).Copyright; + string icon = Application.StartupPath + "\\Info.bmp"; + //Assembly Datum und Zeit + static DateTime value = AssemblyDateTime(); + string date = value.ToShortDateString(); + string time = value.ToLongTimeString(); + private static DateTime AssemblyDateTime() + { + var version = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version; + var buildDateTime = new DateTime(2000, 1, 1).Add(new TimeSpan(TimeSpan.TicksPerDay * version.Build + TimeSpan.TicksPerSecond * 2 * version.Revision)); + //Tage seit dem 1. Januar 2000 und Sekunden seit Mitternacht, (multiplizier mit 2 ergibt das Original) + return buildDateTime; + } + #endregion + + private string strPraefix = "Sync_"; + private string strBatchSuffix = ".bat"; + private string strShortcutSuffix = ".lnk"; + private string strModul3D = "Modul_3D"; + private string strNxEnvironment = "NX_Environment"; + private string strNxMachineryLibrary = "NX_MACHINERY_LIBRARY"; + private string strNxPortal = "NX-Portal"; + private string strSyncDirectory = "C:\\Data\\NX"; + private string strAppStartup; + private Synchronization sy; + + private void bnCreateRemoveSynchronisation_Click(object sender, EventArgs e) + { + string summary = ""; + if (!this.sy.CreateRemoveSynchronisation(this.rBCreateNxEnvironmentSync.Checked, this.rBRemoveNxEnvironmentSync.Checked, this.rBCreateModul3DSync.Checked, this.rBRemoveModul3DSync.Checked, this.rBCreateNxMachineryLibrarySync.Checked, this.rBRemoveNxMachineryLibrarySync.Checked, this.rBCreateNxPortalSync.Checked, this.rBRemoveNxPortalSync.Checked, true, out summary)) + { + return; + } + this.SetStatusText(this.lbModul3DSyncStatus, this.strModul3D); + this.SetStatusText(this.lbNxEnvironmentSyncStatus, this.strNxEnvironment); + this.SetStatusText(this.lbNxMachineryLibrarySyncStatus, this.strNxMachineryLibrary); + this.SetStatusText(this.lbNxPortalSyncStatus, this.strNxPortal); + int num = (int)MessageBox.Show(summary, "Summary - Synchronisation Setup", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); + } + + private void bnRunSynchronization_Click(object sender, EventArgs e) + { + string str1 = "Summary: \n"; + string str2; + if (File.Exists(this.sy.BatchFileName(this.strNxEnvironment))) + { + new Process() + { + StartInfo = { FileName = this.sy.BatchFileName(this.strNxEnvironment) } + }.Start(); + str2 = str1 + "\nSynchronization for " + this.strNxEnvironment + " started successfully"; + } + else + { + str2 = str1 + "\nCannot find synchronization process for " + this.strNxEnvironment + ". Create process before run."; + } + string str3; + if (File.Exists(this.sy.BatchFileName(this.strModul3D))) + { + new Process() + { + StartInfo = { FileName = this.sy.BatchFileName(this.strModul3D) } + }.Start(); + str3 = str2 + "\nSynchronization for " + this.strModul3D + " started successfully"; + } + else + { + str3 = str2 + "\nCannot find synchronization process for " + this.strModul3D + ". Create process before run."; + } + string str4; + if (File.Exists(this.sy.BatchFileName(this.strNxMachineryLibrary))) + { + new Process() + { + StartInfo = { FileName = this.sy.BatchFileName(this.strNxMachineryLibrary) } + }.Start(); + str4 = str3 + "\nSynchronization for " + this.strNxMachineryLibrary + " started successfully"; + } + else + { + str4 = str3 + "\nCannot find synchronization process for " + this.strNxMachineryLibrary + ". Create process before run."; + } + string text; + if (File.Exists(this.sy.BatchFileName(this.strNxPortal))) + { + new Process() + { + StartInfo = { FileName = this.sy.BatchFileName(this.strNxPortal) } + }.Start(); + text = str4 + "\nSynchronization for " + this.strNxPortal + " started successfully"; + } + else + { + text = str4 + "\nCannot find synchronization process for " + this.strNxPortal + ". Create process before run."; + } + int num = (int)MessageBox.Show(text, "Summary - Run Synchronization", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); + } + + private void bnCancel_Click(object sender, EventArgs e) + { + this.Close(); + } + + private void showSynchronizationInfoToolStripMenuItem_Click(object sender, EventArgs e) + { + string text = "Local Synchronization Setup Info:\n"; + string[] strArray = new string[4] + { + this.strNxEnvironment, + this.strModul3D, + this.strNxMachineryLibrary, + this.strNxPortal + }; + foreach (string SyncName in strArray) + { + string str1 = text + "\n" + SyncName + ":"; + string str2 = !File.Exists(this.sy.ShortcutFileName(SyncName)) ? str1 + "\nShortcut does not exist!" : str1 + "\nShortcut:\t\t" + this.sy.ShortcutFileName(SyncName); + text = (!File.Exists(this.sy.BatchFileName(SyncName)) ? str2 + "\nBatch does not exist!" : str2 + "\nBatch:\t\t" + this.sy.BatchFileName(SyncName) + "\nSource:\t\t" + this.GetSyncBatchVarValue(this.sy.BatchFileName(SyncName), "SYNC_SOURCE") + "\nDestination:\t" + this.GetSyncBatchVarValue(this.sy.BatchFileName(SyncName), "SYNC_DESTINATION")) + "\n"; + } + int num = (int)MessageBox.Show(text, "Info", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); + } + + private void aboutToolStripMenuItem_Click(object sender, EventArgs e) + { + int num = (int)MessageBox.Show("About \"Local Synchronization Setup\":\n\nCreates or removes synchronization process for NX_Environment, Modul_3D, NX_Machinery_Library and NX-Portal." + "\nAdditionally environment variables NX_SERVER_DIR and UGII_ENV_FILE will be set." + "\n\nVersion " + version + "\n" + copyright + "\nCreated by Eugen Höglinger, 2010/03/26" + "\nNo warranty! Use program at your own risk!" + "\n\nStart with command line: LocalSynchronizationSetup.exe [startup directory]", "About", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); + } + + public DlgLocalSynchronizationSetup() + { + this.strAppStartup = Application.StartupPath.ToString(); + this.sy = new Synchronization(this.strPraefix, this.strBatchSuffix, this.strShortcutSuffix, this.strModul3D, this.strNxEnvironment, this.strSyncDirectory, this.strAppStartup); + + InitializeComponent(); + } + + public DlgLocalSynchronizationSetup(string ApplicationStartup) + { + this.strAppStartup = ApplicationStartup; + this.sy = new Synchronization(this.strPraefix, this.strBatchSuffix, this.strShortcutSuffix, this.strModul3D, this.strNxEnvironment, this.strSyncDirectory, this.strAppStartup); + InitializeComponent(); + } + + protected override void OnLoad(EventArgs e) + { + base.OnLoad(e); + this.lbStartuppath.Text = this.strAppStartup; + this.SetStatusText(this.lbModul3DSyncStatus, this.strModul3D); + this.SetStatusText(this.lbNxEnvironmentSyncStatus, this.strNxEnvironment); + this.SetStatusText(this.lbNxMachineryLibrarySyncStatus, this.strNxMachineryLibrary); + this.SetStatusText(this.lbNxPortalSyncStatus, this.strNxPortal); + } + + private void SetStatusText(Label StatusLabel, string SyncName) + { + if (this.SynchronizationExists(SyncName)) + { + StatusLabel.Text = "Sync. Proc. EXISTS"; + StatusLabel.BackColor = Color.Yellow; + } + else + { + StatusLabel.Text = "Sync. Proc. NOT EXISTS"; + StatusLabel.BackColor = Color.Transparent; + } + } + + private bool SynchronizationExists(string SyncName) + { + return File.Exists(this.sy.ShortcutFileName(SyncName)) && File.Exists(this.sy.BatchFileName(SyncName)); + } + + private string GetSyncBatchVarValue(string SyncBatchfilename, string VarName) + { + string str1 = ""; + StreamReader streamReader = new StreamReader(SyncBatchfilename); + while (!streamReader.EndOfStream && str1 == "") + { + string str2 = streamReader.ReadLine(); + if (str2.Contains("SET " + VarName + "=")) + { + string[] strArray = str2.Split('='); + str1 = strArray[strArray.Length - 1]; + } + } + streamReader.Close(); + return str1; + } + } +} diff --git a/LocalSynchronizationSetup/DlgLocalSynchronizationSetup.resx b/LocalSynchronizationSetup/DlgLocalSynchronizationSetup.resx new file mode 100644 index 0000000..d5494e3 --- /dev/null +++ b/LocalSynchronizationSetup/DlgLocalSynchronizationSetup.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 17, 17 + + \ No newline at end of file diff --git a/LocalSynchronizationSetup/LocalSynchronizationSetup.csproj b/LocalSynchronizationSetup/LocalSynchronizationSetup.csproj new file mode 100644 index 0000000..3a14182 --- /dev/null +++ b/LocalSynchronizationSetup/LocalSynchronizationSetup.csproj @@ -0,0 +1,96 @@ + + + + + Debug + AnyCPU + {E725F0A2-755F-4A90-A9ED-C69EA20C5621} + WinExe + LocalSynchronizationSetup + LocalSynchronizationSetup + v4.6.1 + 512 + true + false + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + Form + + + DlgLocalSynchronizationSetup.cs + + + + + + + DlgLocalSynchronizationSetup.cs + + + ResXFileCodeGenerator + Resources.Designer.cs + Designer + + + True + Resources.resx + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + True + Settings.settings + True + + + + + + + + {F935DC20-1CF0-11D0-ADB9-00C04FD58A0B} + 1 + 0 + 0 + tlbimp + False + True + + + + \ No newline at end of file diff --git a/LocalSynchronizationSetup/Program.cs b/LocalSynchronizationSetup/Program.cs new file mode 100644 index 0000000..b6ba16e --- /dev/null +++ b/LocalSynchronizationSetup/Program.cs @@ -0,0 +1,113 @@ +using System; +using System.Windows.Forms; + +namespace LocalSynchronizationSetup +{ + static class Program + { + /// + /// Der Haupteinstiegspunkt für die Anwendung. + /// + [STAThread] + private static void Main(string[] args) + { + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + + string str1 = "Usage: LocalSynchronizationSetup.exe \r\n\r\n" + "Example use: LocalSynchronizationSetup.exe\r\n" + "or:\t LocalSynchronizationSetup.exe M:\\NX\r\n" + "or:\t LocalSynchronizationSetup.exe M:\\NX -desktop\r\n" + "or:\t LocalSynchronizationSetup.exe M:\\NX -laptop -internal\r\n" + "or:\t LocalSynchronizationSetup.exe M:\\NX -laptop -external\r\n\r\n" + "\t LocalSynchronizationSetup.exe -h shows this help dialog.\r\n\r\n" + "Parameters:\r\n" + "Startup Directory:\r\n" + "\tDirectory, which contains the folders NX_Environment and Modul_3D.\r\n" + "Computer Type:\r\n" + "\t-laptop: Use this parameter to define the computer type.\r\n" + "\t-desktop: Use this parameter to define the computer type. If -desktop is used, the parameter Connection Type is not necessary.\r\n" + "Connection Type:\r\n" + "\t-internal: Use this parameter, if the computer is connected to the ENGEL network.\r\n" + "\t-external: Use this parameter, if the computer is not connected to the ENGEL network\r\n" + "Don't use -internal and -external at the same time.\r\n" + "Don't use -desktop and -laptop at the same time.\r\n" + "If the parameter Connection Type or Computer Type is used, the program doesn't show a dialog."; + string variable = "COMPUTER_TYPE"; + string str2 = "LAPTOP_INT"; + string str3 = "LAPTOP_EXT"; + string str4 = "DESKTOP"; + string strAppStartup = ""; + bool flag1 = false; + bool flag2 = false; + bool flag3 = false; + bool flag4 = false; + + foreach (string str5 in args) + { + if (str5.Equals("-h", StringComparison.InvariantCultureIgnoreCase)) + { + int num = (int)MessageBox.Show(str1, "Usage of Local Synchronization Setup", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); + } + else if (str5.Equals("-laptop", StringComparison.InvariantCultureIgnoreCase)) + { + flag3 = true; + flag1 = true; + } + else if (str5.Equals("-desktop", StringComparison.InvariantCultureIgnoreCase)) + { + flag3 = false; + flag1 = true; + } + else if (str5.Equals("-internal", StringComparison.InvariantCultureIgnoreCase)) + { + flag4 = true; + flag2 = true; + } + else if (str5.Equals("-external", StringComparison.InvariantCultureIgnoreCase)) + { + flag4 = false; + flag2 = true; + } + else + { + strAppStartup = str5; + } + } + + if (strAppStartup != null && strAppStartup != "" && (args.Length != 0 && args.Length != 1 || (flag1 || flag2)) && ((args.Length != 2 || !flag1 || (flag3 || flag2)) && (args.Length != 3 || !flag1 || !flag2))) + { + int num1 = (int)MessageBox.Show(str1, "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand); + } + else if (flag1 && !flag3) + { + if (Environment.GetEnvironmentVariable(variable, EnvironmentVariableTarget.Machine) != null) + { + return; + } + Environment.SetEnvironmentVariable(variable, str4, EnvironmentVariableTarget.Machine); + } + else if (flag2 && flag1) + { + if (flag3 && flag4) + { + if (Environment.GetEnvironmentVariable(variable, EnvironmentVariableTarget.Machine) == null) + { + Environment.SetEnvironmentVariable(variable, str2, EnvironmentVariableTarget.Machine); + } + string summary = ""; + new Synchronization(strAppStartup).CreateRemoveSynchronisation(true, false, false, false, false, false, true, false, false, out summary); + } + else + { + if (!flag3 || flag4 || Environment.GetEnvironmentVariable(variable, EnvironmentVariableTarget.Machine) != null) + { + return; + } + Environment.SetEnvironmentVariable(variable, str3, EnvironmentVariableTarget.Machine); + } + } + else + { + string str5 = Environment.GetEnvironmentVariable(variable, EnvironmentVariableTarget.Machine); + + if (str5 == null) + { + Environment.SetEnvironmentVariable(variable, str2, EnvironmentVariableTarget.Machine); + str5 = str2; + } + Synchronization synchronization = new Synchronization(strAppStartup); + if (str5.Equals(str2, StringComparison.InvariantCultureIgnoreCase) || str5.Equals(str3, StringComparison.InvariantCultureIgnoreCase)) + { + string summary = ""; + synchronization.CreateRemoveSynchronisation(true, false, false, false, false, false, true, false, false, out summary); + } + synchronization.StrAppStartupContainsFolderNx(true, str1); + + Application.Run(args.Length != 1 ? (Form)new DlgLocalSynchronizationSetup() : (Form)new DlgLocalSynchronizationSetup(args[0])); + } + } + } +} diff --git a/LocalSynchronizationSetup/Properties/AssemblyInfo.cs b/LocalSynchronizationSetup/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..bcb9c93 --- /dev/null +++ b/LocalSynchronizationSetup/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// Allgemeine Informationen über eine Assembly werden über die folgenden +// Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern, +// die einer Assembly zugeordnet sind. +[assembly: AssemblyTitle("LocalSynchronizationSetup")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("LocalSynchronizationSetup")] +[assembly: AssemblyCopyright("Copyright © 2010-2018 by Eugen Höglinger")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Durch Festlegen von ComVisible auf FALSE werden die Typen in dieser Assembly +// für COM-Komponenten unsichtbar. Wenn Sie auf einen Typ in dieser Assembly von +// COM aus zugreifen müssen, sollten Sie das ComVisible-Attribut für diesen Typ auf "True" festlegen. +[assembly: ComVisible(false)] + +// Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird +[assembly: Guid("e725f0a2-755f-4a90-a9ed-c69ea20c5621")] + +// Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten: +// +// Hauptversion +// Nebenversion +// Buildnummer +// Revision +// +// Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden, +// übernehmen, indem Sie "*" eingeben: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.1.*")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/LocalSynchronizationSetup/Properties/Resources.Designer.cs b/LocalSynchronizationSetup/Properties/Resources.Designer.cs new file mode 100644 index 0000000..5d44c42 --- /dev/null +++ b/LocalSynchronizationSetup/Properties/Resources.Designer.cs @@ -0,0 +1,71 @@ +//------------------------------------------------------------------------------ +// +// Dieser Code wurde von einem Tool generiert. +// Laufzeitversion: 4.0.30319.42000 +// +// Änderungen an dieser Datei können fehlerhaftes Verhalten verursachen und gehen verloren, wenn +// der Code neu generiert wird. +// +//------------------------------------------------------------------------------ + +namespace LocalSynchronizationSetup.Properties +{ + + + /// + /// Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw. + /// + // Diese Klasse wurde von der StronglyTypedResourceBuilder-Klasse + // über ein Tool wie ResGen oder Visual Studio automatisch generiert. + // Um einen Member hinzuzufügen oder zu entfernen, bearbeiten Sie die .ResX-Datei und führen dann ResGen + // mit der Option /str erneut aus, oder erstellen Sie Ihr VS-Projekt neu. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources + { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() + { + } + + /// + /// Gibt die zwischengespeicherte ResourceManager-Instanz zurück, die von dieser Klasse verwendet wird. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager + { + get + { + if ((resourceMan == null)) + { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("LocalSynchronizationSetup.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Überschreibt die CurrentUICulture-Eigenschaft des aktuellen Threads für alle + /// Ressourcenlookups, die diese stark typisierte Ressourcenklasse verwenden. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture + { + get + { + return resourceCulture; + } + set + { + resourceCulture = value; + } + } + } +} diff --git a/LocalSynchronizationSetup/Properties/Resources.resx b/LocalSynchronizationSetup/Properties/Resources.resx new file mode 100644 index 0000000..af7dbeb --- /dev/null +++ b/LocalSynchronizationSetup/Properties/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/LocalSynchronizationSetup/Properties/Settings.Designer.cs b/LocalSynchronizationSetup/Properties/Settings.Designer.cs new file mode 100644 index 0000000..101253f --- /dev/null +++ b/LocalSynchronizationSetup/Properties/Settings.Designer.cs @@ -0,0 +1,30 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace LocalSynchronizationSetup.Properties +{ + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase + { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default + { + get + { + return defaultInstance; + } + } + } +} diff --git a/LocalSynchronizationSetup/Properties/Settings.settings b/LocalSynchronizationSetup/Properties/Settings.settings new file mode 100644 index 0000000..3964565 --- /dev/null +++ b/LocalSynchronizationSetup/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + diff --git a/LocalSynchronizationSetup/Shortcut.cs b/LocalSynchronizationSetup/Shortcut.cs new file mode 100644 index 0000000..501b166 --- /dev/null +++ b/LocalSynchronizationSetup/Shortcut.cs @@ -0,0 +1,21 @@ +using IWshRuntimeLibrary; + +namespace LocalSynchronizationSetup +{ + public static class Shortcut + { + public static void Create(string text, string sourceFile, string destPath) + { + if (destPath.Substring(destPath.Length - 1, 1) != "\\") + { + destPath += "\\"; + } + + string shortcutPath = destPath + text + ".lnk"; + WshShell shell = new WshShell(); + IWshShortcut link = (IWshShortcut)shell.CreateShortcut(shortcutPath); + link.TargetPath = sourceFile; + link.Save(); + } + } +} diff --git a/LocalSynchronizationSetup/Synchronization.cs b/LocalSynchronizationSetup/Synchronization.cs new file mode 100644 index 0000000..a2513a1 --- /dev/null +++ b/LocalSynchronizationSetup/Synchronization.cs @@ -0,0 +1,269 @@ +using System; +using System.IO; +using System.Windows.Forms; + +namespace LocalSynchronizationSetup +{ + internal class Synchronization + { + private string strPraefix = "Sync_"; + private string strBatchSuffix = ".bat"; + private string strShortcutSuffix = ".lnk"; + private string strModul3D = "Modul_3D"; + private string strNxEnvironment = "NX-Environment"; + private string strNxMachineryLibrary = "NX_Machinery_Library"; + private string strNxPortal = "NX-Portal"; + private string strSyncDirectory = "C:\\Data\\NX"; + private string strAppStartup; + + public Synchronization(string strAppStartup) + { + this.strAppStartup = strAppStartup; + } + + public Synchronization(string strPraefix, string strBatchSuffix, string strShortcutSuffix, string strModul3D, string strNxEnvironment, string strSyncDirectory, string strAppStartup) + { + this.strPraefix = strPraefix; + this.strBatchSuffix = strBatchSuffix; + this.strShortcutSuffix = strShortcutSuffix; + this.strModul3D = strModul3D; + this.strNxEnvironment = strNxEnvironment; + this.strSyncDirectory = strSyncDirectory; + this.strAppStartup = strAppStartup; + } + + public bool StrAppStartupContainsFolderNx(bool showMessages, string strUsage) + { + if (Directory.Exists(this.strAppStartup + "\\" + this.strNxEnvironment) && Directory.Exists(this.strAppStartup + "\\" + this.strNxPortal)) + { + return true; + } + if (showMessages) + { + int num = (int)MessageBox.Show("With the current settings the synchronization can not be created or removed. Could not find Folder NX in Startup Directory.\r\n" + "The current Startup Directory is: \"" + this.strAppStartup + "\"\r\n\r\n" + strUsage, "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand); + } + return false; + } + + public bool CreateRemoveSynchronisation(bool createNxEnvironmentSync, bool removeNxEnvironmentSync, bool createModul3DSync, bool removeModul3DSync, bool createNxMachineryLibrarySync, bool removeNxMachineryLibrarySync, bool createNxPortalSync, bool removeNxPortalSync, bool show_messages, out string summary) + { + summary = "Summary:\n"; + + try + { + if (createNxEnvironmentSync) + { + if (!Directory.Exists(this.strSyncDirectory)) + { + Directory.CreateDirectory(this.strSyncDirectory); + if (!Directory.Exists(this.strSyncDirectory)) + { + if (show_messages) + { + int num = (int)MessageBox.Show("Unable to create synchronization directory: \n" + this.strSyncDirectory, "Create Synchronization Directory", MessageBoxButtons.OK, MessageBoxIcon.Hand); + } + return false; + } + } + if (!File.Exists(this.strSyncDirectory + "\\robocopy.exe")) + { + File.Copy(Application.StartupPath.ToString() + "\\robocopy.exe", this.strSyncDirectory + "\\robocopy.exe", false); + summary = !this.CreateSyncProcess(this.strNxEnvironment, show_messages) ? summary + "\nUnable to create synchronisation process for " + this.strNxEnvironment : summary + "\nSynchronisation process created for " + this.strNxEnvironment; + } + } + else + { + summary = !removeNxEnvironmentSync ? summary + "\nNo synchronization changes for " + this.strNxEnvironment : (!this.RemoveSyncProcess(this.strNxEnvironment) ? summary + "\nUnable to remove synchronisation process for " + this.strNxEnvironment : summary + "\nSynchronisation process removed for " + this.strNxEnvironment); + } + if (createModul3DSync) + { + if (!Directory.Exists(this.strSyncDirectory)) + { + Directory.CreateDirectory(this.strSyncDirectory); + if (!Directory.Exists(this.strSyncDirectory)) + { + if (show_messages) + { + int num = (int)MessageBox.Show("Unable to create synchronization directory: \n" + this.strSyncDirectory, "Create Synchronization Directory", MessageBoxButtons.OK, MessageBoxIcon.Hand); + } + return false; + } + } + if (!File.Exists(this.strSyncDirectory + "\\robocopy.exe")) + { + File.Copy(this.strAppStartup + "\\robocopy.exe", this.strSyncDirectory + "\\robocopy.exe", false); + } + summary = !this.CreateSyncProcess(this.strModul3D, show_messages) ? summary + "\nUnable to create synchronisation process for " + this.strModul3D : summary + "\nSynchronisation process created for " + this.strModul3D; + } + else + { + summary = !removeModul3DSync ? summary + "\nNo synchronization changes for " + this.strModul3D : (!this.RemoveSyncProcess(this.strModul3D) ? summary + "\nUnable to remove synchronisation process for " + this.strModul3D : summary + "\nSynchronisation process removed for " + this.strModul3D); + } + if (createNxMachineryLibrarySync) + { + if (!Directory.Exists(this.strSyncDirectory)) + { + Directory.CreateDirectory(this.strSyncDirectory); + if (!Directory.Exists(this.strSyncDirectory)) + { + if (show_messages) + { + int num = (int)MessageBox.Show("Unable to create synchronization directory: \n" + this.strSyncDirectory, "Create Synchronization Directory", MessageBoxButtons.OK, MessageBoxIcon.Hand); + } + return false; + } + } + if (!File.Exists(this.strSyncDirectory + "\\robocopy.exe")) + { + File.Copy(Application.StartupPath.ToString() + "\\robocopy.exe", this.strSyncDirectory + "\\robocopy.exe", false); + } + summary = !this.CreateSyncProcess(this.strNxMachineryLibrary, show_messages) ? summary + "\nUnable to create synchronisation process for " + this.strNxMachineryLibrary : summary + "\nSynchronisation process created for " + this.strNxMachineryLibrary; + } + else + { + summary = !removeNxMachineryLibrarySync ? summary + "\nNo synchronization changes for " + this.strNxMachineryLibrary : (!this.RemoveSyncProcess(this.strNxMachineryLibrary) ? summary + "\nUnable to remove synchronisation process for " + this.strNxMachineryLibrary : summary + "\nSynchronisation process removed for " + this.strNxMachineryLibrary); + } + if (createNxPortalSync) + { + if (!Directory.Exists(this.strSyncDirectory)) + { + Directory.CreateDirectory(this.strSyncDirectory); + if (!Directory.Exists(this.strSyncDirectory)) + { + if (show_messages) + { + int num = (int)MessageBox.Show("Unable to create synchronization directory: \n" + this.strSyncDirectory, "Create Synchronization Directory", MessageBoxButtons.OK, MessageBoxIcon.Hand); + } + return false; + } + } + if (!File.Exists(this.strSyncDirectory + "\\robocopy.exe")) + { + File.Copy(Application.StartupPath.ToString() + "\\robocopy.exe", this.strSyncDirectory + "\\robocopy.exe", false); + } + summary = !this.CreateSyncProcess(this.strNxPortal, show_messages) ? summary + "\nUnable to create synchronisation process for " + this.strNxPortal : summary + "\nSynchronisation process created for " + this.strNxPortal; + } + else + { + summary = !removeNxPortalSync ? summary + "\nNo synchronization changes for " + this.strNxPortal : (!this.RemoveSyncProcess(this.strNxPortal) ? summary + "\nUnable to remove synchronisation process for " + this.strNxPortal : summary + "\nSynchronisation process removed for " + this.strNxPortal); + } + } + catch (Exception ex) + { + int num = (int)MessageBox.Show(ex.ToString()); + } + return true; + } + + public string ShortcutFileName(string SyncName) + { + return new DirectoryInfo(Environment.GetFolderPath(Environment.SpecialFolder.Startup)).ToString() + "\\" + this.strPraefix + SyncName + this.strShortcutSuffix; + } + + public string BatchFileName(string SyncName) + { + return this.strSyncDirectory + "\\" + this.strPraefix + SyncName + this.strBatchSuffix; + } + + private bool CreateSyncProcess(string SyncName, bool show_messages) + { + if (!Directory.Exists(this.strAppStartup + "\\" + SyncName)) + { + if (show_messages) + { + int num = (int)MessageBox.Show("Unable to create synchronization process.\n\nCannot find directory \"" + SyncName + "\" in application startup directory.", "Create Synchronization Process", MessageBoxButtons.OK, MessageBoxIcon.Hand); + } + return false; + } + return this.CreateSyncBatch(SyncName) && this.CreateSyncShortcut(SyncName); + } + + private bool RemoveSyncProcess(string SyncName) + { + return this.RemoveSyncShortcut(SyncName) && this.RemoveSyncBatch(SyncName); + } + + private bool CreateSyncBatch(string SyncName) + { + if (Directory.Exists(this.strSyncDirectory)) + { + if (File.Exists(this.BatchFileName(SyncName))) + { + try + { + File.Delete(this.BatchFileName(SyncName)); + } + catch + { + //Tu nichts + } + } + if (!File.Exists(this.BatchFileName(SyncName))) + { + FileStream fileStream = File.Create(this.BatchFileName(SyncName)); + StreamWriter streamWriter = new StreamWriter((Stream)fileStream); + streamWriter.WriteLine("ECHO OFF"); + streamWriter.WriteLine("TITLE Synchronize " + SyncName); + streamWriter.WriteLine("ECHO."); + streamWriter.WriteLine("ECHO +++ Synchronize " + SyncName); + streamWriter.WriteLine("ECHO +++ File Created by LocalSynchronization Setup"); + streamWriter.WriteLine("ECHO +++ written by Eugen Hoeglinger, 2010/03/26"); + streamWriter.WriteLine("ECHO -----------------------------------------"); + streamWriter.WriteLine("ECHO."); + streamWriter.WriteLine("SET ROBOCOPY_PATH=%~dp0"); + streamWriter.WriteLine("SET ROBOCOPY_PATH=%ROBOCOPY_PATH:~0,-1%"); + streamWriter.WriteLine("SET SYNC_SOURCE=%NX_ONLINE%\\NX\\" + SyncName); + streamWriter.WriteLine("SET SYNC_DESTINATION=C:\\Data\\NX\\" + SyncName); + streamWriter.WriteLine("ECHO Start Synchronization... "); + streamWriter.WriteLine("ECHO SOURCE: %SYNC_SOURCE%"); + streamWriter.WriteLine("ECHO DESTINATION: %SYNC_DESTINATION%"); + streamWriter.WriteLine("ECHO."); + streamWriter.WriteLine("\"%ROBOCOPY_PATH%\\robocopy.exe\" \"%SYNC_SOURCE%\" \"%SYNC_DESTINATION%\" /MIR /R:3 /W:30 /Log:\"" + this.strSyncDirectory + "\\Sync_NX_" + SyncName + "_SyncLog.txt\" /TEE"); + streamWriter.WriteLine("exit"); + streamWriter.Flush(); + streamWriter.Close(); + fileStream.Close(); + return File.Exists(this.BatchFileName(SyncName)); + } + } + return false; + } + + private bool CreateSyncShortcut(string SyncName) + { + if (File.Exists(this.ShortcutFileName(SyncName))) + { + File.Delete(this.ShortcutFileName(SyncName)); + } + if (File.Exists(this.ShortcutFileName(SyncName))) + { + return false; + } + + string text = String.Concat(strPraefix, SyncName); + string source = String.Concat(strSyncDirectory, "\\", strPraefix, SyncName, strBatchSuffix); + string path = this.ShortcutFileName(SyncName).Remove(this.ShortcutFileName(SyncName).LastIndexOf("\\") + 1); + Shortcut.Create(text, source, path); + + return File.Exists(this.ShortcutFileName(SyncName)); + } + + private bool RemoveSyncShortcut(string SyncName) + { + if (File.Exists(this.ShortcutFileName(SyncName))) + { + File.Delete(this.ShortcutFileName(SyncName)); + } + return !File.Exists(this.ShortcutFileName(SyncName)); + } + + private bool RemoveSyncBatch(string SyncName) + { + if (File.Exists(this.BatchFileName(SyncName))) + { + File.Delete(this.BatchFileName(SyncName)); + } + return !File.Exists(this.BatchFileName(SyncName)); + } + } +}