public void SetElement(object value, CommentMode mode) { var newPlayByPlay = value as PlayByPlay; if (newPlayByPlay != null) { this.CommentMode = mode; if (mode == CommentMode.Timeline) { this.sequenceRegistry.CurrentSequence.Markers.Remove(this.playByPlay); } this.playByPlay = newPlayByPlay; if (mode == CommentMode.Timeline) { if (!this.sequenceRegistry.CurrentSequence.Markers.Contains(this.playByPlay)) { this.sequenceRegistry.CurrentSequence.Markers.Add(this.playByPlay); } } this.SetPosition(TimeSpan.FromTicks(this.playByPlay.Time)); this.View.Close(); } }
public void SetElement(object value, CommentMode mode) { var newPlayByPlay = value as RCE.Services.Contracts.PlayByPlay; if (newPlayByPlay != null) { this.CommentMode = mode; if (mode == CommentMode.Timeline) { this.sequenceRegistry.CurrentSequence.Markers.Remove(this.playByPlay); } this.playByPlay = newPlayByPlay; if (mode == CommentMode.Timeline) { if (!this.sequenceRegistry.CurrentSequence.Markers.Contains(this.playByPlay)) { this.sequenceRegistry.CurrentSequence.Markers.Add(this.playByPlay); } } this.playByPlay.PropertyChanged += this.PlayByPlayPropertyChanged; this.SetPosition(TimeSpan.FromTicks(this.playByPlay.Time)); this.DisplayView.Close(); this.EditView.Close(); } }
/// <summary> /// Find and remove comments and whitespaces /// </summary> /// <param name="dataToParse"></param> /// <returns></returns> private static char[] RemoveComment(string dataToParse) { StringBuilder result = new StringBuilder(dataToParse.Length); bool stringMode = false; CommentMode commentMode = CommentMode.Disabled; for (int i = 0; i < dataToParse.Length; i++) { // Checks for string start if ((dataToParse[i] == '\"' || dataToParse[i] == '\'') && (i == 0 || dataToParse[i - 1] != '\\')) { stringMode = !stringMode; } // If not string if (!stringMode) { // Checks for comment start if (commentMode == CommentMode.Disabled && dataToParse[i] == '/') { switch (dataToParse[i + 1]) { case '/': commentMode = CommentMode.OneLine; break; case '*': commentMode = CommentMode.MultiLine; break; } } // Adds char to resulting string if it's not comment and whitespace if (commentMode == CommentMode.Disabled && !char.IsWhiteSpace(dataToParse[i])) { result.Append(dataToParse[i]); } // Checks for comment end if ((commentMode == CommentMode.OneLine && (dataToParse[i] == '\n' || dataToParse[i] == '\r')) || (commentMode == CommentMode.MultiLine && dataToParse[i - 1] == '*' && dataToParse[i] == '/')) { commentMode = CommentMode.Disabled; } } else { result.Append(dataToParse[i]); } } return(result.ToString().ToCharArray()); }
public void SetElement(object value, CommentMode mode) { Comment newComment = value as Comment; if (newComment != null) { this.sequenceRegistry.CurrentSequence.CommentElements.CollectionChanged -= this.CommentElements_CollectionChanged; this.sequenceRegistry.CurrentSequence.CommentElements.Remove(this.comment); this.sequenceRegistry.CurrentSequence.CommentElements.CollectionChanged += this.CommentElements_CollectionChanged; this.comment = newComment; this.Text = this.comment.Text; this.SetPosition(TimeSpan.FromSeconds(this.comment.MarkIn.GetValueOrDefault())); this.View.Close(); } }
public void SetVideoComments(CommentMode mode) { switch (mode) { case CommentMode.Anyone: form.AddField("privacy.comments", "anybody"); break; case CommentMode.NoOne: form.AddField("privacy.comments", "nobody"); break; case CommentMode.PeopleIFollow: form.AddField("privacy.comments", "contacts"); break; } }
public void SetElement(object value, CommentMode mode) { var newAdOpportunity = value as AdOpportunity; if (newAdOpportunity != null) { this.sequenceRegistry.CurrentSequence.AdOpportunities.Remove(this.adOpportunity); this.adOpportunity = newAdOpportunity; if (!this.sequenceRegistry.CurrentSequence.AdOpportunities.Contains(this.adOpportunity)) { this.sequenceRegistry.CurrentSequence.AdOpportunities.Add(this.adOpportunity); } this.SetPosition(TimeSpan.FromTicks(this.adOpportunity.Time)); this.View.Close(); } }
public void SetElement(object value, CommentMode mode) { var newMarker = value as Marker; if (newMarker != null) { this.sequenceRegistry.CurrentSequence.Markers.Remove(this.marker); this.marker = newMarker; if (!this.sequenceRegistry.CurrentSequence.Markers.Contains(this.marker)) { this.sequenceRegistry.CurrentSequence.Markers.Add(this.marker); } this.SetPosition(TimeSpan.FromTicks(this.marker.Time)); this.View.Close(); } }
public IReaderMode Read(int indention, string line) { if (line.IsEmpty()) return this; if (line.IsHeaderOne()) { _fixture.title = line.Trim().TrimStart('#', ' '); return this; } if (line.IsHeaderTwo()) { var grammar = new GrammarMode(_fixture, g => _fixture.AddGrammar(g)); grammar.Read(indention, line); return grammar; } var mode = new CommentMode(_fixture); mode.Read(indention, line); return mode; }
public LineCounter() : base("Line Counter") { InitializeComponent(); _winRegistryAccess = new LCWinRegAccess(this); _commentMode = _winRegistryAccess.CommentMode; _updateUiCallback = new UICallBack(UpdateUICounts); _logFile = DigitalProduction.Reflection.Assembly.LibraryPath + "\\log.txt"; _commentingStyleDirectory = DigitalProduction.Reflection.Assembly.LibraryPath + "\\Commenting Styles"; // Before we can do any reading and writing from the registry we have // to make sure that the installations has been done so that we done try // to read entries that are not there. This is mostly used for debugging // purposes. // Allows for the installation event to occur. Largely useful for debugging or resetting the software if the // registry gets messed up. _winRegistryAccess.RaiseInstallEvent(); _nProcessors = Convert.ToInt32(Environment.GetEnvironmentVariable("NUMBER_OF_PROCESSORS")); _threads = new Thread[_nProcessors]; _threadDoneEvents = new ManualResetEvent[_nProcessors]; // Load a list of commenting style configuration files from the hard drive into // the drop down box for commenting styles. The combo box selection change event // will file when this happens so we have to save and restore the last selected filter // index (which is reset during the change event) to create the desire behavior of saving // the filter string across instances. int lastFilterString = _winRegistryAccess.LastSelectedFilterString; LoadCommentingStyles(); _winRegistryAccess.LastSelectedFilterString = lastFilterString; // Set the comment mode. switch (_winRegistryAccess.CommentMode) { case CommentMode.FileExtension: { this.radbtnFileExtension.Checked = true; break; } case CommentMode.Specified: { this.radbtnSpecify.Checked = true; break; } default: { throw new Exception("Unrecognized comment mode."); } } SetCommentMode(_winRegistryAccess.CommentMode); #region Status Bar this.statusBar = new DigitalProduction.Forms.StatusBarWithProgress(); this.statusBarPanel1 = new System.Windows.Forms.StatusBarPanel(); this.statusBarPanel2 = new System.Windows.Forms.StatusBarPanel(); this.statusBarPanel3 = new System.Windows.Forms.StatusBarPanel(); this.statusBar.Location = new System.Drawing.Point(0, 488); this.statusBar.Name = "Status Bar"; this.statusBar.Panels.AddRange(new System.Windows.Forms.StatusBarPanel[] {this.statusBarPanel1, this.statusBarPanel3, this.statusBarPanel2}); this.statusBar.SetProgressBarPanel = 1; this.statusBar.ShowPanels = true; this.statusBar.Size = new System.Drawing.Size(492, 22); this.statusBar.TabStop = false; this.statusBarPanel1.AutoSize = System.Windows.Forms.StatusBarPanelAutoSize.None; this.statusBarPanel1.MinWidth = 80; this.statusBarPanel1.Text = "Ready."; this.statusBarPanel1.Width = 100; this.statusBarPanel3.AutoSize = System.Windows.Forms.StatusBarPanelAutoSize.Spring; this.statusBarPanel3.Style = System.Windows.Forms.StatusBarPanelStyle.OwnerDraw; this.statusBarPanel3.Width = 188; this.statusBar.ProgressBar.Visible = false; this.statusBar.ProgressBar.Step = 1; this.statusBar.ProgressBar.Minimum = 0; this.statusBarPanel2.Text = System.DateTime.Now.ToLongTimeString(); this.tmrClock.Interval = 1000; this.tmrClock.Enabled = true; this.tmrClock.Tick += new EventHandler(tmrClock_Tick); this.Controls.Add(this.statusBar); #endregion }
/// <summary> /// Initializes a new instance of the <see cref="PositionPayloadEventArgs"/> class. /// </summary> /// <param name="position">The position.</param> public PositionPayloadEventArgs(TimeSpan position, CommentMode source) { this.Position = position; this.Source = source; }
public void SetElement(object value, CommentMode mode) { throw new NotImplementedException(); }
public DeleteAllPreviewsPayload(CommentMode source) { this.Source = source; }
/// <summary> /// Saves the current configuration out to the config file. /// </summary> public void Save() { // Physical Paramters TomlTable physicalParameters = Toml.Create(); // Passes TomlInt passes = physicalParameters.Add("Passes", Passes).Added; passes.AddComment(" The number of times to run the complete etching path", CommentLocation.Append); // PixelSize TomlFloat pixelSize = physicalParameters.Add("PixelSize", PixelSize).Added; pixelSize.AddComment(" The size of each pixel (mm per pixel)", CommentLocation.Append); // OriginX TomlFloat originX = physicalParameters.Add("OriginX", OriginX).Added; originX.AddComment(" The X coordinate of the top-left corner, in mm", CommentLocation.Append); // OriginY TomlFloat originY = physicalParameters.Add("OriginY", OriginY).Added; originY.AddComment(" The Y coordinate of the top-left corner, in mm", CommentLocation.Append); // ZHeight TomlFloat zHeight = physicalParameters.Add("ZHeight", ZHeight).Added; zHeight.AddComment(" The Z height to set the laser cutter during etching, in mm", CommentLocation.Append); // TravelSpeed TomlFloat travelSpeed = physicalParameters.Add("TravelSpeed", TravelSpeed).Added; travelSpeed.AddComment(" The speed to move the head between etching operations (when the laser is off), in mm per minute", CommentLocation.Append); // EtchSpeed TomlFloat etchSpeed = physicalParameters.Add("EtchSpeed", EtchSpeed).Added; etchSpeed.AddComment(" The speed to move the head during etching operations (when the laser is on), in mm per minute", CommentLocation.Append); // G-code Commands TomlTable gCodeCommands = Toml.Create(); // LaserOffCommand TomlString laserOffCommand = gCodeCommands.Add("LaserOffCommand", LaserOffCommand).Added; laserOffCommand.AddComment(" The G-code command to turn the laser off", CommentLocation.Append); // LaserLowCommand TomlString laserLowCommand = gCodeCommands.Add("LaserLowCommand", LaserLowCommand).Added; laserLowCommand.AddComment(" The G-code command to turn the laser on, but at a low power level (used for the pre-etch trace preview)", CommentLocation.Append); // LaserHighCommand TomlString laserHighCommand = gCodeCommands.Add("LaserHighCommand", LaserHighCommand).Added; laserHighCommand.AddComment(" The G-code command to turn the laser on full power during etching", CommentLocation.Append); // MoveCommand TomlString moveCommand = gCodeCommands.Add("MoveCommand", MoveCommand).Added; moveCommand.AddComment(" The G-code command to use during moves", CommentLocation.Append); // CommentMode TomlString commentMode = gCodeCommands.Add("CommentMode", CommentMode.ToString()).Added; commentMode.AddComment(" The G-code comment format to use (Semicolon or Parentheses)", CommentLocation.Append); // HomeXY TomlBool homeXY = gCodeCommands.Add("HomeXY", HomeXY).Added; homeXY.AddComment(" True to home the X and Y axes at the start, false to leave them where they were and assume that they are already homed", CommentLocation.Append); // Pre-Etch Trace Preview TomlTable preEtchTracePreview = Toml.Create(); // IsBoundaryPreviewEnabled TomlBool isBoundaryPreviewEnabled = preEtchTracePreview.Add("IsBoundaryPreviewEnabled", IsBoundaryPreviewEnabled).Added; isBoundaryPreviewEnabled.AddComment(" True to perform the pre-etch boundary trace preview, false to disable it and get right to etching", CommentLocation.Append); // PreviewDelay TomlInt previewDelay = preEtchTracePreview.Add("PreviewDelay", PreviewDelay).Added; previewDelay.AddComment(" The delay, in milliseconds, to wait at the start and end of the pre-etch trace preview", CommentLocation.Append); TomlTable settingsTable = Toml.Create(); settingsTable.Add("Physical-Parameters", physicalParameters); settingsTable.Add("G-Code-Commands", gCodeCommands); settingsTable.Add("Pre-Etch-Trace-Preview", preEtchTracePreview); Toml.WriteFile(settingsTable, ConfigFileName); }
public CodeCommenter(CommentMode mode) { Mode = mode; CommentCarretLineIfNoSelection = true; }
/// <summary> /// Sets the comment mode. /// </summary> /// <param name="commentMode">CommentMode.</param> private void SetCommentMode(CommentMode commentMode) { _commentMode = commentMode; }
public void BeginComment(out CommentMode mode) { mode = new CommentMode(this, Scanning); }
public AddPreviewPayload(string registryKey, object value, CommentMode source) { this.RegistryKey = registryKey; this.Value = value; this.Source = source; }
private bool IsSourceSubClip(CommentMode source) { return(source == this.Mode); }
public MetadaSelectedPayload(EventData eventData, CommentMode commentMode) { this.EventData = eventData; this.CommentMode = commentMode; }
private bool IsSourceTimeline(CommentMode source) { return(source == this.Mode); }
public RemovePreviewPayload(string id, CommentMode source) { this.EventId = id; this.Source = source; }
/// <summary> /// Initializes a new instance of the <see cref="RefreshElementsEventArgs"/> class. /// </summary> /// <param name="refreshedWidth">The new width.</param> public RefreshElementsEventArgs(double?refreshedWidth, CommentMode mode) { this.RefreshedWidth = refreshedWidth; this.CommentMode = mode; }
private Token ReadNew() { CommentMode comment = CommentMode.None; int readInt; Token tmpToken; while ((readInt = _source.Read()) >= 0) { // Handle comment mode if (comment == CommentMode.Line) { if (readInt == '\n' || readInt == '\r') { comment = CommentMode.None; } continue; } else if (comment == CommentMode.Block) { if (readInt == '*') { if ((readInt = _source.Read()) == '/') { comment = CommentMode.None; } else if (readInt >= 0) { _source.PushBack(readInt); } } continue; } // Skip whitespaces if (char.IsWhiteSpace((char)readInt)) { continue; } long position = _source.Position; switch (readInt) { case '+': switch (readInt = _source.Read()) { case '+': return(new Token(TokenType.OperatorIncrement, position)); case '=': return(new Token(TokenType.OperatorAssignPlus, position)); default: if (readInt >= 0) { _source.PushBack(readInt); } return(new Token(TokenType.OperatorPlus, position)); } case '-': switch (readInt = _source.Read()) { case '-': return(new Token(TokenType.OperatorDecrement, position)); case '=': return(new Token(TokenType.OperatorAssignMinus, position)); default: if (readInt >= 0) { _source.PushBack(readInt); } return(new Token(TokenType.OperatorMinus, position)); } case '*': switch (readInt = _source.Read()) { case '=': return(new Token(TokenType.OperatorAssignTimes, position)); default: if (readInt >= 0) { _source.PushBack(readInt); } return(new Token(TokenType.OperatorTimes, position)); } case '/': switch (readInt = _source.Read()) { case '=': return(new Token(TokenType.OperatorAssignDivide, position)); case '/': comment = CommentMode.Line; break; case '*': comment = CommentMode.Block; break; default: if (readInt >= 0) { _source.PushBack(readInt); } return(new Token(TokenType.OperatorDivide, position)); } break; case '%': switch (readInt = _source.Read()) { case '=': return(new Token(TokenType.OperatorAssignModulo, position)); default: if (readInt >= 0) { _source.PushBack(readInt); } return(new Token(TokenType.OperatorModulo, position)); } case '(': return(new Token(TokenType.BracketLeft, position)); case ')': return(new Token(TokenType.BracketRight, position)); case '[': return(new Token(TokenType.SquareBracketLeft, position)); case ']': return(new Token(TokenType.SquareBracketRight, position)); case '{': return(new Token(TokenType.CurlyBracketLeft, position)); case '}': return(new Token(TokenType.CurlyBracketRight, position)); case ';': return(new Token(TokenType.EndOfInstruction, position)); case ',': return(new Token(TokenType.Comma, position)); case '.': // It might be a floating point number (in fact, iff it is follows by a digit) int nextInt = _source.Read(); if (nextInt >= 0) { _source.PushBack(nextInt); if (char.IsDigit((char)nextInt)) { // Since the next character is a digit, ProcessNumber_Float() cannot return null return(ProcessNumber_Float(position, new StringBuilder(), readInt)); } } return(new Token(TokenType.Period, position)); case ':': switch (readInt = _source.Read()) { case ':': return(new Token(TokenType.DoubleColon, position)); default: if (readInt >= 0) { _source.PushBack(readInt); } return(new Token(TokenType.Colon, position)); } case '<': switch (readInt = _source.Read()) { case '<': if ((readInt = _source.Read()) == '=') { return(new Token(TokenType.OperatorAssignLeftShift, position)); } if (readInt >= 0) { _source.PushBack(readInt); } return(new Token(TokenType.OperatorLeftShift, position)); case '=': return(new Token(TokenType.OperatorLessThanEqual, position)); default: if (readInt >= 0) { _source.PushBack(readInt); } return(new Token(TokenType.OperatorLessThan, position)); } case '>': switch (readInt = _source.Read()) { case '>': if ((readInt = _source.Read()) == '=') { return(new Token(TokenType.OperatorAssignRightShift, position)); } if (readInt >= 0) { _source.PushBack(readInt); } return(new Token(TokenType.OperatorRightShift, position)); case '=': return(new Token(TokenType.OperatorMoreThanEqual, position)); default: if (readInt >= 0) { _source.PushBack(readInt); } return(new Token(TokenType.OperatorMoreThan, position)); } case '!': switch (readInt = _source.Read()) { case '=': return(new Token(TokenType.OperatorNotEqual, position)); default: if (readInt >= 0) { _source.PushBack(readInt); } return(new Token(TokenType.OperatorLogicalNot, position)); } case '~': return(new Token(TokenType.OperatorBitwiseNot, position)); case '&': switch (readInt = _source.Read()) { case '&': return(new Token(TokenType.OperatorLogicalAnd, position)); case '=': return(new Token(TokenType.OperatorAssignBitwiseAnd, position)); default: if (readInt >= 0) { _source.PushBack(readInt); } return(new Token(TokenType.OperatorBitwiseAnd, position)); } case '|': switch (readInt = _source.Read()) { case '|': return(new Token(TokenType.OperatorLogicalOr, position)); case '=': return(new Token(TokenType.OperatorAssignBitwiseOr, position)); default: if (readInt >= 0) { _source.PushBack(readInt); } return(new Token(TokenType.OperatorBitwiseOr, position)); } case '^': switch (readInt = _source.Read()) { case '=': return(new Token(TokenType.OperatorAssignBitwiseXor, position)); default: if (readInt >= 0) { _source.PushBack(readInt); } return(new Token(TokenType.OperatorBitwiseXor, position)); } case '=': switch (readInt = _source.Read()) { case '=': return(new Token(TokenType.OperatorEqual, position)); default: if (readInt >= 0) { _source.PushBack(readInt); } return(new Token(TokenType.OperatorAssign, position)); } case '\'': switch (readInt = _source.Read()) { case '\'': throw new SyntaxException(_source.Position, "Empty character"); case '\\': switch (readInt = _source.Read()) { case '0': readInt = 0; break; case '\'': break; case '\\': break; case 'n': readInt = '\n'; break; case 'r': readInt = '\r'; break; case 't': readInt = '\t'; break; default: throw new SyntaxException(_source.Position, "Unrecognized escape sequence"); } break; } if (_source.Read() != '\'') { throw new SyntaxException(_source.Position, "Too many characters"); } return(new ValuedToken <string>(TokenType.DecInt, position, readInt.ToString())); default: if ((tmpToken = ProcessNumber(readInt)) != null) { return(tmpToken); } if ((tmpToken = ProcessName(readInt)) != null) { return(tmpToken); } if ((tmpToken = ProcessString(readInt)) != null) { return(tmpToken); } throw new SyntaxException(_source.Position, "Unrecognized character: " + (char)readInt); } } // We reached the end return(new Token(TokenType.EndOfDocument, _source.Position + 1)); }