Advertisement Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

201 Neutral

About musafir2007

  • Rank
  1. Hi, another small discovery..   If I open the above SimpleFlaFile in Notepad++, and then go to Encoding > Convert to UTF-8, it then shows the same content that notepad shows and I can parse. If notepad++ can do this by converting, then there must be some way using c#.   Anyone know how this converting works? thanks!!
  2. thanks, but I don't want to do that since I have to parse almost 300+ files.   I also noticed that windows notepad somehow figures out the encoding of the .fla and displays some useful information which if I can just get into C# string will make my life so much easier.   I have tried almost every encoding available to open a file, but can't get text that notepad shows string allText = File.ReadAllText("C:\\SimpleFlaFile.fla", Encoding.UTF8);   I have attached a simple fla file (just change ext to .txt because I can't upload .fla) with a Clip named "BlueBox" and when you open the fla in notepad, and search it has text "B l u e B o x". I can parse files if I can get that...
  3. Hi, I have about 500 flash files that I need to search for various imported components. There is a program called "Windows Grep", which is able to search through the fla and find the name of the component I am looking for, but searching is tedious since I have to do each one manually.   I am trying to do a simple search in C#, using string fileContent = File.ReadAllText(@"C:\MyFile.fla"); richTextBox1.Text = fileContent;   but this just prints: ?   I feel like this has to do something with encoding, but I am not sure how. Can someone help me with this.   Thanks, Shivam
  4. Hi, just curious what would it take to write a script in python to download music from say I would just provide a list of [Song, Artist] and it would download them for me.   (ps. I am not trying to illegally download music, just curious ;)
  5. Hi all,   I have way too many pictures on my PC and they are everywhere. I am sure many of you have same problem. I am attempting to create a simple program to organize them a bit and minimizing manual work, but unfortunately there will still be some.   Please take a look through this code and let me know if you have any suggestions. I am not very happy with how different pictures with same name is handled. How can I improve this code?   Thanks! //Start Execution here... private void startBtn_Click(object sender, EventArgs e) { DirectoryInfo di = new DirectoryInfo("C:\\srcPictures"); WalkDirectoryTree(di); } private void WalkDirectoryTree(System.IO.DirectoryInfo root) { FileInfo[] files = null; DirectoryInfo[] subDirs = null; // First process files under root folder files = root.GetFiles("*.*"); Logger("Processing Files under: " + root.FullName); if (files != null) { foreach (FileInfo fi in files) { string picTakenOn = getDateTaken(fi, false); string targetDir = ""; if (picTakenOn.Contains("DATETAKEN")) { picTakenOn = picTakenOn.Replace("DATETAKEN", ""); targetDir = "C:\\organizedPictures\\" + picTakenOn + "\\"; if (!Directory.Exists(targetDir)) { Directory.CreateDirectory(targetDir); } copyFileToDestination(fi, fi.FullName, targetDir + fi.Name); } else if (picTakenOn.Contains("DATEMODIFIED")) { picTakenOn = picTakenOn.Replace("DATEMODIFIED", ""); targetDir = destDirectory.Text + "\\Sorted_DateModified\\" + picTakenOn + "\\"; if (!Directory.Exists(targetDir)) { Directory.CreateDirectory(targetDir); } Logger("DATEMODIFIED used instead of DATETAKEN for: " + fi.FullName); copyFileToDestination(fi, fi.FullName, targetDir + fi.Name); } else if (picTakenOn.Contains("INVALID")) { Logger("Not an image (Skipped): " + fi.FullName); } } // Resursion for all subdirectories subDirs = root.GetDirectories(); foreach (System.IO.DirectoryInfo dirInfo in subDirs) { WalkDirectoryTree(dirInfo); } } } private void copyFileToDestination(FileInfo srcInfo, string sourcePath, string destPath) { if (File.Exists(destPath)) //Same file name already exists { FileInfo destInfo = new FileInfo(destPath); if (srcInfo.Length != destInfo.Length) //If different images (check by filesize) { Logger("FILENAME conflict for: " + sourcePath); copyFileToDestination(srcInfo, sourcePath, destPath + "_dup" + srcInfo.Extension); } else { Logger("SKIPPED copy (Dup found) for: " + sourcePath); } } else { File.Copy(sourcePath, destPath); } } private string getDateTaken(FileInfo fi, bool includeDate) { if (fi.Extension != ".jpeg" && fi.Extension != ".jpg" && fi.Extension != ".JPEG" && fi.Extension != ".JPG") return "INVALID"; Regex r = new Regex(":"); FileStream fs = new FileStream(fi.FullName, FileMode.Open, FileAccess.Read); Image myImage = Image.FromStream(fs, false, false); try { PropertyItem propItem = myImage.GetPropertyItem(36867); //36867 is for Date taken string dateTaken = r.Replace(Encoding.UTF8.GetString(propItem.Value), "-", 2).Split(' ')[0]; return ("DATETAKEN" + dateTaken.Split('-')[0] + "-" + dateTaken.Split('-')[1]); } catch { string dateModified = fi.LastWriteTime.ToString(); return ("DATEMODIFIED" + dateModified.Split(' ')[0].Split('/')[2] + "-" + dateModified.Split(' ')[0].Split('/')[1]); } } public void Logger(String lines) { //Set the log file string logFile = "C:\\organizedPictures\\log.txt"; System.IO.StreamWriter file = new System.IO.StreamWriter(logFile, true); file.WriteLine(lines); file.Close(); }
  6. musafir2007

    got an interview with EA

    guys, I got the job! I really appreciate all the feedback, and I have to say part the reason was gamedev. Just by browsing the forums I learn so much.. we have a great community and contributors on here! :)
  7. musafir2007

    got an interview with EA

    thanks Hodgman! I will take your advice and look into making that.   I would also appreciate if someone could elaborate on • Integrate art content into the front end game engine. • Develop tools, features and pipelines for the front end logic and screens.   how does one develop tools, pipelines for front end logic and screens. What does this mean? thank
  8. Hi, I have got a phone interview with EA in couple days. For this job   My issue is that I have 2 years experience in Software testing and some development. But I have never worked on Games.. I did a openGL project in school but that's it. I really want to this job and have always dreamed about working at EA. Can someone give me any hints by looking at the description what I should concentrate on to prepare? thanks!
  9.   Hi, I am new to python and trying to write a class similar to to the defaultdict class. I am little stuck on the constructor. On the python website example they first create a the defaultdict object with type as parameter, and then fill it. Example d = defaultdict(list) and then input "key,value"   If I directly pass "s" when creating object, it seems to be fine, but how can I make it similar to how it's really implemented. Thanks for help! class MyDictionary(dict): #Parent class is "dict"     'This is a derived class from python dict'       def __init__(self, default_factory=None): # implement the parameters correctly         dict.__init__(self, default_factory)         #self.default_factory = default_factory       #def anotherMethod-ToDo-forexmaple-d[10],handle if key doesn't exist          s = [('yellow', 1), ('blue', 2), ('yellow', 3), ('blue', 4), ('red', 1)] d = MyDictionary(list)   for k, v in s:     d[k].append(v)      print (d.items())
  10. musafir2007

    simple char array, please help

    I really like the following way of doing it, and it seems to work on new compiler, But my c compiler doesn't seem to support snprintf. What alternative do i have? Thanks!   #include <stdio.h> #include <stdlib.h> #include <string.h>   void getNetworkAtPriority(char* buffer, size_t bufferLength) {     snprintf(buffer, bufferLength, "mcc-mnc-umts"); }   int main() {     char entry1[14];     getNetworkAtPriority(entry1, 14);     printf("Return:%s", entry1);     return 0; }
  11. musafir2007

    simple char array, please help

    Thanks all! what if I want to try this with global variable?   why [mod edit: are these] not working?   #include <stdio.h> #include <stdlib.h> #include <string.h>   char entry1[14];   char* getNetworkAtPriority() {     char returnValue[14];     sprintf( returnValue, "mcc-mnc-umts");     return returnValue; }   int main() {     entry1 = getNetworkAtPriority( "1" );     return 0; }   #include <stdio.h> #include <stdlib.h> #include <string.h>   char entry1[14];   char* getNetworkAtPriority() {     char returnValue[14];     sprintf( returnValue, "mcc-mnc-umts");     return returnValue; }   int main() {     strcpy(entry1, getNetworkAtPriority());     printf("Return:%s", entry1);     return 0; }   #include <stdio.h> #include <stdlib.h> #include <string.h>   char entry1[14];   void getNetworkAtPriority() {     sprintf( entry1, "mcc-mnc-umts");     //return returnValue; }   int main() {     //strcpy(entry1, getNetworkAtPriority());     printf("Value:%s", entry1);     return 0; }
  12. Hi, I am trying to simple return a string but I get this error: In function 'getNetworkAtPriority': warning: function returns address of local variable In function 'main': error: incompatible types in assignment   Please help what I am doing wrong? thanks #include <stdio.h> #include <stdlib.h> #include <string.h> char * getNetworkAtPriority( ) {     char returnValue[14]; sprintf( returnValue, "mcc-mnc-umts");     return returnValue; } int main() { char entry1[14]; entry1 = getNetworkAtPriority( "1" ); return 0; }
  13. musafir2007

    Help split simple string in c

    thanks for your replies! KnolanCross, I will study your way later. For now I tried this:     char *mcc;     char *mnc;     char readLine[8];       sprintf( readLine, "310:030" );       mcc = strtok(readLine, ":");     mnc = strtok(NULL, ":");       printf("Just testing: %s:%s\n", mcc, mnc);       return 0; Hope this is ok way of doing it.
  14. Hi, I have to split simple string in c. char readLine[7]; //Get from a file, Examples: "001:330", "01:330", "01:33", "333:01" char num1[3]; char num2[3];   //How can I get for example num1="001", num2="330" I am not good with char manupalation. Please help me how I can split with delimiter ":" I think should be easy since I know the line from file can be at most 7 characters, and in above format, so I don't need to do any other handling.   Thanks for your help!
  15. Hi, I am trying to get some information for Web request'fred'   For example I have curl code:   curl -D- -u fred:fred -X GET -H "Content-Type: application/json" http://kelpie9:8081/rest/api/2/search?jql=assignee=fred   and I want a equivalent of this in c#. But I keep getting "The remote server returned an error: (400) Bad Request." what's wrong with my request parameters? HttpWebRequest request = WebRequest.Create("http://kelpie9:8081/") as HttpWebRequest; request.Credentials = new NetworkCredential("username", "password"); request.Method = "GET"; request.ContentType = "application/json";   WebResponse response = request.GetResponse();
  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!