I have richtextbox and preview dialog.
when I want to make a preview I want to see all the pages of the richtextbox but now I can see only the fist page many times.
please help me
char[] param = { '\n' };
string [] lines = {};
if (pd.PrinterSettings.PrintRange == PrintRange.Selection)
{
lines = rtb.SelectedText.Split(param);
}
else
{
lines = rtb.Text.Split(param);
}
int i = 0;
char[] trimParam = { '\r' };
foreach (string s in lines)
{
lines[i++] = s.TrimEnd(trimParam);
}
int linesPrinted = 0;
int x = e.MarginBounds.Left;
int y = e.MarginBounds.Top;
Brush brush = new SolidBrush(rtb.ForeColor);
while (linesPrinted < lines.Length)
{
e.Graphics.DrawString(lines[linesPrinted++],
rtb.Font, brush, x, y);
y += 15;
if (y >= e.MarginBounds.Bottom)
{
e.HasMorePages = true;
return;
}
else
{
e.HasMorePages = false;
}
}
Because if you have this method in the print page even, every time that a new page is printed you read again the content of the RichTextBox :
lines = rtb.Text.Split(param);
And you start again from the beginning ...
So you have to read the RichTextBox content only in the first page ...
To resolve this problem you can for example declare a variable outside of the method :
private int printPage = 0 ;
And externalize from the method the variables :
string [] lines = {};
int linesPrinted = 0;
The new code become (I haven't tested it - is only a proof of concept) :
if(printPage <= 0) {
//First Page
char[] param = { '\n' };
linesPrinted = 0;
if (pd.PrinterSettings.PrintRange == PrintRange.Selection)
{
lines = rtb.SelectedText.Split(param);
}
else
{
lines = rtb.Text.Split(param);
}
}
int i = 0;
char[] trimParam = { '\r' };
foreach (string s in lines)
{
lines[i++] = s.TrimEnd(trimParam);
}
int x = e.MarginBounds.Left;
int y = e.MarginBounds.Top;
Brush brush = new SolidBrush(rtb.ForeColor);
while (linesPrinted < lines.Length)
{
e.Graphics.DrawString(lines[linesPrinted++],
rtb.Font, brush, x, y);
y += 15;
if (y >= e.MarginBounds.Bottom)
{
e.HasMorePages = true;
printPage++;
return;
}
else
{
e.HasMorePages = false;
}
}
Related
How to implement the RichTextBox API, GetLineStartPosition, for a WPF TextBox UI Control?
var charpos_x1 = GetLineStartPosition(0); // get charpos start of the current line
var charpos_x2 = GetLineStartPosition(1); // get charpos start of the next line
var charpos_x3 = GetLineStartPosition(-1); // get charpos start of the prev line
A TextPointer is just a reference to a location in the content of the rich text. TextBox doesn’t expose that but you can use an integer representing the offset of the character in the text. So based on the docs for GetLineStartPosition I think something like the following may work:
public int? GetLineStartPosition(this TextBox tb, int charIndex, int count)
{
/// get the line # for character idx then adjust the line
/// number by the specified # of lines
var l = tb.GetLineIndexFromCharacterIndex(charIndex) + count;
/// if its not valid return null
if (l < 0 || l >= tb.LineCount) return null;
/// otherwise return the character index of the start
/// of the adjusted line
return tb.GetCharacterIndexFromLineIndex(l);
}
Then just use it like this:
tb.GetLineStartPosition(tb.CaretIndex, 0);
public struct LinePos_t
{
public int indexz; // Multiline TextBox.Line End-Position
public int index0; // n-Line Begin Position
public int index1; // n-Line End Position
public int len; // n-Line Length
public string str; // n-line String
};
private static LinePos_t TextBoxMultiline_GetLinePosition(
TextBox tb,
int n
)
{
// (n == 0): current Line
// (n == 1): next line
// (n == -1): prev line
// Notes: end of line marked by: "\r\n" for Textbox.Text
// User can never postion Cursor on '\n' character...
// but can position it on \r character
LinePos_t linepos = new LinePos_t();
int anchor;
int repeat;
string c;
tb.Focus();
if (tb.Text.Length == 0)
{
linepos.indexz = 0;
linepos.index0 = 0;
linepos.index1 = 0;
linepos.len = 0;
linepos.str = "";
return linepos;
}
// Position End of Text
linepos.indexz = tb.Text.Length;
if (linepos.indexz != 0)
linepos.indexz--;
// Position Init Carrot
if (tb.CaretIndex > linepos.indexz)
anchor = linepos.indexz;
else
anchor = tb.CaretIndex;
// Rewind when n is negative
if (n < 0)
{
repeat = -n;
for (int i = 0; i < repeat; i++)
{
anchor = tb.Text.LastIndexOfAny(new char[] { '\r' }, anchor);
if (anchor == -1)
{
anchor = 0;
break;
}
}
//Select Current Line
n = 0;
}
repeat = n + 1;
for (int i = 0; i < repeat; i++)
{
linepos.index0 = tb.Text.LastIndexOfAny(new char[] { '\n' }, anchor);
if (linepos.index0 == -1)
{
linepos.index0 = 0;
break;
}
else
{
linepos.index0++;
}
}
linepos.index1 = tb.Text.IndexOfAny(new char[] { '\n' }, anchor);
if (linepos.index1 == -1)
linepos.index1 = linepos.indexz;
// Length of Line
linepos.len = linepos.index1 - linepos.index0 + 1;
linepos.str = tb.Text.Substring(linepos.index0, linepos.len);
return linepos;
}
So i am trying to grab user input from my text boxes which are being printed to the screen through a loop and if Statements. When trying to print the values put into the textbox I only get one value. Here is the code for adding the textboxes to the grid:
private void InsertEasyNums()
{
int x = 70;
int y = 40;
for (int i = 0; i < 9; i++)
{
if (i == 3)
{
x = 70;
y = 160;
}
else if(i == 6)
{
x = 65;
y = 280;
}
if (easyNums[i] == '0')
{
DrawingField.SendToBack();
int panelX = x + 300;
int panelY = y + + 100;
Font newFont = new Font("Arial", 25);
Point tbLocation = new Point(panelX, panelY);
userInput[i] = new TextBox();
userInput[i].Name = "Row[i]TB";
userInput[i].Font = newFont;
userInput[i].Width = 50;
userInput[i].Location = tbLocation;
userInput[i].BorderStyle = BorderStyle.None;
userInput[i].BackColor = DefaultBackColor;
Controls.Add(userInput[i]);
DrawingField.SendToBack();
x = x + 145;
DrawingField.SendToBack();
}
else if (easyNums[i] != '0')
{
DrawingField.SendToBack();
Font drawFont = new Font("Arial", 30, FontStyle.Bold);
Brush Numbers = new SolidBrush(Color.Black);
Graphics g = DrawingField.CreateGraphics();
g.DrawString(Convert.ToString(easyNums[i]), drawFont,
Numbers, x, y);
x = x + 146;
}
}
}
Here is where I try to print the Textboxes:
foreach (Control c in DrawingField.Controls)
{
if (c is TextBox)
{
int i = 0;
TextBox txt = (TextBox)c;
string str = txt.Text;
TBValues[i] = str;
i++;
}
}
foreach (var key in TBValues)
{
MessageBox.Show(key);
}
ANSWER: I moved the declaration of userInput to the beginning of the method and looped through 9 time to give 9 textboxes then used the if statements to move them and change properties.
try to move i before the loop
int i = 0;
foreach (Control c in DrawingField.Controls)
{
if (c is TextBox)
{
TextBox txt = (TextBox)c;
string str = txt.Text;
TBValues[i] = str;
i++;
}
}
foreach (var key in TBValues)
{
MessageBox.Show(key);
}
I'm creating a new Picturebox via code, but now my TextBoxes don't give me any values. I think they went out of focus, or their controls aren't working anymore, here's the code so far:
private void button1_Click(object sender, EventArgs e)
{
int ErrorCode = 0;
string NewName = NewPointName.Text;
int X, Y;
Application.DoEvents();
if (NewPointName.Text == "")
ErrorCode = 1;
else
for (int i = 0; i < Names + 1; i++)
{
if (PointName[i] == NewName)
ErrorCode = 2;
}
if (ErrorCode > 0)
MessageBox.Show("Error " + ErrorCode);
else
{
if (Convert.ToInt32(NewPointXBox.Text) > 60)
X = 60;
else if (Convert.ToInt32(NewPointXBox.Text) < -60)
X = -60;
else if (NewPointXBox.Text == "")
X = 0;
else
X = Convert.ToInt32(NewPointXBox.Text);
if (Convert.ToInt32(NewPointYBox.Text) > 60)
Y = 60;
else if (Convert.ToInt32(NewPointYBox.Text) < -60)
Y = -60;
else if (NewPointYBox.Text == "")
Y = 0;
else
Y = Convert.ToInt32(NewPointYBox.Text);
Punkt.GiveName(NewName, Names);
Punkt.GiveCoordinates(X, Y, Names);
PointName[Names] = NewName;
NewPointName.Text = "";
NewPointXBox.Text = "";
NewPointYBox.Text = "";
Application.DoEvents();
UpdatePoint();
CreatePoint(X, Y, NewName, Names);
Names++;
ErrorCode = 0;
NewName = "";
}
}
public void CreatePoint(int X, int Y, string name, int i)
{
int StartPointX = 450, StartPointY = 450, Factor = 7;
if (RadioG6060.Checked)
{
StartPointX = 454;
StartPointY = 449;
Factor = 7;
}
Dot[i] = new PictureBox();
this.Controls.Add(Dot[i]);
Dot[i].Name = "PB_" + name;
Dot[i].Size = new Size(10, 10);
Dot[i].Image = Image.FromFile("../Dot.png");
Dot[i].Anchor = AnchorStyles.Left;
Dot[i].Location = new Point(StartPointX, StartPointY);
Dot[i].Visible = true;
InitializeComponent();
Dot[i].BringToFront();
Dot[i].Location = new Point(Dot[i].Location.X + (X * Factor), Dot[i].Location.Y - (Y * Factor));
Application.DoEvents();
}
I think it's the this.controls.Add(Dot[i]) that throws it off, because now I can't access the text in my NewPointName textbox.
How can I focus the program back on the form or do generally anything that could activate the boxes again?
I just solved the problem, I just had to leave out the InitializeComponent(), then it worked. Turns out that if you do that, the already existing components get blocked and can't be changed in any options of themselves anymore.
I have a text file data set with following format (the separation character is tab).
0 762354
1 645645
2 4356743
3 576899063
4 64378
.....
that I read it and save it in array by:
for (int klk = 0; klk <= 92159; klk++)
{
lineuserori = fileuserori.ReadLine();
if (!string.IsNullOrEmpty(lineuserori))
{
string[] valuesiesi = lineitemori.Split('\t');
int useridori;
foreach (string value in valuesiesi)
{
useridori = Convert.ToInt32(valuesiesi[1]);
d[klk] = useridori;
}
}
}
NOW, I want to read an input and search for it in array d, if the number exist in array, I do my calculation, if it is not in array show MessageBox.Show("Error");, the problem is, it always show output with every input (even the input does not exist in array) and never show MessageBox.Show("Error");
{
int sc = Convert.ToInt32(txtbx_id.Text);
int n = Convert.ToInt32(txtbx_noofrecomm.Text);
for (int yu = 0; yu <= 92161; yu++)
{
int wer = d[yu];
if (wer == sc)
{
userseq = yu;
break;
}
}
if (userseq >= 0 && userseq <= 92161)
{
var results = new List<float>(1143600);
for (int z = 0; z < 1143600; z++)
{
results.Add(dotproduct(userseq, z));
}
var sb1 = new StringBuilder();
foreach (var resultwithindex in results.Select((r, index) => new { result = r, Index = index }).OrderByDescending(r => r.result).Take(n))
{
sb1.AppendFormat(CultureInfo.InvariantCulture, "{0}: {1}", c[resultwithindex.Index], resultwithindex.result);
sb1.AppendLine();
}
MessageBox.Show(sb1.ToString());
}
if (userseq < 0 || userseq > 92161)
{
MessageBox.Show("Error");
}
}
Any idea
Thanks
In your code to create array , is lineitemori right?
I think, it should be lineuserori.
Replace this:
string[] valuesiesi = lineitemori.Split('\t');
with:
string[] valuesiesi = lineuserori.Split('\t');
I wrote code below. (some lines uses unknown variables commented out)
Input 762354 to txtbx_id and click button1 then empty MessageBox appeared.
Input 76235 to txtbx_id and click button1 then MessageBox say 'Error'.
public partial class Form1 : Form {
// form have three controls txtbx_id, txtbx_noofrecomm and button1.
int[] d = new int[92162];
string data =
"0\t762354\n"
+"1\t645645\n"
+"2\t4356743\n"
+"3\t576899063\n"
+"4\t64378\n";
public Form1() {
InitializeComponent();
using (var fileuserori = new StringReader(data)) { // use StringReader instead of StreamReader
string lineuserori = "";
for (int klk = 0; klk <= 92159; klk++) {
lineuserori = fileuserori.ReadLine();
if (!string.IsNullOrEmpty(lineuserori)) {
// string[] valuesiesi = lineitemori.Split('\t');
string[] valuesiesi = lineuserori.Split('\t');
int useridori;
foreach (string value in valuesiesi) {
useridori = Convert.ToInt32(valuesiesi[1]);
d[klk] = useridori;
}
}
}
}
}
private void button1_Click(object sender, EventArgs e) {
var userseq = -1;
int sc = Convert.ToInt32(txtbx_id.Text);
int n = Convert.ToInt32(txtbx_noofrecomm.Text);
for (int yu = 0; yu <= 92161; yu++) {
int wer = d[yu];
if (wer == sc) {
userseq = yu;
break;
}
}
if (userseq >= 0 && userseq <= 92161) {
var results = new List<float>(1143600);
for (int z = 0; z < 1143600; z++) {
// results.Add(dotproduct(userseq, z));
}
var sb1 = new StringBuilder();
foreach (var resultwithindex in results.Select((r, index) => new { result = r, Index = index }).OrderByDescending(r => r.result).Take(n)) {
// sb1.AppendFormat(CultureInfo.InvariantCulture, "{0}: {1}", c[resultwithindex.Index], resultwithindex.result);
// sb1.AppendLine();
}
MessageBox.Show(sb1.ToString());
}
if (userseq < 0 || userseq > 92161) {
MessageBox.Show("Error");
}
}
}
Hi I'm currently working on a importer for a C# / XNA application and I need some help with filtering out the input( a List of string where each line is a "new" string) into smaller chunks(smaller List of string).
This is a sample of how the input is divided into "frames" with the mesh and camera data necessary to create a "keyframe".
num_frames 4
start 1
end 24
frame_rate 24
frame 1
meshes 2
name pCube1
color F:/MayaImporterExporter/ImporterExporter/Bin/Textures/image2.gif
bump F:/MayaImporterExporter/ImporterExporter/Bin/Textures/images.jpg
bumpDepth 1
vertices 36
meshData...
name pCube2
color NONE
bump none
bumpDepth 0
vertices 36
meshData...
cameras 1
name persp
cameraData...
frame 5
meshes 2
name pCube1
color F:/MayaImporterExporter/ImporterExporter/Bin/Textures/image2.gif
bump F:/MayaImporterExporter/ImporterExporter/Bin/Textures/images.jpg
bumpDepth 1
vertices 36
meshData...
name pCube2
color NONE
bump none
bumpDepth 0
vertices 36
meshData...
cameras 1
name persp
cameraData...
frame 10
meshes 2
name pCube1
color F:/MayaImporterExporter/ImporterExporter/Bin/Textures/image2.gif
bump F:/MayaImporterExporter/ImporterExporter/Bin/Textures/images.jpg
bumpDepth 1
vertices 36
meshData...
name pCube2
color NONE
bump none
bumpDepth 0
vertices 36
meshData...
cameras 1
name persp
cameraData...
frame 24
meshes 2
name pCube1
color F:/MayaImporterExporter/ImporterExporter/Bin/Textures/image2.gif
bump F:/MayaImporterExporter/ImporterExporter/Bin/Textures/images.jpg
bumpDepth 1
vertices 36
meshData...
name pCube2
color NONE
bump none
bumpDepth 0
vertices 36
meshData...
cameras 1
name persp
cameraData...
so the things i need to do is:
Split the input down into a smaller list containing the mesh and camera data for each keyframe .
Split the keyframe data into two lists( one for the meshes, and one to the cameras).
split the meshes/cameras into a List of List of Strings.
create the meshes and cameras form the "List of List of Strings"(I know this part ).
So I need some help to figure out how to filter out the input data into smaller chunks to create the meshes and cameras from the input.
You can use something similar to this:
var lines = File.ReadAllLines( path )
.Select( s => s.Trim( ) )
.Where( s => s.Length > 0 ).ToArray( );
int index = 0;
void Next() { index++; }
bool Peek(string token ) { return lines[index].StartsWith( token ) ;}
string ReadStringValue ( ) {
var value = lines[index].Split( ' ' )[1];
Next( );
return value;
};
string ReadIntValue () {
var value = lines[index].Split( ' ' )[1];
Next( );
return int.Parse(value);
};
Header ReadAnimation() {
var anim= new Animation();
while (index<lines.Length)
{
if (Peek("num_frames")) anim.NuMFrames = ReadIntValue();
if (Peek("start")) ....
if (Peek("frame")) anim.AddFrame( ReadFrame() );
}
}
Frame ReadFrame() {
if (Peek("frame")) {
var frame = new Frame();
frame.Index = ReadIntValue();
ReadMeshes( frame );
ReadCameras( frame );
return frame;
}
return null;
}
void ReadMeshes(Frame frame)
{
if (Peek("meshes")) {
int count = ReadIntValue();
for (int i =0; i<count; i++) {
frame.Meshes.Add( ReadMesh() );
}
}
}
Mesh ReadMesh() {
....
}
After some failed attempts on successfully implement the importer, I finally figured out how to make it work.
namespace Importer
{
class ImportHandler
{
List<string> inputString;
Readanyfile read= new Readanyfile();
int num_frames, start, end, frame_rate;
GraphicsDevice graphicsDevice;
classes_stat.KeyFrameAnimation Animation;
public ImportHandler(GraphicsDevice graphicsDevice, Game game,string _inputFile)
{
this.graphicsDevice = graphicsDevice;
this.inputString = read.Load();
ReadRawScene();
}
string ReadStringValue(string str)
{
var value = str.Split(' ')[1];
return value;
}
public int strToInt(string str)
{
var value = str.Split(' ')[1];
return int.Parse(value);
}
public float strToFloat(string str)
{
var value = str.Split(' ')[1];
return float.Parse(value);
}
public double strToDouble(string str)
{
var value = str.Split(' ')[1];
try
{
return double.Parse(value, System.Globalization.CultureInfo.InvariantCulture);
}
catch
{
return (double) 0.1f;
}
}
private static float[] ParseFloatArray(string str, int count)
{
var floats = new float[count];
var segments = str.Split(' ');
for (int i = 0; i < count; i++)
{
if (i < segments.Length)
{
try
{
floats[i] = (float)double.Parse(segments[i], System.Globalization.CultureInfo.InvariantCulture);
}
catch
{
floats[i] = 0;
}
}
}
return floats;
}
private Vector2 ParseVector2(string str)
{
var components = ParseFloatArray(str, 3);
var vec = new Vector2(components[0], components[1]);
return components[2] == 0
? vec
: vec / components[2];
}
private Vector3 ParseVector3(string str)
{
var components = ParseFloatArray(str, 4);
var vec = new Vector3(components[0], components[1], components[2]);
return components[3] == 0
? vec
: vec / components[3];
}
public void ReadRawScene()
{
List<classes_stat.KeyFrame> tempAni = new List<classes_stat.KeyFrame>();
for (int i = 0; i < inputString.Count(); i++ )
{
if (inputString[i].StartsWith("num_frames"))
{
num_frames = strToInt(inputString[i]);
}
if (inputString[i].StartsWith("start"))
{
start = strToInt(inputString[i]);
}
if (inputString[i].StartsWith("end"))
{
end = strToInt(inputString[i]);
}
if (inputString[i].StartsWith("frame_rate"))
{
frame_rate = strToInt(inputString[i]);
}
if (inputString[i].StartsWith("frame"))
{ tempAni.Add(ReadFrames(strToInt(inputString[i]), i, inputString));
}
Animation = new classes_stat.KeyFrameAnimation(frame_rate, start, end, num_frames, tempAni);
}
}
public classes_stat.KeyFrame ReadFrames(int frameIndex,int currentIndex, List<string> inputString )
{
List<MeshFromBinary> tempOutPutMesh = new List<MeshFromBinary>();
List<CameraFromBinary> tempOutPutCam = new List<CameraFromBinary>();
for (int i = currentIndex + 3; i < inputString.Count(); i++)
{
if (inputString[i].StartsWith("meshes"))
{
int count = strToInt(inputString[i]);
for (int x = 0; x < count; x++)
{
MeshFromBinary temp = ReadMeshes(i, inputString);
tempOutPutMesh.Add(temp);
}
}
if (inputString[i].StartsWith("cameras"))
{
int count = strToInt(inputString[i]);
for (int x = 0; x < count; x++)
{
tempOutPutCam.Add(ReadCameras(i, inputString));
}
}
if (inputString[i].StartsWith("frame"))
{
break;
}
}
classes_stat.KeyFrame frame = new classes_stat.KeyFrame(frameIndex, tempOutPutMesh, tempOutPutCam);
return frame;
}
private MeshFromBinary ReadMeshes(int currentIndex, List<string> inputString)
{
int tempCurrentIndex = 0;
List<classes_stat.MyOwnVertexFormat> temp = new List<classes_stat.MyOwnVertexFormat>();
string name;
Texture2D color = ContentTextures.crateTexture;
Texture2D bump = ContentTextures.crateTexture;
double bumpDepth = 0;
List<Vector3> tmpPos = new List<Vector3>();
List<Vector3> tmpNor = new List<Vector3>();
List<Vector3> tmpTan = new List<Vector3>();
List<Vector2> tmpUV = new List<Vector2>();
int numberofvertices = 0;
for (int i = currentIndex; i < inputString.Count(); i++)
{
if (inputString[i].StartsWith("name"))
{
name = ReadStringValue(inputString[i]);
}
if (inputString[i].StartsWith("color"))
{
string tmp = ReadStringValue(inputString[i]);
System.IO.FileStream stream = new System.IO.FileStream(tmp, System.IO.FileMode.Open);
color = Texture2D.FromStream(graphicsDevice, stream);
stream.Close();
stream.Dispose();
//temp.Add(ReadStringValue());
}
if (inputString[i].StartsWith("normalMap"))
{
string tmp = ReadStringValue(inputString[i]);
System.IO.FileStream stream = new System.IO.FileStream(tmp, System.IO.FileMode.Open);
bump = Texture2D.FromStream(graphicsDevice, stream);
stream.Close();
stream.Dispose();
}
if (inputString[i].StartsWith("bumpDepth"))
{
bumpDepth = strToDouble(inputString[i]);
}
if (inputString[i].StartsWith("vertices"))
{
numberofvertices = strToInt(inputString[i]);
}
if (inputString[i].StartsWith("v"))
{
tempCurrentIndex = (i - 1);
break;
}
}
for (int i = tempCurrentIndex; i < inputString.Count(); i++)
{
if (inputString[i].StartsWith("v"))
{
tmpPos.Add(ParseVector3(inputString[i]));
}
if (inputString[i].StartsWith("vn"))
{
tmpNor.Add(ParseVector3(inputString[i]));
}
if (inputString[i].StartsWith("t"))
{
tmpTan.Add(ParseVector3(inputString[i]));
}
if (inputString[i].StartsWith("vt"))
{
tmpUV.Add(ParseVector2(inputString[i]));
}
if (inputString[i].StartsWith("cameras"))
{
break;
}
if (inputString[i].StartsWith("name"))
{
break;
}
}
for (int i = 0; i < numberofvertices; i++)
{
temp.Add(new classes_stat.MyOwnVertexFormat(tmpPos[i], tmpNor[i], tmpTan[i], tmpUV[i]));
}
MeshFromBinary mMesh;
return mMesh = new MeshFromBinary(graphicsDevice, temp, color, bump, bumpDepth);
}
private CameraFromBinary ReadCameras(int currentIndex, List<string> inputString)
{
int tempCurrentIndex = 0;
CameraFromBinary temp;
string name;
Vector3 tmpPos = new Vector3();
Vector3 tmpDir = new Vector3();
Vector3 tmpUp = new Vector3();
double tmpV_FOV = new double();
double tmpH_FOV = new double();
double tmpNear_clipping_plane = new double();
double tmpFar_clipping_plane = new double();
double tmpAspect_ratio = new double();
for (int i = currentIndex; i < inputString.Count(); i++)
{
if (inputString[i].StartsWith("name"))
{
System.Console.WriteLine(ReadStringValue(inputString[i]));
name = ReadStringValue(inputString[i]);
tempCurrentIndex = (i + 1);
break;
}
}
for (int i = tempCurrentIndex; i < inputString.Count(); i++)
{
if (inputString[i].StartsWith("eye"))
{
tmpPos = ParseVector3(inputString[i]);
}
else if (inputString[i].StartsWith("up"))
{
tmpUp = ParseVector3(inputString[i]);
}
else if (inputString[i].StartsWith("rotXYZ"))
{
tmpDir = ParseVector3(inputString[i]);
}
else if (inputString[i].StartsWith("v_fov"))
{
tmpV_FOV = strToDouble(inputString[i]);
}
else if (inputString[i].StartsWith("h_fov"))
{
tmpH_FOV = strToDouble(inputString[i]);
}
else if (inputString[i].StartsWith("near_clipping_plane"))
{
tmpNear_clipping_plane = strToDouble(inputString[i]);
}
else if (inputString[i].StartsWith("far_clipping_plane"))
{
tmpFar_clipping_plane = strToDouble(inputString[i]);
}
else if (inputString[i].StartsWith("aspect_ratio"))
{
tmpAspect_ratio = strToDouble(inputString[i]);
}
else if (inputString[i].StartsWith("frame"))
{
break;
}
else if (inputString[i].StartsWith("cameras"))
{
break;
}
else if (inputString[i].StartsWith("name"))
{
break;
}
}
return temp = new CameraFromBinary(tmpPos, tmpDir, tmpV_FOV, tmpAspect_ratio, tmpNear_clipping_plane, tmpFar_clipping_plane);
}
}
}