/// <summary> /// Adds the support settings to true of false to the configRaftSuppor SkeinConfig object. /// </summary> /// <param name="configRaftSupport"></param> private void AddSupportConfiguration(SkeinConfig configRaftSupport) { if (Main.main.slicerPanel.generateSupportCheckbox.Checked == true) { configRaftSupport.setValue("None", "False"); configRaftSupport.setValue("Empty Layers Only", "False"); configRaftSupport.setValue("Exterior Only", "False"); configRaftSupport.setValue("Everywhere", "True"); } else { configRaftSupport.setValue("None", "True"); configRaftSupport.setValue("Everywhere", "False"); configRaftSupport.setValue("Empty Layers Only", "False"); configRaftSupport.setValue("Exterior Only", "False"); } //throw new NotImplementedException(); }
/// <summary> /// Initializes the Skein hash instance. /// </summary> /// <param name="stateSize">The internal state size of the hash in bits. /// Supported values are 256, 512, and 1024.</param> /// <param name="outputSize">The output size of the hash in bits. /// Output size must be divisible by 8 and greater than zero.</param> public Skein(int stateSize, int outputSize) { // Make sure the output bit size > 0 if (outputSize <= 0) { throw new CryptoException("Output bit size must be greater than zero."); } // Make sure output size is divisible by 8 if (outputSize % 8 != 0) { throw new CryptoException("Output bit size must be divisible by 8."); } _cipherStateBits = stateSize; _cipherStateBytes = stateSize / 8; _cipherStateWords = stateSize / 64; _outputBytes = (outputSize + 7) / 8; // Figure out which cipher we need based on // the state size _cipher = ThreefishEngine.CreateCipher(stateSize); if (_cipher == null) { throw new CryptographicException("Unsupported state size."); } // Allocate buffers _inputBuffer = new byte[_cipherStateBytes]; _cipherInput = new ulong[_cipherStateWords]; _state = new ulong[_cipherStateWords]; // Allocate tweak UbiParameters = new UbiTweak(); // Generate the configuration string Configuration = new SkeinConfig(this); Configuration.SetSchema(83, 72, 65, 51); // "SHA3" Configuration.SetVersion(1); Configuration.GenerateConfiguration(); }
/// <summary> /// Adds the Raft configuration to true or false based on the main printer settings. Modifies the SkienConfig object. /// </summary> /// <param name="configRaftSupport"></param> private void AddRaftConfiguration(SkeinConfig configRaftSupport) { if (Main.main.slicerPanel.generateRaftCheckbox.Checked == true) { configRaftSupport.setValue("Activate Raft", "True"); configRaftSupport.setValue("Add Raft, Elevate Nozzle, Orbit:", "True"); configRaftSupport.setValue("Base Layers (integer):", "5"); configRaftSupport.setValue("Interface Layers (integer):", "3"); } else { // These must be true, to allow support generation, but we will set the raft to 0 to remove the raft. configRaftSupport.setValue("Activate Raft", "True"); configRaftSupport.setValue("Add Raft, Elevate Nozzle, Orbit:", "True"); configRaftSupport.setValue("Base Layers (integer):", "0"); configRaftSupport.setValue("Interface Layers (integer):", "0"); ////configRaftSupport.setValue("Activate Raft", "False"); ////configRaftSupport.setValue("Add Raft, Elevate Nozzle, Orbit:", "False"); } // throw new NotImplementedException(); }
public void RestoreConfigs() { if (profileConfig != null) { profileConfig.writeOriginal(); } if (exportConfig != null) { exportConfig.writeOriginal(); } if (extrusionConfig != null) { extrusionConfig.writeOriginal(); } if (multiplyConfig != null) { multiplyConfig.writeOriginal(); } profileConfig = null; exportConfig = null; extrusionConfig = null; multiplyConfig = null; }
public void RunSlice(string file, string profile) { if (procConvert != null) { MessageBox.Show(Trans.T("L_SKEIN_STILL_RUNNING") /*"Last slice job still running. Slicing of new job is canceled."*/, Trans.T("L_ERROR"), MessageBoxButtons.OK, MessageBoxIcon.Error); return; } profileConfig = new SkeinConfig(BasicConfiguration.basicConf.SkeinforgeProfileDir + Path.DirectorySeparatorChar + "skeinforge_profile.csv"); extrusionConfig = new SkeinConfig(BasicConfiguration.basicConf.SkeinforgeProfileDir + Path.DirectorySeparatorChar + "extrusion.csv"); exportConfig = new SkeinConfig(BasicConfiguration.basicConf.SkeinforgeProfileDir + Path.DirectorySeparatorChar + "extrusion" + Path.DirectorySeparatorChar + profile + Path.DirectorySeparatorChar + "export.csv"); multiplyConfig = new SkeinConfig(BasicConfiguration.basicConf.SkeinforgeProfileDir + Path.DirectorySeparatorChar + "extrusion" + Path.DirectorySeparatorChar + profile + Path.DirectorySeparatorChar + "multiply.csv"); // Set profile to extrusion /* cutting False * extrusion True * milling False * winding False */ profileConfig.setValue("cutting", "False"); profileConfig.setValue("milling", "False"); profileConfig.setValue("extrusion", "True"); profileConfig.setValue("winding", "False"); profileConfig.writeModified(); // Set used profile extrusionConfig.setValue("Profile Selection:", profile); extrusionConfig.writeModified(); // Set export to correct values exportConfig.setValue("Activate Export", "True"); exportConfig.setValue("Add Profile Extension", "False"); exportConfig.setValue("Add Profile Name to Filename", "False"); exportConfig.setValue("Add Timestamp Extension", "False"); exportConfig.setValue("Add Timestamp to Filename", "False"); exportConfig.setValue("Add Description to Filename", "False"); exportConfig.setValue("Add Descriptive Extension", "False"); exportConfig.writeModified(); multiplyConfig.setValue("Activate Multiply:", "False"); multiplyConfig.setValue("Activate Multiply: ", "False"); multiplyConfig.setValue("Activate Multiply", "False"); multiplyConfig.writeModified(); string target = StlToGCode(file); if (File.Exists(target)) { File.Delete(target); } procConvert = new Process(); try { SlicingInfo.Start(name); SlicingInfo.SetAction(Trans.T("L_SLICING_STL_FILE...")); //"Slicing STL file ..."); slicefile = file; procConvert.EnableRaisingEvents = true; procConvert.Exited += new EventHandler(ConversionExited); procConvert.StartInfo.FileName = Main.IsMono ? PyPy : wrapQuotes(PyPy); procConvert.StartInfo.Arguments = wrapQuotes(textSkeinforgeCraft.Text) + " " + wrapQuotes(file); procConvert.StartInfo.UseShellExecute = false; procConvert.StartInfo.WorkingDirectory = textWorkingDirectory.Text; procConvert.StartInfo.RedirectStandardOutput = true; procConvert.OutputDataReceived += new DataReceivedEventHandler(OutputDataHandler); procConvert.StartInfo.RedirectStandardError = true; procConvert.ErrorDataReceived += new DataReceivedEventHandler(OutputDataHandler); procConvert.Start(); // Start the asynchronous read of the standard output stream. procConvert.BeginOutputReadLine(); procConvert.BeginErrorReadLine(); //Main.main.tab.SelectedTab = Main.main.tabPrint; } catch (Exception e) { Main.conn.log(e.ToString(), false, 2); RestoreConfigs(); } }
public void RunSlice(string file, string profile) { if (procConvert != null) { MessageBox.Show(Trans.T("L_SKEIN_STILL_RUNNING") /*"Last slice job still running. Slicing of new job is canceled."*/, Trans.T("L_ERROR"), MessageBoxButtons.OK, MessageBoxIcon.Error); return; } string py = PyPy; if (py == null) { MessageBox.Show(Trans.T("L_PYPY_NOT_FOUND"), Trans.T("L_ERROR"), MessageBoxButtons.OK, MessageBoxIcon.Error); return; } string craft = findCraft(); if (craft == null) { MessageBox.Show(Trans.T("L_SKEINCRAFT_NOT_FOUND"), Trans.T("L_ERROR"), MessageBoxButtons.OK, MessageBoxIcon.Error); return; } string profdir = findSkeinforgeProfiles(); if (profdir == null) { MessageBox.Show(Trans.T("L_SKEINCRAFT_PROFILES_NOT_FOUND"), Trans.T("L_ERROR"), MessageBoxButtons.OK, MessageBoxIcon.Error); return; } profileConfig = new SkeinConfig(Path.Combine(profdir, "skeinforge_profile.csv")); extrusionConfig = new SkeinConfig(Path.Combine(profdir, "extrusion.csv")); exportConfig = new SkeinConfig(Path.Combine(profdir, "extrusion" + Path.DirectorySeparatorChar + profile + Path.DirectorySeparatorChar + "export.csv")); multiplyConfig = new SkeinConfig(Path.Combine(profdir, "extrusion" + Path.DirectorySeparatorChar + profile + Path.DirectorySeparatorChar + "multiply.csv")); raftAndSupportConfig = new SkeinConfig(Path.Combine(profdir, "extrusion" + Path.DirectorySeparatorChar + profile + Path.DirectorySeparatorChar + "raft.csv")); // Set profile to extrusion /* cutting False * extrusion True * milling False * winding False */ profileConfig.setValue("cutting", "False"); profileConfig.setValue("milling", "False"); profileConfig.setValue("extrusion", "True"); profileConfig.setValue("winding", "False"); profileConfig.writeModified(); // Set used profile extrusionConfig.setValue("Profile Selection:", profile); extrusionConfig.writeModified(); // Set export to correct values exportConfig.setValue("Activate Export", "True"); exportConfig.setValue("Add Profile Extension", "False"); exportConfig.setValue("Add Profile Name to Filename", "False"); exportConfig.setValue("Add Timestamp Extension", "False"); exportConfig.setValue("Add Timestamp to Filename", "False"); exportConfig.setValue("Add Description to Filename", "False"); exportConfig.setValue("Add Descriptive Extension", "False"); exportConfig.writeModified(); multiplyConfig.setValue("Activate Multiply:", "False"); multiplyConfig.setValue("Activate Multiply: ", "False"); multiplyConfig.setValue("Activate Multiply", "False"); multiplyConfig.writeModified(); string target = StlToGCode(file); if (File.Exists(target)) { File.Delete(target); } // If we are in developer mode then don't add support or rafts or calibrate the height if (!Main.main.DeveloperMode) { // Modify Start Code, Raft, and Support settings to reflect the current user settings CalibrateHeightStartGcode(profdir); AddRaftConfiguration(raftAndSupportConfig); AddSupportConfiguration(raftAndSupportConfig); raftAndSupportConfig.writeModified(); // write the modified raft.csv } procConvert = new Process(); try { SlicingInfo.Start(name); SlicingInfo.SetAction(Trans.T("L_SLICING_STL_FILE...")); //"Slicing STL file ..."); slicefile = file; procConvert.EnableRaisingEvents = true; procConvert.Exited += new EventHandler(ConversionExited); procConvert.StartInfo.FileName = Main.IsMono ? py : wrapQuotes(py); procConvert.StartInfo.Arguments = wrapQuotes(craft) + " " + wrapQuotes(file); procConvert.StartInfo.UseShellExecute = false; procConvert.StartInfo.WorkingDirectory = textWorkingDirectory.Text; procConvert.StartInfo.RedirectStandardOutput = true; procConvert.OutputDataReceived += new DataReceivedEventHandler(OutputDataHandler); procConvert.StartInfo.RedirectStandardError = true; procConvert.ErrorDataReceived += new DataReceivedEventHandler(OutputDataHandler); procConvert.Start(); // Start the asynchronous read of the standard output stream. procConvert.BeginOutputReadLine(); procConvert.BeginErrorReadLine(); //Main.main.tab.SelectedTab = Main.main.tabPrint; } catch (Exception e) { Main.connection.log(e.ToString(), false, 2); RestoreConfigs(); } }